|
|
|
@ -5,7 +5,8 @@ |
|
|
|
; |
|
|
|
; Enhanced with multi-chip support by Marco Maccaferri |
|
|
|
; |
|
|
|
; YM2162/YM3484, GD3 support, VGM Chip identification added by Phil Summers |
|
|
|
; YM2162/YM3484, GD3 support, VGM Chip identification, |
|
|
|
; default file type, basic file size checking added by Phil Summers |
|
|
|
; |
|
|
|
; Compile with: |
|
|
|
; |
|
|
|
@ -79,6 +80,7 @@ BDOS .EQU 0005H ; bdos entry point |
|
|
|
FCB .EQU 005CH ; file control block |
|
|
|
FCBCR .EQU FCB + 20H ; fcb current record |
|
|
|
BUFF .EQU 0080H ; DMA buffer |
|
|
|
TOPM .EQU 0002H ; Top of memory |
|
|
|
|
|
|
|
PRINTF .EQU 9 ; BDOS print string function |
|
|
|
OPENF .EQU 15 ; BDOS open file function |
|
|
|
@ -97,17 +99,37 @@ EOS .EQU '$' ; end of string marker |
|
|
|
LD DE,MSG_WELC ; Welcome Message |
|
|
|
CALL PRTSTR |
|
|
|
|
|
|
|
LD C,OPENF |
|
|
|
LD A,(FCB+1) ; Get first char of filename |
|
|
|
CP ' ' ; Compare to blank |
|
|
|
JP Z,ERR ; If so, missing filename |
|
|
|
LD A,(FCB+9) ; If the filetype |
|
|
|
CP ' ' ; is blanks |
|
|
|
JR NZ,HASEXT ; then assume |
|
|
|
LD A,'V' ; type VGM. |
|
|
|
LD (FCB+9),A |
|
|
|
LD A,'G' ; Fill in |
|
|
|
LD (FCB+10),A ; the file |
|
|
|
LD A,'M' ; extension |
|
|
|
LD (FCB+11),A |
|
|
|
|
|
|
|
HASEXT: LD C,OPENF ; Open File |
|
|
|
LD DE,FCB |
|
|
|
CALL BDOS |
|
|
|
INC A |
|
|
|
JP Z, ERR |
|
|
|
JP Z,ERR |
|
|
|
|
|
|
|
XOR A ; Read VGM file into memory |
|
|
|
LD (FCBCR), A |
|
|
|
LD DE, VGMDATA |
|
|
|
LD (VGMPOS), DE |
|
|
|
RLOOP LD C, READF |
|
|
|
RLOOP |
|
|
|
; LD A,(TOPM) ; CBIOS start |
|
|
|
; SUB 10h ; Less BDOS = Top Memory Page |
|
|
|
LD A,$D6 ; Hardcoded top of memory |
|
|
|
CP D |
|
|
|
LD DE,MSG_MEM |
|
|
|
JP Z,EXIT_ERR ; Exit top of memory reached |
|
|
|
LD C, READF |
|
|
|
LD DE, FCB |
|
|
|
CALL BDOS |
|
|
|
OR A |
|
|
|
@ -251,11 +273,13 @@ EXIT |
|
|
|
AND %00000011 |
|
|
|
srl a |
|
|
|
ADC A,'0' |
|
|
|
CP '0' |
|
|
|
JR Z,NOSN |
|
|
|
CALL PRTCHR |
|
|
|
LD DE,MSG_SN |
|
|
|
CALL PRTSTR |
|
|
|
|
|
|
|
POP AF |
|
|
|
NOSN: POP AF |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
PUSH AF |
|
|
|
@ -263,11 +287,13 @@ EXIT |
|
|
|
AND %00000011 |
|
|
|
srl a |
|
|
|
ADC A,'0' |
|
|
|
CP '0' |
|
|
|
JR Z,NOAY |
|
|
|
CALL PRTCHR |
|
|
|
LD DE,MSG_AY |
|
|
|
CALL PRTSTR |
|
|
|
|
|
|
|
POP AF |
|
|
|
NOAY: POP AF |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
PUSH AF |
|
|
|
@ -275,11 +301,13 @@ EXIT |
|
|
|
AND %00000011 |
|
|
|
srl a |
|
|
|
ADC A,'0' |
|
|
|
CP '0' |
|
|
|
JR Z,NOYM |
|
|
|
CALL PRTCHR |
|
|
|
LD DE,MSG_YM |
|
|
|
CALL PRTSTR |
|
|
|
|
|
|
|
LD A, 9FH ; Mute all channels on psg |
|
|
|
NOYM: LD A, 9FH ; Mute all channels on psg |
|
|
|
OUT (PSGREG), A |
|
|
|
OUT (PSG2REG), A |
|
|
|
LD A, 0BFH |
|
|
|
@ -335,7 +363,8 @@ ERR LD C, PRINTF |
|
|
|
CALL BDOS |
|
|
|
RST 00H |
|
|
|
|
|
|
|
NOFILE .DB "File not found", CR, LF, EOS |
|
|
|
NOFILE .DB "File not found", CR, LF, EOS |
|
|
|
MSG_MEM .DB "File to big", CR, LF, EOS |
|
|
|
MSG_EXIT .DB "FINISHED.",CR,LF,0 |
|
|
|
|
|
|
|
;------------------------------------------------------------------------------ |
|
|
|
@ -497,7 +526,7 @@ FASTIO: |
|
|
|
|
|
|
|
#INCLUDE "printing.inc" |
|
|
|
|
|
|
|
MSG_WELC: .DB "VGM Player for RomWBW v0.1, 8-Nov-2021",CR,LF |
|
|
|
MSG_WELC: .DB "VGM Player for RomWBW v0.2, 27-Nov-2021",CR,LF |
|
|
|
; .DB "J.B. Langston/Marco Maccaferri/Phil Summers",CR,LF |
|
|
|
.DB 0 |
|
|
|
MSG_BADF: .DB "Not a VGM file",CR,LF,0 |
|
|
|
|