From 9e880eef9271b4b7b69f7bbfedf20a6d3dd4a46b Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 18 Jun 2019 22:48:00 -0400 Subject: [PATCH] raster_sound: got the mb routine cycle counted 1000 cycles? --- interlace_demo/Makefile | 2 +- interlace_demo/mockingboard_a.s | 28 ++++++++++++++++++++++------ interlace_demo/rasterbars_sound.s | 23 ++++++++++++++--------- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/interlace_demo/Makefile b/interlace_demo/Makefile index be57496a..e5744f81 100644 --- a/interlace_demo/Makefile +++ b/interlace_demo/Makefile @@ -45,7 +45,7 @@ RASTERBARS_SOUND: rasterbars_sound.o rasterbars_sound.o: rasterbars_sound.s gr_copy.s \ rasterbars_screen.s rasterbars_table.s movement_table.s rb_bg.inc \ - pt3_lib_ci.s interrupt_handler.s + pt3_lib_ci.s interrupt_handler.s mockingboard_a.s ca65 -o rasterbars_sound.o rasterbars_sound.s -l rasterbars_sound.lst diff --git a/interlace_demo/mockingboard_a.s b/interlace_demo/mockingboard_a.s index 5e35aae2..3530af66 100644 --- a/interlace_demo/mockingboard_a.s +++ b/interlace_demo/mockingboard_a.s @@ -252,7 +252,7 @@ mb4_not_in_this_slot: ;==================================== ; cycle counted - ; 2 + 13*(28+28+7) + 5 + ; 2 + 13*(70) + 74 + 5 = 991 mb_write_frame: @@ -267,9 +267,9 @@ mb_write_frame: mb_write_loop: ;============================= - ; not r13 -- 4+5+[ ]+28+28+7 - ; r13, not ff -- 4+5+ 3 +28+28+7 - ; r13 is ff -- 4+5+ 4 + ; not r13 -- 4+5+28+26+7 = 70 + ; r13, not ff -- 4+5+ 4 +28+26+7 = 74 + ; r13 is ff -- 4+5+3+1=[61] = 74 lda AY_REGISTERS,X ; load register value ; 4 @@ -282,9 +282,25 @@ mb_write_loop: ; -1 cmp #$ff ; 2 - beq mb_skip_13 ; 3 + bne mb_not_13 ; 3 ; -1 + + ; delay 61 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + inc TEMP ; 5 + lda TEMP ; 3 + jmp mb_skip_13 ; 3 + mb_not_13: @@ -308,7 +324,7 @@ mb_not_13: sty MOCK_6522_ORB1 ; 4 sty MOCK_6522_ORB2 ; 4 ;=========== - ; 28 + ; 26 mb_no_write: inx ; point to next register ; 2 cpx #14 ; if 14 we're done ; 2 diff --git a/interlace_demo/rasterbars_sound.s b/interlace_demo/rasterbars_sound.s index 8bb61ae2..1eef8dc2 100644 --- a/interlace_demo/rasterbars_sound.s +++ b/interlace_demo/rasterbars_sound.s @@ -288,8 +288,9 @@ display_loop: ; -582 -- erase 22+4*(8+6+126) = 582 ; -696 -- move+draw 4*(16+26+6+126) = 696 ; -10 -- keypress + ; -997 -- mockingboard out ;======= - ; 3262 + ; 2265 pad_time: @@ -462,21 +463,19 @@ pad_time: ;============================ - jsr pt3_make_frame - jsr mb_write_frame +; jsr pt3_make_frame + jsr mb_write_frame ; 6+921 ;============================ ; WAIT for VBLANK to finish ;============================ - ; Try X=5 Y=105 cycles=3256 R6 - nop - nop - nop + ; Try X=112 Y=4 cycles=2265 - ldy #105 ; 2 -loop1: ldx #5 ; 2 + + ldy #4 ; 2 +loop1: ldx #112 ; 2 loop2: dex ; 2 bne loop2 ; 2nt/3 dey ; 2 @@ -491,6 +490,12 @@ no_keypress: jmp display_loop ; 3 + + + + + + ;======================== ; Draw a rasterbar ; unroll as memory is free! haha