-
Notifications
You must be signed in to change notification settings - Fork 0
/
vt100.S
177 lines (147 loc) · 1.72 KB
/
vt100.S
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
vt100
mx %11
and #$7f
cmp #' '
bcs :notctrl
asl
tax
jmp (ctrl,x)
:notctrl
ldx state
jmp (:state_table,x)
:state_table
ext vt52_esc,vt52_dca
ext vt100_esc,vt100_csi,vt100_csi_2
ext vt100_esc_pound,vt100_esc_lparen,vt100_esc_rparen
dw char
dw vt52_esc
dw vt52_dca
dw char
dw vt100_esc
dw vt100_csi
dw vt100_csi_2
dw vt100_esc_pound
dw vt100_esc_lparen
dw vt100_esc_rparen
vt100_csi_bad ent
cmp #'@'
blt :rts
ldx #st_vt100
stx state
:rts rts
esc_csi
stz pcount
stz params
stz params+1
stz csi_private
lda #st_csi
sta state
rts
csi
inc state
inc state
cmp #'?'
bne csi0
lda #$80
sta csi_private
rts
csi0
cmp #';'
beq :semi
cmp #'0'
bcc csi_final
cmp #'9'+1
bcs csi_final
:num
and #$0f ; 0-9
tay ; save
ldx pcount
lda params,x
asl ; x 2
sta params,x
asl ; x 4
asl ; x 8
clc
adc params,x
sta params,x
tya
clc
adc params,x
sta params,x
rts
:semi
ldx pcount
inx
cpx #MAX_PCOUNT
bcs :srts
stx pcount
stz params,x
:srts
rts
csi_final
* c, h, l have private modes.
bit csi_private
bmi :priv
cmp #:MIN_FINAL
bcc :rts
cmp #:MAX_FINAL+1
bcs :rts
asl
tax
jmp (:table,x)
:rts rts
:priv
cmp #:MIN_FINAL_PRIV
bcc :rts
cmp #:MAX_FINAL_PRIV+1
bcs :rts
asl
tax
jmp (:table_priv,x)
csi
*
* ESC [ encountered.
*
* ? -> DEC private
* 0-9 -> parameter value
* ; parameter delim
* other - final character.
cmp #'0'
blt :notnum
cmp #'9'+1
bge :notnum
sep #$30
and #$0f
tay
ldx pcount
lda parms,x
asl
pha
asl
asl
clc
adc 1,s
sta 1,s
tya
adc 1,s
ply
sta parms,x
sep #$30
]rts rts
:notnum
cmp #';'
bne :notsemi
ldx pcount
cpx #MAXPCOUNT
bge ]rts
inx
stx pcount
stz parms,
stz parms+1,x
]rts rts
:notsemi
cmp #'?'
bne :final
sta ptype
rts
:final