I try to make '#' left side of the screen and the other side will be '$' but 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 to 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 and to exercise the power of xor
for you, shorter variant of code (try to step over it in debugger or head and understand how it works):
...
XOR DI, DI ; DI = 0
MOV DX, 50 ; 50 half-lines to fill
MOV AX, 5C23H ; start with '#'
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
...