I have a simple drawing program, when pressing arrow keys, a pixel "snake" moves to that direction. My problem that the program works on 200x255 pixels but I would like to make it work on 200x 320 pixels. So I need to store the x coordinate in a 16 bit register instead of 8 bit one (max 255 pixels). I tried to rewrite it but this stuff is a little bit too advanced to me because of the pixel calculation and I can't find help.
Draw: //I calculate the pixel position like Pixel = Y * 320 + X
pop dx
xor ah, ah
mov al, dh
push dx
mov bx, 320
mul bx
pop dx
add al, dl
jnc Pixel
inc ah
Pixel: //Color and stuff
push dx
mov di, ax
mov al, [si]
mov es:[di], al
//I read input key and then decide where to display pixel
Left:
pop dx
dec dl
cmp dl, 1
jnc Store
inc dl
jmp Store
Right: //I need 320 and 16 bit register here instead of dl
pop dx
inc dl
cmp dl, 250
jc Store
dec dl
jmp Store
Up:
pop dx
dec dh
cmp dh, 1
jnc Store
inc dh
jmp Store
Down:
pop dx
inc dh
cmp dh, 200
jc Store
dec dh
jmp Store
Store:
push dx
jmp Draw
Thank you so much for your help