Browse Source

added KERNAL_TED_04

master
Michael Steil 3 months ago
parent
commit
670c3b8a34
77 changed files with 8614 additions and 1 deletions
  1. 0
    0
      KERNAL_TED_04/assem.src
  2. 0
    0
      KERNAL_TED_04/banking.src
  3. 0
    0
      KERNAL_TED_04/channelio.src
  4. 0
    0
      KERNAL_TED_04/clall.src
  5. 0
    0
      KERNAL_TED_04/close.src
  6. 0
    0
      KERNAL_TED_04/cmds1.src
  7. 0
    0
      KERNAL_TED_04/cmds2.src
  8. 806
    0
      KERNAL_TED_04/declare.src
  9. 0
    0
      KERNAL_TED_04/disasm.src
  10. 0
    0
      KERNAL_TED_04/disclaim.src
  11. 417
    0
      KERNAL_TED_04/ed1.src
  12. 0
    0
      KERNAL_TED_04/ed2.src
  13. 0
    0
      KERNAL_TED_04/ed3.src
  14. 0
    0
      KERNAL_TED_04/ed4.src
  15. 0
    0
      KERNAL_TED_04/ed5.src
  16. 0
    0
      KERNAL_TED_04/ed6.src
  17. 0
    0
      KERNAL_TED_04/ed7.src
  18. 0
    0
      KERNAL_TED_04/errorhdlr.src
  19. 0
    0
      KERNAL_TED_04/init.src
  20. 0
    0
      KERNAL_TED_04/interrupt.src
  21. 0
    0
      KERNAL_TED_04/kernal.src
  22. 0
    0
      KERNAL_TED_04/load.src
  23. 0
    0
      KERNAL_TED_04/messages.src
  24. 0
    0
      KERNAL_TED_04/music.src
  25. 0
    0
      KERNAL_TED_04/open.src
  26. 264
    0
      KERNAL_TED_04/openchanl.src
  27. 0
    0
      KERNAL_TED_04/overflow.src
  28. 0
    0
      KERNAL_TED_04/patches.src
  29. 0
    0
      KERNAL_TED_04/rs232.src
  30. 0
    0
      KERNAL_TED_04/save.src
  31. 0
    0
      KERNAL_TED_04/serial.src
  32. 0
    0
      KERNAL_TED_04/split.src
  33. 0
    0
      KERNAL_TED_04/tapred.src
  34. 0
    0
      KERNAL_TED_04/tapsup.src
  35. 0
    0
      KERNAL_TED_04/tapwrt.src
  36. 0
    0
      KERNAL_TED_04/time.src
  37. 0
    0
      KERNAL_TED_04/util.src
  38. 69
    0
      KERNAL_TED_04/vectors.src
  39. 254
    0
      KERNAL_TED_05/assem.src
  40. 198
    0
      KERNAL_TED_05/banking.src
  41. 255
    0
      KERNAL_TED_05/channelio.src
  42. 75
    0
      KERNAL_TED_05/clall.src
  43. 154
    0
      KERNAL_TED_05/close.src
  44. 307
    0
      KERNAL_TED_05/cmds1.src
  45. 167
    0
      KERNAL_TED_05/cmds2.src
  46. 0
    0
      KERNAL_TED_05/declare.src
  47. 258
    0
      KERNAL_TED_05/disasm.src
  48. 45
    0
      KERNAL_TED_05/disclaim.src
  49. 0
    0
      KERNAL_TED_05/ed1.src
  50. 144
    0
      KERNAL_TED_05/ed2.src
  51. 199
    0
      KERNAL_TED_05/ed3.src
  52. 323
    0
      KERNAL_TED_05/ed4.src
  53. 266
    0
      KERNAL_TED_05/ed5.src
  54. 200
    0
      KERNAL_TED_05/ed6.src
  55. 344
    0
      KERNAL_TED_05/ed7.src
  56. 68
    0
      KERNAL_TED_05/errorhdlr.src
  57. 325
    0
      KERNAL_TED_05/init.src
  58. 72
    0
      KERNAL_TED_05/interrupt.src
  59. 49
    0
      KERNAL_TED_05/kernal.src
  60. 255
    0
      KERNAL_TED_05/load.src
  61. 30
    0
      KERNAL_TED_05/messages.src
  62. 27
    0
      KERNAL_TED_05/music.src
  63. 195
    0
      KERNAL_TED_05/open.src
  64. 0
    0
      KERNAL_TED_05/openchanl.src
  65. 25
    0
      KERNAL_TED_05/overflow.src
  66. 119
    0
      KERNAL_TED_05/patches.src
  67. 206
    0
      KERNAL_TED_05/rs232.src
  68. 154
    0
      KERNAL_TED_05/save.src
  69. 396
    0
      KERNAL_TED_05/serial.src
  70. 82
    0
      KERNAL_TED_05/split.src
  71. 890
    0
      KERNAL_TED_05/tapred.src
  72. 187
    0
      KERNAL_TED_05/tapsup.src
  73. 377
    0
      KERNAL_TED_05/tapwrt.src
  74. 81
    0
      KERNAL_TED_05/time.src
  75. 327
    0
      KERNAL_TED_05/util.src
  76. 0
    0
      KERNAL_TED_05/vectors.src
  77. 4
    1
      README.md

KERNAL_TED/assem.src → KERNAL_TED_04/assem.src View File


KERNAL_TED/banking.src → KERNAL_TED_04/banking.src View File


KERNAL_TED/channelio.src → KERNAL_TED_04/channelio.src View File


KERNAL_TED/clall.src → KERNAL_TED_04/clall.src View File


KERNAL_TED/close.src → KERNAL_TED_04/close.src View File


KERNAL_TED/cmds1.src → KERNAL_TED_04/cmds1.src View File


KERNAL_TED/cmds2.src → KERNAL_TED_04/cmds2.src View File


+ 806
- 0
KERNAL_TED_04/declare.src View File

@@ -0,0 +1,806 @@
1
+	.page
2
+	.subttl 'declare 06/05/84'
3
+dclver	=$0605		;************keep current mmdd
4
+
5
+;  assignments
6
+
7
+addprc	=1
8
+lenfor	=18		;length of a 'for' entry in the run-time stack
9
+lengos	=5		;length of a 'gosub'....
10
+buflen	=89		;ted input buffer size
11
+bufpag	=2
12
+stkend	=507
13
+clmwid	=10		;print window 10 chars
14
+pi	=255
15
+numlev	=23
16
+strsiz	=3
17
+sperr	=$10
18
+maxchr	=80
19
+nwrap	=2 		;max # of physical lines per logical line
20
+	.page
21
+;  i/o devices
22
+;
23
+
24
+acia	=$fd00		;6551 acia
25
+
26
+xport	=$fd10		;6529 port
27
+
28
+bnksel	=$fdd0		;switch paragraph for banking cartridges
29
+
30
+ted	=$ff00
31
+
32
+timr1l	=ted+0		;timer 1 is used to write to tape
33
+timr1h	=ted+1
34
+timr2l	=ted+2		;timer 2 used by serial(timeout)
35
+timr2h	=ted+3		;dipole hunter
36
+timr3l	=ted+4		;timer 3 used to read data bits
37
+timr3h	=ted+5
38
+tedvcr	=ted+6		;ted's video control register
39
+keybrd	=ted+8
40
+tedirq	=ted+9
41
+tedicr	=ted+10
42
+tedcrh	=ted+12		;high byte of ted cursor register
43
+tedcrl	=ted+13		;low byte of ted cursor register
44
+tedmlo	=ted+14		;start of ls bytes of sound freq. values
45
+tedmhi	=ted+16		;start of ms 2 bits of sound freq. values
46
+tedvoi	=ted+17		;ls nybble is vol, ms nybble is voice on/off bits
47
+tedcbr	=ted+19		;character base
48
+romon	=ted+62
49
+romoff	=ted+63
50
+cbrlsb	=$04		;lsb of character base in char. base reg
51
+
52
+
53
+;  screen editor constants
54
+;
55
+llen	=40		;single line 40 columns
56
+nlines	=25		;25 rows on screen
57
+cr	=$0d  		;carriage return
58
+lf	=$0a		;line feed
59
+	.page
60
+;  basic zp storage
61
+;
62
+
63
+	*=0
64
+
65
+pdir	*=*+1		;6510 port data dir reg
66
+port	*=*+1		;6510 internal i/o port
67
+srchtk	*=*+1		;token 'search' looks for (run-time stack)
68
+zpvec1	*=*+2		;temp (renumber)
69
+zpvec2	*=*+2		;temp (renumber)
70
+integr
71
+charac	*=*+1
72
+endchr	*=*+1
73
+trmpos	*=*+1
74
+verck	*=*+1
75
+count	*=*+1
76
+dimflg	*=*+1
77
+valtyp	*=*+1
78
+intflg	*=*+1
79
+garbfl
80
+dores	*=*+1
81
+subflg	*=*+1
82
+inpflg	*=*+1
83
+domask
84
+tansgn	*=*+1
85
+channl	*=*+1
86
+poker
87
+linnum	*=*+2
88
+temppt	*=*+1
89
+lastpt	*=*+2
90
+tempst	*=*+9
91
+index
92
+index1	*=*+2
93
+index2	*=*+2
94
+resho	*=*+1
95
+resmoh	*=*+1
96
+addend
97
+resmo	*=*+1
98
+reslo	*=*+1
99
+	*=*+1
100
+txttab	*=*+2
101
+vartab	*=*+2
102
+arytab	*=*+2
103
+strend	*=*+2
104
+fretop	*=*+2
105
+frespc	*=*+2
106
+memsiz	*=*+2
107
+curlin	*=*+2
108
+txtptr	*=*+2		;pointer to basic text used by chrget,etc.
109
+form			;used by print using
110
+fndpnt	*=*+2		;pointer to item found by search
111
+datlin	*=*+2
112
+datptr	*=*+2
113
+inpptr	*=*+2
114
+varnam	*=*+2
115
+fdecpt
116
+varpnt	*=*+2
117
+lstpnt
118
+andmsk
119
+forpnt	*=*+2
120
+eormsk	=forpnt+1
121
+vartxt
122
+opptr	*=*+2
123
+opmask	*=*+1
124
+grbpnt
125
+tempf3
126
+defpnt	*=*+2
127
+dscpnt	*=*+2
128
+	*=*+1
129
+helper	*=*+1		;flags 'help' or 'list'
130
+jmper	*=*+1
131
+size	*=*+1
132
+oldov	*=*+1
133
+
134
+tempf1	*=*+1
135
+ptarg1	=tempf1		;multiply defined for instr
136
+ptarg2	=tempf1+2
137
+str1	=tempf1+4
138
+str2	=tempf1+7
139
+positn	=tempf1+10
140
+match	=tempf1+11
141
+
142
+temp	=tempf1		;multiply defined for graphic subs
143
+
144
+arypnt
145
+highds	*=*+2
146
+hightr	*=*+2
147
+tempf2
148
+	*=*+1
149
+deccnt
150
+lowds	*=*+2
151
+grbtop
152
+dptflg
153
+lowtr	*=*+1
154
+expsgn	*=*+1
155
+tenexp	=lowds+1
156
+dsctmp
157
+fac
158
+facexp	*=*+1
159
+facho	*=*+1
160
+facmoh	*=*+1
161
+indice
162
+facmo	*=*+1
163
+faclo	*=*+1
164
+facsgn	*=*+1
165
+degree
166
+sgnflg	*=*+1
167
+bits	*=*+1
168
+argexp	*=*+1
169
+argho	*=*+1
170
+argmoh	*=*+1
171
+argmo	*=*+1
172
+arglo	*=*+1
173
+argsgn	*=*+1
174
+strng1
175
+arisgn	*=*+1
176
+facov	*=*+1
177
+
178
+strng2
179
+polypt
180
+curtol
181
+fbufpt	*=*+2
182
+
183
+autinc	*=*+2		;inc. val for auto (0=off)
184
+mvdflg	*=*+1		;flag if 10k hires allocated
185
+
186
+noze			;using's leading zero counter
187
+keynum	*=*+1
188
+
189
+hulp			;counter
190
+keysiz	*=*+1
191
+
192
+syntmp	*=*+1		;used as temp for indirect loads
193
+dsdesc	*=*+3		;descriptor for ds$
194
+tos	*=*+2		;top of run time stack
195
+tmpton	*=*+2		;temps used by music (tone & vol)
196
+voicno	*=*+1
197
+runmod	*=*+1		;flags run/direct mode
198
+
199
+parsts			;dos parser status word
200
+point	*=*+1		;using's pointer to dec.pt
201
+
202
+
203
+
204
+;  graphic zp storage
205
+
206
+graphm	*=*+1		;current graphic mode
207
+colsel	*=*+1		;current color selected
208
+mc1	*=*+1		;multicolor1
209
+fg	*=*+1		;foreground color
210
+scxmax	*=*+1		;maximum # of columns
211
+scymax	*=*+1		;maximum # of rows
212
+ltflag	*=*+1		;paint-left flag
213
+rtflag	*=*+1		;paint-right flag
214
+stopnb	*=*+1		;stop paint if not background/not same color
215
+grapnt	*=*+2
216
+vtemp1	*=*+1
217
+vtemp2	*=*+1
218
+
219
+
220
+
221
+;  kernal zp storage
222
+;
223
+	*=$90
224
+status	*=*+1		;i/o operation status byte
225
+stkey	*=*+1		;stop key flag
226
+spverr	*=*+1		;temporary
227
+verfck	*=*+1		;load or verify flag
228
+c3p0	*=*+1		;ieee buffered char flag
229
+bsour	*=*+1		;char buffer for ieee
230
+xsav	*=*+1		;temp for basin
231
+ldtnd	*=*+1		;index to logical file
232
+dfltn	*=*+1		;default input device #
233
+dflto	*=*+1		;default output device #
234
+msgflg	*=*+1		;os message flag
235
+sal	*=*+1
236
+sah	*=*+1
237
+eal	*=*+1
238
+eah	*=*+1
239
+t1	*=*+2		;temporary 1
240
+t2	*=*+2		;temporary 2
241
+time	*=*+3		;24 hour clock in 1/60th seconds
242
+r2d2	*=*+1		;serial bus usage
243
+tpbyte	*=*+1		;byte to be written/read on/off tape
244
+bsour1	*=*+1		;temp used by serial routine
245
+sedeal			;temp. for scrolling
246
+fpverr	*=*+1
247
+dcount	*=*+1
248
+fnlen	*=*+1		;length current file n str
249
+la	*=*+1		;current file logical addr
250
+sa	*=*+1		;current file 2nd addr
251
+fa	*=*+1		;current file primary addr
252
+fnadr	*=*+2		;addr current file name str
253
+errsum	*=*+1
254
+tmp0
255
+stal	*=*+1
256
+stah	*=*+1
257
+memuss	*=*+2		;load ram base
258
+tapebs	*=*+2		;base pointer to cass buffer
259
+tmp2	*=*+2
260
+wrbase	*=*+2		;pointer to data for tape writes
261
+imparm	*=*+2		;pointer to immediate string for primm
262
+fetptr	*=*+2		;pointer to byte to be fetched in banking fetchl routine
263
+
264
+;  variables for screen editor
265
+;
266
+sedsal	*=*+2		;temp. for scrolling
267
+rvs	*=*+1		;rvs field on flag
268
+indx	*=*+1
269
+lsxp	*=*+1		;x pos at start
270
+lstp	*=*+1
271
+sfdx	*=*+1		;shift mode on print
272
+crsw	*=*+1		;input vs get flag
273
+pnt	*=*+2		;pointer to row
274
+pntr	*=*+1		;pointer to column
275
+qtsw	*=*+1		;quote switch
276
+sedt1	*=*+1		;editor temp. use
277
+tblx	*=*+1
278
+datax	*=*+1
279
+insrt	*=*+1		;insert mode flag
280
+
281
+	*=*+25		;area for use by banking software
282
+cirseg	*=*+1		;degrees/circle-segment
283
+user	*=*+2		;screen editor color ip
284
+keytab	*=*+2		;keyscan table indirect
285
+tmpkey	*=*+1
286
+ndx	*=*+1		;index to keyboard q
287
+stpflg	*=*+1		;pause flag
288
+
289
+;  monitor zp storage
290
+;
291
+t0	*=*+2
292
+chrptr	*=*+1
293
+bufend	*=*+1
294
+
295
+
296
+
297
+chksum	*=*+1		;temp for checksum calc
298
+length	*=*+1
299
+pass	*=*+1		;which pass we're doing str
300
+type	*=*+1		;what type of block we're dealing with
301
+usekdy	*=*+1		;(b.7=1)=> use for wr, (b.6=1)=> use for rd
302
+xstop	*=*+1		;save x reg for quick stopkey test
303
+
304
+
305
+
306
+curbnk	*=*+1		;current bank configuration
307
+xon	*=*+1		;char to send for an x-on
308
+xoff	*=*+1		;char to send for an x-off
309
+sedt2	*=*+1		;editor temp. use
310
+
311
+
312
+
313
+	*=$ff
314
+lofbuf	*=*+1
315
+fbuffr	*=*+16
316
+
317
+savea	*=*+1		;temp locations
318
+savey	*=*+1		;...for save & restore
319
+savex	*=*+1		;...for save & restore
320
+colkey	*=*+16		;default color/luminance table
321
+sysstk			;bottom of system stack
322
+	.page
323
+	*=$200
324
+buf	*=*+buflen	;basic/monitor buffer
325
+oldlin	*=*+2		;basic storage
326
+oldtxt	*=*+2		;basic storage
327
+
328
+;  basic/dos interface vars
329
+;
330
+xcnt	*=*+1		;dos loop counter
331
+
332
+fnbufr	*=*+16		;area for filename
333
+dosf1l	*=*+1		;dos filename 1 len
334
+dosds1	*=*+1		;dos disk drive 1
335
+dosf1a	*=*+2		;dos filename 1 addr
336
+
337
+dosf2l	*=*+1		;dos filename 2 len
338
+dosds2	*=*+1		;dos disk drive 2
339
+dosf2a	*=*+2		;dos filename 2 addr
340
+
341
+dosla	*=*+1		;dos logical addr
342
+dosfa	*=*+1		;dos phys addr
343
+dossa	*=*+1		;dos sec. addr
344
+
345
+dosdid	*=*+2		;dos dsk identif.
346
+didchk	*=*+1		;dos did flg
347
+
348
+dosstr	*=*+1		;dos output str. buf
349
+dosspc	=*-fnbufr	;space used by dos rout.
350
+	*=*+48		;area to build dos string
351
+	.page
352
+vwork			;graphics vars
353
+
354
+xypos
355
+xpos	*=*+2		;current x position
356
+ypos	*=*+2		;current y position
357
+dest
358
+xdest	*=*+2		;x-coordinate destination
359
+ydest	*=*+2		;y-coordinate destination
360
+
361
+;  line drawing variables
362
+;
363
+xyabs
364
+xabs	*=*+2
365
+yabs	*=*+2
366
+xysgn
367
+xsgn	*=*+2
368
+ysgn	*=*+2
369
+fct
370
+fct1	*=*+2
371
+fct2	*=*+2
372
+errval	*=*+2
373
+lesser	*=*+1
374
+greatr	*=*+1
375
+
376
+;  angle routine variables
377
+;
378
+angsgn	*=*+1		;sign of angle
379
+sinval	*=*+2		;sine of value of angle
380
+cosval	*=*+2		;cosine of value of angle
381
+angcnt	*=*+2		;temps for angle distance routines
382
+	.page
383
+;  the following 24 bytes are multiply defined, beginning on this
384
+;  page, and continuing for the next 4 pages.
385
+
386
+params	=*
387
+	*=*+1		;placeholder
388
+bnr	*=*+1		;pointer to begin. no.
389
+enr	*=*+1		;pointer to end no.
390
+dolr	*=*+1		;dollar flag
391
+flag	*=*+1		;comma flag
392
+swe	*=*+1		;counter
393
+usgn	*=*+1		;sign exponent
394
+uexp	*=*+1		;pointer to exponent
395
+vn	*=*+1		;# of digits before decimal point
396
+chsn	*=*+1		;justify flag
397
+vf	*=*+1		;# of pos before decimal point (field)
398
+nf	*=*+1		;# of pos after decimal point (field)
399
+posp	*=*+1		;+/- flag (field)
400
+fesp	*=*+1		;exponent flag (field)
401
+etof	*=*+1		;switch
402
+cform	*=*+1		;char counter (field)
403
+sno	*=*+1		;sign no
404
+blfd	*=*+1		;blank/star flag
405
+begfd	*=*+1		;pointer to begin of field
406
+lfor	*=*+1		;length of format
407
+endfd	*=*+1		;pointer to end of field
408
+	*=*+3		;placeholder
409
+parend	=*
410
+	.page
411
+;  general use parameters. (multiply defined with print using)
412
+
413
+	*=params
414
+
415
+xcentr	*=*+2
416
+ycentr	*=*+2
417
+xdist1	*=*+2
418
+ydist1	*=*+2
419
+xdist2	*=*+2
420
+ydist2	*=*+2
421
+disend
422
+	*=*+2  		;placeholder
423
+colcnt	*=*+1		;char's col. counter
424
+rowcnt	*=*+1
425
+strcnt	*=*+1
426
+
427
+
428
+;  box drawing variables. (multiply defined with print using)
429
+
430
+	*=params
431
+
432
+xcord1	*=*+2		;point 1 x-coord.
433
+ycord1	*=*+2		;point 1 y-coord.
434
+boxang	*=*+2		;rotation angle
435
+xcount	*=*+2
436
+ycount	*=*+2
437
+bxleng	*=*+2		;length of a side
438
+xcord2	*=*+2
439
+ycord2	*=*+2
440
+
441
+
442
+;  circle drawing variables. (multiply defined with print using)
443
+
444
+	*=params
445
+
446
+xcircl	*=*+2		;circle center, x coordinate
447
+ycircl	*=*+2		;circle center, y coordinate
448
+xradus	*=*+2		;x radius
449
+yradus	*=*+2		;y radius
450
+rotang	*=*+4		;rotation angle
451
+angbeg	*=*+2		;arc angle start
452
+angend	*=*+2		;arc angle end
453
+xrcos	*=*+2		;x radius * cos(rotation angle)
454
+yrsin	*=*+2		;y radius * sin(rotation angle)
455
+xrsin	*=*+2		;x radius * sin(rotation angle)
456
+yrcos	*=*+2		;y radius * cos(rotation angle)
457
+	.page
458
+;  shape and move-shape variables (multiply defined with print using)
459
+
460
+	*=params
461
+
462
+	*=*+1		;placeholder
463
+keylen	*=*+1
464
+keynxt	*=*+1
465
+strsz	*=*+1		;string len
466
+gettyp	*=*+1		;replace shape mode
467
+strptr	*=*+1		;string pos'n counter
468
+oldbyt	*=*+1		;old bit map byte
469
+newbyt	*=*+1		;new string or bit map byte
470
+	*=*+1  		;placeholder
471
+xsize	*=*+2		;shape column length
472
+ysize	*=*+2		;shape row length
473
+xsave	*=*+2		;temp for column length
474
+stradr	*=*+2		;save shape string descriptor
475
+bitidx	*=*+1		;bit index into byte
476
+savsiz	*=*+4		;temp work locations
477
+
478
+
479
+	*=parend
480
+
481
+;  graphic variables
482
+;
483
+chrpag	*=*+1		;high byte of address of char rom for 'char' command
484
+bitcnt	*=*+1		;temp for gshape
485
+scalem	*=*+1		;scale mode flag
486
+width	*=*+1		;double width flag
487
+filflg	*=*+1		;box fill flag
488
+bitmsk	*=*+1		;temp for bit mask
489
+numcnt	*=*+1
490
+trcflg	*=*+1		;flags trace mode
491
+
492
+
493
+t3	*=*+1
494
+t4	*=*+2
495
+vtemp3	*=*+1		;graphic temp storage
496
+vtemp4	*=*+1
497
+vtemp5	*=*+1
498
+
499
+
500
+adray1	*=*+2		;ptr to routine:  convert float -> integer
501
+adray2	*=*+2		;ptr to routine:  convert integer -> float
502
+	.page
503
+	*=$2fe
504
+
505
+bnkvec	*=*+2		;vector for function cart. users
506
+ierror	*=*+2		;indirect error (output error in .x)
507
+imain	*=*+2		;indirect main (system direct loop)
508
+icrnch	*=*+2		;indirect crunch (tokenization routine)
509
+iqplop	*=*+2		;indirect list (char list)
510
+igone	*=*+2		;indirect gone (char dispatch)
511
+ieval	*=*+2		;indirect eval (symbol evaluation)
512
+iesclk	*=*+2		;escape token crunch,
513
+iescpr	*=*+2		;..list,
514
+iescex	*=*+2		;..and execute
515
+itime	*=*+2		;60 hz interrupt vector (before jiffy)
516
+cinv	*=*+2		;irq ram vector
517
+cbinv	*=*+2		;brk instr ram vector
518
+iopen	*=*+2		;indirects for code
519
+iclose	*=*+2		;conforms to kernal spec 8/19/80
520
+ichkin	*=*+2
521
+ickout	*=*+2
522
+iclrch	*=*+2
523
+ibasin	*=*+2
524
+ibsout	*=*+2
525
+istop	*=*+2
526
+igetin	*=*+2
527
+iclall	*=*+2
528
+usrcmd	*=*+2
529
+iload	*=*+2
530
+isave	*=*+2		;savesp
531
+
532
+	*=*+1		;*******************************************available
533
+
534
+
535
+tapbuf	*=*+192		;cassette tape buffer
536
+wrlen	*=*+2		;length in 2's compl. of data to be written to cassette
537
+rdcnt	*=*+2		;length in 2's compl. of data to be read  from cassette
538
+
539
+inpqln	=64		;length of rs232 input queue
540
+inpque	*=*+inpqln
541
+hiwatr	=$38		;x-off trip point
542
+lowatr	=$08		;x-on trip point
543
+
544
+estksz	=30		;size of cassette error stack
545
+estakl	*=*+estksz	;low addr
546
+estakh	*=*+estksz	;high addr
547
+
548
+chrget	*=*+6
549
+chrgot	*=*+12
550
+qnum	*=*+15
551
+
552
+
553
+
554
+;  indirect load subroutine area
555
+;
556
+indsub	*=*+14		;shared rom fetch sub
557
+zero	*=*+3		;numeric constant for basic, downloaded from rom
558
+
559
+indtxt	*=*+11		;txtptr
560
+indin1	*=*+11		;index & index1
561
+indin2	*=*+11		;index2
562
+indst1	*=*+11		;strng1
563
+indlow	*=*+11		;lowtr
564
+indfmo	*=*+11		;facmo
565
+
566
+
567
+
568
+;  declarations for print using
569
+;
570
+puchrs
571
+pufill	*=*+1		;print using fill symbol
572
+pucoma	*=*+1		;print using comma symbol
573
+pudot	*=*+1		;print using d.p. symbol
574
+pumony	*=*+1		;print using monetary symbol
575
+
576
+tmpdes	*=*+4		;temp for instr
577
+
578
+errnum	*=*+1		;used by error trapping routine-last error number
579
+errlin	*=*+2		;line # of last error - ffff if no error
580
+trapno	*=*+2		;line to go to on error.. ffxx if none set
581
+tmptrp	*=*+1		;hold trap # tempor.
582
+errtxt	*=*+2
583
+oldstk	*=*+1
584
+
585
+tmptxt	*=*+2		;used by do-loop. could be mult. assigned
586
+tmplin	*=*+2
587
+
588
+mtimlo	*=*+2		;table of pending jiffies till turnoff (in 2's comp)
589
+mtimhi	*=*+2
590
+usrpok	*=*+3
591
+rndx	*=*+5
592
+
593
+dejavu	*=*+1		;'cold' or 'warm' reset status (must be in page 5!)
594
+
595
+
596
+
597
+;  tables for open files
598
+;
599
+lat	*=*+10		;logical file numbers
600
+fat	*=*+10		;primary device numbers
601
+sat	*=*+10		;secondary addresses
602
+
603
+
604
+;  system storage
605
+;
606
+keyd	*=*+10		;irq keyboard buffer
607
+memstr	*=*+2		;start of memory
608
+msiz	*=*+2		;top of memory
609
+timout	*=*+1		;ieee timeout flag
610
+
611
+
612
+;  cassette declarations...
613
+;
614
+filend	*=*+1		;filend reached::=1, 0 otherwise
615
+ctally	*=*+1		;#of chars left in buffer (for r&w)
616
+cbufva	*=*+1		;#of total valid chars in buffer (for r.o.)
617
+tptr	*=*+1		;pointer to next chr in buffer (for r&w)
618
+fltype	*=*+1		;contains type of current cass file
619
+bufmax	=191		;size of the buffer for data entries (excluding type)
620
+;
621
+;  tape block types
622
+;
623
+eot	=5  		;end of tape
624
+blf	=1  		;basic load file
625
+bdf	=2  		;basic data file
626
+plf	=3  		;fixed program type
627
+bdfh	=4 		;basic data file header
628
+
629
+
630
+
631
+;  screen editor storage
632
+;
633
+color	*=*+1		;active attribute byte
634
+flash	*=*+1		;character flash flag
635
+	*=*+1		;*******************************************available
636
+hibase	*=*+1		;base location of screen (top)
637
+xmax	*=*+1
638
+rptflg	*=*+1		;key repeat flag
639
+kount	*=*+1
640
+delay	*=*+1
641
+shflag	*=*+1		;shift flag byte
642
+lstshf	*=*+1		;last shift pattern
643
+keylog	*=*+2		;indirect for keyboard table setup
644
+mode	*=*+1
645
+autodn	*=*+1		;auto scroll down flag(=0 on,<>0 off)
646
+lintmp	*=*+1
647
+rolflg	*=*+1
648
+
649
+
650
+
651
+;  monitor non-zp storage
652
+;
653
+format	*=*+1
654
+msal	*=*+3
655
+wrap	*=*+1
656
+tmpc	*=*+1
657
+diff	*=*+1
658
+pch	*=*+1
659
+pcl	*=*+1
660
+flgs	*=*+1
661
+acc	*=*+1
662
+xr	*=*+1
663
+yr	*=*+1
664
+sp	*=*+1
665
+invl	*=*+1
666
+invh	*=*+1
667
+cmpflg	*=*+1		;used by various monitor routines
668
+bad	*=*+1
669
+
670
+kyndx	*=*+1		;used for programmable keys
671
+keyidx	*=*+1
672
+keybuf	*=*+8		;table of p.f. lengths
673
+maxkys	=128
674
+pkybuf	*=*+maxkys	;p.f. key storage area
675
+
676
+
677
+;  kennedy interface variables...
678
+;
679
+kdata	*=*+1		;temp for data write to kennedy
680
+kdycmd	*=*+1		;select for kennedy rd or wr
681
+kdynum	*=*+1		;kennedy's dev#
682
+kdyprs	*=*+1		;kennedy present::=$ff, else::=$00
683
+kdytyp	*=*+1		;temp stor. for type of open for kdy
684
+;
685
+;  and constants...
686
+;
687
+tedrva	=$fef0
688
+tedrvb	=$fef1
689
+tedrvc	=$fef2
690
+drva2	=$fef3
691
+drvb2	=$fef4
692
+drvc2	=$fef5
693
+
694
+italk	=$40		;ieee talk
695
+ilstn	=$20		;listen
696
+iutalk	=$5f		;untalk
697
+iulstn	=$3f		;unlisten
698
+
699
+kcmd1	=$81		;state change
700
+kcmd2	=$82		;sec. addr
701
+kcmd3	=$83		;dout
702
+kcmd4	=$84		;din
703
+
704
+
705
+
706
+savram	*=*+256		;1 page used by banking routines
707
+pat	=savram		;physical address table for banking
708
+lngjmp	=savram+4	;long jump address for banking 'long' routine
709
+fetarg	=savram+6	;storage for long jumps
710
+fetxrg	=savram+7
711
+fetsrg	=savram+8
712
+
713
+stktop	*=*+196		;basic run-time stack
714
+stkbot	=*
715
+
716
+
717
+;  cassette primitive r&w variables
718
+;
719
+typenb			;doubly defined
720
+wrout	*=*+1		;byte to be written on tape
721
+
722
+parity	*=*+1		;temp for parity calc
723
+tt1	*=*+1		;temp for write-header
724
+tt2	*=*+1		;temp for write-header
725
+	*=*+1		;*************************************available
726
+rdbits	*=*+1		;local index for readbyte routine
727
+errsp	*=*+1		;pointer to the current entry in the error stack
728
+fperrs	*=*+1		;number of first pass errors
729
+;
730
+; *** don't ever re-order the following 3 variables !!! ***
731
+;
732
+dsamp1	*=*+2		;time constant for x cell sample
733
+dsamp2	*=*+2		;time constant for y cell sample
734
+zcell	*=*+2		;time constant for z cell verify
735
+
736
+srecov	*=*+1		;stack marker for stopkey recover
737
+drecov	*=*+1		;stack marker for dropout recover
738
+trsave	*=*+4		;parmeters passed to rdblok
739
+rdetmp	*=*+1		;temp stat save for rdblok
740
+ldrscn	*=*+1		;#consec. shorts to find in leader
741
+cderrm	*=*+1		;#errors fatal in rd countdown
742
+vsave	*=*+1		;temp for verify command
743
+t1pipe	*=*+4		;pipe temp for t1
744
+enext	*=*+1		;read error propagate
745
+
746
+
747
+
748
+;  for rs-232...
749
+;
750
+uoutq	*=*+1		;user char to send
751
+uoutfg	*=*+1		;0::=empty, 1::=full
752
+soutq	*=*+1		;system char to send
753
+soutfg	*=*+1		;0::=empty, 1::=full
754
+inqfpt	*=*+1		;ptr to front of input queue
755
+inqrpt	*=*+1		;ptr to rear of input queue
756
+inqcnt	*=*+1		;# of chars in input queue
757
+astat	*=*+1		;temp ststus word for the acia
758
+aintmp	*=*+1		;temp for input routine
759
+alstop	*=*+1		;flg to indicate if we're paused locally
760
+arstop	*=*+1		;flg to indicate if remote is paused
761
+apres	*=*+1		;flg to indicate if acia in system
762
+
763
+
764
+
765
+;  indirect routine downloaded here...
766
+;
767
+kludes	*=*+12
768
+sinner	=kludes+6
769
+
770
+
771
+scbot	*=*+1
772
+sctop	*=*+1
773
+sclf	*=*+1
774
+scrt	*=*+1
775
+scrdis	*=*+1
776
+insflg	*=*+1
777
+lstchr	*=*+1
778
+logscr	*=*+1
779
+tcolor	*=*+1
780
+bitabl	*=*+4
781
+
782
+
783
+sareg	*=*+1		;reg's for sys command
784
+sxreg	*=*+1
785
+syreg	*=*+1
786
+spreg	*=*+1
787
+
788
+lstx	*=*+1		;key scan index
789
+stpdsb	*=*+1		;flag to disable ctl-s pause
790
+ramrom	*=*+1		;msb flags monitor fetches from ram (0) or rom (1)
791
+colsw	*=*+1		;msb flags color/lum. table in ram (0) or rom (1)
792
+ffrmsk	*=*+1		;rom mask (split screen)
793
+vmbmsk	*=*+1		;v.m. base mask (split screen)
794
+lsem	*=*+1		;motor lock semaphore for cassette (**02/08/84)
795
+palcnt	*=*+1		;pal tod (**02/17/84)
796
+
797
+
798
+tedatr	=$0800		;ted attribute bytes
799
+tedscn	=$0c00		;ted character pointers
800
+basbgn	=$1000
801
+grbase	=$2000		;graphic base is the same as basic beginning
802
+bmcolr	=$1c00
803
+bmlum	=$1800
804
+chrbas	=$d000		;beginning of 'character rom'
805
+
806
+;end

KERNAL_TED/disasm.src → KERNAL_TED_04/disasm.src View File


KERNAL_TED/disclaim.src → KERNAL_TED_04/disclaim.src View File


+ 417
- 0
KERNAL_TED_04/ed1.src View File

@@ -0,0 +1,417 @@
1
+	.page
2
+	.subttl 'ed1    ted 07/10/84'
3
+
4
+	.byte   >dclver,<dclver	;mark declare version
5
+
6
+ldtb2			;screen lines low byte table
7
+       .byte <linz0	;**must** be at $d802...if this is changed, tell basic!
8
+       .byte <linz1
9
+       .byte <linz2
10
+       .byte <linz3
11
+       .byte <linz4
12
+       .byte <linz5
13
+       .byte <linz6
14
+       .byte <linz7
15
+       .byte <linz8
16
+       .byte <linz9
17
+       .byte <linz10
18
+       .byte <linz11
19
+       .byte <linz12
20
+       .byte <linz13
21
+       .byte <linz14
22
+       .byte <linz15
23
+       .byte <linz16
24
+       .byte <linz17
25
+       .byte <linz18
26
+       .byte <linz19
27
+       .byte <linz20
28
+       .byte <linz21
29
+       .byte <linz22
30
+       .byte <linz23
31
+       .byte <linz24
32
+ldtb1			;screen lines high byte table
33
+       .byte >linz0
34
+       .byte >linz1
35
+       .byte >linz2
36
+       .byte >linz3
37
+       .byte >linz4
38
+       .byte >linz5
39
+       .byte >linz6
40
+       .byte >linz7
41
+       .byte >linz8
42
+       .byte >linz9
43
+       .byte >linz10
44
+       .byte >linz11
45
+       .byte >linz12
46
+       .byte >linz13
47
+       .byte >linz14
48
+       .byte >linz15
49
+       .byte >linz16
50
+       .byte >linz17
51
+       .byte >linz18
52
+       .byte >linz19
53
+       .byte >linz20
54
+       .byte >linz21
55
+       .byte >linz22
56
+       .byte >linz23
57
+       .byte >linz24
58
+	.page
59
+scrorg			;return max. # rows, cols of screen
60
+       ldx #llen
61
+       ldy #nlines
62
+       rts
63
+
64
+
65
+plot			;set or read cursor position
66
+       bcs plot10
67
+       stx tblx		;.c=0 means set it
68
+       stx lsxp
69
+       sty pntr
70
+       sty lstp
71
+       jsr sreset	;(in case it's outside window)
72
+       jsr stupt
73
+plot10
74
+       ldx tblx		;.c=1 means read it
75
+       ldy pntr
76
+       rts
77
+
78
+
79
+
80
+;****************************************
81
+;
82
+; cint:  initialize screen & editor
83
+;
84
+;****************************************
85
+
86
+cint
87
+       lda #$0c		;set up base of screen
88
+       sta hibase
89
+
90
+       lda #3
91
+       sta dflto
92
+       lda #0
93
+       sta dfltn
94
+
95
+       sta mode		;always pet mode
96
+       sta graphm	;always text mode
97
+       sta ndx		;no keys in buffer yet
98
+       sta stpflg	;flag 'no ctl-s yet'
99
+
100
+       lda #<shflog	;set shift logic indirects
101
+       sta keylog
102
+       lda #>shflog
103
+       sta keylog+1
104
+       lda #10
105
+       sta xmax		;maximum type ahead buffer size
106
+       sta rolflg	;flag 'roll ok, if in basic, and if in direct mode'
107
+       sta delay
108
+       lda #$80
109
+       sta rptflg	;make all keys repeat
110
+       lda #16		;init color to gk. blue
111
+       sta color
112
+       lda #4
113
+       sta kount	;delay between key repeats
114
+
115
+setbig			;setup full screen window, clear it & clear wrap table
116
+       jsr sreset
117
+clsr			;clear screen
118
+       jsr home		;start at top of window
119
+cls10
120
+       jsr scrset	;point to line
121
+       jsr clrln	;clear the line
122
+       cpx scbot	;done?
123
+       inx
124
+       bcc cls10	;no
125
+
126
+home			;home cursor
127
+       ldx sctop	;move to top of window
128
+       stx tblx
129
+       stx lsxp        	;(for input after home or clear)
130
+stu10
131
+       ldy sclf        	;move to left side of window
132
+       sty pntr
133
+       sty lstp
134
+stupt
135
+       ldx tblx        	;set pointers to beginning of line
136
+
137
+scrset
138
+       lda ldtb2,x     	;.x=line # to set up
139
+       sta pnt
140
+       lda ldtb1,x     	;pointer to screen ram
141
+       sta pnt+1       	
142
+
143
+;pointer to screen ram, fall into 'scolor'
144
+;
145
+scolor
146
+       lda pnt         	;generate color pointer
147
+       sta user
148
+       lda pnt+1
149
+       and #$03
150
+       ora #>tedatr    	;address of ted attribute byte area
151
+       sta user+1
152
+       rts
153
+
154
+
155
+;  remove character from queue
156
+;
157
+lp2
158
+       ldy kyndx       	;are there any pf keys?
159
+       beq lp3         	;branch if not
160
+       ldy keyidx      	;get index to current char
161
+       lda pkybuf,y    	;get current byte
162
+       dec kyndx       	;1 byte down
163
+       inc keyidx      	;bump index to next char
164
+       cli
165
+       rts
166
+lp3
167
+       ldy keyd        	;get key from irq buffer
168
+       ldx #0
169
+lp1
170
+       lda keyd+1,x
171
+       sta keyd,x
172
+       inx
173
+       cpx ndx
174
+       bne lp1
175
+       dec ndx
176
+       tya
177
+       cli
178
+       clc             	;always good return from keybd!
179
+       rts
180
+
181
+loop4
182
+       jsr print
183
+loop3			;turn on cursor
184
+       jsr scolor      	;set up (user) to point to start of current attr bytes row
185
+       ldy pntr        	;get column
186
+       lda (user),y     	;get old color
187
+       pha             	;save it
188
+
189
+       lda color       	;make cursor flash in current color
190
+       sta (user),y
191
+
192
+       tya             	;calculate current screen position
193
+       clc
194
+       adc pnt
195
+       sta tedcrl      	;point cursor there
196
+       lda pnt+1
197
+       adc #0          	;(.c will be clear for sbc following!)
198
+       sbc #>tedscn-1  	;ted crsr posn. is relative to start of screen
199
+       sta tedcrh
200
+
201
+waitky
202
+       lda ndx         	;are there any keys ready?
203
+       ora kyndx       	;or any in the pf key buffer?
204
+       beq waitky      	;loop if not
205
+
206
+;  turn off cursor
207
+;
208
+       pla             	;get saved color
209
+       sta (user),y     	;put it in
210
+       lda #$ff        	;point cursor to cuba
211
+       sta tedcrh      	;(it's the only way to turn it off)
212
+       sta tedcrl
213
+       jsr lp2         	;get key input
214
+
215
+       cmp #$83        	;<shift><run/stop>?
216
+       bne lp22
217
+       ldx #9
218
+       sei             	;fill buffer with load/run cmds
219
+       stx ndx
220
+lp21
221
+       lda runtb-1,x
222
+       sta keyd-1,x
223
+       dex
224
+       bne lp21
225
+lp211
226
+       beq loop3
227
+
228
+lp22
229
+       cmp #cr       	;<cr>?
230
+       bne loop4
231
+       sta crsw        	;flag - we pass chars now
232
+       jsr fndend      	;check nxt line for cont
233
+       stx lintmp      	;save last line number of sentence
234
+       jsr fistrt      	;find begining of line
235
+       lda #0
236
+       sta qtsw        	;clear quote mode
237
+       ldy sclf        	;retrieve from line start if left it
238
+       lda lsxp        	;input started row
239
+       bmi lp80        	;flag we left start line
240
+       cmp tblx
241
+       bcc lp80
242
+       ldy lstp        	;input started column
243
+       cmp lintmp      	;on start line
244
+       bne lp70
245
+       cpy indx        	;past start column
246
+       beq lp75        	;ok if the same
247
+lp70
248
+       bcs clp2        	;yes - null input
249
+lp75
250
+       sta tblx        	;start from here on input
251
+lp80
252
+       sty pntr
253
+       jmp lop5
254
+
255
+
256
+;  input a line until carriage return
257
+;
258
+loop5
259
+       tya
260
+       pha
261
+       txa
262
+       pha
263
+       lda crsw        	;passing chars to input
264
+       beq lp211       	;no - buffer on screen (jmp's to loop3)
265
+       bpl lop5        	;not done - get next char
266
+clp2
267
+       lda #0          	;input done clear flag
268
+       sta crsw
269
+       jmp clppat      	;**patch 01/03/84 fab
270
+       nop             	;**
271
+lop5
272
+       jsr stupt       	;set pnt and user
273
+       jsr get1ch      	;get a screen char
274
+       sta datax
275
+       and #$3f
276
+       asl datax
277
+       bit datax
278
+       bpl lop54
279
+       ora #$80
280
+lop54
281
+       bcc lop52
282
+       ldx qtsw
283
+       bne lop53
284
+lop52
285
+       bvs lop53
286
+       ora #$40
287
+lop53
288
+       jsr qtswc
289
+       ldy tblx        	;on input end line ?
290
+       cpy lintmp
291
+       bcc clp00       	;no
292
+       ldy pntr        	;on input end column ?
293
+       cpy indx
294
+       bcc clp00       	;no
295
+       ror crsw        	;c=1 minus flags last char sent
296
+       bmi clp1        	;always
297
+
298
+clp00
299
+       jsr nxtchr      	;at next char
300
+clp1
301
+       cmp #$de        	;a pi ?
302
+       bne clp7        	;no
303
+       lda #$ff        	;translate
304
+clp7
305
+       sta datax
306
+       pla
307
+       tax
308
+       pla
309
+       tay
310
+       lda datax
311
+       clc             	;**patch 12/22/83 tvr
312
+       rts
313
+
314
+
315
+qtswc
316
+       cmp #$22
317
+       bne qtswl
318
+       lda qtsw
319
+       eor #$1
320
+       sta qtsw
321
+       lda #$22
322
+qtswl
323
+       rts
324
+
325
+
326
+loop2
327
+       lda datax
328
+       sta lstchr      	;save for next escape test
329
+       pla
330
+       tay
331
+       lda insrt
332
+       beq lop2
333
+       lsr qtsw
334
+lop2
335
+       pla
336
+       tax
337
+       pla
338
+       clc             	;good return
339
+;      cli		;shouldn't be necessary here
340
+       rts
341
+
342
+
343
+nxt33
344
+       ora #$40
345
+nxt3
346
+       ldx rvs
347
+       beq nvs
348
+nc3
349
+       ora #$80
350
+nvs
351
+       ldx insrt
352
+       beq nvsa
353
+       dec insrt
354
+nvsa
355
+       bit insflg      	;are we in auto insert?
356
+       bpl nvs1        	;branch if not
357
+       pha             	;save char.
358
+       jsr insert      	;make room
359
+       ldx #0
360
+       stx insrt       	;make sure insert flag is off
361
+       pla
362
+nvs1
363
+       jsr dspp        	;fall thru to movchr! (will return to 'loop2')
364
+	.page
365
+; movchr - move to next char position
366
+; insert blank line if at end of line
367
+; y = column position
368
+; on exit - carry set = abort - scroll disabled
369
+;
370
+movchr
371
+       cpy scrt
372
+       bcc movc10      	;easy if not at end of line
373
+       ldx tblx
374
+       cpx scbot
375
+       bcc movc10      	;skip if not last line of screen
376
+       bit scrdis
377
+       bmi movc30      	;abort if scrolling disabled
378
+movc10
379
+       jsr stupt       	;set pnt address
380
+       jsr nxtchr      	;move to next char position
381
+       bcc movc30      	;done if not move to new line
382
+       jsr getbit      	;check if on a continued line
383
+       bcs movc20      	;skip ahead if not
384
+       sec             	;incase we abort
385
+       bit scrdis
386
+       bvs movc30
387
+       jsr scrdwn      	;else insert a blank line
388
+movc20
389
+       clc             	;for clean exit
390
+movc30
391
+       rts
392
+
393
+
394
+; skip to next line
395
+; wrap to top if scroll disabled
396
+;
397
+nxln
398
+       ldx tblx
399
+       cpx scbot       	;of the bottom of window ?
400
+       bcc nxln1       	;no
401
+       bit scrdis      	;what if scrolling is disabled?
402
+       bpl doscrl      	;branch if scroll is enabled
403
+       lda sctop       	;wrap to top
404
+       sta tblx
405
+       bcs nowhop      	;always
406
+
407
+doscrl
408
+       jsr scrup       	;scroll it all
409
+       clc             	;indicate scroll ok
410
+nxln1
411
+       inc tblx
412
+nowhop
413
+       jmp stupt       	;set line base adr
414
+
415
+;end
416
+;(07/10/84) tvr & fab:  pressing a fct key during a 'getkey' cmd returned
417
+;			a error and shouldn't have. code needed a 'clc'.

KERNAL_TED/ed2.src → KERNAL_TED_04/ed2.src View File


KERNAL_TED/ed3.src → KERNAL_TED_04/ed3.src View File


KERNAL_TED/ed4.src → KERNAL_TED_04/ed4.src View File


KERNAL_TED/ed5.src → KERNAL_TED_04/ed5.src View File


KERNAL_TED/ed6.src → KERNAL_TED_04/ed6.src View File


KERNAL_TED/ed7.src → KERNAL_TED_04/ed7.src View File


KERNAL_TED/errorhdlr.src → KERNAL_TED_04/errorhdlr.src View File


KERNAL_TED/init.src → KERNAL_TED_04/init.src View File


KERNAL_TED/interrupt.src → KERNAL_TED_04/interrupt.src View File


KERNAL_TED/kernal.src → KERNAL_TED_04/kernal.src View File


KERNAL_TED/load.src → KERNAL_TED_04/load.src View File


KERNAL_TED/messages.src → KERNAL_TED_04/messages.src View File


KERNAL_TED/music.src → KERNAL_TED_04/music.src View File


KERNAL_TED/open.src → KERNAL_TED_04/open.src View File


+ 264
- 0
KERNAL_TED_04/openchanl.src View File

@@ -0,0 +1,264 @@
1
+	.page
2
+	.subttl  'openchannel'
3
+;***************************************
4
+;* chkin -- open channel for input     *
5
+;*                                     *
6
+;* the number of the logical file to be*
7
+;* opened for input is passed in .x.   *
8
+;* chkin searches the logical file     *
9
+;* to look up device and command info. *
10
+;* errors are reported if the device   *
11
+;* was not opened for input ,(e.g.     *
12
+;* cassette write file), or the logical*
13
+;* file has no reference in the tables.*
14
+;* device 0, (keyboard), and device 3  *
15
+;* (screen), require no table entries  *
16
+;* and are handled separate.           *
17
+;***************************************
18
+
19
+nchkin
20
+       jsr lookup      	;see if file known
21
+       beq jx310       	;yup...
22
+       jmp error3      	;no...file not open
23
+
24
+jx310
25
+       jsr jz100       	;extract file info (returns w/.a=fa & flags set)
26
+       beq jx320       	;is keyboard...done.
27
+;
28
+; could be screen, keyboard, or serial
29
+;
30
+       cmp #3
31
+       beq jx320       	;is screen...done.
32
+       bcs jx330       	;is serial...address it
33
+       cmp #2
34
+       bne opcasi      	;open cass for input
35
+       jsr aready      	;open rs-232 for input
36
+       bcs excp1       	;carry set if acia not ready
37
+       lda fa
38
+
39
+jx320
40
+       sta dfltn       	;all input comes from here
41
+       clc             	;good exit
42
+excp1
43
+       rts
44
+;
45
+; a serial device has to be a talker
46
+;
47
+jx330
48
+       tax             	;device # for dflto
49
+       jsr ttalk       	;tell him to talk
50
+       bit status      	;anybody home? (case of no devices on bus)
51
+       bmi dnpci       	;no...
52
+
53
+       lda sa          	;a second?
54
+       bpl jx340       	;yes...send it
55
+       jsr ttkatn      	;no...let go
56
+       jmp jx350
57
+
58
+jx340
59
+       jsr ttksa       	;send second
60
+jx350
61
+       txa             	;restore dev#
62
+       bit status      	;secondary address sent ok?
63
+       bpl jx320       	;yep, done
64
+dnpci
65
+       jmp error5      	;input channel device not present
66
+
67
+
68
+opcasi
69
+       ldx sa          	;open cass for input
70
+       cpx #$60        	;is command a read?
71
+       beq jx320       	;yes
72
+       jmp error6
73
+	.page
74
+;***************************************
75
+;* chkout -- open channel for output   *
76
+;*                                     *
77
+;* the number of the logical file to be*
78
+;* opened for output is passed in .x.  *
79
+;* chkout searches the logical file    *
80
+;* to look up device and command info. *
81
+;* errors are reported if the device   *
82
+;* was not opened for input ,(e.g.     *
83
+;* keyboard), or the logical file has  *
84
+;* reference in the tables.            *
85
+;* device 0, (keyboard), and device 3  *
86
+;* (screen), require no table entries  *
87
+;* and are handled separate.           *
88
+;***************************************
89
+
90
+nckout
91
+       jsr lookup      	;is file in table?
92
+       beq ck5         	;yes...
93
+       jmp error3      	;no...file not open
94
+
95
+ck5
96
+       jsr jz100       	;extract table info (returns w/.a=fa & flags set)
97
+       bne ck10        	;no...something else.
98
+ck20
99
+       jmp error7      	;yes...not output file
100
+;
101
+; could be screen, serial, or tape
102
+;
103
+ck10
104
+       cmp #3
105
+       beq ck30        	;is screen...done
106
+       bcs ck40        	;is serial...address it
107
+       cmp #2
108
+       bne optapo      	;open tape for output
109
+       jsr aready      	;open rs-232 for output
110
+       bcs excp2       	;carry set if acia not ready
111
+       lda fa
112
+
113
+ck30
114
+       sta dflto       	;all output goes here
115
+       clc             	;good exit
116
+excp2
117
+       rts
118
+
119
+ck40
120
+       tax             	;save device for dflto
121
+       jsr tlistn      	;tell him to listen
122
+       bit status      	;anybody home? (case of no devices on bus)
123
+       bmi dnpco       	;no...
124
+
125
+       lda sa          	;is there a second?
126
+       bpl ck50        	;yes...
127
+       jsr tscatn      	;no...release lines
128
+       bne ck60        	;branch always
129
+
130
+ck50
131
+       jsr tsecnd      	;send second...
132
+ck60
133
+       txa
134
+       bit status      	;speaketh ye?
135
+       bpl ck30        	;yep, done
136
+dnpco
137
+       jmp error5      	;device not present
138
+
139
+
140
+optapo
141
+       ldx sa          	;open tape for output
142
+       cpx #$60        	;read?
143
+       beq ck20        	;yes...bad!
144
+       bne ck30        	;always
145
+	.page
146
+;***** tedisk support routines... {state transition} *****
147
+
148
+tstkdy
149
+	pha             ;save .a
150
+       stx wrbase      	;save .x
151
+       ldx #$30        	;starting i/o offset
152
+       lda fa          	;load file address
153
+       cmp #8          	;=8?
154
+       beq tstok
155
+nok8   cmp #9          	;=9?
156
+       bne notprs
157
+       ldx #0          	;must be $fec0
158
+tstok  lda #$55        	;write a pattern to cmd channel
159
+       sta tedrva-48,x
160
+       eor tedrva-48,x 	;is it the same
161
+       bne notprs
162
+       lda tedrvb-48,x 	;i tied a status bit hi
163
+       and #2
164
+       bne notprs      	;br, he is blown away
165
+       stx usekdy      	;store offset into i/o slot
166
+       clc             	;ok
167
+       .byte $24
168
+notprs sec             	;sorry not home
169
+       ldx wrbase      	;restore .x
170
+       pla             	;restore .a
171
+       rts             	;45 bytes
172
+
173
+patchb lda tedrvc-48,x 	;wait for rdy ack to go hi
174
+       bpl patchb
175
+       bmi ptchbb      	;bra
176
+
177
+patcha lda #0
178
+       sta tedrva-48,x 	;clear cmd channel
179
+ptchbb lda #$40
180
+       sta tedrvc-48,x 	;set dav hi
181
+       ldx wrbase      	;restor .x
182
+       pla             	;restore .a for ciout, data for acptr
183
+       clc             	;ok
184
+       rts             	;*
185
+
186
+patchd sta tedrvc
187
+       sta drvc2-48
188
+       sta tedrvc-48
189
+       dex
190
+       stx drva2-48
191
+       jmp ptchdd
192
+
193
+;this is in the patch area:
194
+;ptchdd inx             ;.x=0
195
+;       stx drvb2-48
196
+;       stx tedrva-48
197
+;       rts             ;x must = 0 on rts !!!
198
+       
199
+ttalk
200
+       jsr tstkdy      	;who do we talk to???
201
+       bcc kdy1        	;he's out there
202
+       jmp talk        	;serial dev.
203
+
204
+kdy1   pha             	;save (a)data
205
+       lda #italk
206
+       sta kdycmd
207
+       lda usekdy
208
+       ora #$40        	;write to kdy
209
+       sta usekdy
210
+       lda #kcmd1
211
+       jmp kdy75       	;finish up
212
+
213
+ttkatn
214
+       bit usekdy      	;do an open in with no sa...
215
+       bvs kdy5        	;kdy is pres...do nothing
216
+       jmp tkatn       	;serial
217
+
218
+ttksa
219
+       bit usekdy      	;do an open in with sa...
220
+       bvs kdy3        	;kdy is pres
221
+       jmp tksa
222
+
223
+kdy3
224
+       pha             	;save (a) data
225
+       lda sa
226
+       sta kdycmd
227
+       lda #kcmd2
228
+       jmp kdy75
229
+
230
+tlistn
231
+       jsr tstkdy      	;do an open out with fa...
232
+       bcc kdy4        	;he's out there...
233
+       jmp listn
234
+
235
+kdy4
236
+       pha             	;save (a) data
237
+       lda #ilstn
238
+       sta kdycmd
239
+       lda usekdy
240
+       ora #$80
241
+       sta usekdy
242
+       lda #kcmd1      	;tell tedisk to listen
243
+       jmp kdy75
244
+
245
+tscatn
246
+       bit usekdy      	;do an open out with no sa...
247
+       bmi kdy5
248
+       jmp scatn
249
+
250
+kdy5
251
+       rts             	;do nothing for kdy
252
+
253
+tsecnd
254
+       bit usekdy      	;do an open out with sa...
255
+       bmi kdy6
256
+       jmp secnd
257
+
258
+kdy6
259
+       pha             	;save (a) data
260
+       sta kdycmd
261
+       lda #kcmd2
262
+       jmp kdy75
263
+
264
+;end

KERNAL_TED/overflow.src → KERNAL_TED_04/overflow.src View File


KERNAL_TED/patches.src → KERNAL_TED_04/patches.src View File


KERNAL_TED/rs232.src → KERNAL_TED_04/rs232.src View File


KERNAL_TED/save.src → KERNAL_TED_04/save.src View File


KERNAL_TED/serial.src → KERNAL_TED_04/serial.src View File


KERNAL_TED/split.src → KERNAL_TED_04/split.src View File


KERNAL_TED/tapred.src → KERNAL_TED_04/tapred.src View File


KERNAL_TED/tapsup.src → KERNAL_TED_04/tapsup.src View File


KERNAL_TED/tapwrt.src → KERNAL_TED_04/tapwrt.src View File


KERNAL_TED/time.src → KERNAL_TED_04/time.src View File


KERNAL_TED/util.src → KERNAL_TED_04/util.src View File


+ 69
- 0
KERNAL_TED_04/vectors.src View File

@@ -0,0 +1,69 @@
1
+	.page
2
+	.subttl  'vectors  02/17/84'
3
+	*=$ff4c
4
+       jmp print       	;**must be here**... basic needs this jump
5
+       jmp primm       	;**must be here**... basic needs this jump
6
+       jmp entry       	;**must be here**... basic needs this jump
7
+
8
+	*=$ff80
9
+	.if   palmod
10
+	.byte   $84     ;release number of ted kernal (msb=1=pal version)
11
+	.else
12
+	.byte   $04	;release number of ted kernal (msb=0=ntsc version)
13
+	.endif
14
+
15
+       jmp cint
16
+       jmp ioinit
17
+       jmp ramtas
18
+       jmp restor      	;restore vectors to initial system
19
+       jmp vector      	;change vectors for user
20
+       jmp setmsg      	;control o.s. messages
21
+       jmp tsecnd      	;send sa after listen          /cheap/
22
+       jmp ttksa       	;send sa after talk            /cheap/
23
+       jmp memtop      	;set/read top of memory
24
+       jmp membot      	;set/read bottom of memory
25
+       jmp scnkey      	;scan keyboard
26
+       jmp settmo      	;set timeout in ieee
27
+       jmp tacptr      	;handshake ieee byte in         /cheap/
28
+       jmp tciout      	;handshake ieee byte out        /cheap/
29
+       jmp tuntlk      	;send untalk out ieee           /cheap/
30
+       jmp tunlsn      	;send unlisten out ieee         /cheap/
31
+       jmp tlistn      	;send listen out ieee           /cheap/
32
+       jmp ttalk       	;send talk out ieee             /cheap/
33
+       jmp readss      	;return i/o status byte
34
+       jmp setlfs      	;set la, fa, sa
35
+       jmp setnam      	;set length and fn adr
36
+open   jmp (iopen)     	;open logical file
37
+close  jmp (iclose)    	;close logical file
38
+chkin  jmp (ichkin)    	;open channel in
39
+ckout  jmp (ickout)    	;open channel out
40
+clrch  jmp (iclrch)    	;close i/o channel
41
+basin  jmp (ibasin)    	;input from channel
42
+bsout  jmp (ibsout)    	;output to channel
43
+       jmp loadsp      	;load from file
44
+       jmp savesp      	;save to file
45
+       jmp settim      	;set internal clock
46
+       jmp rdtim       	;read internal clock
47
+stop   jmp (istop)     	;scan stop key
48
+getin  jmp (igetin)    	;get char from q
49
+clall  jmp (iclall)    	;close all files
50
+judtim jmp udtim       	;increment clock
51
+jscrog jmp scrorg      	;screen org
52
+jplot  jmp plot        	;read/set x,y coord
53
+       jmp iobase
54
+	.page
55
+; the following code is necessary to prevent the problem where
56
+; the reset button is pressed while the rom is banked out. since
57
+; the ted chip has no reset pin, the processor will attempt to
58
+; fetch the reset vectors without banking in rom, and will get
59
+; garbage. this code is copied into ram behind the reset vectors,
60
+; and will switch the rom back on before transferring execution
61
+; to the reset routine.
62
+
63
+gostrt
64
+       sta romon
65
+       jmp start
66
+	.wor   gostrt          	;initialization code
67
+	.wor   puls            	;interrupt handler
68
+
69
+;end

+ 254
- 0
KERNAL_TED_05/assem.src View File

@@ -0,0 +1,254 @@
1
+       .page
2
+	.subttl 'assem'
3
+;  simple assembler
4
+;  syntax:      a 1111 lda ($00,x)
5
+;               a 1111 dex:               (':' = terminator)
6
+
7
+assem
8
+       bcc as005
9
+       jmp error
10
+as005
11
+       jsr t0tot2
12
+as010
13
+       ldx #0
14
+       stx hulp+1      	;clear left mnemonic
15
+as020
16
+       jsr gnc         	;get a char
17
+       bne as025       	;check for eol
18
+       cpx #0
19
+       bne as025
20
+       jmp main        	;if eol & no mnemonic, exit cleanly
21
+as025
22
+       cmp #$20        	;is it a space ?
23
+       beq as010       	;yes - start again
24
+       sta msal,x      	;no - save char
25
+       inx
26
+       cpx #3          	;got three chars ?
27
+       bne as020       	;no - loop
28
+as030
29
+       dex             	;squished all three ?
30
+       bmi as045       	;yes
31
+       lda msal,x      	;no - first in last out
32
+       sec             	;no borrow
33
+       sbc #$3f        	;normalize
34
+       ldy #5          	;set for 5 shift rights
35
+as040
36
+       lsr a
37
+       ror hulp+1      	;left mnemonic
38
+       ror hulp        	;right mnemonic
39
+       dey             	;done 5 shifts?
40
+       bne as040       	;no-loop
41
+       beq as030       	;always
42
+
43
+as045
44
+       ldx #2          	;move index past mnemonic
45
+as050
46
+       jsr gnc         	;get a char
47
+       beq as100       	;done if eol
48
+       cmp #' '        	;a space
49
+       beq as050       	;yes-skip it
50
+       jsr chrtst      	;a hex #?
51
+       bcs as070       	;no-buffer if
52
+       jsr rdob2       	;fin a read byte
53
+       ldy t0          	;shift t0 to t0+1
54
+       sty t0+1
55
+       sta t0          	;save byte
56
+       lda #'0         	;buffer ascii 0
57
+       sta hulp,x
58
+       inx
59
+as070
60
+       sta hulp,x
61
+       inx
62
+       cpx #10         	;watch buffer size
63
+       bcc as050       	;branch if not full
64
+as100
65
+       stx t1          	;save input # of chars
66
+       ldx #0
67
+       stx wrap        	;start trial at zero
68
+as110
69
+       ldx #0
70
+       stx tmpc        	;disa index=0
71
+       lda wrap        	;get trial byte
72
+       jsr dset        	;digest it
73
+       ldx format      	;save format for later
74
+       stx t1+1
75
+       tax             	;index into mnemonic table
76
+       lda mnemr,x     	;get compressed
77
+       jsr tstrx       	;mnemonic and test
78
+       lda mneml,x
79
+       jsr tstrx
80
+       ldx #6          	;six format bits
81
+as210
82
+       cpx #3
83
+       bne as230
84
+       ldy length
85
+       beq as230       	;skip-single byte instr
86
+as220
87
+       lda format
88
+       cmp #$e8        	;a relative instr?
89
+       lda #'0         	;test zeros
90
+       bcs as250       	;no-3 byte
91
+       jsr tst2        	;test a byte,2 chars
92
+       dey
93
+       bne as220
94
+as230
95
+       asl format
96
+       bcc as240
97
+       lda char1-1,x
98
+       jsr tstrx       	;test syntax
99
+       lda char2-1,x
100
+       beq as240
101
+       jsr tstrx       	;test more syntax
102
+as240
103
+       dex
104
+       bne as210
105
+       beq as300
106
+as250
107
+       jsr tst2        	;test a word,4 chars
108
+       jsr tst2
109
+as300
110
+       lda t1          	;check # chars of both
111
+       cmp tmpc
112
+       beq as310       	;match, skip
113
+       jmp tst05       	;fail
114
+as310
115
+       ldy length
116
+       beq as500       	;if only 1 byte instr skip
117
+       lda t1+1        	;get saved format
118
+       cmp #$9d        	;a relative instr?
119
+       bne as400       	;no-skip
120
+
121
+       lda t0          	;calculate a relative
122
+       sbc t2          	;(.c=1 already)
123
+       sta diff
124
+       lda t0+1
125
+       sbc t2+1
126
+
127
+       bcc as320
128
+       bne aerr        	;out of range
129
+       ldx diff
130
+       bmi aerr
131
+       bpl as340
132
+as320
133
+       tay
134
+       iny             	;out of range,y=$ff
135
+       bne aerr
136
+       ldx diff
137
+       bpl aerr
138
+as340
139
+       dex             	;subtract 2 for instr
140
+       dex
141
+       txa
142
+       ldy length      	;set index to length
143
+       bne as420       	;branch always
144
+
145
+as400
146
+       lda t0-1,y      	;no-put byte out there
147
+as420
148
+       sta (t2),y
149
+       dey
150
+       bne as400
151
+as500
152
+       lda wrap        	;get good op code
153
+       sta (t2),y
154
+       jsr cronly      	;get ready to overstrike line
155
+       ldx #msgasm     	;print 'a(sp)'
156
+       jsr msgxxx
157
+       jsr dis400      	;disassemble one line
158
+
159
+       inc length
160
+       lda length
161
+       jsr addt2       	;update address
162
+
163
+       lda #'a         	;set up next line with 'a nnnn ' for convience
164
+       sta keyd        	;put it in the keyboard buffer
165
+       lda #$20
166
+       sta keyd+1
167
+       sta keyd+6
168
+       lda t2+1
169
+       jsr makhex
170
+       sta keyd+2
171
+       stx keyd+3
172
+       lda t2
173
+       jsr makhex
174
+       sta keyd+4
175
+       stx keyd+5
176
+       lda #7
177
+       sta ndx
178
+       jmp main
179
+
180
+
181
+
182
+;  test char in .a with char in hulp
183
+;
184
+tst2
185
+       jsr tstrx       	;do two tests
186
+tstrx
187
+       stx sxreg
188
+       ldx tmpc        	;get current position
189
+       cmp hulp,x      	;same char
190
+       beq tst10       	;yes-skip
191
+       pla             	;pull jsr off stack
192
+       pla
193
+
194
+tst05
195
+       inc wrap        	;try next trial
196
+       beq aerr        	;=0 tried all,sorry
197
+       jmp as110
198
+
199
+aerr
200
+       jmp error
201
+
202
+tst10
203
+       inx
204
+       stx tmpc
205
+       ldx sxreg       	;restore x
206
+       rts
207
+
208
+
209
+
210
+;  character test
211
+;  test for char between 0-f
212
+;  if 0<=char<=f then carry=0
213
+;
214
+chrtst
215
+       cmp #'a
216
+       bcc chr10       	;must be 0-9
217
+       cmp #'g
218
+       rts
219
+chr10
220
+       cmp #'0
221
+       bcc chr20       	;error
222
+       cmp #':
223
+       rts
224
+
225
+
226
+
227
+rdob2
228
+       jsr hexit
229
+       asl a
230
+       asl a
231
+       asl a
232
+       asl a
233
+       sta bad
234
+       jsr gnc
235
+       jsr hexit
236
+       ora bad
237
+chr20
238
+       sec
239
+       rts
240
+
241
+
242
+
243
+hexit
244
+       cmp #$3a
245
+       php
246
+       and #$0f
247
+       plp
248
+       bcc hex09
249
+       adc #8
250
+hex09
251
+       rts
252
+
253
+;end
254
+

+ 198
- 0
KERNAL_TED_05/banking.src View File

@@ -0,0 +1,198 @@
1
+	.page
2
+	.subttl  'banking'
3
+;***********************************************************************
4
+;
5
+;                 software supporting banking hardware
6
+;
7
+;  *******  this code must fit *entirely* between $fc00-$fcff  *******
8
+;
9
+;
10
+; set up each of the four possible slots, and test if there is a
11
+; device in that slot. if so, store that devices number in the cor-
12
+; responding entry in the physical address translation (pat) table.
13
+; if a device is found to have a number of '1', it will be logged in the
14
+; table, and a jump to that devices cold-start routine will be performed.
15
+;
16
+;***********************************************************************
17
+
18
+poll
19
+       ldx #3
20
+       stx xsav
21
+       lda #0
22
+poll10
23
+       sta pat,x       	;first zero out all pat entries
24
+       dex
25
+       bpl poll10
26
+
27
+poll20			;set up and test each bank
28
+       ldx xsav
29
+       lda dblx,x      	;set up both upper & lower banks
30
+       tax
31
+       sta bnksel,x
32
+       ldy #2
33
+poll30
34
+       lda $8007,y     	;test for 'cbm' (in ascii)
35
+       cmp cbmmsg,y
36
+       bne poll50      	;no match
37
+       dey
38
+       bpl poll30      	;keep looking
39
+
40
+       lda $8006       	;it's 'cbm'...now get device number
41
+       ldx xsav
42
+       sta pat,x
43
+       cmp #1          	;autostart?
44
+       bne poll50      	;no
45
+       stx curbnk      	;yes, give them the bank configuration,
46
+       jsr $8000       	;.. then go to cold start routine.
47
+
48
+poll50
49
+       dec xsav
50
+       bpl poll20
51
+       rts
52
+
53
+cbmmsg .byte 'CBM'
54
+	.page
55
+;*************************************************
56
+;
57
+; call every active cartridges cold start routine.
58
+;
59
+;*************************************************
60
+
61
+phenix
62
+       sei
63
+       ldx #3
64
+phen2
65
+       lda pat,x
66
+       beq phen3       	;no cartridge in this slot if 0
67
+
68
+       txa
69
+       pha
70
+       lda dblx,x      	;select low and high rom
71
+       tax
72
+       sta bnksel,x
73
+       stx curbnk
74
+       jsr $8000       	;call it's cold start routine
75
+       pla
76
+       tax
77
+phen3
78
+       dex
79
+       bne phen2       	;do slots 3,2,1 - ext2, ext1, int
80
+
81
+       sta bnksel      	;set up system bank
82
+       stx curbnk      	;..as current bank
83
+       cli
84
+       rts
85
+
86
+dblx   .byte %00000000,%00000101,%00001010,%00001111
87
+	.page
88
+;***********************************************
89
+; fetch a byte long
90
+;    entry:
91
+;       your bank in acc
92
+;       target bank in x
93
+;       target address in fetptr,fetptr+1
94
+;       offset from address in y
95
+;
96
+;    return with value in a
97
+;***********************************************
98
+
99
+fetchl
100
+       sta bnksel,x
101
+       tax
102
+       lda (fetptr),y
103
+       sta bnksel,x
104
+       rts
105
+	.page
106
+;***********************************************************************
107
+; call a subroutine in another bank
108
+;     enter with:
109
+;       your bank in acc
110
+;       target bank in x
111
+;       fetxrg, fetarg, fetsrg loaded with x, a, and s to go into routine
112
+;       address in lngjmp, lngjmp+1
113
+;
114
+;     return with:
115
+;       fetxrg, fetarg, fetsrg loaded with x, a, and s from routine
116
+;***********************************************************************
117
+
118
+long
119
+       pha             	;save return bank combo
120
+       stx curbnk      	;set up target bank combo
121
+       sta bnksel,x
122
+       ldx fetxrg
123
+       lda fetsrg
124
+       pha
125
+       lda fetarg
126
+       plp
127
+       jsr lngrt1
128
+       sta fetarg
129
+       php
130
+       pla
131
+       sta fetsrg
132
+       stx fetxrg
133
+       pla
134
+       sta curbnk
135
+       tax
136
+       sta bnksel,x
137
+       rts
138
+
139
+lngrt1
140
+       jmp (lngjmp)
141
+	.page
142
+;***********************************************************************
143
+;
144
+; long irq routine.
145
+; called by a bank which has received an interrupt, and wishes to have
146
+; the system roms (kernal/basic) service the interrupt.
147
+;
148
+; the users irq vector should point to the following routine in his rom:
149
+;
150
+;       pha  ;save accum.
151
+;       txa
152
+;       pha  ;save x reg
153
+;       tya
154
+;       pha  ;save y reg
155
+;        .
156
+;        .
157
+;   determine if this is an interrupt to be serviced by the kernal.
158
+;     if so....
159
+;       jmp lngirq
160
+;
161
+; *note* before calling this routine, curbank must contain your bank #
162
+;
163
+;***********************************************************************
164
+
165
+puls			;entry for normal irq's
166
+       pha
167
+       txa
168
+       pha
169
+       tya
170
+       pha
171
+
172
+lngirq			;entry for irq's passed from banking cartridges
173
+       sta bnksel      	;select system roms
174
+       jmp krnirq      	;kernal irq routine
175
+
176
+irqret
177
+       ldx curbnk      	;restore previous bank
178
+       sta bnksel,x
179
+       pla
180
+       tay
181
+       pla
182
+       tax
183
+       pla
184
+       rti
185
+	.page
186
+gobvec
187
+       ldx curbnk
188
+       sta $fdd0,x
189
+       jmp (bnkvec)
190
+
191
+	*=$fcf1		;jump table for banking routines
192
+       jmp gobvec
193
+       jmp phenix
194
+       jmp fetchl
195
+       jmp long
196
+       jmp lngirq
197
+
198
+;end

+ 255
- 0
KERNAL_TED_05/channelio.src View File

@@ -0,0 +1,255 @@
1
+	.page
2
+	.subttl 'channelio'
3
+;***************************************
4
+;* getin -- get character from channel *
5
+;* channel is determined by dfltn.     *
6
+;* if device is 0, keyboard queue is   *
7
+;* examined and a character removed if *
8
+;* available. if queue is empty, z     *
9
+;* flag is returned set. devices 1-31  *
10
+;* advance to basin.                   *
11
+;***************************************
12
+
13
+ngetin
14
+       lda dfltn       	;check device
15
+       bne bn10        	;not keyboard
16
+
17
+       lda ndx         	;queue index
18
+       ora kyndx
19
+       beq gn20        	;nobody there...exit
20
+       sei
21
+       jmp lp2         	;go remove a character
22
+
23
+
24
+
25
+;***************************************
26
+;* basin-- input character from channel*
27
+;* input differs from get on device    *
28
+;* #0 function which is keyboard. the  *
29
+;* screen editor makes ready an entire *
30
+;* line which is passed char by char   *
31
+;* up to the carriage return. other    *
32
+;* devices are:                        *
33
+;*          0 -- keyboard              *
34
+;*          3 -- screen                *
35
+;*          1 -- cassette              *
36
+;*          2 -- rs-232                *
37
+;*          4-31 -- serial bus         *
38
+;***************************************
39
+
40
+nbasin
41
+       lda dfltn       	;check device
42
+       bne bn10        	;is not keyboard...
43
+;
44
+;  input from keyboard
45
+;
46
+       lda pntr        	;save current...
47
+       sta lstp        	;... cursor column
48
+       lda tblx        	;save current...
49
+       sta lsxp        	;... line number
50
+       jmp loop5       	;blink cursor until return
51
+
52
+bn10
53
+       cmp #3          	;is input from screen?
54
+       bne bn30        	;nope, try cassette, 232 or serial
55
+
56
+       ora crsw
57
+       sta crsw        	;fake a carriage return
58
+       lda scrt        	;say we ended...
59
+       sta indx        	;...up on this line
60
+       jmp loop5       	;pick up characters
61
+
62
+casi
63
+       jsr savxy
64
+       cmp #1
65
+       bne rs232i
66
+       jsr getcas
67
+       jmp rstxy
68
+
69
+rs232i
70
+       jsr agetch
71
+       jmp rstxy
72
+;
73
+;  input from serial bus
74
+;
75
+bn30
76
+       bcc casi        	;<3
77
+       lda status      	;status from last
78
+       beq tacptr      	;was good
79
+       lda #$0d        	;bad...all done
80
+gn20
81
+       clc             	;valid data, good return
82
+       rts
83
+
84
+
85
+
86
+getcas 			;get a chr from the cassette buffer
87
+       ldy tptr        	;test for bufr empty
88
+       cpy #bufmax
89
+       bcc notmt1      	;-mt
90
+       jsr rdblok      	;mt, read another block
91
+       bcc getcas      	;!bra, try again
92
+       rts             	;bad exit, carry should be set
93
+
94
+notmt1
95
+       ldy tptr        	;get bufptr
96
+       lda (tapebs),y  	;get chr
97
+       pha             	;save it
98
+       iny             	;try to look at next chr
99
+       cpy #bufmax
100
+       bcs notovr      	;no next chr
101
+       lda (tapebs),y  	;get next chr
102
+       bne notovr      	;..ok, not a #00
103
+       lda #64         	;wooops!, eof
104
+       jsr udst        	;flag it so
105
+
106
+notovr
107
+       inc tptr        	;advance buf ptr
108
+       pla             	;chr to be returned
109
+       clc             	;sucess flag
110
+       rts
111
+	.page
112
+;***************************************
113
+;* bsout -- out character to channel   *
114
+;* determined by variable dflto:       *
115
+;*           0 -- invalid (rs232?)     *
116
+;*           1 -- cassette             *
117
+;*           2 -- rs-232               *
118
+;*           3 -- screen               *
119
+;*        4-31 -- serial bus           *
120
+;***************************************
121
+
122
+nbsout
123
+       pha             	;preserve .a
124
+       lda dflto       	;check device
125
+       cmp #3          	;is it the screen?
126
+       bne bo10        	;nope, try somethin else...
127
+;
128
+;  print to crt
129
+;
130
+       pla             	;restore data
131
+       jmp print       	;print on crt
132
+
133
+bo10
134
+       bcc bo9         	;<3
135
+       pla
136
+       jmp tciout      	;print to serial bus
137
+
138
+bo9
139
+       jsr savaxy
140
+       cmp #1          	;is it cass?
141
+       bne boa         	;nope, try 232
142
+       ldy tptr        	
143
+
144
+;char to write is on top of stack...how much we got?
145
+
146
+       cpy #bufmax
147
+       bcc less1       	;ok, less than the max#
148
+       jsr wfblok      	
149
+
150
+;buf is full, write the block out to tape
151
+
152
+       bcs wrerr1      	;somebody goofed...
153
+       lda #bdf        	;set up a new output buffer...
154
+       sta type
155
+       ldy #0          	;reset tape buf ptr
156
+less1
157
+       pla             	;get the chr to write...
158
+       sta (tapebs),y  	;into buffer
159
+       iny             	;advance buf ptr
160
+       sty tptr        	;save it (or reset it...)
161
+       bcc boa1        	;good exit, tell 'em  (.c=0 always!)
162
+
163
+wrerr1
164
+       pla             	;ditch data
165
+       lda #0
166
+       jmp rstxy       	;(.c=1)
167
+
168
+
169
+boa
170
+       pla
171
+       jsr aputch      	;input a char to queue
172
+boa1
173
+       jmp rstaxy
174
+	.page
175
+;  ***** tedisk support routines... {channel i/o} *****
176
+;
177
+tacptr
178
+       stx wrbase      	;save .x
179
+       bit usekdy      	;use kdy for rd?
180
+       bvs kdy8        	;yes b.6=1
181
+       ldx wrbase      	;restore .x
182
+       jmp acptr       	;...else serial
183
+
184
+kdy8
185
+       lda usekdy      	;get i/o slot
186
+       and #%00110000
187
+       tax             	;$fec0, $fef0
188
+       lda #kcmd4
189
+       sta tedrva-48,x 	;write command
190
+kdy85
191
+       lda tedrvc-48,x 	;wait for rdy to go low
192
+       bmi kdy85
193
+       lda #$00
194
+       sta drva2-48,x  	;setup dat/dir for inputs
195
+       sta tedrvc-48,x 	;drop rdy low
196
+kdy86
197
+       lda tedrvc-48,x 	;wait for rdy to go high
198
+       bpl kdy86
199
+       lda tedrvb-48,x 	;retr status
200
+       and #3          	;mask status bits
201
+       cmp #3          	;eoi ?
202
+       bne kdy88
203
+       lda #$40
204
+kdy88
205
+       jsr udst        	;update status for basic
206
+       lda tedrva-48,x 	;get data
207
+       pha             	;*
208
+       lda #$40
209
+       sta tedrvc-48,x 	;set rdy high
210
+kdy89
211
+       lda tedrvc-48,x 	;wait for dav to go low
212
+       bmi kdy89
213
+       lda #$ff
214
+       sta drva2-48,x  	;turn ports around i got data & status
215
+       lda #$00
216
+       sta tedrva-48,x 	;clear cmd chnl
217
+       sta tedrvc-48,x 	;drop rdy low
218
+kdy90
219
+       jmp patchb      	;finish up
220
+       nop             	;extra byte
221
+
222
+
223
+tciout
224
+       bit usekdy      	;use kdy for wr?
225
+       bmi kdy7        	;yes b.7=1
226
+       jmp ciout       	;else serial
227
+
228
+kdy7
229
+       pha             	;save (a)
230
+       sta kdycmd
231
+       lda #kcmd3
232
+kdy75  stx wrbase
233
+       pha             	;save cmd
234
+       lda usekdy
235
+       and #%00110000
236
+       tax             	;get i/o offset
237
+       pla             	;retr. cmd
238
+       sta tedrva-48,x 	;send cmd
239
+kdy76
240
+       lda tedrvc-48,x 	;wait for dav ack
241
+       bmi kdy76
242
+       lda kdycmd      	;ret state cmd
243
+       sta tedrva-48,x
244
+       lda #$00
245
+       sta tedrvc-48,x 	;drop dav low
246
+kdy77
247
+       lda tedrvc-48,x 	;wait for rdy to go high
248
+       bpl kdy77
249
+       lda tedrvb-48,x 	;retr status
250
+       and #3          	;mask status
251
+kdy79
252
+       jsr udst        	;update basic
253
+       jmp patcha      	;finish up
254
+
255
+;end

+ 75
- 0
KERNAL_TED_05/clall.src View File

@@ -0,0 +1,75 @@
1
+	.page
2
+	.subttl 'close all files'
3
+;*************************************
4
+;* clall -- close all logical files  *
5
+;* deletes all table entries and     *
6
+;* restores default i/o channels     *
7
+;* and clears serial port devices.   *
8
+;*************************************
9
+
10
+nclall
11
+       lda #0
12
+       sta ldtnd       	;forget all files
13
+
14
+
15
+
16
+;****************************************
17
+;* clrch -- clear channels              *
18
+;* unlisten or untalk serial devcs, but *
19
+;* leave others alone. default channels *
20
+;* are restored.                        *
21
+;****************************************
22
+
23
+nclrch
24
+       ldx #3
25
+       cpx dflto       	;is output channel serial?
26
+       bcs jx750       	;no...
27
+       jsr tunlsn      	;yes...unlisten it
28
+jx750
29
+       cpx dfltn       	;is input channel serial?
30
+       bcs clall2      	;no...
31
+       jsr tuntlk      	;yes...untalk it
32
+;
33
+; restore default values
34
+;
35
+clall2
36
+       stx dflto       	;output chan=3=screen
37
+       lda #0
38
+       sta dfltn       	;input chan=0=keyboard
39
+       rts
40
+
41
+
42
+;***** tedisk support routines {state change} *****
43
+;
44
+tunlsn
45
+       bit usekdy      	;unlisten patch
46
+       bmi kdy9        	;kdy was listening...
47
+       jmp unlsn       	;serial was...
48
+
49
+kdy9
50
+       pha             	;save (a)
51
+       lda #iulstn
52
+       sta kdycmd
53
+       lda usekdy      	;status shows unlisten
54
+       and #$7f
55
+       sta usekdy
56
+       lda #kcmd1
57
+       jmp kdy75       	;send cmd
58
+
59
+tuntlk
60
+       bit usekdy      	;untalk patch
61
+       bvs kdya
62
+       jmp untlk
63
+
64
+kdya
65
+       pha             	;save (a)
66
+       lda #iutalk
67
+       sta kdycmd
68
+       lda usekdy
69
+       and #$bf
70
+       sta usekdy
71
+       lda #kcmd1
72
+       jmp kdy75       	;send cmd
73
+
74
+;end
75
+

+ 154
- 0
KERNAL_TED_05/close.src View File

@@ -0,0 +1,154 @@
1
+	.page
2
+	.subttl 'close'
3
+;***************************************
4
+;* close -- close logical file         *
5
+;*                                     *
6
+;* the logical file number of the      *
7
+;* file to be closed is passed in .a.  *
8
+;* keyboard, screen, and files not     *
9
+;* open pass straight through. tape    *
10
+;* files open for write are closed by  *
11
+;* dumping the last buffer and         *
12
+;* conditionally writing an end of     *
13
+;* tape block.serial files are closed  *
14
+;* by sending a close file command if  *
15
+;* a secondary address was specified   *
16
+;* in its open command.                *
17
+;***************************************
18
+
19
+nclose
20
+       ror wrbase      	;save serial close flag
21
+       jsr jltlk       	;look file up
22
+       beq jx050       	;open...
23
+       clc             	;else return
24
+       rts
25
+
26
+jx050
27
+       jsr jz100       	;extract table data
28
+       txa             	;save table index
29
+       pha
30
+
31
+       lda fa          	;check device number
32
+       beq jx150       	;is keyboard...done
33
+       cmp #3
34
+       beq jx150       	;is screen...done
35
+
36
+       bcs jx120       	;is serial address it
37
+       cmp #2          	;rs232?
38
+       bne jx115       	;no, was tape
39
+;
40
+; rs232 close ;...by brute force
41
+;
42
+       php             	;!mutex
43
+       sei
44
+       jsr ainit       	;reset pointers, variables, & acia
45
+       plp             	;!mutex
46
+       beq jx150       	;always
47
+;
48
+; close tape data file
49
+;
50
+jx115
51
+       lda sa          	;was it a tape read?
52
+       and #$f
53
+       beq jx150       	;yes
54
+       ldy tptr        	;else a write
55
+       cpy #bufmax
56
+       bcc jx116       	;buf not full
57
+       jsr wfblok      	;else write out a full block first
58
+       bcs jx117       	;write exception
59
+       lda #bdf        	;setup new block
60
+       sta type
61
+       ldy #0
62
+       sty tptr
63
+jx116
64
+       lda #0
65
+       sta (tapebs),y
66
+       jsr wfblok      	;write out final block
67
+       bcc jx118       	;ok
68
+jx117
69
+       pla             	;get index off stack
70
+       lda #0          	;error exit (stop key pressed)
71
+       rts
72
+
73
+jx118
74
+       lda sa          	;write eot-block?
75
+       cmp #$62
76
+       bne jx150       	;no
77
+       jsr wreot       	;yes
78
+       jmp jx150
79
+;
80
+; close a serial file
81
+;
82
+jx120
83
+       bit wrbase      	;do a real close?
84
+       bpl ropen       	;yep
85
+       lda fa          	;no if a disk & sa=$f
86
+       cmp #8
87
+       bcc ropen       	;>8 ==>not a disk, do real close
88
+       lda sa
89
+       and #$f
90
+       cmp #$f
91
+       beq jx150       	;sa=$f, no real close
92
+ropen
93
+       jsr clsei       	;else do a real close
94
+
95
+
96
+; entry to remove a give logical file
97
+; from table of logical, primary,
98
+; and secondary addresses
99
+
100
+jx150
101
+       pla             	;get table index off stack
102
+       tax
103
+       dec ldtnd
104
+       cpx ldtnd       	;is deleted file at end?
105
+       beq jx170       	;yes...done
106
+
107
+; delete entry in middle by moving
108
+; last entry to that position.
109
+
110
+       ldy ldtnd
111
+       lda lat,y
112
+       sta lat,x
113
+       lda fat,y
114
+       sta fat,x
115
+       lda sat,y
116
+       sta sat,x
117
+
118
+jx170
119
+       clc             	;close exit
120
+jx175
121
+       rts
122
+
123
+
124
+
125
+; lookup tablized logical file data
126
+;
127
+lookup
128
+       lda #0
129
+       sta status
130
+       txa
131
+jltlk
132
+       ldx ldtnd
133
+jx600
134
+       dex
135
+       bmi jz101
136
+       cmp lat,x
137
+       bne jx600
138
+       rts
139
+;
140
+; routine to fetch table entries
141
+;
142
+jz100
143
+       lda lat,x
144
+       sta la
145
+       lda sat,x
146
+       sta sa
147
+       lda fat,x       	;must return w/.a=fa & flags set!
148
+       sta fa
149
+jz101
150
+       rts
151
+
152
+;rsr 5/12/82 - modify for cln232
153
+;end
154
+

+ 307
- 0
KERNAL_TED_05/cmds1.src View File

@@ -0,0 +1,307 @@
1
+	.page
2
+	.subttl 'cmds1   02/17/84'
3
+;**********************************************
4
+;
5
+;   monitor with mini-assembler/disassembler
6
+;
7
+;**********************************************
8
+
9
+entry
10
+       ldx #0          	;call entry***************
11
+       stx flgs
12
+       beq ent010      	;always (.x=msgmon=0)
13
+
14
+entbrk
15
+       cld             	;break entry***************
16
+       ldx #5
17
+ent005
18
+       pla             	;save regs & flags
19
+       sta pch,x
20
+       dex
21
+       bpl ent005
22
+       ldx #msgbrk
23
+
24
+ent010
25
+       stx syreg
26
+       lda #$c0
27
+       sta msgflg      	;enable kernal msgs
28
+
29
+       tsx
30
+       stx sp
31
+       ldx syreg
32
+       jsr msgxxx
33
+
34
+       lda tedvcr      	;make sure screen is enabled
35
+       ora #$10
36
+       sta tedvcr
37
+
38
+       lda #0          	;zero out 'last address' reg
39
+       sta t2
40
+       sta t2+1
41
+       cli             	;be sure to allow these!
42
+
43
+
44
+dspreg
45
+       ldx #msgreg
46
+       jsr msgxxx
47
+       lda pch
48
+       jsr puthex
49
+       ldy #0
50
+dspr10
51
+       lda pcl,y
52
+       jsr puthxs
53
+       iny
54
+       cpy #6
55
+       bcc dspr10
56
+       bcs main        	;always
57
+
58
+
59
+error
60
+       jsr putqst
61
+
62
+
63
+main
64
+       jsr crlf
65
+       ldx #0          	;'getbuf' now in-line!
66
+       stx chrptr
67
+main00
68
+       jsr basin
69
+       sta buf,x
70
+       inx
71
+       cmp #cr        	;read one line into buffer