Fixed the Creativision library's bios_playsound().

It was disabling interrupts permanently.
This commit is contained in:
Greg King
2021-05-14 19:12:59 -04:00
parent 31128d4809
commit f636d4e634

View File

@@ -1,63 +1,67 @@
; void __fastcall__ psg_outb (unsigned char b); ; void __fastcall__ psg_outb (unsigned char b);
; void __fastcall__ psg_delay (unsigned char c); ; void __fastcall__ psg_delay (unsigned char b);
; void __fastcall__ bios_playsound (const void *b, unsigned char c); ; void __fastcall__ bios_playsound (void *a, unsigned char b);
; void psg_silence (void); ; void psg_silence (void);
.export _psg_outb, _psg_silence, _psg_delay
.export _bios_playsound .export _psg_outb, _psg_silence, _psg_delay
.import popa .export _bios_playsound
.import popax
.include "creativision.inc" .include "creativision.inc"
_psg_outb:
;* Let BIOS output the value songptr := $00 ; Points to current tune data
jmp $FE77 volptr := $04 ; Points to current volume table
_psg_outb:
;* Let BIOS output the value.
jmp $FE77
_psg_silence: _psg_silence:
jmp $FE54
jmp $FE54
_psg_delay: _psg_delay:
tay tay
l1: lda #200 l1: lda #200
l2: sbc #1 l2: sbc #1
bne l2 bne l2
lda #200 lda #200
l3: sbc #1 l3: sbc #1
bne l3 bne l3
dey dey
bne l1 bne l1
rts rts
;* Creativision Sound Player ;* Creativision Sound Player
;* Based on BIOS song player.
;* ;*
;* Based on BIOS sound player. ;* Pass a pointer to a set of note triples, terminated with a tempo byte;
;* Pass a pointer to a set of note triples, terminated with a tempo byte ;* and pass the length of the triples and tempo (max 255).
;* and the len (max 255) ;*
;* Note: tune data must be stored backwards.
_bios_playsound: _bios_playsound:
php
pha ; Save Length Byte pha ; Save tune length
sei sei
lda #$D5 ; BIOS volume table low lda #<$FCD5 ; A BIOS volume table
sta $4 ldx #>$FCD5
lda #$FC ; BIOS volume table high sta volptr
sta $5 stx volptr+1
jsr popa ; Get Sound table pointer low jsr popax ; Get tune array pointer
sta $0 sta songptr
jsr popa ; Get Sound table pointer high stx songptr+1
sta $1
pla pla
tay ; Put length in Y tay
dey dey ; Point to tempo byte
php jmp $FBED ; Let BIOS do its thing
jmp $FBED ; Let BIOS do it's thing