-
Notifications
You must be signed in to change notification settings - Fork 0
/
hwinit.asm
133 lines (110 loc) · 1.41 KB
/
hwinit.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
;
; $Id: hwinit.asm,v 1.3 2013/01/19 00:23:03 mikey Exp $
;
fail brk
start
; init stack and clear decimal
cld
ldx #$ff
txs
; riot tests
lda #$3c
sta pactl
lda #$38
sta porta
lda porta
and #$3c
cmp #$38
bne fail
lda #$3d
sta pbctl
lda #$3d
sta portb
lda portb
and #$3d
cmp #$3d
bne fail
; fdc tests
fdc #forceirq
ldx #$15
dex
bne *-1
lda status_register
and #1
bne fail
lda #$55
sta track_register
sta sector_register
ldx #$1e
dex
bne *-1
eor track_register
bne fail
lda #$55
eor sector_register
bne fail
fdc #$48 ;step in, head load, steprate
ldx #$28
jsr delay1
lda status_register
and #1
beq fail
ldx #$28
jsr delay1
lda status_register
and #1
bne fail
; if lever is closed during power up -> run fallback code
lda status_register
bmi *+5
jmp fallback.main
; clear ram
lda #0
tax
?zozo sta $000,x
sta $100,x
sta $200,x
sta $300,x
sta $400,x
sta $500,x
inx
bne ?zozo
lda #0
sta turbo_flag
; lda #2
; sta rvalue
;
;?ccc lda rvalue
; sta rambank_select
;
; lda #0
; tax
;?cc ;lda rvalue
; sta $800,x
; sta $900,x
; sta $a00,x
; sta $b00,x
; sta $c00,x
; sta $d00,x
; sta $e00,x
; sta $f00,x
; inx
; bne ?cc
;
; inc rvalue
; lda rvalue
; cmp #16
; bne ?ccc
; init drive
ldx #3
stx phase
lda phase4
and portb
sta portb
jsr tmoton
lda #0
sta track
jsr bzium
; jsr single ; set initial config
jsr motor_off
jmp mainloop