Subversion Repositories NedoOS

Rev

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

  1. ; Player for NeoGS decoder chip (also GS/NeoGS .mod player)
  2. ; Supports a range of VLSI decoders: VS1001, VS1011, VS1003, VS1033, VS1053
  3.  
  4.         DEVICE ZXSPECTRUM128
  5.         include "../_sdk/sys_h.asm"
  6.         include "ngsdec/gscodedefs.asm"
  7.         include "ngsdec/gsports.asm"
  8.         include "ngsdec/vs10xx.asm"
  9.         include "playerdefs.asm"
  10.  
  11. BUFADDR = 0x8000
  12. BUFSIZE = 0x8000
  13.  
  14.         org PLAYERSTART
  15.  
  16. begin   PLAYERHEADER 0
  17.  
  18. FILETYPE_MP3 = 1
  19. FILETYPE_MOD = 2
  20. FILETYPE_MID = 3
  21.  
  22. isfilesupported
  23. ;cde = file extension
  24. ;out: zf=1 if this player can handle the file and the sound hardware is available, zf=0 otherwise
  25.         ld a,c
  26.         cp 'o'
  27.         jp nz,.checkaac
  28.         ld hl,'gg'
  29.         sbc hl,de
  30.         jp nz,.checkaac
  31.         ld a,(vsversion)
  32.         cp SS_VER_VS1053
  33.         jr z,.initmp3vars
  34.         cp SS_VER_VS1063
  35.         jr z,.initmp3vars
  36.         ret
  37. .checkaac
  38.         cp 'a'
  39.         jp nz,.checkmp3modmid
  40.         ld hl,'ac'
  41.         sbc hl,de
  42.         jp nz,.checkmp3modmid
  43.         ld a,(vsversion)
  44.         cp SS_VER_VS1053
  45.         jr z,.initmp3vars
  46.         cp SS_VER_VS1033
  47.         jr z,.initmp3vars
  48.         cp SS_VER_VS1063
  49.         jr z,.initmp3vars
  50.         ret
  51. .checkmp3modmid
  52.         cp 'm'
  53.         ret nz
  54.         ld hl,'od'
  55.         sbc hl,de
  56. .disablemod=$+1
  57.         jr z,.initmodvars
  58.         ld hl,'id'
  59.         sub hl,de
  60. .disablemid=$+1
  61.         jr z,.checkmid
  62.         ld hl,'p3'
  63.         sub hl,de
  64.         ret nz
  65. .initmp3vars
  66.         ld hl,0
  67.         ld (CUSTOMUIADDR),hl
  68.         ld a,FILETYPE_MP3
  69.         ld (filetype),a
  70.         ret
  71. .initmodvars
  72.         ld hl,modplayerwindowloading
  73.         ld (CUSTOMUIADDR),hl
  74.         ld a,FILETYPE_MOD
  75.         ld (filetype),a
  76.         ret
  77. .checkmid
  78.         ld a,(vsversion)
  79.         cp SS_VER_VS1053
  80.         jr z,.initmidvars
  81.         cp SS_VER_VS1003
  82.         jr z,.initmidvars
  83.         cp SS_VER_VS1033
  84.         jr z,.initmidvars
  85.         cp SS_VER_VS1103
  86.         ret nz
  87. .initmidvars
  88.         ld hl,midiplayerwindowui
  89.         ld (CUSTOMUIADDR),hl
  90.         ld a,FILETYPE_MID
  91.         ld (filetype),a
  92.         ret
  93.  
  94. cleanupvars
  95. ;out: zf=0 so this function can be used as error handler
  96.         xor a
  97.         ld (titlestr),a
  98.         ld (filechunkcounter+0),a
  99.         ld (filechunkcounter+1),a
  100.         ld (filetype),a
  101.         dec a
  102.         ld (streaminfobyte),a
  103.         jp initprogress
  104.  
  105. isfilesupportedgsonly
  106. ;specialized function for GeneralSound
  107.         ld a,c
  108.         cp 'm'
  109.         ret nz
  110.         ld hl,'od'
  111.         sbc hl,de
  112.         ret nz
  113.         jr isfilesupported.initmodvars
  114.  
  115. ismodenabled
  116. ;output: zf=1 if .mod is enabled on this device, zf=0 otherwise
  117.         ld de,(ix+GPSETTINGS.moddevice)
  118.         ld a,d
  119.         or e
  120.         ret z
  121.         ld a,(de)
  122.         cp '0'
  123.         ret z
  124.         cp '2'
  125.         ret
  126.  
  127. checkmididevicesettings
  128. ;output: zf=1 if this player is enabled, zf=0 otherwise
  129.         ld de,(ix+GPSETTINGS.mididevice)
  130.         ld a,d
  131.         or e
  132.         ret z
  133.         ld a,(de)
  134.         cp '0'
  135.         ret z
  136.         cp '2'
  137.         ret z
  138.         ld a,0
  139.         ld (isfilesupported.disablemid),a
  140.         ret
  141.  
  142. playerinit
  143. ;ix = GPSETTINGS
  144. ;a = player page
  145. ;out: zf=1 if init is successful, hl=init message
  146.         ld (.settingsaddr),ix
  147.         ld a,(ix+GPSETTINGS.sharedpages)
  148.         ld (page8000),a
  149.         ld a,(ix+GPSETTINGS.sharedpages+1)
  150.         ld (pageC000),a
  151.         ld hl,(ix+GPSETTINGS.drawprogresscallback)
  152.         ld (drawloadingprogress.callback),hl
  153.         ld hl,(ix+GPSETTINGS.drawcustomui)
  154.         ld (drawcustomui.callback),hl
  155.         call cleanupvars
  156. ;       call gssoftreset
  157. ;b==0 if no reply from GS
  158. ;       dec b
  159. ;       inc b
  160. ;       call z,gshardreset
  161.         call gshardreset
  162. ;b==0 if no reply from GS
  163.         ld a,b
  164.         cp 1
  165.         ld hl,nodevicestr
  166.         ret c
  167. ;get chip id
  168.         call gsstartcode
  169.         SC CMDGETCHIPID
  170.         WC
  171.         WN
  172.         GD
  173.         ld (vsversion),a
  174.         call gscodereset
  175. .settingsaddr=$+2
  176.         ld ix,0
  177.         ld a,(vsversion)
  178.         cp SS_VER_VS1103+1
  179.         jr nc,.initgsonly
  180.         rrca
  181.         rrca
  182.         add a,idtostr%256
  183.         ld l,a
  184.         adc a,idtostr/256
  185.         sub l
  186.         ld h,a
  187.         ld de,chipidstr
  188.         ld bc,4
  189.         ldir
  190.         call ismodenabled
  191.         jr z,$+6
  192.         xor a
  193.         ld (isfilesupported.disablemod),a
  194.         call checkmididevicesettings
  195.         xor a
  196.         ld hl,ngsinitokstr
  197.         ret
  198. .initgsonly
  199.         call ismodenabled
  200.         ld hl,playerdisabledstr
  201.         ret nz
  202.         ld hl,isfilesupportedgsonly
  203.         ld (ISFILESUPPORTEDPROCADDR),hl
  204.         xor a
  205.         ld hl,gsinitokstr
  206.         ret
  207.  
  208. playerdeinit
  209.         ret
  210.  
  211. musicload
  212. ;cde = file extension
  213. ;hl = input file name
  214. ;out: hl = device mask, zf=1 if the file is ready for playing, zf=0 otherwise
  215.         push hl
  216.         ld a,(filetype)
  217.         cp FILETYPE_MP3
  218.         jr nz,.skipmp3setup
  219.         ld hl,mp3playerwindowui
  220.         ld (CUSTOMUIADDR),hl
  221.         call setdefaultstreaminfoui
  222. .skipmp3setup
  223.         pop de
  224.         call openstream_file
  225.         or a
  226.         jp nz,cleanupvars
  227. page8000=$+1
  228.         ld a,0
  229.         SETPG8000
  230. pageC000=$+1
  231.         ld a,0
  232.         SETPGC000
  233.         ld a,(filetype)
  234.         cp FILETYPE_MOD
  235.         jr z,loadmod
  236.         cp FILETYPE_MID
  237.         jr nz,.skipmidicheck
  238.         ld hl,16
  239.         ld de,BUFADDR
  240.         call readstream_file
  241.         call checksmf0
  242.         jr z,.donemidicheck
  243.         ld hl,smf0errorui | 0x8000
  244.         ld (ERRORSTRINGADDR),hl
  245.         call closestream_file
  246.         jp cleanupvars
  247. .donemidicheck
  248.         ld a,(filehandle)
  249.         ld b,a
  250.         ld hl,0
  251.         ld de,hl
  252.         OS_SEEKHANDLE
  253. .skipmidicheck
  254.         ld a,(filehandle)
  255.         ld b,a
  256.         OS_GETFILESIZE
  257.         ld a,e
  258.         call setprogressdelta
  259.         call gsstartcode
  260.         ld hl,firstpaddingframedata
  261.         ld (paddingframedataptr),hl
  262.         ld hl,0
  263.         ld (paddingframecount),hl
  264.         ld (bufferdataleft),hl
  265.         ld hl,DEVICE_NEOGS_MASK
  266.         xor a
  267.         ret
  268.  
  269. checksmf0
  270.         ld hl,(BUFADDR)
  271.         ld de,"TM"
  272.         sub de,hl
  273.         ret nz
  274.         ld hl,(BUFADDR+2)
  275.         ld de,"dh"
  276.         sbc de,hl
  277.         ret nz
  278.         ld hl,(BUFADDR+8)
  279.         ld de,0
  280.         sbc hl,de      
  281.         ret
  282.  
  283. TITLELENGTH = 64
  284.  
  285. loadmod
  286. ;setup loading progress
  287.         ld (.savedsp),sp
  288.         ld a,(filehandle)
  289.         ld b,a
  290.         OS_GETFILESIZE
  291.         ld a,e
  292.         ld de,0x7fff
  293.         add hl,de
  294.         adc a,0
  295.         add hl,hl
  296.         rla
  297.         call setprogressdelta
  298. ;start loading
  299.         ld hl,BUFSIZE
  300.         ld de,BUFADDR
  301.         call readstream_file
  302.         push hl
  303. ;get pattern count
  304.         call getmodtype
  305.         ld a,(BUFADDR+950)
  306.         jr z,$+5
  307.         ld a,(BUFADDR+470)
  308.         ld (.pattnum),a
  309. ;set title
  310.         ld hl,titlestr
  311.         ld de,BUFADDR
  312.         ld b,TITLELENGTH+1
  313. .copytitleloop
  314.         ld a,(de)
  315.         ld (hl),a
  316.         inc de
  317.         inc hl
  318.         dec b
  319.         or a
  320.         jr nz,.copytitleloop
  321.         dec hl
  322. .filltitleloop
  323.         ld (hl),' '
  324.         inc hl
  325.         djnz .filltitleloop
  326.         ld (hl),0
  327. ;load module
  328.         SC 0x30
  329.         WC
  330. ;open stream
  331.         SC 0xD1
  332.         WC
  333. ;upload file
  334.         pop bc
  335.         ld d,0
  336. .uploadnextchunk
  337.         inc d
  338.         push de
  339.         ld hl,BUFADDR
  340.         ld a,c
  341.         dec bc
  342.         inc b
  343.         ld c,b
  344.         ld b,a
  345. .uploadloop
  346.         ld a,(hl)
  347.         out (GSDAT),a
  348.         WD
  349.         inc hl
  350.         djnz .uploadloop
  351.         dec c
  352.         jr nz,.uploadloop
  353.         ld a,d
  354.         call updateprogress
  355.         call drawloadingprogress
  356.         jr nz,.cancelloading
  357.         ld hl,BUFSIZE
  358.         ld de,BUFADDR
  359.         call readstream_file
  360.         ld bc,hl
  361.         pop de
  362.         ld a,b
  363.         or c
  364.         jr nz,.uploadnextchunk
  365.         call closestream_file
  366. ;close stream
  367.         SC 0xD2
  368.         WC
  369. ;play module
  370.         ld a,1
  371.         out (GSDAT),a
  372.         SC 0x31
  373.         WC
  374. ;finalize
  375.         call initprogress
  376. .pattnum=$+1
  377.         ld a,0
  378.         call setprogressdelta
  379.         ld hl,modplayerwindowui
  380.         ld (CUSTOMUIADDR),hl
  381.         xor a
  382.         ld (currentposition),a
  383.         ld hl,DEVICE_GS_MASK
  384.         ret
  385. .cancelloading
  386. .savedsp=$+1
  387.         ld sp,0
  388.         call closestream_file
  389. ;cold reset because warm reset hangs randomly if stream is not closed
  390.         SC 0xf4
  391.         WC
  392.         jp cleanupvars
  393.  
  394. drawloadingprogress
  395. .callback=$+1
  396.         jp 0
  397.  
  398. drawcustomui
  399. .callback=$+1
  400.         jp 0
  401.  
  402. musicunload
  403.         ld a,(filetype)
  404.         cp FILETYPE_MOD
  405.         jr z,.unloadmod
  406.         call closestream_file
  407.         ld hl,cleanupvars
  408.         push hl
  409.         ld a,(filetype)
  410.         cp FILETYPE_MID
  411.         jp nz,gscodereset
  412. ;gscodereset didn't always work for extremely slow MIDI streams
  413.         ld a,C_GRST
  414.         out (GSCTR),a
  415.         ret
  416. .unloadmod
  417. ;warm reset
  418.         SC 0xf3
  419.         WC
  420.         ret
  421.  
  422. musicplay
  423. ;out: zf=0 if still playing, zf=1 otherwise
  424. filetype=$+1
  425.         ld a,0
  426.         cp FILETYPE_MOD
  427.         jp z,playmod
  428. bufferreadptr=$+1
  429.         ld hl,0
  430. bufferdataleft=$+1
  431.         ld bc,0
  432.         ld a,c
  433.         or b
  434.         jr nz,.checkifcanupload
  435. .readfilechunk
  436.         ld hl,(paddingframecount)
  437.         ld de,150
  438.         sub hl,de
  439.         sbc a
  440.         ret z
  441.         call readdata
  442.         ld hl,BUFADDR
  443.         ex de,hl
  444.         sub hl,de
  445.         ld b,l
  446.         dec hl
  447.         inc h
  448.         ld c,h
  449.         ex de,hl
  450.         jr .checkifcanupload
  451. .uploaddataloop
  452.         ld a,(hl)
  453.         out (GSDAT),a
  454.         WD
  455.         inc hl
  456.         djnz .uploaddataloop
  457.         dec c
  458.         jr z,.readfilechunk          ;done uploading current chunk
  459.         bit 0,c
  460.         jr z,.uploaddataloop         ;poll GS once per 512 bytes
  461. .checkifcanupload
  462.         SC CMDGETFREEBUFFERSPACE
  463.         WC
  464.         WN
  465.         GD
  466.         cp 6
  467.         jr nc,.uploaddataloop       ;keep uploading until we have less than 1024 free buffer space
  468.         ld (bufferreadptr),hl
  469.         ld (bufferdataleft),bc
  470.         SC CMDGETSTREAMINFO
  471.         WC
  472.         WN
  473.         GD
  474. streaminfobyte=$+1
  475.         ld b,255
  476.         cp b
  477.         call nz,updatestreaminfo
  478.         YIELD
  479.         or 1
  480.         ret
  481.  
  482. updatestreaminfo
  483.         ld (streaminfobyte),a
  484.         cp 255
  485.         jr z,.decoderidle
  486.         ld c,a
  487. ;update bitrate
  488.         and 31
  489.         add a,a
  490.         add a,a
  491.         add a,a
  492.         add a,mp3bitratearraystr%256
  493.         ld l,a
  494.         adc a,mp3bitratearraystr/256
  495.         sub l
  496.         ld h,a
  497.         ld (mp3bitratetext+CUSTOMUIPRINTTEXT.straddr),hl
  498.         ld a,b
  499.         inc b
  500.         jr z,.forcefullupdate
  501.         xor c
  502.         and %11100000
  503.         ld ix,bitrateonlyui
  504.         jp z,drawcustomui
  505. .forcefullupdate
  506.         bit 7,c
  507.         jr z,.notmpeg
  508.         ld hl,decodermpegstr
  509.         ld (mp3codectext+CUSTOMUIPRINTTEXT.straddr),hl
  510.         ld a,c
  511.         rlca
  512.         rlca
  513.         rlca
  514.         and 3
  515.         ld b,a
  516.         add a,a
  517.         add a,a
  518.         ld c,a
  519.         add a,a
  520.         add a,b
  521.         add a,c ;a*13
  522.         add a,mp3modes%256
  523.         ld l,a
  524.         adc a,mp3modes/256
  525.         sub l
  526.         ld h,a
  527.         ld (mp3modetext+CUSTOMUIPRINTTEXT.straddr),hl
  528.         ld ix,allstreamstatsui
  529.         jp drawcustomui
  530. .decoderidle
  531.         call setdefaultstreaminfoui
  532.         ld ix,allstreamstatsui
  533.         jp drawcustomui
  534. .notmpeg
  535.         bit 6,c
  536.         ld hl,decoderaacstr
  537.         jr z,$+5
  538.         ld hl,decoderoggstr
  539.         ld (mp3codectext+CUSTOMUIPRINTTEXT.straddr),hl
  540.         ld hl,emptyfieldstr
  541.         ld (mp3modetext+CUSTOMUIPRINTTEXT.straddr),hl
  542.         ld ix,allstreamstatsui
  543.         jp drawcustomui
  544.  
  545. setdefaultstreaminfoui
  546.         ld hl,emptyfieldstr
  547.         ld (mp3codectext+CUSTOMUIPRINTTEXT.straddr),hl
  548.         ld (mp3modetext+CUSTOMUIPRINTTEXT.straddr),hl
  549.         ld (mp3bitratetext+CUSTOMUIPRINTTEXT.straddr),hl
  550.         ret
  551.  
  552. mp3bitratearraystr
  553.         db "8Kbps  ",0
  554.         db "16Kbps ",0
  555.         db "24Kbps ",0
  556.         db "32Kbps ",0
  557.         db "40Kbps ",0
  558.         db "48Kbps ",0
  559.         db "56Kbps ",0
  560.         db "64Kbps ",0
  561.         db "80Kbps ",0
  562.         db "96Kbps ",0
  563.         db "112Kbps",0
  564.         db "128Kbps",0
  565.         db "144Kbps",0
  566.         db "160Kbps",0
  567.         db "176Kbps",0
  568.         db "192Kbps",0
  569.         db "224Kbps",0
  570.         db "256Kbps",0
  571.         db "288Kbps",0
  572.         db "320Kbps",0
  573.         db "352Kbps",0
  574.         db "384Kbps",0
  575.         db "416Kbps",0
  576.         db "448Kbps",0
  577.         ; emptyfieldstr
  578.  
  579. emptyfieldstr  db "-              ",0
  580. decoderaacstr  db "AAC (ADTS/ADIF)",0
  581. decoderoggstr  db "Ogg Vorbis     ",0
  582. decodermpegstr db "MPEG Audio     ",0
  583.  
  584. mp3modes
  585.         db "Stereo      ",0
  586.         db "Joint Stereo",0
  587.         db "Dual Channel",0
  588.         db "Mono        ",0
  589.  
  590. playmod
  591.         YIELD
  592. ;update progress
  593.         SC 0x60
  594.         WC
  595.         WN
  596.         GD
  597.         push af
  598.         call updateprogress
  599.         pop af
  600. ;check if the position is increasing monotonically
  601.         ld hl,currentposition
  602.         cp (hl)
  603.         ld (hl),a
  604.         ccf
  605.         sbc a
  606.         ret
  607.  
  608. readdata
  609. ;out: de = past-the-end data pointer
  610.         ld hl,(paddingframecount)
  611.         ld a,l
  612.         or h
  613.         ld hl,BUFSIZE
  614.         ld de,BUFADDR
  615.         jr nz,writepadding
  616.         call readstream_file
  617.         ld bc,hl
  618.         ld hl,BUFADDR
  619.         add hl,bc
  620.         ex de,hl
  621.         ld hl,BUFSIZE
  622.         sub hl,bc
  623.         jr nz,writepadding
  624. ;update progress
  625.         ld hl,(filechunkcounter)
  626.         ld de,BUFSIZE>>8 ;256 bytes chunks
  627.         add hl,de
  628.         ld (filechunkcounter),hl
  629.         ld a,h
  630.         call updateprogress
  631.         ld de,(BUFADDR+BUFSIZE)%65536
  632.         ret
  633.  
  634. writepadding
  635.         ld bc,paddingframedata_end-paddingframedata
  636.         sub hl,bc
  637.         ret c
  638.         push hl
  639. paddingframedataptr=$+1
  640.         ld hl,0
  641.         ldir
  642.         ld hl,paddingframedata
  643.         ld (paddingframedataptr),hl
  644. paddingframecount=$+1
  645.         ld hl,0
  646.         inc hl
  647.         ld (paddingframecount),hl
  648.         pop hl
  649.         jr writepadding
  650.  
  651. gshardreset
  652. ;out: b!=0 if got reply from GS, b==0 otherwise
  653.         ld a,C_GRST
  654.         out (GSCTR),a               ;hw reset
  655.         YIELD
  656.         YIELD
  657.         YIELD
  658. gssoftreset
  659.         SC 0xf3                     ;GS reset
  660.         ld b,50                     ;max spins
  661. wcloop
  662.         push bc
  663.         YIELD
  664.         pop bc
  665.         dec b
  666.         ret z
  667.         in a,(GSCOM)
  668.         rrca
  669.         jr c,wcloop
  670.         ret
  671.  
  672. gsstartcode
  673.         ld bc,GSDAT
  674.         ld de,gscode_end-gscode
  675.         ld hl,GSPROGSTART
  676.         out (c),e
  677.         SC 0x14
  678.         WC
  679.         out (c),d
  680.         WD
  681.         out (c),l
  682.         WD
  683.         out (c),h
  684.         WD
  685. ;start upload
  686.         ld hl,gscode
  687. .uploadloop
  688.         outi
  689.         WD
  690.         dec de
  691.         ld a,d
  692.         or e
  693.         jr nz,.uploadloop
  694. ;launch the code
  695.         ld hl,GSPROGSTART
  696.         out (c),l
  697.         SC 0x13
  698.         WC
  699.         out (c),h
  700.         WD
  701. ;the code is starting
  702.         YIELD
  703.         YIELD
  704.         YIELD
  705.         ret
  706.  
  707. getmodtype
  708. ;https://github.com/psbhlw/gs-firmware/blob/6c783a56147511b43d197e4079e993c2b94b4f12/firmware/src/PLAY.a80#L27
  709. ;out: zf=0 for SoundTracker 4/15 file, zf=1 otherwise
  710.         LD A,(BUFADDR+1080)
  711.         CP "M"
  712.         JR Z,TTY1
  713.         CP "4"
  714.         JR Z,TTY1
  715.         CP "F"
  716.         JR Z,TTY1
  717.         ret
  718. TTY1    LD A,(BUFADDR+1081)
  719.         CP "."
  720.         JR Z,TTY2
  721.         CP "L"
  722.         JR Z,TTY2
  723.         CP "!"
  724.         JR Z,TTY2
  725.         CP "C"
  726.         JR Z,TTY2
  727.         ret
  728. TTY2    LD A,(BUFADDR+1082)
  729.         CP "K"
  730.         ret z
  731.         CP "T"
  732.         ret z
  733.         CP "H"
  734.         ret
  735.  
  736. gscodereset
  737.         SC CMDRESET
  738.         WC
  739.         ret
  740.  
  741. firstpaddingframedata
  742.         db 0xFF,0xFB,0x90,0x64,0x00,0x0F,0xF0,0x00,0x00
  743.         db 0x69,0x00,0x00,0x00,0x08,0x00,0x00,0x0D,0x20
  744.         db 0x00,0x00,0x01,0x00,0x00,0x01,0xA4,0x00,0x00
  745.         db 0x00,0x20,0x00,0x00,0x34,0x80,0x00,0x00,0x04
  746.         ds 381,0x55
  747. firstpaddingframedata_end
  748.  
  749. paddingframedata
  750.         db 0xFF,0xFB,0x90,0x64,0x40,0x8F,0xF0,0x00,0x00
  751.         db 0x69,0x00,0x00,0x00,0x08,0x00,0x00,0x0D,0x20
  752.         db 0x00,0x00,0x01,0x00,0x00,0x01,0xA4,0x00,0x00
  753.         db 0x00,0x20,0x00,0x00,0x34,0x80,0x00,0x00,0x04
  754.         ds 381,0x55
  755. paddingframedata_end
  756.  
  757.  
  758. gscode
  759.         incbin "gscode.bin"
  760. gscode_end
  761.  
  762.         include "../_sdk/file.asm"
  763.         include "progress.asm"
  764.  
  765. SS_VER_VS1001 = 0x00
  766. SS_VER_VS1011 = 0x10
  767. SS_VER_VS1002 = 0x20
  768. SS_VER_VS1003 = 0x30
  769. SS_VER_VS1053 = 0x40
  770. SS_VER_VS8053 = 0x40
  771. SS_VER_VS1033 = 0x50
  772. SS_VER_VS1063 = 0x60
  773. SS_VER_VS1103 = 0x70
  774.  
  775. vsversion
  776.         db 255
  777. idtostr
  778.         db "1001"
  779.         db "1011"
  780.         db "1002"
  781.         db "1003"
  782.         db "1053"
  783.         db "1033"
  784.         db "1063"
  785. ngsinitokstr
  786.         db "NeoGS with VS"
  787. chipidstr
  788.         db "????\r\n",0
  789. gsinitokstr
  790.         db "GS\r\n",0
  791. nodevicestr
  792.         db "no device!\r\n",0
  793. playernamestr
  794.         db "GS/NeoGS",0
  795. playerdisabledstr
  796.         db "disabled!\r\n",0
  797. loadingtitlestr
  798.         db "Loading tracker module...",0
  799. modplayerwindowloading
  800.         PROGRESSIVELOADINGWINDOWTEMPLATE loadingtitlestr,musicprogress+1
  801. modplayerwindowui
  802.         PROGRESSIVEPLAYERWINDOWTEMPLATE titlestr,musicprogress+1
  803. midiplayerwindowui
  804.         PLAYERWINDOWTEMPLATE 0
  805.  
  806. smf0error1str db "MIDI file must be in SMF format 0! Please convert it using",0
  807. smf0error2str db "GN1:0 MIDI Converter http://www.gnmidi.com/gn1to0.zip",0
  808. errorwindowheaderstr db "Error",0
  809.  
  810. smf0errorui
  811.         CUSTOMUIDRAWWINDOW ,7,8,60,4
  812.         CUSTOMUIPRINTTEXT ,9,8,errorwindowheaderstr
  813.         CUSTOMUIPRINTTEXT ,9,10,smf0error1str
  814.         CUSTOMUIPRINTTEXT ,12,11,smf0error2str
  815.         CUSTOMUIDRAWEND
  816.  
  817. codectextstr db "Codec:",0
  818. bitratetextstr db "Bitrate:",0
  819. modetextstr db "Mode:",0
  820.  
  821. mp3playerwindowui
  822.         CUSTOMUISETCOLOR ,COLOR_PANEL
  823.         CUSTOMUIDRAWWINDOW ,6,8,66,7
  824.         CUSTOMUISETCOLOR ,15
  825.         CUSTOMUISEPARATOR ,7,13,64,196,196,196
  826.         CUSTOMUIPLAYERWINDOWTITLE ,8,8
  827.         CUSTOMUISONGTITLE ,8,10,titlestr
  828.         CUSTOMUIPLAYPROGRESS ,8,11,musicprogress+1
  829.         CUSTOMUIPLAYTIME ,67,8
  830.         CUSTOMUISETCOLOR ,COLOR_PANEL_FILE
  831.         CUSTOMUIPRINTTEXT ,11,14,codectextstr
  832.         CUSTOMUIPRINTTEXT ,45,14,modetextstr
  833.         CUSTOMUIPRINTTEXT ,9,15,bitratetextstr
  834. allstreamstatsui
  835.         CUSTOMUISETCOLOR ,COLOR_PANEL_FILE
  836. mp3codectext
  837.         CUSTOMUIPRINTTEXT ,18,14,emptyfieldstr
  838. mp3modetext
  839.         CUSTOMUIPRINTTEXT ,51,14,emptyfieldstr
  840. bitrateonlyui
  841.         CUSTOMUISETCOLOR ,COLOR_PANEL_FILE
  842. mp3bitratetext
  843.         CUSTOMUIPRINTTEXT ,18,15,emptyfieldstr
  844.         CUSTOMUIDRAWEND
  845. end
  846.  
  847. currentposition
  848.         ds 1
  849. filechunkcounter
  850.         ds 2
  851. titlestr
  852.         ds TITLELENGTH+1
  853.  
  854.         savebin "mp3.bin",begin,end-begin
  855.