.include "cpctelera.h.s"
.include "menu.h.s"
.include "cpct_functions.h.s"
.include "sys/render.h.s"
.include "sys/collision.h.s"


string_inicio1:  .asciz "DINING"
string_inicio2:  .asciz "WITH"
string_inicio3:  .asciz "THE FISHES"
string_play:    .asciz "SPACE TO START"

string_ins:     .asciz "1.CONTROLS"
string_control1: .asciz "w UP"
string_control2: .asciz "A LEFT"
string_control3: .asciz "S DOWN"
string_control4: .asciz "D RIGHT"


contadr: .dw #puntuacion


;; HL -> KEY
waitKeyPressed:
   push hl
   call  cpct_scanKeyboard_f_asm
   pop hl
   push hl
   call  cpct_isKeyPressed_asm
   pop hl
   
   jr   nz, waitKeyPressed

loop2:
   push hl
   call  cpct_scanKeyboard_f_asm
   pop hl
   push hl
   call  cpct_isKeyPressed_asm
   pop hl
   jr    z, loop2
   ret


man_menu_init::

    call sys_eren_init

    ld hl, #0x0001
    call cpct_setDrawCharM0_asm
    ld iy, #string_inicio1
    posX = 25
    posY = 80
    ld hl, #0xC000
    call cpct_drawStringM0_asm

    ld hl, #0x0001
    call cpct_setDrawCharM0_asm
    ld iy, #string_inicio2
    posX = 25
    posY = 80
    ld hl, #0xC0A0
    call cpct_drawStringM0_asm

    ld hl, #0x0001
    call cpct_setDrawCharM0_asm
    ld iy, #string_inicio3
    posX = 25
    posY = 80
    ld hl, #0xC140
    call cpct_drawStringM0_asm



    ld hl, #0x0007
    call cpct_setDrawCharM0_asm
    ld iy, #string_control1
    posX = 20
    posY = 130
    ld hl, #0xD255
    call cpct_drawStringM0_asm

    ld hl, #0x0007
    call cpct_setDrawCharM0_asm
    ld iy, #string_control2
    posX = 20
    posY = 130
    ld hl, #0xD2F5
    call cpct_drawStringM0_asm

    ld hl, #0x0007
    call cpct_setDrawCharM0_asm
    ld iy, #string_control3
    posX = 20
    posY = 130
    ld hl, #0xD395
    call cpct_drawStringM0_asm

    ld hl, #0x0007
    call cpct_setDrawCharM0_asm
    ld iy, #string_control4
    posX = 20
    posY = 130
    ld hl, #0xD435
    call cpct_drawStringM0_asm





    ld hl, #0x0003
    call cpct_setDrawCharM0_asm
    ld iy, #string_play
    posX = 20
    posY = 130
    ld hl, #0xCDFC
    call cpct_drawStringM0_asm

    ret 
;;man_menu_punt::
;;
;;   
;;   
;;   ld hl, #0x0008
;;   call cpct_setDrawCharM0_asm
;;   ld iy, #puntuacion
;;   posX = 20
;;   posY = 130
;;   ld hl, #0xD435
;;   call cpct_drawStringM0_asm
;;
;;ret



man_menu_play::

    ld hl, #Key_Space
    call waitKeyPressed

    cpctm_clearScreen_asm 0
    ret


;;man_menu_ins:
;;
;;   call sys_eren_init
;;   ld hl, #0x0001
;;   call cpct_setDrawCharM0_asm
;;   ld iy, #string_ins
;;    
;;   ld hl, #0xC010
;;   call cpct_drawStringM0_asm
;;
;;
;;   ld hl, #0x0003
;;   call cpct_setDrawCharM0_asm
;;   ld iy, #string_control1
;;   ld hl, #0xCD09
;;   call cpct_drawStringM0_asm
;;
;;_mloop:
;;   call cpct_scanKeyboard_f_asm
;;   ld hl, #Key_Esc
;;   call cpct_isKeyPressed_asm
;;   jr z, _mloop
;;   call man_menu_init
;;   ret
