]> Joshua Wise's Git repositories - fpgaboy.git/blob - rom.asm
0c25faba8bed2c5e703cf912f20a5781e64c65fd
[fpgaboy.git] / rom.asm
1         SECTION "a",HOME
2
3 main:
4         ld c, $51       ; Note that we are alive.
5         ld a, $FF
6         ld [c],a
7         
8         ld sp, $DFF0
9         
10         ld hl, $DF81
11         ld a, $80
12         ld [hl], a
13
14         ld c, $07
15         ld a, $04       ;start timer, 4.096KHz
16         ld [c], a
17 ;diqs:  ei
18 ;       ld a, $80
19 ;       ld c, $51
20 ;       ld [c], a
21 ;       jr diqs
22         call irqhand
23         ei
24 coqs: jr coqs
25
26         section "Diq", HOME[$38]
27 fuqed:
28         di
29         jr fuqed
30
31         section "fuq",HOME[$100]
32 irqhand:
33         PUSH AF
34         PUSH BC
35         PUSH DE
36         PUSH HL
37         
38         xor a
39         ld c, $0F       ; ack the irq
40         ld [c], a
41         
42         ld a, $41       ; print A
43         call putc
44         
45         ld hl, $DF81
46         ld a, [hl]
47         ld b, 1
48         add b
49         ld c, $51
50         ld [c], a
51         ld [hl], a
52
53
54         POP HL
55         POP DE
56         POP BC
57         POP AF
58         RETI
59         db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE
60         db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE
61         db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE
62
63 putc:
64         ld b, 0
65         ld c, $50
66         push af
67 .waitport:
68         ld a,[c]
69         cp b
70         jr nz,.waitport
71         pop af
72         ld [c],a
73         ret
This page took 0.023465 seconds and 2 git commands to generate.