diff --git a/pt3_player/gr_fast_clear.s b/pt3_player/gr_fast_clear.s index f804bc6f..f40c807c 100644 --- a/pt3_player/gr_fast_clear.s +++ b/pt3_player/gr_fast_clear.s @@ -5,7 +5,7 @@ clear_screens: lda #$0 jsr clear_top - jsr clear_bottom + jsr clear_bottom0 ;=================================== ; Clear top/bottom of page 1 @@ -13,7 +13,7 @@ clear_screens: lda #$4 jsr clear_top - jmp clear_bottom + jmp clear_bottom4 @@ -85,6 +85,7 @@ clear_bottoms: ; Clear bottom of page 1 ;=================================== +clear_bottom4: lda #$4 ; fall through @@ -95,6 +96,7 @@ clear_bottoms: clear_bottom: sta DRAW_PAGE ; 3 +clear_bottom0: clc ; 2 adc #6 ; 2 diff --git a/pt3_player/interrupt_handler.s b/pt3_player/interrupt_handler.s index f7187d58..e48d7716 100644 --- a/pt3_player/interrupt_handler.s +++ b/pt3_player/interrupt_handler.s @@ -99,9 +99,9 @@ mb_not_13: lda #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2 sta MOCK_6522_ORB1 ; latch_address on PB1 ; 4 sta MOCK_6522_ORB2 ; latch_address on PB2 ; 4 - lda #MOCK_AY_INACTIVE ; go inactive ; 2 - sta MOCK_6522_ORB1 ; 4 - sta MOCK_6522_ORB2 ; 4 + ldy #MOCK_AY_INACTIVE ; go inactive ; 2 + sty MOCK_6522_ORB1 ; 4 + sty MOCK_6522_ORB2 ; 4 ; value lda AY_REGISTERS,X ; load register value ; 4 @@ -110,11 +110,10 @@ mb_not_13: lda #MOCK_AY_WRITE ; ; 2 sta MOCK_6522_ORB1 ; write on PB1 ; 4 sta MOCK_6522_ORB2 ; write on PB2 ; 4 - lda #MOCK_AY_INACTIVE ; go inactive ; 2 - sta MOCK_6522_ORB1 ; 4 - sta MOCK_6522_ORB2 ; 4 + sty MOCK_6522_ORB1 ; 4 + sty MOCK_6522_ORB2 ; 4 ;=========== - ; 62 + ; 60 mb_no_write: inx ; point to next register ; 2 cpx #14 ; if 14 we're done ; 2 @@ -178,7 +177,7 @@ done_time: check_keyboard: jsr get_key - lda LASTKEY + cmp #0 beq exit_interrupt ;==================== diff --git a/pt3_player/keypress_minimal.s b/pt3_player/keypress_minimal.s index 16d7c815..8b176a61 100644 --- a/pt3_player/keypress_minimal.s +++ b/pt3_player/keypress_minimal.s @@ -11,7 +11,7 @@ get_key: figure_out_key: cmp #' '+128 ; the mask destroys space ; 2 - beq save_key ; so handle it specially ; 2nt/3 + beq return_key ; so handle it specially ; 2nt/3 check_right_arrow: cmp #$95 ; 2 @@ -32,15 +32,14 @@ check_down_arrow: check_escape: and #$5f ; mask, to make upper-case ; 2 cmp #$1B ; 2 - bne save_key ; 2nt/3 + bne return_key ; 2nt/3 lda #'Q' ; 2 - bne save_key ; branch always ; 3 + bne return_key ; branch always ; 3 no_key: - lda #0 ; no key, so save a zero ; 2 + lda #0 ; no key, so return a zero ; 2 -save_key: - sta LASTKEY ; save the key to our buffer ; 2 +return_key: rts ; 6 ;============ diff --git a/pt3_player/mockingboard_a.s b/pt3_player/mockingboard_a.s index 67ddca70..bf8b7cdd 100644 --- a/pt3_player/mockingboard_a.s +++ b/pt3_player/mockingboard_a.s @@ -90,9 +90,9 @@ write_ay_both: lda #MOCK_AY_LATCH_ADDR ; latch_address on PB1 ; 2 sta MOCK_6522_ORB1 ; latch_address on PB1 ; 3 sta MOCK_6522_ORB2 ; latch_address on PB2 ; 3 - lda #MOCK_AY_INACTIVE ; go inactive ; 2 - sta MOCK_6522_ORB1 ; 3 - sta MOCK_6522_ORB2 ; 3 + ldy #MOCK_AY_INACTIVE ; go inactive ; 2 + sty MOCK_6522_ORB1 ; 3 + sty MOCK_6522_ORB2 ; 3 ; value lda MB_VALUE ; 3 @@ -101,13 +101,12 @@ write_ay_both: lda #MOCK_AY_WRITE ; ; 2 sta MOCK_6522_ORB1 ; write on PB1 ; 3 sta MOCK_6522_ORB2 ; write on PB2 ; 3 - lda #MOCK_AY_INACTIVE ; go inactive ; 2 - sta MOCK_6522_ORB1 ; 3 - sta MOCK_6522_ORB2 ; 3 + sty MOCK_6522_ORB1 ; 3 + sty MOCK_6522_ORB2 ; 3 rts ; 6 ;=========== - ; 53 + ; 51 ;======================================= ; clear ay -- clear all 14 AY registers ; should silence the card diff --git a/pt3_player/pt3_lib.s b/pt3_player/pt3_lib.s index bbb92cad..f6722cbe 100644 --- a/pt3_player/pt3_lib.s +++ b/pt3_player/pt3_lib.s @@ -497,7 +497,6 @@ VolTableCreator: ; Init initial variables lda #$0 - sta z80_h sta z80_d ldy #$11 @@ -524,14 +523,11 @@ vol_type_35: ldy #16 ; skip first row, all zeros ldx #16 ; c=16 vol_outer: - lda z80_h - pha ; save H - clc ; add HL,DE lda z80_l adc z80_e sta z80_e - lda z80_h + lda #0 adc z80_d sta z80_d ; carry is important @@ -572,8 +568,6 @@ vol_smc: pla - pla - sta z80_h ; restore H lda z80_e ; a=e cmp #$77 @@ -691,8 +685,9 @@ note_not_too_high: ; a->tone = (a->tone + a->tone_sliding + w) & 0xfff; clc - lda note_a+NOTE_TONE_L,X - adc note_a+NOTE_TONE_SLIDING_L,X + ldy note_a+NOTE_TONE_SLIDING_L,X + tya + adc note_a+NOTE_TONE_L,X sta note_a+NOTE_TONE_L,X lda note_a+NOTE_TONE_H,X adc note_a+NOTE_TONE_SLIDING_H,X @@ -720,9 +715,10 @@ note_not_too_high: ; a->tone_sliding+=a->tone_slide_step clc ;;can be removed if ADC freq_h cannot overflow - lda note_a+NOTE_TONE_SLIDING_L,X + tya adc note_a+NOTE_TONE_SLIDE_STEP_L,X sta note_a+NOTE_TONE_SLIDING_L,X + tay lda note_a+NOTE_TONE_SLIDING_H,X adc note_a+NOTE_TONE_SLIDE_STEP_H,X sta note_a+NOTE_TONE_SLIDING_H,X @@ -743,7 +739,7 @@ check1: ; (a->tone_sliding <= a->tone_delta) || ; 16 bit signed compare - lda note_a+NOTE_TONE_SLIDING_L,X ; NUM1-NUM2 + tya ; NUM1-NUM2 cmp note_a+NOTE_TONE_DELTA_L,X ; lda note_a+NOTE_TONE_SLIDING_H,X sbc note_a+NOTE_TONE_DELTA_H,X @@ -753,7 +749,7 @@ sc_loser1: bmi slide_to_note ; then A (signed) < NUM (signed) and BMI will branch ; equals case - lda note_a+NOTE_TONE_SLIDING_L,X + tya cmp note_a+NOTE_TONE_DELTA_L,X bne check2 lda note_a+NOTE_TONE_SLIDING_H,X @@ -767,7 +763,7 @@ check2: ; (a->tone_sliding >= a->tone_delta) ; 16 bit signed compare - lda note_a+NOTE_TONE_SLIDING_L,X ; NUM1-NUM2 + tya ; NUM1-NUM2 cmp note_a+NOTE_TONE_DELTA_L,X ; lda note_a+NOTE_TONE_SLIDING_H,X sbc note_a+NOTE_TONE_DELTA_H,X @@ -941,7 +937,6 @@ envelope_slide_done: ; a->envelope_sliding = j; sta note_a+NOTE_ENVELOPE_SLIDING,X - clc last_envelope: diff --git a/pt3_player/pt3_timer.s b/pt3_player/pt3_timer.s index 5ef887f7..6775d4c9 100644 --- a/pt3_player/pt3_timer.s +++ b/pt3_player/pt3_timer.s @@ -411,9 +411,9 @@ mb_not_13: lda #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2 sta MOCK_6522_ORB1 ; latch_address on PB1 ; 4 sta MOCK_6522_ORB2 ; latch_address on PB2 ; 4 - lda #MOCK_AY_INACTIVE ; go inactive ; 2 - sta MOCK_6522_ORB1 ; 4 - sta MOCK_6522_ORB2 ; 4 + ldy #MOCK_AY_INACTIVE ; go inactive ; 2 + sty MOCK_6522_ORB1 ; 4 + sty MOCK_6522_ORB2 ; 4 ; value lda AY_REGISTERS,X ; load register value ; 4 @@ -422,11 +422,10 @@ mb_not_13: lda #MOCK_AY_WRITE ; ; 2 sta MOCK_6522_ORB1 ; write on PB1 ; 4 sta MOCK_6522_ORB2 ; write on PB2 ; 4 - lda #MOCK_AY_INACTIVE ; go inactive ; 2 - sta MOCK_6522_ORB1 ; 4 - sta MOCK_6522_ORB2 ; 4 + sty MOCK_6522_ORB1 ; 4 + sty MOCK_6522_ORB2 ; 4 ;=========== - ; 62 + ; 60 mb_no_write: inx ; point to next register ; 2 cpx #14 ; if 14 we're done ; 2