-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbank_test.asm
138 lines (117 loc) · 1.99 KB
/
bank_test.asm
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
; bank_test.asm
;
start=$c000 ; machine language org
chrout=$ffd2
; "hires ml"
* = start
sei
jsr disp_header
jsr bank_norm
lda #$A0
sta $A000
lda #$C8
sta $C800
lda #$0E
sta $D800
lda #$E0
sta $E000
jsr bank_ram
lda #$D8
sta $D800
jsr bank_norm
lda #0
sta my_bank
- jsr disp_test
inc my_bank
lda #$07
bit my_bank
beq +
bne -
+ jsr bank_norm
cli
rts
bank_norm
lda $01
ora #$07
sta $01
rts
bank_ram
lda $01
and #$f8
sta $01
rts
bank_select
lda $01
and #$f8
ora my_bank
sta $01
rts
disp_test
lda #' '
jsr chrout
lda my_bank
jsr disp_hex
lda #$00
ldx #$A0
jsr disp_banked
lda #$00
ldx #$C8
jsr disp_banked
lda #$00
ldx #$D8
jsr disp_banked
lda #$00
ldx #$E0
jsr disp_banked
lda #13
jsr chrout
rts
disp_banked
sta $FB
stx $FC
lda #' '
jsr chrout
jsr chrout
jsr chrout
ldy #0
jsr bank_select
lda ($FB),Y
pha
jsr bank_norm
pla
jsr disp_hex
rts
disp_hex
pha
lsr
lsr
lsr
lsr
jsr disp_digit
pla
and #$0f
; fall thru disp_digit
disp_digit
cmp #16
bcs ++
cmp #10
bcs +
adc #'0'
jmp chrout
+ sbc #$0A
adc #$40
jmp chrout
++ rts
disp_header
ldy #0
- lda header,y
beq +
jsr chrout
iny
bne -
+ rts
header
!text "BANK A000 C800 D800 E000"
!byte 13 ; carriage return
!byte 0 ; end of string
my_bank !byte 0