;======================================================= ; TitleScreen- Displays title screen and opening menu ;======================================================= TitleScreen: ;Copy Picture to graph_mem ld hl,TitlePic ld de,graph_mem ld bc,324 ; we need to copy call disprle ;Clear the rest ld bc,444 ld hl,graph_mem+323 ldir ;Display Roto's Sprite ld a,12 call SetSpriteHeight ld bc,$4028 ld hl,Player+24+24+24+24+24+24+24 call PutSprClp ;Start a loop TitleLoop: ;Display Screen call fastcopy InverseText ld hl,$1922 ld (pencol),hl ld hl,tDungeon bcall(_vputs) DisableAPD NoInverseText call waitkey cp kDel jr z,EraseSavedGame cp_0(mhp) jp z,erase2 ret EraseSavedGame: ld a,$C9 ;ret ld (wk_ret),a bcall(_clrlcdfull) res textInverse, (iy+textflags) ld hl,$0404 ld (pencol),hl ld hl,tWarning bcall(_vputs) call waitkey cp kClear ret z erase2: ;Erase all saved data ld hl,enemyram ld de,enemyram+1 ld bc,endofvars-enemyram-1 ld (hl),0 ldir ;Set up level 1 loto ;150 hp & mhp ld a,150 ld (hp),a ld (mhp),a ;Sword 9, shield 9, str 9, ndf 9... ld a,9 ld (sword),a ld (shield),a ld (str),a ld (ndf),a ;9 squares till next battle ld (fight),a ;Name: Loto ld hl,tYourName ld (NamePointer),hl ;nothing before loto ld hl,tNull ld (yNull),hl ;Level 1 ld a,1 ld (lev),a ;1 of each scroll ld hl,scrolls ld de,scrolls+1 ld bc,7 ld (hl),a ldir ;create a monster ally! ld b,10 call random ld c,7 ld e,5 ld d,a call GenerateEnemy ret DispRLE: DispRLEL: ld a,(hl) ; get the next byte cp $91 ; is it a run? jr z,DispRLERun ; then we need to decode the run ldi ; copy the byte, and update counters DispRLEC: ld a,b ; check the low byte and or c ; the high byte for 0 jr nz,DispRLEL ; if not, then we're not done either ret ; if it's zero, we're done DispRLERun: inc hl ; move to the run value ld a,(hl) ; get the run value inc hl ; move to the run count push hl ; save source pointer ld h,(hl) ; get the run count ex de,hl ; swap source and destination pointers DispRLERunL: ld (hl),a ; copy the byte inc hl ; increase destination pointer dec bc ; decrease byte count dec d ; decrease run count jr nz,DispRLERunL ; if we're not done, then loop ex de,hl ; swap pointers back pop hl ; recover source pointer inc hl ; advance the source pointer jr DispRLEC ; check to see if we should loop