学生時代に書いた OS になったはずの起点のソースコードです。(その授業は一応合格できました。)
Revision | 31e900017e6056bf05c9d2ff630455ea211b42b2 (tree) |
---|---|
Zeit | 2013-07-08 13:41:26 |
Autor | Joel Matthew Rees <reiisi@user...> |
Commiter | Joel Matthew Rees |
I think this was getting keyboard translation sort of running.
@@ -3,7 +3,6 @@ | ||
3 | 3 | 00100 * SYSGLO MUST BE ON EVEN PAGE (256 BYTE) BOUNDARY |
4 | 4 | 00105 IVSAVE RMB 2 IRQ VECTOR FOR RETURN TO EDTASM |
5 | 5 | 00106 SVSAVE RMB 2 SWI VECTOR FOR RETURN TO EDTASM |
6 | -00107 S3SAVE RMB 2 SWI3 VECTOR FOR RETURN TO EDTASM | |
7 | 6 | 00110 HASTY RMB 1 ABBREVIATE IRQ (TIMER) SERVICE? |
8 | 7 | 00120 SLICEL FCB 10 LIMIT OF TICKS/SLICE |
9 | 8 | 00130 SLICE RMB 1 COUNT OF TICKS REMAINING IN THIS SLICE |
@@ -11,6 +10,14 @@ | ||
11 | 10 | 00150 SYSERR FDB 0 |
12 | 11 | 00160 CURPRO FCB 0 |
13 | 12 | 00170 PROCIX FDB 0 ADDRESS OF ENTRY IN PROTBL |
13 | +00180 SPEED FCB 0 COPY OF CURRENT PROCESS' PROCRT | |
14 | +00190 WINDIX FCB 0 POINTER TO CURRENT WINDOW | |
15 | +00200 SYSATT FCB 0 OPERATOR REQUEST FOR SYSTEM ATTENTION | |
16 | +00500 KEYOLD RMB 8 KEYBOARD SCAN TABLES | |
17 | +00510 KEYSCN RMB 8 OLD AND SCAN ARE NEGATIVE LOGIC | |
18 | +00520 KEYCHG RMB 8 POSITIVE LOGIC FOR CHANGES IN LAST SLICE | |
19 | +00550 KEYIN FDB KEYBUF | |
20 | +00560 KEYOUT FDB KEYBUF | |
14 | 21 | 00600 YRBASE FDB 1900 |
15 | 22 | 00610 YEAR FCB 87 |
16 | 23 | 00620 MONTH FCB 4 |
@@ -46,7 +53,73 @@ | ||
46 | 53 | 01040 FCB 0 NO DAYS |
47 | 54 | 01050 FCB 0 IN MO. |
48 | 55 | 01060 FCB 0 13-15 (FOR AUTO-RESTORING) |
49 | -01500 PROTBL EQU * P0 IS IDLE PROCESS | |
56 | +01070 * | |
57 | +01080 * KEYBOARD SCAN CODES | |
58 | +01090 KEYTBL FCB $60 | |
59 | +01100 FCC 'abcdefghijklmnopqrstuvwxyz' | |
60 | +01110 FCB $13 | |
61 | +01120 FCB $0A | |
62 | +01130 FCB 8 | |
63 | +01140 FCB 9 | |
64 | +01150 FCC ' 0123456789:;,-./' | |
65 | +01160 FCB $0D | |
66 | +01170 FCB KMT | |
67 | +01180 FCB 3 | |
68 | +01190 FCB KMT | |
69 | +01200 FCB KMT | |
70 | +01205 FCB KMT | |
71 | +01210 FCB KMT | |
72 | +01215 FCB KMT | |
73 | +01220 KEYSHF FCC /@ABCDEFGHIJKLMNOPQRSTUVWXYZ/ | |
74 | +01230 FCB $5E | |
75 | +01240 FCB '[ | |
76 | +01250 FCB $5F | |
77 | +01260 FCC /] \!"#$%&'()*+<=>?/ | |
78 | +01270 FCB $0C | |
79 | +01280 FCB 1 | |
80 | +01290 FCB $7F | |
81 | +01291 FCB KMT | |
82 | +01292 FCB KMT | |
83 | +01293 FCB KMT | |
84 | +01294 FCB KMT | |
85 | +01295 FCB KMT | |
86 | +01300 KEYCTL FDB 1 | |
87 | +01304 FDB $203 | |
88 | +01308 FDB $405 | |
89 | +01312 FDB $607 | |
90 | +01316 FDB $809 | |
91 | +01320 FDB $0A0B | |
92 | +01324 FDB $0C0D | |
93 | +01328 FDB $0E0F | |
94 | +01332 FDB $1011 | |
95 | +01336 FDB $1213 | |
96 | +01340 FDB $1415 | |
97 | +01344 FDB $1617 | |
98 | +01348 FDB $1819 | |
99 | +01352 FDB $1A1B | |
100 | +01356 FDB $1C1D | |
101 | +01360 FDB $1E1F | |
102 | +01364 FDB $8081 | |
103 | +01368 FDB $8283 | |
104 | +01372 FDB $8485 | |
105 | +01376 FDB $8687 | |
106 | +01380 FDB $8889 | |
107 | +01384 FDB $7C8B | |
108 | +01388 FDB $7B7E | |
109 | +01392 FDB $7D8F | |
110 | +01396 FCB $8A | |
111 | +01400 FCB KMT | |
112 | +01404 FCB KBREAK | |
113 | +01408 FCB KMT | |
114 | +01412 FCB KMT | |
115 | +01416 FCB KMT | |
116 | +01420 FCB KMT | |
117 | +01424 FCB 1 | |
118 | +01428 * | |
119 | +01450 KEYBUF RMB 129 | |
120 | +01460 KEYEND FDB 0 SAFETY | |
121 | +01500 NUMPRO EQU 16 | |
122 | +01505 PROTBL EQU * P0 IS IDLE PROCESS | |
50 | 123 | 01510 PROCSP EQU *-PROTBL SYSTEM STACK POINTER IN SUSPENSE |
51 | 124 | 01520 FDB IDLESP |
52 | 125 | 01530 PROCSB EQU *-PROTBL SYSTEM STACK BASE |
@@ -66,7 +139,7 @@ | ||
66 | 139 | 01960 PROCRT EQU *-PROTBL OVERDRIVE (2X) CLOCK RATE FLAG |
67 | 140 | 01970 FCB 0 |
68 | 141 | 01980 PROSIZ EQU *-PROTBL SIZE OF PROCESS TABLE |
69 | -01990 RMB 19*PROSIZ | |
142 | +01990 RMB (NUMPRO-1)*PROSIZ | |
70 | 143 | 02000 * |
71 | 144 | 02010 CARRY EQU 1 FLAG BIT |
72 | 145 | 02020 TIMOVR EQU $8000 |
@@ -75,10 +148,31 @@ | ||
75 | 148 | 02050 KEYCOL EQU $FF02 |
76 | 149 | 02060 IRQVEC EQU $10D |
77 | 150 | 02065 SWIVEC EQU $107 |
78 | -02068 SW3VEC EQU $101 | |
79 | 151 | 02070 VIDMOD EQU $FF22 |
80 | 152 | 02080 BSOUND EQU 2 |
81 | 153 | 02090 OVRDRV EQU $FFD9 |
154 | +02100 KBREAK EQU $E0 | |
155 | +02110 KMT EQU $F0 | |
156 | +02120 SCRWID EQU 32 | |
157 | +02130 VSPACE EQU $60 MC6847 | |
158 | +02500 NUMWIN EQU 8 | |
159 | +02502 WINTBL EQU * | |
160 | +02504 WSCR EQU *-WINTBL | |
161 | +02506 FCB 2 | |
162 | +02510 WLCOL EQU *-WINTBL | |
163 | +02520 FCB 13 | |
164 | +02530 WRCOL EQU *-WINTBL | |
165 | +02540 FCB 31 | |
166 | +02550 WTROW EQU *-WINTBL | |
167 | +02560 FCB 0 | |
168 | +02570 WBROW EQU *-WINTBL | |
169 | +02580 FCB 0 | |
170 | +02590 WCURCL EQU *-WINTBL | |
171 | +02600 FCB 0 | |
172 | +02610 WCURRW EQU *-WINTBL | |
173 | +02620 FCB 0 | |
174 | +02700 WINSIZ EQU *-WINTBL | |
175 | +02710 RMB (NUMWIN-1)*WINSIZ | |
82 | 176 | 02900 KSTACO FDB 0 |
83 | 177 | 02910 RMB $100 KERNEL'S STACK |
84 | 178 | 02920 KSTACK EQU * |
@@ -185,7 +279,127 @@ | ||
185 | 279 | 03880 LDD #TIMOVR |
186 | 280 | 03890 STD SYSERR |
187 | 281 | 03900 * |
188 | -03910 KEYRD TST KEYCOL | |
282 | +03910 KEYRD LDA KEYROW+1 CONTROL/STATUS REGISTER | |
283 | +03920 ANDA #.NOT.4 SELECT DATA DIRECTION REGISTER | |
284 | +03930 STA KEYROW+1 | |
285 | +03940 CLRB 0-7 INPUT | |
286 | +03950 STB KEYROW | |
287 | +03960 ORA #4 SELECT DATA REGISTER | |
288 | +03970 STA KEYROW+1 | |
289 | +03980 LDA KEYCOL+1 | |
290 | +03990 ANDA #.NOT.4 | |
291 | +04000 STA KEYCOL+1 | |
292 | +04010 COMB ALL OUT | |
293 | +04020 STB KEYCOL | |
294 | +04030 ORA #4 | |
295 | +04040 STA KEYCOL+1 | |
296 | +04050 STB KEYCOL | |
297 | +04060 LEAY KEYSCN,PCR | |
298 | +04070 LDX #8 LIMIT SCAN LOOP | |
299 | +04080 ANDCC #.NOT.CARRY | |
300 | +04090 KYSCAN ROL KEYCOL TO LS BIT | |
301 | +04100 LDA KEYROW | |
302 | +04110 ORA #$80 MASK JOYSTICK COMP BIT | |
303 | +04120 TFR A,B | |
304 | +04130 COMA POSITIVE LOGIC | |
305 | +04140 ANDA ,Y NEW BIT AND NOT OLD BIT? | |
306 | +04150 STA KEYCHG-KEYSCN,Y SAVE NEWLY SET BITS | |
307 | +04160 STB ,Y+ SAVE NEW STATE | |
308 | +04170 LEAX -1,X | |
309 | +04180 ORCC #CARRY FOR SCAN | |
310 | +04190 BNE KYSCAN COUNTED OUT? | |
311 | +04200 * | |
312 | +04210 * SCAN FOR PHANTOMS | |
313 | +04220 LEAY KEYOLD,PCR | |
314 | +04230 LDB #7 COLUMN COUNT TO SCAN | |
315 | +04240 KYSCNS LDA KEYSCN-KEYOLD,Y GET SCANNED KEYS | |
316 | +04250 COMA + LOGIC | |
317 | +04260 BEQ KYNSCN | |
318 | +04270 LSRA | |
319 | +04280 BCC *-1 FIND A KEY | |
320 | +04290 BEQ KYNSCN MORE THAN ONE KEY? | |
321 | +04300 LEAX KEYSCN-KEYOLD,Y SCAN FOR DUPLICATED BITS | |
322 | +04310 PSHS B | |
323 | +04320 LDA ,X+ SCAN CODE (AGAIN) | |
324 | +04330 KYPHML CMPA ,X+ DUPLICATED? | |
325 | +04340 BNE KYNPHM | |
326 | +04350 CLR KEYCHG-KEYSCN-1,X NO CHANGES SEEN | |
327 | +04360 LDA KEYOLD-KEYSCN-1,X HOLDOVER SCAN | |
328 | +04370 STA -1,X | |
329 | +04380 CLR KEYCHG-KEYOLD,Y UNDO BOTH | |
330 | +04390 KYNPHM DECB | |
331 | +04400 BNE KYPHML | |
332 | +04410 PULS B RESTORE COUNT | |
333 | +04420 TST KEYCHG-KEYOLD,Y BITS CLEARED? | |
334 | +04430 BNE KYNSCN | |
335 | +04440 LDA ,Y+ CLEAR MATCHED BITS, ALSO | |
336 | +04450 STA KEYSCN-KEYOLD-1,Y | |
337 | +04460 BRA KYYSCN | |
338 | +04470 KYNSCN LDA KEYSCN-KEYOLD,Y UPDATE OLD STATE | |
339 | +04480 STA ,Y+ | |
340 | +04490 KYYSCN DECB NEXT COL | |
341 | +04500 BNE KYSCNS | |
342 | +04510 * | |
343 | +04520 * TRANSLATE KEYS | |
344 | +04530 LEAY KEYSCN,PCR | |
345 | +04540 LDA #$40 ROW 6 | |
346 | +04550 BITA 1,Y | |
347 | +04560 BEQ KYCTRL NEGATIVE LOGIC | |
348 | +04570 BITA 7,Y | |
349 | +04580 BEQ KYSHFT | |
350 | +04590 LEAX KEYTBL,PCR UNSHIFTED KEYS | |
351 | +04600 BRA KYTRAN | |
352 | +04610 KYCTRL LEAX KEYCTL,PCR | |
353 | +04620 BRA KYTRAN | |
354 | +04630 KYSHFT LEAX KEYSHF,PCR | |
355 | +04640 KYTRAN LDB #7 MAX COL | |
356 | +04650 LEAY KEYCHG,PCR | |
357 | +04660 KYTRLP LDA B,Y COL BITS | |
358 | +04670 BEQ KYTRAL | |
359 | +04680 PSHS B | |
360 | +04690 LDB #-1 ROW COUNT | |
361 | +04700 KYTBIT INCB COUNT BIT | |
362 | +04710 LSRA | |
363 | +04720 BCC KYTBIT | |
364 | +04730 PSHS A,B | |
365 | +04740 ASLB | |
366 | +04750 ASLB | |
367 | +04760 ASLB B*8 | |
368 | +04770 ADDB 2,S B+COLUMNS | |
369 | +04780 LDA B,X | |
370 | +04790 BPL KYTRKY STRAIGHT CODE | |
371 | +04800 CMPA #KMT NO KEY DEFINED? | |
372 | +04810 BEQ KYTRNK | |
373 | +04820 CMPA #KBREAK SYS REQ? | |
374 | +04830 BNE KYTRKY | |
375 | +04840 STA SYSATT | |
376 | +04850 BRA KYTRNK | |
377 | +04860 KYTRKY PSHS X | |
378 | +04870 *BUFFER READ MUST ALSO BE UNINTERRUPTIBLE (SINGLE MPU) | |
379 | +04880 LDX KEYOUT | |
380 | +04890 PSHS X FULL TEST | |
381 | +04900 LEAX KEYEND,PCR | |
382 | +04910 PSHS X WRAP TEST | |
383 | +04920 LDX KEYIN | |
384 | +04930 STA ,X+ | |
385 | +04940 CMPX ,S++ | |
386 | +04950 BLO KYTRKN | |
387 | +04960 LEAX KEYBUF,PCR | |
388 | +04970 KYTRKN CMPX ,S++ | |
389 | +04980 BNE KYTRKK | |
390 | +04990 LDA #12 | |
391 | +05000 ADDA BEEP | |
392 | +05010 STA BEEP | |
393 | +05020 BRA KYTRKF DROP KEY | |
394 | +05030 KYTRKK STX KEYIN | |
395 | +05040 KYTRKF PULS X | |
396 | +05050 KYTRNK PULS A,B ROW PATTERN, COUNT | |
397 | +05060 TSTA MORE ROWS? | |
398 | +05070 BNE KYTBIT | |
399 | +05080 PULS B | |
400 | +05090 KYTRAL DECB NEXT COL | |
401 | +05100 BPL KYTRLP | |
402 | +05110 * | |
189 | 403 | 10000 * |
190 | 404 | 10003 * OTHER HALF OF 60 HZ BEL |
191 | 405 | 10005 LDA BEEP |
@@ -339,143 +553,6 @@ | ||
339 | 553 | 16920 JSR [A,Y] |
340 | 554 | 16930 RTI |
341 | 555 | 16940 * |
342 | -17000 * Z IS UNDEFINED HANDLER | |
343 | -17010 CA3TBL FDB Z | |
344 | -17020 FDB Z | |
345 | -17030 FDB Z | |
346 | -17040 FDB Z | |
347 | -17050 FDB Z | |
348 | -17060 FDB Z | |
349 | -17070 FDB Z | |
350 | -17080 FDB Z | |
351 | -17090 FDB Z | |
352 | -17100 FDB Z | |
353 | -17110 FDB Z | |
354 | -17120 FDB Z | |
355 | -17130 FDB Z | |
356 | -17140 FDB Z | |
357 | -17150 FDB Z | |
358 | -17160 FDB Z | |
359 | -17170 FDB Z | |
360 | -17180 FDB Z | |
361 | -17190 FDB Z | |
362 | -17200 FDB Z | |
363 | -17210 FDB Z | |
364 | -17220 FDB Z | |
365 | -17230 FDB Z | |
366 | -17240 FDB Z | |
367 | -17250 FDB Z | |
368 | -17260 FDB Z | |
369 | -17270 FDB Z | |
370 | -17280 FDB Z | |
371 | -17290 FDB Z | |
372 | -17300 FDB Z | |
373 | -17310 FDB Z | |
374 | -17320 FDB Z | |
375 | -17330 FDB Z | |
376 | -17340 FDB Z | |
377 | -17350 FDB Z | |
378 | -17360 FDB Z | |
379 | -17370 FDB Z | |
380 | -17380 FDB Z | |
381 | -17390 FDB Z | |
382 | -17400 FDB Z | |
383 | -17410 FDB Z | |
384 | -17420 FDB Z | |
385 | -17430 FDB Z | |
386 | -17440 FDB Z | |
387 | -17450 FDB Z | |
388 | -17460 FDB Z | |
389 | -17470 FDB Z | |
390 | -17480 FDB Z | |
391 | -17490 FDB Z | |
392 | -17500 FDB Z | |
393 | -17510 FDB Z | |
394 | -17520 FDB Z | |
395 | -17530 FDB Z | |
396 | -17540 FDB Z | |
397 | -17550 FDB Z | |
398 | -17560 FDB Z | |
399 | -17570 FDB Z | |
400 | -17580 FDB Z | |
401 | -17590 FDB Z | |
402 | -17600 FDB Z | |
403 | -17610 FDB Z | |
404 | -17620 FDB Z | |
405 | -17630 FDB Z | |
406 | -17640 FDB Z | |
407 | -17650 FDB Z | |
408 | -17660 FDB Z | |
409 | -17670 FDB Z | |
410 | -17680 FDB Z | |
411 | -17690 FDB Z | |
412 | -17700 FDB Z | |
413 | -17710 FDB Z | |
414 | -17720 FDB Z | |
415 | -17730 FDB Z | |
416 | -17740 FDB Z | |
417 | -17750 FDB Z | |
418 | -17760 FDB Z | |
419 | -17770 FDB Z | |
420 | -17780 FDB Z | |
421 | -17790 FDB Z | |
422 | -17800 FDB Z | |
423 | -17810 FDB Z | |
424 | -17820 FDB Z | |
425 | -17830 FDB Z | |
426 | -17840 FDB Z | |
427 | -17850 FDB Z | |
428 | -17860 FDB Z | |
429 | -17870 FDB Z | |
430 | -17880 FDB Z | |
431 | -17890 FDB Z | |
432 | -17900 FDB Z | |
433 | -17910 FDB Z | |
434 | -17920 FDB Z | |
435 | -17930 FDB Z | |
436 | -17940 FDB Z | |
437 | -17950 FDB Z | |
438 | -17960 FDB Z | |
439 | -17970 FDB Z | |
440 | -17980 FDB Z | |
441 | -17990 FDB Z | |
442 | -18000 FDB Z | |
443 | -18010 FDB Z | |
444 | -18020 FDB Z | |
445 | -18030 FDB Z | |
446 | -18040 FDB Z | |
447 | -18050 FDB Z | |
448 | -18060 FDB Z | |
449 | -18070 FDB Z | |
450 | -18080 FDB Z | |
451 | -18090 FDB Z | |
452 | -18100 FDB Z | |
453 | -18110 FDB Z | |
454 | -18120 FDB Z | |
455 | -18130 FDB Z | |
456 | -18140 FDB Z | |
457 | -18150 FDB Z | |
458 | -18160 FDB Z | |
459 | -18170 FDB Z | |
460 | -18180 FDB Z | |
461 | -18190 FDB Z | |
462 | -18200 FDB Z | |
463 | -18210 FDB Z | |
464 | -18220 FDB Z | |
465 | -18230 FDB Z | |
466 | -18240 FDB Z | |
467 | -18250 FDB Z | |
468 | -18260 FDB Z | |
469 | -18270 FDB Z | |
470 | -18280 FDB Z | |
471 | -18290 * 128 ENTRIES -> NO BOUNDS CHECK ON CALL NUMBER | |
472 | -18300 * SWI3 DOES NOT DISABLE IRQ | |
473 | -18310 SW3SRV LEAY CA3TBL,PCR | |
474 | -18320 PULU A CALL # | |
475 | -18330 ASLA WORD ADR | |
476 | -18340 JSR [A,Y] | |
477 | -18350 RTI | |
478 | -18360 * USING SUBROUTINE LINKAGE ALLOWS CALL BY JSR [CA3TBL+N*2,PCR] | |
479 | 556 | 20000 * |
480 | 557 | 20010 CLICK PSHS A |
481 | 558 | 20020 LDA VIDMOD |
@@ -514,12 +591,26 @@ | ||
514 | 591 | 50260 STD SVSAVE,PCR |
515 | 592 | 50270 LDD #SWISRV |
516 | 593 | 50280 STD SWIVEC |
517 | -50290 LDD SW3VEC SET UP SYSTEM CALLS - SWI3 | |
518 | -50300 STD S3SAVE,PCR | |
519 | -50310 LDD #SW3SRV | |
520 | -50320 STD SW3VEC | |
521 | 594 | 50330 * |
522 | -54900 WAITIQ CWAI #.NOT.IRQMSK | |
595 | +50340 LEAY SYSGLO,PCR | |
596 | +50350 TFR Y,D | |
597 | +50360 TFR A,DP | |
598 | +50370 SETDP SYSGLO/256 | |
599 | +50380 LEAY KEYEND,PCR | |
600 | +50390 PSHS Y | |
601 | +50400 ANDCC #.NOT.IRQMSK | |
602 | +50410 WAITIQ LDX KEYOUT | |
603 | +50420 CMPX KEYIN | |
604 | +50430 BEQ WAITIQ | |
605 | +50440 ORCC #IRQMSK | |
606 | +50450 LDX KEYOUT | |
607 | +50460 LDA ,X+ | |
608 | +50470 CMPX ,S | |
609 | +50480 BLO WAITBF | |
610 | +50490 LEAX KEYBUF,PCR | |
611 | +50500 WAITBF STX KEYOUT | |
612 | +50510 ANDCC #.NOT.IRQMSK | |
613 | +50520 STA $400 | |
523 | 614 | 54910 BRA WAITIQ |
524 | 615 | 55990 * |
525 | 616 | 56000 FDB 0 |