-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitvars.asm
More file actions
27 lines (23 loc) · 821 Bytes
/
Copy pathinitvars.asm
File metadata and controls
27 lines (23 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
;Initializes AMOUNT_OF_SQUARES_HORIZONTAL, HORIZONTAL_OFFSET, AMOUNT_OF_SQUARES_VERTICAL, VERTICAL_OFFSET
proc InitVars
xor dx, dx
mov ax, SCREEN_WIDTH
div [SQUARE_SIZE]
mov [AMOUNT_OF_SQUARES_HORIZONTAL], ax; SCREEN_WIDTH / SQUARE_SIZE
mov [HORIZONTAL_OFFSET], dl; SCREEN_WIDTH % SQUARE_SIZE
xor dx, dx
mov ax, SCREEN_HEIGHT
div [SQUARE_SIZE]
mov [AMOUNT_OF_SQUARES_VERTICAL], ax; SCREEN_HEIGHT / SQUARE_SIZE
mov [VERTICAL_OFFSET], dl; SCREEN_HEIGHT % SQUARE_SIZE
mov ax, SCREEN_HEIGHT
sub al, dl; dl == VERTICAL_OFFSET from previus calculation
mov [LEN_VERTICAL], ax; SCREEN_HEIGHT - (SCREEN_HEIGHT % SQUARE_SIZE)
;SCREEN_WIDTH > FFH, calculation needs to occur inside a word
mov ax, SCREEN_WIDTH
xor bh, bh
mov bl, [HORIZONTAL_OFFSET]
sub ax, bx
mov [LEN_HORIZONTAL], ax;
ret
endp initVars