flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 22 Feb 2010, 05:26
Is this a homework assignment?
|
|||
![]() |
|
DOS386 22 Feb 2010, 08:28
manjaru wrote: hope you will solve it immedeatly NOT before you reveal what the problem is ![]() Quote: .. thanks!! godbless Some hints: 1. Add comments a) What register holds what ??? b) What call to INT $21 or $16 does what ??? 2. Remove dead code 3. Recheck termination |
|||
![]() |
|
adroit 22 Feb 2010, 20:18
You need to add some comments on the instructions that are used. They help "debuggers" with actually knowing what the problem is with the code, or what the code does.
Quote: Some hints: _________________ meshnix |
|||
![]() |
|
bitshifter 23 Feb 2010, 06:36
Ultimately you want to collect input for each number into buffer.
Then process it and print the result. That way you wouldnt be limited to numbers less than 99 as result. Anyway, i put some notes and made it work, somehow :S Code: ; make .COM program org 100h ; enter 80*25 video mode mov ax,03h int 10h ; print prompt to enter first 2 digit number mov dx, message mov ah,9 int 21h ; get 10'ths of first number xor ah,ah int 16h mov bh,al ; get 1'ths of first number xor ah,ah int 16h mov bl,al ; print prompt to enter second 2 digit number mov ah,9 int 21h ; get 10'ths of second number xor ah,ah int 16h mov ch,al ; get 1'ths of second number xor ah,ah int 16h mov cl,al ; print header for results mov dx, result mov ah,9 int 21h ; -statecheck- ; ; BH = 10.ths of first number ; BL = 1'ths of first number ; CH = 10'ths of second number ; CL = 1'ths of second number ; ; add numbers together (very cheezy) add bl,cl sub bl,30h add bh,ch sub bh,30h cmp bl,'9' jle label_x inc bh label_x: ; print 10'ths of result mov dl,bh mov ah,2 int 21h ; print 1'ths of result mov dl,bl mov ah,2 int 21h ; wait for user to press any key xor ah,ah int 16h ; exit back to operating system int 20h ; dos strings _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.