.title Sean Riddle's Williams RAM test ;www.seanriddle.com ;assembled with as6809 ;del willyramtest.bin ;del willyramtest.rel ;del willyramtest.s19 ;as6809 -l -o -s willyramtest.asm ;aslink -s -m -u -b _CODEF000=0xF000 -b _VECTORS=0xfff0 willyramtest.rel ;srec_cat willyramtest.s19 -o willyramtest.bin -binary ;3/18/2012 SKR created ;game hardware screen_end = 0x9800 ;screen memory from $0000-$97FF ram_end = 0xc000 ;RAM from $0000-$BFFF color_registers = 0xC000 COLOR_BLUE = 0xc0 COLOR_WHITE = 0xff widget_pia_dataa = 0xC804 ;control panel widget_pia_ctrla = 0xC805 widget_pia_datab = 0xC806 widget_pia_ctrlb = 0xC807 rom_pia_dataa = 0xC80C ;coin door and sound board rom_pia_ctrla = 0xC80D rom_pia_datab = 0xC80E rom_pia_ctrlb = 0xC80F rom_enable_scr_ctrl = 0xC900 ;when D0=1, reads come from ROM, not RAM start_blitter = 0xCA00 ;special chip registers blitter_mask = 0xCA01 blitter_source = 0xCA02 blitter_dest = 0xCA04 blitter_w_h = 0xCA06 vidctrs = 0xcb00 ;beam position watchdog = 0xCBFF watchdog_data = 0x39 PARPORT = 0xc900 ;used for RAM dump .area _CODEF000 ;this area will link at $D000 reset: orcc #0xff ldb #watchdog_data stb watchdog clr rom_pia_ctrla ;setup ROM PIA clr rom_pia_dataa lda #0x3c sta rom_pia_ctrla clr rom_pia_ctrlb lda #0xff sta rom_pia_datab lda #0x35 sta rom_pia_ctrlb lda #0x3f sta rom_pia_datab clr widget_pia_ctrla ;setup widget PIA clr widget_pia_ctrlb clr widget_pia_dataa clr widget_pia_datab lda #0x34 sta widget_pia_ctrla lda #0x3c ;select B controls for joystick sta widget_pia_ctrlb lda #0x00 ;enable RAM sta rom_enable_scr_ctrl ldb #0x00 tfr b,a lsla lsla lsla lsla lsla lsla sta rom_pia_datab ;set bits A & B tfr b,a anda #0x08 ora #0x34 ;select Cx2 as output sta rom_pia_ctrla ;set bit D tfr b,a lsla anda #0x08 ora #0x34 sta rom_pia_ctrlb ;set bit C ldb #watchdog_data ldx #0x0000 lda #0x00 1$: stb watchdog sta ,x+ cmpx #ram_end bne 1$ jmp dumpram1 dumpram1return: ldb #watchdog_data ldx #0x0000 lda #0xff 2$: stb watchdog sta ,x+ cmpx #ram_end bne 2$ jmp dumpram2 dumpram2return: jmp spin ;subroutines dumpram1: ;bit-bangs RAM buffer from 0 to 0xBFFF - uses A, B, X, U ldb #0x01 tfr b,a lsla lsla lsla lsla lsla lsla sta rom_pia_datab ;set bits A & B tfr b,a anda #0x08 ora #0x34 ;select Cx2 as output sta rom_pia_ctrla ;set bit D tfr b,a lsla anda #0x08 ora #0x34 sta rom_pia_ctrlb ;set bit C lda #0x02 ;enable RAM, trigger ROM dump w/screen flip sta rom_enable_scr_ctrl ldu #0x0000 parbyteout1: ldb #watchdog_data stb watchdog lda ,u anda #0xf0 sta PARPORT ldx #0x0020 $delay11: leax -1,x bne $delay11 lda ,u+ rola rola rola rola anda #0xf0 sta PARPORT ldx #0x0020 $delay21: leax -1,x bne $delay21 cmpu #ram_end bne parbyteout1 lda #0x00 ;enable RAM, turn off trigger sta rom_enable_scr_ctrl jmp dumpram1return dumpram2: ;bit-bangs RAM buffer from U to numb - uses A, B, X, U ldb #0x02 tfr b,a lsla lsla lsla lsla lsla lsla sta rom_pia_datab ;set bits A & B tfr b,a anda #0x08 ora #0x34 ;select Cx2 as output sta rom_pia_ctrla ;set bit D tfr b,a lsla anda #0x08 ora #0x34 sta rom_pia_ctrlb ;set bit C lda #0x02 ;enable RAM, trigger ROM dump w/screen flip sta rom_enable_scr_ctrl ldu #0x0000 parbyteout2: ldb #watchdog_data stb watchdog lda ,u anda #0xf0 sta PARPORT ldx #0x0020 $delay12: leax -1,x bne $delay12 lda ,u+ rola rola rola rola anda #0xf0 sta PARPORT ldx #0x0020 $delay22: leax -1,x bne $delay22 cmpu #ram_end bne parbyteout2 lda #0x00 ;enable RAM, turn off trigger sta rom_enable_scr_ctrl jmp dumpram2return spin: ldb #0x03 tfr b,a lsla lsla lsla lsla lsla lsla sta rom_pia_datab ;set bits A & B tfr b,a anda #0x08 ora #0x34 ;select Cx2 as output sta rom_pia_ctrla ;set bit D tfr b,a lsla anda #0x08 ora #0x34 sta rom_pia_ctrlb ;set bit C ldb #watchdog_data spin1: stb watchdog bra spin1 ;unused space from end of code to FFEF .area _VECTORS ;CPU vectors at FFF0 .word #reset,#reset,#reset,#reset,#reset,#reset,#reset,#reset ;point them all to start of code .end