-
Notifications
You must be signed in to change notification settings - Fork 82
/
rs232nmifile
159 lines (159 loc) · 3.45 KB
/
rs232nmifile
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
.PAGE 'NMI HANDLER'
NMI SEI ;NO IRQ'S ALLOWED...
JMP (NMINV) ;...COULD MESS UP CASSETTES
NNMI PHA ;SAVE 6502 REGS
TXA
PHA
TYA
PHA
NNMI10 LDA D1IFR ;CHECK IF REAL NMI...
BPL NMIRTN ;...NO
;
AND D1IER ;SHOW ONLY ENABLES
TAX ;SAVE IN .X FOR LATTER
AND #$02 ;CHECK IF RESTORE KEY...
BEQ NNMI20 ;...NO
;
NNMI18 JSR A0INT ;CHECK IF $A0 IN...
BNE NNMI19 ;...NO
JMP ($A002) ;...YES
;
; CHECK FOR STOP KEY DOWN
;
NNMI19 BIT D1ORAH ;CLR CA1 FLAG
JSR UDTIM
JSR STOP
BNE NMIRTN ;NO STOP KEY
;
; TIMB - WHERE SYSTEM GOES ON A BRK INSTRUCTION
;
TIMB JSR RESTOR ;RESTORE SYSTEM INDIRECTS
JSR IOINIT ;RESTORE I/O FOR BASIC
JSR CINT ;RESTORE SCREEN FOR BASIC
JMP ($C002) ;...NO, SO BASIC WARM START
.SKI 2
; DISABLE NMI'S UNTILL READY
; SAVE ON STACK
;
NNMI20 LDA D1IER ;SAVE CURRENT ENABLES...
ORA #$80 ;SO WE CAN ENABLE ON RESTORE
PHA
LDA #$7F ;KILL THE REST
STA D1IER
;
;
; T1 NMI CHECK - TRANSMITT A BIT
;
TXA
AND #$40 ;CHECK FOR T1
BEQ NNMI30 ;NO...
;
LDA #$CE ;FIXED PCR HERE
; WILL TURN OFF YOUR CASS MOTOR!
ORA NXTBIT ;LOAD DATA AND...
STA D1PCR ;...SEND IT
;
LDA D1T1L ;KILL REQUEST
;
PLA ;RESTORE NMI'S
STA D1IER ;READY FOR NEXT...
;
JSR RSTRAB ;GO CALC INFO (CODE COULD BE IN LINE)
NMIRTN JMP NMIRTI
;
.SKI 2
; T2 NMI CHECK - RECIEVE A BIT
;
NNMI30 TXA
AND #$20 ;MASK TO T2
BEQ NNMI40 ;NO...
;
LDA D1ORB ;GET DATA IN
AND #01 ;MASK OFF...
STA INBIT ;...SAVE FOR LATTER
;
; UPDATE T2 FOR MID BIT CHECK
; (WORST CASE <255 US TO HERE)
;
LDA D1T2L ;CALC NEW TIME & CLR NMI
SBC #22 ;TIME FOR THIS LOOP
ADC BAUDOF
STA D1T2L
LDA D1T2H
ADC BAUDOF+1
STA D1T2H
;
;
PLA ;RESTORE NMI'S
STA D1IER
;
JSR RSRCVR ;GO SHIFT IN...
JMP NMIRTI
.SKI 2
; CB1 NMI HANDLER - RECIEVE A START BIT
;
NNMI40 TXA ;CHECK FOR EDGE
AND #$10 ;ON CB1...
BEQ NMIRTI ;NO...
;
; CHECK FOR NOISE ?
;
LDA M51CTR ;GET LENGTH TO CHECK FOR
AND #$0F
BNE NNMI42 ;USE TABLES
;
; GET BAUD RATE FROM ELSE WHERE ###NEED CODE###
;
NNMI42 ASL A ;GET DATA FROM BAUD TABLE
TAX
LDA BAUDO-2,X ;MOVE TO TIMER
STA D1T2L
LDA BAUDO-1,X
STA D1T2H
;
LDA D1ORB ;KILL CB1 EDGE NMI
PLA ;RESTORE NMI'S
ORA #$20 ;ENABLE T2 NMI
AND #$EF ;DISABLE EDGE ON CB1
STA D1IER
;
LDX BITNUM ;GET #OF BITS IN
STX BITCI ;PUT IN RCVRCNT
;
.SKI 2
NMIRTI ;RESTORE 6502 REGS
PREND PLA ;BECAUSE OF MISSING SCREEN EDITOR
TAY
PLA
TAX
PLA
RTI
.SKI 4
; BAUDO TABLE CONTAINS VALUES
; FOR 1.023E6/BAUD RATE/2
;
BAUDO .WOR 10230-CBIT ; 50 BAUD
.WOR 6820-CBIT ; 75 BAUD
.WOR 4650-CBIT ; 110 BAUD
.WOR 3800-CBIT ; 134.6 BAUD
.WOR 3410-CBIT ; 150 BAUD
.WOR 1705-CBIT ; 300 BAUD
.WOR 853-CBIT ; 600 BAUD
.WOR 426-CBIT ; 1200 BAUD
.WOR 284-CBIT ; 1800 BAUD
.WOR 213-CBIT ; 2400 BAUD
.WOR 142-CBIT ; 3600 BAUD
;
; CBIT - AN ADJUSTMENT TO MAKE NEXT T2 HIT NEAR CENTER
; OF THE NEXT BIT.
; APROX THE TIME TO SERVICE A CB1 NMI
CBIT = 100 ;US
.END
; RSR 8/2/80 - ROUTINE FOR PANIC
; RSR 8/8/80 - PANIC & STOP KEY
; RSR 8/12/80 - CHANGE FOR A0INT A SUBROUTINE
; RSR 8/19/80 - ADD RS-232 CHECKS
; RSR 8/21/80 - MODIFY RS-232
; RSR 8/29/80 - CHANGE PANIC ORDER FOR JACK
; RSR 8/30/80 - ADD T2
; RSR 9/22/80 - ADD 1800 BAUD OPPS!