?login_element?

Subversion Repositories NedoOS

Rev

Rev 1517 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;play *.tfd
  2.  
  3.         macro INCHL
  4.         inc l
  5.         call z,INCH
  6.         endm
  7.  
  8. INCH
  9.         inc h
  10.         ret nz
  11.         ld h,0xc0
  12.        push af
  13.        push bc
  14.         ld a,(tfdplay_pg)
  15.         inc a
  16.         ld (tfdplay_pg),a
  17.         ld c,a
  18.         ld b,tpgs/256
  19.         ld a,(bc)
  20.         SETPGC000
  21.        pop bc
  22.        pop af
  23.         ret
  24.  
  25. skipstr
  26.         xor a
  27.         ld b,a
  28.         ld c,a ;чтобы точно найти терминатор
  29.         cpir ;найдём обязательно, если длина=0, то bc=-1 и т.д.
  30.         ret
  31.  
  32. tfd_ini
  33.         xor a
  34.         ld (tfdplay_pg),a
  35.         ld c,a
  36.         ld b,tpgs/256
  37.         ld a,(bc)
  38.         SETPGC000
  39.         LD HL,0xc000;tfmData
  40.         ld a,(hl)
  41.         cp 'T'
  42.         ret nz;jr nz,tfd_ini_noheader
  43.         inc hl
  44.         ld a,(hl)
  45.         cp 'F'
  46.         ret nz;jr nz,tfd_ini_noheader
  47.         inc hl
  48.         ld a,(hl)
  49.         cp 'M'
  50.         ret nz;jr nz,tfd_ini_noheader
  51.         inc hl
  52.         ld a,(hl)
  53.         cp 'D'
  54.         ret nz;jr nz,tfd_ini_noheader
  55.         inc hl
  56.         call skipstr
  57.         call skipstr
  58.         call skipstr
  59.         ld (tfdplay_addr),hl
  60. ;tfd_ini_noheader        
  61.         ret
  62.  
  63.  
  64. tfd_play
  65. ;a = port bd77 value
  66.         di
  67.         push af
  68.         and 0xf7;0xa0;%10101000 ;320x200 mode noturbo
  69.         ld bc,0xbd77    ;shadow ports and palette remain on
  70.         out (c),a
  71.  
  72.         call tfd_playPP
  73.  
  74.         pop af
  75.         ;LD A,0xa8;%10101000 ;320x200 mode
  76.         ld bc,0xbd77    ;shadow ports and palette remain on
  77.         out (c),a
  78.         ei
  79.         ret
  80.  
  81. tfd_playPP
  82. tfdplay_wait=$+1
  83.         ld a,0
  84.         or a
  85.         jr z,tfd_play_nowait
  86.         dec a
  87.         ld (tfdplay_wait),a
  88.         ret
  89. tfd_play_nowait
  90.  
  91. tfdplay_pg=$+1
  92.         ld c,0
  93.         ld b,tpgs/256
  94.         ld a,(bc)
  95.         SETPGC000
  96. tfdplay_addr=$+1
  97.         ld hl,0xc000
  98.  
  99.         LD DE,#FFBF
  100.         LD C,#FD
  101.  
  102.         CALL selChip0
  103. parse0
  104.         LD A,(HL)
  105.         CP D ;0xff
  106.         JR NZ,parse1
  107. ;команда 0xff - новый кадр
  108.         ;HALT
  109.         ;out (0),a
  110.         INCHL
  111.         ;CALL selChip0
  112. parse0q
  113.         ld (tfdplay_addr),hl
  114.         ret
  115.  
  116. parse1
  117.  
  118.         CP #FC
  119.         JR NZ,parse2
  120.         CALL selChip0
  121.         INCHL
  122.         JR parse0
  123.  
  124. parse2
  125.  
  126.         CP #FD
  127.         JR NZ,parse3
  128.         CALL selChip1
  129.         INCHL
  130.         JR parse0
  131.  
  132. parse3
  133.  
  134.         CP #FB
  135.         JR NZ,parse4
  136. ;loop
  137. loopPos_pg=$+1
  138.         ld a,0
  139.        ld (tfdplay_pg),a
  140.         ld c,a
  141.         ld b,tpgs/256
  142.         ld a,(bc)
  143.         SETPGC000      
  144. loopPos_addr=$+1
  145.         LD HL,0xc000;tfmData
  146.         JP parse0 ;q???
  147.  
  148. parse4
  149.  
  150.         CP #FA
  151.         JR NZ,parse5
  152. ;set loop
  153.         INCHL
  154.        ld a,(tfdplay_pg)
  155.        ld (loopPos_pg),a
  156.         LD (loopPos_addr),HL
  157.         JP parse0
  158.  
  159. parse5
  160.  
  161.         CP #FE
  162.         JR NZ,parse6
  163.  
  164.         INCHL
  165.         LD a,(HL)
  166.         ;INC B
  167.         ;INC B
  168.         ;INC B
  169.         add a,2;3
  170.         ld (tfdplay_wait),a
  171.  
  172.         ;HALT
  173.         ;DJNZ $-1 ;TODO
  174.         INCHL
  175.         ;CALL selChip0
  176.         JP parse0q
  177.  
  178. parse6
  179.         LD B,D
  180.         WaitStatus
  181.         LD A,(HL)
  182.         OUT (C),A
  183.         INCHL
  184.         LD B,E
  185.         WaitStatus
  186.         LD A,(HL)
  187.         OUT (C),A
  188.         INCHL
  189.         jp parse0
  190.  
  191.        if 0
  192. selChip0
  193.         LD B,D
  194.         LD A,#FB;D
  195.         OUT (C),A
  196.         RET
  197.  
  198. selChip1
  199.         LD B,D
  200.         LD A,#FA;#FE
  201.         OUT (C),A
  202.         RET
  203.        endif
  204.  
  205.         align 256
  206. tpgs
  207.         ds 256
  208.  
  209. ;tfmData
  210.         ;INCBIN "ddd.t"
  211.