This is my assembly code. It draws a pink square 32x32 from position 0. My goal is to make a checkboard pattern. Can you finish the code so it does that. This is a 16bit simulator of assembly. Only four registers for arithematics. draw1: MOV A, 2 ; Set the bitmap mode . OUT 7 MOV A, 3 ; Clear the video memory . OUT 7 MOV C, 0 NOT D MUL 32 MOV B, D draw2: MOV A, B OUT 8 MOV A, 238 OUT 9 ADD B, 1 ; paints ADD C, 1 ;increments counter CMP C, 32 JZ row CMP C, 64 JZ row CMP C, 96 JZ row CMP C, 128 JZ row CMP C, 160 JZ row CMP C, 192 JZ row CMP C, 224 JZ row CMP C, 256 JZ row CMP C, 288 JZ row CMP C, 320 JZ row CMP C, 352 JZ row CMP C, 384 JZ row CMP C, 416 JZ row CMP C, 448 JZ row CMP C, 480 JZ row CMP C, 512 JZ row CMP C, 544 JZ row CMP C, 576 JZ row CMP C, 608 JZ row CMP C, 640 JZ row CMP C, 672 JZ row CMP C, 704 JZ row CMP C, 736 JZ row CMP C, 768 JZ row CMP C, 800 JZ row CMP C, 832 JZ row CMP C, 864 JZ row CMP C, 896 JZ row CMP C, 928 JZ row CMP C, 960 JZ row CMP C, 992 JZ row CMP C, 1024 JZ row JMP draw2 row: ADD B, 256 SUB B, 32 CMP C, 1024 JZ exit JMP draw2: exit: HLT Note: Try to follow the syntax like i did so that i can compile it when i get the result.
This is my assembly code. It draws a pink square 32x32 from position 0. My goal is to make a checkboard pattern. Can you finish the code so it does that. This is a 16bit simulator of assembly. Only four registers for arithematics.
draw1:
MOV A, 2 ; Set the bitmap mode .
OUT 7
MOV A, 3 ; Clear the video memory .
OUT 7
MOV C, 0
NOT D
MUL 32
MOV B, D
draw2:
MOV A, B
OUT 8
MOV A, 238
OUT 9
ADD B, 1 ; paints
ADD C, 1 ;increments counter
CMP C, 32
JZ row
CMP C, 64
JZ row
CMP C, 96
JZ row
CMP C, 128
JZ row
CMP C, 160
JZ row
CMP C, 192
JZ row
CMP C, 224
JZ row
CMP C, 256
JZ row
CMP C, 288
JZ row
CMP C, 320
JZ row
CMP C, 352
JZ row
CMP C, 384
JZ row
CMP C, 416
JZ row
CMP C, 448
JZ row
CMP C, 480
JZ row
CMP C, 512
JZ row
CMP C, 544
JZ row
CMP C, 576
JZ row
CMP C, 608
JZ row
CMP C, 640
JZ row
CMP C, 672
JZ row
CMP C, 704
JZ row
CMP C, 736
JZ row
CMP C, 768
JZ row
CMP C, 800
JZ row
CMP C, 832
JZ row
CMP C, 864
JZ row
CMP C, 896
JZ row
CMP C, 928
JZ row
CMP C, 960
JZ row
CMP C, 992
JZ row
CMP C, 1024
JZ row
JMP draw2
row:
ADD B, 256
SUB B, 32
CMP C, 1024
JZ exit
JMP draw2:
exit:
HLT
Note: Try to follow the syntax like i did so that i can compile it when i get the result.
Step by step
Solved in 3 steps