Login

Subversion Repositories NedoOS

Rev

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

    MODULE ModProcessor
    ifdef GS
       
    macro GS_WaitCommand2
.wait
    in a, (CMD)
    rrca
    jr c, .wait
    endm

    macro GS_SendCommand2 nn
    ld a, nn : out (CMD), a
    endm
       
play:
    ld a, 255
    ld (oldminutes), a

    call Console.waitForKeyUp

    ld hl, Gopher.requestbuffer : call DialogBox.msgNoWait

    ;ld a, 1, (Render.play_next), a
        xor a
        ld (last_song_position),a
   
    ld h, #00, a, 32
    call TextMode.fillLine
    ld de, #0001 : call TextMode.gotoXY
    ld hl, message : call TextMode.printZ
    ld a, #00
    call TextMode.highlightLine

.loop
    halt
    xor a
    call Console.peekC
    cp Console.BACKSPACE
    jp z, .stopKey
        cp SPACE
    jp z, .playNext
   
    call printRTC

   ;╨┐╤А╨╛╨▓╨╡╤А╨║╨░ ╤З╤В╨╛ MOD ╨╜╨░╤З╨░╨╗ ╨╕╨│╤А╨░╤В╤М ╤Б╨╜╨░╤З╨░╨╗╨░
    GS_SendCommand2 CMD_GET_SONG_POSITION
    GS_WaitCommand2
        ld a,(last_song_position) ;╨┐╤А╨╡╨┤╤Л╨┤╤Г╤Й╨░╤П ╨┐╨╛╨╖╨╕╤Ж╨╕╤П
        ld c,a
        in a,(DATA) ;╤В╨╡╨║╤Г╤Й╨░╤П ╨┐╨╛╨╖╨╕╤Ж╨╕╤П
        ld (last_song_position),a
        cp c
        jr nc, .loop ;╨╡╤Б╨╗╨╕ ╨╜╨╡ ╨╝╨╡╨╜╤М╤И╨╡, ╨┐╤А╨╛╨┤╨╛╨╗╨╢╨░╨╡╨╝ ╨╕╨│╤А╨░╤В╤М
.playNext
    ld a, 1, (Render.play_next), a ;╤Д╨╗╨░╨│ ╤З╤В╨╛ ╨╜╨░╨┤╨╛ ╨▒╤Г╨┤╨╡╤В ╨╕╨│╤А╨░╤В╤М ╤Б╨╗╨╡╨┤╤Г╤О╤Й╨╕╨╣ ╤Д╨░╨╣╨╗
.stop
    call GeneralSound.stopModule
   
    call Console.waitForKeyUp
    ret
.stopKey
    xor a : ld (Render.play_next), a ;╤Д╨╗╨░╨│ ╤З╤В╨╛ ╨╜╨╡ ╨╜╨░╨┤╨╛ ╨╕╨│╤А╨░╤В╤М ╤Б╨╗╨╡╨┤╤Г╤О╤Й╨╕╨╣ ╤Д╨░╨╣╨╗
    jr .stop

message
    IFDEF SCREEN64
    ENDIF    
    IFDEF SCREEN80
    db "       "
    ENDIF    
    IFDEF SCREEN85
    db "         "
    ENDIF

    db "Playing MODs [SPACE] for next song [BACKSPACE] for stop playing.", 0

CMD_GET_SONG_POSITION     = #60
last_song_position db 0

;; Control ports
CMD  = 187
DATA = 179
    endif
    ENDMODULE