PLAYERSTART = 0x4000
PLAYEREND = 0x8000
SYSTEM_MEMORY_END = 0x200 ;must not touch memory below this address
macro PLAYERHEADER customui
db 0xc3 : dw playerinit ;called once, should check if sound device is available (if possible)
db 0xc3 : dw playerdeinit ;called once when the application is exiting
db 0xc3 : dw musicload ;function that loads the file allocating all required resources
db 0xc3 : dw musicunload ;function that frees all resources allocated in musicload and mutes the sound device
db 0xc3 : dw musicplay ;function called in the main loop, should update progress variable
db 0xc3 : dw isfilesupported ;function to determine if this player can handle the file
dw playernamestr ;player name string
dw 0 ;address of error string
dw customui ;address of custom UI elements
endm
PLAYERINITPROCADDR = PLAYERSTART+0x01
PLAYERDEINITPROCADDR = PLAYERSTART+0x04
MUSICLOADPROCADDR = PLAYERSTART+0x07
MUSICUNLOADPROCADDR = PLAYERSTART+0x0a
MUSICPLAYPROCADDR = PLAYERSTART+0x0d
ISFILESUPPORTEDPROCADDR = PLAYERSTART+0x10
PLAYERNAMESTRADDR = PLAYERSTART+0x12
ERRORSTRINGADDR = PLAYERSTART+0x14
CUSTOMUIADDR = PLAYERSTART+0x16
struct GPSETTINGS
drawprogresscallback dw 0
drawcustomui dw 0
usemp3 dw 0
usemwm dw 0
usept3 dw 0
usevgm dw 0
usemoonmod dw 0
usemoonmid dw 0
moonmoddefaultpanning dw 0
midiuartdelayoverride dw 0
mididevice dw 0
moddevice dw 0
slowtfm dw 0
slowmidiuart dw 0
framelength dw 0 ;in 42 t-states units
moonsoundstatus ds 1 ; 0 - no device, 1 - BomgeMoon or MoonSound with old firmware (wave ports not working), 2 - MoonSound OK
tfmstatus ds 1 ; 0 - no device, 1 - TFM, 2 - slow TFM
opmstatus ds 1 ; 0 - no device, 1 - single YM2151, 2 - dual YM2151
opnastatus ds 1 ; 0 - no device, 1 - found YM2608
sharedpages ds 3
ends
DEVICE_AY_BIT = 0
DEVICE_TURBOSOUND_BIT = 1
DEVICE_TFM_BIT = 2
DEVICE_MOONSOUND_BIT = 3
DEVICE_GS_BIT = 4
DEVICE_NEOGS_BIT = 5
DEVICE_MIDI_UART_BIT = 6
DEVICE_OPM_BIT = 7
DEVICE_DUAL_OPM_BIT = 8
DEVICE_OPNA_BIT = 9
DEVICE_AY_MASK = 1<<DEVICE_AY_BIT
DEVICE_TURBOSOUND_MASK = 1<<DEVICE_TURBOSOUND_BIT
DEVICE_TFM_MASK = 1<<DEVICE_TFM_BIT
DEVICE_MOONSOUND_MASK = 1<<DEVICE_MOONSOUND_BIT
DEVICE_GS_MASK = 1<<DEVICE_GS_BIT
DEVICE_NEOGS_MASK = 1<<DEVICE_NEOGS_BIT
DEVICE_MIDI_UART_MASK = 1<<DEVICE_MIDI_UART_BIT
DEVICE_OPM_MASK = 1<<DEVICE_OPM_BIT
DEVICE_DUAL_OPM_MASK = 1<<DEVICE_DUAL_OPM_BIT
DEVICE_OPNA_MASK = 1<<DEVICE_OPNA_BIT
MIN_FRAME_LENGTH_FPGA = 18000000/49/42
MIN_FRAME_LENGTH_ZXEVO = 10000000/49/42
COLOR_DEFAULT = 0x07
COLOR_PANEL = 0x4f
COLOR_CURSOR = 0x28
COLOR_PANEL_FILE = 0x0f
COLOR_PANEL_DIR = 0x4f
COLOR_PANEL_DRIVE = 0x4b
COLOR_ERROR_WINDOW = 0x17
CUSTOM_UI_CMD_DRAW_WINDOW = 0 ;draws window
CUSTOM_UI_CMD_PRINT_TEXT = 1 ;prints text at the specified cursor position
CUSTOM_UI_CMD_SET_COLOR = 2 ;affects subsequent drawing and text output
CUSTOM_UI_CMD_PLAYER_WINDOW = 3 ;redraw is special and managed by shared UI code
CUSTOM_UI_CMD_PLAYER_WINDOW_TITLE = 4 ;autogenerated player window title string
CUSTOM_UI_CMD_PLAY_TIME = 5 ;shows elapsed time in mm:ss format
CUSTOM_UI_CMD_PLAY_PROGRESS = 6 ;shows progress bar or loading message
CUSTOM_UI_CMD_SONG_TITLE = 7 ;prints song title or filename if string is empty
CUSTOM_UI_CMD_SEPARATOR = 8 ;draws a visual separator
CUSTOM_UI_CMD_COUNT = 9 ;number of custom UI commands
struct CUSTOMUIDRAWEND
cmd db CUSTOM_UI_CMD_COUNT
ends
struct CUSTOMUIDRAWWINDOW
cmd db CUSTOM_UI_CMD_DRAW_WINDOW
topleftx db 0
toplefty db 0
clientwidth db 0
clientheight db 0
ends
struct CUSTOMUIPRINTTEXT
cmd db CUSTOM_UI_CMD_PRINT_TEXT
posx db 0
posy db 0
straddr dw 0
ends
struct CUSTOMUISETCOLOR
cmd db CUSTOM_UI_CMD_SET_COLOR
color db 0
ends
struct CUSTOMUIPLAYERWINDOW
cmd db CUSTOM_UI_CMD_PLAYER_WINDOW
topleftx db 0
toplefty db 0
clientwidth db 0
clientheight db 0
ends
struct CUSTOMUIPLAYERWINDOWTITLE
cmd db CUSTOM_UI_CMD_PLAYER_WINDOW_TITLE
posx db 0
posy db 0
ends
struct CUSTOMUIPLAYTIME
cmd db CUSTOM_UI_CMD_PLAY_TIME
posx db 0
posy db 0
color dw COLOR_CURSOR
ends
struct CUSTOMUISONGTITLE
cmd db CUSTOM_UI_CMD_SONG_TITLE
posx db 0
posy db 0
straddr dw 0
ends
struct CUSTOMUIPLAYPROGRESS
cmd db CUSTOM_UI_CMD_PLAY_PROGRESS
posx db 0
posy db 0
counteraddr dw 0
color dw COLOR_PANEL_DIR
ends
struct CUSTOMUISEPARATOR
cmd db CUSTOM_UI_CMD_SEPARATOR
posx db 0
posy db 0
middlecharcount db 0
middlechar db 196
leftchar db 199
rightchar db 182
ends
macro PROGRESSIVEPLAYERWINDOWTEMPLATE songtitle,progresscounter
CUSTOMUIPLAYERWINDOW ,6,8,66,4
CUSTOMUIPLAYERWINDOWTITLE ,8,8
CUSTOMUISONGTITLE ,8,10,songtitle
CUSTOMUIPLAYPROGRESS ,8,11,progresscounter
CUSTOMUIPLAYTIME ,67,8
CUSTOMUIDRAWEND
endm
macro PLAYERWINDOWTEMPLATE songtitle
CUSTOMUIPLAYERWINDOW ,12,8,54,3
CUSTOMUIPLAYERWINDOWTITLE ,14,8
CUSTOMUISONGTITLE ,14,10,songtitle
CUSTOMUIPLAYPROGRESS ,255
CUSTOMUIPLAYTIME ,61,8
CUSTOMUIDRAWEND
endm
macro PROGRESSIVELOADINGWINDOWTEMPLATE windowtitlestr,progresscounter
CUSTOMUISETCOLOR ,COLOR_PANEL
CUSTOMUIDRAWWINDOW ,6,8,66,4
CUSTOMUISETCOLOR ,COLOR_CURSOR
CUSTOMUIPRINTTEXT ,8,8,windowtitlestr
CUSTOMUISONGTITLE ,8,10,0
CUSTOMUIPLAYPROGRESS ,8,11,progresscounter,7
CUSTOMUIDRAWEND
endm