mirror of
https://github.com/KarolS/millfork.git
synced 2024-12-23 23:30:22 +00:00
62 lines
840 B
Plaintext
62 lines
840 B
Plaintext
#if not(NES)
|
|
#warn nes_routines module should be only used on NES/Famicom targets
|
|
#endif
|
|
|
|
|
|
asm void on_reset() {
|
|
SEI
|
|
CLD
|
|
LDX #$40
|
|
STX $4017
|
|
LDX #$ff
|
|
TXS
|
|
INX
|
|
STX ppu_ctrl
|
|
STX ppu_mask
|
|
STX $4010
|
|
BIT ppu_status
|
|
vwait1:
|
|
BIT ppu_status
|
|
BPL vwait1
|
|
vwait2:
|
|
BIT ppu_status
|
|
BPL vwait2
|
|
|
|
|
|
LDA #$00
|
|
LDX #$00
|
|
clean_byte:
|
|
STA $000,x
|
|
STA $100,x
|
|
STA $200,x
|
|
STA $300,x
|
|
STA $400,x
|
|
STA $500,x
|
|
STA $600,x
|
|
STA $700,x
|
|
INX
|
|
BNE clean_byte
|
|
|
|
LDA #$00
|
|
STA $2000
|
|
STA $2001
|
|
|
|
JMP main
|
|
JMP on_reset
|
|
}
|
|
|
|
interrupt void on_irq() {
|
|
irq()
|
|
}
|
|
|
|
interrupt void on_nmi() {
|
|
nmi()
|
|
}
|
|
|
|
const array nmi_vector @$FFFA = @word [on_nmi.addr]
|
|
|
|
const array reset_vector @$FFFC = @word [on_reset.addr]
|
|
|
|
const array irq_vector @$FFFE = @word [on_irq.addr]
|
|
|