assembly - how to print char on the screen -
i try make '#' left side of screen , other side '$' it's not stop on 25*40
.model tiny .code .startup cld mov ax, 0b800h ;for open screen mov es, ax mov di, 0 mov cx, 25*40 ;try divide screen mov ax, 5c23h rep stosw mov ax, 0b800h mov ds, ax mov si,0 mov cx, 25*40 mov ax, 6f24h rep stosw .exit end
.model tiny .code .startup cld mov ax, 0b800h ;for open screen mov es, ax xor di, di ; di = 0 mov dx, 25 ; lines counter line_loop: mov cx, 40 mov ax, 5c23h rep stosw mov cx, 40 mov ax, 6f24h rep stosw dec dx jnz line_loop .exit end
for fun , exercise power of xor
you, shorter variant of code (try step on in debugger or head , understand how works):
... xor di, di ; di = 0 mov dx, 50 ; 50 half-lines fill mov ax, 5c23h ; start '#' half_line_loop: mov cx, 40 rep stosw xor ax, 3307h ; 5c23 xor 3307 = 6f24, 6f24 xor 3307 = 5c23 dec dx jnz half_line_loop ...
Comments
Post a Comment