Subversion Repositories NedoOS

Rev

Rev 2421 | Blame | Compare with Previous | Last modification | View Log | Download

  1. PLAYERSTART = 0x4000
  2. PLAYEREND   = 0x8000
  3. SYSTEM_MEMORY_END = 0x200 ;must not touch memory below this address
  4.  
  5.         macro PLAYERHEADER customui
  6.         db 0xc3 : dw playerinit      ;called once, should check if sound device is available (if possible)
  7.         db 0xc3 : dw playerdeinit    ;called once when the application is exiting
  8.         db 0xc3 : dw musicload       ;function that loads the file allocating all required resources
  9.         db 0xc3 : dw musicunload     ;function that frees all resources allocated in musicload and mutes the sound device
  10.         db 0xc3 : dw musicplay       ;function called in the main loop, should update progress variable
  11.         db 0xc3 : dw isfilesupported ;function to determine if this player can handle the file
  12.         dw playernamestr ;player name string
  13.         dw 0             ;address of error string
  14.         dw customui      ;address of custom UI elements
  15.         endm
  16.  
  17. PLAYERINITPROCADDR      = PLAYERSTART+0x01
  18. PLAYERDEINITPROCADDR    = PLAYERSTART+0x04
  19. MUSICLOADPROCADDR       = PLAYERSTART+0x07
  20. MUSICUNLOADPROCADDR     = PLAYERSTART+0x0a
  21. MUSICPLAYPROCADDR       = PLAYERSTART+0x0d
  22. ISFILESUPPORTEDPROCADDR = PLAYERSTART+0x10
  23. PLAYERNAMESTRADDR       = PLAYERSTART+0x12
  24. ERRORSTRINGADDR         = PLAYERSTART+0x14
  25. CUSTOMUIADDR            = PLAYERSTART+0x16
  26.  
  27.         struct GPSETTINGS
  28. drawprogresscallback dw 0
  29. drawcustomui dw 0
  30. usemp3 dw 0
  31. usemwm dw 0
  32. usept3 dw 0
  33. usevgm dw 0
  34. usemoonmod dw 0
  35. usemoonmid dw 0
  36. moonmoddefaultpanning dw 0
  37. midiuartdelayoverride dw 0
  38. mididevice dw 0
  39. moddevice dw 0
  40. slowtfm dw 0
  41. slowmidiuart dw 0
  42. framelength dw 0 ;in 42 t-states units
  43. moonsoundstatus ds 1 ; 0 - no device, 1 - BomgeMoon or MoonSound with old firmware (wave ports not working), 2 - MoonSound OK
  44. tfmstatus ds 1 ; 0 - no device, 1 - TFM, 2 - slow TFM
  45. opmstatus ds 1 ; 0 - no device, 1 - single YM2151, 2 - dual YM2151
  46. opnastatus ds 1 ; 0 - no device, 1 - found YM2608
  47. sharedpages ds 3
  48.         ends
  49.  
  50. DEVICE_AY_BIT         = 0
  51. DEVICE_TURBOSOUND_BIT = 1
  52. DEVICE_TFM_BIT        = 2
  53. DEVICE_MOONSOUND_BIT  = 3
  54. DEVICE_GS_BIT         = 4
  55. DEVICE_NEOGS_BIT      = 5
  56. DEVICE_MIDI_UART_BIT  = 6
  57. DEVICE_OPM_BIT        = 7
  58. DEVICE_DUAL_OPM_BIT   = 8
  59. DEVICE_OPNA_BIT       = 9
  60.  
  61. DEVICE_AY_MASK         = 1<<DEVICE_AY_BIT
  62. DEVICE_TURBOSOUND_MASK = 1<<DEVICE_TURBOSOUND_BIT
  63. DEVICE_TFM_MASK        = 1<<DEVICE_TFM_BIT
  64. DEVICE_MOONSOUND_MASK  = 1<<DEVICE_MOONSOUND_BIT
  65. DEVICE_GS_MASK         = 1<<DEVICE_GS_BIT
  66. DEVICE_NEOGS_MASK      = 1<<DEVICE_NEOGS_BIT
  67. DEVICE_MIDI_UART_MASK  = 1<<DEVICE_MIDI_UART_BIT
  68. DEVICE_OPM_MASK        = 1<<DEVICE_OPM_BIT
  69. DEVICE_DUAL_OPM_MASK   = 1<<DEVICE_DUAL_OPM_BIT
  70. DEVICE_OPNA_MASK       = 1<<DEVICE_OPNA_BIT
  71.  
  72. MIN_FRAME_LENGTH_FPGA  = 18000000/49/42
  73. MIN_FRAME_LENGTH_ZXEVO = 10000000/49/42
  74.  
  75. COLOR_DEFAULT = 0x07
  76. COLOR_PANEL = 0x4f
  77. COLOR_CURSOR = 0x28
  78. COLOR_PANEL_FILE = 0x0f
  79. COLOR_PANEL_DIR = 0x4f
  80. COLOR_PANEL_DRIVE = 0x4b
  81. COLOR_ERROR_WINDOW = 0x17
  82.  
  83. CUSTOM_UI_CMD_DRAW_WINDOW          = 0 ;draws window
  84. CUSTOM_UI_CMD_PRINT_TEXT           = 1 ;prints text at the specified cursor position
  85. CUSTOM_UI_CMD_SET_COLOR            = 2 ;affects subsequent drawing and text output
  86. CUSTOM_UI_CMD_PLAYER_WINDOW        = 3 ;redraw is special and managed by shared UI code
  87. CUSTOM_UI_CMD_PLAYER_WINDOW_TITLE  = 4 ;autogenerated player window title string
  88. CUSTOM_UI_CMD_PLAY_TIME            = 5 ;shows elapsed time in mm:ss format
  89. CUSTOM_UI_CMD_PLAY_PROGRESS        = 6 ;shows progress bar or loading message
  90. CUSTOM_UI_CMD_SONG_TITLE           = 7 ;prints song title or filename if string is empty
  91. CUSTOM_UI_CMD_SEPARATOR            = 8 ;draws a visual separator
  92. CUSTOM_UI_CMD_COUNT                = 9 ;number of custom UI commands
  93.  
  94.         struct CUSTOMUIDRAWEND
  95. cmd db CUSTOM_UI_CMD_COUNT
  96.         ends
  97.  
  98.         struct CUSTOMUIDRAWWINDOW
  99. cmd db CUSTOM_UI_CMD_DRAW_WINDOW
  100. topleftx db 0
  101. toplefty db 0
  102. clientwidth db 0
  103. clientheight db 0
  104.         ends
  105.  
  106.         struct CUSTOMUIPRINTTEXT
  107. cmd db CUSTOM_UI_CMD_PRINT_TEXT
  108. posx db 0
  109. posy db 0
  110. straddr dw 0
  111.         ends
  112.  
  113.         struct CUSTOMUISETCOLOR
  114. cmd db CUSTOM_UI_CMD_SET_COLOR
  115. color db 0
  116.         ends
  117.  
  118.         struct CUSTOMUIPLAYERWINDOW
  119. cmd db CUSTOM_UI_CMD_PLAYER_WINDOW
  120. topleftx db 0
  121. toplefty db 0
  122. clientwidth db 0
  123. clientheight db 0
  124.         ends
  125.  
  126.         struct CUSTOMUIPLAYERWINDOWTITLE
  127. cmd db CUSTOM_UI_CMD_PLAYER_WINDOW_TITLE
  128. posx db 0
  129. posy db 0
  130.         ends
  131.  
  132.         struct CUSTOMUIPLAYTIME
  133. cmd db CUSTOM_UI_CMD_PLAY_TIME
  134. posx db 0
  135. posy db 0
  136. color dw COLOR_CURSOR
  137.         ends
  138.  
  139.         struct CUSTOMUISONGTITLE
  140. cmd db CUSTOM_UI_CMD_SONG_TITLE
  141. posx db 0
  142. posy db 0
  143. straddr dw 0
  144.         ends
  145.  
  146.         struct CUSTOMUIPLAYPROGRESS
  147. cmd db CUSTOM_UI_CMD_PLAY_PROGRESS
  148. posx db 0
  149. posy db 0
  150. counteraddr dw 0
  151. color dw COLOR_PANEL_DIR
  152.         ends
  153.  
  154.         struct CUSTOMUISEPARATOR
  155. cmd db CUSTOM_UI_CMD_SEPARATOR
  156. posx db 0
  157. posy db 0
  158. middlecharcount db 0
  159. middlechar db 196
  160. leftchar db 199
  161. rightchar db 182
  162.         ends
  163.  
  164.         macro PROGRESSIVEPLAYERWINDOWTEMPLATE songtitle,progresscounter
  165.         CUSTOMUIPLAYERWINDOW ,6,8,66,4
  166.         CUSTOMUIPLAYERWINDOWTITLE ,8,8
  167.         CUSTOMUISONGTITLE ,8,10,songtitle
  168.         CUSTOMUIPLAYPROGRESS ,8,11,progresscounter
  169.         CUSTOMUIPLAYTIME ,67,8
  170.         CUSTOMUIDRAWEND
  171.         endm
  172.  
  173.         macro PLAYERWINDOWTEMPLATE songtitle
  174.         CUSTOMUIPLAYERWINDOW ,12,8,54,3
  175.         CUSTOMUIPLAYERWINDOWTITLE ,14,8
  176.         CUSTOMUISONGTITLE ,14,10,songtitle
  177.         CUSTOMUIPLAYPROGRESS ,255
  178.         CUSTOMUIPLAYTIME ,61,8
  179.         CUSTOMUIDRAWEND
  180.         endm
  181.  
  182.         macro PROGRESSIVELOADINGWINDOWTEMPLATE windowtitlestr,progresscounter
  183.         CUSTOMUISETCOLOR ,COLOR_PANEL
  184.         CUSTOMUIDRAWWINDOW ,6,8,66,4
  185.         CUSTOMUISETCOLOR ,COLOR_CURSOR
  186.         CUSTOMUIPRINTTEXT ,8,8,windowtitlestr
  187.         CUSTOMUISONGTITLE ,8,10,0
  188.         CUSTOMUIPLAYPROGRESS ,8,11,progresscounter,7
  189.         CUSTOMUIDRAWEND
  190.         endm
  191.