Subversion Repositories NedoOS

Rev

Rev 1712 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download

  1.         DEVICE ZXSPECTRUM128
  2.         include "../_sdk/sys_h.asm"
  3.         include "playerdefs.asm"
  4.  
  5. MDLADDR = 0x8000
  6.  
  7.         org PLAYERSTART
  8.  
  9. begin   PLAYERHEADER
  10.  
  11. isfilesupported
  12. ;cde = file extension
  13.         ld a,c
  14.         cp 'p'
  15.         ret nz
  16.         ld a,d
  17.         cp 't'
  18.         ret nz
  19.         ld a,e
  20.         cp '3'
  21.         ret z
  22.         cp '2'
  23.         ret
  24.  
  25. playerinit
  26. ;hl = shared pages
  27. ;a = player page
  28.         ld a,(hl)
  29.         ld (page8000),a
  30.         inc hl
  31.         ld a,(hl)
  32.         ld (pageC000),a
  33.  
  34.         xor a
  35.         ret
  36.  
  37. playerdeinit
  38.         ret
  39.  
  40. musicload
  41. ;de = input file name
  42.         call openstream_file
  43.         or a
  44.         ret nz
  45.  
  46. page8000=$+1
  47.         ld a,0
  48.         SETPG8000
  49. pageC000=$+1
  50.         ld a,0
  51.         SETPGC000
  52.  
  53.         ld de,MDLADDR
  54.         ld hl,de
  55.         call readstream_file
  56.         push hl
  57.  
  58.         call closestream_file
  59.  
  60.         pop ix
  61.         call getptsconfig
  62.         ld (SETUP),a
  63.  
  64.         ld de,MDLADDR
  65.         add hl,de
  66.         ex hl,de
  67.         call INIT
  68.  
  69.         xor a
  70.         ret
  71.  
  72. musicunload
  73.         jp MUTE
  74.  
  75. musicplay
  76. ;out: zf=0 if still playing, zf=1 otherwise
  77.         YIELD
  78.         call PLAY
  79.  
  80.         ld a,(SETUP)
  81.         cpl
  82.         and 128
  83.         ret
  84.  
  85. findts
  86. ;ix = file size
  87. ;out: zf = 1 if TS data is found, hl = offset to the second module if available
  88.         ld de,MDLADDR
  89.         add ix,de ;past-the-end address of the data buffer
  90.  
  91.         ld a,'0'
  92.         cp (ix-4)
  93.         ret nz
  94.         ld a,'2'
  95.         cp (ix-3)
  96.         ret nz
  97.         ld a,'T'
  98.         cp (ix-2)
  99.         ret nz
  100.         ld a,'S'
  101.         cp (ix-1)
  102.         ret nz
  103.  
  104.         ld hl,(ix-12)
  105.         ret
  106.  
  107. getptsconfig
  108. ;ix = file size
  109. ;out: a = player config bits, hl = offset to the second module if available
  110.         call findts
  111.         ld a,%00010001 ;2xPT3
  112.         ret z
  113.  
  114.         ld a,(MDLADDR)
  115.         cp 'V'
  116.         jr z,$+4
  117.         cp 'P' ;'P'/'V' for PT3
  118.         ld a,%00100001 ;PT3
  119.         ret z
  120.  
  121.         ld a,%00000011 ;PT2
  122.         ret
  123.  
  124.         include "../_sdk/file.asm"
  125.         include "ptsplay/ptsplay.asm"
  126. end
  127.  
  128.         savebin "pt3.bin",begin,end-begin
  129.