forked from EtchedPixels/Virtual65
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.s
More file actions
95 lines (84 loc) · 1.12 KB
/
bootstrap.s
File metadata and controls
95 lines (84 loc) · 1.12 KB
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
;
; FIXME: load from the end of the disk not the start.
;
.segment "BOOT"
ptr1 = $FE
; At 0xFC00
sei
lda #<hello
ldx #>hello
jsr print
lda #0
tay
sta ptr1
sta $FE30 ; disk 0
lda #$FF
sta $FE31 ; block high
lda #$80 ; block low (last 64K of our 32MB disk)
sta $FE32
lda #1
sta $FE33
ldx #$FA ; going to load 0200 to FBFF (64000 bytes)
lda #$02
sta ptr1+1 ; at 0x0200-0xFBFF
diskload_2:
lda $FE35
cmp #0
bne diskfault
diskload_1:
lda $FE34
sta (ptr1),Y
iny
bne diskload_1
lda #'*'
sta $FE20
inc ptr1+1
dex
bne diskload_2
lda #13
sta $FE20
lda #10
sta $FE20
lda $2000
cmp #65
bne badcode
lda $2001
cmp #02
bne badcode
lda #<booting
ldx #>booting
jmp $2002
print:
sta ptr1
stx ptr1+1
ldy #0
print_loop:
lda (ptr1),y
cmp #0
beq printed
sta $FE20
iny
jmp print_loop
printed:lda #13
sta $FE20
lda #10
sta $FE20
rts
diskfault:
lda #<disk
ldx #>disk
jsr print
spin: jmp spin
badcode:
lda #<bad
ldx #>bad
jsr print
jmp spin
hello:
.byte "Disk Loader 0.1",13,10,"Loading...",0
booting:
.byte "Booting...",0
bad:
.byte "No loadable image found.",0
disk:
.byte "Disk error.",0