-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbooteater.asm
39 lines (31 loc) · 1.31 KB
/
booteater.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
; Banks for a bootloader program on the 6502 Ben Eater architecture
#include "cpu6502.asm"
#include "constants.asm"
; Banks
#bankdef zeropage { #addr 0x0000, #size 0x0100 }
#bankdef stack { #addr 0x0100, #size 0x0100 }
#bankdef ram { #addr 0x0200, #size 0x3e00 }
#bankdef uart { #addr 0x4000, #size 0x2000 }
#bankdef iomux { #addr 0x6000, #size 0x2000 }
#bankdef subprog { #addr 0x8000, #size 0x0ffa, #outp 8 * 0x0000 }
#bankdef subvecs { #addr 0x8ffa, #size 0x0006, #outp 8 * 0x0ffa }
#bankdef program { #addr 0xf000, #size 0x0ffa, #outp 8 * 0x7000 }
#bankdef vectors { #addr 0xfffa, #size 0x0006, #outp 8 * 0x7ffa }
#include "zeropage.asm"
#bank subprog
subprogram:
subprogram_reset: ; Dummy subprogram by default
jmp subprogram ; Loop forever
subprogram_nmi: ; NMI handler
subprogram_irq: ; IRQ handler
rti ; Return from interrupt
#bank subvecs
subprogram_nmi_vec: #d16 le(subprogram_nmi`16) ; Non-maskable interrupt entry point
subprogram_reset_vec: #d16 le(subprogram_reset`16) ; Reset entry point
subprogram_irq_vec: #d16 le(subprogram_irq`16) ; Maskable interrupt entry point
#bank program
bootprogram:
#bank vectors
#d16 le(nmi`16) ; Non-maskable interrupt entry point
#d16 le(reset`16) ; Reset entry point
#d16 le(irq`16) ; Maskable interrupt entry point