• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

学生時代に書いた OS になったはずの起点のソースコードです。(その授業は一応合格できました。)


Commit MetaInfo

Revisiona8999a24f01c9e4c630bae921e15824fc0294f30 (tree)
Time2013-07-08 16:38:24
AuthorJoel Matthew Rees <reiisi@user...>
CommiterJoel Matthew Rees

Log Message

Adding a license clause, since the source is now in a
publically available place,

Change Summary

Incremental Difference

--- a/oswind3test.as9
+++ b/oswind3test.as9
@@ -1,3 +1,19 @@
1+00010 * The beginnings of a simple operating system for the
2+00011 * 6809 on the TRS-80 Color Computer
3+00012 * written in fulfillment of
4+00013 * the Operating Systems part 2 class at BYU
5+00014 * in 1986 or thereabouts.
6+00015 * By Joel Matthew Rees,
7+00016 * Copyright 2013 Joel Matthew Rees
8+00020 *
9+00021 * Offered under the GPL, v. 3.
10+00022 * See the LICENSE.TXT file for details on use and distribution.
11+00023 *
12+00030 * The source in its current form is this single file.
13+00031 * It was originally developed on a
14+00032 * tape-and-cartridge development system,
15+00033 * Using Radio Shack's EDTAM+ cartridge.
16+00034 *
117 00080 ORG $5000
218 00090 SYSGLO EQU *
319 00100 * SYSGLO MUST BE ON EVEN PAGE (256 BYTE) BOUNDARY
--- /dev/null
+++ b/oswind3test.as9~
@@ -0,0 +1,962 @@
1+00010 * The beginnings of a simple operating system for the
2+00011 * 6809 on the TRS-80 Color Computer
3+00012 * written in fulfillment of
4+00013 * the Operating Systems part 2 class at BYU
5+00014 * in 1986 or thereabouts.
6+00015 * By Joel Matthew Rees,
7+00016 * Copyright 2013 Joel Matthew Rees
8+00017 * Offered under the GPL, v. 3.
9+00018 * See the LICENSE.TXT file for details on use and distribution.
10+00020 *
11+00030 * The source in its current form is this single file.
12+00031 * It was originally developed on a
13+00032 * tape-and-cartridge development system,
14+00033 * Using Radio Shack's EDTAM+ cartridge.
15+00034 *
16+00080 ORG $5000
17+00090 SYSGLO EQU *
18+00100 * SYSGLO MUST BE ON EVEN PAGE (256 BYTE) BOUNDARY
19+00105 IVSAVE RMB 2 IRQ VECTOR FOR RETURN TO EDTASM
20+00106 SVSAVE RMB 2 SWI VECTOR FOR RETURN TO EDTASM
21+00110 HASTY RMB 1 ABBREVIATE IRQ (TIMER) SERVICE?
22+00120 SLICEL FCB 10 LIMIT OF TICKS/SLICE
23+00130 SLICE RMB 1 COUNT OF TICKS REMAINING IN THIS SLICE
24+00140 BEEP FCB 255 RMB 1 COUNT OF TICKS LEFT TO BEEP
25+00150 SYSERR FDB 0
26+00160 CURPRO FCB 0
27+00170 PROCIX FDB 0 ADDRESS OF ENTRY IN PROTBL
28+00180 SPEED FCB 0 COPY OF CURRENT PROCESS' PROCRT
29+00190 WINDIX FCB 0 POINTER TO CURRENT WINDOW
30+00200 SYSATT FCB 0 OPERATOR REQUEST FOR SYSTEM ATTENTION
31+00500 KEYOLD RMB 8 KEYBOARD SCAN TABLES
32+00510 KEYSCN RMB 8 OLD AND SCAN ARE NEGATIVE LOGIC
33+00520 KEYCHG RMB 8 POSITIVE LOGIC FOR CHANGES IN LAST SLICE
34+00530 KEYOPN RMB 8 POSITIVE LOGIC KEY RELEASE TABLE
35+00535 KEYLAS FCB -1
36+00536 KEYRAW FCB -1
37+00537 KEYVAL FCB 0
38+00540 KEYTIM FCB 0
39+00545 KEYRPT FCB 40 REPEAT PAUSE
40+00546 KEYRAT FCB 6 REPEAT PERIOD
41+00550 KEYIN FDB KEYBUF
42+00560 KEYOUT FDB KEYBUF
43+00600 YRBASE FDB 1900
44+00610 YEAR FCB 87
45+00620 MONTH FCB 4
46+00630 DAY FCB 1
47+00640 HOUR FCB 0
48+00650 MINUTE FCB 0
49+00660 SECOND FCB 0
50+00670 TICK FCB 0
51+00800 * 64 POTENTIAL LEAP YEARS IN BIT MAP (FASTER THAN DIVIDE)
52+00810 LYRTBL FCB $FE YEAR 1900
53+00820 FCB $FF
54+00830 FCB $FF
55+00840 FCB $FF YEAR 2000
56+00850 FCB $FF
57+00860 FCB $FF
58+00870 FCB $FB YEAR 2100
59+00880 FCB $FF
60+00890 *
61+00900 * TABLE OF DAYS IN MONTHS
62+00910 MONTBL FCB 0 NO DAYS IN MONTH ZERO
63+00920 FCB 31
64+00930 FCB 28
65+00940 FCB 31
66+00950 FCB 30
67+00960 FCB 31
68+00970 FCB 30
69+00980 FCB 31 JULY
70+00990 FCB 31 AUGUST
71+01000 FCB 30
72+01010 FCB 31
73+01020 FCB 30
74+01030 FCB 31
75+01040 FCB 0 NO DAYS
76+01050 FCB 0 IN MO.
77+01060 FCB 0 13-15 (FOR AUTO-RESTORING)
78+01070 *
79+01080 * KEYBOARD SCAN CODES
80+01090 KEYTBL FCB $60
81+01100 FCC 'abcdefghijklmnopqrstuvwxyz'
82+01110 FCB $13
83+01120 FCB $0A
84+01130 FCB 8
85+01140 FCB 9
86+01150 FCC ' 0123456789:;,-./'
87+01160 FCB $0D
88+01170 FCB KMT
89+01180 FCB 3
90+01190 FCB KMT
91+01200 FCB KMT
92+01205 FCB KMT
93+01210 FCB KMT
94+01215 FCB KMT
95+01220 KEYSHF FCC /@ABCDEFGHIJKLMNOPQRSTUVWXYZ/
96+01230 FCB $5E
97+01240 FCB '[
98+01250 FCB $5F
99+01260 FCC /] \!"#$%&'()*+<=>?/
100+01270 FCB $0C
101+01280 FCB 1
102+01290 FCB $7F
103+01291 FCB KMT
104+01292 FCB KMT
105+01293 FCB KMT
106+01294 FCB KMT
107+01295 FCB KMT
108+01300 KEYCTL FDB 1
109+01304 FDB $203
110+01308 FDB $405
111+01312 FDB $607
112+01316 FDB $809
113+01320 FDB $0A0B
114+01324 FDB $0C0D
115+01328 FDB $0E0F
116+01332 FDB $1011
117+01336 FDB $1213
118+01340 FDB $1415
119+01344 FDB $1617
120+01348 FDB $1819
121+01352 FDB $1A1B
122+01356 FDB $1C1D
123+01360 FDB $1E1F
124+01364 FDB $8081
125+01368 FDB $8283
126+01372 FDB $8485
127+01376 FDB $8687
128+01380 FDB $8889
129+01384 FDB $7C8B
130+01388 FDB $7B7E
131+01392 FDB $7D8F
132+01396 FCB $8A
133+01400 FCB KMT
134+01404 FCB KBREAK
135+01408 FCB KMT
136+01412 FCB KMT
137+01416 FCB KMT
138+01420 FCB KMT
139+01424 FCB 1
140+01428 *
141+01450 KEYBUF RMB 129
142+01460 KEYEND FDB 0 SAFETY
143+01500 NUMPRO EQU 16
144+01505 PROTBL EQU * P0 IS IDLE PROCESS
145+01510 PROCSP EQU *-PROTBL SYSTEM STACK POINTER IN SUSPENSE
146+01520 FDB IDLESP
147+01530 PROCSB EQU *-PROTBL SYSTEM STACK BASE
148+01540 FDB IDLESP
149+01542 PROCSL EQU *-PROTBL SYSTEM STACK LIMIT
150+01544 FDB IDLESL
151+01550 PROCUB EQU *-PROTBL USER STACK BASE
152+01560 FDB IDLEUB
153+01562 PROCUL EQU *-PROTBL USER (PARAMETER) STACK LIMIT
154+01564 FDB IDLEUL
155+01570 PROCBA EQU *-PROTBL BOTTOM OF PROCESS IMAGE
156+01580 FDB O START UP
157+01590 PROCLI EQU *-PROTBL TOP OF PROCESS IMAGE
158+01600 FDB IDLLIM
159+01940 PROCST EQU *-PROTBL PROCESS STATE
160+01950 FCB 0
161+01960 PROCRT EQU *-PROTBL OVERDRIVE (2X) CLOCK RATE FLAG
162+01970 FCB 0
163+01980 PROSIZ EQU *-PROTBL SIZE OF PROCESS TABLE
164+01990 RMB (NUMPRO-1)*PROSIZ
165+02000 *
166+02010 CARRY EQU 1 FLAG BIT
167+02020 TIMOVR EQU $8000
168+02030 IRQMSK EQU $10
169+02040 KEYROW EQU $FF00
170+02050 KEYCOL EQU $FF02
171+02060 IRQVEC EQU $10D
172+02065 SWIVEC EQU $107
173+02070 VIDMOD EQU $FF22
174+02080 BSOUND EQU 2
175+02090 OVRDRV EQU $FFD9
176+02100 KBREAK EQU $E0
177+02110 KMT EQU $F0
178+02120 SCRWID EQU 32
179+02130 VSPACE EQU $60 MC6847
180+02140 UNDEF EQU -1
181+02500 NUMWIN EQU 8
182+02502 WINTBL EQU *
183+02504 WSCR EQU *-WINTBL
184+02506 FCB 2 CONSOLE
185+02510 WLCOL EQU *-WINTBL
186+02520 FCB 0
187+02530 WWCOL EQU *-WINTBL
188+02540 FCB 12
189+02550 WTROW EQU *-WINTBL
190+02560 FCB 0
191+02570 WLROW EQU *-WINTBL
192+02580 FCB 5
193+02590 WCURCL EQU *-WINTBL
194+02600 FCB 0
195+02610 WCURRW EQU *-WINTBL
196+02620 FCB 0
197+02630 WCSCLR EQU *-WINTBL
198+02640 FCB $8F
199+02650 WCSTIM EQU *-WINTBL
200+02660 FCB 0
201+02670 WCSTAT EQU *-WINTBL B7=DISPLAY B6-B0=COUNT
202+02680 FCB $8F
203+02700 WINSIZ EQU *-WINTBL
204+02709 * CLOCK WINDOW
205+02710 FCB 2
206+02711 FCB 13
207+02712 FCB 18
208+02713 FCB 0
209+02714 FCB 0
210+02715 FCB 0
211+02716 FCB 0
212+02717 FCB $8F
213+02718 FCB 0
214+02719 FCB 0
215+02720 *
216+02721 * TEST WINDOW
217+02722 FCB 2
218+02723 FCB 0
219+02724 FCB 31
220+02725 FCB 6
221+02726 FCB 9
222+02727 FCB 0
223+02728 FCB 0
224+02729 FCB $8F
225+02730 FCB 0
226+02731 FCB $83
227+02732 *
228+02890 RMB (NUMWIN-2)*WINSIZ
229+02900 KSTACO FDB 0
230+02910 RMB $100 KERNEL'S STACK
231+02920 KSTACK EQU *
232+02930 KUSTKO FDB 0
233+02940 RMB $100 KERNEL'S PARAMETER STACK
234+02950 KUSTAK EQU *
235+02960 FDB 0
236+03000 *
237+03010 * SYSGLO CONTAINS SYSTEM GLOBALS
238+03020 IRQSRV INC TICK,PCR
239+03030 TST HASTY,PCR
240+03040 BEQ *+3
241+03050 RTI
242+03060 *
243+03065 * CLR OVRDRV SWITCH TO WARP SPEED
244+03070 * INDEX PROCESS TABLE ENTRY
245+03072 LEAX PROTBL,PCR
246+03074 LDA #PROSIZ
247+03076 LDB CURPRO
248+03078 MUL
249+03080 LEAX D,X
250+03082 STX PROCIX
251+03084 STS PROCSP,X
252+03090 * SWITCH TO KERNEL STACK
253+03095 LDU #KUSTAK
254+03100 LDS #KSTACK
255+03110 * DEFINITELY NOT RE-ENTRANT
256+03120 LEAY SYSGLO,PCR
257+03130 TFR Y,D
258+03140 TFR A,DP
259+03150 SETDP SYSGLO/$100
260+03155 * HALF OF 60 HZ BEL
261+03160 TST BEEP
262+03170 BEQ *+5
263+03200 LBSR CLICK
264+03205 *
265+03210 LDA TICK
266+03211 SUBA #60
267+03212 LBLO KEYRD
268+03213 INC SECOND
269+03214 STA TICK ALLOW TICKS TO OVERFLOW
270+03215 LDA SECOND
271+03220 SUBA #60
272+03230 LBLO KEYRD
273+03240 INC MINUTE
274+03250 STA SECOND ALLOW SECONDS TO OVERFLOW
275+03260 LDA MINUTE
276+03270 SUBA #60
277+03280 LBLO KEYRD
278+03290 INC HOUR
279+03300 CLR MINUTE
280+03310 LDA HOUR
281+03320 SUBA #24
282+03330 BLO KEYRD
283+03340 INC DAY
284+03350 CLR HOUR
285+03360 *
286+03370 LDA MONTH
287+03380 ANDA #$F CRUDE AUTO-RESTORE
288+03390 * CHECK LEAP YEAR
289+03400 CMPA #2
290+03410 BNE NOLEAP
291+03420 LDB YEAR
292+03430 BITB #3 MODULO 4
293+03440 BNE NOLEAP
294+03450 LSRB YEAR/4
295+03460 LSRB
296+03470 PSHS B
297+03480 LSRB YEAR/32
298+03490 LSRB
299+03500 LSRB
300+03510 LEAX LYRTBL,PCR
301+03520 LEAX B,X
302+03530 PULS A BIT #
303+03540 ANDA #7
304+03550 CLRB
305+03560 ORCC #CARRY
306+03570 LYRBLP ROLB
307+03580 DECA
308+03590 BPL LYRBLP
309+03600 *
310+03610 ANDB ,X LEAP?
311+03620 BEQ NOLEAP
312+03630 LEAX MONTBL,PCR
313+03640 LDB 2,X
314+03650 INCB ONE MORE DAY
315+03660 CMPB DAY
316+03670 BHS KEYRD
317+03680 INC MONTH
318+03690 LDB #1
319+03700 STB DAY
320+03710 BRA KEYRD NOW MARCH, SAME YEAR
321+03720 *
322+03730 NOLEAP LDD MONTH
323+03740 ANDA #$F
324+03750 LEAX MONTBL,PCR
325+03760 CMPB A,X CHECK DAYS FOR THIS MONTH
326+03770 BLS KEYRD
327+03780 LDB #1
328+03790 STB DAY
329+03800 INCA
330+03810 CMPA #12
331+03820 BHI *+6
332+03830 STA MONTH
333+03840 BRA KEYRD
334+03850 STB MONTH
335+03860 INC YEAR
336+03870 BNE KEYRD
337+03880 LDD #TIMOVR
338+03890 STD SYSERR
339+03900 *
340+03910 KEYRD INC KEYTIM
341+03915 LDA KEYROW+1 CONTROL/STATUS REGISTER
342+03920 ANDA #.NOT.4 SELECT DATA DIRECTION REGISTER
343+03930 STA KEYROW+1
344+03940 CLRB 0-7 INPUT
345+03950 STB KEYROW
346+03960 ORA #4 SELECT DATA REGISTER
347+03970 STA KEYROW+1
348+03980 LDA KEYCOL+1
349+03990 ANDA #.NOT.4
350+04000 STA KEYCOL+1
351+04010 COMB ALL OUT
352+04020 STB KEYCOL
353+04030 ORA #4
354+04040 STA KEYCOL+1
355+04050 STB KEYCOL
356+04060 LEAY KEYSCN,PCR
357+04070 LDX #8 LIMIT SCAN LOOP
358+04080 ANDCC #.NOT.CARRY
359+04090 KYSCAN ROL KEYCOL TO LS BIT
360+04100 LDA KEYROW
361+04110 ORA #$80 MASK JOYSTICK COMP BIT
362+04120 TFR A,B
363+04130 COMA POSITIVE LOGIC
364+04140 ANDA ,Y NEW BIT AND NOT OLD BIT?
365+04150 STA KEYCHG-KEYSCN,Y SAVE NEWLY SET BITS
366+04151 TFR B,A
367+04152 COMA NOT (NEW OR NOT OLD)
368+04153 ORA ,Y
369+04154 COMA
370+04155 STA KEYOPN-KEYSCN,Y
371+04160 STB ,Y+ SAVE NEW STATE
372+04170 LEAX -1,X
373+04180 ORCC #CARRY FOR SCAN
374+04190 BNE KYSCAN COUNTED OUT?
375+04200 *
376+04210 * SCAN FOR PHANTOMS
377+04220 LEAY KEYOLD,PCR
378+04230 LDB #7 COLUMN COUNT TO SCAN
379+04240 KYSCNS LDA KEYSCN-KEYOLD,Y GET SCANNED KEYS
380+04250 COMA + LOGIC
381+04260 BEQ KYNSCN
382+04270 LSRA
383+04280 BCC *-1 FIND A KEY
384+04290 BEQ KYNSCN MORE THAN ONE KEY?
385+04300 LEAX KEYSCN-KEYOLD,Y SCAN FOR DUPLICATED BITS
386+04310 PSHS B
387+04320 LDA ,X+ SCAN CODE (AGAIN)
388+04330 KYPHML CMPA ,X+ DUPLICATED?
389+04340 BNE KYNPHM
390+04350 CLR KEYCHG-KEYSCN-1,X NO CHANGES SEEN
391+04360 LDA KEYOLD-KEYSCN-1,X HOLDOVER SCAN
392+04370 STA -1,X
393+04380 CLR KEYCHG-KEYOLD,Y UNDO BOTH
394+04390 KYNPHM DECB
395+04400 BNE KYPHML
396+04410 PULS B RESTORE COUNT
397+04420 TST KEYCHG-KEYOLD,Y BITS CLEARED?
398+04430 BNE KYNSCN
399+04440 LDA ,Y+ CLEAR MATCHED BITS, ALSO
400+04450 STA KEYSCN-KEYOLD-1,Y
401+04460 BRA KYYSCN
402+04470 KYNSCN LDA KEYSCN-KEYOLD,Y UPDATE OLD STATE
403+04480 STA ,Y+
404+04490 KYYSCN DECB NEXT COL
405+04500 BNE KYSCNS
406+04510 *
407+04520 * TRANSLATE KEYS
408+04530 LEAY KEYSCN,PCR
409+04540 LDA #$40 ROW 6
410+04550 BITA 1,Y
411+04560 BEQ KYCTRL NEGATIVE LOGIC
412+04570 BITA 7,Y
413+04580 BEQ KYSHFT
414+04590 LEAX KEYTBL,PCR UNSHIFTED KEYS
415+04600 BRA KYTRAN
416+04610 KYCTRL LEAX KEYCTL,PCR
417+04620 BRA KYTRAN
418+04630 KYSHFT LEAX KEYSHF,PCR
419+04640 KYTRAN LDB #7 MAX COL
420+04650 KYTRLP LEAY KEYCHG,PCR
421+04660 LDA B,Y CLOSURE BITS
422+04670 BEQ KYTRUP
423+04680 PSHU A,B
424+04690 LDB #-1 ROW COUNT
425+04700 KYTRDL BSR KYTBIT
426+04710 CMPA #KMT DEFINED?
427+04720 BEQ KYTRDM
428+04730 PSHU A
429+04740 BSR KYBPUT
430+04750 KYTRDM TST ,U MORE ROWS?
431+04760 BNE KYTRDL
432+04770 PULU A,B
433+04780 KYTRUP LEAY KEYOPN,PCR
434+04790 LDA B,Y
435+04795 BEQ KYTRNX
436+04800 PSHU A,B
437+04810 LDB #-1
438+04820 KYTRUL BSR KYTBIT
439+04825 LDA KEYLAS
440+04830 CMPA KEYLAS
441+04840 BNE KYTRUM
442+04850 CLR KEYTIM
443+04860 LDA #-1
444+04870 STA KEYLAS
445+04880 KYTRUM TST ,U
446+04890 BNE KYTRUL
447+04900 PULU A,B
448+04910 KYTRNX DECB
449+04920 BPL KYTRLP
450+04930 *
451+04940 * REPEATS
452+04950 LDA KEYLAS
453+04960 CMPA #-1
454+04970 BEQ KYRPNO
455+04980 LDB KEYTIM
456+04990 CMPB KEYRPT
457+05000 BLO KYRPNO
458+05004 LDA KEYVAL
459+05005 PSHU A
460+05006 BSR KYBPUT
461+05010 SUBB KEYRAT
462+05020 STB KEYTIM
463+05050 KYRPNO BRA DOBEEP
464+05060 *
465+05065 * WILL HANG IF TOP OF STACK CLEAR
466+05070 KYTBIT LDA ,U ROW BITS
467+05080 KYTBLP INCB COUNT BIT
468+05090 LSRA
469+05100 BCC KYTBLP
470+05110 STA ,U
471+05120 TFR B,A KEEP COUNT
472+05130 ASLA
473+05140 ASLA
474+05150 ASLA
475+05160 ADDA 1,U COLUMNS
476+05165 STA KEYRAW
477+05170 LDA A,X CHARACTER
478+05175 STA KEYVAL
479+05180 RTS
480+05190 *
481+05200 *BUFFER READ MUST ALSO BE UNINTERRUPTIBLE (SINGLE MPU)
482+05210 KYBPUT PSHS A,X,CC
483+05220 ORCC #IRQMSK
484+05230 PULU A KEY CODE
485+05240 CMPA #KBREAK SYSTEM ATTENTION?
486+05250 BNE KYBPCH
487+05260 STA SYSATT
488+05270 LDA #-1
489+05280 BRA KYBPF1 NO REPEAT
490+05290 KYBPCH CMPA #KMT
491+05300 BEQ KYBPF
492+05310 LEAX KEYEND,PCR
493+05320 PSHS X WRAP TEST
494+05330 LDX KEYIN
495+05340 STA ,X+
496+05350 CMPX ,S++
497+05360 BLO KYBPNW
498+05370 LEAX KEYBUF,PCR
499+05380 KYBPNW CMPX KEYOUT
500+05390 BNE KYBPNF
501+05400 LDA #12
502+05410 ADDA BEEP
503+05420 STA BEEP
504+05430 LDA #-1
505+05440 BRA KYBPF1
506+05450 KYBPNF STX KEYIN
507+05455 LDA KEYRAW
508+05460 KYBPF1 STA KEYLAS
509+05470 KYBPF CLR KEYTIM
510+05480 PULS A,X,CC,PC
511+05490 *
512+10000 *
513+10003 * OTHER HALF OF 60 HZ BEL
514+10005 DOBEEP LDA BEEP
515+10007 BEQ NOBEEP
516+10009 DECA
517+10011 STA BEEP
518+10013 LBSR CLICK
519+10015 NOBEEP LDX PROCIX
520+10025 TST PROCRT,X
521+10027 BNE *+5
522+10040 CLR OVRDRV-1 BACK TO VISIBLE SPEED
523+10050 LDS PROCSP,X
524+10060 RTI
525+10062 SETDP 0
526+10070 *
527+15000 * Z IS UNDEFINED HANDLER
528+15005 CALTBL FDB YIELD
529+15630 FDB Z
530+15640 CALSIZ EQU (*-CALTBL)/2-1
531+15650 SETDP SYSGLO/$100
532+15660 Z STA $5FF
533+15670 LDA #UNDEF
534+15680 STA SYSERR
535+15800 YIELD CWAI #.NOT.IRQMSK
536+15810 RTS
537+16000 * SWI DISABLES IRQ
538+16010 SWISRV LEAY CALTBL,PCR
539+16020 LEAX SYSGLO,PCR
540+16030 TFR X,D
541+16040 TFR A,DP
542+16045 SETDP SYSGLO/$100
543+16050 * INDEX PROCESS TABLE ENTRY
544+16060 LEAX PROTBL,PCR
545+16070 LDA #PROSIZ
546+16080 LDB CURPRO
547+16090 MUL
548+16100 LEAX D,X
549+16110 STX PROCIX
550+16120 PULU A CALL #
551+16130 CMPA #CALSIZ
552+16140 BLS SWISC
553+16150 JSR [CALSIZ*2,Y] UNDEFINED
554+16160 BRA SWISN
555+16180 SWISC ASLA WORD
556+16190 JSR [A,Y] SIGNED OFFSET
557+16195 SWISN STU 8,S BALANCE PARAMETERS
558+16200 RTI
559+20000 *
560+20010 CLICK PSHS A
561+20020 LDA VIDMOD
562+20030 EORA #BSOUND
563+20040 STA VIDMOD
564+20050 PULS A,PC
565+20060 *
566+20070 GETKEY PSHS CC,A,B,X,Y
567+20080 LEAY KEYEND,PCR
568+20090 PSHS Y
569+20095 BSR IXWIND
570+20100 LDY ,U
571+20120 BSR IXCRSR
572+20125 LDA WCSCLR,Y
573+20130 LDB [,U] CHARACTER UNDER CURSOR
574+20140 ORCC #IRQMSK
575+20150 GETKLP LDX KEYOUT
576+20160 CMPX KEYIN
577+20170 BNE GETKIN
578+20180 PSHS B
579+20190 LDB WCSTAT,Y DISPLAY IT?
580+20200 BPL GETKNC
581+20210 ANDB #$7F FLASH?
582+20220 BEQ GETKNF
583+20230 DEC WCSTIM,Y
584+20240 BGT GETKNF
585+20250 STB WCSTIM,Y RESTORE COUNT
586+20260 ADDA #$10 NEW COLOR
587+20270 BMI GETKNF
588+20280 LDA #$8F
589+20290 GETKNF STA [,U] CURSOR ON SCREEN
590+20300 GETKNC PULS B
591+20310 CLR ,-U YIELD CPU
592+20320 SWI
593+20330 BRA GETKLP
594+20340 GETKIN STB [,U++] PUT CHARACTER BACK ON SCREEN
595+20350 LDA ,X+
596+20360 CMPX ,S++ WRAP?
597+20370 BLO GETKBF
598+20380 LEAX KEYBUF,PCR
599+20390 GETKBF STX KEYOUT
600+20400 PSHU A
601+20410 PULS PC,CC,A,B,X,Y
602+20420 *
603+20430 IXWIND PSHS A,B,Y
604+20440 LEAY WINTBL,PCR
605+20450 PULU B
606+20460 ANDB #NUMWIN-1
607+20470 LDA #WINSIZ
608+20480 MUL
609+20490 LEAY D,Y
610+20500 PSHU Y
611+20510 PULS A,B,Y,PC
612+20520 *
613+20530 IXCRSR PSHS A,B,X
614+20540 LDX ,U
615+20545 PSHU X
616+20546 BSR BWIND
617+20550 LDA WSCR,X
618+20560 ASLA
619+20570 PSHS A
620+20580 LDA #SCRWID
621+20590 LDB WCURRW,X
622+20600 ADDB WTROW,X
623+20610 MUL
624+20620 ADDB WLCOL,X
625+20630 ADCA #0
626+20640 ADDB WCURCL,X
627+20650 ADCA ,S+
628+20660 STD ,U
629+20670 PULS A,B,X,PC
630+20680 *
631+20690 VITRAN PSHS A
632+20700 LDA ,U
633+20710 CMPA #' '
634+20720 BLO VITRDF
635+20730 CMPA #'?
636+20740 BHI *+6
637+20750 ORA #$40 UNINVERT
638+20760 BRA VITRET
639+20770 CMPA #'^
640+20780 BLS VITRET PASS IT ON
641+20790 CMPA #$60 GRAVE ACCENT
642+20800 BHS *+6
643+20810 LDA #$20 UNDERSCORE IS INVERTED SPACE
644+20820 BRA VITRET
645+20830 BHI *+6
646+20840 LDA #$27 INVERTED ACCENT
647+20850 BRA VITRET
648+20860 CMPA #$7C BAR
649+20870 BNE *+6
650+20880 LDA #$3A INVERTED COLON
651+20890 BRA VITRET
652+20900 CMPA #$7F DELETE
653+20910 BHS VITRDF
654+20920 ANDA #$1F LOWER CASE IS INVERTED CAP ALPHA
655+20930 VITRET STA ,U
656+20940 PULS A,PC
657+20950 VITRDF LDA #$3F INVERTED ? FOR BAD CODES
658+20960 BRA VITRET
659+20970 *
660+20980 * RESTORE CURSOR TO WINDOW BOUNDARIES
661+20990 BWIND PSHS A,Y
662+21000 PULU Y
663+21010 LDA WCURRW,Y
664+21020 BPL BWINRH
665+21030 CLR WCURRW,Y
666+21040 CLR WCURCL,Y
667+21050 BRA BWINQT
668+21060 BWINRH CMPA WLROW,Y
669+21070 BLS BWINCL
670+21080 LDA WLROW,Y
671+21090 STA WCURRW,Y
672+21100 LDA WWCOL,Y
673+21110 STA WCURCL,Y
674+21120 BRA BWINQT
675+21130 BWINCL LDA WCURCL,Y
676+21140 BPL BWINCH
677+21150 CLR WCURCL,Y
678+21160 BRA BWINQT
679+21170 BWINCH CMPA WWCOL,Y
680+21180 BLS BWINQT
681+21190 LDA WWCOL,Y
682+21200 STA WCURCL,Y
683+21210 BWINQT PULS A,Y,PC
684+21220 *
685+21230 * RETURN POINTER TO HOME IN WINDOW
686+21240 IXHOME PSHS A,B,X
687+21250 LDX ,U
688+21260 LDA WSCR,X
689+21270 ASLA
690+21280 PSHS A
691+21290 LDA #SCRWID
692+21300 LDB WTROW,X
693+21310 MUL
694+21320 ADDB WLCOL,X
695+21330 ADCA ,S+
696+21340 STD ,U
697+21350 PULS A,B,X,PC
698+21360 *
699+21370 * SPLIT SCREEN AND INSERT LINE AT CURSOR
700+21380 USPLIT PSHS A,B,X,Y
701+21390 LDY ,U SET UP
702+21400 BSR IXHOME
703+21410 PULU X
704+21420 LDA WCURRW,Y
705+21430 BPL *+4
706+21440 PULS A,B,X,Y,PC EARLY RETURN
707+21450 LDB #SCRWID-1
708+21460 SUBB WWCOL,Y WRAP ADJUST
709+21470 PSHS A,B
710+21480 LDB WCURCL,Y
711+21490 CMPB WWCOL,Y
712+21500 BLS USPLCF
713+21510 CLR WCURCL,Y
714+21520 INCA WRAP ROW
715+21530 USPLCF TSTA ROW 0?
716+21540 BNE USPLRT
717+21550 LDA #VSPACE
718+21560 LDB WCURCL,Y
719+21570 BEQ USPLQT
720+21580 USPLL0 STA ,X+
721+21590 DECB TO CURSOR
722+21600 BGT USPLL0
723+21610 BRA USPLQT
724+21620 * DO WHOLE ROWS
725+21630 USPLRT CMPA WLROW,Y
726+21640 BLS USPLSR
727+21650 LDA WLROW,Y
728+21660 INCA OVER END
729+21670 STA WCURRW,Y
730+21680 USPLSR DECA # SCROLL
731+21690 BEQ USPLPS
732+21700 STA ,S
733+21710 USPLRL LDB WWCOL,Y
734+21720 USPLCL LDA SCRWID,X
735+21730 STA ,X+
736+21740 DECB NATURAL
737+21750 BPL USPLCL
738+21760 LDB 1,S
739+21770 ABX WRAP LINE
740+21780 DEC ,S WHOLE CT
741+21790 BGT USPLRL
742+21800 * NOW PARTIAL SCROLL LAST
743+21805 USPLPS LDB #VSPACE
744+21810 LDA WCURCL,Y
745+21820 BEQ USPLCE
746+21830 STA ,S
747+21850 USPLPL LDA SCRWID,X
748+21860 STB SCRWID,X
749+21870 STA ,X+
750+21880 DEC ,S WHOLE CT
751+21890 BGT USPLPL
752+21900 USPLCE DEC WCURRW,Y BUMP CURSOR BACK
753+21910 LDA WWCOL,Y
754+21920 SUBA WCURCL,Y
755+21930 USPLEL STB ,X+
756+21940 DECA NATURAL
757+21950 BPL USPLEL
758+21960 USPLQT LEAS 2,S
759+21970 PULS A,B,X,Y,PC
760+21980 *
761+21990 * PUT CHARACTER ON SCREEN, TTY, WITH CONTROL CHARACTERS
762+22000 VPUTCH PSHS A,X
763+22010 PULU A
764+22020 LBSR IXWIND
765+22030 CMPA #$20
766+22040 BHS VPUTVC
767+22050 ASLA CTL FN
768+22060 LEAX CTLTBL,PCR
769+22070 JSR [A,X]
770+22080 BRA VPUTQT
771+22090 * PUT VISIBLE CHARACTER
772+22100 VPUTVC PSHU A
773+22110 LBSR VITRAN
774+22120 PULU A
775+22130 LDX ,U
776+22140 LBSR IXCRSR
777+22150 STA [,U++]
778+22160 INC WCURCL,X
779+22170 LDA WCURCL,X
780+22180 CMPA WWCOL,X
781+22190 BLS VPUTQT
782+22210 CLR WCURCL,X
783+22220 INC WCURRW,X
784+22230 LDA WCURRW,X
785+22240 CMPA WLROW,X
786+22250 BLS VPUTQT
787+22260 PSHU X
788+22270 LBSR USPLIT
789+22280 VPUTQT PULS A,X,PC
790+22290 *
791+22300 * TABLE OF CONTROL FUNCTION POINTERS FOR PRINT ROUTINES
792+22310 CTLTBL FDB VNUL ASCII NUL
793+22320 FDB VNUL
794+22330 FDB VNUL
795+22340 FDB VNUL
796+22350 FDB VNUL
797+22360 FDB VNUL
798+22370 FDB VNUL
799+22380 FDB VBEL
800+22390 FDB VBS
801+22400 FDB VNUL
802+22410 FDB VNUL
803+22420 FDB VNUL
804+22430 FDB VFF
805+22440 FDB VCR
806+22450 FDB VNUL
807+22460 FDB VNUL
808+22470 FDB VNUL
809+22480 FDB VNUL
810+22490 FDB VNUL
811+22500 FDB VNUL
812+22510 FDB VNUL
813+22520 FDB VNUL
814+22530 FDB VNUL
815+22540 FDB VNUL
816+22550 FDB VNUL
817+22560 FDB VNUL
818+22570 FDB VNUL
819+22580 FDB VNUL
820+22590 FDB VNUL
821+22600 FDB VNUL
822+22610 FDB VNUL
823+22620 FDB VNUL
824+22630 *
825+22640 * DO NOTHING
826+22650 VNUL LEAU 2,U
827+22660 RTS
828+22670 *
829+22680 * LOW TONE
830+22690 VBEL PSHS A
831+22700 LEAU 2,U
832+22710 LDA BEEP
833+22720 ADDA #30
834+22730 STA BEEP
835+22740 PULS A,PC
836+22750 *
837+22760 * BACK SPACE DESTRUCTIVE
838+22770 VBS PSHS A,X
839+22780 LDX ,U
840+22790 DEC WCURCL,X
841+22800 BPL VBSNW
842+22810 LDA WWCOL,X
843+22820 STA WCURCL,X
844+22830 DEC WCURRW,X
845+22840 BPL VBSNW
846+22850 CLR WCURRW,X
847+22855 CLR WCURCL,X
848+22860 VBSNW LBSR IXCRSR
849+22870 LDA #VSPACE
850+22880 STA [,U++]
851+22890 PULS A,X,PC
852+22900 *
853+22910 * CLEAR WINDOW, HOME CURSOR
854+22920 VFF PSHS A,B,X,Y
855+22930 LDY ,U
856+22940 LBSR IXHOME
857+22950 PULU X
858+22960 CLR WCURRW,Y
859+22970 CLR WCURCL,Y
860+22980 LDB #SCRWID-1
861+22990 SUBB WWCOL,Y
862+23000 LDA WLROW,Y
863+23010 PSHS A,B
864+23020 LDA #VSPACE
865+23030 VFFLL LDB WWCOL,Y
866+23040 VFFCL STA ,X+
867+23050 DECB
868+23060 BPL VFFCL
869+23070 LDB 1,S
870+23080 ABX
871+23090 DEC ,S
872+23100 BPL VFFLL
873+23110 LEAS 2,S
874+23120 PULS A,B,X,Y,PC
875+23130 *
876+23140 * CLEAR TO END, FEED/HOME
877+23150 VCR PSHS A,B,X,Y
878+23160 LDY ,U
879+23170 LBSR IXCRSR
880+23180 PULU X
881+23190 LDA #VSPACE
882+23200 LDB WWCOL,Y
883+23210 SUBB WCURCL,Y
884+23220 BLO VCRDUN
885+23230 VCRLUP STA ,X+
886+23240 DECB
887+23250 BPL VCRLUP
888+23260 CLR WCURCL,Y
889+23270 INC WCURRW,Y
890+23280 LDA WCURRW,Y
891+23290 CMPA WLROW,Y
892+23300 BLS VCRDUN
893+23310 PSHU Y
894+23320 LBSR USPLIT
895+23330 VCRDUN PULS A,B,X,Y,PC
896+23340 *
897+50000 O EQU *
898+50010 * STARTUP CODE
899+50020 * INTIALIZE PORTS
900+50030 * 1 BIT SOUND OUTPUT
901+50032 LDS #IDLESP
902+50034 LDU #IDLEUB
903+50040 LDA VIDMOD+1
904+50050 ANDA #.NOT.4
905+50060 STA VIDMOD+1 DATA DIRECTION REGISTER
906+50070 LDB VIDMOD
907+50080 ORB #BSOUND
908+50090 STB VIDMOD
909+50100 ORA #4 DATA REGISTER
910+50110 STA VIDMOD+1
911+50120 * ENABLE IRQ ON FIELD SYNC
912+50130 * (INTERRUPTS 60 TIMES A SECOND
913+50140 * MASK IRQ FIRST
914+50150 ORCC #IRQMSK
915+50160 * SET UP IRQ VECTOR
916+50170 LDD IRQVEC
917+50180 STD IVSAVE,PCR
918+50190 LDD #IRQSRV
919+50200 STD IRQVEC
920+50205 * ENABLE PORT
921+50210 LDA KEYCOL+1
922+50220 ORA #1
923+50230 STA KEYCOL+1
924+50240 * HANDSHAKE BY READING KEYCOL (IMPLICIT IN KEY DECODE)
925+50250 LDD SWIVEC SET UP SYSTEM CALLS - SWI
926+50260 STD SVSAVE,PCR
927+50270 LDD #SWISRV
928+50280 STD SWIVEC
929+50330 *
930+50340 LEAY SYSGLO,PCR
931+50350 TFR Y,D
932+50360 TFR A,DP
933+50370 SETDP SYSGLO/256
934+50390 WAITIQ CLR ,-U WINDOW 0
935+50410 LBSR GETKEY
936+50411 PULU A
937+50412 CMPA #3
938+50413 BEQ IQDONE
939+50420 CLRB
940+50430 PSHU A,B
941+50440 LBSR VPUTCH
942+50480 BRA WAITIQ
943+50485 IQDONE ORCC #IRQMSK
944+50490 LDA KEYCOL+1
945+50500 ANDA #.NOT.1
946+50510 STA KEYCOL+1
947+50520 LDD SVSAVE,PCR
948+50530 STD SWIVEC
949+50540 LDD IVSAVE,PCR
950+50550 STD IRQVEC
951+50560 SWI
952+55990 *
953+56000 FDB 0
954+56010 IDLESL RMB 128
955+56020 IDLESP EQU *
956+56030 FDB 0
957+56032 IDLEUL RMB 128
958+56034 IDLEUB EQU *
959+56036 FDB 0
960+56040 IDLLIM EQU *
961+56050 *
962+62000 END