repo_id
string
size
int64
file_path
string
content
string
xem/nes
3,732
nes-test-roms/oam_stress/source/common/console.s
; Scrolling text console with line wrapping, 30x29 characters. ; Buffers lines for speed. Will work even if PPU doesn't ; support scrolling (until text reaches bottom). Keeps border ; along bottom in case TV cuts it off. ; ; Defers most initialization until first newline, at which ; point it clears nametable and makes ...
xem/nes
2,344
nes-test-roms/oam_stress/source/common/build_nsf.s
; Builds program as NSF music file .ifndef NSF_SONG_COUNT NSF_SONG_COUNT = 1 .endif .ifndef CUSTOM_NSF_HEADER .segment "HEADER" .byte "NESM",26,1 .byte NSF_SONG_COUNT .byte 1 ; start with first song .word load_addr,reset,nsf_play .endif .segment "CODE" load_addr: .ifndef CUSTOM_NSF_VECTORS .segment "VEC...
xem/nes
1,096
nes-test-roms/oam_stress/source/common/text_out.s
; Text output as expanding zero-terminated string at text_out_base ; The final exit result byte is written here final_result = $6000 ; Text output is written here as an expanding ; zero-terminated string text_out_base = $6004 bss_res text_out_temp zp_res text_out_addr,2 init_text_out: ldx #0 ; Put valid data fi...
xem/nes
1,824
nes-test-roms/oam_stress/source/common/ppu.s
; PPU utilities bss_res ppu_not_present ; Sets PPUADDR to w ; Preserved: X, Y .macro set_ppuaddr w bit PPUSTATUS setb PPUADDR,>w setb PPUADDR,<w .endmacro ; Delays by no more than n scanlines .macro delay_scanlines n .if CLOCK_RATE <> 1789773 .error "Currently only supports NTSC" .endif delay ((n)*341)/3 .e...
xem/nes
4,636
nes-test-roms/oam_stress/source/common/shell.s
; Common routines and runtime ; Detect inclusion loops (otherwise ca65 goes crazy) .ifdef SHELL_INCLUDED .error "shell.s included twice" .end .endif SHELL_INCLUDED = 1 ;**** Special globals **** ; Temporary variables that ANY routine might modify, so ; only use them between routine calls. temp = <$A temp2 = <$B...
xem/nes
3,437
nes-test-roms/oam_stress/source/common/delay.s
; Delays in CPU clocks, milliseconds, etc. All routines are re-entrant ; (no global data). No routines touch X or Y during execution. ; Code generated by macros is relocatable; it contains no JMPs to itself. zp_byte delay_temp_ ; only written to ; Delays n clocks, from 2 to 16777215 ; Preserved: A, X, Y, flags .macro...
xem/nes
1,632
nes-test-roms/oam_stress/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: A, X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum modul...
xem/nes
7,782
nes-test-roms/instr_timing/source/1-instr_timing.s
; Tests instruction timing for all except the 8 branches and 12 halts ; ; Times each instruction by putting it in a loop that counts iterations ; and waits for APU length counter to expire. CUSTOM_IRQ=1 .include "shell.inc" zp_byte nothing_failed zp_byte test_index zp_byte type_mask zp_byte saved_sp stack_copy = $600...
xem/nes
2,427
nes-test-roms/instr_timing/source/2-branch_timing.s
; Verifies timing of branch instructions ; ; Runs branch instruction in loop that counts iterations ; until APU length counter expires. Moves the loop around ; in memory to trigger page cross/no cross cases. .include "shell.inc" zp_byte opcode zp_byte flags zp_byte time_ptr bss_res times,8 main: set_test 0 for_loo...
xem/nes
1,856
nes-test-roms/instr_timing/source/common/testing.s
; Utilities for writing test ROMs ; In NVRAM so these can be used before initializing runtime, ; then runtime initialized without clearing them nv_res test_code ; code of current test nv_res test_name,2 ; address of name of current test, or 0 of none ; Sets current test code and optional name. Also resets ; checksum...
xem/nes
2,660
nes-test-roms/instr_timing/source/common/print.s
; Prints values in various ways to output, ; including numbers and strings. newline = 10 zp_byte print_temp_ ; Prints indicated register to console as two hex ; chars and space ; Preserved: A, X, Y, flags print_a: php pha print_reg_: jsr print_hex lda #' ' jsr print_char_ pla plp rts print_x: php pha txa...
xem/nes
1,506
nes-test-roms/instr_timing/source/common/build_rom.s
; Builds program as iNES ROM ; Default is 32K PRG and 8K CHR ROM, NROM (0) .if 0 ; Options to set before .include "shell.inc": CHR_RAM=1 ; Use CHR-RAM instead of CHR-ROM CART_WRAM=1 ; Use mapper that supports 8K WRAM in cart CUSTOM_MAPPER=n ; Specify mapper number .endif .ifndef CUSTOM_MAPPER .ifdef CART_...
xem/nes
5,523
nes-test-roms/instr_timing/source/common/console.s
; Scrolling text console with line wrapping, 30x29 characters. ; Buffers lines for speed. Will work even if PPU doesn't ; support scrolling (until text reaches bottom). Keeps border ; along bottom in case TV cuts it off. ; ; Defers most initialization until first newline, at which ; point it clears nametable and makes ...
xem/nes
1,096
nes-test-roms/instr_timing/source/common/text_out.s
; Text output as expanding zero-terminated string at text_out_base ; The final exit result byte is written here final_result = $6000 ; Text output is written here as an expanding ; zero-terminated string text_out_base = $6004 bss_res text_out_temp zp_res text_out_addr,2 init_text_out: ldx #0 ; Put valid data fi...
xem/nes
2,024
nes-test-roms/instr_timing/source/common/ppu.s
; PPU utilities bss_res ppu_not_present ; Sets PPUADDR to w ; Preserved: X, Y .macro set_ppuaddr w bit PPUSTATUS setb PPUADDR,>w setb PPUADDR,<w .endmacro ; Delays by no more than n scanlines .macro delay_scanlines n .if CLOCK_RATE <> 1789773 .error "Currently only supports NTSC" .endif delay ((n)*341)/3 .e...
xem/nes
5,433
nes-test-roms/instr_timing/source/common/shell.s
; Common routines and runtime ; Detect inclusion loops (otherwise ca65 goes crazy) .ifdef SHELL_INCLUDED .error "shell.s included twice" .end .endif SHELL_INCLUDED = 1 ; Temporary variables that ANY routine might modify, so ; only use them between routine calls. temp = <$A temp2 = <$B temp3 = <$C addr = <$E p...
xem/nes
3,437
nes-test-roms/instr_timing/source/common/delay.s
; Delays in CPU clocks, milliseconds, etc. All routines are re-entrant ; (no global data). No routines touch X or Y during execution. ; Code generated by macros is relocatable; it contains no JMPs to itself. zp_byte delay_temp_ ; only written to ; Delays n clocks, from 2 to 16777215 ; Preserved: A, X, Y, flags .macro...
xem/nes
1,632
nes-test-roms/instr_timing/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: A, X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum modul...
xem/nes
1,178
nes-test-roms/cpu_reset/source/registers.s
; At power, A,X,Y=0 P=$34 S=$FD ; At reset, I flag set, S decreased by 3, no other change CUSTOM_RESET=1 .include "shell.inc" .include "run_at_reset.s" nv_res log,8 reset: ; Save current registers and stack php sta log+0 stx log+1 sty log+2 pla sta log+3 tsx stx log+4 lda $112 sta log+5 lda $111 sta log...
xem/nes
1,856
nes-test-roms/cpu_reset/source/common/testing.s
; Utilities for writing test ROMs ; In NVRAM so these can be used before initializing runtime, ; then runtime initialized without clearing them nv_res test_code ; code of current test nv_res test_name,2 ; address of name of current test, or 0 of none ; Sets current test code and optional name. Also resets ; checksum...
xem/nes
2,660
nes-test-roms/cpu_reset/source/common/print.s
; Prints values in various ways to output, ; including numbers and strings. newline = 10 zp_byte print_temp_ ; Prints indicated register to console as two hex ; chars and space ; Preserved: A, X, Y, flags print_a: php pha print_reg_: jsr print_hex lda #' ' jsr print_char_ pla plp rts print_x: php pha txa...
xem/nes
1,506
nes-test-roms/cpu_reset/source/common/build_rom.s
; Builds program as iNES ROM ; Default is 32K PRG and 8K CHR ROM, NROM (0) .if 0 ; Options to set before .include "shell.inc": CHR_RAM=1 ; Use CHR-RAM instead of CHR-ROM CART_WRAM=1 ; Use mapper that supports 8K WRAM in cart CUSTOM_MAPPER=n ; Specify mapper number .endif .ifndef CUSTOM_MAPPER .ifdef CART_...
xem/nes
1,225
nes-test-roms/cpu_reset/source/common/run_at_reset.s
; Keeps track of number of times reset, and prompts user. power_flag_value = $42 nv_res power_flag_ nv_res num_resets_ ; Out: A = number of times NES has been reset since turned on ; Preserved: X, Y num_resets: lda power_flag_ cmp #power_flag_value bne :+ lda num_resets_ rts : lda #0 rts ; Prompts user...
xem/nes
5,523
nes-test-roms/cpu_reset/source/common/console.s
; Scrolling text console with line wrapping, 30x29 characters. ; Buffers lines for speed. Will work even if PPU doesn't ; support scrolling (until text reaches bottom). Keeps border ; along bottom in case TV cuts it off. ; ; Defers most initialization until first newline, at which ; point it clears nametable and makes ...
xem/nes
1,096
nes-test-roms/cpu_reset/source/common/text_out.s
; Text output as expanding zero-terminated string at text_out_base ; The final exit result byte is written here final_result = $6000 ; Text output is written here as an expanding ; zero-terminated string text_out_base = $6004 bss_res text_out_temp zp_res text_out_addr,2 init_text_out: ldx #0 ; Put valid data fi...
xem/nes
2,024
nes-test-roms/cpu_reset/source/common/ppu.s
; PPU utilities bss_res ppu_not_present ; Sets PPUADDR to w ; Preserved: X, Y .macro set_ppuaddr w bit PPUSTATUS setb PPUADDR,>w setb PPUADDR,<w .endmacro ; Delays by no more than n scanlines .macro delay_scanlines n .if CLOCK_RATE <> 1789773 .error "Currently only supports NTSC" .endif delay ((n)*341)/3 .e...
xem/nes
5,433
nes-test-roms/cpu_reset/source/common/shell.s
; Common routines and runtime ; Detect inclusion loops (otherwise ca65 goes crazy) .ifdef SHELL_INCLUDED .error "shell.s included twice" .end .endif SHELL_INCLUDED = 1 ; Temporary variables that ANY routine might modify, so ; only use them between routine calls. temp = <$A temp2 = <$B temp3 = <$C addr = <$E p...
xem/nes
3,437
nes-test-roms/cpu_reset/source/common/delay.s
; Delays in CPU clocks, milliseconds, etc. All routines are re-entrant ; (no global data). No routines touch X or Y during execution. ; Code generated by macros is relocatable; it contains no JMPs to itself. zp_byte delay_temp_ ; only written to ; Delays n clocks, from 2 to 16777215 ; Preserved: A, X, Y, flags .macro...
xem/nes
1,632
nes-test-roms/cpu_reset/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: A, X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum modul...
xem/nes
2,428
nes-test-roms/cpu_dummy_reads/source/cpu_dummy_reads.s
; Tests instructions that do dummy reads before the real read/write ; Tests LDA and STA with modes (ZP,X), (ZP),Y and ABS,X ; Dummy reads are made for the following cases: ; LDA ABS,X or (ZP),Y when carry is generated from low byte ; STA ABS,X or (ZP),Y .include "shell.inc" .macro set_addr n lda #<n sta addr lda #...
xem/nes
2,223
nes-test-roms/cpu_dummy_reads/source/common/testing.s
; Utilities for writing test ROMs zp_res test_code,1 ; code of current test zp_res test_name,2 ; address of name of current test, or 0 of none ; Reports that all tests passed tests_passed: .if !BUILD_MULTI jsr print_filename print_str "Passed" .endif lda #0 jmp exit ; Reports that the current test failed. Pr...
xem/nes
2,326
nes-test-roms/cpu_dummy_reads/source/common/print.s
; Prints values in various ways to output, including numbers and strings. newline = 10 ; Prints indicated register to console as two hex chars and space ; Preserved: A, X, Y, P print_a: php pha print_reg_: jsr print_hex lda #' ' jsr print_char_ pla plp rts print_x: php pha txa jmp print_reg_ print_y: p...
xem/nes
3,161
nes-test-roms/cpu_dummy_reads/source/common/console.s
; Scrolling text console with line wrapping, 30x30 characters. ; Buffers lines for speed. Will work even if PPU doesn't ; support scrolling (until text reaches bottom). ; ** ASCII font must already be in CHR, and mirroring ; must be vertical or single-screen. ; Number of characters of margin on left and right, to avoi...
xem/nes
2,505
nes-test-roms/cpu_dummy_reads/source/common/delay.s
; Delays in clocks and milliseconds. All routines re-entrant ; (no global data). ; Delays n milliseconds (1/1000 second) ; n can range from 0 to 1100. ; Preserved: X, Y .macro delay_msec n .if (n) < 0 .or (n) > 1100 .error "time out of range" .endif delay ((n)*CLOCK_RATE+500)/1000 .endmacro ; Delays n m...
xem/nes
1,260
nes-test-roms/cpu_dummy_reads/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum module. ...
xem/nes
1,049
nes-test-roms/nes15-1.0.0/snd/snd.s
; ; File: snd.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Music and sound effects data ; .include "muse.inc" .segment "CODE" ; Register envelopes muse_envs_lo: .byte <env0 .byte <env1 .byte <env2 .byte <env3 .byte <env4 muse_envs_hi: .byte >env0 .byte >env1...
xem/nes
12,336
nes-test-roms/nes15-1.0.0/snd/mus0.s
; ; File: mus0.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Prelude from BWV 558 by J.S. Bach (possibly by J. T. Krebs), preceded by the ; new puzzle SFX ; .include "muse.inc" .include "snd.inc" muse_create_tempo TEMPO, 95 .segment "CODE" .export snd_mus0 .proc s...
xem/nes
1,091
nes-test-roms/nes15-1.0.0/snd/mus1.s
; ; File: mus1.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Puzzle solved music ; .include "muse.inc" .include "snd.inc" muse_create_tempo TEMPO, 95 .segment "CODE" .export snd_mus1 .proc snd_mus1 .byte 0 .byte MUSE_MUS0 .addr stream0 .byte MUSE_MUS1 .addr ...
xem/nes
1,034
nes-test-roms/nes15-1.0.0/nes-lib/vrub_from_mem.s
; ; File: vrub_from_mem.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; 'vrub_from_mem' subroutine ; .include "vrub.inc" .segment "ZEROPAGE" vrub_src: .res 2 .segment "VRUBLIB" .proc vrub_from_mem sta vrub_src sty vrub_src + 1 update_loop: ldy #0 lda (vrub_s...
xem/nes
18,564
nes-test-roms/nes15-1.0.0/nes-lib/muse.s
; ; File: muse.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; MUSE sound engine subroutines and data ; .include "apu.inc" .include "muse.inc" .segment "ZEROPAGE" ; Temporary storage used by 'muse_play' temp: .res 3 ; Temporary storage used by 'muse_update'. Note ...
xem/nes
18,662
nes-test-roms/nes15-1.0.0/fifteen/fifteen.s
; ; File: fifteen.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Fifteen puzzle subroutines and data ; ; The solver used is based on documentation and source code by 'Karl Hornell' ; found at: ; http://www.javaonthebrain.com/java/puzz15/ ; .include "lfsr32.inc" .include "...
xem/nes
1,159
nes-test-roms/nes15-1.0.0/fifteen/test.s
; ; File: test.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Test program for the fifteen puzzle library ; .include "lfsr32.inc" .include "fifteen.inc" NUM_TESTS = 10000 .segment "ZEROPAGE" failed: .res 1 count: .res 2 .segment "CODE" ; ; Reset routine used t...
xem/nes
9,458
nes-test-roms/nes15-1.0.0/src/play.s
; ; File: play.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Playing game state subroutines and data ; .include "joy.inc" .include "muse.inc" .include "pkb.inc" .include "ppu.inc" .include "fifteen.inc" .include "game.inc" .include "gfx.inc" .include "nmi.inc" .include "...
xem/nes
1,137
nes-test-roms/nes15-1.0.0/src/title.s
; ; File: title.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Title screen state subroutines and data ; .include "joy.inc" .include "lfsr32.inc" .include "pkb.inc" .include "ppu.inc" .include "game.inc" .include "nmi.inc" .include "title.inc" .segment "CODE" .proc t...
xem/nes
10,404
nes-test-roms/nes15-1.0.0/src/gfx.s
; ; File: gfx.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Graphics subroutines and data ; .include "bcd.inc" .include "oam.inc" .include "ppu.inc" .include "vrub.inc" .include "fifteen.inc" .include "game.inc" .include "gfx.inc" ; Puzzle tile's dimensions in patter...
xem/nes
2,203
nes-test-roms/nes15-1.0.0/src/game.s
; ; File: game.s ; Copyright (c) 2011 Mathew Brenaman (see 'LICENSE' for details) ; Assembled with ca65 ; ; Main game subroutines and data ; .include "apu.inc" .include "joy.inc" .include "muse.inc" .include "oam.inc" .include "ppu.inc" .include "vrub.inc" .include "fifteen.inc" .include "gfx.inc" .include "nmi.inc" ...
xem/nes
1,654
nes-test-roms/mmc3_test/source/1-clocking.s
.include "test_mmc3.inc" main: jsr begin_mmc3_tests set_test 2,"Counter/IRQ/A12 clocking isn't working at all" ldx #10 jsr begin_counter_test jsr clock_counter jsr clock_counter jsr should_be_clear set_test 3,"Should decrement when A12 is toggled via PPUADDR" ldx #2 jsr begin_counter_test ldx #9 jsr cl...
xem/nes
1,745
nes-test-roms/mmc3_test/source/2-details.s
; Tests MMC3 IRQ counter details .include "test_mmc3.inc" main: jsr begin_mmc3_tests set_test 2,"Counter isn't working when reloaded with 255" ldx #255 jsr begin_counter_test ldx #255 jsr clock_counter_x jsr should_be_clear jsr clock_counter jsr should_be_set set_test 3,"Counter should run even when IR...
xem/nes
2,470
nes-test-roms/mmc3_test/source/4-scanline_timing.s
; Tests MMC3 IRQ timing to PPU clock accuracy. Tests both modes, ; $2000=$08 and $2000=$10. ; ; Timing tested is between $2002 reads of VBL flag first set, ; and IRQ occurring. .include "test_mmc3.inc" .include "sync_vbl.s" .macro test mode, count, n .local n_ n_ = (n) + 1 setb PPUMASK,0 jsr sync_vbl_even delay_...
xem/nes
1,649
nes-test-roms/mmc3_test/source/3-A12_clocking.s
; Tests MMC3 IRQ clocking via bit 12 of VRAM address .include "test_mmc3.inc" main: jsr begin_mmc3_tests setb PPUCTRL,0 ; disable PPU, sprites and bg use $0xxx patterns sta PPUMASK set_test 2,"Shouldn't be clocked when A12 doesn't change" ldx #1 jsr begin_counter_test lda #$00 ; tr...
xem/nes
1,856
nes-test-roms/mmc3_test/source/common/testing.s
; Utilities for writing test ROMs ; In NVRAM so these can be used before initializing runtime, ; then runtime initialized without clearing them nv_res test_code ; code of current test nv_res test_name,2 ; address of name of current test, or 0 of none ; Sets current test code and optional name. Also resets ; checksum...
xem/nes
2,660
nes-test-roms/mmc3_test/source/common/print.s
; Prints values in various ways to output, ; including numbers and strings. newline = 10 zp_byte print_temp_ ; Prints indicated register to console as two hex ; chars and space ; Preserved: A, X, Y, flags print_a: php pha print_reg_: jsr print_hex lda #' ' jsr print_char_ pla plp rts print_x: php pha txa...
xem/nes
1,505
nes-test-roms/mmc3_test/source/common/build_rom.s
; Builds program as iNES ROM ; Default is 16K PRG and 8K CHR ROM, NROM (0) .if 0 ; Options to set before .include "shell.inc": CHR_RAM=1 ; Use CHR-RAM instead of CHR-ROM CART_WRAM=1 ; Use mapper that supports 8K WRAM in cart CUSTOM_MAPPER=n ; Specify mapper number .endif .ifndef CUSTOM_MAPPER .ifdef CART_...
xem/nes
5,523
nes-test-roms/mmc3_test/source/common/console.s
; Scrolling text console with line wrapping, 30x29 characters. ; Buffers lines for speed. Will work even if PPU doesn't ; support scrolling (until text reaches bottom). Keeps border ; along bottom in case TV cuts it off. ; ; Defers most initialization until first newline, at which ; point it clears nametable and makes ...
xem/nes
1,096
nes-test-roms/mmc3_test/source/common/text_out.s
; Text output as expanding zero-terminated string at text_out_base ; The final exit result byte is written here final_result = $6000 ; Text output is written here as an expanding ; zero-terminated string text_out_base = $6004 bss_res text_out_temp zp_res text_out_addr,2 init_text_out: ldx #0 ; Put valid data fi...
xem/nes
2,024
nes-test-roms/mmc3_test/source/common/ppu.s
; PPU utilities bss_res ppu_not_present ; Sets PPUADDR to w ; Preserved: X, Y .macro set_ppuaddr w bit PPUSTATUS setb PPUADDR,>w setb PPUADDR,<w .endmacro ; Delays by no more than n scanlines .macro delay_scanlines n .if CLOCK_RATE <> 1789773 .error "Currently only supports NTSC" .endif delay ((n)*341)/3 .e...
xem/nes
5,332
nes-test-roms/mmc3_test/source/common/shell.s
; Common routines and runtime ; Detect inclusion loops (otherwise ca65 goes crazy) .ifdef SHELL_INCLUDED .error "shell.s included twice" .end .endif SHELL_INCLUDED = 1 ;**** Special globals **** ; Temporary variables that ANY routine might modify, so ; only use them between routine calls. temp = <$A temp2 = <$B...
xem/nes
3,550
nes-test-roms/mmc3_test/source/common/sync_vbl.s
; Synchronizes EXACTLY to VBL, to accuracy of 1/3 CPU clock ; (1/2 CPU clock if PPU is enabled). Reading PPUSTATUS ; 29768 clocks or later after return will have bit 7 set. ; Reading PPUSTATUS immediately will have bit 7 clear. ; Preserved: A, X, Y ; Time: 120-330 msec .align 128 sync_vbl: pha ; Disable interrupts ...
xem/nes
3,437
nes-test-roms/mmc3_test/source/common/delay.s
; Delays in CPU clocks, milliseconds, etc. All routines are re-entrant ; (no global data). No routines touch X or Y during execution. ; Code generated by macros is relocatable; it contains no JMPs to itself. zp_byte delay_temp_ ; only written to ; Delays n clocks, from 2 to 16777215 ; Preserved: A, X, Y, flags .macro...
xem/nes
1,632
nes-test-roms/mmc3_test/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: A, X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum modul...
xem/nes
4,189
nes-test-roms/cpu_exec_space/source/test_cpu_exec_space_apu.s
; Expected output, and explanation: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; TEST: test_cpu_exec_space_apu ; This program verifies that the ; CPU can execute code from any ; possible location that it can ; address, including I/O space. ; ; In this test, it is also ; verified that not only all ; write-only APU I/O po...
xem/nes
15,553
nes-test-roms/cpu_exec_space/source/test_cpu_exec_space_ppuio.s
; Expected output, and explanation: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; TEST: test_cpu_exec_space ; This program verifies that the ; CPU can execute code from any ; possible location that it can ; address, including I/O space. ; ; In addition, it will be tested ; that an RTS instruction does a ; dummy read of ...
xem/nes
1,856
nes-test-roms/cpu_exec_space/source/common/testing.s
; Utilities for writing test ROMs ; In NVRAM so these can be used before initializing runtime, ; then runtime initialized without clearing them nv_res test_code ; code of current test nv_res test_name,2 ; address of name of current test, or 0 of none ; Sets current test code and optional name. Also resets ; checksum...
xem/nes
5,340
nes-test-roms/cpu_exec_space/source/common/print.s
; Prints values in various ways to output, ; including numbers and strings. newline = 10 zp_byte print_temp_ ; Prints indicated register to console as two hex ; chars and space ; Preserved: A, X, Y, flags print_a: php pha print_reg_: jsr print_hex lda #' ' jsr print_char_ pla plp rts print_x: php pha txa...
xem/nes
1,593
nes-test-roms/cpu_exec_space/source/common/build_rom.s
; Builds program as iNES ROM ; Default is 16K PRG and 8K CHR ROM, NROM (0) .if 0 ; Options to set before .include "shell.inc": CHR_RAM=1 ; Use CHR-RAM instead of CHR-ROM CART_WRAM=1 ; Use mapper that supports 8K WRAM in cart CUSTOM_MAPPER=n ; Specify mapper number .endif .ifndef CUSTOM_MAPPER .ifdef CART_...
xem/nes
4,298
nes-test-roms/cpu_exec_space/source/common/console.s
; Scrolling text console with line wrapping, 30x29 characters. ; Buffers lines for speed. Will work even if PPU doesn't ; support scrolling (until text reaches bottom). Keeps border ; along bottom in case TV cuts it off. ; ; Defers most initialization until first newline, at which ; point it clears nametable and makes ...
xem/nes
1,096
nes-test-roms/cpu_exec_space/source/common/text_out.s
; Text output as expanding zero-terminated string at text_out_base ; The final exit result byte is written here final_result = $6000 ; Text output is written here as an expanding ; zero-terminated string text_out_base = $6004 bss_res text_out_temp zp_res text_out_addr,2 init_text_out: ldx #0 ; Put valid data fi...
xem/nes
2,024
nes-test-roms/cpu_exec_space/source/common/ppu.s
; PPU utilities bss_res ppu_not_present ; Sets PPUADDR to w ; Preserved: X, Y .macro set_ppuaddr w bit PPUSTATUS setb PPUADDR,>w setb PPUADDR,<w .endmacro ; Delays by no more than n scanlines .macro delay_scanlines n .if CLOCK_RATE <> 1789773 .error "Currently only supports NTSC" .endif delay ((n)*341)/3 .e...
xem/nes
4,660
nes-test-roms/cpu_exec_space/source/common/shell.s
; Common routines and runtime ; Detect inclusion loops (otherwise ca65 goes crazy) .ifdef SHELL_INCLUDED .error "shell.s included twice" .end .endif SHELL_INCLUDED = 1 ;**** Special globals **** ; Temporary variables that ANY routine might modify, so ; only use them between routine calls. temp = <$A temp2 = <$B...
xem/nes
3,445
nes-test-roms/cpu_exec_space/source/common/delay.s
; Delays in CPU clocks, milliseconds, etc. All routines are re-entrant ; (no global data). No routines touch X or Y during execution. ; Code generated by macros is relocatable; it contains no JMPs to itself. zp_byte delay_temp_ ; only written to ; Delays n clocks, from 2 to 16777215 ; Preserved: A, X, Y, flags .macro...
xem/nes
1,632
nes-test-roms/cpu_exec_space/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: A, X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum modul...
xem/nes
10,193
nes-test-roms/dpcmletterbox/src/reset.s
; nes sample timer abuse ; ; Copyright 2010 Damian Yerrick ; ; Copying and distribution of this file, with or without ; modification, are permitted in any medium without royalty ; provided the copyright notice and this notice are preserved. ; This file is offered as-is, without any warranty. .p02 .include "src/nes.h" ...
xem/nes
1,881
nes-test-roms/cpu_interrupts_v2/source/3-nmi_and_irq.s
; NMI behavior when it interrupts IRQ vectoring. ; ; Result when run: ; NMI IRQ ; 23 00 NMI occurs before LDA #1 ; 21 00 NMI occurs after LDA #1 (Z flag clear) ; 21 00 ; 20 00 NMI occurs after CLC, interrupting IRQ ; 20 00 ; 20 00 ; 20 00 ; 20 00 ; 20 00 ; 20 00 Same result for 7 clocks before IRQ is vectored...
xem/nes
1,373
nes-test-roms/cpu_interrupts_v2/source/4-irq_and_dma.s
; Has IRQ occur at various times around sprite DMA. ; First column refers to what instruction IRQ occurred ; after. Second column is time of IRQ, in CPU clocks relative ; to some arbitrary starting point. ; ; 0 +0 ; 1 +1 ; 1 +2 ; 2 +3 ; 2 +4 ; 4 +5 ; 4 +6 ; 7 +7 ; 7 +8 ; 7 +9 ; 7 +10 ; 8 +11 ; 8 +12 ; 8 +13 ; ... ; 8 +...
xem/nes
1,790
nes-test-roms/cpu_interrupts_v2/source/2-nmi_and_brk.s
; NMI behavior when it interrupts BRK. Occasionally fails on ; NES due to PPU-CPU synchronization. ; ; Result when run: ; NMI BRK -- ; 27 36 00 NMI before CLC ; 26 36 00 NMI after CLC ; 26 36 00 ; 36 00 00 NMI interrupting BRK, with B bit set on stack ; 36 00 00 ; 36 00 00 ; 36 00 00 ; 36 00 00 ; 2...
xem/nes
2,787
nes-test-roms/cpu_interrupts_v2/source/5-branch_delays_irq.s
; A taken non-page-crossing branch ignores IRQ during ; its last clock, so that next instruction executes ; before the IRQ. Other instructions would execute the ; NMI before the next instruction. ; ; The same occurs for NMI, though that's not tested here. ; ; test_jmp ; T+ CK PC ; 00 02 04 NOP ; 01 01 04 ; 02 03 07 JM...
xem/nes
3,807
nes-test-roms/cpu_interrupts_v2/source/1-cli_latency.s
; Tests the delay in CLI taking effect, and some basic aspects of IRQ ; handling and the APU frame IRQ (needed by the tests). It uses the APU's ; frame IRQ and first verifies that it works well enough for the tests. ; ; The later tests execute CLI followed by SEI and equivalent pairs of ; instructions (CLI, PLP, where...
xem/nes
1,227
nes-test-roms/cpu_interrupts_v2/source/4-nmi_and_dma.s
; Has IRQ occur at various times around sprite DMA. ; First column refers to what instruction IRQ occurred ; after. Second column is time of IRQ, in CPU clocks relative ; to some arbitrary starting point. CUSTOM_IRQ=1 .include "shell.inc" .include "sync_apu.s" irq: bit SNDCHN rti begin: jsr sync_apu ...
xem/nes
1,852
nes-test-roms/cpu_interrupts_v2/source/common/testing.s
; Utilities for writing test ROMs ; In NVRAM so these can be used before initializing runtime, ; then runtime initialized without clearing them nv_res test_code ; code of current test nv_res test_name,2 ; address of name of current test, or 0 of none ; Sets current test code and optional name. Also resets ; checksum...
xem/nes
3,229
nes-test-roms/cpu_interrupts_v2/source/common/print.s
; Prints values in various ways to output, ; including numbers and strings. newline = 10 zp_byte print_temp_ ; Prints indicated register to console as two hex ; chars and space ; Preserved: A, X, Y, flags print_a: php pha print_reg_: jsr print_hex lda #' ' jsr print_char_ pla plp rts print_x: php pha txa...
xem/nes
3,104
nes-test-roms/cpu_interrupts_v2/source/common/shell_misc.s
; Reports internal error and exits program internal_error: init_cpu_regs print_str newline,"Internal error" lda #255 jmp exit .import __NVRAM_LOAD__, __NVRAM_SIZE__ .macro fill_ram_ Begin, End ; Simpler to count from negative size up to 0, ; and adjust address downward to compensate ; for initial low byte in Y...
xem/nes
1,483
nes-test-roms/cpu_interrupts_v2/source/common/build_rom.s
; Builds program as iNES ROM ; Default is 32K PRG and 8K CHR ROM, NROM (0) .if 0 ; Options to set before .include "shell.inc": CHR_RAM=1 ; Use CHR-RAM instead of CHR-ROM CART_WRAM=1 ; Use mapper that supports 8K WRAM in cart CUSTOM_MAPPER=n ; Specify mapper number .endif .ifndef CUSTOM_MAPPER .ifdef CART_...
xem/nes
5,404
nes-test-roms/cpu_interrupts_v2/source/common/console.s
; Scrolling text console with word wrapping, 30x29 characters. ; ; * Defers PPU initialization until first flush/ newline. ; * Works even if PPU doesn't support scrolling. ; * Keeps border around edge of screen for TV overscan. ; * Requires vertical or single-screen mirroring. ; * Requires ASCII font in CHR. .ifndef C...
xem/nes
1,096
nes-test-roms/cpu_interrupts_v2/source/common/text_out.s
; Text output as expanding zero-terminated string at text_out_base ; The final exit result byte is written here final_result = $6000 ; Text output is written here as an expanding ; zero-terminated string text_out_base = $6004 bss_res text_out_temp zp_res text_out_addr,2 init_text_out: ldx #0 ; Put valid data fi...
xem/nes
3,060
nes-test-roms/cpu_interrupts_v2/source/common/ppu.s
; PPU utilities bss_res ppu_not_present ; Sets PPUADDR to w ; Preserved: X, Y .macro set_ppuaddr w bit PPUSTATUS setb PPUADDR,>w setb PPUADDR,<w .endmacro ; Delays by no more than n scanlines .macro delay_scanlines n .if CLOCK_RATE <> 1789773 .error "Currently only supports NTSC" .endif delay ((n)*341)/3 .e...
xem/nes
2,729
nes-test-roms/cpu_interrupts_v2/source/common/shell.s
; Shell that sets up testing framework and calls main ; Detect inclusion loops (otherwise ca65 goes crazy) .ifdef SHELL_INCLUDED .error "shell.s included twice" .end .endif SHELL_INCLUDED = 1 ; Temporary variables that ANY routine might modify, so ; only use them between routine calls. temp = <$A temp2 = <$B tem...
xem/nes
3,713
nes-test-roms/cpu_interrupts_v2/source/common/sync_vbl.s
; Synchronizes EXACTLY to VBL, to accuracy of 1/3 CPU clock ; (1/2 CPU clock if PPU is enabled). Reading PPUSTATUS ; 29768 clocks or later after return will have bit 7 set. ; Reading PPUSTATUS immediately will have bit 7 clear. ; Preserved: A, X, Y ; Time: 120-330 msec .align 128 sync_vbl: pha ; Disable interrupts ...
xem/nes
3,437
nes-test-roms/cpu_interrupts_v2/source/common/delay.s
; Delays in CPU clocks, milliseconds, etc. All routines are re-entrant ; (no global data). No routines touch X or Y during execution. ; Code generated by macros is relocatable; it contains no JMPs to itself. zp_byte delay_temp_ ; only written to ; Delays n clocks, from 2 to 16777215 ; Preserved: A, X, Y, flags .macro...
xem/nes
1,632
nes-test-roms/cpu_interrupts_v2/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: A, X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum modul...
xem/nes
2,653
nes-test-roms/ppu_open_bus/source/ppu_open_bus.s
; Tests PPU "decay value", the open-bus value read back from ; write-only registers and unimplemented bits of $2002. ; Takes about five seconds. .include "shell.inc" main: set_test 2,"Write to any PPU register should set decay value" lda #$55 sta PPUSTATUS cmp PPUCTRL jne test_failed ...
xem/nes
1,856
nes-test-roms/ppu_open_bus/source/common/testing.s
; Utilities for writing test ROMs ; In NVRAM so these can be used before initializing runtime, ; then runtime initialized without clearing them nv_res test_code ; code of current test nv_res test_name,2 ; address of name of current test, or 0 of none ; Sets current test code and optional name. Also resets ; checksum...
xem/nes
2,583
nes-test-roms/ppu_open_bus/source/common/print.s
; Prints values in various ways to output, ; including numbers and strings. newline = 10 zp_byte print_temp_ ; Prints indicated register to console as two hex ; chars and space ; Preserved: A, X, Y, flags print_a: php pha print_reg_: jsr print_hex lda #' ' jsr print_char_ pla plp rts print_x: php pha txa...
xem/nes
1,491
nes-test-roms/ppu_open_bus/source/common/build_rom.s
; Builds program as iNES ROM ; Default is 16K PRG and 8K CHR ROM, NROM (0) .if 0 ; Options to set before .include "shell.inc": CHR_RAM=1 ; Use CHR-RAM instead of CHR-ROM CART_WRAM=1 ; Use mapper that supports 8K WRAM in cart CUSTOM_MAPPER=n ; Specify mapper number .endif .ifndef CUSTOM_MAPPER .ifdef CART_...
xem/nes
3,732
nes-test-roms/ppu_open_bus/source/common/console.s
; Scrolling text console with line wrapping, 30x29 characters. ; Buffers lines for speed. Will work even if PPU doesn't ; support scrolling (until text reaches bottom). Keeps border ; along bottom in case TV cuts it off. ; ; Defers most initialization until first newline, at which ; point it clears nametable and makes ...
xem/nes
1,096
nes-test-roms/ppu_open_bus/source/common/text_out.s
; Text output as expanding zero-terminated string at text_out_base ; The final exit result byte is written here final_result = $6000 ; Text output is written here as an expanding ; zero-terminated string text_out_base = $6004 bss_res text_out_temp zp_res text_out_addr,2 init_text_out: ldx #0 ; Put valid data fi...
xem/nes
2,024
nes-test-roms/ppu_open_bus/source/common/ppu.s
; PPU utilities bss_res ppu_not_present ; Sets PPUADDR to w ; Preserved: X, Y .macro set_ppuaddr w bit PPUSTATUS setb PPUADDR,>w setb PPUADDR,<w .endmacro ; Delays by no more than n scanlines .macro delay_scanlines n .if CLOCK_RATE <> 1789773 .error "Currently only supports NTSC" .endif delay ((n)*341)/3 .e...
xem/nes
4,658
nes-test-roms/ppu_open_bus/source/common/shell.s
; Common routines and runtime ; Detect inclusion loops (otherwise ca65 goes crazy) .ifdef SHELL_INCLUDED .error "shell.s included twice" .end .endif SHELL_INCLUDED = 1 ;**** Special globals **** ; Temporary variables that ANY routine might modify, so ; only use them between routine calls. temp = <$A temp2 = <$B...
xem/nes
3,437
nes-test-roms/ppu_open_bus/source/common/delay.s
; Delays in CPU clocks, milliseconds, etc. All routines are re-entrant ; (no global data). No routines touch X or Y during execution. ; Code generated by macros is relocatable; it contains no JMPs to itself. zp_byte delay_temp_ ; only written to ; Delays n clocks, from 2 to 16777215 ; Preserved: A, X, Y, flags .macro...
xem/nes
1,632
nes-test-roms/ppu_open_bus/source/common/crc.s
; CRC-32 checksum calculation zp_res checksum,4 zp_byte checksum_temp zp_byte checksum_off_ ; Turns CRC updating on/off. Allows nesting. ; Preserved: A, X, Y crc_off: dec checksum_off_ rts crc_on: inc checksum_off_ beq :+ jpl internal_error ; catch unbalanced crc calls : rts ; Initializes checksum modul...
xem/nes
1,295
nes-test-roms/nes_instr_test/source/01-implied.s
;CALIBRATE=1 .include "instr_test.inc" instrs: entry $2A,"ROL A" ; A = op A entry $0A,"ASL A" entry $6A,"ROR A" entry $4A,"LSR A" entry $8A,"TXA" ; AXY = AXY entry $98,"TYA" entry $AA,"TAX" entry $A8,"TAY" entry $E8,"INX" ; XY = op XY entry $C8,"INY" entry $CA,"DEX" entry $88,"DEY" entry $38,"SEC" ; ...