model small declaring this code will be consists of one data segment and one code segment Then distinguishing label & procedure can be done easily. if multiple label and procedure is present in assembly code. Here at first, indicating start of label and $ indicating start of procedure. PARAMETER : SI = POINTING TO STRING TO FILL.įrom now on you can use number2string and dollars to display numbers. USED BEFORE CONVERT NUMBERS TO STRING, BECAUSE Inc cx INCREASE COUNTER FOR EVERY DIGIT EXTRACTED. Push dx PRESERVE DIGIT EXTRACTED FOR LATER. Mov bx, 10 DIGITS ARE EXTRACTED DIVIDING BY 10.ĭiv bx DX:AX / 10 = AX:QUOTIENT DX:REMAINDER. THEM IN STACK, THEN EXTRACT THEM IN REVERSE ALGORITHM : EXTRACT DIGITS ONE BY ONE, STORE Here is your code displaying numbers from 0 to 100 (the comments will help you to understand it). Added proc dollars, to fill numstr with dollar signs (necessary to display, and to clear the string before converting the next number).Added proc number2string, to convert a number in AX to the string pointed by SI ( this is the most important).Added variable lbk (just a line break after each number).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |