mirror of
https://github.com/KarolS/millfork.git
synced 2024-08-18 17:29:21 +00:00
87 lines
1.5 KiB
Plaintext
87 lines
1.5 KiB
Plaintext
byte ppu_ctrl @$2000
|
|
byte ppu_mask @$2001
|
|
byte ppu_status @$2002
|
|
byte oam_addr @$2003
|
|
byte oam_data @$2004
|
|
byte ppu_scroll @$2005
|
|
byte ppu_addr @$2006
|
|
byte ppu_data @$2007
|
|
byte oam_dma @$4014
|
|
|
|
// TODO: better names
|
|
|
|
byte apu_pulse1_ctrl @$4000
|
|
byte apu_pulse1_sweep @$4001
|
|
word apu_pulse1_period @$4002
|
|
|
|
byte apu_pulse2_ctrl @$4004
|
|
byte apu_pulse2_sweep @$4005
|
|
word apu_pulse2_period @$4006
|
|
|
|
byte apu_triangle_unmute @$4008
|
|
word apu_triangle_period @$400A
|
|
|
|
byte apu_noise_ctrl @$400C
|
|
byte apu_noise_period @$400E
|
|
|
|
byte apu_dmc_ctrl @$4010
|
|
byte apu_dmc_load @$4011
|
|
byte apu_dmc_sample_addr @$4012
|
|
byte apu_dmc_sample_length @$4013
|
|
|
|
byte apu_status @$4015
|
|
byte apu_frame_counter @$4017
|
|
|
|
byte joypad1_ctrl @$4016
|
|
byte joypad2_ctrl @$4017
|
|
|
|
inline asm byte strobe_joypad() {
|
|
? LDA #1
|
|
STA joypad1_ctrl
|
|
LSR
|
|
STA joypad1_ctrl
|
|
? RTS
|
|
}
|
|
|
|
inline asm byte read_joypad1() {
|
|
LDA joypad1_ctrl
|
|
? RTS
|
|
}
|
|
|
|
inline asm byte read_joypad2() {
|
|
LDA joypad2_ctrl
|
|
? RTS
|
|
}
|
|
|
|
macro asm void simulate_reset() {
|
|
JMP (reset_vector.addr)
|
|
}
|
|
|
|
inline asm void ppu_set_addr(word ax) {
|
|
STX ppu_addr
|
|
STA ppu_addr
|
|
?RTS
|
|
}
|
|
|
|
inline asm byte read_ppu_status() {
|
|
LDA ppu_status
|
|
? RTS
|
|
}
|
|
|
|
inline asm void ppu_set_scroll(word a, word x) {
|
|
STA ppu_scroll
|
|
STX ppu_scroll
|
|
?RTS
|
|
}
|
|
|
|
inline asm void ppu_write_data(byte a) {
|
|
STA ppu_data
|
|
?RTS
|
|
}
|
|
|
|
inline asm void ppu_oam_dma_write(byte a) {
|
|
STA oam_dma
|
|
?RTS
|
|
}
|
|
|