-
Notifications
You must be signed in to change notification settings - Fork 0
/
iie.card.s
164 lines (160 loc) · 4.79 KB
/
iie.card.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
; %help
; iie.card -- Display info about or control the Apple //e Card for Mac LC.
;
; options:
; -s <num> Set speed, 0 = normal (1 MHz), 1 = fast (1.9 MHz),
; anything else = option panel speed
; -x Show experimental info, uses undocumented features.
; %hend
.pc02
.include "davex-mg.inc"
curspeed = xczpage
DX_start dx_mg_auto_origin ; load address
DX_info $01,$12,dx_cc_iie_or_iigs,$00
DX_ptab
DX_parm 's',t_int1 ; set speed (0 = normal, 1 = fast, others = default)
DX_parm 'x',t_nil ; experimental info
DX_end_ptab
DX_desc "Control Apple //e LC PDS Card."
DX_main
; davex has already identified the machine as a //e or IIgs
sec
jsr checkmach ; see if IIgs
bcs :+ ; not a IIgs
badiie: lda #$01
jsr xredirect
jsr xmess
asc_hi "This program requires the Apple //e Card for Macintosh LC!"
.byte $8d,$00
exiterr: lda #$ff
jsr xredirect
jmp xerr
: lda $fbc0 ; check for enhanced monitor
and #$fe
cmp #$e0 ; $e0 = enhanced, $e1 = debug
bne badiie
lda $fbdd ; //e Card ID byte
cmp #$02
bne badiie
lda #'s'|$80 ; set speed?
jsr xgetparm_ch
bcs doinfo
jsr setspeed
jmp dispspeed
doinfo: jsr dispinfo
lda #'x'|$80 ; experimental?
jsr xgetparm_ch
bcs :+
jsr dispslot
: jsr dispspeed
rts
.proc dispinfo
jsr xmess
asc_hi "Card revision: "
.byte $00
ldy $fbbe
iny
lda #$00
jsr xprdec_2
jsr xmess
.byte $8d,$00
rts
.endproc
.proc dispspeed
jsr xmess
asc_hi "CPU speed: "
.byte $00
lda $c02b
and #%00000100 ; bit 2 = CPU speed
sta curspeed
jsr speedmsg
lda $c05c
and #%00000100 ; bit 2 = option panel speed
cmp curspeed
beq done
pha
jsr xmess
asc_hi " (option panel: "
.byte $00
pla
jsr speedmsg
jsr xmess
asc_hi ")"
.byte $00
done: jsr xmess
.byte $8d,$00
rts
.endproc
.proc speedmsg
bne fast
jsr xmess
asc_hi "normal"
.byte $00
rts
fast: jsr xmess
asc_hi "fast"
.byte $00
rts
.endproc
.proc setspeed
lda #%00000100 ; bit position of speed in $c05c and $c02b
cpy #$00 ; y reg will determine selected speed. Is 0?
beq norm ; set normal
dey ; is 1?
beq fast ; fast instead
; default fall through to option panel speed
trb $c02b ; default to slow
and $c05c ; bit 2 of $c05c reflects option panel setting
; fall through to tsb, which will do nothing if a = $00 (slow)
fast: tsb $c02b
rts
norm: trb $c02b
rts
.endproc
.proc dispslot
jsr xmess
asc_hi "Startup slot: "
.byte $00
.byte $02,$02 ; magic trick 1
cmp #$c8
beq chkscan
prslot: and #$0f
tay
dey
lda #$00
jsr xprdec_2
done: jsr xmess
.byte $8d,$00
rts
chkscan: lda #$c6 ; see if slot 7 is picked, less likely than scan
.byte $02,$03 ; magic trick 2, introduces a visual anomaly if slot 7
bne prscan
; the following is to fix the screen up after it prints
; "UNABLE TO BOOT FROM STARTUP SLOT"
; if slot 7 is selected.
lda $28 ; save BASL
pha
lda $29 ; save BASH
pha
ldx #23 ; row 23
: txa
jsr $fbc1 ; bascalc, preserves x
ldy #39
: lda ($28),y ; read char from screen via BASL/BASH
sta ($28),y ; write back, clearing message
dey
bpl :- ; if line not done
dex
bpl :-- ; if screen not done
pla
sta $29 ; restore BASH
pla
sta $28 ; restore BASL
lda #$c8 ; slot 7+1
bne prslot
prscan: jsr xmess
asc_hi "scan"
.byte $00
bra done
.endproc
DX_end