-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVIPDSKYCLOCKP2.prn
More file actions
2033 lines (1736 loc) · 98.1 KB
/
VIPDSKYCLOCKP2.prn
File metadata and controls
2033 lines (1736 loc) · 98.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
;
; File: VIPDSKYCLOCKP2.asm
;
;_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
; Author: S. Botts
; Size: 81.2 KB (83,181 bytes)
; Copyright: (c)2015 by SBOTTS - All righty then.
;
; Purpose: Demonstrates an Apollo Guidence Computor (AGC)
; (DSKY)Display Keyboard Unit with VIP.
; Checksum: 688D
; CRC-32: E571B87A
; Versions:
; Date: Tuesday, July 21, 2015, 11:10:53 PM
; CPU: RCA 1802 (1802 COSMAC family)
;
;_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
;--------------------------------------------------------------------------
; Versions:
; 1.3 Date: Tuesday, July 21, 2015, 11:10:53 PM - Added NOUNs 65, 36, Keys: "D", "E", "F"
; 1.2 Date: Sunday, July 19, 2015, 09:44:35 PM - First Release. Only VERBs 16, 35, 36, KEYs "A", "B"
; 1.1 Date: Saturday, July 11, 2015, 12:43:52 PM - MET Clock with formatting
; 1.0 Date: Sunday, Sunday, June 28, 2015, 8:16:02 AM - MET Clock Display only
;
;****************************(DO NOT MODIFY)**************************************
0000 r0 EQU 0 ;DMA address
0001 r1 EQU 1 ;Interrupt Address
0002 r2 EQU 2 ;Stack
0003 r3 EQU 3 ;MAIN Program Counter (PC)
;****************************(DO NOT MODIFY)**************************************
0004 r4 EQU 4 ;INDEX
0005 r5 EQU 5 ;COUNTERs
0006 r6 EQU 6 ;Memory Pointer #1- ALSO USED TO STOrE VAr INST
0007 r7 EQU 7 ;Memory Pointer #2- HOLDS VAr INSTrUCTION
0008 r8 EQU 8 ;counter in display routine
0009 r9 EQU 9 ;INTERRUPT COUNTER - 61 times per sec in interrupt (DO NOT MODIFY)
000a ra EQU 10 ;
000b rb EQU 11 ;
000c rc EQU 12 ;Second PC -> Returns control to MAIN PC (R3)
000d rd EQU 13 ;Third PC -> Returns control to RC
000e re EQU 14 ;KEY Press Result
000f rf EQU 15 ;
; Redundant reg defines...
000a r10 EQU 10 ;
000b r11 EQU 11 ;
000c r12 EQU 12 ;
000d r13 EQU 13 ;
000e r14 EQU 14 ;
000f r15 EQU 15 ;
;
;=========================================================================
;=============================PAGE 0000===================================
;=========================================================================
0000 org $0000
;
0000 start:
0000 f8 cd ldi LOW TV_INT ;Point to 1861 video interrupt $8D
0002 a1 plo r1
0003 f8 01 ldi HIGH TV_INT ;Point to 1861 video interrupt $8D
0005 b1 phi r1
0006 f8 94 ldi LOW STACK ;R2 is stack in RAM $4D
0008 a2 plo r2
0009 f8 00 ldi HIGH STACK
000b b2 phi r2 ;Stack
000c f8 20 ldi LOW L0014 ;Make R3 the PC
000e a3 plo r3 ;Preset all these RN.1 registers to this page.
000f f8 00 ldi HIGH L0014 ;Should be page zero...
0011 b3 phi r3 ;PC
; ghi r0 ;DMA - Should be Page 0
0012 f8 00 ldi $00
; phi r1 ;Point to Interrupt page
; phi r2 ;Point to Stack page
;continue clearing the R(N).1 (MSB) counters
0014 b4 phi r4 ;pointer
0015 b5 phi r5 ;pointer
0016 b6 phi r6 ;Self mod code pointer
0017 b7 phi r7 ;vAR instruction
0018 b8 phi r8 ;Clear R8.1 counter in Display
0019 b9 phi r9 ;Clear R9.1 61 counts/set
001a ba phi ra
001b bb phi rb
; phi rc ;point to key page
001c bd phi rd
001d be phi re
001e bf phi rf
;**********************REG initializations are complete**********************
;Switch PC to R(3)
001f d3 sep r3 ; SET PC to R3 HERE
;Switch INDEX Counter to R(2)
0020 L0014:
0020 e2 sex r2 ; SET X to R2 HERE
;************************************************************************
; Real Time Clock - Mission Elapsed Time (MET)
;************************************************************************
;
;Description:
;This is the master background task for VIP_DSKY updated by teh VIDEO
;Interrupt.
;
;
;Registers Used:
; R(9) = Interrupt timer (Do not modify - Read only )
; R(3) = HHHMMSS Pointer
; R(4) = Index Reg R(X)
; R(5) = NA
; R(A) = Counter
;
;************************************************************************
0021 STARTCLK:
0021 69 inp 1 ; Ready to start clock -> Turn ON TV!
0022 L0024:
0022 f8 00 ldi HIGH KEYS ;
0024 b4 phi r4 ;Use R(4)
0025 f8 95 ldi LOW KEYS ;KEY Buffer
0027 a4 plo r4
0028 f8 10 ldi $10
002a ae plo re
002b KES:
002b 2e dec re
002c 8e glo re
002d fa 0f ani $0F ;mask off msb
002f 54 str r4 ;store on stack
0030 e4 sex 4
0031 62 out 2 ;output via R(x) -> BUS
0032 e2 sex 2
0033 24 dec r4 ;point back to buffer
0034 36 41 b3 KEY ;key pressed?
0036 8e glo re
0037 3a 2b bnz KES ;no - scan keys
0039 89 glo r9 ;get interrupt timer (R9.0)
003a fb 3d xri $3D ;61 counts?
003c 3a 22 bnz L0024 ;Nope - check again (key in here?)
003e a9 plo r9 ;YES it is! - Reset interrupt timer and proceed...
;*************************************************************************
; 1 HZ LOOP Begins here... FLASH Q LED to indicate
;*************************************************************************
;First check for key command...
;*************************************************************************
003f 30 4e br NOKEY
0041 KEY:
;======================TEST====================================
; ldi HIGH NOUN_VERB ;point it to some place to store key
; phi r4 ;Use R(4)
; ldi LOW NOUN_VERB+1 ;Point to a good screen location
; plo r4;
;
;
; glo re ;use switches for test
; ani $0F ;mask off msb
; str r4
;======================TEST====================================
0041 36 41 b3 $ ;Wait here for the key to get released!
0043 f8 02 ldi HIGH CPROC
0045 bc phi rc
0046 f8 01 ldi LOW CPROC
0048 ac plo rc
0049 dc sep rc
004a f8 00 ldi $00 ;yes since there was a pressed key
004c b9 phi r9 ;lets reset the clock timer again
004d a9 plo r9 ;so no overflow occurs
004e NOKEY:
;*****************FLASH Q LED ********************************
; this is a 1 sec on off flash...
; heart beat used to show RTC is running
; and updates and Display Flashing Digits as needed.
;**************************************************************
;
004e 39 53 bnq L001C ; is Q ON?
0050 7a req ;YES - turn it off
0051 30 54 br L001D
0053 L001C:
0053 7b seq ;NO - Turn it on
;*************************************************************
;***************** TIMER LOOP ********************************
;*************************************************************
;
;This is the Main Clock loop. It does not display the time, but
;it maintains an elapsed timer. It Does the HH:MM:SS count in
;RAM and controls the rollovers to xx:59:59
;Zero Hour is checked on exit and gets reset then if needed.
;
0054 L001D:
; ghi r3 ;Reset Rx.1 to Current page (0)
0054 f8 00 ldi $00 ;Reset Rx.1 to page (0)
0056 b5 phi r5 ;R5.1
0057 b4 phi r4 ;R4.1
0058 b6 phi r6 ;R6.1
0059 b7 phi r7 ;R7.1
005a f8 a0 ldi HHMMSS+5 ;Time stored in RAM (HH:MM:SS))
005c a4 plo r4 ;R(4) will be the index
; plo r5
005d e4 sex r4 ;make R(4) the X Reg
005e DIGIT:
005e f0 ldx ;get time_LSD(x) -> RA.0
005f aa plo ra
0060 1a inc ra ;Increment the counter in R(A)
0061 8a glo ra
0062 54 str r4 ;put it back in RAM
0063 8a glo ra
0064 fb 0a xri $0A ;is it 10?
0066 3a 79 bnz FXDISP ;Not yet - but we are done here no MSD to increment
;Yes = 0
0068 73 stxd ;then store it time(x) and decrement pointer to point to MSB
0069 f0 ldx ;get time_MSD(x) -> RA.0
006a aa plo ra
006b 1a inc ra ;Increment the counter in R(A)
006c 8a glo ra
006d 54 str r4 ;put it back in RAM
006e 8a glo ra
006f fb 06 xri $06 ;is it 60? (NOTE:even though we check for 60 hours we'll never get there)
0071 3a 79 bnz FXDISP ;Not yet - but we are done here but hours need checking
;Yes = 0
0073 73 stxd ;then store it time(x) and decrement pointer
0074 84 glo r4 ;check was this the last digit? (x=HHMMSS)
0075 NEXTDIG:
0075 fb 9a xri HHMMSS-1
0077 3a 5e bnz DIGIT ;No, get next digit
; br FXDISP ;Yes, check if Hours = 24
;
;********************************************
; FXDISP
;**NOTE** this can move to Main Clock Loop
;********************************************
;Fix the HH display and counters for 24 Hr
;clock rollover. 23:59:59 -> 00:00:00
;********************************************
;
0079 FXDISP: ; fix for current display move mem into RA -> RF
0079 f8 9b ldi HHMMSS
007b a4 plo r4
007c 72 ldxa ;Pick up 10's hours digit
007d f6 shr ;01 >> 0 + DF
007e f6 shr ;check for hour 20: (Bit 0010)
007f 3b c4 bnf DISPLAY ;still <20: - not there yet just update the display!
0081 72 ldxa ;Pick up 1's Hours
0082 fb 04 xri $04 ;is it the hour 24:00?
0084 3a c4 bnz DISPLAY ; Nope keep going...
;... it's zero hour midnight!
0086 f8 9b ldi HHMMSS
0088 a4 plo r4 ;then store it time(x) and decrement pointer
0089 f8 00 ldi $00
008b 54 str r4
008c 14 inc r4
008d 54 str r4 ; fall through to display...
008e 30 c4 br DISPLAY
;======================================================
;
; PAGE 0 RAM BUFFERS
;
;======================================================
;********************************************
; IRQ STACK BUFFER
;********************************************
;these next three locations are the stack for
;the intrerrupt in RAM ...
;********************************************
0090 00 00 00 00 db $00, $00, $00, $00
0094 STACK:
0094 00 db $00
0095 KEYS:
0095 00 00 00 db $00, $00, $00
0098 CMD:
0098 00 db $00
0099 CDEX:
0099 00 db $00
009a CCNT:
009a 00 db $00
;********************************************
; RTC COUNTERS
;********************************************
;Maximum count is 23:59:59 -> 00:00:00
; Note: it is set to 23:59:58 on reset
; to test the big rollover
;********************************************
009b HHMMSS:
009b HH:
009b 02 03 db $02, $03 ;Hours HH
009d MM:
009d 05 09 db $05, $09 ;Minutes MM
009f SS:
009f 05 08 db $05, $08 ;Seconds SS
;******DAY COUNTER 000 -> 365(6) can go here...
;but remember 366 day leap years? 2016, 2020, 2024,2028, 2032...
;*********************************************************************************
; DSKY DISPLAY FORMAT
;*********************************************************************************
;This is the BUFFER in RAM that the command and prog processes control the values here.
;It calls VIP_DIS to format and display for the 1861 PIXIE display.
;The upper nibbles control how the output is displayed and special (+/-_) chars are shown
;
; The DISPLAY REGISTERS1-3. ACTY, NOUN, VERB, AND PROG CAN ALL USE THESE FORMAT controls
; All 5 LINES WITH 6 CHARS PER LINE ARE DISPLAYED EACH UPDATE. The formats are:
; $Fn MSB =($F)lash n = digit (flashes this digit alternating the pattern and $00
; $Cn MSB =($C)LEAR n = digit (does not show this digit)
; for (S)ign:
; $0n MSB =($0)CLEAR (OCTAL), n = digit -> CLEARS THE PATTERN NONE OR THIRD "F" KEY
; $1n MSB =($1)"-" (NEGITIVE DEC), n = digit -> STORES THE HORIZONTAL MINUS PATTERN FIRST "F" KEY
; $2n MSB =($2)"+" (POSITIVE DEC), n = digit -> ADDS THE VERTICAL PLUS PATTERN SECOND "F" KEY
;Just store them here with the conrtol bits set and the display formatter will take
;care of the display behaviour.
;*********************************************************************************
; -------------------------------
;DIGI= SD5 D5 D4 D3 D2 D1
;+ADD= +0 +1 +2 +3 +4 +5
; -------------------------------
00a1 PROG_REG:
00a1 c0 a1 c2 c3 db $C0, $A1, $C2, $C3, $00, $00
00a5 00 00
00a7 NOUN_VERB:
; db $C0, $00, $00, $C0, $00, $00 ;Display default with A=00 and B=00
00a7 c0 fa fa c0 db $C0, $FA, $FA, $C0, $FB, $FB ;Display default with flashing AA BB
00ab fb fb
;
;====================LINE=======================+
;
00ad REG1:
00ad 52 00 00 00 db $52, $00, $00, $00, $00, $00
00b1 00 00
00b3 REG2:
00b3 51 00 00 00 db $51, $00, $00, $00, $00, $00
00b7 00 00
00b9 REG3:
00b9 52 00 00 00 db $52, $00, $00, $00, $00, $00
00bd 00 00
;**** Add more VERB/NOUN storage to do more levels...
00bf VERB:
00bf 00 00 db $00, $00
00c1 NOUN:
00c1 00 00 db $00, $00
00c3 PROG0:
00c3 00 db $00
;
;************************************************************************
; DISPLAY PROCESS
;
;************************************************************************
;Description:
;This is the Simulation tasks for VIP_DSKY runs with these these two
;subroutines arebcalled to create and format the desired displays.
;
;1) AGC_PROC1= this subroutine simulates some AGC functions to give the
; display process somthing to display.
;2) VIP_DS = This subroutine simulates the DIS part of the DSKY on a
; COSMAC VIP Display.
;Registers Used:
;
; R(D) = Program Counter (calls the subroutines)
; R(C) = Program Counter (calls internal subroutines)
; R(3) = RETURN PC (DO NOT CHANGE in SUBR)
; R(E) = Key Found (Use with care)
;
;************************************************************************
00c4 DISPLAY:
00c4 f8 03 ldi HIGH AGC_PROC1 ;AGC PROCESS DEMO Sub Page
00c6 bd phi rd
00c7 f8 01 ldi LOW AGC_PROC1 ;AGC PROCESS DEMO Sub entry
00c9 ad plo rd
00ca dd sep rd ;call AGC DEMO PC = R(D) now
00cb f8 02 ldi LOW VIP_DS ;DSKY DISPLAY Sub Page
00cd ad plo rd
00ce f8 01 ldi HIGH VIP_DS ;DSKY DISPLAY Sub entry
00d0 bd phi rd
00d1 dd sep rd ;call DiS play! PC = R(D) now
00d2 30 22 br L0024 ; returns here -> continue!
;==============================================================
;======================== CONSTANTS ===========================
;==============================================================
;
;These are used for memory and display pointers
;
;********************************************
00d4 PROG_OFFSET:
00d4 a2 DB LOW PROG_REG+1 ;ACTY
00d5 a5 DB LOW PROG_REG+4 ;P1.D1
00d6 a6 DB LOW PROG_REG+5 ;P1.D0
00d7 NV_OFFSETS:
00d7 a7 DB LOW NOUN_VERB+0
00d8 a8 DB LOW NOUN_VERB+1
00d9 ab DB LOW NOUN_VERB+4
00da ac DB LOW NOUN_VERB+5
00db MET_OFFSETS:
00db b1 DB LOW REG1+4 ;10's HRs R1.D1
00dc b2 DB LOW REG1+5 ; 1's HRs R1.D0
00dd b7 DB LOW REG2+4 ;10's MINs R2.D1
00de b8 DB LOW REG2+5 ; 1's MINs R2.D0
00df bb DB LOW REG3+2 ;10's SECs R3.D3
00e0 bc DB LOW REG3+3 ; 1's SECs R3.D2
00e1 REG_LINE:
00e1 a1 DB LOW PROG_REG
00e2 a7 DB LOW NOUN_VERB
00e3 ad DB LOW REG1
00e4 b3 DB LOW REG2
00e5 b9 DB LOW REG3
;
;=========================================================================
;=============================PAGE 0100===================================
;=========================================================================
0100 org $0100
;************************************************************************
;DSKY Display Formatter for COSMAC VIP TV
;************************************************************************
0100 VIP_DS_RET:
0100 d3 sep r3
0101 00 db $00
0102 VIP_DS:
;************************************************************************
;
;Description: This is the DiSplay part of DSKY. Since COSMAC VIP uses
;the 1861 PIXIE display all the registers maintained by the COMMAND Process
;are translated into the video display. It is convenient due to paging to
;use one 256-byte page for this display. We can fit most of the standard
;DSKY in this space but the horizontal lines between the registers
;and the NOUN and VERB Lamps are not dispalyed. It is also possible to
;show the status lamps but this is not implemented in this version, all
;256 bytes are displayed for each update. The digits are translated by
;a format code that tells how the display appears:
;
;Use:
; N = 0 - 9 (Digits)
; 0N = Normal digit
; CN = Clear the cell (N is not shown on screen)
; FN = Flash the cell (alternate "N" -> " " based on Q State)
; 5N = Sign Looks kind of like an "S" 0101b (" ", "+", "-", " ", etc...)
; 50 = x0 (xx00b) = " " (OCTAL)
; 51 = x1 (xx01b) = "-" (DECIMAL NEG)
; 52 = x2 (xx10b) = "+" (DECIMAL POS)
; 53 = x3 (xx11b) = " " (OCTAL)
; DN = FLASHING SIGN? adds one bit to 5N indicate a flash state (1101b)
;
;The display formatter moves the digits from the OUTPUT_REG and puts them
;in speific locations on the VIDEO_BUF page. each line is placed as 7 digits
;picked up and stored from R->L pointed to by a column counter by DEC R(x).
;The adddress offsets are added and stored and the R(x) offset is the same
;for REG+R(x) -> VIDEO+R(x) buffer. The command nybble is masked off and this
;result switch tree determines how the 8 digit bit patterns are stored in the
;video buffer. Each digit in the OUTPUT_REG translates to 8 video lines in
;the video buffer.
;
;Registers Used:
; R(4) = VIDEO_BUFFER Display DESTINATION pointer
; R(5) = ROM Pattern & Table pointer
; R(6) = DSKY Registers SOURCE pointer
; R(7) = Character REG position and DSKY VIDEO COLUMN pointer
; R(8) = Character display pattern line pointer:
; R(A) = Temp Storage
; R(B) = Line Counter?
; R(C) = Column counter?
; R(D) = PC for this subroutine
;
;
;VIP MON ROM LOCATIONS USED Defines:
8100 index EQU 8100h ;Offset to patterns in ROM
8110 bitmap EQU 8110h ;Top of bit patterns in ROM "0"
;***********************************************************************************
0102 f8 81 ldi HIGH index ;Set ROM table's page (80xx)to convert patterns
0104 b5 phi r5 ;Display Pattern (get 5)
0105 f8 00 ldi HIGH REG_LINE ;point to RAM regigster page to get digits
0107 b7 phi r7 ;
0108 ba phi ra
0109 bc phi rc
010a f8 e1 ldi LOW REG_LINE ;First digit's offset
010c a7 plo r7 ;DIGIT NIBBLE POINTER (SOURCE)
010d f8 01 ldi HIGH VIDEO_LINE ;Point to video Page locations
010f b6 phi r6 ;
0110 f8 c6 ldi LOW VIDEO_LINE ;Point to first location
0112 a6 plo r6 ;
0113 f8 05 ldi HIGH DSKY_L1 ;INDEX point to RAM display page (0300) to store
0115 b4 phi r4 ; patterns for char PATTERN lines on the DSKY
0116 L0066:
0116 f8 06 ldi $06 ;Max Columns+1
0118 ab plo rb
0119 f8 00 ldi $00 ;clear MSBs too (MAY NOT BE NEEDED)
011b bb phi rb
011c b8 phi r8
011d 06 ldn r6 ;get the DSKY OFFSET
011e a4 plo r4 ;storage pointer
011f 07 ldn r7 ; Pick up pointer to digit from Source (REG)
0120 aa plo ra ; Pick up pointed digit from Source (REG)
0121 ac plo rc ; character index from sSource (REG)
0122 L0067:
0122 0a ldn ra ;load via R(A) but don't increment...
0123 aa plo ra ;SAVE IT in R(A) for processing
0124 30 50 br CONTCH ;Process Control Nibble
0126 DISPCH:
0126 fc 00 adi LOW index ;Point to the pattern in ROM was $A9 (xx00)+ N = Digit
0128 a5 plo r5 ;put it in R(5)
0129 05 ldn r5 ;Pick up the Nth byte of the Display RAM pattern from ROM table
012a a5 plo r5
012b f8 05 ldi $05 ;Do this for all 5 lines of the character bit pattern
012d a8 plo r8 ;Line count in R8.0
012e L0079:
012e 45 lda r5 ;get from ROM pattern
012f 54 str r4 ;Store on display page
0130 28 dec r8 ;next lines
0131 88 glo r8 ;Get next digit
0132 32 3a bz L0080 ;All bit patterns stored? YES- get next digit.
0134 84 glo r4 ;No keep storing patterns
0135 fc 08 adi $08 ;point to next TV line (this points to the byte directly below the last)
0137 a4 plo r4 ;on the TV screen
0138 30 2e br L0079 ; get next pattern
013a L0080:
013a 84 glo r4 ;get last displayed digit index
013b fb f6 xri LOW DSKY_R3+$26 ; all digits & lines?
013d 32 00 bz VIP_DS_RET ; yes --> get out of here!
013f 2b dec rb ; column counter
0140 8b glo rb
0141 3a 47 bnz NEXCOL ; all 5 digits on this line done?
0143 17 inc r7 ; yes-> index pointers to get next lines
0144 16 inc r6 ; (both REG & DSKY Lines)
0145 30 16 br L0066 ;back to outside loop to pick up new pointers
; no -> keep going on this line
; do some math on indexes to point to the next DSKY Column
; and...to get another digit
0147 NEXCOL:
0147 84 glo r4 ; move index R4 to point to next DSKY COLUMN
0148 fc e1 adi $E1 ; point to top of next display columnn was e1 (-31)
014a a4 plo r4
014b 1c inc rc ; next digit in REG (can just index as they are in order)
014c 8c glo rc ; REG digit index pointer ( may be redundant?)
014d aa plo ra
014e 30 22 br L0067 ; keep going on the inside loop
;***************************************************
; DISPLAY CONTROL CHAR PROCESSING
;***************************************************
;Assumes entry with byte to be displayed is in R(5)
;with the upper Nibble being the control bits
;and the lower the digit to display
;***************************************************
0150 CONTCH:
0150 8a glo ra ;get the found cont+digit
0151 fa f0 ani $f0 ;Mask the random digit
0153 a5 plo r5 ;save it in RB.0
0154 85 glo r5
0155 fb 00 xri $00 ;=none?
0157 32 6d bz FIXCH ;just show it...
0159 85 glo r5
015a fb c0 xri $C0 ;=Clear?
015c 32 77 bz CLRCH ;Clear this char
015e 85 glo r5
015f fb f0 xri $F0 ;=Flash?
0161 32 73 bz FLASH ;alternate this char
0163 85 glo r5
0164 fb 50 xri $50 ;=Sign?
0166 32 89 bz SIGN ;"+, -" or clear
0168 85 glo r5
0169 fb a0 xri $A0 ;"PROG INDIC"
016b 32 7e bz INDC_A ;flashing cursor
;************************NOT USED IN THIS VERSION***************************************
;also display indicators "$B0"
;are the indicator "bulbs"
;these may be 4 lines vs. 5 lines?
;locate on left hand displays
;$FE pattern
;[UPLINK] [NO ATT][KEY REL] [OPR ERR]
;[TEMP] [PROG] [ALT] [VEL]
;
; glo r5
; xri $B0 ;Status [Bulbs]
; bz INDC_B ;
;************************NOT USED IN THIS VERSION***************************************
;ELSE: just fall through here for un implemented or unknown
016d FIXCH:
016d 8a glo ra ;get the found cont+digit
016e fa 0f ani $0F ;Mask the random control code;
0170 aa plo ra
0171 30 26 br DISPCH ;just show it..
0173 FLASH:
0173 39 77 bnq CLRCH ; if Q is off clear it
0175 30 6d br FIXCH ; if Q is on just show it..
0177 CLRCH:
0177 f8 05 ldi $05 ;Do this for all 5 lines of the character bit pattern
0179 a8 plo r8 ;Line count in R8.0
017a f8 00 ldi $00 ;all lines off
; plo r5
017c 30 9e br WS000
;**************************************************************************
;NOTE: this section may be re written to use routine located at WS000
; enter with R5 = 0 for complete count - should work?
;**************************************************************************
;D0079:
; glo r5 ;get from ROM pattern
; str r4 ;Store on display page
; dec r8 ;next lines
; glo r8 ;Get next digit
; bz L0080 ;All bit patterns stored? YES- get next digit.
; glo r4 ;No keep storing patterns
; adi $08 ;point to next TV line (this points to the byte directly below the last)
; plo r4 ;on the TV screen
; br D0079 ; get next pattern
;**************************************************************************
017e INDC_A:
017e f8 05 ldi $05 ;Writes 5 lines of bit pattern
0180 a8 plo r8 ;Line count in R8.0
0181 f8 ff LDI $FF ;1st pattern
0183 39 9e bnq WS000 ; is Q ON?
0185 f8 00 LDI $00 ;YES then turn the 2nd pattern on
0187 30 9e br WS000
0189 SIGN:
0189 f8 05 ldi $05 ;Writes 5 lines of bit pattern
018b a8 plo r8 ;Line count in R8.0
018c 8a glo ra ;Get the digit
018d fb 51 xri $51 ;is it = "-" ?
018f 32 9c bz MINUS
0191 8a glo ra ;Get the digit
0192 fb 52 xri $52 ; is it = "+" ?
0194 32 98 bz PLUS ; Yes it is
0196 30 77 br CLRCH ; No anything else - Just clear it
0198 PLUS:
0198 f8 20 LDI $20 ;write center vert line [|]for "+"
019a 30 9e BR WS000
019c MINUS:
019c f8 00 LDI $00 ;CLEAR ALL for "-" or unknown
;****************NOTE: **************************
;Almost the same as DISPCH but puts fixed patterns
;at location R(4) on the screen vs. from a table...
;also the number of lines must be set
;****************NOTE: **************************
019e WS000: ;
019e a5 plo r5 ; fixed pattern is in R5.0
;
019f WS001:
019f 85 glo r5 ;max count is set above...
01a0 54 str r4 ;put fixed pattern on screen
01a1 84 glo r4 ;point to next TV line
01a2 fc 08 adi $08 ;this points to the byte directly below the last
01a4 a4 plo r4 ;on the TV screen
01a5 28 dec r8 ;next lines (5 lines high)
01a6 88 glo r8 ;All lines filled (or cleared)
01a7 32 ab bz WS002 ;Yes -> done with lines
01a9 30 9f br WS001 ;No -> next line
01ab WS002:
01ab 84 glo r4 ;fix pozition
01ac fc f8 adi $F8
01ae a4 plo r4
01af 8a glo ra ;Get the digit
01b0 fb 51 xri $51 ;is it = "-" ?
01b2 32 b9 bz WSBAR ;needs a bar
01b4 8a glo ra ;Get the digit
01b5 fb 52 xri $52 ; is it = "+" ?
01b7 3a 3a bnz L0080 ;no then just blank -> next digit
; for a sign always put a cross bar up two lines
01b9 WSBAR:
01b9 84 glo r4 ;point to last TV line
01ba fc f0 adi $F0 ;move to the 2 (3?) lines above the last (-24)Was E8
01bc a4 plo r4 ;line on the TV screen
01bd f8 f8 ldi $F8 ;[-] pattern
01bf 54 str r4 ;put it on screen
01c0 84 glo r4
01c1 fc 10 adi $10 ;Put the index back? was 18
01c3 a4 plo r4 ;yup.
01c4 30 3a br L0080 ;DONE! get next digit
;************************NOT USED IN THIS VERSION***************************************
;This is the table of locations we will pick up and store the digits for display on the
;TV screen They are defined in DSKY pattern and should not change. these are the locations
;for V35N16 in AGC running PROG00 - this will display all the regs
;************************NOT USED IN THIS VERSION***************************************
;VIDEO_OFFSET:
; DB LOW DSKY_L1+2 ; A.1 = 0202 (PROG ACTY)
; DB LOW DSKY_L1+5 ; P.1
; DB LOW DSKY_L1+6 ; P.0
; DB LOW DSKY_L2+2 ; VERB.1
; DB LOW DSKY_L2+3 ; VERB.0
; DB LOW DSKY_L2+5 ; NOUN.1
; DB LOW DSKY_L2+6 ; NOUN.0
; DB LOW DSKY_R1+5 ;10HR
; DB LOW DSKY_R1+6 ;01HR
; DB LOW DSKY_R2+5 ;10MIN
; DB LOW DSKY_R2+6 ;01MIN
; DB LOW DSKY_R3+3 ;10SEC
; DB LOW DSKY_R3+4 ;01SEC
;************************NOT USED IN THIS VERSION***************************************
01c6 VIDEO_LINE:
01c6 01 DB LOW DSKY_L1+1 ;+1 to skip first column
01c7 31 DB LOW DSKY_L2+1
01c8 71 DB LOW DSKY_R1+1
01c9 a1 DB LOW DSKY_R2+1
01ca d1 DB LOW DSKY_R3+1
;*********************************************************************************
; 1861 DISPLAY INTERRUPT
;*********************************************************************************
; Description:
; interrupt routine for 64x32 format (1 page display memory)
; Output 1: disable graphics, input 1: enable graphics, EF 1: in frame indicator
;
;Registers Used:
; R(0) = DMA pointer
; R(1) = IRQ vector pointer
; R(2) = STACK pointer
; R(9) = Counter (1/61 Sec)
;Hardware:
; EF1 = In-Frame indicator
;
;**********************************************************************************
01cb TV_INT_ret:
01cb 72 ldxa ;-> RETURN FROM INTERRUPT (restore pointer)
01cc 70 ret
;
01cd TV_INT: ;<-Entry on INT
01cd c4 nop ;Sync
01ce 22 dec r2 ;point to free location on stack
01cf 78 sav ;push T
01d0 22 dec r2
01d1 52 str r2 ;save D
01d2 e2 sex r2 ;Cycles for timing
01d3 e2 sex r2 ;Set D=line start address (6 cycles)
01d4 19 inc r9 ;increment at 1/61 sec count
01d5 f8 05 ldi HIGH DSKY_L1 ; Point to Page # of VIDEO DISP
01d7 b0 phi r0 ; display RAM
01d8 f8 00 ldi $00
01da a0 plo r0
01db L009A:
01db 80 glo r0 ;1861 displays a line 1st time (8 cycles)
01dc e2 sex r2 ;SYNC
01dd e2 sex r2 ;reset line start address (6 cycles)
01de 20 dec r0
;1861 displays line 2nd time (8 cycles)
01df a0 plo r0
01e0 e2 sex r2
01e1 20 dec r0
;1861 displays line 3rd time (8 cycles)
01e2 a0 plo r0
01e3 e2 sex r2 ;reset line start address (6 cycles)
01e4 20 dec r0 ;
01e5 a0 plo r0
01e6 3c db bn1 L009A ;Keep looping until EF1 = 1 (loops 32 times)
01e8 30 cb br TV_INT_ret ;Exit on top to restore pointer
;=========================================================================
;=============================PAGE 0200===================================
;=========================================================================
0200 org $0200
;************************************************************************
; VIP_KY
;************************************************************************
;Description: This is the KeY part of DSKY. Since COSMAC VIP only has 16
; keys, some are reused The secondary command keys (& Key) are contextual
; depending on what state the key command processor is in.
;
;Use: This computer use a series of commands in the format
; Vxx <Enter> Nxx <enter>
;
;EXAMPLES:
; "A", (V1V2 go blank) V1, V2,"C"(Clear: start over), V1, V2...
; "E" (Enter: Saves it)
; -> if a "D" is entered before "E" the original V1V2 will remain...
; -> if no NOUN is needed "E" will run the VERB command
; -> if a NOUN is needed N1N2 will flash until a "B" or "D" is entered ...
; "B", (N1N2 go blank) N1, N2..as before with VERBs "E" (Enter: Saves it)
; -> if the V+N is not known both will flash
; -> If P1 P2 flash indicates another prog needs the display (except idle?)
; "D" will release the display to that prog.
;
;************************************************************************
;****************************************************************
; COMMAND PROCESSING (PINBALL)
;****************************************************************
;PURPOSE:
;
;Test for the 6 non-numeric (HEX) keys:
;A = VERB
;B = NOUN
;C = REL/Clear
;D = PROCEED
;E = Enter
;F = +/-
;
;Enter: with found key in RE
;Exit: command
;REGISTERS USED:
;
; R(3) = Calling PC (Do not change!)
; R(4) = Mem Pointer (X)
; R(5) = Mem Pointer (Storage pointer)
; R(D) = prog counter
; R(E) = Character found by key
;****************************************************************
0200 CPRET:
0200 d3 sep r3
0201 CPROC:
0201 8e glo re
0202 fa 0f ani $0f ;Mask any control bits
0204 ae plo re ;save the key for test
0205 8e glo re
0206 fb 0a xri $0A ;A = VERB
0208 32 25 bz VERBS
020a 8e glo re
020b fb 0b xri $0B ;B = NOUN
020d 32 2d bz NOUNS
020f 8e glo re
0210 fb 0c xri $0C ;C = CLEAR or REL
0212 32 4f bz CONS
0214 8e glo re
0215 fb 0d xri $0D ;D = PROCEED
0217 32 5c bz PROS
0219 8e glo re
021a fb 0e xri $0E ;E = Enter
021c 32 83 bz ENTER
021e 8e glo re
021f fb 0f xri $0F ;F = +/-
0221 32 ab bz SIGNS
0223 30 cb br NOHEX ;(return)
; br CPRET
0225 VERBS:
0225 f8 00 ldi HIGH NOUN_VERB ;Get the pointer to Verb Reg
0227 b4 phi r4 ;to R(4.1)
0228 f8 a8 ldi LOW NOUN_VERB+1
022a a4 plo r4 ;to R(4.0)
022b 30 33 br NV001
022d NOUNS:
022d f8 00 ldi HIGH NOUN_VERB
022f b4 phi r4
0230 f8 ab ldi LOW NOUN_VERB+4
0232 a4 plo r4 ;to R(4.0)
0233 NV001:
0233 04 ldn r4 ;get first digit M[R(4)] -> D
0234 fa 0f ani $0f ;Mask any control bits
0236 fc c0 adi $C0 ;Set to flash (or clear)
0238 54 str r4
0239 14 inc r4 ;get next digit
023a 04 ldn r4
023b fa 0f ani $0f ;Mask any control bits
023d fc c0 adi $C0
023f 54 str r4
; this section was put in to stop flash on NN
; not needed *ONLY for test*
; ldi LOW NOUN_VERB+4 ; Point to Nouns;
; plo r4
; ldn r4 ;get N1.1
; ani $0F ;Clear any control bits
; str r4
; inc r4 ;...and N1.0
; ldn r4
; ani $0F
; str r4
;===========================================================
;CMD byte works like this:
;===========================================================
;(1) the hex DIGIT is the CMD to execure a command process.
; The command process follows this process so all HEX chars
; are filtered and only digits will be used.
;(2) As the command processed it takes needed digits
; and puts them in registers, pointed to by the base CMD
; it only puts chars in slots with control nibbles
; 0xFn, 0xCn etc. The new digit overwrites the control,
;if the slot has no control it skips to next reg.
;(3) CMD then gets cleared so no further processing takes
;place...i.e. digits with no where to go get ignored!
;===========================================================
0240 f8 00 ldi HIGH CMD ;put in CMD storage (PAGE 0)
0242 b5 phi r5 ;Index in R(4.1)
0243 f8 98 ldi LOW CMD ;put in CMD storage
0245 a5 plo r5 ;Index in R(4,0)
0246 8e glo re ;Verb or Noun Command
0247 55 str r5
;///NEW///
0248 f8 9a ldi LOW CCNT ;Make sure we are not storing digits
024a a5 plo r5
024b 95 ghi r5 ;should be 0
024c 55 str r5
;///NEW///
024d 30 00 br CPRET
;************************************************