• 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

Revision9518b6d6db9c37367ef560505d64f3b1d1396057 (tree)
Time2013-07-08 13:37:33
AuthorJoel Matthew Rees <reiisi@user...>
CommiterJoel Matthew Rees

Log Message

I think this was where I got basic clock/calendar functionality sort of working.

Change Summary

Incremental Difference

--- /dev/null
+++ b/OSCLOCK5.AS9
@@ -0,0 +1,535 @@
1+00080 ORG $4000
2+00090 SYSGLO EQU *
3+00100 * SYSGLO MUST BE ON EVEN PAGE (256 BYTE) BOUNDARY
4+00105 IVSAVE RMB 2 IRQ VECTOR FOR RETURN TO EDTASM
5+00106 SVSAVE RMB 2 SWI VECTOR FOR RETURN TO EDTASM
6+00107 S3SAVE RMB 2 SWI3 VECTOR FOR RETURN TO EDTASM
7+00110 HASTY RMB 1 ABBREVIATE IRQ (TIMER) SERVICE?
8+00120 SLICEL FCB 10 LIMIT OF TICKS/SLICE
9+00130 SLICE RMB 1 COUNT OF TICKS REMAINING IN THIS SLICE
10+00140 BEEP FCB 255 RMB 1 COUNT OF TICKS LEFT TO BEEP
11+00150 SYSERR FDB 0
12+00160 CURPRO FCB 0
13+00170 PROCIX FDB 0 ADDRESS OF ENTRY IN PROTBL
14+00600 YRBASE FDB 1900
15+00610 YEAR FCB 87
16+00620 MONTH FCB 4
17+00630 DAY FCB 1
18+00640 HOUR FCB 0
19+00650 MINUTE FCB 0
20+00660 SECOND FCB 0
21+00670 TICK FCB 0
22+00800 * 64 POTENTIAL LEAP YEARS IN BIT MAP (FASTER THAN DIVIDE)
23+00810 LYRTBL FCB $FE YEAR 1900
24+00820 FCB $FF
25+00830 FCB $FF
26+00840 FCB $FF YEAR 2000
27+00850 FCB $FF
28+00860 FCB $FF
29+00870 FCB $FB YEAR 2100
30+00880 FCB $FF
31+00890 *
32+00900 * TABLE OF DAYS IN MONTHS
33+00910 MONTBL FCB 0 NO DAYS IN MONTH ZERO
34+00920 FCB 31
35+00930 FCB 28
36+00940 FCB 31
37+00950 FCB 30
38+00960 FCB 31
39+00970 FCB 30
40+00980 FCB 31 JULY
41+00990 FCB 31 AUGUST
42+01000 FCB 30
43+01010 FCB 31
44+01020 FCB 30
45+01030 FCB 31
46+01040 FCB 0 NO DAYS
47+01050 FCB 0 IN MO.
48+01060 FCB 0 13-15 (FOR AUTO-RESTORING)
49+01500 PROTBL EQU * P0 IS IDLE PROCESS
50+01510 PROCSP EQU *-PROTBL SYSTEM STACK POINTER IN SUSPENSE
51+01520 FDB IDLESP
52+01530 PROCSB EQU *-PROTBL SYSTEM STACK BASE
53+01540 FDB IDLESP
54+01542 PROCSL EQU *-PROTBL SYSTEM STACK LIMIT
55+01544 FDB IDLESL
56+01550 PROCUB EQU *-PROTBL USER STACK BASE
57+01560 FDB IDLEUB
58+01562 PROCUL EQU *-PROTBL USER (PARAMETER) STACK LIMIT
59+01564 FDB IDLEUL
60+01570 PROCBA EQU *-PROTBL BOTTOM OF PROCESS IMAGE
61+01580 FDB O START UP
62+01590 PROCLI EQU *-PROTBL TOP OF PROCESS IMAGE
63+01600 FDB IDLLIM
64+01940 PROCST EQU *-PROTBL PROCESS STATE
65+01950 FCB 0
66+01960 PROCRT EQU *-PROTBL OVERDRIVE (2X) CLOCK RATE FLAG
67+01970 FCB 0
68+01980 PROSIZ EQU *-PROTBL SIZE OF PROCESS TABLE
69+01990 RMB 19*PROSIZ
70+02000 *
71+02010 CARRY EQU 1 FLAG BIT
72+02020 TIMOVR EQU $8000
73+02030 IRQMSK EQU $10
74+02040 KEYROW EQU $FF00
75+02050 KEYCOL EQU $FF02
76+02060 IRQVEC EQU $10D
77+02065 SWIVEC EQU $107
78+02068 SW3VEC EQU $101
79+02070 VIDMOD EQU $FF22
80+02080 BSOUND EQU 2
81+02090 OVRDRV EQU $FFD9
82+02900 KSTACO FDB 0
83+02910 RMB $100 KERNEL'S STACK
84+02920 KSTACK EQU *
85+02930 KUSTKO FDB 0
86+02940 RMB $100 KERNEL'S PARAMETER STACK
87+02950 KUSTAK EQU *
88+02960 FDB 0
89+03000 *
90+03010 * SYSGLO CONTAINS SYSTEM GLOBALS
91+03020 IRQSRV INC TICK,PCR
92+03030 TST HASTY,PCR
93+03040 BEQ *+3
94+03050 RTI
95+03060 *
96+03065 CLR OVRDRV SWITCH TO WARP SPEED
97+03070 * INDEX PROCESS TABLE ENTRY
98+03072 LEAX PROTBL,PCR
99+03074 LDA #PROSIZ
100+03076 LDB CURPRO
101+03078 MUL
102+03080 LEAX D,X
103+03082 STX PROCIX
104+03084 STS PROCSP,X
105+03090 * SWITCH TO KERNEL STACK
106+03095 LDU #KUSTAK
107+03100 LDS #KSTACK
108+03110 * DEFINITELY NOT RE-ENTRANT
109+03120 LEAY SYSGLO,PCR
110+03130 TFR Y,D
111+03140 TFR A,DP
112+03150 SETDP SYSGLO/$100
113+03155 * HALF OF 60 HZ BEL
114+03160 TST BEEP
115+03170 BEQ *+5
116+03200 LBSR CLICK
117+03205 *
118+03210 LDA TICK
119+03220 SUBA #60
120+03230 LBLO KEYRD
121+03240 INC MINUTE
122+03250 STA SECOND ALLOW TICKS TO OVERFLOW SECONDS
123+03260 LDA MINUTE
124+03270 SUBA #60
125+03280 LBLO KEYRD
126+03290 INC HOUR
127+03300 CLR MINUTE
128+03310 LDA HOUR
129+03320 SUBA #24
130+03330 BLO KEYRD
131+03340 INC DAY
132+03350 CLR HOUR
133+03360 *
134+03370 LDA MONTH
135+03380 ANDA #$F CRUDE AUTO-RESTORE
136+03390 * CHECK LEAP YEAR
137+03400 CMPA #2
138+03410 BNE NOLEAP
139+03420 LDB YEAR
140+03430 TSTB #3 MODULO 4
141+03440 BNE NOLEAP
142+03450 LSRB YEAR/4
143+03460 LSRB
144+03470 PSHS B
145+03480 LSRB YEAR/32
146+03490 LSRB
147+03500 LSRB
148+03510 LEAX LYRTBL,PCR
149+03520 LEAX B,X
150+03530 PULS A BIT #
151+03540 ANDA #7
152+03550 CLRB
153+03560 ORCC #CARRY
154+03570 LYRBLP ROLB
155+03580 DECA
156+03590 BPL LYRBLP
157+03600 *
158+03610 ANDB ,X LEAP?
159+03620 BEQ NOLEAP
160+03630 LEAX MONTBL,PCR
161+03640 LDB 2,X
162+03650 INCB ONE MORE DAY
163+03660 CMPB DAY
164+03670 BHS KEYRD
165+03680 INC MONTH
166+03690 LDB #1
167+03700 STB DAY
168+03710 BRA KEYRD NOW MARCH, SAME YEAR
169+03720 *
170+03730 NOLEAP LDD MONTH
171+03740 ANDA #$F
172+03750 LEAX MONTBL,PCR
173+03760 CMPB A,X CHECK DAYS FOR THIS MONTH
174+03770 BLS KEYRD
175+03780 LDB #1
176+03790 STB DAY
177+03800 INCA
178+03810 CMPA #12
179+03820 BHI *+6
180+03830 STA MONTH
181+03840 BRA KEYRD
182+03850 STB MONTH
183+03860 INC YEAR
184+03870 BNE KEYRD
185+03880 LDD #TIMOVR
186+03890 STD SYSERR
187+03900 *
188+03910 KEYRD TST KEYCOL
189+10000 *
190+10003 * OTHER HALF OF 60 HZ BEL
191+10005 LDA BEEP
192+10007 BEQ NOBEEP
193+10009 DECA
194+10011 STA BEEP
195+10013 LBSR CLICK
196+10015 NOBEEP LDX PROCIX
197+10025 TST PROCRT,X
198+10027 BNE *+5
199+10040 CLR OVRDRV-1 BACK TO VISIBLE SPEED
200+10050 LDS PROCSP,X
201+10060 RTI
202+10062 SETDP 0
203+10070 *
204+15000 * Z IS UNDEFINED HANDLER
205+15005 CALTBL FDB Z
206+15010 FDB Z
207+15015 FDB Z
208+15020 FDB Z
209+15025 FDB Z
210+15030 FDB Z
211+15035 FDB Z
212+15040 FDB Z
213+15045 FDB Z
214+15050 FDB Z
215+15055 FDB Z
216+15060 FDB Z
217+15065 FDB Z
218+15070 FDB Z
219+15075 FDB Z
220+15080 FDB Z
221+15085 FDB Z
222+15090 FDB Z
223+15095 FDB Z
224+15100 FDB Z
225+15105 FDB Z
226+15110 FDB Z
227+15115 FDB Z
228+15120 FDB Z
229+15125 FDB Z
230+15130 FDB Z
231+15135 FDB Z
232+15140 FDB Z
233+15145 FDB Z
234+15150 FDB Z
235+15155 FDB Z
236+15160 FDB Z
237+15165 FDB Z
238+15170 FDB Z
239+15175 FDB Z
240+15180 FDB Z
241+15185 FDB Z
242+15190 FDB Z
243+15195 FDB Z
244+15200 FDB Z
245+15205 FDB Z
246+15210 FDB Z
247+15215 FDB Z
248+15220 FDB Z
249+15225 FDB Z
250+15230 FDB Z
251+15235 FDB Z
252+15240 FDB Z
253+15245 FDB Z
254+15250 FDB Z
255+15255 FDB Z
256+15260 FDB Z
257+15265 FDB Z
258+15270 FDB Z
259+15275 FDB Z
260+15280 FDB Z
261+15285 FDB Z
262+15290 FDB Z
263+15295 FDB Z
264+15300 FDB Z
265+15305 FDB Z
266+15310 FDB Z
267+15315 FDB Z
268+15320 FDB Z
269+15325 FDB Z
270+15330 FDB Z
271+15335 FDB Z
272+15340 FDB Z
273+15345 FDB Z
274+15350 FDB Z
275+15355 FDB Z
276+15360 FDB Z
277+15365 FDB Z
278+15370 FDB Z
279+15375 FDB Z
280+15380 FDB Z
281+15385 FDB Z
282+15390 FDB Z
283+15395 FDB Z
284+15400 FDB Z
285+15405 FDB Z
286+15410 FDB Z
287+15415 FDB Z
288+15420 FDB Z
289+15425 FDB Z
290+15430 FDB Z
291+15435 FDB Z
292+15440 FDB Z
293+15445 FDB Z
294+15450 FDB Z
295+15455 FDB Z
296+15460 FDB Z
297+15465 FDB Z
298+15470 FDB Z
299+15475 FDB Z
300+15480 FDB Z
301+15485 FDB Z
302+15490 FDB Z
303+15495 FDB Z
304+15500 FDB Z
305+15505 FDB Z
306+15510 FDB Z
307+15515 FDB Z
308+15520 FDB Z
309+15525 FDB Z
310+15530 FDB Z
311+15535 FDB Z
312+15540 FDB Z
313+15545 FDB Z
314+15550 FDB Z
315+15555 FDB Z
316+15560 FDB Z
317+15565 FDB Z
318+15570 FDB Z
319+15575 FDB Z
320+15580 FDB Z
321+15585 FDB Z
322+15590 FDB Z
323+15595 FDB Z
324+15600 FDB Z
325+15605 FDB Z
326+15610 FDB Z
327+15615 FDB Z
328+15620 FDB Z
329+15625 FDB Z
330+15630 FDB Z
331+15635 FDB Z
332+15640 FDB Z
333+15645 * 128 ENTRIES -> NO BOUNDS CHECK ON CALL NUMBER
334+15650 Z EQU *
335+16000 * SWI DISABLES IRQ
336+16010 SWISRV LEAY CALTBL,PCR
337+16900 PULU A CALL #
338+16910 ASLA WORD ADR
339+16920 JSR [A,Y]
340+16930 RTI
341+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+20000 *
480+20010 CLICK PSHS A
481+20020 LDA VIDMOD
482+20030 EORA #BSOUND
483+20040 STA VIDMOD
484+20050 PULS A,PC
485+50000 O EQU *
486+50010 * STARTUP CODE
487+50020 * INTIALIZE PORTS
488+50030 * 1 BIT SOUND OUTPUT
489+50032 LDS #IDLESP
490+50034 LDU #IDLEUB
491+50040 LDA VIDMOD+1
492+50050 ANDA #.NOT.4
493+50060 STA VIDMOD+1 DATA DIRECTION REGISTER
494+50070 LDB VIDMOD
495+50080 ORB #BSOUND
496+50090 STB VIDMOD
497+50100 ORA #4 DATA REGISTER
498+50110 STA VIDMOD+1
499+50120 * ENABLE IRQ ON FIELD SYNC
500+50130 * (INTERRUPTS 60 TIMES A SECOND
501+50140 * MASK IRQ FIRST
502+50150 ORCC #IRQMSK
503+50160 * SET UP IRQ VECTOR
504+50170 LDD IRQVEC
505+50180 STD IVSAVE,PCR
506+50190 LDD #IRQSRV
507+50200 STD IRQVEC
508+50205 * ENABLE PORT
509+50210 LDA KEYCOL+1
510+50220 ORA #1
511+50230 STA KEYCOL+1
512+50240 * HANDSHAKE BY READING KEYCOL (IMPLICIT IN KEY DECODE)
513+50250 LDD SWIVEC SET UP SYSTEM CALLS - SWI
514+50260 STD SVSAVE,PCR
515+50270 LDD #SWISRV
516+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+50330 *
522+54900 WAITIQ CWAI #.NOT.IRQMSK
523+54910 BRA WAITIQ
524+55990 *
525+56000 FDB 0
526+56010 IDLESL RMB 32
527+56020 IDLESP EQU *
528+56030 FDB 0
529+56032 IDLEUL RMB 32
530+56034 IDLEUB EQU *
531+56036 FDB 0
532+56040 IDLLIM EQU *
533+56050 *
534+62000 END
535+
\ No newline at end of file
--- a/TIMKEY.AS9
+++ /dev/null
@@ -1,97 +0,0 @@
1-00100 KR EQU $FF00
2-00110 KC EQU $FF02
3-00120 VSAVE RMB 2
4-00130 IRQV EQU $10C
5-00140 COUNT FCB 0
6-00150 OLDKEY FCB 0
7-00160 FLAG FCB $80
8-00200 O LDU #$8000
9-00210 LDS #$7800
10-00220 LDA KC+1
11-00230 ANDA #.NOT.4
12-00240 STA KC+1
13-00250 LDB #$FF
14-00260 STB KC
15-00270 ORA #4
16-00280 STA KC+1
17-00290 LDB #$BF
18-00295 STB KC
19-00300 LDD IRQV+1
20-00310 STD VSAVE
21-00315 ORCC #$10
22-00320 LDD #CKEY
23-00330 STD IRQV+1
24-00340 LDB KC+1
25-00350 ANDB #$FD
26-00360 ORB #1
27-00370 TST KC
28-00380 STB KC+1
29-00390 KTIME CWAI #$EF
30-00400 LDB COUNT
31-00410 BEQ KTIME
32-00420 LBSR HOME
33-00430 PSHU B
34-00440 LBSR HXOUT
35-00442 LDA FLAG
36-00444 JSR [$A002]
37-00446 INCA
38-00448 STA FLAG
39-00450 BRA KTIME
40-00460 *
41-00470 CKEY LDA KR
42-00475 CMPA #$FF
43-00480 BEQ CKEY0
44-00490 CMPA OLDKEY
45-00495 BEQ CKEYLD
46-00500 STA OLDKEY
47-00505 BRA CKEY0
48-00510 CKEYLD INC COUNT
49-00515 BRA CKEYBK
50-00520 CKEY0 CLR COUNT
51-00525 CKEYBK TST KC
52-00530 RTI
53-00535 *
54-01110 KLOOP LDA #7
55-01120 BSR HOME
56-01130 LDB #$FF
57-01140 STB KC
58-01150 ANDCC #.NOT.1
59-01160 KILOOP ROL KC
60-01170 LDB KR
61-01180 PSHU B
62-01190 BSR HXOUT
63-01200 LDB KC
64-01210 PSHU B
65-01220 BSR HXOUT
66-01230 DECA
67-01240 ORCC #1
68-01250 BPL KILOOP
69-01260 BRA KLOOP
70-01270 *
71-01280 HOME PSHS A,B
72-01290 LDD #$400
73-01300 STD $88
74-01310 PULS A,B,PC
75-01320 *
76-01330 HXOUT PSHS A
77-01340 LDA ,U
78-01350 LSRA
79-01360 ASRA
80-01370 ASRA
81-01380 ASRA
82-01390 BSR DIGOUT
83-01400 LDA ,U+
84-01410 ANDA #$F
85-01420 BSR DIGOUT
86-01430 LDA #'
87-01440 JSR [$A002]
88-01450 PULS A,PC
89-01460 *
90-01470 DIGOUT CMPA #9
91-01480 BLS HXODEC
92-01490 ADDA #'A-'9-1
93-01500 HXODEC ADDA #'0
94-01510 JSR [$A002]
95-01520 RTS
96-01530 END
97-
\ No newline at end of file