
;=================================================================
; [CUTEA.S] -- Cute Angel(a) ~ The Ultimate semi-playable "Hello world!"
;=================================================================
;
; Project start date: Mar '03
; Completion date   : 22.02.2006 (after a *long* time being in "limbo".
; o.o;;
;
; (c)opyfite Nattekos. Big thanks to Paul Lay for being such a good lad!


; I remember when all of the code were nice and structured *sigh*
.INCLUDE "cart.inc"
.INCLUDE "vrampal.inc"
.INCLUDE "initsys.inc"
.INCLUDE "ohjoy.inc"
.INCLUDE "sprites.inc"
.INCLUDE "strings.inc"

; from this point .. .. err, what can I say ?  Things go bad :/
.INCLUDE "s1boss.s"


;=================================================================
;= VARIABLES === DEFINES === VARIABLES === DEFINES === VARIABLES =
;=================================================================


.DEFINE MAPX $18
.DEFINE MAPY $1A

.DEFINE CURFRAME (SPRBUF1+SFRAME)
.DEFINE CURFRAME1 (SPRBUF1+SFRAME1)
.DEFINE CURFRAME2 (SPRBUF1+SFRAME2)
.DEFINE CURFRAME3 (SPRBUF1+SFRAME3)

.DEFINE CURFRAME4 (SPRBUF1+SFRAME4)
.DEFINE CURFRAME5 (SPRBUF1+SFRAME5)
.DEFINE CURFRAME6 (SPRBUF1+SFRAME6)
.DEFINE CURFRAME7 (SPRBUF1+SFRAME7)
.DEFINE CURFRAME8 (SPRBUF1+SFRAME8)
.DEFINE CURFRAME9 (SPRBUF1+SFRAME9)
.DEFINE CURFRAME10 (SPRBUF1+SFRAME10)
.DEFINE CURFRAME11 (SPRBUF1+SFRAME11)
.DEFINE CURFRAME12 (SPRBUF1+SFRAME12)
.DEFINE CURFRAME13 (SPRBUF1+SFRAME13)
.DEFINE CURFRAME14 (SPRBUF1+SFRAME14)
.DEFINE CURFRAME15 (SPRBUF1+SFRAME15)
.DEFINE CURFRAME16 (SPRBUF1+SFRAME16)
.DEFINE CURFRAME17 (SPRBUF1+SFRAME17)
.DEFINE CURFRAME18 (SPRBUF1+SFRAME18)
.DEFINE CURFRAME19 (SPRBUF1+SFRAME19)
.DEFINE CURFRAME20 (SPRBUF1+SFRAME20)
.DEFINE CURFRAME21 (SPRBUF1+SFRAME21)
.DEFINE CURFRAME22 (SPRBUF1+SFRAME22)
.DEFINE CURFRAME23 (SPRBUF1+SFRAME23)
.DEFINE CURFRAME24 (SPRBUF1+SFRAME24)
.DEFINE CURFRAME25 (SPRBUF1+SFRAME25)
.DEFINE CURFRAME26 (SPRBUF1+SFRAME26)
.DEFINE CURFRAME27 (SPRBUF1+SFRAME27)
.DEFINE CURFRAME28 (SPRBUF1+SFRAME28)
.DEFINE CURFRAME29 (SPRBUF1+SFRAME29)
.DEFINE CURFRAME30 (SPRBUF1+SFRAME30)
.DEFINE CURFRAME31 (SPRBUF1+SFRAME31)

.DEFINE PLY_SHIPX $30
.DEFINE PLY_SHIPY $60

; ****PLAY****

; joypad values
.DEFINE SELECT    $20
.DEFINE TOP_RIGHT $10
.DEFINE TOP_LEFT  $20

; variables
.DEFINE GOOD_ENDING $100F
.DEFINE BAD_ENDING  GOOD_ENDING+$01

.DEFINE MUSIC       $100F+$02
.DEFINE V0SFX       MUSIC+$01
.DEFINE V1SFX       MUSIC+$02
.DEFINE OLD_JOY_LOW MUSIC+$03
.DEFINE OLD_JOY_HI  MUSIC+$04

.DEFINE animationData MUSIC+$06           ; animation data array
.DEFINE animationIndex animationData+350  ; index into array
.DEFINE frameSource animationIndex+$02    ; 24-bit source address
.DEFINE frameDest frameSource+$04         ; VRAM destination address
.DEFINE shipFrame frameDest+$02           ; current ship frame


.ENUM $80
    ; PERSONAL NOTE: Inserting too many variables results in strange errors.
    ; As of right now we're just about 1~8 vars from the "limit"!
    ; DO NOT ADD ANY MORE VARIABLES -- RE-USE THOSE THAT CURRENTLY EXIST!!! :-)
    ; Am I misunderstanding something or is WLA to blame?
    ;---
    ; Note to self: variable ram (scratchpad) [$00f6-1fff]

    mapXbg2 DW                  ; write to any of these variables at
    mapYbg2 DW                  ; any time to alter bg#2 position

    dummybyte DW                ; only to be used there and then!
    a_byte DB
    a_byte2 DB
    a_word DW
    a_word2 DW
    what_fade DB

    ENM_killCounter DB          ; space wave complete @ $05
    ENM_bulletHitENM DB         ; (see coll.inc)
    anm_timer DB                ; Enemy animation timer
    anm_flag0 DB                ; Enemy animation flag#0 (2 sprites)
    anm_flag1 DB                ; Enemy animation flag#1 (3 sprites)

    LEVEL_WAVE DB
    areWeAtFirstBoss DB
    lostLife_forceNoFLIP DB

    introSIKA_again DB          ; display introSIKA-screen? bool of cuz!

    playerDir DB
    playerDirWait DB
    ;---============-----------
    hd_coll DB                  ; Hitdetection? Bool
    hd_colc DB                  ; Counter
    hd_cx DB
    hd_cy DB
    hd_cx2 DB
    hd_cy2 DB
    hd_px2 DB
    hd_py2 DB
    ;---============-----------
    score_1 DW
    score_10 DW
    score_100 DW
    score_1000 DW
    score_10000 DW
    scorey_1 DW
    scorey_10 DW
    scorey_100 DW
    scorey_1000 DW
    scorey_10000 DW
    score_d DB                  ; Score increment delay
    ;---============-----------
    shipInvulnerable DB
    shipInvulnerable_w DB       ; on/off
    shipInvulnerable_wd DB      ; interval

    waitBeforeYouGoGo DB        ; another one nasty hack :(

    shipAnim DB
    shipLastDir DB              ; 0 = up, 1 = down
    shipVel DB                  ; velocity for player ship
    shipAdvNumPix DB            ; advance # pixels ( 0=1/2, 1=1, 2=2 )
    shipAdvHalfFlag DB          ; switch between 0|1 for half dex :P
                                ; + is *always* updated!
    dec_vel_dir DB              ; makes deaccelerate direction work ok.
    ;---============-----------
    ang_hp DB                   ; current health points
    ang_lives DB                ; current lives remaining

    freeForAll1 DB              ; these four bytes can be used for
    freeForAll2 DB              ; everything
    freeForAll3 DB
    freeForAll4 DB
    ;---============-----------
    ; ENEMIES AND STUFFO
    ; ----
    ; This part of the code might be a little difficult
    ; to understand, but once you get it .. Voila! =)
    ; Please refer to `enemies.inc' for further information!
    ;
    ; Edit: It's no 'voila! =)' after all :(
    ;---============-----------
    ENEMY_ALIVE_DEBUG DB
    ENM_hitDetectTime DB

    ENM_patternCounter DW
    ENM_patternDir DB
    ENM_pattSinHalf DB
    ENM_pattTmpPatty DB

    ENM_wait_delay DB           ; slow down ENM_wait_counter..
    ENM_wait_counter DB         ; used to check whether an enemy can move,
                                ; no matter it is alive or not.

    ENM_13_tmp_X DB
    ENM_14_tmp_X DB
    ENM_15_tmp_X DB
    ENM_16_tmp_X DB
    ENM_17_tmp_X DB
    ENM_18_tmp_X DB

    ENM_13_dead DB
    ENM_14_dead DB
    ENM_15_dead DB
    ENM_16_dead DB
    ENM_17_dead DB

    ENM_13_alive DB
    ENM_14_alive DB
    ENM_15_alive DB
    ENM_16_alive DB
    ENM_17_alive DB
    ENM_18_alive DB

    ENM_13_hp DB               ; ENM_13_blinkState
    ENM_14_hp DB               ; ENM_14_blinkState
    ENM_15_hp DB               ; ENM_15_blinkState
    ENM_16_hp DB               ; ENM_16_blinkState
    ENM_17_hp DB               ; ENM_17_blinkState
    ENM_18_hp DB               ; ENM_13_blinkHowLong

    ENM_13_speed DB
    ENM_14_speed DB
    ENM_15_speed DB
    ENM_16_speed DB
    ENM_17_speed DB
    ENM_18_speed DB

    ENM_13_numfr DB
    ENM_14_numfr DB
    ENM_15_numfr DB
    ENM_16_numfr DB
    ENM_17_numfr DB
    ENM_18_numfr DB

    ENM_13_f1 DB
    ENM_13_f2 DB
    ENM_13_f3 DB
    ENM_14_f1 DB
    ENM_14_f2 DB
    ENM_14_f3 DB
    ENM_15_f1 DB
    ENM_15_f2 DB
    ENM_15_f3 DB
    ENM_16_f1 DB
    ENM_16_f2 DB
    ENM_16_f3 DB
    ENM_17_f1 DB
    ENM_17_f2 DB
    ENM_17_f3 DB
    ENM_18_f1 DB
    ENM_18_f2 DB
    ENM_18_f3 DB

    ENM_13_patt DB
    ENM_14_patt DB
    ENM_15_patt DB
    ENM_16_patt DB
    ENM_17_patt DB
    ENM_18_patt DB

    ENM_13_wait DB
    ENM_14_wait DB
    ENM_15_wait DB
    ENM_16_wait DB
    ENM_17_wait DB
    ENM_18_wait DB

    ENM_13_magica DB           ; ENM_14_blinkHowLong
    ENM_14_magica DB           ; ENM_15_blinkHowLong
    ENM_15_magica DB           ; ENM_16_blinkHowLong
    ENM_16_magica DB           ; ENM_17_blinkHowLong
    ENM_17_magica DB           ; ENM_ALL_blinkDelay
    ENM_18_magica DB           ; ENM_ALL_blinkONOFF

    ENM_13_leftRight DB
    ENM_14_leftRight DB
    ENM_15_leftRight DB
    ENM_16_leftRight DB
    ENM_17_leftRight DB
    ENM_18_leftRight DB

    ENM_13_pattNum DB
    ENM_14_pattNum DB
    ENM_15_pattNum DB
    ENM_16_pattNum DB
    ENM_17_pattNum DB
    ENM_18_pattNum DB

    ;---============-----------
    BUL_21_alive DB
    BUL_21_time DB
    BUL_21_delay DB
    BUL_21_dir DB
    ;---============-----------
    OBJ_X DB
    OBJ_X2 DB
    OBJ_Y DB
    OBJ_Y2 DB
    OBJ_W DB
    OBJ_W2 DB
    OBJ_H DB
    OBJ_H2 DB
    OBJ_HIT DB

.ENDE


;=================================================================
;== MAIN = MAIN = MAIN = MAIN = MAIN = MAIN = MAIN = MAIN = MAIN =
;=================================================================


.BANK 0 SLOT 0
.ORG $0000
.SECTION "voidmaincode"

; message to rom-hackers
.DB "   Why are you reading off my intestines?  "
.DB "   ROMHAXING IS LLAMA! ;-)   "
.DB "  ..but you can just go on and do yer thing..   "
.DB "    SNES hacking 4evah!!!!!!!!!!!!!!!    "

; ****PLAY****
; include audio equates and subroutines
.INCLUDE "audio.s"
; include fade in/out effects
.INCLUDE "fade.s"
; include menu subroutines
.INCLUDE "menu.inc"
; include cinematic stuff..
.INCLUDE "intro.inc"
; include hitdetection and subroutines
.INCLUDE "coll.inc"
; include konami gag
.INCLUDE "konami.inc"
; include obligatory game stuff :)
.INCLUDE "gameover.inc"
.INCLUDE "pstats.inc"
.INCLUDE "pstuff.inc"
.INCLUDE "enemies.inc"
; include animation subroutines
.INCLUDE "anim.s"

VOID_MAIN:
    sei                         ; disable interrupts
    rep #$30                    ; A=X/Y=16bit
    stz animationIndex          ; clear animation

    INIT_SNES
; ****PLAY****
; load audio program
    rep #$20 ; 16-bit A
    lda.w #$8000
    sta SPC_SOURCE
     sep #$20 ; 8-bit A
    lda.b #$02 ; audio data in bank 2
    sta SPC_SOURCE+$02
    jsr AUDIO_BOOT

; enable all audio voices (sfx and music)
    lda #ALL_AUDIO_ENABLED
    jsr AUDIO_CONTROL

; initialise sfx variables
    lda #V0SFX_DEEP_THUMP
    sta V0SFX
    lda #V1SFX_SQUISH
    sta V1SFX

; normal ship frame is displayed initially
    rep #$30
    lda #NORMAL_SHIP
    sta shipFrame

    rep   #$10                  ; A/mem=8bits, X/Y=16bits
    sep   #$20
    LOAD_PAL BG_TITPAL
    LOAD_BLOCK2VRAM BG_TITGFX,$2000,$6000
;   LOAD_BLOCK2VRAM BG_TITGFX,$1000,$0800
    LOAD_BLOCK2VRAM FONT_TILES,$5000,$0800

    stz GOOD_ENDING
    stz BAD_ENDING

    ; Set the priority bit to all of BG#2 tiles
    lda   #$80
    sta   $2115                 ; Write only to the higher byte of VRAM
    ldx   #$5800
    stx   $2116
    ldx   #$0400                ; 32x32 tiles
    lda   #$20
_NXTTLE:
    sta   $2119
    dex
    bne   _NXTTLE

    jsr   INIT_SPRITES
    jsr   SPRITEZ_PRIOR30
    jsr   INIT_JOY

    lda   #$01
    sta   introSIKA_again

    jsr   INIT_VIDEO_04
    wai
    wai
    wai
    wai
    wai
    wai
    jsr   CHKKONGRD
;   jsr   DISPLAY_LOGO

;====================
SJEKK_DEN_KUULE_LOGOEN_ASSE

    jsr INIT_VIDEO_04
    lda   #$80
    sta   $2100                 ; screen off, no brightness
    wai
    wai
    wai
    jml   bH13_SUPERNINTENDO_LOGOEN
LOGO_SNES_ENDETARM
    jml   bH13_SJEKK_DEN_KUULE_LOGOEN

.ENDASM
    ldx #$0000
    stx MAPX
    ldx #$ffff
    stx MAPY

    lda #%00000001
    sta $212c                   ; disable all, but bg#1

    LOAD_PAL ITSSNESTASY_PAL
    wai
    LOAD_BLOCK2VRAM ITSSNESTASY_MAP,$0000,$2000
    wai
    wai
    LOAD_BLOCK2VRAM ITSSNESTASY_PIC,$2000,$6000
    wai
    wai

    jsl bH13_FADE_IN_macro
    ldx #$00ff
    jsr slightDelay_plus_DEVCheck
    jsl bH13_FADE_OUT_macro
    jmp itsSnestasyENDE


slightDelay_plus_DEVCheck
    wai
    lda joy1
    cmp #$10                   ; check if 'R' is pressed
    bne sD_p_DChk_noDEV
    lda joy1+1
    cmp #$01
    bne sD_p_DChk_noDEV        ; check if RIGHT pad is pressed also
    jml bH13_DEV_SCREEN
sD_p_DChk_noDEV
    dex
    cpx #$0000
    bne slightDelay_plus_DEVCheck
    rts
.ASM

itsSnestasyENDE
    lda #%00011111              ; enable all planes+oam
    sta $212c

;========================
    ; DEBUG SHORTCUT DEBUG SHORTCUT DEBUG SHORTCUT
;   jml STAGE2TESTLESTEN

; play title music
    lda #SONG_ICE
    sta MUSIC
    jsr AUDIO_PLAY_SONG

SPLASH_LOAD:                                ; NOTE: Splash-screen runs in mode #$04

;   LOAD_BLOCK2VRAM FONT_TILES,$5000,$0800  ; was: $2000,$1800 for mode #$03
    LOAD_BLOCK2VRAM MYFONT_CRED_PIC,$5000,$0800
    wai
    wai
    wai

; ****PLAY**** removed:
;    lda   #$03
;    sta   $100D
;    lda   $100D
;    sta   $2140
SPLASH_SCREEN:                  ; The splash-screen

    lda   #$8F
    sta   $2100
    ldx   #$0000
    stx   MAPX
    ldx   #$ffff
    stx   MAPY


    stz   ENM_13_numfr         ; these vars are zeroifed in order to
    stz   ENM_14_numfr         ; prevent enemy anims from screwing up, i.e
    stz   ENM_15_numfr         ; not appearing animated at all.
    stz   ENM_16_numfr
    stz   ENM_17_numfr
    stz   ENM_18_numfr
    stz   ENM_killCounter
    stz   ENM_bulletHitENM
    stz   anm_timer
    stz   anm_flag0
    stz   anm_flag1


    jsl bH13_ENMBLINK_setup

    LOAD_PAL BG_TITPAL
    wai
    LOAD_BLOCK2VRAM BG_TITDAT,$0000,$2000   ; 64x64 tiles
    wai
    wai
    LOAD_BLOCK2VRAM BG_TITGFX,$2000,$6000
    wai
    wai
    LOAD_BLOCK2VRAM SPR_SPLASH,$6000,$2000  ; 6 32x32 (4bpp)
    wai
    wai

    jsr SPLSC_CLR

    GOTOXY 10,0
    jsr   SPLSC_HIDEB
    GOTOXY 11,0
    jsr   SPLSC_HIDEB
    GOTOXY 12,0
    jsr   SPLSC_HIDEB
    GOTOXY 13,0
    jsr   SPLSC_HIDEB
    GOTOXY 14,0
    jsr   SPLSC_HIDEB
    GOTOXY 15,0
    jsr   SPLSC_HIDEB
    GOTOXY 16,0
    jsr   SPLSC_HIDEB
    GOTOXY 17,0
    jsr   SPLSC_HIDEB
    GOTOXY 18,0
    jsr   SPLSC_HIDEB
    GOTOXY 19,0
    PRINTS "qqqqqqqqq"
    bra   SPLSC_SETUP
SPLSC_HIDEB:
    PRINTS "qqqqqqqqqqqq"
    rts
SPLSC_SETUP:
    jsl   bH13_SPLSC_SETUP
SPLSC_LOOP:
    wai
    lda   $100B
    cmp   #$00
    beq   SPLSC_NOBL
    lda   #$00
    sta   SPRBUF2               ; Sprites on
    bra   SPLSC_LC
SPLSC_NOBL:
    lda   #$FF
    sta   SPRBUF2               ; Sprites off
SPLSC_LC:
    ldx   a_word2
    inx
    inx
    stx   a_word2
    cpx   #$14
    beq   SPLSC_LCC
    bra   SPLSC_LCONT
SPLSC_LCC:
    ldx   #$0000
    stx   a_word2
    inc   $100B
    lda   $100B
    cmp   #$02
    beq   SPLSC_LCCC
    sta   $100B
    bra   SPLSC_LCONT
SPLSC_LCCC:
    stz   $100B
SPLSC_LCONT:
    ldx   a_word
    inx
    stx   a_word
    cpx   #$3E8
    beq   SPLSC_BATINPUSSY      ; *YaY!*
    lda   joy1+1
    and   #$10                  ; Press start (higher byte)
    beq   SPLSC_JMLL
    bra   SPLSC_NC
SPLSC_JMLL:
    jml   SPLSC_LOOP
;=========
SPLSC_BATINPUSSY:
    lda   #$01
    sta   $100E
    jmp   SPLSC_NC_NOSND
SPLSC_NC:
    lda   #V0SFX_DEEP_THUMP
    sta   V0SFX
    jsr   AUDIO_PLAY_V0SFX
    jsl   bH13_SUTAaTOBOTAN_BLINKx10
SPLSC_NC_NOSND:
    lda   #$FF
    sta   SPRBUF2
    jsl   bH13_FADE_OUT_MOSAIC_macro
    GOTOXY 10,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 11,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 12,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 13,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 14,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 15,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 16,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 17,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 18,0
    jsr   SPLSC_UNHIDEB
    GOTOXY 19,0
    PRINTS "uuuuuuuuu"
    bra   SPLSC_UNHIDEBE
SPLSC_UNHIDEB:
    PRINTS "uuuuuuuuuuuu"
    rts
SPLSC_UNHIDEBE:
    lda   $100E
    cmp   #$01
    beq   SPLSC_CREDS

    GOTOXY 13,0
    jsr SPLSC_CLRTXT
    GOTOXY 14,0
    jsr SPLSC_CLRTXT
    GOTOXY 19,0
    jsr SPLSC_CLRTXT
    GOTOXY 21,0
    jsr SPLSC_CLRTXT

; Where to go? To the main menu or to the guess-the-number game?

    lda OBJ_HIT
    cmp #$00
    beq MMENU_sym
    cmp #$01
    beq MMENU_sym
    cmp #$02
    beq MMENU_sym
    cmp #$03
    beq MMENU_sym
    jml bH0f_GTN_splashScreen
MMENU_sym
    jmp MENU_MAIN               ; was: jml PLAY_GAME

SPLSC_CREDS:
    LOAD_PAL BG_CREDPAL
    wai
    LOAD_BLOCK2VRAM BG_CREDDAT,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM BG_CREDGFX,$2000,$6000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM MYFONT_CRED_PIC,$5000,$0800
    wai
    wai
    wai

    ; BG#2 translucency and shiat
    lda #$01
    sta $212d
    lda #$02
    sta $2130
    lda #$52
    sta $2131

    ldx   #$0000
    stx   a_word
    stz   $100E                 ; Watch creds? Bool
    GOTOXY 2,1
    PRINTS "@uuu@u@uuuuuuu@@@uuuuuuuuuuu@"
    GOTOXY 3,1
    PRINTS "@uuu@u@uuuu@uu@uu@uu@uuu@uu@u@"
    GOTOXY 4,1
    PRINTS "@u@u@u@@uu@u@u@uu@u@u@u@u@u@@"
    GOTOXY 5,1
    PRINTS "@u@u@u@u@u@u@u@uu@u@u@u@u@u@"
    GOTOXY 6,1
    PRINTS "u@u@uu@u@uu@uu@@@uuu@uu@u@uu@@"
    GOTOXY 8,1 ;; DLDLDLDLD
    PRINTS "u@@@uu@uuu@u@uuu@u@uuuuuuuu@"
    GOTOXY 9,2
    PRINTS "@uu@uuuuu@u@uuu@u@uuuu@uu@@@"
    GOTOXY 10,2
    PRINTS "@uu@u@u@@@u@u@u@u@@uu@u@uu@"
    GOTOXY 11,2
    PRINTS "@uu@u@u@u@u@u@u@u@u@u@@@uu@"
    GOTOXY 12,2
    PRINTS "@@@uu@u@@@uu@u@uu@u@u@u@uu@@"
    GOTOXY 13,0
    jsr SPLSC_CLRTXT
    GOTOXY 14,0
    jsr SPLSC_CLRTXT
    GOTOXY 14,2
    PRINTS "PROGRAM...KRISTOFFER RELLING"
;   PRINTS "abcde.....KRISTOFFER RELLING"
    GOTOXY 15,2
    PRINTS "GFX.......MANKO-CHAN"
;   PRINTS "cdjk=lm...MANKO-CHAN"
    GOTOXY 16,2
    PRINTS "AUDIO.....PAUL LAY"
;   PRINTS "fghi......PAUL LAY"
    GOTOXY 17,2
    PRINTS "MUSIC.....EVIL TEEN NINJAS"
;   PRINTS "1243=l....EVIL TEEN NINJAS"
;   PRINTS "uuuuuuuuuuuuuuuuuuuuuuuuuuuu"uuu"
    GOTOXY 18,0
    jsr SPLSC_CLRTXT
    GOTOXY 19,2
    PRINTS "THANKS...."
;   PRINTS "nop......."
    GOTOXY 20,0
    jsr SPLSC_CLRTXT
    GOTOXY 21,2
    PRINTS "      KEVIN MANTEY"
    GOTOXY 22,2
    PRINTS "      ANTHROX"
    GOTOXY 23,2
    PRINTS "      VILLE HELIN"
    GOTOXY 24,2
    PRINTS "      Y0SHI + QWERTIE"
    GOTOXY 26,0
    PRINTS "uuKRISTOFFER.RELLINGwGMAIL.COM"
;   FADE_IN
;   jsl bH13_FADE_IN_macro
    jsl bH13_FADE_IN_BG1CREDSCROLL
SPLSC_CREDSLOOP:
    wai
    ldx   MAPY
    dex
    stx   MAPY
    ldx   a_word
    inx
    stx   a_word
    cpx   #$1F4
    beq   SPLSC_CTUP
    bra   SPLSC_CDM
SPLSC_CTUP:
;   FADE_OUT
;   jsl   bH13_FADE_OUT_macro
    jsl   bH13_FADE_OUT_BG1CREDSCROLL
    jsr   SPLSC_CLR
    stz   $212d
    stz   $2130
    stz   $2131
    jml   SPLASH_SCREEN
SPLSC_CDM:
    lda   joy1+1
    and   #$10
    beq   SPLSC_CREDSLOOP
    bra   SPLSC_CTUP
SPLSC_CLR:                      ; Wipe out textblocks
    ;---
    GOTOXY 0,0
    jsr SPLSC_CLRTXT
    GOTOXY 1,0
    jsr SPLSC_CLRTXT
    GOTOXY 2,0
    jsr SPLSC_CLRTXT
    GOTOXY 3,0
    jsr SPLSC_CLRTXT
    GOTOXY 4,0
    jsr SPLSC_CLRTXT
    GOTOXY 5,0
    jsr SPLSC_CLRTXT
    GOTOXY 6,0
    jsr SPLSC_CLRTXT
    GOTOXY 7,0
    jsr SPLSC_CLRTXT
    GOTOXY 8,0 ;; DLDLDLDLD
    jsr SPLSC_CLRTXT
    GOTOXY 9,0
    jsr SPLSC_CLRTXT
    GOTOXY 10,0
    jsr SPLSC_CLRTXT
    GOTOXY 11,0
    jsr SPLSC_CLRTXT
    GOTOXY 12,0
    jsr SPLSC_CLRTXT
    GOTOXY 13,0
    jsr SPLSC_CLRTXT
    GOTOXY 14,0
    jsr SPLSC_CLRTXT
    GOTOXY 15,0
    jsr SPLSC_CLRTXT
    GOTOXY 16,0
    jsr SPLSC_CLRTXT
    GOTOXY 17,0
    jsr SPLSC_CLRTXT
    GOTOXY 18,0
    jsr SPLSC_CLRTXT
    GOTOXY 19,0
    jsr SPLSC_CLRTXT
    GOTOXY 20,0
    jsr SPLSC_CLRTXT
    GOTOXY 21,0
    jsr SPLSC_CLRTXT
    GOTOXY 22,0
    jsr SPLSC_CLRTXT
    GOTOXY 23,0
    jsr SPLSC_CLRTXT
    GOTOXY 24,0
    jsr SPLSC_CLRTXT
    GOTOXY 25,0
    jsr SPLSC_CLRTXT
    GOTOXY 26,0
    jsr SPLSC_CLRTXT
    GOTOXY 27,0
    jsr SPLSC_CLRTXT
    rts
SPLSC_CLRTXT:
    PRINTS "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
    wai
    rts
DO_ZE_FLLTXT:
    PRINTS "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"
    rts

    ;---

PLAY_GAME:
    stz areWeAtFirstBoss
    stz lostLife_forceNoFLIP
    stz LEVEL_WAVE
    jsl RESET_SCOREZ

    lda #$01
    sta playerDir
    lda #$3f
    sta playerDirWait
    stz ENEMY_ALIVE_DEBUG
    stz ENM_patternCounter
    stz ENM_patternDir
    stz ENM_pattSinHalf
    stz ENM_wait_delay
    stz ENM_wait_counter
    stz shipInvulnerable
    stz shipInvulnerable_w
    stz shipInvulnerable_wd
    lda #$01
    sta waitBeforeYouGoGo

    lda #$30
    sta SPRBUF1+SPRIORITY12
    sta SPRBUF1+SPRIORITY13
    sta SPRBUF1+SPRIORITY14
    sta SPRBUF1+SPRIORITY15
    sta SPRBUF1+SPRIORITY16
    sta SPRBUF1+SPRIORITY17
    sta SPRBUF1+SPRIORITY18
    ;------

    lda #$80
    sta $2100
    jsr INIT_VIDEO_04
    lda #$80
    sta $2100


    jsl bH13_STAGE1_SCREEN

    lda #$80
    sta $2100
    jsr INIT_VIDEO_03
    lda #$80
    sta $2100



    lda #%0011010
    sta $212C

    lda #NO_SONG
    sta MUSIC
    jsr AUDIO_PLAY_SONG

    LOAD_PAL ANGSTART_PAL
    wai
    LOAD_BLOCK2VRAM ANGSTART_GFX,$6000,$2000
    wai
    LOAD_BLOCK2VRAM FONT2_TILES,$2000,$1800
    wai
    wai

    GOTOXY 17,0                 ; hide some trash
    PRINTS "qq\nqq\nqq\nqq\nqq\nqq\nqq\nqq\nqq"

    jsl bH13_ANGELA_START

    GOTOXY 17,0
    PRINTS "uu\nuu\nuu\nuu\nuu\nuu\nuu\nuu\nuu"

    LOAD_PAL BG_PAL
    wai
    LOAD_BLOCK2VRAM BG_MAPDAT,$0000,$2000  ; 64x64 tiles
    wai
    wai
    wai
    LOAD_BLOCK2VRAM BG_MAPGFX,$1000,$0800  ; 384 tiles (8bpp)
    wai
    wai
    wai
    LOAD_BLOCK2VRAM SPR_TILES,$6000,$2000  ; 56 32x32 (4bpp)
    wai
    wai
    LOAD_BLOCK2VRAM FONT2_TILES,$2000,$1800
    wai
    wai

    lda #$00
    sta $2100

    stz MAPX
    stz MAPY

; ****PLAY****
; play in-game music
    lda #SONG_GOKU               ; No! It has nothing to do with the legend
    sta MUSIC                    ; of Son Goku or anything similar ;-)
    jsr AUDIO_PLAY_SONG

;============
; removed:
;    lda   #$07
;    sta   $100D                 ; Song # (2-7)
;    lda   $100D
;    sta   $2140                 ; TURN ON THE MUSIC!!!

;;;  Hak & Haxter
    jsl bH13_HAK_AND_HAXTER

    jsr SEQ_setUpUsTheSprites
    jsr SEQ_hideSprites
;;; End of Hak & Haxter


    ;============================
    jsl WRITE_STATUSBAR_LV1
    jmp _GET_DOWN_WITH_RENA_CHAN ;and score some more


WRITE_STATUSBAR_LV1
    GOTOXY 0,0
    jsr DO_ZE_FLLTXT
    GOTOXY 1,0
    jsr DO_ZE_FLLTXT
    GOTOXY 2,0
    jsr DO_ZE_FLLTXT
    GOTOXY 3,0
    jsr DO_ZE_FLLTXT
    GOTOXY 1,0
;   PRINTS "qqREST:02qqqSCORE:00000qqefefefq"
    PRINTS "qq-[]-~04qqqq_:[-~00000qqefefefq"
    GOTOXY 2,0
;   PRINTS "qrssssssstqrssssssssssstqghghghq"
    PRINTS "qrssssssssssssssssssssstqghghghq"
    rtl
_GET_DOWN_WITH_RENA_CHAN
    stz shipAnim
    stz shipVel
    stz shipAdvNumPix
    stz shipAdvHalfFlag
    stz dec_vel_dir
    stz score_d

    lda #$03
    sta ang_hp
    lda #$05
    sta ang_lives
    
;   ldx #$0000
;   stx ang_startx
;   stx ang_starty
;   ldx #$40
;   stx ang_startx
;   ldx #$28
;   stx ang_starty

    ; Adjust position of ship
    ldx   #$40
    stx   PLY_SHIPX
    stx   SPRBUF1+SX12
    ldx   #$80 ;$48
    stx   PLY_SHIPY
    stx   SPRBUF1+SY12

    lda #$ff
    sta SPRBUF2
;   sta SPRBUF2+1
;   sta SPRBUF2+2
    stz SPRBUF2+1 ; these three lines are for the 50-point sprites
    lda #$FC
    sta SPRBUF2+2
.ENDASM
    stz   SPRBUF2  ; 00-03 ; Walls
    stz   SPRBUF2+1; 04-07
    stz   SPRBUF2+2; 08-11
.ASM
    stz   SPRBUF2+3; 12-15 ; Player + enemies
    lda   #$C0
    sta   SPRBUF2+4; 16-19
    lda   #$F3 ;f3
    sta   SPRBUF2+5; 20-23 ; Bullet
    lda   #$FF
    sta   SPRBUF2+6; 24-27
    sta   SPRBUF2+7; 28-31
    wai
    wai
    wai

    lda   #$8c
    sta   CURFRAME21

    lda   #$30
    sta   SPRBUF1+SPRIORITY12   ; Set the sprite to highest priority

;;; Hak & Haxter episode II
    jsl bH13_HAK_AND_HAXTER_ep2
;;; End of Hak & Haxter episode II

    jsr   ENM_resetVars
    jsr   ENM_initWave

    ldx   PLY_SHIPY
    stx   dummybyte

;   jsl   CUT_PLYFLD

    jsl bH13_SOME_RANDOM_GIBBERISH

    jsl ADD_BLACK_SIDES_MKAY
    jsl WRITE_FOOBAR_LV1
    jmp READY_FOR_FADEIN_AND_SHIT

ADD_BLACK_SIDES_MKAY
    GOTOXY 4,0                  ; black sides..:)
    jsr DO_ZE_FLLTXT
    GOTOXY 5,0
    jsr DO_ZE_FLLTXT
    GOTOXY 6,0
    jsr DO_ZE_FLLTXT
    GOTOXY 7,0
    jsr DO_ZE_FLLTXT

    jsl bH13_BLACK_SIDES_MKAY
    jmp pgDoneWithZeQQQs1

pgDoTheQQQQloop1
    PRINTS "qqqq"
    rtl
pgDoneWithZeQQQs1
    rtl

READY_FOR_FADEIN_AND_SHIT
;   jsr   PREP_ENEMIES
;   jsl bH13_FADE_IN_macro
    jsl bH13_INIT_doThe50p
    jsl bH13_ENMBLINK_setup
    jsl bH13_FADE_IN_SCROLLBG1
    jmp DA_BIG_LOOP

PLAY_NEXT_WAVE:
;   jsl bH13_INIT_doThe50p
    lda #%11111100
    sta SPRBUF2+3
    lda #$ff
    sta SPRBUF2+4

    inc LEVEL_WAVE
    lda LEVEL_WAVE
    cmp #$01
    beq PNW_loadSprSet2
    cmp #$02
    beq PNW_loadSprSet2
    cmp #$03
    beq PNW_loadSprSet3
    cmp #$04
    beq PNW_loadSprSet3
    cmp #$05
    beq PNW_loadSprSet4
    cmp #$06
    beq PNW_loadSprSet4
    cmp #$07
    beq STAGE1BOSS_sym

PNW_loadSprSet1
    jmp _SHOOTER_dataLoad_SPRT01
PNW_loadSprSet2
    jmp _SHOOTER_dataLoad_SPRT02
PNW_loadSprSet3
    jmp _SHOOTER_dataLoad_SPRT03
PNW_loadSprSet4
    jmp _SHOOTER_dataLoad_SPRT04
PNW_loadSprSet_fin
    wai
    wai
    wai
    jmp _SHOOTER_NOSET_dummy

STAGE1BOSS_sym
    lda #$80
    sta $2100
    lda #NORMAL_SHIP
    sta shipFrame
    jsr setShipFrame
    wai
    jml STAGE1BOSS

_SHOOTER_dataLoad_SPRT01
    LOAD_BLOCK2VRAM SPR_TILES,$6000,$2000
    jmp PNW_loadSprSet_fin
_SHOOTER_dataLoad_SPRT02
    LOAD_BLOCK2VRAM SPR_TILES2,$6000,$2000
    jmp PNW_loadSprSet_fin
_SHOOTER_dataLoad_SPRT03
    LOAD_BLOCK2VRAM SPR_TILES3,$6000,$2000
    jmp PNW_loadSprSet_fin
_SHOOTER_dataLoad_SPRT04
    LOAD_BLOCK2VRAM SPR_TILES4,$6000,$2000
    jmp PNW_loadSprSet_fin

_SHOOTER_NOSET_dummy
    stz   SPRBUF2+3; 12-15 ; Player + enemies
    lda   #$C0
    sta   SPRBUF2+4; 16-19

    stz ENEMY_ALIVE_DEBUG
    stz ENM_patternCounter
    stz ENM_patternDir
    stz ENM_pattSinHalf
    stz ENM_wait_delay
    stz ENM_wait_counter
    jsr ENM_resetVars
    jsr ENM_initWave


DA_BIG_LOOP:
    wai
    jsl bH13_ENGINE_ALL_doThe50p
    jsl bH13_ENMBLINK_doIt
    jsl bH13_ENMBLINK_delay

    lda LEVEL_WAVE
    cmp #$00
    bne _INVGODCHK
    lda ENM_wait_counter
    cmp #$0b
    bpl _NOiCHInIsAN
    jsr ICHINISAN
_NOiCHInIsAN
    lda waitBeforeYouGoGo
    cmp #$00
    beq _INVGODCHK
    stz shipVel

_INVGODCHK:
    lda shipInvulnerable
    cmp #$00
    beq _SHIPINVDONE
    jsl INVULNERABILITY_COUNTDOWN

_SHIPINVDONE:
    lda playerDirWait
    cmp #$01
    bpl _dec_pDW
    jmp _dec_pDW_ende
_dec_pDW
    dec playerDirWait
_dec_pDW_ende

    inc score_d
    lda score_d
    cmp #$0f
    bpl +
    jmp _BSEL
+   stz score_d
    ldy #$0001
    sty score_1
    jsl ADD_SCORE
_BSEL:
; ****PLAY****
;   jsr joypad_audio

    lda waitBeforeYouGoGo
    cmp #$00
    bne _BSTART
    jsr joypad_anim

; removed:
;    lda   joy1+1
;    and   #$20
;    beq   _UP
;    inc   $100D
;    lda   $100D
;    cmp   #$08
;    beq   _BSELRES
;    sta   $2140
;    bra   _UP
;_BSELRES:
;    lda   #$02
;    sta   $100D
;    sta   $4210

; --- NOTE TO MYSELF:
; Move the XABY buttons and stuff to a stand-alone
; include file ("pstuff.inc").
; NOTE TO MYSELF UPDATE:
; Forget about the above note to myself!
    lda playerDirWait
    cmp #$00
    bne _BUTTA

    lda joy1                    ; check L
    and #$20
    beq _BUTTR

    lda playerDir               ; what is current direction?
    cmp #$00
    beq _BUTTR                  ; if direction is left already do branch
    jsr PLAYER_TURN_L
    jsl bH13_WARPSCREEN_done
    stz playerDir
    lda #$1f
    sta playerDirWait
    
_BUTTR
    lda joy1                    ; check R
    and #$10
    beq _BUTTA

    lda playerDir               ; what is current direction?
    cmp #$01
    beq _BUTTA                  ; if direction is right already do branch
    jsr PLAYER_TURN_R
    jsl bH13_WARPSCREEN_done
    lda #$01
    sta playerDir
    lda #$1f
    sta playerDirWait

_BUTTA
.ENDASM
    ; DEBUG VERSION ONLY: Hitting the A-button kills an entire wave of enemies
    ; a.k.a. 'Elle melle moss, jeg vil ikke slaass.'
    lda joy1                    ; check button A
    and #$80
    beq _BUTTX
    lda #$01
    sta ENEMY_ALIVE_DEBUG
    stz ENM_14_alive
    stz ENM_15_alive
    stz ENM_16_alive
    stz ENM_17_alive
    stz ENM_18_alive
    lda #$05
    sta ENM_killCounter
.ASM
_BUTTX
; Check button X
.ENDASM
    ; DEBUG VERSION ONLY: Hitting the X-button decreases player HP by one

    lda joy1
    and #$40
    beq _BUTTY
    jsl HP_DROP
.ASM
; Check button Y
_BUTTY:
    lda joy1+1
    and #$40
    beq _BSTART
    jsr PLAYER_SHOOT

_BSTART:
    lda joy1+1
    and #$10
    beq _UP
    jmp PAUSE_GAME
_pause_over
_UP:
    lda waitBeforeYouGoGo
    cmp #$00
    beq _UP2
    jmp _STANDING
_UP2:
    lda   joy1+1
    and   #$08
    beq   _DOWN

    lda   #$01
    sta   a_byte                ; used for velocity up & down

    ldx   PLY_SHIPX
    stx   PLY_SHIPX
    stx   SPRBUF1+SX12

    stz   a_byte2
    stz   dec_vel_dir
    jsr   MOVE_PLAYER

    ; Has left or right been pressed too?
    lda   joy1+1
    and   #$02
    beq   _DOWN

    lda   #$02
    sta   a_byte2
    sta   dec_vel_dir
    jsr   MOVE_PLAYER

    ldx   PLY_SHIPY
    stx   PLY_SHIPY
    stx   SPRBUF1+SY12

    jml   _DONE
_DOWN:
    lda   joy1+1
    and   #$04
    beq   _LEFT

    lda   #$01
    sta   a_byte                ; used for velocity up & down

    ldx   PLY_SHIPX
    stx   PLY_SHIPX
    stx   SPRBUF1+SX12

    lda   #$01
    sta   a_byte2
    sta   dec_vel_dir
    jsr   MOVE_PLAYER

    ; Has left or right been pressed too?
    lda   joy1+1
    and   #$02
    beq   _LEFT

    lda   #$02
    sta   a_byte2
    sta   dec_vel_dir
    jsr   MOVE_PLAYER

    ldx   PLY_SHIPY
    stx   PLY_SHIPY
    stx   SPRBUF1+SY12

    jml   _DONE
_LEFT:
    lda   joy1+1
    and   #$02
    beq   _RIGHT

    inc   shipVel
    lda   shipVel
    cmp   #$2E
    bmi   _left_vel
    lda   #$2E
_left_vel
    sta   shipVel

    lda   #$02
    sta   a_byte2
    sta   dec_vel_dir
    jsr   MOVE_PLAYER

    ldx   PLY_SHIPY
    stx   PLY_SHIPY
    stx   SPRBUF1+SY12

    jml   _DONE
_RIGHT:
    lda   joy1+1
    and   #$01
    beq   _STANDING

    inc   shipVel
    lda   shipVel
    cmp   #$2E
    bmi   _right_vel
    lda   #$2E
_right_vel
    sta   shipVel

    lda   #$03
    sta   a_byte2
    sta   dec_vel_dir
    jsr   MOVE_PLAYER

    ldx   PLY_SHIPY
    stx   PLY_SHIPY
    stx   SPRBUF1+SY12

    jml   _DONE
_STANDING:
    lda   shipVel
    cmp   #$00
    bne   _dec_shipvel
    jmp   _stnd_vel
_dec_shipvel
    dec   shipVel
_stnd_vel
    lda   shipVel
    cmp   #$00
    beq   _stndstill
    lda   dec_vel_dir
    sta   a_byte2
    ldx   PLY_SHIPY
    stx   dummybyte
    jsr   MOVE_PLAYER
_stndstill

    lda   #$00
    sta   CURFRAME12
    bra   _DONE
_DONE:
    lda   a_byte                ; ship velocity for up & down
    cmp   #$01
    bne   _ud_vel_ende
    sta   a_byte
    inc   shipVel
    inc   shipVel
    lda   shipVel
    cmp   #$2E
    bmi   _ud_vel
    lda   #$2E
_ud_vel
    sta   shipVel
_ud_vel_ende


    ldx   MAPX
    inx
    inx
    inx
    stx   MAPX

    inc   anm_timer             ; Animation-timer for the enemy-sprites
    lda   anm_timer
    cmp   #$0A
    bne   _ANMDONE
    inc   anm_flag0
    lda   anm_flag0
    cmp   #$02
    beq   _ANMRESF0
    sta   anm_flag0
    jmp   _ANMNXTFL
_ANMRESF0:                      ; Reset flag#0
    lda   #$00
    sta   anm_flag0
_ANMNXTFL:                      ; Handle flag#1
    inc   anm_flag1
    lda   anm_flag1
    cmp   #$03
    beq   _ANMRESF1
    sta   anm_flag1
    jmp   _ANMFFLAGS
_ANMRESF1:                      ; Reset flag#1
    lda   #$00
    sta   anm_flag1
_ANMFFLAGS:                     ; Fuck those flags!

    jsr ENM_animateShiat
_ANMDONE:
    sta anm_timer

    jsr ENM_moveShiat

    jsr   CHECK_HITDETECT
    jsr   CHECK_BULLY_DETECT
    jsr   PLAYER_BOUNDARIES
    jsr   HANDLE_BULLIES

    lda BUL_21_delay
    cmp #$00
    beq _noTickyNoBully
    dec BUL_21_delay
_noTickyNoBully

    ; DEBUG dEBUG DEBUG
;   GOTOXY 16,10
;   PRINTS "uuu"
;   PRINTNUM ENM_wait_counter
;   GOTOXY 17,10
;   PRINTS "uuu"
;   GOTOXY 17,10
;   PRINTNUM playerDirWait
;   GOTOXY 18,10
;   PRINTS "uuu"
;   GOTOXY 18,10

    jsl WRITE_FOOBAR_LV1
    jmp _HAPPY_LESSON_WITH_NARUCHAN

WRITE_FOOBAR_LV1
    GOTOXY 4,13    ; FOE gfx tiles + hearts
    PRINTS "q;#$+"
    GOTOXY 5,13
    PRINTS "q%&&(="
    GOTOXY 6,13
    PRINTS "))))))"
    rtl

_HAPPY_LESSON_WITH_NARUCHAN
;   GOTOXY 27,10
;   PRINTNUM ENM_killCounter    ; stage 1 kill per wave count
;   GOTOXY 27,18
;   PRINTNUM LEVEL_WAVE

;-----
    inc   shipAdvHalfFlag
    lda   shipAdvHalfFlag
    cmp   #$02
    bpl   _sahf_stz
    sta   shipAdvHalfFlag
    bra   _sahf_ende
_sahf_stz
    stz   shipAdvHalfFlag
_sahf_ende
;-----
    jsr ENM_checkEnemiesPassed

    ; wave complete?

;   lda ENM_killCounter
;   cmp #$05
;   bmi __WAVE_notCOMPLETE
;   jmp WAVE_COMPLETE

    lda ENM_killCounter
    cmp #$05
    bmi __WAVE_notCOMPLETE
    lda ENM_17_hp            ; *ENM_17_*blinkState*
    cmp #$00
    bne __WAVE_notCOMPLETE      ; branch until ENM_17_blinkState equ zero
    jmp WAVE_COMPLETE


__WAVE_notCOMPLETE
    jmp   DA_BIG_LOOP


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


WAVE_COMPLETE
    jmp PLAY_NEXT_WAVE
;   GOTOXY 7,10
;   PRINTS "WAVE COMPLETE!"
;WC_FOREVER
;   wai
;   jmp WC_FOREVER


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


CALC_ADVNUMPIX
    lda shipVel
    cmp #$00
    beq canp_ende
    cmp #$0B
    bmi canp_half
    cmp #$1A
    bmi canp_one
    bpl canp_two

canp_half
    stz shipAdvNumPix
    jmp canp_ende
canp_one
    lda #$01
    sta shipAdvNumPix
    jmp canp_ende
canp_two
    lda #$02
    sta shipAdvNumPix

canp_ende
    rts


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

; "I need all the power you can get me, Scotty!"

MOVE_PLAYER
    jsr CALC_ADVNUMPIX          ; - "How fast are we going, captain?"
                                ; - "Probably fast e'nuff, lad!"
    lda a_byte2
    cmp #$00                    ; up?
    beq mvp_up
    cmp #$01                    ; down?
    beq mvp_down
    cmp #$02                    ; left?
    beq mvp_left
    cmp #$03                    ; right?
    beq mvp_right
mvp_up
    ldx PLY_SHIPY
    jsr MOVE_WITH_DEX
    stx PLY_SHIPY
    stx SPRBUF1+SY12
    jmp mvp_ende
mvp_down
    ldx PLY_SHIPY
    jsr MOVE_WITH_INX
    stx PLY_SHIPY
    stx SPRBUF1+SY12
    jmp mvp_ende
mvp_left
    ldx PLY_SHIPX
    jsr MOVE_WITH_DEX
    stx PLY_SHIPX
    stx SPRBUF1+SX12
    ldx dummybyte
    stx PLY_SHIPY
    stx SPRBUF1+SY12
    jmp mvp_ende
mvp_right
    ldx PLY_SHIPX
    jsr MOVE_WITH_INX
    stx PLY_SHIPX
    stx SPRBUF1+SX12
    ldx dummybyte
    stx PLY_SHIPY
    stx SPRBUF1+SY12
mvp_ende
    rts


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

; yes! I'm a little bit lazy when it comes to naming
; my dumb inventions <:)

MOVE_WITH_DEX
    lda shipAdvNumPix
    cmp #$00
    beq mwd_half
    cmp #$01
    beq mwd_one
    jmp mwd_two
mwd_half
    lda shipAdvHalfFlag
    cmp #$01
    beq mwd_one
    rts
mwd_two
    lda a_byte2
    cmp #$02
    bmi mwd_two_0
    dex
mwd_two_0
    dex
mwd_one
    dex
    rts


MOVE_WITH_INX
    lda shipAdvNumPix
    cmp #$00
    beq mwi_half
    cmp #$01
    beq mwi_one
    jmp mwi_two
mwi_half
    lda shipAdvHalfFlag
    cmp #$01
    beq mwi_one
    rts
mwi_two
    lda a_byte2
    cmp #$02
    bmi mwi_two_0
    inx
mwi_two_0
    inx
mwi_one
    inx
    rts


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

; ADD_SCORE "calculates" new input in score_1..score_10000.
; e.g: <ldy #$0002, sty score_10, jsr add_score> increases score by 20.
; The score vars can of course be handled by any 16-bits regs..
;
; This is a piece-of-crap trashy routine which alone ensures that
; this game -never- ever will go open-source >:(
;
; I started working at Langva Blikkenslager as a welder last Monday (..lemme
; see..today is Thursday which is 23th Oct.'03.) --->
; which is a really nice workshop with even nicer people. I must say that it
; is quite different from the shipyard I previously worked at!
;
; Okay! ... Two days later I'm back and kicking! Spent about a half hour and
; this routine does now feel much more complete despite the fact that it may
; feel somewhat rough. :-)
;
; Blogs are kinda ..
; </blog>

; myuu .. ..

ADD_SCORE
    phy

    ldy #$0000
    ldy score_1
    cpy #$0000
    beq as_chk_sc10
as_sc1_incloop
    inc scorey_1
    dey
    lda scorey_1
    cmp #$0a
    bpl as_sc1_res              ; reset scorey_1, inc score_10
as_sc1_backOnTrack
    cpy #$0000
    beq as_chk_sc10
    jmp as_sc1_incloop
as_sc1_res
    ;stz scorey_1
    phx
    ldx #$0000
    stx scorey_1
    plx
    inc score_10
    jmp as_sc1_backOnTrack

as_chk_sc10
    ldy #$0000
    ldy score_10
    cpy #$0000
    beq as_chk_sc100
as_sc10_incloop
    inc scorey_10
    dey
    lda scorey_10
    cmp #$0a
    bpl as_sc10_res             ; reset scorey_10, inc score_100
as_sc10_backOnTrack
    cpy #$0000
    beq as_chk_sc100
    jmp as_sc10_incloop
as_sc10_res
;   stz scorey_10
    phx
    ldx #$0000
    stx scorey_10
    plx
    inc score_100
    jmp as_sc10_backOnTrack

as_chk_sc100
    ldy #$0000
    ldy score_100
    cpy #$0000
    beq as_chk_sc1k
as_sc100_incloop
    inc scorey_100
    dey
    lda scorey_100
    cmp #$0a
    bpl as_sc100_res            ; reset scorey_100, inc score_1000
as_sc100_backOnTrack
    cpy #$0000
    beq as_chk_sc1k
    jmp as_sc100_incloop
as_sc100_res
;   stz scorey_100
    phx
    ldx #$0000
    stx scorey_100
    plx
    inc score_1000
    jmp as_sc100_backOnTrack

as_chk_sc1k
    ldy #$0000
    ldy score_1000
    cpy #$0000
    beq as_chk_sc10k
as_sc1k_incloop
    inc scorey_1000
    dey
    lda scorey_1000
    cmp #$0a
    bpl as_sc1k_res             ; reset scorey_1000, inc score_10000
as_sc1k_backOnTrack
    cpy #$0000
    beq as_chk_sc10k
    jmp as_sc1k_incloop
as_sc1k_res
;   stz scorey_1000
    phx
    ldx #$0000
    stx scorey_1000
    plx
    inc score_10000
    jmp as_sc1k_backOnTrack

as_chk_sc10k
    ldy #$0000
    ldy score_10000
    cpy #$0000
    beq as_scoreEnd
as_sc10k_incloop
    inc scorey_10000
    dey
    lda scorey_10000
    cmp #$0a
    bpl as_sc10k_res            ; lock scorey_10000
as_sc10k_backOnTrack
    cpy #$0000
    beq as_scoreEnd
    jmp as_sc10k_incloop
as_sc10k_res
    phx
    ldx #$0000
    stx scorey_10000
    plx

as_scoreEnd
    ply
    stz score_10
    stz score_100
    stz score_1000
    stz score_10000
    jsl UPDATE_SCORE
    rtl


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


UPDATE_SCORE
    GOTOXY 1,22
    PRINTNUM scorey_1           ; print 1
    GOTOXY 1,21
    PRINTNUM scorey_10          ; print 10
    GOTOXY 1,20
    PRINTNUM scorey_100         ; print 100
    GOTOXY 1,19
    PRINTNUM scorey_1000        ; print 1000
    GOTOXY 1,18
    PRINTNUM scorey_10000       ; print 10000

    rtl
    

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


RESET_SCOREZ
    stz score_1
    stz score_10
    stz score_100
    stz score_1000
    stz score_10000
    stz scorey_1
    stz scorey_10
    stz scorey_100
    stz scorey_1000
    stz scorey_10000

    rtl


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


PAUSE_GAME:
    jsl bH13_PAUSE_GAME_chunk1st
    jmp pgDoneWithZeQQQs

pgDoTheQQQQloop
    PRINTS "qqqq"
    rtl


pgDoneWithZeQQQs

    lda #%0000111               ; disable obj/oam layer
    sta $212C

    lda #SONG_SPOOKIE
    jsr AUDIO_PLAY_SONG
    wai

    LOAD_PAL BG_PAUPAL
    wai
    wai
    wai
    LOAD_BLOCK2VRAM BG_PAUDAT,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM BG_PAUGFX,$1000,$0800
    wai
    wai
    wai

    lda #V1SFX_SQUISH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX

    GOTOXY 15,11
    PRINTS "v|nnnnnn@w"
    GOTOXY 16,11
    PRINTS "zqqqqqqqq{"
    GOTOXY 17,11
    PRINTS "lqqqqqqqqm"
    GOTOXY 18,11
    PRINTS "jqqqqqqqqk"
    GOTOXY 19,11
    PRINTS "x}ooooooiy"

    phy
    ldy #$64
    ldx #$0C
    stx a_word
    stz a_byte
    stz a_byte2                 ; fadein counter
    stz $100C                   ; fadein delay
pg_delay
    wai
    jsr PAUSE_SCROLL
    jsr PAUSE_GAMEA
    jsr PAUSE_FADEIN
    dey
    cpy #$00
    bne pg_delay

pg_loop
    wai
    jsr PAUSE_SCROLL
    jsr PAUSE_GAMEA
    lda joy1+1
    and #$10
    beq pg_loop

    lda #V0SFX_DEEP_THUMP
    sta V0SFX
    jsr AUDIO_PLAY_V0SFX

    ldy #$32
    lda #$0F
    sta a_byte2                 ; fadeout counter
    stz $100C                   ; fadeout delay
pg_delay2
    wai
    jsr PAUSE_SCROLL
    jsr PAUSE_GAMEA
    jsr PAUSE_FADEOUT
    dey
    cpy #$00
    bne pg_delay2

    lda #$00
    sta $2100

    GOTOXY 15,11
    jsr pg_do_uuuuuuuuuu_loop
    GOTOXY 16,11
    jsr pg_do_uuuuuuuuuu_loop
    GOTOXY 17,11
    jsr pg_do_uuuuuuuuuu_loop
    GOTOXY 18,11
    jsr pg_do_uuuuuuuuuu_loop
    GOTOXY 19,11
    jsr pg_do_uuuuuuuuuu_loop
    jmp pg_do_uuuuuuuuuu_ende
pg_do_uuuuuuuuuu_loop
    PRINTS "uuuuuuuuuu"
    rts
pg_do_uuuuuuuuuu_ende

    stz MAPX                    ; Restore star positions
    stz MAPY

    LOAD_PAL BG_PAL
    wai
    LOAD_BLOCK2VRAM BG_MAPDAT,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM BG_MAPGFX,$1000,$0800
    wai
    wai
    wai

    lda MUSIC
    jsr AUDIO_PLAY_SONG
    wai
    wai

    lda #%0011111               ; enable obj/oam layer
    sta $212C
    ply

    jsl bH13_PAUSE_GAME_chunk2nd
    jmp pgDoneWithZeUUUs

pgDoTheUUUUloop
    PRINTS "uuuu"
    rtl

pgDoneWithZeUUUs

    jsl ADD_BLACK_SIDES_MKAY
    GOTOXY 4,13    ; FOE gfx tiles + hearts
    PRINTS "q;#$+"
    GOTOXY 5,13
    PRINTS "q%&&(="
    GOTOXY 6,13
    PRINTS "))))))"


    ; Fadein while scrolling bg#1
    pha
    phx
    phy
    ldy $100E
    stz $100E
pgfi_m_fin_r
    ldx #$05
pgfi_m_fin_l
    phx
    ldx MAPX
    inx
    inx
    inx
    stx MAPX
    plx
    wai
    dex
    cpx #$00
    bne pgfi_m_fin_l
    inc $100E
    lda $100E
    sta $2100
    cmp #$0F
    bne pgfi_m_fin_r
    sty $100E
    ply
    plx
    pla

    jmp _pause_over


PAUSE_GAMEA
    ldx a_word
    dex
    cpx #$0000
    beq pg_wrchk
    stx a_word
    rts
pg_wrchk
    ldx #$0C
    stx a_word
    lda a_byte
    cmp #$00
    beq pg_writeit
    GOTOXY 17,11
    PRINTS "lqqqqqqqqm"
    jmp pg_aftermath
pg_writeit
    GOTOXY 17,11
    PRINTS "lqPAUSEDqm"
pg_aftermath
    inc a_byte
    lda a_byte
    cmp #$02
    beq pg_wstz
    sta a_byte
    jmp pg_wend
pg_wstz
    stz a_byte
pg_wend
    rts


PAUSE_SCROLL
    dec $100E
    lda $100E
    cmp #$00
    bne ps_sbpl
    sta $100E
    inc $100D
    lda $100D
    cmp #$04
    bne ps_snoinc
    lda #$00
    sta $100D
    jmp ps_sbpl
ps_snoinc
    sta $100D
    lda #$C8
ps_sbpl
    sta $100E

    phx
    lda $100D
    cmp #$00
    bne ps_sright
    sta $100D
    ldx MAPY
    inx
    inx
    inx
    stx MAPY
    jmp ps_wend
ps_sright
    lda $100D
    cmp #$01
    bne ps_sdown
    sta $100D
    ldx MAPX
    dex
    dex
    dex
    stx MAPX
    jmp ps_wend
ps_sdown
    lda $100D
    cmp #$02
    bne ps_sleft
    sta $100D
    ldx MAPY
    dex
    dex
    dex
    stx MAPY
    jmp ps_wend
ps_sleft
    lda $100D
    cmp #$03
    bne ps_wend                 ; this instruction *never* gets executed :-)
    sta $100D
    ldx MAPX
    inx
    inx
    inx
    stx MAPX
ps_wend
    plx
    rts


PAUSE_FADEIN
    inc $100C                   ; delay before more fading
    lda $100C
    cmp #$05
    bne pfi_wend
    stz $100C

    lda a_byte2
    cmp #$0F
    beq pfi_full
    sta a_byte2
    inc a_byte2
    jmp pfi_wend
pfi_full
    sta a_byte2
pfi_wend
    lda a_byte2
    sta $2100
    rts


PAUSE_FADEOUT
    inc $100C                   ; delay before more fading
    lda $100C
    cmp #$05
    bne pfo_wend
    stz $100C

    lda a_byte2
    cmp #$00
    beq pfo_min
    sta a_byte2
    dec a_byte2
    jmp pfo_wend
pfo_min
    sta a_byte2
pfo_wend
    lda a_byte2
    sta $2100
    rts


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


; Fortunately, this sloppy source-code will probably never
; ever be released to the public so with that in mind I'm
; ready for some more action (read: hacks ;)

CUT_PLYFLD:                     ; Camouflage :)
    jsl bH13_cutPlyFldpart1

    GOTOXY 4,0
    jsr CPLYF_CAMOUFLAGE
    GOTOXY 5,0
    jsr CPLYF_CAMOUFLAGE
    GOTOXY 6,0
    jsr CPLYF_CAMOUFLAGE
    GOTOXY 7,0
    jsr CPLYF_CAMOUFLAGE

    rtl

CPLYF_CAMOUFLAGE
    PRINTS "qqqquuuuuuuuuuuuuuuuuuuuuuuuqqqq"
    rts


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


PLAYER_BOUNDARIES:
    ldx PLY_SHIPX
    cpx #$22
    bmi pb_set_minx
    jmp pb_chk_maxx
pb_set_minx
    ldx #$22
    stx PLY_SHIPX
pb_chk_maxx
    ldx PLY_SHIPX
    cpx #$BE
    bpl pb_set_maxx
    jmp pb_chk_miny
pb_set_maxx
    ldx #$BE
    stx PLY_SHIPX
pb_chk_miny
    ldx PLY_SHIPY
    cpx #$42 ;$22
    bmi pb_set_miny
    jmp pb_chk_maxy
pb_set_miny
    ldx #$42;$22
    stx PLY_SHIPY
pb_chk_maxy
    ldx PLY_SHIPY
    cpx #$BC
    bpl pb_set_maxy
    jmp pb_end
pb_set_maxy
    ldx #$BC
    stx PLY_SHIPY
pb_end
    rts


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

; VBLANK handling

VBLANK:
    rep   #$30                  ; A/mem=X/Y=16bits
    phb
    pha
    phx
    phy
    phd
    sep   #$20                  ; A/mem=8bits, X/Y=16bits

    ; Transfer sprite data (OAM)
    stz   $2102
    stz   $2103
    ldy   #$0400
    sty   $4300
    ldy   #$0400
    sty   $4302
    ldy   #$0220
    sty   $4305
    lda   #$7E
    sta   $4304
    lda   #$01
    sta   $420B

    ; Transfer BG#2 data
    lda   #$00
    sta   $2115
    ldx   #$5800
    stx   $2116
    ldy   #$1800
    sty   $4300
    ldy   #$0000
    sty   $4302
    ldy   #$0400
    sty   $4305
    lda   #$7F
    sta   $4304
    lda   #$01
    sta   $420B

    ; Update the map-coordinates
    lda   MAPX                  ; plane 1 coords
    sta   $210D
    lda   MAPX+1
    sta   $210D
    lda   MAPY
    sta   $210E
    lda   MAPY+1
    sta   $210E

    lda   mapXbg2               ; plane 2 coords
    sta   $210f
    lda   mapXbg2+1
    sta   $210f
    lda   mapYbg2
    sta   $2110
    lda   mapYbg2+1
    sta   $2110 

    jsr   processAnimations
    jsl   JOY_GETINPUT

    lda   $4210                 ; Clear NMI flag
    rep   #$30                  ; A/mem=X/Y=16bits
    pld
    ply
    plx
    pla
    plb
    rti


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


; I admit that the logo-code is just plain horrible, but it was
; just to get over with it quick'n'easy -- no pun intended! pEACE!
.ENDASM
DISPLAY_LOGO:
    phx
    GOTOXY 0,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 1,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 2,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 3,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 4,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 5,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 6,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 7,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 8,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 9,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 10,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 11,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 12,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 13,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 14,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 15,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 16,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 17,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 18,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 19,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 20,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 21,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 22,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 23,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 24,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 25,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 26,0
    jsr   DO_ZE_FLLTXT
    GOTOXY 27,0
    jsr   DO_ZE_FLLTXT

    ldx   #$64
DLOGO_BLD:
    wai
    dex
    cpx   #$00
    bne   DLOGO_BLD
    GOTOXY 13,12
    PRINTS "a"
    jsr   DLOGO_REST
    GOTOXY 14,17
    PRINTS "n"
    jsr   DLOGO_REST
    GOTOXY 14,15
    PRINTS "l"
    jsr   DLOGO_REST
    GOTOXY 13,19
    PRINTS "h"
    jsr   DLOGO_REST
    GOTOXY 14,13
    PRINTS "j"
    jsr   DLOGO_REST
    GOTOXY 13,16
    PRINTS "e"
    jsr   DLOGO_REST
    GOTOXY 13,14
    PRINTS "c"
    jsr   DLOGO_REST
    GOTOXY 14,16
    PRINTS "m"
    jsr   DLOGO_REST
    GOTOXY 14,19
    PRINTS "p"
    jsr   DLOGO_REST
    GOTOXY 13,17
    PRINTS "f"
    jsr   DLOGO_REST
    GOTOXY 14,12
    PRINTS "i"
    jsr   DLOGO_REST
    GOTOXY 13,15
    PRINTS "d"
    jsr   DLOGO_REST
    GOTOXY 14,18
    PRINTS "o"
    jsr   DLOGO_REST
    GOTOXY 14,14
    PRINTS "k"                  ; K ..
    jsr   DLOGO_REST
    GOTOXY 13,18
    PRINTS "g"                  ; .. G ..
    jsr   DLOGO_REST
    GOTOXY 13,13
    PRINTS "b"                  ; .. B .. -- haha! Get it? Neither do I!
    jmp   DLOGO_END
DLOGO_REST:
    ldx   #$03
    jsr   theWayOfTheWAI
    rts
;DLOGO_RLOOP:
;   wai
;   dex
;   cpx   #$00
;   bne   DLOGO_RLOOP
;   rts
DLOGO_END:
; ****PLAY**** removed:
;    jsl   SONG_DATA
    ldx   #$64
DLOGO_ENDR:
    wai
    dex
    cpx   #$00
    bne   DLOGO_ENDR
    GOTOXY 13,13
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 13,18
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,14
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,18
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 13,15
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,12
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 13,17
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,19
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,16
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 13,14
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 13,16
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,13
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 13,19
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,15
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 14,17
    PRINTS "q"
    jsr   DLOGO_REST
    GOTOXY 13,12
    PRINTS "q"
    ldx   #$0032
DLOGO_ENDR2:
    wai
    dex
    cpx   #$00
    bne   DLOGO_ENDR2
    GOTOXY 0,0
    jsr   SPLSC_CLRTXT
    GOTOXY 1,0
    jsr   SPLSC_CLRTXT
    GOTOXY 2,0
    jsr   SPLSC_CLRTXT
    GOTOXY 3,0
    jsr   SPLSC_CLRTXT
    GOTOXY 4,0
    jsr   SPLSC_CLRTXT
    GOTOXY 5,0
    jsr   SPLSC_CLRTXT
    GOTOXY 6,0
    jsr   SPLSC_CLRTXT
    GOTOXY 7,0
    jsr   SPLSC_CLRTXT
    GOTOXY 8,0
    jsr   SPLSC_CLRTXT
    GOTOXY 9,0
    jsr   SPLSC_CLRTXT
    GOTOXY 10,0
    jsr   SPLSC_CLRTXT
    GOTOXY 11,0
    jsr   SPLSC_CLRTXT
    GOTOXY 12,0
    jsr   SPLSC_CLRTXT
    GOTOXY 13,0
    jsr   SPLSC_CLRTXT
    GOTOXY 14,0
    jsr   SPLSC_CLRTXT
    GOTOXY 15,0
    jsr   SPLSC_CLRTXT
    GOTOXY 16,0
    jsr   SPLSC_CLRTXT
    GOTOXY 17,0
    jsr   SPLSC_CLRTXT
    GOTOXY 18,0
    jsr   SPLSC_CLRTXT
    GOTOXY 19,0
    jsr   SPLSC_CLRTXT
    GOTOXY 20,0
    jsr   SPLSC_CLRTXT
    GOTOXY 21,0
    jsr   SPLSC_CLRTXT
    GOTOXY 22,0
    jsr   SPLSC_CLRTXT
    GOTOXY 23,0
    jsr   SPLSC_CLRTXT
    GOTOXY 24,0
    jsr   SPLSC_CLRTXT
    GOTOXY 25,0
    jsr   SPLSC_CLRTXT
    GOTOXY 26,0
    jsr   SPLSC_CLRTXT
    GOTOXY 27,0
    jsr   SPLSC_CLRTXT

DLOGO_TRD:
    plx
    rts
.ASM

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


INIT_VIDEO_03:
    php
    rep #$10                    ; A/mem=8bits, X/Y=16bits
    sep #$20
    lda #$A3                    ; Spr sizes = 32x32||64x64,
                                ; VRAM chr data address = $6000
    sta $2101
    lda #$03                    ; Mode #3, 8x8 (BG#1=8bpp, BG#2=4bpp)
    sta $2105
    lda #$08                    ; BG#1 tilemap VRAM offs = $0000 ..
    sta $2107                   ; .. and tilemap size = 64x64 tiles
    lda #$21                    ; BG#1 chr VRAM offs = $1000
    sta $210B                   ; BG#2 chr VRAM offs = $2000
    lda #$58                    ; BG#2 tilemap VRAM offs = $5800 ..
    sta $2108                   ; .. and tilemap size = 32x32 tiles
    lda #$13                    ; Enable BG#1, BG#2 and BG#5
    sta $212C
    lda #$0F
    sta $2100                   ; Turn on screen, full brightness
    lda #$FF                    ; Scroll BG#2 down by one pixel
    sta $2110
    sta $2110
    plp

    ldx #$00ff                  ; same as above
    stx mapYbg2

    rts


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


INIT_VIDEO_04:
    php
    rep #$10                    ; A/mem=8bits, X/Y=16bits
    sep #$20
    lda #$A3                    ; Spr sizes = 32x32||64x64,
                                ; VRAM chr data address = $6000
    sta $2101
    lda #$04                    ; Mode #4, 8x8 (BG#1=8bpp, BG#2=2bpp)
    sta $2105
    lda #$03                    ; BG#1 tilemap VRAM offs = $0000 ..
    sta $2107                   ; .. and tilemap size = 64x64 tiles
    lda #$52                    ; BG#1 chr VRAM offs = $1000
    sta $210B                   ; BG#2 chr VRAM offs = $2000
    lda #$58                    ; BG#2 tilemap VRAM offs = $5800 ..
    sta $2108                   ; .. and tilemap size = 32x32 tiles
    lda #$13                    ; Enable BG#1, BG#2 and BG#5
    sta $212C
    lda #$0F
    sta $2100                   ; Turn on screen, full brightness
    lda #$FF                    ; Scroll BG#2 down by one pixel
    sta $2110
    sta $2110
    plp

    ldx #$00ff                  ; same as above
    stx mapYbg2

    rts


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


; ****PLAY****
; joypad audio processing (stage 1 only)
; - if select is pressed, play the next song
; - if top right is pressed, play the next voice 0 sfx
; - if top left is pressed, play the next voide 1 sfx
.ENDASM
joypad_audio:

; check for select
    lda joy1+$01
    and #SELECT
    beq ja_no_select
    
    lda OLD_JOY_HI
    and #SELECT
    bne ja_no_select
    
    inc MUSIC
    lda MUSIC
    cmp #SONG_PENNY+$01
    bmi ja_play_song

    lda #NO_SONG
    sta MUSIC
    
ja_play_song:
    jsr AUDIO_PLAY_SONG

ja_no_select
    jmp ja_no_top_left ;; ELIMINATES L&R checks soundwise.

; check for top right button
    lda joy1
    and #TOP_RIGHT
    beq ja_no_top_right

    lda OLD_JOY_LOW
    and #TOP_RIGHT
    bne ja_no_top_right
    
    inc V0SFX
    lda V0SFX
    cmp #V0SFX_DEEP_THUMP+$01
    bmi ja_play_v0sfx
    
    lda #V0SFX_EXPLOSION
    sta V0SFX
    
ja_play_v0sfx
    jsr AUDIO_PLAY_V0SFX
    
ja_no_top_right

; check for top left button
    lda joy1
    and #TOP_LEFT
    beq ja_no_top_left

    lda OLD_JOY_LOW
    and #TOP_LEFT
    bne ja_no_top_left
    
    inc V1SFX
    lda V1SFX
    cmp #V1SFX_SQUISH+$01
    bmi ja_play_v1sfx
    
    lda #V1SFX_PING_HIGH
    sta V1SFX

ja_play_v1sfx
    jsr AUDIO_PLAY_V1SFX

ja_no_top_left:

; remember joypad
    lda joy1
    sta OLD_JOY_LOW
    lda joy1+$01
    sta OLD_JOY_HI

    rts
.ASM

joypad_anim
    lda joy1+1
    and #$08
    beq ja_no_up

    stz shipLastDir

    inc shipAnim
    lda shipAnim
    cmp #$20
    bpl ja_enough_00
    jmp ja_moveon_00
ja_enough_00
    lda #$20
    sta shipAnim
    rts
ja_moveon_00
    cmp #$12
    bmi ja_anim_up1
    beq ja_anim_up1
    bpl ja_anim_up2

ja_anim_up1
    lda #UP_SHIP
    jsr setShipFrame
    rts
ja_anim_up2
    lda #UP2_SHIP
    jsr setShipFrame
    rts

ja_no_up
    lda joy1+1
    and #$04
    beq ja_no_down

    lda #$01
    sta shipLastDir

    inc shipAnim
    lda shipAnim
    cmp #$20
    bpl ja_enough_01
    jmp ja_moveon_01
ja_enough_01
    lda #$20
    sta shipAnim
    rts
ja_moveon_01
    cmp #$12
    bmi ja_anim_dw1
    beq ja_anim_dw1
    bpl ja_anim_dw2

ja_anim_dw1
    lda #DOWN_SHIP
    jsr setShipFrame
    rts
ja_anim_dw2
    lda #DOWN2_SHIP
    jsr setShipFrame
    rts

ja_no_down
     dec shipAnim
     dec shipAnim
     lda shipAnim
     cmp #$01
     beq ja_no_down_f0
     bmi ja_no_down_f0

     cmp #$13                   ; if shipAnim > 0 && <= 18
     beq ja_no_down_f1
     bmi ja_no_down_f1          ; do frame #1

     cmp #$20                   ; if shipAnim > 18 && <= 32
     beq ja_no_down_f2          ; do frame #2
     bmi ja_no_down_f2

ja_no_down_f0                   ; set ship frame #0
     stz shipAnim
     lda #NORMAL_SHIP
     jmp ja_no_down_ende

ja_no_down_f1                   ; set ship frame #1
     sta shipAnim

     lda shipLastDir
     cmp #$00
     bne ja_no_down_f1_down
     lda #UP_SHIP
     jmp ja_no_down_ende
ja_no_down_f1_down
     lda #DOWN_SHIP
     jmp ja_no_down_ende

ja_no_down_f2                   ; set ship frame #2
     sta shipAnim

     lda shipLastDir
     cmp #$00
     bne ja_no_down_f2_down
     lda #UP2_SHIP
     jmp ja_no_down_ende
ja_no_down_f2_down
     lda #DOWN2_SHIP
     jmp ja_no_down_ende

ja_no_down_ende
     jsr setShipFrame
     rts



;=================================================================
;  SOUND 'zn MUSIC AND STUFF!!

sym_MUS_NO_SONG                 ; $00
    lda #NO_SONG
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_ASCHE              ; $01
    lda #SONG_ASCHE
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_ATOMIC             ; $02
    lda #SONG_ATOMIC
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_AWOLF              ; $03
    lda #SONG_AWOLF
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_AXELAY             ; $04
    lda #SONG_AXELAY
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_BOWSER             ; $05
    lda #SONG_BOWSER
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_C1GO               ; $06
    lda #SONG_C1GO
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_C2GO               ; $07
    lda #SONG_C2G0
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_GRADIUS            ; $08
    lda #SONG_GRADIUS
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_ICE                ; $09
    lda #SONG_ICE
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_LUIGI              ; $0a
    lda #SONG_LUIGI
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_SPOOKIE            ; $0b
    lda #SONG_SPOOKIE
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_UNSQUAD            ; $0c
    lda #SONG_UNSQUAD
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_XENON              ; $0d
    lda #SONG_XENON
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_GOKU               ; $0e
    lda #SONG_GOKU
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_MERRY              ; $0f
    lda #SONG_MERRY
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_METLM              ; $10
    lda #SONG_METLM
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_SEASIA             ; $11
    lda #SONG_SEASIA
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_RUD21              ; $12
    lda #SONG_RUD21
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_FZERO              ; $13
    lda #SONG_FZERO
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_GOOP               ; $14
    lda #SONG_GOOP
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_SHERB              ; $15
    lda #SONG_SHERB
    jmp sym_MUS_fillInDaRestBiatch

sym_MUS_SONG_PENNY              ; $16
    lda #SONG_PENNY
    jmp sym_MUS_fillInDaRestBiatch


sym_MUS_fillInDaRestBiatch
    sta MUSIC
    jsr AUDIO_PLAY_SONG
    wai
    wai
    rtl


sym_SFX_EXPLOSION
    lda #V0SFX_EXPLOSION
    sta V0SFX
    jsr AUDIO_PLAY_V0SFX
    rtl

sym_SFX_GUN_FIRE
    lda #V0SFX_GUN_FIRE
    sta V0SFX
    jsr AUDIO_PLAY_V0SFX
    rtl

sym_SFX_GLASS_SMASH
    lda #V0SFX_GLASS_SMASH
    sta V0SFX
    jsr AUDIO_PLAY_V0SFX
    rtl

sym_SFX_INTERFERENCE
    lda #V0SFX_INTERFERENCE
    sta V0SFX
    jsr AUDIO_PLAY_V0SFX
    rtl

sym_SFX_DEEP_THUMP
    lda #V0SFX_DEEP_THUMP
    sta V0SFX
    jsr AUDIO_PLAY_V0SFX
    rtl

sym_SFX_PING_HIGH
    lda #V1SFX_PING_HIGH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    rtl

sym_SFX_PING_LOW
    lda #V1SFX_PING_LOW
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    rtl

sym_SFX_DING_A_LING_HIGH
    lda #V1SFX_DING_A_LING_HIGH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    rtl

sym_SFX_DING_A_LING_LOW
    lda #V1SFX_DING_A_LING_LOW
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    rtl

sym_SFX_LASER_FIRE
    lda #V1SFX_LASER_FIRE
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    rtl

sym_SFX_SQUISH
    lda #V1SFX_SQUISH
    sta V1SFX
    jsr AUDIO_PLAY_V1SFX
    rtl



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



bH0_SPLSC_CLR
    jsr SPLSC_CLR
    rtl


;DEBUG_STANDVAL
;   GOTOXY 10,10
;   PRINTS "uuuu"
;   GOTOXY 10,10
;   PRINTNUM ENM_18_f2
;   rtl
;DEBUG_COUNTVAL
;   GOTOXY 11,10
;   PRINTS "uuuu"
;   GOTOXY 11,10
;   PRINTNUM ENM_18_f3
;   rtl
;bH0_PRINTS_SB1_BARNETISS
;   PRINTS "BARNETISS"
;   rtl
;bH0_PRINTS_TEMPCOUNTER
;   GOTOXY 3,2
;   PRINTS "uuuuuuu"
;   GOTOXY 3,3
;   PRINTNUM ENM_17_hp
;   rtl
bH0_PRINTS_MSG_ENDSCORE
    GOTOXY 11,11
    PRINTS "ENDuSCORE"
    GOTOXY 13,17
    PRINTNUM scorey_1
    GOTOXY 13,16
    PRINTNUM scorey_10
    GOTOXY 13,15
    PRINTNUM scorey_100
    GOTOXY 13,14
    PRINTNUM scorey_1000
    GOTOXY 13,13
    PRINTNUM scorey_10000
    rtl


bH0_PRINTS_START_TO_SKIP1
    GOTOXY 27,4
;          "0123456789ABCDEF01234567"
    PRINTS "qqqPRESSqSTARTqBUTTONqqq"
    rtl
bH0_PRINTS_START_TO_SKIP2
    GOTOXY 27,4
    PRINTS "qqqqqqqqTOqSKIPqqqqqqqqq"
    rtl
bH0_PRINTS_START_TO_SKIP3
    GOTOXY 27,4
    PRINTS "qqqCINEMATICqSEQUENCEqqq"
    rtl
bH0_PRINTS_START_TO_SKIP4
    GOTOXY 27,4
    PRINTS "uuuuuuuuuuuuuuuuuuuuuuuu"
    rtl
bH0_PRINTS_START_TO_SKIP5
    GOTOXY 27,4
    PRINTS "qqqqqqqqqqqqqqqqqqqqqqqq"
    rtl

bH0_PRINTS_SB1_SEQWLOADAH_banner
    GOTOXY 2,0
    PRINTS "qqqqqqqqqkllllllllllllmqqqqqqqqq"
    GOTOXY 3,0
    PRINTS "qqqqqqqqqnuuuuuuuuuuuupqqqqqqqqq"
    GOTOXY 4,0
    PRINTS "qqqqqqqqqnuuuuuuuuuuuupqqqqqqqqq"
    GOTOXY 5,0
    PRINTS "qqqqqqqqqnuuuuuuuuuuuupqqqqqqqqq"
    GOTOXY 6,0
    PRINTS "qqqqqqqqqnuuuuuuuuuuuupqqqqqqqqq"
    GOTOXY 7,0
    PRINTS "qqqqqqqqqvttttttttttttwqqqqqqqqq"
    rtl

bH0_PRINTS_SB1_SEQWLOADAH_txt1
    GOTOXY 10,4
    PRINTS "HURRY UP AND PRESS START"
    GOTOXY 11,6
    PRINTS "TO SKIP THE SEQUENCE"
    rtl

bH0_PRINTS_SB1_SEQWLOADAH_txt2
    GOTOXY 21,2
    PRINTS "HURRY, TIME IS RUNNING OUT!!"
    rtl
bH0_PRINTS_SB1_SEQWLOADAH_txt3
    GOTOXY 23,2
    PRINTS "BUT WHAT IF I FAIL?"  ; then you're screwed, Neo! Screwed!
    rtl
bH0_PRINTS_SB1_SEQWLOADAH_txt4
    GOTOXY 24,2
    PRINTS "NO..TRINITY..."       ; hahaha!!!
    rtl

bH0_PRINTS_SB1_SEQWLOADAH_box
    GOTOXY 14,14
    PRINTS "kllm"
    GOTOXY 15,14
    PRINTS "n10p"
    GOTOXY 16,14
    PRINTS "vttw"
    rtl

bH0_PRINTS_SB1_SEQWLOADAH_num
    GOTOXY 15,15
    PRINTS "0"
    GOTOXY 15,16
    PRINTNUM a_byte
    rtl



bH0_PRINTS_SB1_DAIJOUBU_KA
    GOTOXY 16,2
    PRINTS "ANGEL: #$%\&o(*+"
    GOTOXY 17,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_ERR_YES
    GOTOXY 18,2
    PRINTS "MANKO: ERR, YES.. I THINK SO."
    GOTOXY 19,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_YOKATTA
    GOTOXY 20,2
    PRINTS "ANGEL: `*ab!"
    GOTOXY 21,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_STATUS_IS_WHAT
    GOTOXY 22,2
    PRINTS "ANGEL: defgd/?"
    GOTOXY 23,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_RATHER_CRAP
    GOTOXY 24,2
    PRINTS "MANKO: RATHER CRAP, REALLY!"
    GOTOXY 25,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl
;----
bH0_PRINTS_SB1_JUST_ABOUT
    GOTOXY 16,2
    PRINTS "MANKO: JUST ABOUT EVERYTHING,"
    GOTOXY 17,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_BUT_THE_PHAZER
    GOTOXY 18,2
    PRINTS "BUT THE DAGG-R; AND THE SHIP'S"
    rtl

bH0_PRINTS_SB1_BASIC_CONTROL
    GOTOXY 20,2
    PRINTS "BASIC CONTROL SYSTEM WAS"
    rtl

bH0_PRINTS_SB1_DESTROYED
    GOTOXY 22,2
    PRINTS "DESTROYED DUE TO THAT NASTY"
    rtl

bH0_PRINTS_SB1_FREAK_ACCIDENT
    GOTOXY 24,2
    PRINTS "FREAK COLLISION ACCIDENT."
    rtl
;----

bH0_PRINTS_SB1_BUT_AS_LONG
    GOTOXY 16,2
    PRINTS "MANKO: BUT AS LONG AS THERE'S"
    GOTOXY 17,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_LIFE_HOPE
    GOTOXY 18,2
    PRINTS "       LIFE, THERE IS HOPE."
    rtl

bH0_PRINTS_SB1_YAY_PLUS_HEART
    GOTOXY 20,2
    PRINTS "ANGEL: `c!! )"
    GOTOXY 21,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_CRAPPY_MUSIC_1
    GOTOXY 22,2
    PRINTS "MANKO: UNN.. WHAT'S UP WITH"
    GOTOXY 23,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_CRAPPY_MUSIC_2
    GOTOXY 24,2
    PRINTS "THIS CRAPPY MUSIC ANYWAY?!"
    rtl

;----

bH0_PRINTS_SB1_e2_CHIKUSHOU
    GOTOXY 16,2
    PRINTS "ANGEL: ]"
    GOTOXY 17,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl
bH0_PRINTS_SB1_e2_CHIKUSHOU2
    GOTOXY 16,2
    PRINTS "ANGEL: ] ][c&o_"
    GOTOXY 17,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_e2_IAMHAPPY
    GOTOXY 18,2
    PRINTS "MANKO: I'M HAPPY I GOT TO"
    GOTOXY 19,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_e2_NICEKNOWINGYOU
    GOTOXY 20,2
    PRINTS "KNOW YOU, ANGELA"
    rtl

bH0_PRINTS_SB1_e2_WWWDOTCOM
    PRINTS "."
    rtl

bH0_PRINTS_SB1_e2_ANGDOTx3
    GOTOXY 22,2
    PRINTS "ANGEL: . . ."
    GOTOXY 23,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl

bH0_PRINTS_SB1_SKYtop
    PRINTS "3456789:"
    rtl
bH0_PRINTS_SB1_SKYbtm
    PRINTS "CDEFGHIJ"
    rtl
bH0_PRINTS_SB1_SKY1top
    PRINTS "3456666666789:"
    rtl
bH0_PRINTS_SB1_SKY1btm
    PRINTS "CDEF222222GHIJ"
    rtl

bH0_PRINTS_S1BMEANWHILE1of2
    PRINTS "MEANWHILE,"
    rtl
bH0_PRINTS_S1BMEANWHILE2of2
    PRINTS "SOMEWHERE BELOW..."
    rtl
;----
bH0_PRINTS_S1BAUDIENCE_AV_HERO        ; "avatar" hero
    PRINTS "&()+"
    rtl
bH0_PRINTS_S1BAUDIENCE_AV_KING        ; "avatar" king
    PRINTS "\"#$-"
    rtl
bH0_PRINTS_S1BAUDIENCE_00
    PRINTS "Whyuhellouthere,"
    rtl
bH0_PRINTS_S1BAUDIENCE_01
    PRINTS "LIGHTuWARRIOR!uu"
    rtl
bH0_PRINTS_S1BAUDIENCE_02
    PRINTS "S'*puolduman?uuu"
    rtl
bH0_PRINTS_S1BAUDIENCE_03
    PRINTS ".....uQ*iteusome"
    rtl
bH0_PRINTS_S1BAUDIENCE_04
    PRINTS "foxyuhoesuyo*uuu"
    rtl
bH0_PRINTS_S1BAUDIENCE_05
    PRINTS "gotuthere,uKING!"
    rtl
bH0_PRINTS_S1BAUDIENCE_06
    PRINTS "Hahaha!uNo,uno.."
    rtl
bH0_PRINTS_S1BAUDIENCE_07
    PRINTS "LIGHTuWARRIOR,uu"
    rtl
bH0_PRINTS_S1BAUDIENCE_08
    PRINTS "letumeuintrod*ce"
    rtl
bH0_PRINTS_S1BAUDIENCE_09
    PRINTS "yo*utouL*biauand"
    rtl
bH0_PRINTS_S1BAUDIENCE_10
    PRINTS "V*lva!uuTheyuare"
    rtl
bH0_PRINTS_S1BAUDIENCE_11
    PRINTS "myuda*ghters.uuI"
    rtl
bH0_PRINTS_S1BAUDIENCE_12
    PRINTS "loveuthemuveryuu"
    rtl
bH0_PRINTS_S1BAUDIENCE_13
    PRINTS "m*ch.uuuVirgins."
    rtl
bH0_PRINTS_S1BAUDIENCE_14
    PRINTS "Totallyusweet!uu"
    rtl
bH0_PRINTS_S1BAUDIENCE_15
    PRINTS "uuuuuu???uuuuuuu"
    rtl
bH0_PRINTS_S1BAUDIENCE_erase
    PRINTS "uuuuuuuuuuuuuuuu"
    rtl

bH0_PRINTS_BADENDING_TEXT_00a
    PRINTS "ANDuSOuONuTHATuDAY,"
    rtl
bH0_PRINTS_BADENDING_TEXT_01a
    PRINTS "ANuENTIREuANCIENT"
    rtl
bH0_PRINTS_BADENDING_TEXT_02a
    PRINTS "KINGDOMuCIVILIZATION"
    rtl
bH0_PRINTS_BADENDING_TEXT_03a
    PRINTS "GOTuWIPEDuOUT"
    rtl
bH0_PRINTS_BADENDING_TEXT_04a
    PRINTS "INuTHEuMATTERuOFuSECONDS."
    rtl
bH0_PRINTS_BADENDING_TEXT_00b
    PRINTS "ANGELAuANDuHERuPET"
    rtl
bH0_PRINTS_BADENDING_TEXT_01b
    PRINTS "SIDEKICK,uMANKO-CHAN,"
    rtl
bH0_PRINTS_BADENDING_TEXT_02b
    PRINTS "MANAGEDuTOuESCAPEuTHE"
    rtl
bH0_PRINTS_BADENDING_TEXT_03b
    PRINTS "FALLINGuSPACE-SHIP"
    rtl
bH0_PRINTS_BADENDING_TEXT_04b
    PRINTS "USINGuTHEIRuPARACHUTES."
    rtl
bH0_PRINTS_BADENDING_TEXT_00c
    PRINTS "DESPITEuMISSIONuFAILURE"
    rtl
bH0_PRINTS_BADENDING_TEXT_01c
    PRINTS "ANDuBROKENuPRIDEuTHEY"
    rtl
bH0_PRINTS_BADENDING_TEXT_02c
    PRINTS "WEREuSTILLuALIVE.uBEING"
    rtl
bH0_PRINTS_BADENDING_TEXT_03c
    PRINTS "ALIVEuISuAuGOODuTHING."
    rtl

;----

bH0_PRINTZ_aLineWorthOfEraze
    PRINTS "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
    rtl

bH0_PRINTZ_angelManko_underLine
    PRINTS "sssss"
    rts

bH0_PRINTZ_singleEraser
    PRINTS "u"
    rtl

bH0_PRINTZ_singleQ
    PRINTS "q"
    rtl

bH0_PRINTZ_angelManko_AbuttAnim
    GOTOXY 24,30
    lda a_byte
    cmp #$03
    beq bH0_PRINTZ_angelManko_Abutt01
    cmp #$02
    beq bH0_PRINTZ_angelManko_Abutt02
    cmp #$01
    beq bH0_PRINTZ_angelManko_Abutt01

bH0_PRINTZ_angelManko_Abutt00
    PRINTS "j"
    rtl
bH0_PRINTZ_angelManko_Abutt01
    PRINTS "i"
    rtl
bH0_PRINTZ_angelManko_Abutt02
    PRINTS "h"
    rtl
bH0_PRINTZ_blingBling_a01
    PRINTS "\""
    rtl
bH0_PRINTZ_blingBling_a02
    PRINTS "^"
    rtl

;---------

bH0_PRINTZ_S2AMCHAT_01
    GOTOXY 16,2
    PRINTS "MANKO: YOU OKAY, ANGELA?!"
    GOTOXY 17,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl
bH0_PRINTZ_S2AMCHAT_02
    GOTOXY 18,2
    PRINTS "ANGEL: #$%\&o(`+"  ; daijoubu yo
    GOTOXY 19,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl
bH0_PRINTZ_S2AMCHAT_03
    GOTOXY 20,2
    PRINTS "MANKO: ... ... ..."
    GOTOXY 21,2
    jsr bH0_PRINTZ_angelManko_underLine
    rtl
bH0_PRINTZ_S2AMCHAT_04
    GOTOXY 22,2
    PRINTS "YOU CAN'T GO LIKE THAT. WEAR"
    rtl
bH0_PRINTZ_S2AMCHAT_05
    GOTOXY 24,2
    PRINTS "THIS NEW PAIR OF CLOTHES!"
    rtl
bH0_PRINTZ_S2AMCHAT_BIGEYES
    GOTOXY 10,11
    PRINTS "67"
    GOTOXY 11,11
    PRINTS "89"
    rtl
bH0_PRINTZ_S2AMCHAT_undoBIGEYES
    GOTOXY 10,11
    PRINTS "uu"
    GOTOXY 11,11
    PRINTS "uu"
    rtl
bH0_PRINTZ_S2AMCHAT_ARROWS
    GOTOXY 11,14
    PRINTS "0"                 ; \
    GOTOXY 15,18
    PRINTS "1"                 ; ^
    GOTOXY 13,25
    PRINTS "2"                 ; <-
    rtl
bH0_PRINTZ_S2AMCHAT_undoARROWS
    GOTOXY 11,14
    jsl bH0_PRINTZ_singleEraser
    GOTOXY 15,18
    jsl bH0_PRINTZ_singleEraser
    GOTOXY 13,25
    jsl bH0_PRINTZ_singleEraser
    rtl

;---------


bH0_PRINTZ_letter_E            ; END letters for FF ending (bad ending)
    GOTOXY 4,17
    PRINTS "wzz"
    GOTOXY 5,17
    PRINTS "zuu"
    GOTOXY 6,17
    PRINTS "zzu"
    GOTOXY 7,17
    PRINTS "zuu"
    GOTOXY 8,17
    PRINTS "vzz"
    rtl
bH0_PRINTZ_letter_N
    GOTOXY 4,21
    PRINTS "zzx"
    GOTOXY 5,21
    jsr bH0_prntz_juj
    GOTOXY 6,21
    jsr bH0_prntz_juj
    GOTOXY 7,21
    jsr bH0_prntz_juj
    GOTOXY 8,21
    jsr bH0_prntz_juj
    rtl
bH0_prntz_juj                  ; an attempt on saving some valuable space ;-)
    PRINTS "zuz"
    rts
bH0_PRINTZ_letter_D
    GOTOXY 4,25
    PRINTS "uuz"
    GOTOXY 5,25
    PRINTS "uuz"
    GOTOXY 6,25
    PRINTS "wzz"
    GOTOXY 7,25
    PRINTS "zuz"
    GOTOXY 8,25
    PRINTS "vzy"
    rtl

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

bH0_PRINTZ_DEV_SCREEN
    GOTOXY 8,0
    jsr bH0_prntz_dvScrn02

    GOTOXY 9,2
    jsr bH0_prntz_dvScrn01
    GOTOXY 11,2
    jsr bH0_prntz_dvScrn01
    GOTOXY 9,29
    jsr bH0_prntz_dvScrn01
    GOTOXY 11,29
    jsr bH0_prntz_dvScrn01

    GOTOXY 10,0
    PRINTS "uu@uVELKOMMENuSKALuDUuVvRE!!u@"
    GOTOXY 12,0
    jsr bH0_prntz_dvScrn02
    GOTOXY 15,0
    PRINTS "uuuuuVELGuIuFRAuFzLGENDE.."
    GOTOXY 17,0
    PRINTS "uuuuuuuXu-uFFuSEKVENSEN"
    GOTOXY 18,0
    PRINTS "uuuuuuuAu-uAKUMAuNOuYAMASHIRO"
    GOTOXY 19,0
    PRINTS "uuuuuuuBu-uNUMMERuSPILLET"
    rtl
bH0_prntz_dvScrn01
    PRINTS "@"
    rts
bH0_prntz_dvScrn02
    PRINTS "uu@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
    rts


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

bH0_PRINTZ_GTN_pressStart
    PRINTS "PRESSuSTART"
    rtl

bH0_PRINTZ_GTN_menuWindow
    GOTOXY 13,12
    PRINTS "abbbbbc"
    GOTOXY 14,12
    PRINTS "giPLAYh"
    GOTOXY 15,12
    PRINTS "guEXITh"
    GOTOXY 16,12
    PRINTS "deeeeef"
    rtl

bH0_PRINTZ_GTN_mWCrsr
    PRINTS "i"
    rtl

bH0_PRINTZ_GTN_msgSel2Quit
    PRINTS "jklmnop"
    rtl
bH0_PRINTZ_GTN_msgSel2QuitNo
    PRINTS "/;<=>@_"
    rtl
bH0_PRINTZ_GTN_ingT1
    GOTOXY 2,5
    PRINTS "SECRET NUMBER FIND!!"
    GOTOXY 3,5
    PRINTS "CAN YOU MAKE IT AND WIN?"
    GOTOXY 5,2
    PRINTS "ARROWS SET NUMBER AND"
    GOTOXY 6,2
    PRINTS "Y TRIGGERS. GOOD LUCK!"
    rtl
bH0_PRINTZ_GTN_curNum
    GOTOXY 12,10
    PRINTS "uuu"
    GOTOXY 12,10
    PRINTNUM dec_vel_dir
    rtl

bH0_PRINTZ_GTN_tooLow
    PRINTS "VALUE TOO LOW."
    rtl
bH0_PRINTZ_GTN_tooHigh
    PRINTS "VALUE TOO HIGH."
    rtl
bH0_PRINTZ_GTN_correct
    PRINTS "CORRECT!"
    rtl
bH0_PRINTZ_GTN_lucky
    PRINTS "LUCKY!!!"
    rtl
bH0_PRINTZ_GTN_nextReady
    GOTOXY 19,6
    PRINTS "NEXT READY!!"
;   PRINTS "vwxyzrst"
;   GOTOXY 20,6
;   PRINTS "$%\&()*+-"
    rtl

bH0_PRINTZ_GTN_displayTries
    GOTOXY 23,4
    PRINTS "# TURNS USED:"
    GOTOXY 23,18
    PRINTNUM a_byte
    rtl

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

bH0_PRINTZ_END_00
    PRINTS "WELLuDONE,uPLAYER!"
    rtl
bH0_PRINTZ_END_00a
    PRINTS "ssssssssssssssssss"
    rtl
bH0_PRINTZ_END_01
    PRINTS "ANGELA  AND MANKO-CHAN  WENT"
    rtl
bH0_PRINTZ_END_02
    PRINTS "ON  THROUGH  SEVERAL  STAGES"
    rtl
bH0_PRINTZ_END_03
    PRINTS "ALL LOADED WITH CRAZY MAYHEM"
    rtl
bH0_PRINTZ_END_04
    PRINTS "AND  INSANELY  GOOD  LOOKING"
    rtl
bH0_PRINTZ_END_05
    PRINTS "GRAPHICS.    THEY ALSO SAVED"
    rtl
bH0_PRINTZ_END_06
    PRINTS "THE  WORLD  THUS  COMPLETING"
    rtl
bH0_PRINTZ_END_07
    PRINTS "THEIR   IMPORTANT   MISSION."
    rtl

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


bH0_PRINTZ_foeHeartAkai
    PRINTS ")"
    rtl
bH0_PRINTZ_foeHeartAoi
    PRINTS "<"
    rtl
bH0_PRINTZ_foeHeartKara
    PRINTS ">"
    rtl


.ENDS


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


.BANK 1 SLOT 0
.ORG $0000
.SECTION "gfxstuff1"

BG_PAUDAT:
    .INCBIN "gfx/pausemap.map"
BG_TITDAT:
    .INCBIN "gfx/splash.map"
BG_MAPDAT:
    .INCBIN "gfx/mymap.map"
BG_MAPGFX:
    .INCBIN "gfx/mymap.pic"
BG_PAL:
    .INCBIN "gfx/mymap.clr"
    .INCBIN "gfx/sprset1.clr"
BG_PAL_TENONE
    .INCBIN "gfx/tenone.clr"
    .INCBIN "gfx/sprsplsh.clr"
FONT2_TILES:
    .INCBIN "gfx/gfont.pic"

.ENDS


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

; ****PLAY****
; banks 2 and 3 are now used for audio data

.BANK 2 SLOT 0
.ORG $0000
.SECTION "musdata1"

    .DW SPC_END-SPC_START+$8000,$0200
SPC_START:
    .INCBIN "mus/spc1.obj"

; ..and here is some menu sprite data..
MMENU_SPR_GFX
    .INCBIN "gfx/mmenuspr.pic"

;---------
SEQ_PROFESSOR_PICMAP
    .INCBIN "gfx/introdata/proffen/proffen.map"
SEQ_PROFESSOR_PICPAL
    .INCBIN "gfx/introdata/proffen/proffen.clr"

.ENDS

.BANK 3 SLOT 0
.ORG $0000
.SECTION "musdata2"

    .INCBIN "mus/spc2.obj"
SPC_END:
    .DW $0000,$F800

.ENDS


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


.BANK 4 SLOT 0 ; ****PLAY**** moved to bank 4
.ORG $0000
.SECTION "gfxstuff2"

BG_TITGFX:
    .INCBIN "gfx/splash.pic"
SPR_SPLASH:
    .INCBIN "gfx/sprsplsh.pic"
BG_PAUGFX:
    .INCBIN "gfx/pausemap.pic"

;~~~~~
ANG_FRAME:
    .INCBIN "anims/angstill.pic"
ANG_UP_FRAME:
    .INCBIN "anims/ang_up1.pic"
ANG_DOWN_FRAME:
    .INCBIN "anims/ang_dw1.pic"
ANG_UP2_FRAME:
    .INCBIN "anims/ang_up2.pic"
ANG_DOWN2_FRAME:
    .INCBIN "anims/ang_dw2.pic"

.ENDS


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


.BANK 5 SLOT 0 ; ****PLAY**** moved to bank 5
.ORG $0000
.SECTION "gfxsprites"

SPR_TILES:
    .INCBIN "gfx/sprset1.pic"   ; 10k (16 32x32 sprites)

;------
BG1_SNEZPAD_PIC:
    .INCBIN "gfx/snezpad.pic"
BG1_SNEZPAD_PAL:
    .INCBIN "gfx/snezpad.clr"

.ENDS


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


.BANK 6 SLOT 0 ; ****PLAY****
.ORG $0000
.SECTION "music1"

FONT_TILES:                     ; Hihihi!! Ein snikert !! ;)
    .INCBIN "gfx/myfont.pic"

;--------------
ASCHE_MUS:
    .INCBIN "mus/asche.mus"
ASCHE_MUS_END:

ATOMIC_MUS:
    .INCBIN "mus/atomic.mus"
ATOMIC_MUS_END:

AWOLF_MUS:
    .INCBIN "mus/awolf.mus"
AWOLF_MUS_END:

AXELAY_MUS:
    .INCBIN "mus/axelay.mus"
AXELAY_MUS_END:

BOWSER_MUS:
    .INCBIN "mus/bowser.mus"
BOWSER_MUS_END:

C1GO_MUS:
    .INCBIN "mus/c1go.mus"
C1GO_MUS_END
    
C2G0_MUS:
    .INCBIN "mus/c2go.mus"
C2G0_MUS_END:

GRADIUS_MUS:
    .INCBIN "mus/gradius.mus"
GRADIUS_MUS_END:

ICE_MUS:
    .INCBIN "mus/ice.mus"
ICE_MUS_END:

LUIGI_MUS:
    .INCBIN "mus/luigi.mus"
LUIGI_MUS_END:

SPOOKIE_MUS:
    .INCBIN "mus/spookie.mus"
SPOOKIE_MUS_END:
    
UNSQUAD_MUS:
    .INCBIN "mus/unsquad.mus"
UNSQUAD_MUS_END:

XENON_MUS:
    .INCBIN "mus/xenon.mus"
XENON_MUS_END:


;================================
; intro text data --
; a list of valid characters are
; to be found somewhere in intro.inc
;================================

; INTROPLA
TXT_INTRO_00       ; OUR BELOVED WORLD IN ALL ITS
    .db $2c,$48,$42,$68,$02,$08,$26,$2c,$4a,$08,$06
    .db $68,$4c,$2c,$42,$26,$06,$68,$20,$2a,$68,$68
    .db $68,$00,$26,$26,$68,$20,$46,$44,$68,$68

TXT_INTRO_01       ; PRECIOUS GLORY ETC.
    .db $2e,$42,$08,$04,$20,$2c,$48,$44,$68,$68,$68
    .db $0c,$26,$2c,$42,$60,$68,$68,$08,$46,$04,$66
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68

TXT_INTRO_02       ; EVERYONE WERE HAPPY AND DID
    .db $68,$08,$4a,$08,$42,$60,$2c,$2a,$08,$68,$68
    .db $4c,$08,$42,$08,$68,$0e,$00,$2e,$2e,$60,$68
    .db $68,$68,$00,$2a,$06,$68,$06,$20,$06,$68

TXT_INTRO_03       ; GOOD STUFF. AH! AND NOT TO FORGET
    .db $0c,$2c,$2c,$06,$68,$44,$46,$48,$0a,$0a,$66
    .db $00,$0e,$64,$68,$00,$2a,$06,$68,$2a,$2c,$46
    .db $68,$46,$2c,$68,$0a,$2c,$42,$0c,$08,$46

TXT_INTRO_04       ; ABOUT THE WEEDSMOKING AT DUSK..
    .db $68,$00,$02,$2c,$48,$46,$68,$46,$0e,$08,$68
    .db $4c,$08,$08,$06,$44,$28,$2c,$24,$20,$2a,$0c
    .db $68,$00,$46,$68,$06,$48,$44,$24,$66,$66

TXT_INTRO_05       ; EVERYTHING WAS GREAT.
    .db $08,$4a,$08,$42,$60,$46,$0e,$20,$2a,$0c,$68
    .db $68,$4c,$00,$44,$68,$0c,$42,$08,$00,$46,$66
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68

TXT_INTRO_06       ; BUT ALL GOOD THINGS MUST COME
    .db $68,$68,$02,$48,$46,$68,$00,$26,$26,$68,$68
    .db $0c,$2c,$2c,$06,$68,$46,$0e,$20,$2a,$0c,$44
    .db $68,$28,$48,$44,$46,$68,$04,$2c,$28,$08

TXT_INTRO_07       ; TO AN END..
    .db $46,$2c,$68,$00,$2a,$68,$08,$2a,$06,$66,$66
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68,$68
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68
; INTRODR
TXT_INTRO_08       ; INGENIOUSLY EVIL MASTER MIND
    .db $20,$2a,$0c,$08,$2a,$20,$2c,$48,$44,$26,$60
    .db $08,$4a,$20,$26,$68,$28,$00,$44,$46,$08,$42
    .db $68,$68,$68,$28,$20,$2a,$06,$68,$68,$68

TXT_INTRO_09       ; DR. SLOPPY GOT ALL MAD ABOUT
    .db $68,$06,$42,$66,$44,$26,$2c,$2e,$2e,$60,$68
    .db $68,$68,$0c,$2c,$46,$68,$00,$26,$26,$68,$68
    .db $68,$28,$00,$06,$68,$00,$02,$2c,$48,$46

TXT_INTRO_10       ; WORLD DOMINATION, NORWEGIAN
    .db $68,$68,$68,$4c,$2c,$42,$26,$06,$68,$68,$68
    .db $06,$2c,$28,$20,$2a,$00,$46,$20,$2c,$2a,$6a
    .db $68,$2a,$2c,$42,$4c,$08,$0c,$20,$00,$2a

TXT_INTRO_11       ; BEER AND HOT LITTLE JAPANESE
    .db $68,$02,$08,$08,$42,$68,$00,$2a,$06,$68,$68
    .db $0e,$2c,$46,$68,$26,$20,$46,$46,$26,$08,$68
    .db $68,$22,$00,$2e,$00,$2a,$08,$44,$08,$68
; INTROPNT *pantsu pantsu pantsu*
TXT_INTRO_12       ; SCHOOLGIRLS ...
    .db $44,$04,$0e,$2c,$2c,$26,$0c,$20,$42,$26,$44
    .db $68,$68,$68,$68,$66,$66,$66,$68,$68,$68,$68
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68
; INTROTAN
TXT_INTRO_13       ; DR. SLOPPY WORKED OUT AN EVIL
    .db $68,$06,$42,$66,$44,$26,$2c,$2e,$2e,$60,$68
    .db $4c,$2c,$42,$24,$08,$06,$68,$68,$2c,$48,$46
    .db $68,$68,$00,$2a,$68,$08,$4a,$20,$26,$68

TXT_INTRO_14       ; SCHEME THAT INVOLVED TANUKI, A
    .db $44,$04,$0e,$08,$28,$08,$68,$46,$0e,$00,$46
    .db $68,$68,$20,$2a,$4a,$2c,$26,$4a,$08,$06,$68
    .db $68,$46,$00,$2a,$48,$24,$20,$6a,$68,$00

TXT_INTRO_15       ; RARE AND MAGICAL RACCOON,
    .db $68,$42,$00,$42,$08,$68,$00,$2a,$06,$68,$68
    .db $68,$28,$00,$0c,$20,$04,$00,$26,$68,$68,$68
    .db $68,$42,$00,$04,$04,$2c,$2c,$2a,$6a,$68

TXT_INTRO_16       ; AND SOME SECRET FORMULA Y.
    .db $68,$00,$2a,$06,$68,$44,$2c,$28,$08,$68,$68
    .db $68,$68,$44,$08,$04,$42,$08,$46,$68,$68,$68
    .db $0a,$2c,$42,$28,$48,$26,$00,$68,$60,$66

TXT_INTRO_17       ; THE FORMULA MIXED WITH TANUKIS
    .db $46,$0e,$08,$68,$0a,$2c,$42,$28,$48,$26,$00
    .db $28,$20,$4e,$08,$06,$68,$4c,$20,$46,$0e,$68
    .db $68,$46,$00,$2a,$48,$24,$20,$44,$68,$68
; INTROTST
TXT_INTRO_18       ; MAGICAL FLUID TURNED THE
    .db $68,$68,$28,$00,$0c,$20,$04,$00,$26,$68,$68
    .db $68,$68,$68,$0a,$26,$48,$20,$06,$68,$68,$68
    .db $46,$48,$42,$2a,$08,$06,$68,$46,$0e,$08

TXT_INTRO_19       ; WORLD UPSIDE DOWN ...
    .db $68,$68,$68,$4c,$2c,$42,$26,$06,$68,$68,$68
    .db $48,$2e,$44,$20,$06,$08,$68,$06,$2c,$4c,$2a
    .db $68,$68,$68,$68,$66,$66,$66,$68,$68,$68
; -NO- PICTURE (BG#1 DISABLED)
TXT_INTRO_20       ; PRESENT DAY [CR] FOUR DAYS LATER
    .db $2e,$42,$08,$44,$08,$2a,$46,$68,$06,$00,$60
    .db $68,$0a,$2c,$48,$42,$68,$06,$00,$60,$44,$68
    .db $68,$68,$68,$26,$00,$46,$08,$42,$68,$68

TXT_INTRO_21       ; U.N. HEADQUARTER
    .db $48,$66,$2a,$66,$68,$68,$68,$68,$68,$68,$68
    .db $0e,$08,$00,$06,$40,$48,$00,$42,$46,$08,$42
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68
; INTROMAN
TXT_INTRO_22       ; ANGELA AND HER PET SIDEKICK,
    .db $00,$2a,$0c,$08,$26,$00,$68,$68,$00,$2a,$06
    .db $68,$68,$0e,$08,$42,$68,$2e,$08,$46,$68,$68
    .db $68,$44,$20,$06,$08,$24,$20,$04,$24,$6a

TXT_INTRO_23       ; MANKO CHAN, ARE OUR LAST HOPE.
    .db $28,$00,$2a,$24,$2c,$68,$04,$0e,$00,$2a,$6a
    .db $68,$68,$00,$42,$08,$68,$2c,$48,$42,$68,$68
    .db $2c,$2a,$26,$60,$68,$0e,$2c,$2e,$08,$66

TXT_INTRO_24       ; GOOD LUCK, GIRLS!!
    .db $0c,$2c,$2c,$06,$68,$68,$26,$48,$04,$24,$6a
    .db $68,$68,$0c,$20,$42,$26,$44,$64,$64,$68,$68
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68

TXT_INTRO_25       ; HAI !!
    .db $68,$68,$68,$68,$00,$02,$04,$68,$68,$68,$68
    .db $68,$68,$68,$68,$06,$08,$0a,$68,$68,$68,$68
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68

; --- SEQ PROFFEN
; SEQPROFFEN

;       0123456789A
;       umm.. ..
;        you might
;         get to
TXT_SEQPROFFEN_00
    .db $48,$28,$28,$66,$66,$68,$66,$66,$68,$68,$68
    .db $68,$60,$2c,$48,$68,$28,$20,$0c,$0e,$46,$68
    .db $68,$68,$0c,$08,$46,$68,$46,$2c,$68,$68

;       0123456789A
;       experience
;       some minor
;        problems
TXT_SEQPROFFEN_01
    .db $08,$4e,$2e,$08,$42,$20,$08,$2a,$04,$08,$68
    .db $44,$2c,$28,$08,$68,$28,$20,$2a,$2c,$42,$68
    .db $68,$2e,$42,$2c,$02,$26,$08,$28,$44,$68

;       0123456789A
;       during your
;       mission due
;       to certain
TXT_SEQPROFFEN_02
    .db $06,$48,$42,$20,$2a,$0c,$68,$60,$2c,$48,$42
    .db $28,$20,$44,$44,$20,$2c,$2a,$68,$06,$48,$08
    .db $46,$2c,$68,$04,$08,$42,$46,$00,$20,$2a

;       0123456789A
;       nasty probs
;            of
;        technical
TXT_SEQPROFFEN_03
    .db $2a,$00,$44,$46,$60,$68,$2e,$42,$2c,$02,$44
    .db $68,$68,$68,$68,$68,$2c,$0a,$68,$68,$68,$68
    .db $68,$46,$08,$04,$0e,$2a,$20,$04,$00,$26

;       0123456789A
;       nature. the
;        engineer
;       that built
TXT_SEQPROFFEN_04
    .db $2a,$00,$46,$48,$42,$08,$66,$68,$46,$0e,$08
    .db $68,$08,$2a,$0c,$20,$2a,$08,$08,$42,$68,$68
    .db $46,$0e,$00,$46,$68,$02,$48,$20,$26,$46

;       0123456789A
;       your   nice
;       little ship
;       is a nasty
TXT_SEQPROFFEN_05
    .db $60,$2c,$48,$42,$68,$68,$68,$2a,$20,$04,$08
    .db $26,$20,$46,$46,$26,$08,$68,$44,$0e,$20,$2e
    .db $20,$44,$68,$00,$68,$2a,$00,$44,$46,$60

;       0123456789A
;        drunkard
;         bastard,
;       so please
TXT_SEQPROFFEN_06
    .db $68,$06,$42,$48,$2a,$24,$00,$42,$06,$68,$68
    .db $68,$68,$02,$00,$44,$46,$00,$42,$06,$6a,$68
    .db $44,$2c,$68,$2e,$26,$08,$00,$44,$08,$68

;       0123456789A
;       forgive us!
;
;             kthx
TXT_SEQPROFFEN_007
    .db $0a,$2c,$42,$0c,$20,$4a,$08,$68,$48,$44,$64
    .db $68,$68,$68,$68,$68,$68,$68,$68,$68,$68,$68
    .db $68,$68,$68,$68,$68,$68,$24,$46,$0e,$4e

.ENDS


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


.BANK 7 SLOT 0 ; ****PLAY****
.ORG $0000
.SECTION "music2"

GOKU_MUS:
    .INCBIN "mus/goku.mus"
GOKU_MUS_END:

MERRY_MUS:
    .INCBIN "mus/merry.mus"
MERRY_MUS_END:

METLM_MUS:
    .INCBIN "mus/metlm.mus"
METLM_MUS_END:

SEASIA_MUS:
    .INCBIN "mus/seasia.mus"
SEASIA_MUS_END:

RUD21_MUS:
    .INCBIN "mus/rud21.mus"
RUD21_MUS_END:

FZERO_MUS:
    .INCBIN "mus/fzero.mus"
FZERO_MUS_END:

;-----
;================================
; intro text palettes
;================================

SPRFPAL_06
    .INCBIN "gfx/sprfont/sprfont6.clr"
SPRFPAL_05
    .INCBIN "gfx/sprfont/sprfont5.clr"
SPRFPAL_04
    .INCBIN "gfx/sprfont/sprfont4.clr"
SPRFPAL_03
    .INCBIN "gfx/sprfont/sprfont3.clr"
SPRFPAL_02
    .INCBIN "gfx/sprfont/sprfont2.clr"
SPRFPAL_01
    .INCBIN "gfx/sprfont/sprfont1.clr"
SPRFPAL_00
    .INCBIN "gfx/sprfont/sprfont.clr"



S1AM_S1B_SEQ_FONT
    .INCBIN "gfx/s1bfont.pic"


.ENDS


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

.BANK 8 SLOT 0 ; ****PLAY****
.ORG $0000
.SECTION "music3"

GOOP_MUS:
    .INCBIN "mus/goop.mus"
GOOP_MUS_END:

SHERB_MUS:
    .INCBIN "mus/sherb.mus"
SHERB_MUS_END:


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

SPRSETFL:
    .INCBIN "gfx/sprsetfl.pic"

SEQ_SB1BG2GFX:
    .INCBIN "gfx/seq_sb1bg2.pic"

.ENDS


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


.BANK 9 SLOT 0 ; ****PLAY****
.ORG $0000
.SECTION "music4"

PENNY_MUS:
    .INCBIN "mus/penny.mus"
PENNY_MUS_END:

; the rest of this bank's space stores graphics and datas
; for the main menu.

;MMENU_BG1_GFX                   ; MOVED TO BANK $13 DUE TO CHANGES WHICH
;   .INCBIN "gfx/mmenubg1.pic"   ; RESULTS IN MUCHO BIGGER SIZE.
MMENU_BG1_DAT
    .INCBIN "gfx/mmenubg1.map"
;MMENU_BG_PAL                    ; MOVED TO BANK $A DUE TO -94 bytes :(
;   .INCBIN "gfx/mmenubg1.clr"   ; HAHA! NOT ANYMORE, BUT WHO CARES??
;   .INCBIN "gfx/sprsplsh.clr"
MMENU_BG2_GFX
    .INCBIN "gfx/mmenufnt.pic"

.ENDS


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


.BANK $A SLOT 0
.ORG $0000
.SECTION "credbgd"

MMENU_BG_PAL
    .INCBIN "gfx/mmenubg1.clr"
    .INCBIN "gfx/sprfont/sprfont.clr"

MMENU_OPTSPRITES_PALLY
    .INCBIN "gfx/mmenubg1.clr"
    .INCBIN "gfx/optsprites.clr"

MMENU_OPTSPRITES1_PAL
    .INCBIN "gfx/optsprites1.clr"

MMENU_OPTSPRITES
    .INCBIN "gfx/optsprites.pic"

BG_CREDDAT
    .INCBIN "gfx/credbgd.map"
BG_CREDGFX
    .INCBIN "gfx/credbgd.pic"
BG_CREDPAL
    .INCBIN "gfx/credbgd.clr"
    .INCBIN "gfx/sprsplsh.clr"
    
BG_GOVERDAT
    .INCBIN "gfx/g_over.map"
BG_GOVERGFX
    .INCBIN "gfx/g_over.pic"
BG_GOVERPAL
    .INCBIN "gfx/g_over.clr"
    .INCBIN "gfx/sprsplsh.clr" ;sprgover.clr

ANGSTART_PAL
    .INCBIN "gfx/splash.clr"
    .INCBIN "gfx/angstart.clr"
ANGSTART_GFX
    .INCBIN "gfx/angstart.pic" ; <- 6 sprites

STAGE1_SPR
    .INCBIN "gfx/stage1sp.pic"

SEQ_S1BCASTLE_PAL
    .INCBIN "gfx/seq_s1bcastle.clr"
SEQ_S1BCASTLE_MAP
    .INCBIN "gfx/seq_s1bcastle.map"


.ENDS


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


.BANK $B SLOT 0
.ORG $0000
.SECTION "fadedata1"

.DEFINE FADE_BANK_1 11

circle_data_1
    .INCBIN "fades/circle1.dat"
circle_data_2
    .INCBIN "fades/circle2.dat"
triangle_data
    .INCBIN "fades/triangle.dat"


STAGE1_PAL
    .INCBIN "gfx/stage1.clr"
    .INCBIN "gfx/stage1sp.clr"
STAGE1_MAP
    .INCBIN "gfx/stage1.map"

MYFONT_CRED_PIC
    .INCBIN "gfx/myfont_cred.pic"

.ENDS


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


.BANK $C SLOT 0
.ORG $0000
.SECTION "fadedata2"

.DEFINE FADE_BANK_2 12

square_data_1
    .INCBIN "fades/square1.dat"
square_data_2
    .INCBIN "fades/square2.dat"

;~~~~~~~~~~

INTRO_BG_GRL_GFX
    .INCBIN "gfx/introdata/introgrl.pic"

BG_SEQUENCETIME_BANNER_MAP
    .INCBIN "gfx/skipseq2.map"

.ENDS


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


.BANK $D SLOT 0
.ORG $0000
.SECTION "intro_bank1"

INTRO_BG_PLA_GFX
    .INCBIN "gfx/introdata/intropla.pic"
INTRO_BG_DR_GFX
    .INCBIN "gfx/introdata/introdr.pic"
INTRO_BG_PNT_GFX
    .INCBIN "gfx/introdata/intropnt.pic"

INTRO_SPRHAI
    .INCBIN "gfx/sprfont/spr_hai.pic"

.ENDS


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


.BANK $E SLOT 0
.ORG $0000
.SECTION "intro_bank2"

INTRO_BG_TST_GFX
    .INCBIN "gfx/introdata/introtst.pic"
INTRO_BG_TAN_GFX
    .INCBIN "gfx/introdata/introtan.pic"


INTRO_BG_PLA_PAL
    .INCBIN "gfx/introdata/intropla.clr"
    .INCBIN "gfx/sprfont/sprfont.clr"
INTRO_BG_DR_PAL
    .INCBIN "gfx/introdata/introdr.clr"
    .INCBIN "gfx/sprfont/sprfont.clr"
INTRO_BG_PNT_PAL
    .INCBIN "gfx/introdata/intropnt.clr"
    .INCBIN "gfx/sprfont/sprfont.clr"
INTRO_BG_TST_PAL
    .INCBIN "gfx/introdata/introtst.clr"
    .INCBIN "gfx/sprfont/sprfont.clr"
INTRO_BG_TAN_PAL
    .INCBIN "gfx/introdata/introtan.clr"
    .INCBIN "gfx/sprfont/sprfont.clr"
INTRO_BG_MAN_PAL
    .INCBIN "gfx/introdata/introman.clr"
    .INCBIN "gfx/sprfont/sprfont.clr"
INTRO_BG_GRL_PAL
    .INCBIN "gfx/introdata/introgrl.clr"
    .INCBIN "gfx/sprfont/spr_hai.clr"

INTRO_BG_GRL_MAP
    .INCBIN "gfx/introdata/introgrl.map"

.ENDS


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

.BANK $F SLOT 0
.ORG $0000
.SECTION "intro_bank3"

SEQ_S1B_FUUUCK_PAL:
    .INCBIN "gfx/s1amfuck.clr"

ITSSNESTASY_PAL
    .INCBIN "gfx/its_snestasy.clr"

INTRO_BG_MAN_GFX
    .INCBIN "gfx/introdata/introman.pic"


INTRO_BG_PLA_MAP
    .INCBIN "gfx/introdata/intropla.map"
INTRO_BG_DR_MAP
    .INCBIN "gfx/introdata/introdr.map"
INTRO_BG_PNT_MAP
    .INCBIN "gfx/introdata/intropnt.map"
INTRO_BG_TST_MAP
    .INCBIN "gfx/introdata/introtst.map"
INTRO_BG_TAN_MAP
    .INCBIN "gfx/introdata/introtan.map"
INTRO_BG_MAN_MAP
    .INCBIN "gfx/introdata/introman.map"


INTRO_SPRFONT
    .INCBIN "gfx/sprfont/sprfont.pic"



;----------------------------------
;   Hidden mini-game: GUESS THE NUMBER (AND BACON AND SHIT)
; anja

bH0f_GTN_splashScreen

    ; assuming that mode4 is up and running, let's do it..
    lda #$80
    sta $2100
    lda #%00000011
    sta $212c                   ; bg#1 and bg#2 enable
    LOAD_PAL GTN_SPLASH_PAL
    wai
    LOAD_BLOCK2VRAM GTN_SPLASH_MAP,$0000,$2000
    wai
    wai
    LOAD_BLOCK2VRAM GTN_SPLASH_PIC,$2000,$6000
    wai
    wai
    LOAD_BLOCK2VRAM HIDDEN_FONT_PIC,$5000,$0800
    wai
    wai

gtnReturnToTitle
    lda #$80
    sta $2100
    wai
    wai
    jsl bH0_SPLSC_CLR
    jsl sym_MUS_SONG_ATOMIC

    GOTOXY 14,10
    jsl bH0_PRINTZ_GTN_pressStart
    stz a_byte                 ; blink counter for the 'press start' text

    ldx #$0000
    stx MAPX
    ldx #$ffff
    stx MAPY
    wai
    wai
    wai
    wai
    lda #$0f
    sta $2100
    jmp bH0f_GTN_splshScrnLOOP

gtn_prssStrt_unshow
    GOTOXY 14,0
    jsl bH0_PRINTZ_aLineWorthOfEraze
    stz a_byte
    jmp gtn_prssStrt_showOK
gtn_prssStrt_show
    GOTOXY 14,10
    jsl bH0_PRINTZ_GTN_pressStart
    jmp gtn_prssStrt_showOK


bH0f_GTN_splshScrnLOOP
    wai
    jsr gtn_randomize
    lda joy1+1
    cmp #$10                   ; check start button
    beq bH0f_GTN_menu ;bH0f_GTN_scrollToPlayScreen

    lda a_byte
    cmp #$0f
    beq gtn_prssStrt_show
    cmp #$1f
    beq gtn_prssStrt_unshow
gtn_prssStrt_showOK
    inc a_byte
    jmp bH0f_GTN_splshScrnLOOP


bH0f_GTN_menu
    stz a_byte
    jsl bH0_SPLSC_CLR
    jsl bH0_PRINTZ_GTN_menuWindow
    GOTOXY 14,13
    jsl bH0_PRINTZ_GTN_mWCrsr
bH0f_GTN_ueShita
    lda joy1+1
    cmp #$08                   ; check up arrow
    beq gtnMENUupPlease
    lda joy1+1
    cmp #$04                   ; check down arrow
    beq gtnMENUdownPlease
gtnUeShitaRETURN
    jsr gtn_randomize
    lda joy1+1
    cmp #$10                   ; check start button
    beq gtnENDOFMENU
    jmp bH0f_GTN_ueShita
gtnMENUupPlease
    GOTOXY 14,13
    jsl bH0_PRINTZ_GTN_mWCrsr
    GOTOXY 15,13
    jsl bH0_PRINTZ_singleEraser
    stz a_byte
    jmp gtnUeShitaRETURN
gtnMENUdownPlease
    GOTOXY 14,13
    jsl bH0_PRINTZ_singleEraser
    GOTOXY 15,13
    jsl bH0_PRINTZ_GTN_mWCrsr
    lda #$01
    sta a_byte
    jmp gtnUeShitaRETURN
gtnENDOFMENU
    jsl sym_MUS_NO_SONG
    lda a_byte
    cmp #$00
    beq bH0f_GTN_scrollToPlayScreen
    stz OBJ_HIT
    jml SJEKK_DEN_KUULE_LOGOEN_ASSE


bH0f_GTN_scrollToPlayScreen
    jsl sym_MUS_NO_SONG
    jsl bH0_SPLSC_CLR
    lda #$8f                   ; # of times looping
bH0f_GTN_scrlToPlyScrLOOP
    wai
    jsr gtn_randomize
    ldx MAPY
    dex
    dex
    stx MAPY
    dea
    cmp #$00
    bne bH0f_GTN_scrlToPlyScrLOOP


GTN_COPY_RNDNUM
    lda OBJ_HIT                ; get random number
    sta a_byte2                ; the number to guess
    stz a_byte                 ; counts number of attempts
    lda #$32
    sta dec_vel_dir            ; adjustable variable for playability

    GOTOXY 26,3
    jsl bH0_PRINTZ_GTN_msgSel2Quit
    jsl bH0_PRINTZ_GTN_ingT1
    jsl bH0_PRINTZ_GTN_curNum

GTN_GAME_LOOP
    wai
    wai
    wai
    wai
    jsr gtn_randomize
    lda joy1+1
    cmp #$04                   ; check down arrow
    bne gtnGLOOP_chkUP

    GOTOXY 20,0
    jsl bH0_PRINTZ_aLineWorthOfEraze
    lda dec_vel_dir
    cmp #$00
    beq gtn_set100
    dec dec_vel_dir
    jsl bH0_PRINTZ_GTN_curNum
    jmp gtnGLOOP_keyDone
gtn_set100
    lda #100
    sta dec_vel_dir
    jsl bH0_PRINTZ_GTN_curNum
    jmp gtnGLOOP_keyDone

gtnGLOOP_chkUP
    lda joy1+1
    cmp #$08                   ; check up arrow
    bne gtnGLOOP_keyDone

    GOTOXY 20,0
    jsl bH0_PRINTZ_aLineWorthOfEraze
    lda dec_vel_dir
    cmp #100
    beq gtn_setRei
    inc dec_vel_dir
    jsl bH0_PRINTZ_GTN_curNum
    jmp gtnGLOOP_keyDone
gtn_setRei
    stz dec_vel_dir
    jsl bH0_PRINTZ_GTN_curNum

gtnGLOOP_keyDone

    lda joy1+1
    cmp #$20                   ; check select button
    bne gtnSELnotPressedYo
    jmp gtnSELpressed

gtnSELnotPressedYo
    lda joy1+1
    cmp #$40                   ; check Y button
    beq gtnYhasBeenPressed
 
    jmp GTN_GAME_LOOP



gtnYhasBeenPressed
    GOTOXY 20,3
    inc a_byte

    lda dec_vel_dir
    cmp a_byte2
    beq gtn_valueDoesEqual
    bcs gtn_valueTooHigh
gtn_valueTooLow
    jsl sym_SFX_SQUISH
    jsl bH0_PRINTZ_GTN_tooLow
    jmp gtn_YUnpressCheck
gtn_valueTooHigh
    jsl sym_SFX_SQUISH
    jsl bH0_PRINTZ_GTN_tooHigh
    jmp gtn_YUnpressCheck
gtn_valueDoesEqual
    jmp gtn_correctGuess
gtn_YUnpressCheck
    lda joy1+1
    cmp #$40
    beq gtn_YUnpressCheck
    jmp GTN_GAME_LOOP
    

gtnSELpressed
    jsl sym_SFX_DEEP_THUMP
    jsl bH13_FADE_OUT_MOSAIC_macro
    jmp gtnReturnToTitle


gtn_randomize                  ; number randomize function (0-100)
    pha
    inc OBJ_HIT
    lda OBJ_HIT
    cmp #101
    bne gtnRndmzENDE
    stz OBJ_HIT
gtnRndmzENDE
    pla
    rts


gtn_correctGuess
    GOTOXY 26,3
    jsl bH0_PRINTZ_GTN_msgSel2QuitNo
    jsl bH0_PRINTZ_GTN_displayTries

    GOTOXY 20,3
    jsl bH0_PRINTZ_GTN_correct
    ldx #$010f
    jsl bH12_WAIT_FOR_THE_HOLY_WAI
    lda a_byte
    cmp #$01
    bne gtnCG01
    GOTOXY 20,3
    jsl bH0_PRINTZ_GTN_lucky
    ldx #$010f
    jsl bH12_WAIT_FOR_THE_HOLY_WAI
gtnCG01
    ; blink next ready
    GOTOXY 20,3
    jsl bH0_PRINTZ_aLineWorthOfEraze
    wai
    wai
    wai
    wai
    wai
    wai
    wai
    wai
    ldx #$0010
gtnCG01L
    phx
    jsl bH0_PRINTZ_GTN_nextReady
    plx
    wai
    wai
    wai
    wai
    wai
    wai
    wai
    wai
    phx
    GOTOXY 19,3
    jsl bH0_PRINTZ_aLineWorthOfEraze
    GOTOXY 20,3
    jsl bH0_PRINTZ_aLineWorthOfEraze
    plx
    wai
    wai
    wai
    wai
    wai
    wai
    wai
    wai
    dex
    cpx #$0000
    bne gtnCG01L
    GOTOXY 23,0
    jsl bH0_PRINTZ_aLineWorthOfEraze
    jmp GTN_COPY_RNDNUM 


.ENDS


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


.BANK $10 SLOT 0
.ORG $0000
.SECTION "evenMoreShittyDataz"      ; I am shitty tired of naming those sections!

SEQ_PROFESSOR_PIC
    .INCBIN "gfx/introdata/proffen/proffen.pic"

SPR_TILES2:
    .INCBIN "gfx/sprset2.pic"   ; 10k (16 32x32 sprites)
SPR_TILES3:
    .INCBIN "gfx/sprset3.pic"   ; 10k (16 32x32 sprites)

S1B_VERSUS_PAL
    .INCBIN "gfx/s1bversus.clr"

.ENDS


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


.BANK $11 SLOT 0
.ORG $0000
.SECTION "evenMoreCrappyDatasBiatch"

SPR_TILES4:
    .INCBIN "gfx/sprset4.pic"   ; 10k (16 32x32 sprites)
SPR_TILES5:
    .INCBIN "gfx/sprset5.pic"   ; 10k (16 32x32 sprites)


SEQ_S1B_DISCUSS_PAL:
    .INCBIN "gfx/s1amchat.clr"

SEQ_S1B_DISCUSS_PIC:
    .INCBIN "gfx/s1amchat.pic"

BG_SEQUENCETIME_BANNER_PIC
    .INCBIN "gfx/skipseq2.pic"

.ENDS



; NOTE: BANK $12 is another code rombank (s1boss.s)


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


.BANK $13 SLOT 0
.ORG $0000
.SECTION "miscDatasFromBank0"


bH13_SPLSC_SETUP

    lda   #$30
    sta   SPRBUF1+SPRIORITY
    sta   SPRBUF1+SPRIORITY1
    sta   SPRBUF1+SPRIORITY2
    sta   SPRBUF1+SPRIORITY3
    sta   SPRBUF1+SPRIORITY4
    sta   SPRBUF1+SPRIORITY5
    sta   SPRBUF1+SPRIORITY6
    sta   SPRBUF1+SPRIORITY7
    sta   SPRBUF1+SPRIORITY8
    lda   #$08
    sta   CURFRAME
    sta   CURFRAME1
    sta   CURFRAME2
    sta   CURFRAME3

    lda   OBJ_HIT
    cmp   #$00
    beq   bH13_SPLSC_SETUP_sprNorm
    cmp   #$01
    beq   bH13_SPLSC_SETUP_sprNorm
    cmp   #$02
    beq   bH13_SPLSC_SETUP_sprNorm
    cmp   #$03
    beq   bH13_SPLSC_SETUP_sprNorm
    jmp   bH13_SPLSC_SETUP_sprJikkyou ; Parodius


bH13_SPLSC_SETUP_sprNorm

    ldx   #$40                  ; PRE...
    stx   SPRBUF1+SX
    ldx   #$67
    stx   SPRBUF1+SY
    lda   #$00
    sta   CURFRAME
    ldx   #$60                  ; SS ...
    stx   SPRBUF1+SX1
    ldx   #$67
    stx   SPRBUF1+SY1
    lda   #$04
    sta   CURFRAME1
    ldx   #$80                  ; STA...
    stx   SPRBUF1+SX2
    ldx   #$67
    stx   SPRBUF1+SY2
    lda   #$08
    sta   CURFRAME2
    ldx   #$A0                  ; RT!
    stx   SPRBUF1+SX3
    ldx   #$67
    stx   SPRBUF1+SY3
    lda   #$0C
    sta   CURFRAME3

    jmp   bH13_SPLSC_SETUP_sprJikkyouNONONO


bH13_SPLSC_SETUP_sprJikkyou

    ldx   #$40                  ; PRE...
    stx   SPRBUF1+SX
    ldx   #$67
    stx   SPRBUF1+SY
    lda   #$44
    sta   CURFRAME
    ldx   #$60                  ; SS ...
    stx   SPRBUF1+SX1
    ldx   #$67
    stx   SPRBUF1+SY1
    lda   #$48
    sta   CURFRAME1
    ldx   #$80                  ; STA...
    stx   SPRBUF1+SX2
    ldx   #$67
    stx   SPRBUF1+SY2
    lda   #$4c
    sta   CURFRAME2
    ldx   #$A0                  ; RT!
    stx   SPRBUF1+SX3
    ldx   #$67
    stx   SPRBUF1+SY3
    lda   #$80
    sta   CURFRAME3


bH13_SPLSC_SETUP_sprJikkyouNONONO

    lda   #$90                  ; sprites pal #1 (0-7)
    stz   $2121
    stz   $2121
    lda   #$91
    stz   $2121
    stz   $2121
    lda   #$92
    stz   $2121
    stz   $2121
    lda   #$93
    stz   $2121
    stz   $2121
    lda   #$94
    stz   $2121
    stz   $2121
    lda   #$95
    stz   $2121
    stz   $2121
    lda   #$96
    stz   $2121
    stz   $2121
    lda   #$97
    stz   $2121
    stz   $2121
    lda   #$98
    stz   $2121
    stz   $2121
    lda   #$99
    stz   $2121
    stz   $2121
    lda   #$9a
    stz   $2121
    stz   $2121
    lda   #$9b
    stz   $2121
    stz   $2121
    lda   #$9c
    stz   $2121
    stz   $2121
    lda   #$9d
    stz   $2121
    stz   $2121
    lda   #$9e
    stz   $2121
    stz   $2121
    lda   #$9f
    stz   $2121
    stz   $2121

    lda   #$40
    sta   CURFRAME4
    sta   CURFRAME5
    sta   CURFRAME6
    sta   CURFRAME7
    sta   CURFRAME8
    sta   CURFRAME9
    sta   CURFRAME10
    sta   CURFRAME11
    sta   CURFRAME12
    sta   CURFRAME13
    sta   CURFRAME14
    sta   CURFRAME15
    sta   CURFRAME16
    sta   CURFRAME17
    sta   CURFRAME18
    sta   CURFRAME19
    sta   CURFRAME20
    sta   CURFRAME21
    sta   CURFRAME22
    sta   CURFRAME23
    sta   CURFRAME24
    sta   CURFRAME25
    sta   CURFRAME26
    sta   CURFRAME27
    sta   CURFRAME28
    sta   CURFRAME29
    sta   CURFRAME30
    sta   CURFRAME31

    lda   #%00000010            ; no flips, lowest priority, pal #1 (0-7)
    sta   SPRBUF1+SPRIORITY4
    sta   SPRBUF1+SPRIORITY5
    sta   SPRBUF1+SPRIORITY6
    sta   SPRBUF1+SPRIORITY7
    sta   SPRBUF1+SPRIORITY8
    sta   SPRBUF1+SPRIORITY9
    sta   SPRBUF1+SPRIORITY10
    sta   SPRBUF1+SPRIORITY11
    sta   SPRBUF1+SPRIORITY12
    sta   SPRBUF1+SPRIORITY13
    sta   SPRBUF1+SPRIORITY14
    sta   SPRBUF1+SPRIORITY15
    sta   SPRBUF1+SPRIORITY16
    sta   SPRBUF1+SPRIORITY17
    sta   SPRBUF1+SPRIORITY18
    sta   SPRBUF1+SPRIORITY19
    sta   SPRBUF1+SPRIORITY20
    sta   SPRBUF1+SPRIORITY21
    sta   SPRBUF1+SPRIORITY22
    sta   SPRBUF1+SPRIORITY23
    sta   SPRBUF1+SPRIORITY24
    sta   SPRBUF1+SPRIORITY25
    sta   SPRBUF1+SPRIORITY26
    sta   SPRBUF1+SPRIORITY27
    sta   SPRBUF1+SPRIORITY28
    sta   SPRBUF1+SPRIORITY29
    sta   SPRBUF1+SPRIORITY30
    sta   SPRBUF1+SPRIORITY31

    ; All those sta/z's above may seem like unheard of ROM space abuse,
    ; but belive me;  We (read: I) really have no choice, cuz of some
    ; crazy SNES designation flaw (? not sure..) *blah* *rant-rant*
    
    ldx   #$00
    stx   MAPY
    stx   MAPX
;   FADE_IN_MOSAIC
    jsl   bH13_FADE_IN_MOSAIC_macro
    stz   $100B                 ; Blink (boolean)
    stz   a_word2               ; Blink timer
    stz   a_word2
    stz   $100E                 ; Whatch creds? Bool
    lda   #$0000
    sta   a_word

    rtl



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



bH13_ANGELA_START

;   lda #$00
;   sta SPRBUF2                 ; show them sprites
    lda #$30
    sta SPRBUF1+SPRIORITY
    sta SPRBUF1+SPRIORITY1
    sta SPRBUF1+SPRIORITY2
    sta SPRBUF1+SPRIORITY3
    sta SPRBUF1+SPRIORITY4
    sta SPRBUF1+SPRIORITY5
    sta SPRBUF1+SPRIORITY6
    sta SPRBUF1+SPRIORITY7
    sta SPRBUF1+SPRIORITY8
    lda #$08
    sta CURFRAME
    sta CURFRAME1
    sta CURFRAME2
    sta CURFRAME3
    ldx #$40                    ; ANG ...
    stx SPRBUF1+SX
    ldx #$67
    stx SPRBUF1+SY
    lda #$00
    sta CURFRAME
    ldx #$60                    ; ELA ...
    stx SPRBUF1+SX1
    ldx #$67
    stx SPRBUF1+SY1
    lda #$04
    sta CURFRAME1
    ldx #$80                    ; STA...
    stx SPRBUF1+SX2
    ldx #$67
    stx SPRBUF1+SY2
    lda #$08
    sta CURFRAME2
    ldx #$A0                    ; RT !!
    stx SPRBUF1+SX3
    ldx #$67
    stx SPRBUF1+SY3
    lda #$0C
    sta CURFRAME3

    ;--- NASTY "REMOVE THEM UNWANTED SPRITEZ" HACK
    ; This "hack" is needed to eliminate the possibilities where
    ; the `ANGELA START' message gets kind of distorted (real HW only!)
    lda #$00
    sta SPRBUF1+SX4
    sta SPRBUF1+SX5
    sta SPRBUF1+SX6
    sta SPRBUF1+SX7
    sta SPRBUF1+SX8
    sta SPRBUF1+SX9
    sta SPRBUF1+SX10
    sta SPRBUF1+SX11
    sta SPRBUF1+SX12
    sta SPRBUF1+SX13
    sta SPRBUF1+SX14
    sta SPRBUF1+SX15
    sta SPRBUF1+SX16
    sta SPRBUF1+SX17
    sta SPRBUF1+SX18
    sta SPRBUF1+SX19
    sta SPRBUF1+SX20
    sta SPRBUF1+SX21
    sta SPRBUF1+SX22
    sta SPRBUF1+SX23
    sta SPRBUF1+SX24
    sta SPRBUF1+SX25
    sta SPRBUF1+SX26
    sta SPRBUF1+SX27
    sta SPRBUF1+SX28
    sta SPRBUF1+SX29
    sta SPRBUF1+SX30
    sta SPRBUF1+SX31
    sta SPRBUF1+SY4
    sta SPRBUF1+SY5
    sta SPRBUF1+SY6
    sta SPRBUF1+SY7
    sta SPRBUF1+SY8
    sta SPRBUF1+SY9
    sta SPRBUF1+SY10
    sta SPRBUF1+SY11
    sta SPRBUF1+SY12
    sta SPRBUF1+SY13
    sta SPRBUF1+SY14
    sta SPRBUF1+SY15
    sta SPRBUF1+SY16
    sta SPRBUF1+SY17
    sta SPRBUF1+SY18
    sta SPRBUF1+SY19
    sta SPRBUF1+SY20
    sta SPRBUF1+SY21
    sta SPRBUF1+SY22
    sta SPRBUF1+SY23
    sta SPRBUF1+SY24
    sta SPRBUF1+SY25
    sta SPRBUF1+SY26
    sta SPRBUF1+SY27
    sta SPRBUF1+SY28
    sta SPRBUF1+SY29
    sta SPRBUF1+SY30
    sta SPRBUF1+SY31
    ;--- [/NASTYHACK]

    stz SPRBUF2
    lda #%00000010
    sta SPRBUF1+SPRIORITY4
    sta SPRBUF1+SPRIORITY5
    sta SPRBUF1+SPRIORITY6
    sta SPRBUF1+SPRIORITY7
    sta SPRBUF1+SPRIORITY8
    sta SPRBUF1+SPRIORITY9
    sta SPRBUF1+SPRIORITY10
    sta SPRBUF1+SPRIORITY11
    sta SPRBUF1+SPRIORITY12
    sta SPRBUF1+SPRIORITY13
    sta SPRBUF1+SPRIORITY14
    sta SPRBUF1+SPRIORITY15
    sta SPRBUF1+SPRIORITY16
    sta SPRBUF1+SPRIORITY17
    sta SPRBUF1+SPRIORITY18
    sta SPRBUF1+SPRIORITY19
    sta SPRBUF1+SPRIORITY20
    sta SPRBUF1+SPRIORITY21
    sta SPRBUF1+SPRIORITY22
    sta SPRBUF1+SPRIORITY23
    sta SPRBUF1+SPRIORITY24
    sta SPRBUF1+SPRIORITY25
    sta SPRBUF1+SPRIORITY26
    sta SPRBUF1+SPRIORITY27
    sta SPRBUF1+SPRIORITY28
    sta SPRBUF1+SPRIORITY29
    sta SPRBUF1+SPRIORITY30
    sta SPRBUF1+SPRIORITY31
    wai

    phx                         ; delay between the splash screen fadeout
    ldx #$32                    ; and the appearance of angstart.
-   wai
    dex
    cpx #$0000
    bpl -
    plx

    lda #$0F
    sta $2100
    phx
    ldx #$64
-   wai
    dex
    cpx #$0000
    bpl -
    plx
    lda #$80
    sta $2100                   ; disable screen
    lda #$FF
    sta SPRBUF2
    lda #%0011111
    sta $212C                   ; dump them sprites *MWAHAHAHAA* -cough-

    rtl



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


; BOKMERKE
bH13_STAGE1_SCREEN

    lda #$63                   ; 16x16 spr. size, chr data at $6000
    sta $2101
    stz SPRBUF2
    stz SPRBUF2+1
    stz SPRBUF2+2
    stz SPRBUF2+3
    stz SPRBUF2+4
    stz SPRBUF2+5
    stz SPRBUF2+6
    stz SPRBUF2+7

    LOAD_PAL STAGE1_PAL
    wai
    LOAD_BLOCK2VRAM STAGE1_MAP,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM STAGE1_PIC,$2000,$6000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM STAGE1_SPR,$6000,$2000
    wai
    wai
    wai

    lda #%00010001              ; disable all layers except for bg#1 and oam
    sta $212c

    ldx #$0000                  ; reset bg#1 MAP x,y
    stx MAPX
    stx MAPY

    jsr bH13_STAGE1_SCREEN_initSPR

    jsl sym_MUS_SONG_C1GO
    wai
    stz a_byte2                ; anim#
    lda #$0a
    sta ENM_13_hp              ; anim delay
    jsr bH13_STAGE1_SCREEN_fadeIn


    lda #$AF
    sta a_byte                 ; loop delay
bH13_STAGE1_SCREEN_waitLoop
    wai
    dec ENM_13_hp
    lda ENM_13_hp
    cmp #$00
    bne bH13_STG1_SCR_wLoopCont
    jsr bH13_STAGE1_SCREEN_animSPR
    lda #$0a
    sta ENM_13_hp
bH13_STG1_SCR_wLoopCont
    dec a_byte
    lda a_byte
    cmp #$00
    bne bH13_STAGE1_SCREEN_waitLoop
    jsr bH13_STAGE1_SCREEN_fadeOut
    rtl


bH13_STAGE1_SCREEN_animSPR
    lda a_byte2
    cmp #$00
    beq bH13_STG1_SCR_anmSPR0
    cmp #$01
    beq bH13_STG1_SCR_anmSPR1
    cmp #$02
    beq bH13_STG1_SCR_anmSPR2
    cmp #$03
    beq bH13_STG1_SCR_anmSPR3

;bH13_STG1_SCR_anmSPR4
    lda #$0a
    jsr bH13_STG1_SCR_sframe0dash14
    lda #$02
    jsr bH13_STG1_SCR_sframe15dash28
    jmp bH13_STG1_SCR_anmSPRende
bH13_STG1_SCR_anmSPR3
    lda #$08
    jsr bH13_STG1_SCR_sframe0dash14
    lda #$08
    jsr bH13_STG1_SCR_sframe15dash28
    jmp bH13_STG1_SCR_anmSPRende
bH13_STG1_SCR_anmSPR2
    lda #$04
    jsr bH13_STG1_SCR_sframe0dash14
    lda #$00
    jsr bH13_STG1_SCR_sframe15dash28
    jmp bH13_STG1_SCR_anmSPRende
bH13_STG1_SCR_anmSPR1
    lda #$02
    jsr bH13_STG1_SCR_sframe0dash14
    lda #$02
    jsr bH13_STG1_SCR_sframe15dash28
    jmp bH13_STG1_SCR_anmSPRende
bH13_STG1_SCR_anmSPR0
    lda #$00
    jsr bH13_STG1_SCR_sframe0dash14
    lda #$06
    jsr bH13_STG1_SCR_sframe15dash28
bH13_STG1_SCR_anmSPRende
    inc a_byte2
    lda a_byte2
    cmp #$05
    bne bH13_STG1_SCR_anmSPRende2
    stz a_byte2
bH13_STG1_SCR_anmSPRende2
    rts



bH13_STAGE1_SCREEN_initSPR
    lda #12                    ; type1
    sta SPRBUF1+SX
    lda #63
    sta SPRBUF1+SY
    lda #20
    sta SPRBUF1+SX1
    lda #87
    sta SPRBUF1+SY1
    lda #44
    sta SPRBUF1+SX2
    lda #79
    sta SPRBUF1+SY2
    lda #52
    sta SPRBUF1+SX3
    lda #103
    sta SPRBUF1+SY3
    lda #84
    sta SPRBUF1+SX4
    lda #103
    sta SPRBUF1+SY4
    lda #28
    sta SPRBUF1+SX5
    lda #143
    sta SPRBUF1+SY5
    lda #52
    sta SPRBUF1+SX6
    lda #135
    sta SPRBUF1+SY6
    lda #76
    sta SPRBUF1+SX7
    lda #127
    sta SPRBUF1+SY7
    lda #116
    sta SPRBUF1+SX8
    lda #71
    sta SPRBUF1+SY8
    lda #132
    sta SPRBUF1+SX9
    lda #135
    sta SPRBUF1+SY9
    lda #156
    sta SPRBUF1+SX10
    lda #111
    sta SPRBUF1+SY10
    lda #164
    sta SPRBUF1+SX11
    lda #135
    sta SPRBUF1+SY11
    lda #196
    sta SPRBUF1+SX12
    lda #135
    sta SPRBUF1+SY12
    lda #220
    sta SPRBUF1+SX13
    lda #79
    sta SPRBUF1+SY13
    lda #228
    sta SPRBUF1+SX14
    lda #71
    sta SPRBUF1+SY14
    lda #12                    ; type2
    sta SPRBUF1+SX15
    lda #79
    sta SPRBUF1+SY15
    lda #36
    sta SPRBUF1+SX16
    lda #71
    sta SPRBUF1+SY16
    lda #52
    sta SPRBUF1+SX17
    lda #87
    sta SPRBUF1+SY17
    lda #76
    sta SPRBUF1+SX18
    lda #95
    sta SPRBUF1+SY18
    lda #44
    sta SPRBUF1+SX19
    lda #127
    sta SPRBUF1+SY19
    lda #36
    sta SPRBUF1+SX20
    lda #151
    sta SPRBUF1+SY20
    lda #84
    sta SPRBUF1+SX21
    lda #151
    sta SPRBUF1+SY21
    lda #108
    sta SPRBUF1+SX22
    lda #63
    sta SPRBUF1+SY22
    lda #124
    sta SPRBUF1+SX23
    lda #127
    sta SPRBUF1+SY23
    lda #132
    sta SPRBUF1+SX24
    lda #119
    sta SPRBUF1+SY24
    lda #164
    sta SPRBUF1+SX25
    lda #119
    sta SPRBUF1+SY25
    lda #188
    sta SPRBUF1+SX26
    lda #127
    sta SPRBUF1+SY26
    lda #220
    sta SPRBUF1+SX27
    lda #63
    sta SPRBUF1+SY27
    lda #228
    sta SPRBUF1+SX28
    lda #87
    sta SPRBUF1+SY28
    lda #128                   ; shecret message *har-har*
    sta SPRBUF1+SX29
    lda #16
    sta SPRBUF1+SY29
    lda #144
    sta SPRBUF1+SX30
    lda #16
    sta SPRBUF1+SY30
    lda #160
    sta SPRBUF1+SX31
    lda #16
    sta SPRBUF1+SY31
    lda #$30
    sta SPRBUF1+SPRIORITY
    sta SPRBUF1+SPRIORITY1
    sta SPRBUF1+SPRIORITY2
    sta SPRBUF1+SPRIORITY3
    sta SPRBUF1+SPRIORITY4
    sta SPRBUF1+SPRIORITY5
    sta SPRBUF1+SPRIORITY6
    sta SPRBUF1+SPRIORITY7
    sta SPRBUF1+SPRIORITY8
    sta SPRBUF1+SPRIORITY9
    sta SPRBUF1+SPRIORITY10
    sta SPRBUF1+SPRIORITY11
    sta SPRBUF1+SPRIORITY12
    sta SPRBUF1+SPRIORITY13
    sta SPRBUF1+SPRIORITY14
    sta SPRBUF1+SPRIORITY15
    sta SPRBUF1+SPRIORITY16
    sta SPRBUF1+SPRIORITY17
    sta SPRBUF1+SPRIORITY18
    sta SPRBUF1+SPRIORITY19
    sta SPRBUF1+SPRIORITY20
    sta SPRBUF1+SPRIORITY21
    sta SPRBUF1+SPRIORITY22
    sta SPRBUF1+SPRIORITY23
    sta SPRBUF1+SPRIORITY24
    sta SPRBUF1+SPRIORITY25
    sta SPRBUF1+SPRIORITY26
    sta SPRBUF1+SPRIORITY27
    sta SPRBUF1+SPRIORITY28
    stz SPRBUF1+SPRIORITY29
    stz SPRBUF1+SPRIORITY30
    stz SPRBUF1+SPRIORITY31
    lda #$00                   ; type1 (15 total)
    jsr bH13_STG1_SCR_sframe0dash14
    lda #$06                   ; type2 (14 total)
    jsr bH13_STG1_SCR_sframe15dash28
    lda #$0c                   ; shecret sprites (3 total)
    sta SPRBUF1+SFRAME29
    lda #$0e
    sta SPRBUF1+SFRAME30
    lda #$20
    sta SPRBUF1+SFRAME31
    rts


bH13_STG1_SCR_sframe0dash14
    sta SPRBUF1+SFRAME
    sta SPRBUF1+SFRAME1
    sta SPRBUF1+SFRAME2
    sta SPRBUF1+SFRAME3
    sta SPRBUF1+SFRAME4
    sta SPRBUF1+SFRAME5
    sta SPRBUF1+SFRAME6
    sta SPRBUF1+SFRAME7
    sta SPRBUF1+SFRAME8
    sta SPRBUF1+SFRAME9
    sta SPRBUF1+SFRAME10
    sta SPRBUF1+SFRAME11
    sta SPRBUF1+SFRAME12
    sta SPRBUF1+SFRAME13
    sta SPRBUF1+SFRAME14
    rts
bH13_STG1_SCR_sframe15dash28
    sta SPRBUF1+SFRAME15
    sta SPRBUF1+SFRAME16
    sta SPRBUF1+SFRAME17
    sta SPRBUF1+SFRAME18
    sta SPRBUF1+SFRAME19
    sta SPRBUF1+SFRAME20
    sta SPRBUF1+SFRAME21
    sta SPRBUF1+SFRAME22
    sta SPRBUF1+SFRAME23
    sta SPRBUF1+SFRAME24
    sta SPRBUF1+SFRAME25
    sta SPRBUF1+SFRAME26
    sta SPRBUF1+SFRAME27
    sta SPRBUF1+SFRAME28
    rts


bH13_STAGE1_SCREEN_fadeIn
    pha
    phx
    phy
    ldy   $100E
    stz   $100E
bH13_S1SCR_FIN_R
    ldx   #$04
bH13_S1SCR_FIN_L
    wai
    dec ENM_13_hp
    lda ENM_13_hp
    cmp #$00
    bne bH13_STG1_SCR_FIcont
    jsr bH13_STAGE1_SCREEN_animSPR
    lda #$0a
    sta ENM_13_hp
bH13_STG1_SCR_FIcont
    dex
    cpx   #$00
    bne   bH13_S1SCR_FIN_L
    inc   $100E
    lda   $100E
    sta   $2100
    cmp   #$0F
    bne   bH13_S1SCR_FIN_R
    sty   $100E
    ply
    plx
    pla
    rts

bH13_STAGE1_SCREEN_fadeOut
    pha
    phx
    phy
    ldy   $100E
    lda   #$0F
    sta   $100E
bH13_S1SCR_FOT_R
    ldx   #$04
bH13_S1SCR_FOT_L
    wai
    dec ENM_13_hp
    lda ENM_13_hp
    cmp #$00
    bne bH13_STG1_SCR_FOcont
    jsr bH13_STAGE1_SCREEN_animSPR
    lda #$0a
    sta ENM_13_hp
bH13_STG1_SCR_FOcont
    dex
    cpx   #$00
    bne   bH13_S1SCR_FOT_L
    dec   $100E
    lda   $100E
    sta   $2100
    cmp   #$00
    bne   bH13_S1SCR_FOT_R
    sty   $100E
    ply
    plx
    pla
    rts



.ENDASM
bH13_STAGE1_SCREEN

    LOAD_PAL STAGE1_PAL
    wai
    LOAD_BLOCK2VRAM STAGE1_MAP,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM STAGE1_PIC,$2000,$6000
    wai
    wai
    wai

    lda #$01                    ; disable all layers except for bg#1
    sta $212c

    ldx #$0000                  ; reset bg#1 MAP x,y
    stx MAPX
    stx MAPY

    jsl sym_MUS_SONG_C1GO
    wai
    jsl bH13_FADE_IN_MOSAIC_macro


    lda #$AF
bH13_STAGE1_SCREEN_waitLoop
    wai
    dea
    cmp #$00
    bne bH13_STAGE1_SCREEN_waitLoop

    jsl bH13_FADE_OUT_macro

    rtl
.ASM


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



bH13_PAUSE_GAME_chunk1st

    lda #$01                    ; temporary vars for the bg#1-scroll
    sta $100D                   ; scrolly direction
    lda #$C8
    sta $100E                   ; scrolly counter

    ; Fadeout while scrolling bg#1
    pha
    phx
    phy
    ldy $100E
    lda #$0F
    sta $100E
pgfo_m_fot_r
    ldx #$05
pgfo_m_fot_l
    phx
    ldx MAPX
    inx
    inx
    inx
    stx MAPX
    plx
    wai
    dex
    cpx #$00
    bne pgfo_m_fot_l
    dec $100E
    lda $100E
    sta $2100
    cmp #$00
    bne pgfo_m_fot_r
    sty $100E
    ply
    plx
    pla

    GOTOXY 4,0                  ; black sides..:)
    jsl pgDoTheQQQQloop
    GOTOXY 5,0
    jsl pgDoTheQQQQloop
    GOTOXY 6,0
    jsl pgDoTheQQQQloop
    GOTOXY 7,0
    jsl pgDoTheQQQQloop
    GOTOXY 8,0
    jsl pgDoTheQQQQloop
    GOTOXY 9,0
    jsl pgDoTheQQQQloop
    GOTOXY 10,0
    jsl pgDoTheQQQQloop
    GOTOXY 11,0
    jsl pgDoTheQQQQloop
    GOTOXY 12,0
    jsl pgDoTheQQQQloop
    GOTOXY 13,0
    jsl pgDoTheQQQQloop
    GOTOXY 14,0
    jsl pgDoTheQQQQloop
    GOTOXY 15,0
    jsl pgDoTheQQQQloop
    GOTOXY 16,0
    jsl pgDoTheQQQQloop
    GOTOXY 17,0
    jsl pgDoTheQQQQloop
    GOTOXY 18,0
    jsl pgDoTheQQQQloop
    GOTOXY 19,0
    jsl pgDoTheQQQQloop
    GOTOXY 20,0
    jsl pgDoTheQQQQloop
    GOTOXY 21,0
    jsl pgDoTheQQQQloop
    GOTOXY 22,0
    jsl pgDoTheQQQQloop
    GOTOXY 23,0
    jsl pgDoTheQQQQloop
    GOTOXY 24,0
    jsl pgDoTheQQQQloop
    GOTOXY 25,0
    jsl pgDoTheQQQQloop
    GOTOXY 26,0
    jsl pgDoTheQQQQloop
    GOTOXY 27,0
    jsl pgDoTheQQQQloop
    GOTOXY 4,28
    jsl pgDoTheQQQQloop
    GOTOXY 5,28
    jsl pgDoTheQQQQloop
    GOTOXY 6,28
    jsl pgDoTheQQQQloop
    GOTOXY 7,28
    jsl pgDoTheQQQQloop
    GOTOXY 8,28
    jsl pgDoTheQQQQloop
    GOTOXY 9,28
    jsl pgDoTheQQQQloop
    GOTOXY 10,28
    jsl pgDoTheQQQQloop
    GOTOXY 11,28
    jsl pgDoTheQQQQloop
    GOTOXY 12,28
    jsl pgDoTheQQQQloop
    GOTOXY 13,28
    jsl pgDoTheQQQQloop
    GOTOXY 14,28
    jsl pgDoTheQQQQloop
    GOTOXY 15,28
    jsl pgDoTheQQQQloop
    GOTOXY 16,28
    jsl pgDoTheQQQQloop
    GOTOXY 17,28
    jsl pgDoTheQQQQloop
    GOTOXY 18,28
    jsl pgDoTheQQQQloop
    GOTOXY 19,28
    jsl pgDoTheQQQQloop
    GOTOXY 20,28
    jsl pgDoTheQQQQloop
    GOTOXY 21,28
    jsl pgDoTheQQQQloop
    GOTOXY 22,28
    jsl pgDoTheQQQQloop
    GOTOXY 23,28
    jsl pgDoTheQQQQloop
    GOTOXY 24,28
    jsl pgDoTheQQQQloop
    GOTOXY 25,28
    jsl pgDoTheQQQQloop
    GOTOXY 26,28
    jsl pgDoTheQQQQloop
    GOTOXY 27,28
    jsl pgDoTheQQQQloop

    rtl



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



bH13_PAUSE_GAME_chunk2nd

    GOTOXY 4,0
    jsl pgDoTheUUUUloop
    GOTOXY 5,0
    jsl pgDoTheUUUUloop
    GOTOXY 6,0
    jsl pgDoTheUUUUloop
    GOTOXY 7,0
    jsl pgDoTheUUUUloop
    GOTOXY 8,0
    jsl pgDoTheUUUUloop
    GOTOXY 9,0
    jsl pgDoTheUUUUloop
    GOTOXY 10,0
    jsl pgDoTheUUUUloop
    GOTOXY 11,0
    jsl pgDoTheUUUUloop
    GOTOXY 12,0
    jsl pgDoTheUUUUloop
    GOTOXY 13,0
    jsl pgDoTheUUUUloop
    GOTOXY 14,0
    jsl pgDoTheUUUUloop
    GOTOXY 15,0
    jsl pgDoTheUUUUloop
    GOTOXY 16,0
    jsl pgDoTheUUUUloop
    GOTOXY 17,0
    jsl pgDoTheUUUUloop
    GOTOXY 18,0
    jsl pgDoTheUUUUloop
    GOTOXY 19,0
    jsl pgDoTheUUUUloop
    GOTOXY 20,0
    jsl pgDoTheUUUUloop
    GOTOXY 21,0
    jsl pgDoTheUUUUloop
    GOTOXY 22,0
    jsl pgDoTheUUUUloop
    GOTOXY 23,0
    jsl pgDoTheUUUUloop
    GOTOXY 24,0
    jsl pgDoTheUUUUloop
    GOTOXY 25,0
    jsl pgDoTheUUUUloop
    GOTOXY 26,0
    jsl pgDoTheUUUUloop
    GOTOXY 27,0
    jsl pgDoTheUUUUloop
    GOTOXY 4,28
    jsl pgDoTheUUUUloop
    GOTOXY 5,28
    jsl pgDoTheUUUUloop
    GOTOXY 6,28
    jsl pgDoTheUUUUloop
    GOTOXY 7,28
    jsl pgDoTheUUUUloop
    GOTOXY 8,28
    jsl pgDoTheUUUUloop
    GOTOXY 9,28
    jsl pgDoTheUUUUloop
    GOTOXY 10,28
    jsl pgDoTheUUUUloop
    GOTOXY 11,28
    jsl pgDoTheUUUUloop
    GOTOXY 12,28
    jsl pgDoTheUUUUloop
    GOTOXY 13,28
    jsl pgDoTheUUUUloop
    GOTOXY 14,28
    jsl pgDoTheUUUUloop
    GOTOXY 15,28
    jsl pgDoTheUUUUloop
    GOTOXY 16,28
    jsl pgDoTheUUUUloop
    GOTOXY 17,28
    jsl pgDoTheUUUUloop
    GOTOXY 18,28
    jsl pgDoTheUUUUloop
    GOTOXY 19,28
    jsl pgDoTheUUUUloop
    GOTOXY 20,28
    jsl pgDoTheUUUUloop
    GOTOXY 21,28
    jsl pgDoTheUUUUloop
    GOTOXY 22,28
    jsl pgDoTheUUUUloop
    GOTOXY 23,28
    jsl pgDoTheUUUUloop
    GOTOXY 24,28
    jsl pgDoTheUUUUloop
    GOTOXY 25,28
    jsl pgDoTheUUUUloop
    GOTOXY 26,28
    jsl pgDoTheUUUUloop
    GOTOXY 27,28
    jsl pgDoTheUUUUloop

    rtl



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



bH13_FADE_OUT_macro

    FADE_OUT
    rtl


bH13_FADE_IN_macro

    FADE_IN
    rtl


bH13_FADE_OUT_MOSAIC_macro

    FADE_OUT_MOSAIC
    rtl


bH13_FADE_IN_MOSAIC_macro

    FADE_IN_MOSAIC
    rtl



; And here is the routines over again, but with scrolling plane #1
; for starmap intensions :-)


bH13_FADE_IN_MOSAIC_SCROLLBG1
    pha

    lda #$00
    sta $2100
    lda #$ff
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$01
    sta $2100
    lda #$ef
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$02
    sta $2100
    lda #$df
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$03
    sta $2100
    lda #$cf
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$04
    sta $2100
    lda #$bf
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$05
    sta $2100
    lda #$af
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$06
    sta $2100
    lda #$9f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$07
    sta $2100
    lda #$8f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$08
    sta $2100
    lda #$7f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$09
    sta $2100
    lda #$6f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$0a
    sta $2100
    lda #$5f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$0b
    sta $2100
    lda #$4f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$0c
    sta $2100
    lda #$3f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$0d
    sta $2100
    lda #$2f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$0e
    sta $2100
    lda #$1f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX
    lda #$0f
    sta $2100
    lda #$0f
    sta $2106
    jsr bH13_M_FINMSBG1_WAI_KTHX

    jmp bH13_M_FINMSBG1_ENDE

bH13_M_FINMSBG1_WAI_KTHX
    phx
    ldx MAPX
    inx
    inx
    inx
    stx MAPX
    plx
    wai
    wai
    wai
    wai
    rts

bH13_M_FINMSBG1_ENDE
    pla
    rtl


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


bH13_FADE_OUT_MOSAIC_SCROLLBG1
    pha

    lda #$0f
    sta $2100
    lda #$0f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$0e
    sta $2100
    lda #$1f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$0d
    sta $2100
    lda #$2f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$0c
    sta $2100
    lda #$3f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$0b
    sta $2100
    lda #$4f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$0a
    sta $2100
    lda #$5f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$09
    sta $2100
    lda #$6f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$08
    sta $2100
    lda #$7f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$07
    sta $2100
    lda #$8f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$06
    sta $2100
    lda #$9f
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$05
    sta $2100
    lda #$af
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$04
    sta $2100
    lda #$bf
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$03
    sta $2100
    lda #$cf
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$02
    sta $2100
    lda #$df
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$01
    sta $2100
    lda #$ef
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX
    lda #$00
    sta $2100
    lda #$ff
    sta $2106
    jsr bH13_M_FOTMSBG1_WAI_KTHX

    jmp bH13_M_FOTMSBG1_ENDE

bH13_M_FOTMSBG1_WAI_KTHX
    phx
    ldx MAPX
    inx
    inx
    inx
    stx MAPX
    plx
    wai
    wai
    wai
    wai
    rts

bH13_M_FOTMSBG1_ENDE
    lda #$0f
    sta $2106
    pla
    rtl


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


bH13_FADE_IN_SCROLLBG1
    pha
    phx
    phy
    ldy   $100E
    stz   $100E
bH13_M_FIN_R
    ldx   #$04
bH13_M_FIN_L
    wai
    phx
    ldx   MAPX
    inx
    inx
    inx
    stx   MAPX
    plx
    dex
    cpx   #$00
    bne   bH13_M_FIN_L
    inc   $100E
    lda   $100E
    sta   $2100
    cmp   #$0F
    bne   bH13_M_FIN_R

    sty   $100E
    ply
    plx
    pla
    rtl

;----

bH13_FADE_IN_SCROLLBG1virreVirre
    pha
    phx
    phy
    ldy   $100E
    stz   $100E
bH13_M_FINvv_R
    ldx   #$04
bH13_M_FINvv_L
    wai
    jsl   S1B_virreteShipShip
    phx
    ldx   MAPX
    inx
    inx
    inx
    stx   MAPX
    plx
    dex
    cpx   #$00
    bne   bH13_M_FINvv_L
    inc   $100E
    lda   $100E
    sta   $2100
    cmp   #$0F
    bne   bH13_M_FINvv_R

    sty   $100E
    ply
    plx
    pla
    rtl

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


bH13_FADE_OUT_SCROLLBG1
    pha
    phx
    phy
    ldy   $100E
    lda   #$0F
    sta   $100E
bH13_M_FOT_R
    ldx   #$04
bH13_M_FOT_L
    wai
    jsl   bH13_ENGINE_ALL_doThe50p
    phx
    ldx   MAPX
    inx
    inx
    inx
    stx   MAPX
    plx
    dex
    cpx   #$00
    bne   bH13_M_FOT_L
    dec   $100E
    lda   $100E
    sta   $2100
    cmp   #$00
    bne   bH13_M_FOT_R

    sty   $100E
    ply
    plx
    pla
    rtl


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


bH13_FADE_IN_BG1CREDSCROLL

    pha
    phx
    phy
    ldy   $100E
    stz   $100E
bH13_Ma9a_FIN_R
    ldx   #$04
bH13_Ma9a_FIN_L
    wai
    phx
    ldx   MAPY
    dex
    stx   MAPY
    plx
    dex
    cpx   #$00
    bne   bH13_Ma9a_FIN_L
    inc   $100E
    lda   $100E
    sta   $2100
    cmp   #$0f
    bne   bH13_Ma9a_FIN_R

    sty   $100E
    ply
    plx
    pla
    rtl

bH13_FADE_OUT_BG1CREDSCROLL
    pha
    phx
    phy
    ldy   $100E
    lda   #$0F
    sta   $100E
bH13_Ma9a_FOT_R
    ldx   #$04
bH13_Ma9a_FOT_L
    wai
    phx
    ldx   MAPY
    dex
    stx   MAPY
    plx
    dex
    cpx   #$00
    bne   bH13_Ma9a_FOT_L
    dec   $100E
    lda   $100E
    sta   $2100
    cmp   #$00
    bne   bH13_Ma9a_FOT_R

    sty   $100E
    ply
    plx
    pla
    rtl


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


bH13_HAK_AND_HAXTER

    php
    rep #$10                    ; A/mem=8bits, X/Y=16bits
    sep #$20
    lda #$A3                    ; Spr sizes = 32x32||64x64,
                                ; VRAM chr data address = $6000
    sta $2101
    lda #$04                    ; Mode #4, 8x8 (BG#1=8bpp, BG#2=2bpp)
    sta $2105
    lda #$03                    ; BG#1 tilemap VRAM offs = $0000 ..
    sta $2107                   ; .. and tilemap size = 64x64 tiles
    lda #$52                    ; BG#1 chr VRAM offs = $1000
    sta $210B                   ; BG#2 chr VRAM offs = $2000
    lda #$58                    ; BG#2 tilemap VRAM offs = $5800 ..
    sta $2108                   ; .. and tilemap size = 32x32 tiles
    lda #$13                    ; Enable BG#1, BG#2 and BG#5
    sta $212C
    lda #$FF                    ; Scroll BG#2 down by one pixel
    sta $2110
    sta $2110
    plp
    lda #$80
    sta $2100                   ; screen off, no brightness

    lda #$63                    ; 16x16 spr. size, chr data at $6000
    sta $2101                   ; set oam size register

    rtl



bH13_HAK_AND_HAXTER_ep2

    php
    rep #$10                    ; A/mem=8bits, X/Y=16bits
    sep #$20
    lda #$A3                    ; Spr sizes = 32x32||64x64,
                                ; VRAM chr data address = $6000
    sta $2101
    lda #$03                    ; Mode #3, 8x8 (BG#1=8bpp, BG#2=4bpp)
    sta $2105
    lda #$08                    ; BG#1 tilemap VRAM offs = $0000 ..
    sta $2107                   ; .. and tilemap size = 64x64 tiles
    lda #$21                    ; BG#1 chr VRAM offs = $1000
    sta $210B                   ; BG#2 chr VRAM offs = $2000
    lda #$58                    ; BG#2 tilemap VRAM offs = $5800 ..
    sta $2108                   ; .. and tilemap size = 32x32 tiles
    lda #$13                    ; Enable BG#1, BG#2 and BG#5
    sta $212C
    lda #$FF                    ; Scroll BG#2 down by one pixel
    sta $2110
    sta $2110
    plp
    wai
    wai

    rtl



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


bH13_cutPlyFldpart1
    lda #$00

    sta SPRBUF1+SPRIORITY
    sta SPRBUF1+SPRIORITY1
    sta SPRBUF1+SPRIORITY2
    sta SPRBUF1+SPRIORITY3
    sta SPRBUF1+SPRIORITY4
    sta SPRBUF1+SPRIORITY5
    sta SPRBUF1+SPRIORITY6
    sta SPRBUF1+SPRIORITY7
    sta SPRBUF1+SPRIORITY8
    sta SPRBUF1+SPRIORITY9
    sta SPRBUF1+SPRIORITY10
    sta SPRBUF1+SPRIORITY11

    sta SPRBUF1+SPRIORITY19
    sta SPRBUF1+SPRIORITY20
    sta SPRBUF1+SPRIORITY22
    sta SPRBUF1+SPRIORITY23
    sta SPRBUF1+SPRIORITY24
    sta SPRBUF1+SPRIORITY25
    sta SPRBUF1+SPRIORITY26
    sta SPRBUF1+SPRIORITY27
    sta SPRBUF1+SPRIORITY28
    sta SPRBUF1+SPRIORITY29
    sta SPRBUF1+SPRIORITY30
    sta SPRBUF1+SPRIORITY31


    sta SPRBUF1+SX
    sta SPRBUF1+SY
    sta SPRBUF1+SX1
    sta SPRBUF1+SY1
    sta SPRBUF1+SX2
    sta SPRBUF1+SY2
    sta SPRBUF1+SX3
    sta SPRBUF1+SY3
    sta SPRBUF1+SX4
    sta SPRBUF1+SY4
    sta SPRBUF1+SX5
    sta SPRBUF1+SY5
    sta SPRBUF1+SX6
    sta SPRBUF1+SY6
    sta SPRBUF1+SX7
    sta SPRBUF1+SY7
    sta SPRBUF1+SX8
    sta SPRBUF1+SY8
    sta SPRBUF1+SX9
    sta SPRBUF1+SY9
    sta SPRBUF1+SX10
    sta SPRBUF1+SY10
    sta SPRBUF1+SX11
    sta SPRBUF1+SY11
    sta SPRBUF1+SX19
    sta SPRBUF1+SY19
    sta SPRBUF1+SX20
    sta SPRBUF1+SY20
    sta SPRBUF1+SX22
    sta SPRBUF1+SY22
    sta SPRBUF1+SX23
    sta SPRBUF1+SY23
    sta SPRBUF1+SX24
    sta SPRBUF1+SY24
    sta SPRBUF1+SX25
    sta SPRBUF1+SY25
    sta SPRBUF1+SX26
    sta SPRBUF1+SY26
    sta SPRBUF1+SX27
    sta SPRBUF1+SY27
    sta SPRBUF1+SX28
    sta SPRBUF1+SY28
    sta SPRBUF1+SX29
    sta SPRBUF1+SY29
    sta SPRBUF1+SX30
    sta SPRBUF1+SY30
    sta SPRBUF1+SX31
    sta SPRBUF1+SY31
    wai
    rtl


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



bH13_SOME_RANDOM_GIBBERISH

    lda #$30
    sta SPRBUF1+SX19
    sta SPRBUF1+SX20
    sta SPRBUF1+SX22
    sta SPRBUF1+SX23
    sta SPRBUF1+SX24
    sta SPRBUF1+SX25
    sta SPRBUF1+SX26
    sta SPRBUF1+SX27
    sta SPRBUF1+SX28
    sta SPRBUF1+SX29
    sta SPRBUF1+SX30
    sta SPRBUF1+SX31
    sta SPRBUF1+SY20
    sta SPRBUF1+SY22
    sta SPRBUF1+SY23
    sta SPRBUF1+SY24
    sta SPRBUF1+SY25
    sta SPRBUF1+SY26
    sta SPRBUF1+SY27
    sta SPRBUF1+SY28
    sta SPRBUF1+SY29
    sta SPRBUF1+SY30
    sta SPRBUF1+SY31
    lda #$CC
    sta CURFRAME19
    sta CURFRAME20
    sta CURFRAME22
    sta CURFRAME23
    sta CURFRAME24
    sta CURFRAME25
    sta CURFRAME26
    sta CURFRAME27
    sta CURFRAME28
    sta CURFRAME29
    sta CURFRAME30
    sta CURFRAME31

    rtl



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



bH13_BLACK_SIDES_MKAY

    GOTOXY 8,0
    jsl pgDoTheQQQQloop1
    GOTOXY 9,0
    jsl pgDoTheQQQQloop1
    GOTOXY 10,0
    jsl pgDoTheQQQQloop1
    GOTOXY 11,0
    jsl pgDoTheQQQQloop1
    GOTOXY 12,0
    jsl pgDoTheQQQQloop1
    GOTOXY 13,0
    jsl pgDoTheQQQQloop1
    GOTOXY 14,0
    jsl pgDoTheQQQQloop1
    GOTOXY 15,0
    jsl pgDoTheQQQQloop1
    GOTOXY 16,0
    jsl pgDoTheQQQQloop1
    GOTOXY 17,0
    jsl pgDoTheQQQQloop1
    GOTOXY 18,0
    jsl pgDoTheQQQQloop1
    GOTOXY 19,0
    jsl pgDoTheQQQQloop1
    GOTOXY 20,0
    jsl pgDoTheQQQQloop1
    GOTOXY 21,0
    jsl pgDoTheQQQQloop1
    GOTOXY 22,0
    jsl pgDoTheQQQQloop1
    GOTOXY 23,0
    jsl pgDoTheQQQQloop1
    GOTOXY 24,0
    jsl pgDoTheQQQQloop1
    GOTOXY 25,0
    jsl pgDoTheQQQQloop1
    GOTOXY 26,0
    jsl pgDoTheQQQQloop1
    GOTOXY 27,0
    jsl pgDoTheQQQQloop1
    GOTOXY 4,28
    jsl pgDoTheQQQQloop1
    GOTOXY 5,28
    jsl pgDoTheQQQQloop1
    GOTOXY 6,28
    jsl pgDoTheQQQQloop1
    GOTOXY 7,28
    jsl pgDoTheQQQQloop1
    GOTOXY 8,28
    jsl pgDoTheQQQQloop1
    GOTOXY 9,28
    jsl pgDoTheQQQQloop1
    GOTOXY 10,28
    jsl pgDoTheQQQQloop1
    GOTOXY 11,28
    jsl pgDoTheQQQQloop1
    GOTOXY 12,28
    jsl pgDoTheQQQQloop1
    GOTOXY 13,28
    jsl pgDoTheQQQQloop1
    GOTOXY 14,28
    jsl pgDoTheQQQQloop1
    GOTOXY 15,28
    jsl pgDoTheQQQQloop1
    GOTOXY 16,28
    jsl pgDoTheQQQQloop1
    GOTOXY 17,28
    jsl pgDoTheQQQQloop1
    GOTOXY 18,28
    jsl pgDoTheQQQQloop1
    GOTOXY 19,28
    jsl pgDoTheQQQQloop1
    GOTOXY 20,28
    jsl pgDoTheQQQQloop1
    GOTOXY 21,28
    jsl pgDoTheQQQQloop1
    GOTOXY 22,28
    jsl pgDoTheQQQQloop1
    GOTOXY 23,28
    jsl pgDoTheQQQQloop1
    GOTOXY 24,28
    jsl pgDoTheQQQQloop1
    GOTOXY 25,28
    jsl pgDoTheQQQQloop1
    GOTOXY 26,28
    jsl pgDoTheQQQQloop1
    GOTOXY 27,28
    jsl pgDoTheQQQQloop1

    rtl


;--------------
; STAGE 1 ~ doThe50p & stuff routines and bacon 'n shit
;-------


bH13_INIT_doThe50p

    lda #$00
    sta SPRBUF1+SPRIORITY4      ; set lowest priority to make them appear
    sta SPRBUF1+SPRIORITY5      ; underneath bg#2
    sta SPRBUF1+SPRIORITY6
    sta SPRBUF1+SPRIORITY7
    sta SPRBUF1+SPRIORITY8
    sta SPRBUF1+SX4             ; hide them somewhere on the screen
    sta SPRBUF1+SY4
    sta SPRBUF1+SX5
    sta SPRBUF1+SY5
    sta SPRBUF1+SX6
    sta SPRBUF1+SY6
    sta SPRBUF1+SX7
    sta SPRBUF1+SY7
    sta SPRBUF1+SX8
    sta SPRBUF1+SY8
    lda #$cc                    ; assign graphic to the sprites
    sta SPRBUF1+SFRAME4
    sta SPRBUF1+SFRAME5
    sta SPRBUF1+SFRAME6
    sta SPRBUF1+SFRAME7
    sta SPRBUF1+SFRAME8
    rtl

bH13_DEINIT_doThe50p

    lda #$8c
    sta SPRBUF1+SFRAME4
    sta SPRBUF1+SFRAME5
    sta SPRBUF1+SFRAME6
    sta SPRBUF1+SFRAME7
    sta SPRBUF1+SFRAME8
    stz SPRBUF1+SX4             ; hide them somewhere on the screen
    stz SPRBUF1+SY4
    stz SPRBUF1+SX5
    stz SPRBUF1+SY5
    stz SPRBUF1+SX6
    stz SPRBUF1+SY6
    stz SPRBUF1+SX7
    stz SPRBUF1+SY7
    stz SPRBUF1+SX8
    stz SPRBUF1+SY8
    lda #$ff
    sta SPRBUF2+1
    sta SPRBUF2+2
    rtl

bH13_ENGINE_ALL_doThe50p        ; the new and improved "do-the-50points"
                                ; 2d anti-alised multipurpose movement
                                ; engine.  TODO: add some vector math!
    lda SPRBUF1+SY4
    cmp #$00
    beq bH13_EAdT50p_5
    dec SPRBUF1+SY4
bH13_EAdT50p_5
    lda SPRBUF1+SY5
    cmp #$00
    beq bH13_EAdT50p_6
    dec SPRBUF1+SY5
bH13_EAdT50p_6
    lda SPRBUF1+SY6
    cmp #$00
    beq bH13_EAdT50p_7
    dec SPRBUF1+SY6
bH13_EAdT50p_7
    lda SPRBUF1+SY7
    cmp #$00
    beq bH13_EAdT50p_8
    dec SPRBUF1+SY7
bH13_EAdT50p_8
    lda SPRBUF1+SY8
    cmp #$00
    beq bH13_EAdT50p_done
    dec SPRBUF1+SY8
bH13_EAdT50p_done
    rtl


bH13_doThe50p_ENM13
    lda SPRBUF1+SX13
    sta SPRBUF1+SX4
    lda SPRBUF1+SY13
    sta SPRBUF1+SY4
    rtl
bH13_doThe50p_ENM14
    lda SPRBUF1+SX14
    sta SPRBUF1+SX5
    lda SPRBUF1+SY14
    sta SPRBUF1+SY5
    rtl
bH13_doThe50p_ENM15
    lda SPRBUF1+SX15
    sta SPRBUF1+SX6
    lda SPRBUF1+SY15
    sta SPRBUF1+SY6
    rtl
bH13_doThe50p_ENM16
    lda SPRBUF1+SX16
    sta SPRBUF1+SX7
    lda SPRBUF1+SY16
    sta SPRBUF1+SY7
    rtl
bH13_doThe50p_ENM17
    lda SPRBUF1+SX17
    sta SPRBUF1+SX8
    lda SPRBUF1+SY17
    sta SPRBUF1+SY8
    rtl

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

bH13_ENMBLINK_delay
;------------
    inc ENM_17_magica          ; *ENM_ALL_*blinkDelay*
    lda ENM_17_magica          ; *ENM_ALL_*blinkDelay*
    cmp #$06
    bne bH13_ENMBLDLY_deguchi

    stz ENM_17_magica          ; *ENM_ALL_*blinkDelay*
    inc ENM_18_magica          ; *ENM_ALL_*blinkONOFF*
    lda ENM_18_magica          ; *ENM_ALL_*blinkONOFF*
    cmp #$02
    bne bH13_ENMBLDLY_artsyfartsy
    stz ENM_18_magica          ; *ENM_ALL_*blinkONOFF*
    stz SPRBUF2+6
    stz SPRBUF2+7
    jmp bH13_ENMBLDLY_deguchi

bH13_ENMBLDLY_artsyfartsy
    lda #$FF
    sta SPRBUF2+6
    sta SPRBUF2+7

bH13_ENMBLDLY_deguchi
    lda #$00
    sta SPRBUF1+SX26            ; 'tees ones areth unused and must be taken
    sta SPRBUF1+SY26            ; proper care of *hideous laughter*
    sta SPRBUF1+SX25
    sta SPRBUF1+SY25
    sta SPRBUF1+SX24
    sta SPRBUF1+SY24
    
    rtl


bH13_ENMBLINK_setup
;------------
    stz ENM_13_hp           ; *ENM_13_*blinkState*
    stz ENM_14_hp           ; *ENM_14_*blinkState*
    stz ENM_15_hp           ; *ENM_15_*blinkState*
    stz ENM_16_hp           ; *ENM_16_*blinkState*
    stz ENM_17_hp           ; *ENM_17_*blinkState*

    stz SPRBUF1+SX26
    stz SPRBUF1+SY26
    stz SPRBUF1+SX27
    stz SPRBUF1+SY27
    stz SPRBUF1+SX28
    stz SPRBUF1+SY28
    stz SPRBUF1+SX29
    stz SPRBUF1+SY29
    stz SPRBUF1+SX30
    stz SPRBUF1+SY30
    stz SPRBUF1+SX31
    stz SPRBUF1+SY31

    lda #$FF
    sta SPRBUF2+6
    sta SPRBUF2+7

    rtl


bH13_ENMBLINK_doIt

    lda ENM_13_hp           ; *ENM_13_*blinkState*
    cmp #$01
    bne bH13_ENMBLINK_doIt_E14

    dec ENM_18_hp           ; *ENM_13_*blinkHowLong*
    lda ENM_18_hp           ; *ENM_13_*blinkHowLong*
    cmp #$00
    bne bH13_ENMBLINK_doIt_E14
    ; disable ENM_13_blinkState
    stz ENM_13_hp           ; *ENM_13_*blinkState*
    lda #$00
    sta SPRBUF1+SX27
    sta SPRBUF1+SY27

bH13_ENMBLINK_doIt_E14

    lda ENM_14_hp           ; *ENM_14_*blinkState*
    cmp #$01
    bne bH13_ENMBLINK_doIt_E15

    dec ENM_13_magica          ; *ENM_14_*blinkHowLong*
    lda ENM_13_magica          ; *ENM_14_*blinkHowLong*
    cmp #$00
    bne bH13_ENMBLINK_doIt_E15
    ; disable ENM_14_blinkState
    stz ENM_14_hp           ; *ENM_14_*blinkState*
    lda #$00
    sta SPRBUF1+SX28
    sta SPRBUF1+SY28

bH13_ENMBLINK_doIt_E15

    lda ENM_15_hp           ; *ENM_15_*blinkState*
    cmp #$01
    bne bH13_ENMBLINK_doIt_E16

    dec ENM_14_magica          ; *ENM_15*_blinkHowLong*
    lda ENM_14_magica          ; *ENM_15_*blinkHowLong*
    cmp #$00
    bne bH13_ENMBLINK_doIt_E16
    ; disable ENM_15_blinkState
    stz ENM_15_hp           ; *ENM_15_*blinkState*
    lda #$00
    sta SPRBUF1+SX29
    sta SPRBUF1+SY29

bH13_ENMBLINK_doIt_E16

    lda ENM_16_hp           ; *ENM_16_*blinkState*
    cmp #$01
    bne bH13_ENMBLINK_doIt_E17

    dec ENM_15_magica          ; *ENM_16_*blinkHowLong*
    lda ENM_15_magica          ; *ENM_16_*blinkHowLong*
    cmp #$00
    bne bH13_ENMBLINK_doIt_E17
    ; disable ENM_16_blinkState
    stz ENM_16_hp           ; *ENM_16_*blinkState*
    lda #$00
    sta SPRBUF1+SX30
    sta SPRBUF1+SY30

bH13_ENMBLINK_doIt_E17

    lda ENM_17_hp           ; *ENM_17_*blinkState*
    cmp #$01
    bne bH13_ENMBLINK_doIt_E18

    dec ENM_16_magica          ; *ENM_17_*blinkHowLong*
    lda ENM_16_magica          ; *ENM_17_*blinkHowLong*
    cmp #$00
    bne bH13_ENMBLINK_doIt_E18
    ; disable ENM_17_blinkState
    stz ENM_17_hp           ; *ENM_17_*blinkState*
    lda #$00
    sta SPRBUF1+SX31
    sta SPRBUF1+SY31

bH13_ENMBLINK_doIt_E18
    rtl

-------------------

    ; katrine
bH13_MSG_ENDSCORE
    jsl bH12_INIT_VIDEO_04
    lda #$80
    sta $2100
    lda #%00000010
    sta $212c                   ; disable all, but bg#2
    LOAD_PAL SEQ_S1B_DISCUSS_PAL
    wai
    LOAD_BLOCK2VRAM INTRO_BG_GRL_MAP,$0000,$2000
    wai
    wai
    LOAD_BLOCK2VRAM SEQ_S1B_DISCUSS_PIC,$2000,$6000
    wai
    wai
    LOAD_BLOCK2VRAM FONT_TILES,$5000,$0800
    wai
    wai
    lda #$0f
    sta $2106                  ; disable mosaic
    jsl bH0_SPLSC_CLR
    jsl bH0_PRINTS_MSG_ENDSCORE
    lda #$0f
    sta $2100
    ldx #$010f
    jsl bH12_WAIT_FOR_THE_HOLY_WAI
    lda #$80
    sta $2100
    lda #%00011111
    sta $212c
    jsl bH0_SPLSC_CLR
    rtl

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

bH13_SUTAaTOBOTAN_BLINKx10

    ldx #$000b

strtBtnBlnkX10_loop

    stz SPRBUF2
    wai
    wai
    wai
    wai
    wai
    lda #$ff
    sta SPRBUF2
    wai
    wai
    wai
    wai
    wai
    dex
    cpx #$0000
    bne strtBtnBlnkX10_loop
    stz SPRBUF2
    wai
    wai
    wai
    wai
    wai
    rtl

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

bH13_SUPERNINTENDO_LOGOEN

    ldx #$0000
    stx MAPX
    ldx #$ffff
    stx MAPY

    lda #%00000001
    sta $212c                   ; disable all, but bg#1

    LOAD_PAL LOGO_SNES_PAL
    wai
    LOAD_BLOCK2VRAM LOGO_SNES_MAP,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM LOGO_SNES_PIC,$2000,$6000
    wai
    wai
    wai

    lda #$0f
    sta $2100
    ldx #$0080
superLoopPlease
    wai
    dex
    cpx #$0000
    bne superLoopPlease
    jsl bH13_FADE_OUT_macro
    jml LOGO_SNES_ENDETARM


;--------------------------------
; DEV SCREEN RELATED STUFF

bH13_SJEKK_DEN_KUULE_LOGOEN

    ldx #$0000
    stx MAPX
    ldx #$ffff
    stx MAPY

    lda #%00000001
    sta $212c                   ; disable all, but bg#1

    LOAD_PAL ITSSNESTASY_PAL
    wai
    LOAD_BLOCK2VRAM ITSSNESTASY_MAP,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM ITSSNESTASY_PIC,$2000,$6000
    wai
    wai
    wai

    jsl bH13_FADE_IN_macro
    ldx #$0100
    jsr slightDelay_plus_DEVCheck
    jsl bH13_FADE_OUT_macro
    jml itsSnestasyENDE

slightDelay_plus_DEVCheck
    wai
    lda joy1
    cmp #$10                   ; check if 'R' is pressed
    bne sD_p_DChk_noDEV
    lda joy1+1
    cmp #$01
    bne sD_p_DChk_noDEV        ; check if RIGHT pad is pressed also
    jml bH13_DEV_SCREEN
sD_p_DChk_noDEV
    dex
    cpx #$0000
    bne slightDelay_plus_DEVCheck
    rts

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

bH13_DEV_SCREEN

    lda #$80
    sta $2100
    lda #%00000011
    sta $212c

    LOAD_BLOCK2VRAM MYFONT_CRED_PIC,$5000,$0800
    wai
    wai
    LOAD_PAL BG_CREDPAL
    wai
    LOAD_BLOCK2VRAM BG_CREDDAT,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM BG_CREDGFX,$2000,$6000
    wai
    wai
    wai

    ; BG#2 translucency and shiat
    lda #$01
    sta $212d
    lda #$02
    sta $2130
    lda #$52
    sta $2131

    jsl bH0_PRINTZ_DEV_SCREEN

    lda #$0f
    sta $2100

bH13_dvScrn_loop
    wai
    ldx MAPY
    dex
    stx MAPY

    lda joy1
    cmp #$40                   ; check 'X'
    beq bH13_dvScrn_prsd_X
    lda joy1
    cmp #$80                   ; check 'A'
    beq bH13_dvScrn_prsd_A
    lda joy1+1
    cmp #$80                   ; check 'B'
    beq bH13_dvScrn_prsd_B

    jmp bH13_dvScrn_loop

bH13_dvScrn_prsd_X
    stz $212d                  ; disable translucency
    stz $2130
    stz $2131
    jml SB1_ENDSEQ_n2_meanwhile
bH13_dvScrn_prsd_A
    stz $212d                  ; disable translucency
    stz $2130
    stz $2131
    lda #$03
    sta ang_hp
    lda #$04
    sta ang_lives
    jml b1Clr_XPLODE_finito
bH13_dvScrn_prsd_B
    stz $212d                  ; disable translucency
    stz $2130
    stz $2131
    lda #$04
    sta OBJ_HIT
    jml itsSnestasyENDE



bH13_WARPSCREEN
    lda #$80
    sta $2100
    LOAD_PAL WARPSCREEN_PAL
    wai
    LOAD_BLOCK2VRAM WARPSCREEN_MAP,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM WARPSCREEN_PIC,$1000,$0800
    wai
    wai
    wai
    lda #$0f
    sta $2100
    rtl
bH13_WARPSCREEN_done
    lda #$80
    sta $2100
    LOAD_PAL BG_PAL
    wai
    LOAD_BLOCK2VRAM BG_MAPDAT,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM BG_MAPGFX,$1000,$0800
    wai
    wai
    wai
    lda #$0f
    sta $2100
    rtl



bH13_MESSAGE_FROM_CREATOR ; quistis
    lda #$80
    sta $2100
    wai
    wai
    wai
    jsl sym_MUS_SONG_SPOOKIE
    wai
    jsl bH12_INIT_VIDEO_04
    lda #$80
    sta $2100
    wai
    stz $212c
    ldx #$0000
    stx MAPX
    ldx #$ffff
    stx MAPY
    wai
    wai
    wai
    wai
    LOAD_PAL MESSAGE_PAL
    wai
    LOAD_BLOCK2VRAM MESSAGE_MAP,$0000,$2000
    wai
    wai
    wai
    LOAD_BLOCK2VRAM MESSAGE_PIC,$2000,$6000
    wai
    wai
    wai
    ldx #$003f
    jsl bH12_WAIT_FOR_THE_HOLY_WAI
    
    lda #$00000001
    sta $212c
    jsl bH13_FADE_IN_MOSAIC_macro
waitForPress
    wai
    lda joy1+1
    cmp #$10
    bne waitForPress
    jsl bH13_FADE_OUT_MOSAIC_macro
    ldx #$0010
    jsl bH12_WAIT_FOR_THE_HOLY_WAI
    rtl
    

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



bH13_OPTMENU_SPRTEXT
    LOAD_PAL MMENU_OPTSPRITES_PALLY
    wai

    lda #$01                    ; change colours on bg#1
    sta $2121
    lda #$10
    sta $2122
    lda #$7e
    sta $2122
    lda #$02
    sta $2121
    lda #$9b
    sta $2122
    lda #$7f
    sta $2122
    lda #$03
    sta $2121
    lda #$10
    sta $2122
    lda #$7c
    sta $2122

    LOAD_BLOCK2VRAM MMENU_OPTSPRITES,$6000,$2000 ; 38 sprites (8x8)
    wai
    wai

    stz SPRBUF2
    stz SPRBUF2+1
    stz SPRBUF2+2
    stz SPRBUF2+3
    stz SPRBUF2+4
    stz SPRBUF2+5
    stz SPRBUF2+6
    stz SPRBUF2+7

    lda #%00110000
    sta SPRBUF1+SPRIORITY
    sta SPRBUF1+SPRIORITY1
    sta SPRBUF1+SPRIORITY2
    sta SPRBUF1+SPRIORITY3
    sta SPRBUF1+SPRIORITY4
    sta SPRBUF1+SPRIORITY5
    sta SPRBUF1+SPRIORITY6
    sta SPRBUF1+SPRIORITY7
    sta SPRBUF1+SPRIORITY8
    sta SPRBUF1+SPRIORITY9

    lda #%00110010
    sta SPRBUF1+SPRIORITY10
    sta SPRBUF1+SPRIORITY11
    sta SPRBUF1+SPRIORITY12
    sta SPRBUF1+SPRIORITY13
    sta SPRBUF1+SPRIORITY14
    sta SPRBUF1+SPRIORITY15
    sta SPRBUF1+SPRIORITY16
    sta SPRBUF1+SPRIORITY27
    ;--
    sta SPRBUF1+SPRIORITY17
    sta SPRBUF1+SPRIORITY18
    sta SPRBUF1+SPRIORITY19
    sta SPRBUF1+SPRIORITY20
    sta SPRBUF1+SPRIORITY21
    sta SPRBUF1+SPRIORITY28
    ;--
    sta SPRBUF1+SPRIORITY22
    sta SPRBUF1+SPRIORITY23
    sta SPRBUF1+SPRIORITY24
    sta SPRBUF1+SPRIORITY25
    ;--
    sta SPRBUF1+SPRIORITY26

    ;=================================
    lda #$58  ; 88     ; R (?)
    sta SPRBUF1+SX
    lda #$58  ; 88
    sta SPRBUF1+SY
    lda #$01 ; #$11
    sta CURFRAME
    ;--
    lda #$60  ; 96     ; A (?)
    sta SPRBUF1+SX1
    lda #$58  ; 88
    sta SPRBUF1+SY1
    lda #$01 ; #$00
    sta CURFRAME1
    ;--
    lda #$68  ; 104    ; N (?)
    sta SPRBUF1+SX2
    lda #$58  ; 88
    sta SPRBUF1+SY2
    lda #$01 ; #$0d
    sta CURFRAME2
    ;--
    lda #$70  ; 112    ; K
    sta SPRBUF1+SX3
    lda #$58; ; 88
    sta SPRBUF1+SY3
    lda #$16 ; #$0a
    sta CURFRAME3
    ;--
    ;--
    ;--
    lda #$80  ; 128    ; N
    sta SPRBUF1+SX4
    lda #$58; ; 88
    sta SPRBUF1+SY4
    lda #$16 ; #$0d
    sta CURFRAME4
    ;--
    lda #$88  ; 136    ; O
    sta SPRBUF1+SX5
    lda #$58; ; 88
    sta SPRBUF1+SY5
    lda #$16 ; #$0e
    sta CURFRAME5
    ;--
    lda #$90  ; 144    ; R
    sta SPRBUF1+SX6
    lda #$58 ; 88
    sta SPRBUF1+SY6
    lda #$16 ; #$11
    sta CURFRAME6
    ;--
    lda #$98  ; 152    ; M
    sta SPRBUF1+SX7
    lda #$58 ; 88
    sta SPRBUF1+SY7
    lda #$16 ; #$0c
    sta CURFRAME7
    ;--
    lda #$A0  ; 160    ; A
    sta SPRBUF1+SX8
    lda #$58 ; 88
    sta SPRBUF1+SY8
    lda #$16 ; #$00
    sta CURFRAME8
    ;--
    lda #$A8  ; 168    ; L
    sta SPRBUF1+SX9
    lda #$58 ; 88
    sta SPRBUF1+SY9
    lda #$16 ; #$0b
    sta CURFRAME9
    ;--
    ;--
    ;--
    lda #$58  ; 88     ; M
    sta SPRBUF1+SX10
    lda #$60  ; 96
    sta SPRBUF1+SY10
    lda #$0c
    sta CURFRAME10
    ;--
    lda #$60  ; 96     ; U
    sta SPRBUF1+SX11
    lda #$60  ; 96
    sta SPRBUF1+SY11
    lda #$14
    sta CURFRAME11
    ;--
    lda #$68  ; 104    ; S
    sta SPRBUF1+SX12
    lda #$60  ; 96
    sta SPRBUF1+SY12
    lda #$12
    sta CURFRAME12
    ;--
    lda #$70  ; 112    ; I
    sta SPRBUF1+SX13
    lda #$60  ; 96
    sta SPRBUF1+SY13
    lda #$08
    sta CURFRAME13
    ;--
    lda #$78  ; 120    ; C
    sta SPRBUF1+SX14
    lda #$60  ; 96
    sta SPRBUF1+SY14
    lda #$02
    sta CURFRAME14
    ;--
    lda #$A0  ; 160    ; 0
    sta SPRBUF1+SX15
    lda #$60  ; 96
    sta SPRBUF1+SY15
    lda #$1c
    sta CURFRAME15
    ;--
    lda #$A8  ; 168    ; 0
    sta SPRBUF1+SX16
    lda #$60  ; 96
    sta SPRBUF1+SY16
    lda #$1c
    sta CURFRAME16
    ;--
    ;--
    ;--
    lda #$58  ; 88     ; S
    sta SPRBUF1+SX17
    lda #$68  ; 104
    sta SPRBUF1+SY17
    lda #$12
    sta CURFRAME17
    ;--
    lda #$60  ; 96     ; .
    sta SPRBUF1+SX18
    lda #$68  ; 104
    sta SPRBUF1+SY18
    lda #$19
    sta CURFRAME18
    ;--
    lda #$68  ; 104    ; E
    sta SPRBUF1+SX19
    lda #$68  ; 104
    sta SPRBUF1+SY19
    lda #$04
    sta CURFRAME19
    ;--
    lda #$A0  ; 160    ; 0
    sta SPRBUF1+SX20
    lda #$68  ; 104
    sta SPRBUF1+SY20
    lda #$1c
    sta CURFRAME20
    ;--
    lda #$A8  ; 168    ; 0
    sta SPRBUF1+SX21
    lda #$68  ; 104
    sta SPRBUF1+SY21
    lda #$1c
    sta CURFRAME21
    ;--
    ;--
    ;--
    lda #$58  ; 88     ; K
    sta SPRBUF1+SX22
    lda #$70  ; 112
    sta SPRBUF1+SY22
    lda #$0a
    sta CURFRAME22
    ;--
    lda #$60  ; 96     ; E
    sta SPRBUF1+SX23
    lda #$70  ; 112
    sta SPRBUF1+SY23
    lda #$04
    sta CURFRAME23
    ;--
    lda #$68  ; 104    ; Y
    sta SPRBUF1+SX24
    lda #$70  ; 112
    sta SPRBUF1+SY24
    lda #$17
    sta CURFRAME24
    ;--
    lda #$70  ; 112    ; S
    sta SPRBUF1+SX25
    lda #$70  ; 112
    sta SPRBUF1+SY25
    lda #$12
    sta CURFRAME25
    ;--
    ;--
    ;--
    lda #$58  ; 88     ; <-
    sta SPRBUF1+SX26
    lda #$80  ; 128
    sta SPRBUF1+SY26
    lda #$18
    sta CURFRAME26
    ;--
    ;--
    ;--
    lda #$4c  ; 76     ; STAR POINTER
    sta SPRBUF1+SX30
    lda #$57  ; 87
    sta SPRBUF1+SY30
    lda #$1a
    sta CURFRAME30
    ;--
    lda #$98  ; 152    ; MUSIC #
    sta SPRBUF1+SX27
    lda #$60  ; 96
    sta SPRBUF1+SY27
    lda #$1b
    sta CURFRAME27
    ;--
    lda #$98  ; 152    ; S.E #
    sta SPRBUF1+SX28
    lda #$68  ; 104
    sta SPRBUF1+SY28
    lda #$1b
    sta CURFRAME28
    ;--
    lda #$16           ; these are unused.
    sta CURFRAME29
    sta CURFRAME31
    ;=================================
    lda #$30
    sta SPRBUF1+SPRIORITY30
    rtl



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


S1B_VERSUS_PIC
    .INCBIN "gfx/s1bversus.pic"

MMENU_BG1_GFX
    .INCBIN "gfx/mmenubg1.pic"

SEQ_S1B_CSTIN_PAL
    .INCBIN "gfx/seq_s1bcstin.clr"
    .INCBIN "gfx/seq_s1bsprff.clr"

.ENDS ; $13


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


.BANK $14 SLOT 0
.ORG $0000
.SECTION "bukkakeIsNice"


STAGE1_PIC
    .INCBIN "gfx/stage1.pic"


SEQ_S1B_FUUUCK_PIC:
    .INCBIN "gfx/s1amfuck.pic"
SEQ_S1B_FUUUCK_MAP:
    .INCBIN "gfx/s1amfuck.map"


S1B_VERSUS_MAP
    .INCBIN "gfx/s1bversus.map"

ITSSNESTASY_PIC
    .INCBIN "gfx/its_snestasy.pic"

SEQ_S1B_CSTIN_MAP            ; castle inside (big)
    .INCBIN "gfx/seq_s1bcstin.map"

.ENDS ; $14


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


.BANK $15 SLOT 0
.ORG $0000
.SECTION "mikonosayochan"

SEQ_SB1_ENDLVL_SKY_MAP
    .INCBIN "gfx/seq_sb1sky.map"
SEQ_SB1_ENDLVL_SKY_PIC
    .INCBIN "gfx/seq_sb1sky.pic"
SEQ_SB1_ENDLVL_SKY_PAL
    .INCBIN "gfx/seq_sb1sky.clr"
    .INCBIN "gfx/sprset1.clr"
SEQ_SB1_SPRZ
    .INCBIN "gfx/seq_sb1spr.pic"
SEQ_S1BCASTLE_PIC
    .INCBIN "gfx/seq_s1bcastle.pic"
SEQ_S1B_CSTIN2_PAL
    .INCBIN "gfx/seq_s1bcstin2.clr"
    .INCBIN "gfx/seq_s1bsprff.clr"

.ENDS ; $15


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


.BANK $16 SLOT 0               ; bank #22
.ORG $0000
.SECTION "mrGimmicksOwnerIsHawt"

SEQ_S1B_CSTIN_PIC
    .INCBIN "gfx/seq_s1bcstin.pic"
SEQ_S1B_SPRSETFF               ; Final Fantasy spriteset
    .INCBIN "gfx/seq_s1bsprff.pic"
SEQ_S1B_CSTIN2_PIC
    .INCBIN "gfx/seq_s1bcstin2.pic"
SEQ_S1B_CSTIN2_MAP
    .INCBIN "gfx/seq_s1bcstin2.map"
FF1_FONTSET
    .INCBIN "gfx/ff1fontset.pic"

ENDING_BAD_BG1_PIC
    .INCBIN "gfx/end_bad.pic"
ENDING_BAD_PAL
    .INCBIN "gfx/end_bad.clr"
    .INCBIN "gfx/end_bad_spr.clr"

.ENDS ; $16


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


.BANK $17 SLOT 0               ; bank #23
.ORG $0000
.SECTION "7th042005"

ENDING_BAD_BG1_MAP
    .INCBIN "gfx/end_bad.map"
ENDING_BAD_SPR_PIC
    .INCBIN "gfx/end_bad_spr.pic"

STAGE_CLEAR_SPR
    .INCBIN "gfx/stgclr_spr.pic"
STAGE_CLEAR_PAL
    .INCBIN "gfx/stgclr_bg1.clr"
    .INCBIN "gfx/stgclr_spr.clr"

STAGE2_PAL
    .INCBIN "gfx/stage2.clr"
STAGE2_MAP
    .INCBIN "gfx/stage2.map"

.ENDS ; $17


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


.BANK $18 SLOT 0
.ORG $0000
.SECTION "obladioblada"

STAGE2_PIC
    .INCBIN "gfx/stage2.pic"

S2_LEVEL_PAL
    .INCBIN "gfx/stage2data/lvlscrns/room03.clr"  ; oppdater denne (room*.clr)
    .INCBIN "gfx/stage2data/s2_sprset1.clr"       ; etter nyeste tillagte rom.

S2_SPRSET1_PIC
    .INCBIN "gfx/stage2data/s2_sprset1.pic"

S1_SPRSET5b
    .INCBIN "gfx/sprset5b.pic"

.ENDS ; $18


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


.BANK $19 SLOT 0
.ORG $0000
.SECTION "kagomeGetsRapedInTheManga" ;_;

ITSSNESTASY_MAP
    .INCBIN "gfx/its_snestasy.map"


S2_ROOM_01_PIC
    .INCBIN "gfx/stage2data/lvlscrns/room01.pic"
S2_ROOM_01_MAP
    .INCBIN "gfx/stage2data/lvlscrns/room01.map"

S2_ROOM_02_PIC
    .INCBIN "gfx/stage2data/lvlscrns/room02.pic"
S2_ROOM_02_MAP
    .INCBIN "gfx/stage2data/lvlscrns/room02.map"
S2_ROOM_02a_PIC
    .INCBIN "gfx/stage2data/lvlscrns/room02a.pic"
S2_ROOM_03_PIC
    .INCBIN "gfx/stage2data/lvlscrns/room03.pic"

.ENDS ; $19


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


.BANK $1a SLOT 0
.ORG $0000
.SECTION "harmoniskOrkester"

S2_ROOM_02a_MAP
    .INCBIN "gfx/stage2data/lvlscrns/room02a.map"
S2_ROOM_03_MAP
    .INCBIN "gfx/stage2data/lvlscrns/room03.map"


LOGO_SNES_PAL
    .INCBIN "gfx/logo_snes.clr"
LOGO_SNES_PIC
    .INCBIN "gfx/logo_snes.pic"
LOGO_SNES_MAP
    .INCBIN "gfx/logo_snes.map"


BG_TITPAL:
    .INCBIN "gfx/splash.clr"
    .INCBIN "gfx/sprsplsh.clr"
BG_PAUPAL:
    .INCBIN "gfx/pausemap.clr"
    .INCBIN "gfx/sprsplsh.clr"


.ENDS ; $1a


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


.BANK $1b SLOT 0
.ORG $0000
.SECTION "pussyGalore"

S2AMBLOOD_PAL
    .INCBIN "gfx/s1amblood.clr"
S2AMBLOOD_PIC
    .INCBIN "gfx/s1amblood.pic"
S2AMBLOOD_MAP
    .INCBIN "gfx/s1amblood.map"

SEQ_WARNING_FONT
    .INCBIN "gfx/warnfont.pic"


GTN_SPLASH_PIC
    .INCBIN "gfx/guessnum/gtn_splash.pic"
GTN_SPLASH_PAL
    .INCBIN "gfx/guessnum/gtn_splash.clr"

.ENDS ; $1b


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


.BANK $1c SLOT 0
.ORG $0000
.SECTION "greatfulDays"

HIDDEN_FONT_PIC
    .INCBIN "gfx/hidden_font.pic"

GTN_SPLASH_MAP
    .INCBIN "gfx/guessnum/gtn_splash.map"
BG1_SNEZPAD_MAP
    .INCBIN "gfx/snezpad.map"


WARPSCREEN_PIC
    .INCBIN "gfx/warpscreen.pic"
WARPSCREEN_MAP
    .INCBIN "gfx/warpscreen.map"
WARPSCREEN_PAL
    .INCBIN "gfx/warpscreen.clr"
    .INCBIN "gfx/sprset1.clr"


MESSAGE_PAL
    .INCBIN "gfx/message.clr"

.ENDS ; $1c


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


.BANK $1d SLOT 0
.ORG $0000
.SECTION "getYourActTogether"

MESSAGE_PIC
    .INCBIN "gfx/message.pic"


S2INT_OUTSIDE_SPRSET
    .INCBIN "gfx/stage2data/outside_spr.pic"
S2INT_OUTSIDE_CASTLE_PAL
    .INCBIN "gfx/stage2data/outside_castle.clr"
    .INCBIN "gfx/stage2data/outside_spr.clr"

.ENDS ; $1d


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


.BANK $1e SLOT 0
.ORG $0000
.SECTION "grimReaperSaysGoToBed"   ; "you heard 'im, Michael.. NOW GO TO BED!!! ^_^

MESSAGE_MAP
    .INCBIN "gfx/message.map"


S2INT_OUTSIDE_CASTLE_MAP
    .INCBIN "gfx/stage2data/outside_castle.map"
S2INT_OUTSIDE_CASTLE_PIC
    .INCBIN "gfx/stage2data/outside_castle.pic"

.ENDS ; $1e


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


.BANK $1f SLOT 0
.ORG $0000
.SECTION "finalBank"

THE_END_PAL
    .INCBIN "gfx/the_end.clr"
THE_END_MAP
    .INCBIN "gfx/the_end.map"
THE_END_PIC
    .INCBIN "gfx/the_end.pic"

.ENDS ; $1f
