Day 23




Inputting Numbers


	Inputting numbers was asked for recently on the Win32ASM boards, I figured
I should mention it here.

Services Used

We will use INT 21h, Function 1. INT 16h can also be used, it would probably be better to use INT 16h, because it's a BIOS call (not dependant on DOS), but we'll use INT 21h anyway...

The Code

Here it is: ;--CODE START--; mov ah,1 int 21h ; returns ASCII code in AL sub al,30h ; '1' the char, -30h will equal 1 (the number) ;--CODE END--;

This Day In Review

Very simple. Although this only works with 1 digit numbers, there's no reason why you can't write a subroutine to input longer numbers... Happy Coding!, - GbaGuy
Intro - Day 24

Patater GBAGuy Mirror
Contact