-
Notifications
You must be signed in to change notification settings - Fork 1
/
_TERM2.asm
412 lines (411 loc) · 4.54 KB
/
_TERM2.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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
;
ORG #8000
;
SCROLL EQU #0E00
;
MENU
DI
CALL #0DAF
LD HL,0
LD (AT_Y),HL
;
LD HL,MESS1
CALL PRINTMESS
;
EI
L10
RES 5,(IY+1)
G01
BIT 5,(IY+1)
JR Z,G01
LD A,(IY-50)
RES 5,(IY+1)
CP "c"
JR Z,CONNECT
CP "q"
JP Z,QUIT
JR L10
QUIT
LD HL,MESS3
CALL PRINTMESS
RET
;
CONNECT
LD HL,MESS2
CALL PRINTMESS
;
DI
LD A,1
OUT (#F7),A
LD A,1
OUT (#F7),A
LD A,#40
OUT (#F7),A
LD A,#4E
OUT (#F7),A
;
MAINLOOP
LD A,#16
OUT (#F7),A
CALL RXBLOCK
CALL PRINTBLOCK
LD A,#33
OUT (#F7),A
CALL READLN
CALL TXBLOCK
JR MAINLOOP
;
RXBLOCK
DI
LD HL,#C000
R1
LD A,#16
OUT (#F7),A
CALL RXBYTE
OR A
JR NZ,R1
R2
LD A,#16
OUT (#F7),A
CALL RXBYTE
OR A
JR Z,R2
JR R3
;
RXBLOCK1
LD A,#16
OUT (#F7),A
CALL RXBYTE
R3
LD (HL),A
INC HL
CP #1A
JR NZ,RXBLOCK1
EI
RET
;
PRINTBLOCK
LD HL,#C000
PRINTBLOCK1
LD A,(HL)
CP #1A
RET Z
CP 13
JR Z,PRI
CP 32
JR C,PRI2
PRI
CALL PRINT64
PRI2
INC HL
JR PRINTBLOCK1
;
RXBYTE
CALL #1F54
JP NC,BREAK4
IN A,(#F7)
AND #38
JR NZ,RXBYTE1
IN A,(#F7)
BIT 1,A
JR Z,RXBYTE
RXBYTE1
IN A,(#77)
RET
BREAK
XOR A
OUT (#F7),A
BREAK2
LD HL,MESS4
CALL PRINTMESS
EI
LD B,200
MEEE HALT
DJNZ MEEE
CALL GETKBD
JP MENU
BREAK4
POP HL
BREAK3
POP HL
JR BREAK
;
READLN
LD HL,#C000
READLN1
CALL GETKBD
CP #0D
JR Z,READLN_CR
CP 12
JR Z,READLN_BS
CP #20
JR C,READLN1
LD (HL),A
INC HL
CALL PRINT64
JR READLN1
READLN_CR
LD (HL),A
INC HL
LD (HL),#1A
JP PRINT64
READLN_BS
LD A,L
OR A
JR NZ,READLN_BS1
LD A,H
CP #C0
JR Z,READLN1
READLN_BS1
DEC HL
PUSH HL
LD A," "
CALL PRINT_CHAR
;
LD HL,AT_X
LD A,(HL)
AND A
JR Z,CUR0
DEC (HL)
CONTCUR
LD A,8
CALL PRINT_CHAR
CON2
POP HL
JR READLN1
;
CUR0
LD (HL),63
DEC HL
DEC (HL)
LD A,(HL)
AND A
JR Z,CON2
JR CONTCUR
;
TXBLOCK
DI
LD HL,#C000
LD B,16
T1
LD A,#33
OUT (#F7),A
XOR A
CALL TXBYTE
DJNZ T1
;
TXBLOCK1
LD A,#33
OUT (#F7),A
LD A,(HL)
CALL TXBYTE
INC HL
CP #1A
JR NZ,TXBLOCK1
CALL TXBYTE
CALL TXBYTE
CALL TXBYTE
CALL TXBYTE
CALL TXBYTE
CALL TXBYTE
CALL TXBYTE
EI
RET
;
TXBYTE
PUSH AF
TXBYTE1
CALL #1F54
JP NC,BREAK3
IN A,(#F7)
BIT 0,A
JR Z,TXBYTE1
POP AF
OUT (#77),A
RET
GETKBD
EI
RES 5,(IY+1)
GETKBD1
BIT 5,(IY+1)
JR Z,GETKBD1
CALL #1F54
JP NC,BREAK4
LD A,(IY-50)
RES 5,(IY+1)
RET
;
MESS1
DEFB "--------------------------------",13
DEFB "Welcome to SPECCY/AMIGA BBS v1.0",13
DEFB "Copyright 1994 by Rst7 & (R)soft",13
DEFB "BBS phone is 110564 (Dima)",13
DEFB "--------------------------------",13
DEFB "Press <C> to CONNECT or <Q> to Quit",13
DEFB 13,0
MESS2
DEFB 13
DEFB "You are connected...",13
DEFB "--------------------",13,0
MESS3
DEFB 13,"Good bye...",13,0
MESS4
DEFB 13
DEFB "------ B R E A K -------"
DEFB 13
DEFB "You have been disconnecting...",13
DEFB "Press any key to return.",13
DEFB 0
;
PRINTMESS
LD A,(HL)
AND A
RET Z
CALL PRINT64
INC HL
JR PRINTMESS
;
PRINT64
PUSH AF
PUSH BC
PUSH DE
PUSH HL
CP 13
JR Z,ENTER
CALL PRINT_CHAR
LD HL,AT_X
INC (HL)
BIT 6,(HL)
JR Z,NO_NEXT_AT_Y
ENTER2
LD HL,AT_X
LD (HL),0
DEC HL
INC (HL)
;
LD A,(HL)
CP 24
JR C,NO_NEXT_AT_Y
DEC (HL)
LD BC,#1700
CALL SCROLL
NO_NEXT_AT_Y
LD A,8
CALL PRINT_CHAR
POP HL
POP DE
POP BC
POP AF
RET
;
ENTER
LD A," "
CALL PRINT_CHAR
JR ENTER2
;
PRINT_CHAR
SRL A
PUSH AF
LD H,0
LD L,A
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD DE,FONT
ADD HL,DE
EX DE,HL
CALL ADDR_OF_OUT64
LD B,8
JR C,PRINT_IN_RIGHT
POP AF
JR NC,WITH_RIGHT
PRINT_IN_LEFT
WITH_LEFT
LD A,(HL)
AND #0F
LD C,A
LD A,(DE)
AND #0F
RLCA
RLCA
RLCA
RLCA
OR C
LD (HL),A
INC DE
INC H
DJNZ WITH_LEFT
RET
WITH_RIGHT
LD A,(HL)
AND #0F
LD C,A
LD A,(DE)
AND #F0
OR C
LD (HL),A
INC DE
INC H
DJNZ WITH_RIGHT
RET
PRINT_IN_RIGHT
POP AF
JR NC,WITH_RIGHT2
WITH_LEFT2
LD A,(HL)
AND #F0
LD C,A
LD A,(DE)
AND #0F
OR C
LD (HL),A
INC DE
INC H
DJNZ WITH_LEFT2
RET
WITH_RIGHT2
LD A,(HL)
AND #F0
LD C,A
LD A,(DE)
AND #F0
RLCA
RLCA
RLCA
RLCA
OR C
LD (HL),A
INC DE
INC H
DJNZ WITH_RIGHT2
RET
;
ADDR_OF_OUT64
LD A,(AT_Y)
LD H,0
LD L,A
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD A,(AT_X)
RRA
PUSH AF
LD B,0
LD C,A
ADD HL,BC
RL H
RL H
RL H
SET 6,H
POP AF
RET
;
AT_Y DEFB 0
AT_X DEFB 0
;
FONT
*$FNT4*8
;
EOF