-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel.asm
55 lines (46 loc) · 1.15 KB
/
level.asm
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; void unpackLevel(byte <al> levelNumber)
;
; Loads the read-only level information into working memory.
unpackLevel:
pusha
mov si, leveldata ; find the level data for the number
dec al
mov dx, level.width * level.height
mov ah, 0
mul dx
add si, ax
mov di, uninitialized.currentLevel
mov cx, level.width * level.height
rep movsb
popa
ret
; void drawLevel(void)
; Expects ES to point to buffer A
;
; Reads the brick objects from the array and displays them to the screen.
drawLevel:
pusha
mov dx, field.xMin
mov bx, field.yMax
mov si, uninitialized.currentLevel
mov cx, level.width * level.height
.readBrick:
lodsb
cmp al, btype.NULL ; skip entry if block type is null
je .nextPosition
push cx
mov cl, al
mov ax, dx
call drawBrick
pop cx
.nextPosition:
add dx, brick.width
cmp dx, field.xMax
jb @f
mov dx, field.xMin
sub bx, brick.height
@@:
loop .readBrick
.end:
popa
ret