-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteletyper.asm
139 lines (107 loc) · 2.38 KB
/
teletyper.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
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
.module TELETYPE
_DATAL = OUSER+0
_DATAH = OUSER+1
_CURSORX = OUSER+2
_CURSORY = OUSER+3
_SCRPL = OUSER+4
_SCRPH = OUSER+5
_AFTERL = OUSER+6
_AFTERH = OUSER+7
_TIMER = OUSER+8
TTRATE = 2
teletypergameover:
ld (iy+_DATAL),failedtext & 255
ld (iy+_DATAH),failedtext / 256
ld (iy+_AFTERL),attract & 255
ld (iy+_AFTERH),attract / 256
ld (iy+_CURSORY),4-1
call _newlinetest
jr _teletype
teletypercongrat:
ld (iy+_DATAL),congrattext & 255
ld (iy+_DATAH),congrattext / 256
ld (iy+_AFTERL),gamemain & 255
ld (iy+_AFTERH),gamemain / 256
ld (iy+_CURSORY),-1
call _newlinetest
; fall in
_teletype:
ld (iy+_SCRPL),l
ld (iy+_SCRPH),h
call cls
ld hl,ttfont
ld de,UDG
call decrunch
ld hl,0
ld (scrollpos),hl
_ttloop:
ld (iy+_TIMER),TTRATE
ld l,(iy+_SCRPL)
ld h,(iy+_SCRPH)
ld (hl),$3f
-: YIELD
dec (iy+_TIMER)
jr nz,{-}
ld (iy+_TIMER),TTRATE
ld l,(iy+_SCRPL)
ld h,(iy+_SCRPH)
ld (hl),$00
-: YIELD
dec (iy+_TIMER)
jr nz,{-}
ld l,(iy+_SCRPL)
ld h,(iy+_SCRPH)
ld e,(iy+_DATAL)
ld d,(iy+_DATAH)
ld a,(de)
inc de
ld (iy+_DATAL),e
ld (iy+_DATAH),d
cp $3d
jr z,_done ; end of text
cp $3e
call z,_newlinetest ; returns with new screen pointer and character if n/l hit
ld (hl),a
inc hl
ld (iy+_SCRPL),l
ld (iy+_SCRPH),h
and a
jr z,_ttloop
ld a,SFX_TT
call AFXPLAY
jr _ttloop
_done:
ld (iy+_TIMER),0
-: YIELD
ld l,(iy+_SCRPL)
ld h,(iy+_SCRPH)
ld a,(iy+_TIMER)
bit 2,a
ld a,0
jr nz,{+}
ld a,$3f
+: ld (hl),a
dec (iy+_TIMER)
ld hl,pressfiretext+1
bit 6,(iy+_TIMER)
jr nz,{+}
ld hl,BOTTOM_LINE+4
+: ld de,BOTTOM_LINE+1+4
ld bc,31
ldir
+: ld a,(fire)
cp 1
jr nz,{-}
ld c,(iy+_AFTERL)
ld b,(iy+_AFTERH)
call objectafterhead
DIE
_newlinetest:
ld a,(iy+_CURSORY)
inc a
ld (iy+_CURSORY),a
call mulby600
ld hl,D_BUFFER-1
add hl,de
ld a,$3f
ret