;=================================================================
; [pstuff.inc] - Player stuff and such shite ..
;=================================================================


PLAYER_SHOOT
    lda BUL_21_delay
    cmp #$00
    beq PS_okToShoot
    jmp PS_noBullies
PS_okToShoot
    lda BUL_21_alive
    cmp #$00                    ; bullet alive?
    beq PS_doMyBullah21         ; no! branch dammit!

;   lda BUL_22_alive
;   cmp #$00                    ; bullet alive?
;   beq PS_doMyBullah22         ; no! branch dammit!

;   lda BUL_23_alive
;   cmp #$00                    ; bullet alive?
;   beq PS_doMyBullah23         ; no! branch dammit!
    jmp PS_noBullies            ; sorry! you'll have to wait.

PS_doMyBullah21
    lda playerDir
    cmp #$00
    beq PS_doMyBullah21_left

    phx
    ldx PLY_SHIPX
    inx                         ; <-( Long live us mighty INX's !!! )
    inx
    inx                         ; <-( All of your INYs are belong to us! )
    inx
    inx                         ; <-( Cleopatra Jones is my bee-hotch. )
    inx
    inx
    inx;007                     ; <-( INX: With license to thrill. )
    inx
    inx                         ; <-( I'll kick yer' nutz, laddie! )
;   inx
;   inx
;   inx
    inx                         ; <-( Manko-chan no manko wa kawaii desu! )
    inx                         ; <-( *hi-hi-hee* .. Riiiight .... )
    inx
    stx SPRBUF1+SX21
    ldx PLY_SHIPY
    stx SPRBUF1+SY21
    plx
    lda #$88
    sta CURFRAME21              ; assign bullet sprite
    lda #$01
    sta BUL_21_alive            ; fire bullet, please!
    lda #$0a
    sta BUL_21_time             ; BULLET-TIME!!
    lda #$20
    sta BUL_21_delay

    lda #$01
    sta BUL_21_dir
;   lda #$30
    stz SPRBUF1+SPRIORITY21     ; this line was sta, but not anymore *huhu*
    jmp PS_bullySetOK

PS_doMyBullah21_left
    phx
    ldx PLY_SHIPX
    dex
    dex
    dex
    dex
    dex
    dex
    dex
    dex
    dex;007
    dex
    dex
    dex
    dex
    stx SPRBUF1+SX21
    ldx PLY_SHIPY
    stx SPRBUF1+SY21
    plx
    lda #$88
    sta CURFRAME21              ; assign bullet sprite
    lda #$01
    sta BUL_21_alive            ; fire bullet, please!
    lda #$0a
    sta BUL_21_time             ; BULLET-TIME!!
    lda #$20
    sta BUL_21_delay
    stz BUL_21_dir
    lda #%01000000
    sta SPRBUF1+SPRIORITY21

PS_bullySetOK
    lda #V1SFX_LASER_FIRE
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX

PS_noBullies
    rts


;-----------------------------------------------------------------


HANDLE_BULLIES
    lda BUL_21_alive
    cmp #$00
    bne HB_bul21
    jmp HB_ende
HB_bul21
    lda BUL_21_time
    cmp #$00                    ; end of BUL_21's fatal run?
    beq HB_bul21_stop           ; indeed!
    dec BUL_21_time

    lda BUL_21_dir
    cmp #$00
    bne HB_bul21_dirRight
    ldx SPRBUF1+SX21            ; bullet.x -= 4;
    dex
    dex
    dex
    dex
    stx SPRBUF1+SX21
    jmp HB_ende
HB_bul21_dirRight
    ldx SPRBUF1+SX21            ; bullet.x += 4;
    inx
    inx
    inx
    inx
    stx SPRBUF1+SX21

    jmp HB_ende
HB_bul21_stop
    lda #$00
    sta BUL_21_alive
    sta BUL_21_time
    lda #$8c
    sta CURFRAME21              ; make bullet sprite disappear
HB_ende
    rts


;=================================================================

PLAYER_TURN_L
    lda #$FC                    ; hide enemies and bullet
    sta SPRBUF2+3
    lda #$ff
    sta SPRBUF2+4
    sta SPRBUF2+5
    sta SPRBUF2+6
    sta SPRBUF2+7

;   jsr PLAYER_TURN_hideGarbage

    lda SPRBUF1+SX13
    sta ENM_13_tmp_X
    lda SPRBUF1+SX14
    sta ENM_14_tmp_X
    lda SPRBUF1+SX15
    sta ENM_15_tmp_X
    lda SPRBUF1+SX16
    sta ENM_16_tmp_X
    lda SPRBUF1+SX17
    sta ENM_17_tmp_X
    lda SPRBUF1+SX18
    sta ENM_18_tmp_X
    lda #$00
    sta SPRBUF1+SX13
    sta SPRBUF1+SX14
    sta SPRBUF1+SX15
    sta SPRBUF1+SX16
    sta SPRBUF1+SX17
    sta SPRBUF1+SX18
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L

    jsl bH13_WARPSCREEN

    jsr PLAYER_TURN_jamiroWAI_L
    LOAD_BLOCK2VRAM SPRSETFL,$6000,$2000
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L

    lda #V1SFX_SQUISH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX

    lda #$00
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$04
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$08
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$0c
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$40
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$44
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #%1100000
    sta SPRBUF1+SPRIORITY12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$40
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$0c
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$08
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$04
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    lda #$00
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L

    jsr PLAYER_TURN_jamiroWAI_L

    pha
    lda LEVEL_WAVE
    cmp #$01
    beq _PL_TL_s2
    cmp #$02
    beq _PL_TL_s2
    cmp #$03
    beq _PL_TL_s3
    cmp #$04
    beq _PL_TL_s3
    cmp #$05
    beq _PL_TL_s4
    cmp #$06
    beq _PL_TL_s4
    jmp _PL_TL_s1
_PL_TL_s4
    LOAD_BLOCK2VRAM SPR_TILES4,$6000,$2000
    jmp _PL_TL_s0
_PL_TL_s3
    LOAD_BLOCK2VRAM SPR_TILES3,$6000,$2000
    jmp _PL_TL_s0
_PL_TL_s2
    LOAD_BLOCK2VRAM SPR_TILES2,$6000,$2000
    jmp _PL_TL_s0
_PL_TL_s1
    LOAD_BLOCK2VRAM SPR_TILES,$6000,$2000
_PL_TL_s0
;   ldx #$0003
;   jsr theWayOfTheWAI
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    pla

    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L

    stz SPRBUF2+3               ; unhide enemies and bullet
    lda #$C0
    sta SPRBUF2+4
    lda #$F3
    sta SPRBUF2+5
    jsr PLAYER_TURN_jamiroWAI_L
    jsr PLAYER_TURN_jamiroWAI_L

    stz shipAnim
    stz shipVel
    stz shipAdvNumPix
    stz dec_vel_dir
    lda #$00
    sta CURFRAME12

    lda ENM_13_tmp_X
    sta SPRBUF1+SX13
    lda ENM_14_tmp_X
    sta SPRBUF1+SX14
    lda ENM_15_tmp_X
    sta SPRBUF1+SX15
    lda ENM_16_tmp_X
    sta SPRBUF1+SX16
    lda ENM_17_tmp_X
    sta SPRBUF1+SX17
    lda ENM_18_tmp_X
    sta SPRBUF1+SX18
    jsr PLAYER_TURN_jamiroWAI_L

;   jsr PLAYER_TURN_unhideGarbage

    rts

PLAYER_TURN_jamiroWAI_L
    ldx MAPX
    dex
    dex
    dex
    dex
    dex
    dex
    dex
    dex
    dex
    dex
    stx MAPX
    jsl bH13_ENGINE_ALL_doThe50p
    wai
    rts
PLAYER_TURN_jamiroWAI_R
    ldx MAPX
    inx
    inx
    inx
    inx
    inx
    inx
    inx
    inx
    inx
    inx
    stx MAPX
    jsl bH13_ENGINE_ALL_doThe50p
    wai
    rts

PLAYER_TURN_R
    lda #$FC                    ; hide enemies and bullet
    sta SPRBUF2+3
    lda #$ff
    sta SPRBUF2+4
    sta SPRBUF2+5
    sta SPRBUF2+6
    sta SPRBUF2+7

;   jsr PLAYER_TURN_hideGarbage

    lda SPRBUF1+SX13
    sta ENM_13_tmp_X
    lda SPRBUF1+SX14
    sta ENM_14_tmp_X
    lda SPRBUF1+SX15
    sta ENM_15_tmp_X
    lda SPRBUF1+SX16
    sta ENM_16_tmp_X
    lda SPRBUF1+SX17
    sta ENM_17_tmp_X
    lda SPRBUF1+SX18
    sta ENM_18_tmp_X
    lda #$00
    sta SPRBUF1+SX13
    sta SPRBUF1+SX14
    sta SPRBUF1+SX15
    sta SPRBUF1+SX16
    sta SPRBUF1+SX17
    sta SPRBUF1+SX18
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R

    jsl bH13_WARPSCREEN

    jsr PLAYER_TURN_jamiroWAI_R
    LOAD_BLOCK2VRAM SPRSETFL,$6000,$2000
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R

    lda #V1SFX_SQUISH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX

    lda #$00
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$04
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$08
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$0c
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$40
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$44
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$30
    sta SPRBUF1+SPRIORITY12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$40
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$0c
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$08
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    lda #$04
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R

    lda #$00
    sta CURFRAME12
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R

    jsr PLAYER_TURN_jamiroWAI_R


    pha
    lda LEVEL_WAVE
    cmp #$01
    beq _PL_TR_s2
    cmp #$02
    beq _PL_TR_s2
    cmp #$03
    beq _PL_TR_s3
    cmp #$04
    beq _PL_TR_s3
    cmp #$05
    beq _PL_TR_s4
    cmp #$06
    beq _PL_TR_s4
    jmp _PL_TR_s1
_PL_TR_s4
    LOAD_BLOCK2VRAM SPR_TILES4,$6000,$2000
    jmp _PL_TR_s0
_PL_TR_s3
    LOAD_BLOCK2VRAM SPR_TILES3,$6000,$2000
    jmp _PL_TR_s0
_PL_TR_s2
    LOAD_BLOCK2VRAM SPR_TILES2,$6000,$2000
    jmp _PL_TR_s0
_PL_TR_s1
    LOAD_BLOCK2VRAM SPR_TILES,$6000,$2000
_PL_TR_s0
;   ldx #$0003
;   jsr theWayOfTheWAI
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    pla


    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R

    stz SPRBUF2+3               ; unhide enemies and bullet
    lda #$C0
    sta SPRBUF2+4
    lda #$F3
    sta SPRBUF2+5
    jsr PLAYER_TURN_jamiroWAI_R
    jsr PLAYER_TURN_jamiroWAI_R

    stz shipAnim
    stz shipVel
    stz shipAdvNumPix
    stz dec_vel_dir
    lda #$00
    sta CURFRAME12

    lda ENM_13_tmp_X
    sta SPRBUF1+SX13
    lda ENM_14_tmp_X
    sta SPRBUF1+SX14
    lda ENM_15_tmp_X
    sta SPRBUF1+SX15
    lda ENM_16_tmp_X
    sta SPRBUF1+SX16
    lda ENM_17_tmp_X
    sta SPRBUF1+SX17
    lda ENM_18_tmp_X
    sta SPRBUF1+SX18
    jsr PLAYER_TURN_jamiroWAI_R

;   jsr PLAYER_TURN_unhideGarbage

    rts


PLAYER_TURN_hideGarbage         ; following piece of program is used
    GOTOXY 4,0                  ; to hide some nasty graphical glitches
                                ; that only appears on real hardware. :(
   ;PRINTS "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"
    jsr PLAYER_TURN_hG_loop
    GOTOXY 5,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 6,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 7,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 8,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 9,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 10,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 11,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 12,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 13,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 14,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 15,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 16,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 17,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 18,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 19,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 20,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 21,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 22,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 23,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 24,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 25,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 26,0
    jsr PLAYER_TURN_hG_loop
    GOTOXY 27,0
PLAYER_TURN_hG_loop    
    PRINTS "qqqquuuuuuuuuuuuuuuuuuuuuuuuqqqq"
    rts


PLAYER_TURN_unhideGarbage
    GOTOXY 4,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 5,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 6,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 7,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 8,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 9,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 10,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 11,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 12,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 13,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 14,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 15,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 16,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 17,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 18,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 19,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 20,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 21,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 22,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 23,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 24,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 25,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 26,0
    jsr PLAYER_TURN_uhG_loop
    GOTOXY 27,0
PLAYER_TURN_uhG_loop    
    PRINTS "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
    rts


;================================

; This routine really doesn't belong in this file.
; The reason is that `cutea.s' is just too darn big <:)

ICHINISAN
    lda ENM_wait_counter
    cmp #$00
    beq INS_zero
    cmp #$01
    beq INS_san
    cmp #$02
    beq INS_san
    cmp #$03
    beq INS_san
    cmp #$04
    beq INS_ni
    cmp #$05
    beq INS_ni
    cmp #$06
    beq INS_ni
    cmp #$07
    beq INS_ichi
    cmp #$08
    beq INS_ichi
    cmp #$09
    beq INS_ichi
    cmp #$0a
    beq INS_zero
    rts
INS_san
    jmp INS_drawSan
INS_sanEnde
    rts
INS_ni
    jmp INS_drawNi
INS_niEnde
    rts
INS_ichi
    jmp INS_drawIchi
INS_ichiEnde
    rts
INS_zero
    jmp INS_drawZero
INS_zeroEnde
    rts

INS_drawSan
;   GOTOXY 14,0
;   PRINTS "qqqquuuuuuuuu___uuuuuuuuuuuuqq"
;   GOTOXY 15,0
;   PRINTS "qqqquuuuuuuu_____uuuuuuuuuuuqq"
;   GOTOXY 16,0
;   PRINTS "qqqquuuuuuuuuuu[[uuuuuuuuuuuqq"
;   GOTOXY 17,0
;   PRINTS "qqqquuuuuuuuuu[[uuuuuuuuuuuuqq"
;   GOTOXY 18,0
;   PRINTS "qqqquuuuuuuuuuu[[uuuuuuuuuuuqq"
;   GOTOXY 19,0
;   PRINTS "qqqquuuuuuuu]]]]]uuuuuuuuuuuqq"
;   GOTOXY 20,0
;   PRINTS "qqqquuuuuuuuu]]]uuuuuuuuuuuuqq"
    lda a_byte
    cmp #$00
    bne INS_drawSanNoSnd
    lda #V1SFX_PING_HIGH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    lda #$01
    sta a_byte
INS_drawSanNoSnd
    jmp INS_sanEnde
INS_drawNi
;   GOTOXY 14,0
;   PRINTS "qqqquuuuuuuuuu___uuuuuuuuuuuqq"
;   GOTOXY 15,0
;   PRINTS "qqqquuuuuuuuu_____uuuuuuuuuuqq"
;   GOTOXY 16,0
;   PRINTS "qqqquuuuuuuuuuuu[[uuuuuuuuuuqq"
;   GOTOXY 17,0
;   PRINTS "qqqquuuuuuuuuuu[[uuuuuuuuuuuqq"
;   GOTOXY 18,0
;   PRINTS "qqqquuuuuuuuuu[[uuuuuuuuuuuuqq"
;   GOTOXY 19,0
;   PRINTS "qqqquuuuuuuuu]]uuuuuuuuuuuuuqq"
;   GOTOXY 20,0
;   PRINTS "qqqquuuuuuuuu]]]]]uuuuuuuuuuqq"
    lda a_byte
    cmp #$01
    bne INS_drawNiNoSnd
    lda #V1SFX_PING_LOW
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    lda #$02
    sta a_byte
INS_drawNiNoSnd
    jmp INS_niEnde
INS_drawIchi
;   GOTOXY 14,0
;   PRINTS "qqqquuuuuuuuuuuu_uuuuuuuuuuuqq"
;   GOTOXY 15,0
;   PRINTS "qqqquuuuuuuuuuu__uuuuuuuuuuuqq"
;   GOTOXY 16,0
;   PRINTS "qqqquuuuuuuuuu[[[uuuuuuuuuuuqq"
;   GOTOXY 17,0
;   PRINTS "qqqquuuuuuuuuuuu[uuuuuuuuuuuqq"
;   GOTOXY 18,0
;   PRINTS "qqqquuuuuuuuuuuu[uuuuuuuuuuuqq"
;   GOTOXY 19,0
;   PRINTS "qqqquuuuuuuuuuuu]uuuuuuuuuuuqq"
;   GOTOXY 20,0
;   PRINTS "qqqquuuuuuuuuu]]]]]uuuuuuuuuqq"
    lda a_byte
    cmp #$02
    bne INS_drawIchiNoSnd
    lda #V1SFX_DING_A_LING_HIGH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    lda #$03
    sta a_byte
INS_drawIchiNoSnd
    jmp INS_ichiEnde
INS_drawZero
    GOTOXY 14,0
    jsr INS_drawZero_uuuuuu
    GOTOXY 15,0
    jsr INS_drawZero_uuuuuu
    GOTOXY 16,0
    jsr INS_drawZero_uuuuuu
    GOTOXY 17,0
    jsr INS_drawZero_uuuuuu
    GOTOXY 18,0
    jsr INS_drawZero_uuuuuu
    GOTOXY 19,0
    jsr INS_drawZero_uuuuuu
    GOTOXY 20,0
    jsr INS_drawZero_uuuuuu

    stz a_byte
    jmp INS_zeroEnde

INS_drawZero_uuuuuu
;   PRINTS "qqqquuuuuuuuuuuuuuuuuuuuuuuuqq"
    rts
