Search code examples
asciiassemblymasmtasm

ASCII code interpretation (assembly)


First of all, thanks for all the help thus far.

Complete code can be found here

I have trouble understanding these lines. I wrote some comments...

The line, for example, mov es:[si+6], al means move data in al to the memory address marked by si+6 (I think this would be an offset calculation).

Then what is add si,40 in the loop?

Any helps mean everything to me! Thank you.

L0_95:         ; this segment prints ASCII code 0 - 95
mov si,6       ; refers to the string we declared at the beginning
mov cx,4       ; I think this is the height?

C1A:
; this loop adds the name of the column
mov al,string[0]
mov es:[si],al
mov al,string[2]
mov es:[si+6],al
mov al,string[4]
mov es:[si+24],al
mov al,string[6]
mov es:[si+28],al
add si,40           ;;;; what is this line?
loop C1A

mov si,122          ;;;; and these three lines?
mov bx,0
mov cx,4
C1B:push cx  

mov cx,24
add si,40
C1C:push cx
call DEC_CONVERT
add si,2
call HEX_CONVERT
add si,2
call BIN_CONVERT
add si,2
call CHAR_CONVERT
inc bx
add si,126
pop cx
loop C1C
pop cx
sub si,3840
loop C1B

ret

L96_191:

Solution

  • add si advances the si register by 40.
    mov si,122 sets the si register to 122, probably the address of some data. The remaining two instructions should now be self-explanatory.