mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-13 22:30:49 +00:00
chiptune_bare: still shows bug
This commit is contained in:
parent
b516b60f51
commit
4e82142cef
@ -6,13 +6,6 @@
|
||||
; Setup
|
||||
;=============================
|
||||
|
||||
; init variables
|
||||
lda #0
|
||||
sta DONE_PLAYING
|
||||
sta MB_CHUNK_OFFSET
|
||||
|
||||
|
||||
|
||||
;============================
|
||||
; Init the Mockingboard
|
||||
;============================
|
||||
@ -58,28 +51,6 @@
|
||||
; load first song
|
||||
;==================
|
||||
|
||||
jsr new_song
|
||||
|
||||
;============================
|
||||
; Enable 6502 interrupts
|
||||
;============================
|
||||
|
||||
cli ; clear interrupt mask
|
||||
|
||||
;============================
|
||||
; Loop forever
|
||||
;============================
|
||||
main_loop:
|
||||
|
||||
jmp main_loop
|
||||
|
||||
|
||||
;=================
|
||||
; load a new song
|
||||
;=================
|
||||
|
||||
new_song:
|
||||
|
||||
;=========================
|
||||
; Init Variables
|
||||
;=========================
|
||||
@ -103,12 +74,134 @@ new_song:
|
||||
lda #$3
|
||||
sta CHUNKSIZE
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;============================
|
||||
; Enable 6502 interrupts
|
||||
;============================
|
||||
|
||||
cli ; clear interrupt mask
|
||||
|
||||
;============================
|
||||
; Loop forever
|
||||
;============================
|
||||
main_loop:
|
||||
|
||||
jmp main_loop
|
||||
|
||||
|
||||
|
||||
|
||||
;=========
|
||||
;routines
|
||||
;=========
|
||||
.include "mockingboard_a.s"
|
||||
|
||||
; left speaker
|
||||
MOCK_6522_ORB1 EQU $C400 ; 6522 #1 port b data
|
||||
MOCK_6522_ORA1 EQU $C401 ; 6522 #1 port a data
|
||||
MOCK_6522_DDRB1 EQU $C402 ; 6522 #1 data direction port B
|
||||
MOCK_6522_DDRA1 EQU $C403 ; 6522 #1 data direction port A
|
||||
|
||||
; right speaker
|
||||
MOCK_6522_ORB2 EQU $C480 ; 6522 #2 port b data
|
||||
MOCK_6522_ORA2 EQU $C481 ; 6522 #2 port a data
|
||||
MOCK_6522_DDRB2 EQU $C482 ; 6522 #2 data direction port B
|
||||
MOCK_6522_DDRA2 EQU $C483 ; 6522 #2 data direction port A
|
||||
|
||||
; AY-3-8910 commands on port B
|
||||
; RESET BDIR BC1
|
||||
MOCK_AY_RESET EQU $0 ; 0 0 0
|
||||
MOCK_AY_INACTIVE EQU $4 ; 1 0 0
|
||||
MOCK_AY_READ EQU $5 ; 1 0 1
|
||||
MOCK_AY_WRITE EQU $6 ; 1 1 0
|
||||
MOCK_AY_LATCH_ADDR EQU $7 ; 1 1 1
|
||||
|
||||
|
||||
;========================
|
||||
; Mockingboard Init
|
||||
;========================
|
||||
; Initialize the 6522s
|
||||
; set the data direction for all pins of PortA/PortB to be output
|
||||
|
||||
mockingboard_init:
|
||||
lda #$ff ; all output (1)
|
||||
sta MOCK_6522_DDRB1
|
||||
sta MOCK_6522_DDRA1
|
||||
sta MOCK_6522_DDRB2
|
||||
sta MOCK_6522_DDRA2
|
||||
rts
|
||||
|
||||
;======================
|
||||
; Reset Left AY-3-8910
|
||||
;======================
|
||||
reset_ay_both:
|
||||
lda #MOCK_AY_RESET
|
||||
sta MOCK_6522_ORB1
|
||||
lda #MOCK_AY_INACTIVE
|
||||
sta MOCK_6522_ORB1
|
||||
|
||||
;======================
|
||||
; Reset Right AY-3-8910
|
||||
;======================
|
||||
;reset_ay_right:
|
||||
lda #MOCK_AY_RESET
|
||||
sta MOCK_6522_ORB2
|
||||
lda #MOCK_AY_INACTIVE
|
||||
sta MOCK_6522_ORB2
|
||||
rts
|
||||
|
||||
|
||||
; Write sequence
|
||||
; Inactive -> Latch Address -> Inactive -> Write Data -> Inactive
|
||||
|
||||
;=========================================
|
||||
; Write Right/Left to save value AY-3-8910
|
||||
;=========================================
|
||||
; register in X
|
||||
; value in MB_VALUE
|
||||
|
||||
write_ay_both:
|
||||
; address
|
||||
stx MOCK_6522_ORA1 ; put address on PA1 ; 3
|
||||
stx MOCK_6522_ORA2 ; put address on PA2 ; 3
|
||||
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
|
||||
|
||||
; value
|
||||
lda MB_VALUE ; 3
|
||||
sta MOCK_6522_ORA1 ; put value on PA1 ; 3
|
||||
sta MOCK_6522_ORA2 ; put value on PA2 ; 3
|
||||
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
|
||||
|
||||
rts ; 6
|
||||
;===========
|
||||
; 53
|
||||
;=======================================
|
||||
; clear ay -- clear all 14 AY registers
|
||||
; should silence the card
|
||||
;=======================================
|
||||
clear_ay_both:
|
||||
ldx #14
|
||||
lda #0
|
||||
sta MB_VALUE
|
||||
clear_ay_left_loop:
|
||||
jsr write_ay_both
|
||||
dex
|
||||
bpl clear_ay_left_loop
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;================================
|
||||
@ -121,10 +214,7 @@ interrupt_handler:
|
||||
pha ; save A ; 3
|
||||
; Should we save X and Y too?
|
||||
|
||||
.ifdef NOIRQ
|
||||
.else
|
||||
bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4
|
||||
.endif
|
||||
|
||||
mb_play_music:
|
||||
|
||||
@ -267,11 +357,8 @@ increment_offset:
|
||||
|
||||
done_interrupt:
|
||||
pla ; restore a ; 4
|
||||
.ifdef NOIRQ
|
||||
rts
|
||||
.else
|
||||
rti ; return from interrupt ; 6
|
||||
.endif
|
||||
|
||||
|
||||
REGISTER_OLD:
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
Loading…
x
Reference in New Issue
Block a user