]> Joshua Wise's Git repositories - fpgaboy.git/blame_incremental - fpgaboot.asm
fixed daa for no half carry, top carry, decimal carry on MSD, no decimal carry on LSD
[fpgaboy.git] / fpgaboot.asm
... / ...
CommitLineData
1 SECTION "boot", HOME[$0]
2boot: ld a, $AA
3 ld [$FF51], A ; Poke the LEDs
4
5 ld sp, $FFFE
6
7 ld hl, signon
8 call puts
9
10.wait: ld a, [$FF53]
11 and $02
12 jr z, .nodata
13 ld a, [$FF52]
14 ld [$FF51], a
15
16 cp $1B ; Escape
17 jp z, .cbc
18 ld [$FF52], a
19.cbc: call z, bootcmd
20
21.nodata: ld a, [$FF51]
22 cp $00
23 jr nz, .wait
24
25doboot: xor a
26 ld h, a
27 ld l, a
28 ld [hl], $01 ; Select the GB boot rom
29
30 ld a, $55
31 ld [c], a
32
33 ld hl, booting
34 call puts
35
36 rst $00 ; Boot
37
38signon:
39 db $0D,$0A,$1B,"[1mFPGABoy Boot ROM",$1B,"[0m",$0D,$0A,0
40booting:
41 db "Booting...",$0D,$0A,0
42
43putc:
44 ld c, $53
45 push af
46.waitport:
47 ld a,[c]
48 and $01
49 jr nz,.waitport
50 pop af
51 ld [$FF52],a
52 ret
53
54puts:
55 ld a, [hli]
56 cp $00
57 ret z
58 call putc
59 jr puts
60
61getc:
62 ld a, [$FF53]
63 and $02
64 jr z, getc
65 ld a, [$FF52]
66 ret
67
68bootcmd:
69 call getc
70 cp $56 ;V
71 jr z,.version
72 cp $41 ;A
73 jr z,.addr
74 cp $44 ;D
75 jr z,.data
76 cp $50 ;P
77 jr z,.prog
78 cp $42 ;B
79 jr z,doboot
80 cp $1B
81 jr z,bootcmd ; If you keep yelling, you're bound to get the thing's attention.
82 ld a, $3f ;?
83 jr putc
84.version:
85 ld hl, .verstr
86 jr puts
87.verstr:
88 db "V1.00",0
89.addr:
90 call getc
91 ld [$FF60], A
92 call getc
93 ld [$FF61], A
94 call getc
95 ld [$FF62], A
96 ld A, $41 ;A
97 jr putc
98.data:
99 call getc ; byte count
100 ld c, a
101.dl: dec c
102 jr z, .done
103 call getc
104 ld [$FF63], A
105 jr .dl
106.done: ld A, $44 ;D
107 jr putc
108
109.prog:
110 ld hl, $FF80
111 ld c, $7F
112.pl: dec c
113 jp z, .progboot
114 call getc
115 ld [hli], a
116 jr .pl
117.progboot:
118 ld a, $50 ;P
119 call putc
120 jp $FF80
121
122 SECTION "a", HOME[$100]
123 nop ; Make sure we don't overflow.
124
This page took 0.024948 seconds and 4 git commands to generate.