学生時代に書いた OS になったはずの起点のソースコードです。(その授業は一応合格できました。)
修訂 | 830ad31ed21b8d23acc7e5a4a9a1b8de29d3063a (tree) |
---|---|
時間 | 2013-07-08 13:45:52 |
作者 | Joel Matthew Rees <reiisi@user...> |
Commiter | Joel Matthew Rees |
I think this was improvements to the key translations, and a change in the calendar handling.
@@ -16,6 +16,11 @@ | ||
16 | 16 | 00500 KEYOLD RMB 8 KEYBOARD SCAN TABLES |
17 | 17 | 00510 KEYSCN RMB 8 OLD AND SCAN ARE NEGATIVE LOGIC |
18 | 18 | 00520 KEYCHG RMB 8 POSITIVE LOGIC FOR CHANGES IN LAST SLICE |
19 | +00530 KEYOPN RMB 8 POSITIVE LOGIC KEY RELEASE TABLE | |
20 | +00535 KEYLAS FCB KMT | |
21 | +00540 KEYTIM FCB 0 | |
22 | +00545 KEYRPT FCB 40 REPEAT PAUSE | |
23 | +00546 KEYRAT FCB 6 REPEAT PERIOD | |
19 | 24 | 00550 KEYIN FDB KEYBUF |
20 | 25 | 00560 KEYOUT FDB KEYBUF |
21 | 26 | 00600 YRBASE FDB 1900 |
@@ -155,6 +160,7 @@ | ||
155 | 160 | 02110 KMT EQU $F0 |
156 | 161 | 02120 SCRWID EQU 32 |
157 | 162 | 02130 VSPACE EQU $60 MC6847 |
163 | +02140 UNDEF EQU -1 | |
158 | 164 | 02500 NUMWIN EQU 8 |
159 | 165 | 02502 WINTBL EQU * |
160 | 166 | 02504 WSCR EQU *-WINTBL |
@@ -171,6 +177,12 @@ | ||
171 | 177 | 02600 FCB 0 |
172 | 178 | 02610 WCURRW EQU *-WINTBL |
173 | 179 | 02620 FCB 0 |
180 | +02630 WCSCLR EQU *-WINTBL | |
181 | +02640 FCB $8F | |
182 | +02650 WCSTIM EQU *-WINTBL | |
183 | +02660 FCB 0 | |
184 | +02670 WCSTAT EQU *-WINTBL B7=DISPLAY B6-B0=COUNT | |
185 | +02680 FCB $8F | |
174 | 186 | 02700 WINSIZ EQU *-WINTBL |
175 | 187 | 02710 RMB (NUMWIN-1)*WINSIZ |
176 | 188 | 02900 KSTACO FDB 0 |
@@ -279,7 +291,8 @@ | ||
279 | 291 | 03880 LDD #TIMOVR |
280 | 292 | 03890 STD SYSERR |
281 | 293 | 03900 * |
282 | -03910 KEYRD LDA KEYROW+1 CONTROL/STATUS REGISTER | |
294 | +03910 KEYRD INC KEYTIM | |
295 | +03915 LDA KEYROW+1 CONTROL/STATUS REGISTER | |
283 | 296 | 03920 ANDA #.NOT.4 SELECT DATA DIRECTION REGISTER |
284 | 297 | 03930 STA KEYROW+1 |
285 | 298 | 03940 CLRB 0-7 INPUT |
@@ -304,6 +317,11 @@ | ||
304 | 317 | 04130 COMA POSITIVE LOGIC |
305 | 318 | 04140 ANDA ,Y NEW BIT AND NOT OLD BIT? |
306 | 319 | 04150 STA KEYCHG-KEYSCN,Y SAVE NEWLY SET BITS |
320 | +04151 TFR B,A | |
321 | +04152 COMA NOT (NEW OR NOT OLD) | |
322 | +04153 ORA ,Y | |
323 | +04154 COMA | |
324 | +04155 STA KEYOPN-KEYSCN,Y | |
307 | 325 | 04160 STB ,Y+ SAVE NEW STATE |
308 | 326 | 04170 LEAX -1,X |
309 | 327 | 04180 ORCC #CARRY FOR SCAN |
@@ -353,56 +371,96 @@ | ||
353 | 371 | 04620 BRA KYTRAN |
354 | 372 | 04630 KYSHFT LEAX KEYSHF,PCR |
355 | 373 | 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 | |
374 | +04650 KYTRLP LEAY KEYCHG,PCR | |
375 | +04660 LDA B,Y CLOSURE BITS | |
376 | +04670 BEQ KYTRUP | |
377 | +04680 PSHU A,B | |
360 | 378 | 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 * | |
379 | +04700 KYTRDL BSR KYTBIT | |
380 | +04710 CMPA #KMT DEFINED? | |
381 | +04720 BEQ KYTRDM | |
382 | +04730 PSHU A | |
383 | +04740 BSR KYBPUT | |
384 | +04750 KYTRDM TST ,U MORE ROWS? | |
385 | +04760 BNE KYTRDL | |
386 | +04770 PULU A,B | |
387 | +04780 KYTRUP LEAY KEYOPN,PCR | |
388 | +04790 LDA B,Y | |
389 | +04795 BEQ KYTRNX | |
390 | +04800 PSHU A,B | |
391 | +04810 LDB #-1 | |
392 | +04820 KYTRUL BSR KYTBIT | |
393 | +04830 CMPA KEYLAS | |
394 | +04840 BNE KYTRUM | |
395 | +04850 CLR KEYTIM | |
396 | +04860 LDA #KMT | |
397 | +04870 STA KEYLAS | |
398 | +04880 KYTRUM TST ,U | |
399 | +04890 BNE KYTRUL | |
400 | +04900 PULU A,B | |
401 | +04910 KYTRNX DECB | |
402 | +04920 BPL KYTRLP | |
403 | +04930 * | |
404 | +04940 * REPEATS | |
405 | +04950 LDA KEYLAS | |
406 | +04960 CMPA #KMT KEY? | |
407 | +04970 BEQ KYRPNO | |
408 | +04980 LDB KEYTIM | |
409 | +04990 CMPB KEYRPT | |
410 | +05000 BLO KYRPNO | |
411 | +05005 PSHU A | |
412 | +05006 BSR KYBPUT | |
413 | +05010 SUBB KEYRAT | |
414 | +05020 STB KEYTIM | |
415 | +05050 KYRPNO BRA DOBEEP | |
416 | +05060 * | |
417 | +05065 * WILL HANG IF TOP OF STACK CLEAR | |
418 | +05070 KYTBIT LDA ,U ROW BITS | |
419 | +05080 KYTBLP INCB COUNT BIT | |
420 | +05090 LSRA | |
421 | +05100 BCC KYTBLP | |
422 | +05110 STA ,U | |
423 | +05120 TFR B,A KEEP COUNT | |
424 | +05130 ASLA | |
425 | +05140 ASLA | |
426 | +05150 ASLA | |
427 | +05160 ADDA 1,U COLUMNS | |
428 | +05170 LDA A,X CHARACTER | |
429 | +05180 RTS | |
430 | +05190 * | |
431 | +05200 *BUFFER READ MUST ALSO BE UNINTERRUPTIBLE (SINGLE MPU) | |
432 | +05210 KYBPUT PSHS A,X,CC | |
433 | +05220 ORCC #IRQMSK | |
434 | +05230 PULU A KEY CODE | |
435 | +05240 CMPA #KBREAK SYSTEM ATTENTION? | |
436 | +05250 BNE KYBPCH | |
437 | +05260 STA SYSATT | |
438 | +05270 LDA #KMT | |
439 | +05280 BRA KYBPF NO REPEAT | |
440 | +05290 KYBPCH CMPA #KMT | |
441 | +05300 BEQ KYBPF | |
442 | +05310 LEAX KEYEND,PCR | |
443 | +05320 PSHS X WRAP TEST | |
444 | +05330 LDX KEYIN | |
445 | +05340 STA ,X+ | |
446 | +05350 CMPX ,S++ | |
447 | +05360 BLO KYBPNW | |
448 | +05370 LEAX KEYBUF,PCR | |
449 | +05380 KYBPNW CMPX KEYOUT | |
450 | +05390 BNE KYBPNF | |
451 | +05400 LDA #12 | |
452 | +05410 ADDA BEEP | |
453 | +05420 STA BEEP | |
454 | +05430 LDA #KMT | |
455 | +05440 BRA KYBPF | |
456 | +05450 KYBPNF STX KEYIN | |
457 | +05460 KYBPF STA KEYLAS | |
458 | +05470 CLR KEYTIM | |
459 | +05480 PULS A,X,CC,PC | |
460 | +05490 * | |
403 | 461 | 10000 * |
404 | 462 | 10003 * OTHER HALF OF 60 HZ BEL |
405 | -10005 LDA BEEP | |
463 | +10005 DOBEEP LDA BEEP | |
406 | 464 | 10007 BEQ NOBEEP |
407 | 465 | 10009 DECA |
408 | 466 | 10011 STA BEEP |
@@ -416,149 +474,107 @@ | ||
416 | 474 | 10062 SETDP 0 |
417 | 475 | 10070 * |
418 | 476 | 15000 * Z IS UNDEFINED HANDLER |
419 | -15005 CALTBL FDB Z | |
420 | -15010 FDB Z | |
421 | -15015 FDB Z | |
422 | -15020 FDB Z | |
423 | -15025 FDB Z | |
424 | -15030 FDB Z | |
425 | -15035 FDB Z | |
426 | -15040 FDB Z | |
427 | -15045 FDB Z | |
428 | -15050 FDB Z | |
429 | -15055 FDB Z | |
430 | -15060 FDB Z | |
431 | -15065 FDB Z | |
432 | -15070 FDB Z | |
433 | -15075 FDB Z | |
434 | -15080 FDB Z | |
435 | -15085 FDB Z | |
436 | -15090 FDB Z | |
437 | -15095 FDB Z | |
438 | -15100 FDB Z | |
439 | -15105 FDB Z | |
440 | -15110 FDB Z | |
441 | -15115 FDB Z | |
442 | -15120 FDB Z | |
443 | -15125 FDB Z | |
444 | -15130 FDB Z | |
445 | -15135 FDB Z | |
446 | -15140 FDB Z | |
447 | -15145 FDB Z | |
448 | -15150 FDB Z | |
449 | -15155 FDB Z | |
450 | -15160 FDB Z | |
451 | -15165 FDB Z | |
452 | -15170 FDB Z | |
453 | -15175 FDB Z | |
454 | -15180 FDB Z | |
455 | -15185 FDB Z | |
456 | -15190 FDB Z | |
457 | -15195 FDB Z | |
458 | -15200 FDB Z | |
459 | -15205 FDB Z | |
460 | -15210 FDB Z | |
461 | -15215 FDB Z | |
462 | -15220 FDB Z | |
463 | -15225 FDB Z | |
464 | -15230 FDB Z | |
465 | -15235 FDB Z | |
466 | -15240 FDB Z | |
467 | -15245 FDB Z | |
468 | -15250 FDB Z | |
469 | -15255 FDB Z | |
470 | -15260 FDB Z | |
471 | -15265 FDB Z | |
472 | -15270 FDB Z | |
473 | -15275 FDB Z | |
474 | -15280 FDB Z | |
475 | -15285 FDB Z | |
476 | -15290 FDB Z | |
477 | -15295 FDB Z | |
478 | -15300 FDB Z | |
479 | -15305 FDB Z | |
480 | -15310 FDB Z | |
481 | -15315 FDB Z | |
482 | -15320 FDB Z | |
483 | -15325 FDB Z | |
484 | -15330 FDB Z | |
485 | -15335 FDB Z | |
486 | -15340 FDB Z | |
487 | -15345 FDB Z | |
488 | -15350 FDB Z | |
489 | -15355 FDB Z | |
490 | -15360 FDB Z | |
491 | -15365 FDB Z | |
492 | -15370 FDB Z | |
493 | -15375 FDB Z | |
494 | -15380 FDB Z | |
495 | -15385 FDB Z | |
496 | -15390 FDB Z | |
497 | -15395 FDB Z | |
498 | -15400 FDB Z | |
499 | -15405 FDB Z | |
500 | -15410 FDB Z | |
501 | -15415 FDB Z | |
502 | -15420 FDB Z | |
503 | -15425 FDB Z | |
504 | -15430 FDB Z | |
505 | -15435 FDB Z | |
506 | -15440 FDB Z | |
507 | -15445 FDB Z | |
508 | -15450 FDB Z | |
509 | -15455 FDB Z | |
510 | -15460 FDB Z | |
511 | -15465 FDB Z | |
512 | -15470 FDB Z | |
513 | -15475 FDB Z | |
514 | -15480 FDB Z | |
515 | -15485 FDB Z | |
516 | -15490 FDB Z | |
517 | -15495 FDB Z | |
518 | -15500 FDB Z | |
519 | -15505 FDB Z | |
520 | -15510 FDB Z | |
521 | -15515 FDB Z | |
522 | -15520 FDB Z | |
523 | -15525 FDB Z | |
524 | -15530 FDB Z | |
525 | -15535 FDB Z | |
526 | -15540 FDB Z | |
527 | -15545 FDB Z | |
528 | -15550 FDB Z | |
529 | -15555 FDB Z | |
530 | -15560 FDB Z | |
531 | -15565 FDB Z | |
532 | -15570 FDB Z | |
533 | -15575 FDB Z | |
534 | -15580 FDB Z | |
535 | -15585 FDB Z | |
536 | -15590 FDB Z | |
537 | -15595 FDB Z | |
538 | -15600 FDB Z | |
539 | -15605 FDB Z | |
540 | -15610 FDB Z | |
541 | -15615 FDB Z | |
542 | -15620 FDB Z | |
543 | -15625 FDB Z | |
477 | +15005 CALTBL FDB YIELD | |
544 | 478 | 15630 FDB Z |
545 | -15635 FDB Z | |
546 | -15640 FDB Z | |
547 | -15645 * 128 ENTRIES -> NO BOUNDS CHECK ON CALL NUMBER | |
548 | -15650 Z EQU * | |
479 | +15640 CALSIZ EQU (*-CALTBL)/2-1 | |
480 | +15650 SETDP SYSGLO/$100 | |
481 | +15660 Z STA $5FF | |
482 | +15670 LDA #UNDEF | |
483 | +15680 STA SYSERR | |
484 | +15800 YIELD CWAI #.NOT.IRQMSK | |
485 | +15810 RTS | |
549 | 486 | 16000 * SWI DISABLES IRQ |
550 | 487 | 16010 SWISRV LEAY CALTBL,PCR |
551 | -16900 PULU A CALL # | |
552 | -16910 ASLA WORD ADR | |
553 | -16920 JSR [A,Y] | |
554 | -16930 RTI | |
555 | -16940 * | |
488 | +16020 LEAX SYSGLO,PCR | |
489 | +16030 TFR X,D | |
490 | +16040 TFR A,DP | |
491 | +16045 SETDP SYSGLO/$100 | |
492 | +16050 * INDEX PROCESS TABLE ENTRY | |
493 | +16060 LEAX PROTBL,PCR | |
494 | +16070 LDA #PROSIZ | |
495 | +16080 LDB CURPRO | |
496 | +16090 MUL | |
497 | +16100 LEAX D,X | |
498 | +16110 STX PROCIX | |
499 | +16120 PULU A CALL # | |
500 | +16130 CMPA #CALSIZ | |
501 | +16140 BLS SWISC | |
502 | +16150 JSR [CALSIZ*2,Y] UNDEFINED | |
503 | +16160 BRA SWISN | |
504 | +16180 SWISC ASLA WORD | |
505 | +16190 JSR [A,Y] SIGNED OFFSET | |
506 | +16195 SWISN STU 8,S BALANCE PARAMETERS | |
507 | +16200 RTI | |
556 | 508 | 20000 * |
557 | 509 | 20010 CLICK PSHS A |
558 | 510 | 20020 LDA VIDMOD |
559 | 511 | 20030 EORA #BSOUND |
560 | 512 | 20040 STA VIDMOD |
561 | 513 | 20050 PULS A,PC |
514 | +20060 * | |
515 | +20070 GETKEY PSHS CC,A,B,X,Y | |
516 | +20080 LEAY KEYEND,PCR | |
517 | +20090 PSHS Y | |
518 | +20095 BSR IXWIND | |
519 | +20100 LDY ,U | |
520 | +20120 BSR IXCRSR | |
521 | +20125 LDA WCSCLR,Y | |
522 | +20130 LDB [,U] CHARACTER UNDER CURSOR | |
523 | +20140 ORCC #IRQMSK | |
524 | +20150 GETKLP LDX KEYOUT | |
525 | +20160 CMPX KEYIN | |
526 | +20170 BNE GETKIN | |
527 | +20180 PSHS B | |
528 | +20190 LDB WCSTAT,Y DISPLAY IT? | |
529 | +20200 BPL GETKNC | |
530 | +20210 ANDB #$7F FLASH? | |
531 | +20220 BEQ GETKNF | |
532 | +20230 DEC WCSTIM,Y | |
533 | +20240 BGT GETKNF | |
534 | +20250 STB WCSTIM,Y RESTORE COUNT | |
535 | +20260 ADDA #$10 NEW COLOR | |
536 | +20270 BMI GETKNF | |
537 | +20280 LDA #$8F | |
538 | +20290 GETKNF STA [,U] CURSOR ON SCREEN | |
539 | +20300 GETKNC PULS B | |
540 | +20310 CLR ,-U YIELD CPU | |
541 | +20320 SWI | |
542 | +20330 BRA GETKLP | |
543 | +20340 GETKIN STB [,U++] PUT CHARACTER BACK ON SCREEN | |
544 | +20350 LDA ,X+ | |
545 | +20360 CMPX ,S++ WRAP? | |
546 | +20370 BLO GETKBF | |
547 | +20380 LEAX KEYBUF,PCR | |
548 | +20390 GETKBF STX KEYOUT | |
549 | +20400 PSHU A | |
550 | +20410 PULS PC,CC,A,B,X,Y | |
551 | +20420 * | |
552 | +20430 IXWIND PSHS A,B,Y | |
553 | +20440 LEAY WINTBL,PCR | |
554 | +20450 PULU B | |
555 | +20460 ANDB #NUMWIN-1 | |
556 | +20470 LDA #WINSIZ | |
557 | +20480 MUL | |
558 | +20490 LEAY D,Y | |
559 | +20500 PSHU Y | |
560 | +20510 PULS A,B,Y,PC | |
561 | +20520 * | |
562 | +20530 IXCRSR PSHS A,B,X | |
563 | +20540 LDX ,U | |
564 | +20550 LDA WSCR,X | |
565 | +20560 ASLA | |
566 | +20570 PSHS A | |
567 | +20580 LDA #SCRWID | |
568 | +20590 LDB WCURRW,X | |
569 | +20600 ADDB WTROW,X | |
570 | +20610 MUL | |
571 | +20620 ADDB WLCOL,X | |
572 | +20630 ADCA #0 | |
573 | +20640 ADDB WCURCL,X | |
574 | +20650 ADCA ,S+ | |
575 | +20660 STD ,U | |
576 | +20670 PULS A,B,X,PC | |
577 | +20680 * | |
562 | 578 | 50000 O EQU * |
563 | 579 | 50010 * STARTUP CODE |
564 | 580 | 50020 * INTIALIZE PORTS |
@@ -596,28 +612,31 @@ | ||
596 | 612 | 50350 TFR Y,D |
597 | 613 | 50360 TFR A,DP |
598 | 614 | 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 | |
614 | -54910 BRA WAITIQ | |
615 | +50380 LDX #$400 | |
616 | +50390 WAITIQ CLR ,-U WINDOW 0 | |
617 | +50410 LBSR GETKEY | |
618 | +50420 PULU A | |
619 | +50430 STA ,X+ | |
620 | +50440 CMPX #$600 | |
621 | +50450 BLO *+5 | |
622 | +50460 LDX #$400 | |
623 | +50470 CMPA #3 | |
624 | +50480 BNE WAITIQ | |
625 | +50485 ORCC #IRQMSK | |
626 | +50490 LDA KEYCOL+1 | |
627 | +50500 ANDA #.NOT.1 | |
628 | +50510 STA KEYCOL+1 | |
629 | +50520 LDD SVSAVE,PCR | |
630 | +50530 STD SWIVEC | |
631 | +50540 LDD IVSAVE,PCR | |
632 | +50550 STD IRQVEC | |
633 | +50560 SWI | |
615 | 634 | 55990 * |
616 | 635 | 56000 FDB 0 |
617 | -56010 IDLESL RMB 32 | |
636 | +56010 IDLESL RMB 128 | |
618 | 637 | 56020 IDLESP EQU * |
619 | 638 | 56030 FDB 0 |
620 | -56032 IDLEUL RMB 32 | |
639 | +56032 IDLEUL RMB 128 | |
621 | 640 | 56034 IDLEUB EQU * |
622 | 641 | 56036 FDB 0 |
623 | 642 | 56040 IDLLIM EQU * |