-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSCRLVL.ASM
More file actions
180 lines (161 loc) · 4.42 KB
/
SCRLVL.ASM
File metadata and controls
180 lines (161 loc) · 4.42 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#include "ti-85.h"
#include "smacros.asm"
;;offsets
titlesub =5
mainsub =14
;;;;;;;;;;title
.org 0
.db " LVL",0 ;;<- file name will be placed in there!
;;;;;;;;;;;main
main:
ld hl,(PROGRAM_ADDR) ; {
ld de,picdata ;
add hl,de ;
ld (picptr),hl ; }load picptr
ld hl,(PROGRAM_ADDR) ; }
ld de,lvldata ;
add hl,de ;
ld (levelptr),hl ; }load levelptr
ld a,'Z' ; {
ld (levelnumand),a ; }load lvland .db 1
ld a,'X' ; {
ld (passarg),a ; }load passargs
savedhiscore:
ld hl,0 ; { load saved hiscore (its 0 here)
ld (hiscore),hl ; } hiscore=savehiscore
ROM_CALL(CLEARLCD) ;
ld hl,$0002 ;
ld de,comment ;
CALL_(putstr) ;
wait: ;
call GET_KEY ;
cp 0 ;
jr z,wait ;
CALL_(findengine) ;
checkhiscore: ;
ld ix,(PROGRAM_ADDR) ;
ld de,savedhiscore+1 ;
add ix,de ;
ld l,(ix+0) ;;load lo byte
ld h,(ix+1) ;;load hi byte
ld de,(hiscore) ;checkfor new hiscore{
call CP_HL_DE
ret nc ;;no new hiscore
;;;;;;;;;;hope ix -> savedhiscore
;;;;;;;;;;hope hl = hiscore
ld (ix+0),e ;set lo byte
ld (ix+1),d ;set hi byte
ld a,(firstname) ;;{is the first name not 0
or a ;;
jr z,nonewname ;;}
ld hl,(PROGRAM_ADDR) ;
ld de,yourname ;
add hl,de ;hl->yourname
ld de,firstname ;de->firstname
ex de,hl
ld bc,3 ;
ldir ;copy the 3 bytes
nonewname: ;
ld hl,ZS_BITS ;;{
set 0,(hl) ;;}perform checksum again
ret
;;;;;;;;end main
VARNLEN =$8083
VARNAME =$8084
FINDVAR =$2715
;;findlevel1()
findengine:
ld de,lvlname
ld hl,(PROGRAM_ADDR)
add hl,de
ld a,(hl)
inc a
inc a
ld b,a
ld de,VARNLEN
findlevel1:
ld a,(hl)
ld (de),a
inc de
inc hl
djnz findlevel1 ;;name should be copied.
rst 10h
jr c,notfound
;;;;;;;;;;;;;;;;;;;;de->string data
ld hl,(PROGRAM_ADDR)
push hl
ld hl,titlesub
add hl,de ;hl->SENGINE title
ld (PROGRAM_ADDR),hl
ld de,mainsub
add hl,de ;hl->SENGINE program
ld a,(hl) ;;;;;;;;!!!!!!!!!!!!
cp 76h ;;;;;;;halt instruction???
jr z,itshalt
pop hl
ld (PROGRAM_ADDR),hl
jr notfound
itshalt:
;;;;;;;;;;PROGRAM_ADDR==SENGINE_ADDR!!
CALL_( mainsub)
pop hl
ld (PROGRAM_ADDR),hl
ret
notfound:
ld hl,$0006
ld de,needstr
CALL_(putstr)
ld hl,$0007
ld de,lvlname+1
CALL_(putstr)
wait2:
call GET_KEY
cp 0
jr z,wait2
ret
;;end findlevel
;;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
;;printnum(hl=number,b=col,c=row)
printnum:
ld (CURSOR_ROW),bc
ROM_CALL(D_HL_DECI)
ret
;;end printnum
needstr .db "NEEDS:",0
lvlname .db 7,"SENGINE",0
;;;;;;123456789012345678901
comment:
.db " Official levels! " ;;<-- comment line!
.db "Scrolls LVL - C Busch" ;;<-- comment line
.db " Top player is "
yourname: .db "you. "
.db "SLVL4.0(C)1996 CBusch",0
;;;;savehiscore .dw 0 ;;saved hiscore
;;;;lvland .db 1
picdata:
;#include "pics.asm"
lvldata:
;#include "level1.asm"
.END
;;end of program
;;;;;;;;;old load levelnumand
; ;ld hl,(PROGRAM_ADDR) ; {
; ;ld de,lvland ;
; ;add hl,de ;
; ;ld a,(hl) ;
; ;ld (levelnumand),a ; }load levelnumand
;;;;;;;;;;;;;;;;old load hiscore code
;; ld hl,(PROGRAM_ADDR) ; {
;; ld de,savehiscore ;
;; add hl,de ;
;; ld e,(hl) ;
;; inc hl ;
;; ld d,(hl) ;
;; ld (hiscore),de ; }load old hiscore