The C code:
Code: Select all
//NUM=320*200 (yes I know it will basically never finish)
do {
for (i = 0; ; i++){ //note, this compiles and works. I've simplified it as much as possible to make it simple to convert to assembly
if(i>=NUM){
break;
}
values[i]++;
if(values[i]!=0){
break;
}
print_val();
}
} while (i < NUM);
Code: Select all
main_loop:
;ds:0 is start of `values` array
mov bx,0 ;i=0
.inner:; for(..) {
cmp bx,320*200
jge .exit_loop ;i>=320*200 then break
inc byte [bx] ;values[i]++
cmp byte [bx],0
jne .exit_loop ;values[i]!=0 then break
inc bx ;i++
;inc bx
jmp .inner ;}
.exit_loop:
cmp bx,320*200
jl main_loop ;i<num
.exit: