Search code examples
assemblymasmtasm

what do these lines do in assembly?


I am quite new to assembly. I am always confused by the numbers Can someone please help me ? I am using TASM... so 8066 assembler Is there any good reference that I can use?

SCREEN_CLEARER:
mov ax,1720h
mov cx,2000
mov bx,0
L2:
mov es:[bx],ax
add bx,2
loop L2
ret

I don't really get what 1720h, 2000 are. I also not quite sure how to read move es:[bx],ax

Thank you very much


Solution

  • Looks like DOS-code, trying to fill the (text) screen buffer or so ..., IIRC ax would be character (0x20 == ' ' == space) combined with the text attributes (0x17 == foreground/background color).

    The 2000 would be 80x25 ;)

    es would for this purpose point to the screen buffer.

    L2:
    mov es:[bx],ax
    add bx,2
    loop L2
    

    moves the character and attribute (in ax) into each word from es:[0] for 2000 words (== 2 bytes) until cx becomes 0 (that's the meaning of the loop opcode).