bits 16 org 100h section .text MOV AH,0 MOV AL,12h ;video mode 12. 640x480 graphics INT 10h MOV AH,0Ch ;set pixel MOV AL,01 ;first color. leave BH as 0!!! MOV DI,0Ah ;offset NextSqr: MOV CX,1E0h ;480. Top of squares loop SUB CX,DI ;480-offset ending coord MOV [200h],CX ;save to mem for reuse of DI MOV CX,DI ;starting column MOV DX,DI ;starting row MOV [202h],DI ;save offset MOV DI,[200h] ;restore 480-offset to DI toprow: INT 10h INC CX ;top line rightward CMP CX,DI ;until right side column JL toprow rightcol: INT 10h INC DX ;right line down CMP DX,DI ;until bottom row JL rightcol bottomrow: MOV DI,[202h] ;restore offset to DI INT 10h DEC CX ;bottom row leftward CMP DI,CX ;until left side column JL bottomrow leftrow: INT 10h DEC DX ;left line upward CMP DI,DX ;until top row JL leftrow INC AL ;next color ADD DI,0Ah ;new offset, smaller inner square CMP DI,0F0h JL NextSqr ;wait for any key press: MOV AH,10h INT 16h ;reset to video mode 2: so can Alt Enter back to a window MOV AH,00 MOV AL,02 INT 10h ;exit to DOS mov ah, 4ch int 21h ;INT 20 section .data section .bss