File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -86,9 +86,11 @@ update_timer_state_tracker::
8686 call ym2610_wait_available
8787
8888 ;; reset interrupt timer B
89+ ;; YM2610 register context is only captured by regular code,
90+ ;; i.e. outside of the interrupt handler
8991 ld b , #REG_TIMER_FLAGS
9092 ld c , # 0x2a
91- call ym2610_write_port_a
93+ call ym2610_write_port_a_no_ctx
9294
9395 ;; step2: at this stage, if we interrupted a ym2610_write_port_a,
9496 ;; restore the YM2610 register context before returning from the
Original file line number Diff line number Diff line change @@ -63,6 +63,25 @@ ym2610_write_port_a::
6363 pop af
6464 ret
6565
66+ ;;; ym2610_write_port_a_no_ctx
67+ ;;; --------------------------
68+ ;;; IN:
69+ ;;; b: register address in ym2610
70+ ;;; c: data to set
71+ ;;; (all registers are preserved)
72+ ym2610_write_port_a_no_ctx::
73+ push af
74+ ;; select register address
75+ ld a , b
76+ out (PORT_YM2610_A_ADDR) , a
77+ call _ym2610_wait_address_write
78+ ;; set data in the selected register
79+ ld a , c
80+ out (PORT_YM2610_A_VALUE) , a
81+ call _ym2610_wait_data_write
82+ pop af
83+ ret
84+
6685;;; ym2610_write_port_b
6786;;; -------------------
6887;;; IN:
You can’t perform that action at this time.
0 commit comments