-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSMISC.ASM
More file actions
149 lines (138 loc) · 3.24 KB
/
SMISC.ASM
File metadata and controls
149 lines (138 loc) · 3.24 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
;;Chris Busch
;;shared code between caves and scrolls engines
;;;;;;;void dimout()
dimout:
ld a,$1F ;;;(CONTRAST)
dimmer:
out (2),a
nop
halt
nop
dec a
cp 0
jr nz,dimmer
ld a,(CONTRAST)
out (2),a
ret
;;end dimout
;;putstr(l=row,h=col,DE=string)
;;;;;;;;ld HL,$0003
putstr:
ld (CURSOR_ROW),HL
ld HL,(PROGRAM_ADDR)
add HL,DE
ROM_CALL(D_ZT_STR)
ret
;;checks for high score
checkhiscore:
ld hl,(hiscore) ;checkfor new hiscore{
ld de,(score)
call CP_HL_DE
ret nc
ld hl,modebits ;;aug 1996
set newhiscorebit,(hl) ;;
ld hl,(score)
ld (hiscore),hl ;
ret
;;;;;end checkhiscore
;;;;;;;;;;showmap
;;;;uses what is in graph memory to make a single pixel per byte
;;;;map in the upper left hand corner of display screen
showmap:
ld hl,(player+sprxyoffhl)
ld de,-(32*16)-(16)
add hl,de ;;;hl->map data offset
ld a,h
and 3 ;modulo 1024
ld h,a
ld DE,GRAPH_MEM
add hl,de
push hl
pop de
;ld DE,GRAPH_MEM+(10*32)+13 ;source
ld HL,VIDEO_MEM ;dest
ld b,32 ;rows
process_rows:
push bc ;push rows
ld b,4 ;cols 4*8=32 columns
process_cols:
push bc ;push columns
ld c,0
ld b,8 ;process 8 bytes at a time
process_byte:
ld a,(de) ;examine a map byte
inc de
push hl
ld hl,GRAPH_MEM+(32*32)
call CP_HL_DE
jr nz,nomodulo
ld de,GRAPH_MEM ;modulo arond
nomodulo:
pop hl
rl c ;rotate left thru carry into c
res 0,c ;if 0 char or killableand then need to have 0 pixel
or a
jr z,skip_setpix ;it is zero leave it off
and killableand
or a
jr nz,skip_setpix ;it is killable so leave it off
set 0,c
skip_setpix:
djnz process_byte ;dec b until 0
ld a,c
ld (hl),a ;store 8 pixels
inc hl ;adv dest
pop bc ;cols
djnz process_cols
ld bc,12
add hl,bc ;newline of pixels
pop bc ;pop rows
djnz process_rows
ret ;end of function
;;;;;;;showmap2
;;;;;;;will rename to tourmap
;;;;;;;will have this do getkey and use cursor keys
;;;;;;;this shows the map to the user
tourMap:
ld hl,(player+sprxyoffhl)
ld de,-(levelwidth*4)-(dispwidth/2)
add hl,de ;;;hl->map data offset
showmapmore:
ld a,h
and 3
ld h,a
push hl
CALL_(refresh)
halt
;DEBUG16(hl)
call GET_KEY
pop hl
cp K_UP
jr nz,notupkey
ld bc,-32
add hl,bc
jr showmapmore
notupkey:
cp K_DOWN
jr nz,notdownkey
ld bc,32
add hl,bc
jr showmapmore
notdownkey:
cp K_LEFT
jr nz,notleftkey
dec hl
jr showmapmore
notleftkey:
cp K_RIGHT
jr nz,notrightkey
inc hl
jr showmapmore
notrightkey:
cp K_CLEAR
ret z
cp K_EXIT
ret z
jr showmapmore
;;end of function
;;end of code