bcall(_cleargbuf) ld hl,ContrastTEXT ld de,2*256+2 call DispVText ld de,9*256+2 call DispVText call _IonFastCopy ContrastQuestion: bcall(_getcsc) ld b,1 cp g2nd jr z,AcceptContrast dec b cp gMode jr nz,ContrastQuestion AcceptContrast: ld a,b ld (ContrastEnableFlag),a ld hl,MapPackString ld (SearchString),hl Menu: ld a,(SaveState) or a jp z,NewGame LoadGameMenu: ld de,30*256+10 ld hl,LoadTxt call DispVText call _IonFastCopy MenuMain: bcall(_getcsc) cp gMode jp z,NewGame2 cp g2nd jr nz,MenuMain ld hl,SaveState ld de,PlayerWeapons ldi ld de,WeaponSelected ldi ld de,PlayerHealth ldi ;Health ldi ;Ammo ld de,NextLevelSearchString LoadNextLevelSearchStringLoop: ld a,(hl) ldi or a jr nz,LoadNextLevelSearchStringLoop inc a ; =1 ld (NewGameFlag),a jp GameLoaded Loadlevel: bcall(_cleargbuf) ld de,$0008 ld hl,TitleTxt call DispVText ld de,$3901 ld hl,AuthorTxt call DispVText ld hl,GRAPH_MEM call Invert ld hl,GRAPH_MEM+684 call Invert ld hl,(progptr) SearchLoop: ld ix,0 SearchString = $-2 call _IonDetect jr nz,SearchDone ld hl,LvlNo inc (hl) ex de,hl jr SearchLoop SearchDone: ld de, $0801 ld a,(LvlNo) or a jr nz,LevelsFound NoLevels: NoFilesFoundExit: ld hl,NoLevel call DispVText call _IonFastCopy QuitFromLoad: pop hl ; aus call LoadLevel heraus! ret ;exit! LevelsFound: xor a ld (SetD+1),a ShowLevels: ld b,8 ld a,0 LvlNo = $-1 cp b jr nc,ShowLevel2 ld b,a ShowLevel2: push bc dec b ld l,b ld h,6 bcall(MUL_HL) ld de, $0801 ld a,l add a,d ld d,a pop bc ShowLevel: ld (pencol),de push de push bc ld a,(Top) add a,b call LoadLevelA ld b,24 bcall(_vputs) pop bc pop de ld a,d sub 6 ld d,a djnz ShowLevel ld hl,Top ld a,(LvlNo) sub (hl) cp 8 jr c,SetMax ld a,8 SetMax: ld e,a dec e SetD: ld d,0 call ShowBar CL_KeyLoop: push de bcall(_getcsc) pop de cp gup jr z,ScrollUp cp g2nd jr z,AcceptLevel cp gclear jr z,QuitFromLoad cp gdown jr nz,CL_KeyLoop ScrollDown: call ShowBar ld a,d cp e jr z,ScrollL_Down inc d jr ShowIt ScrollL_Down: ld (SetD+1),a ld a,(LvlNo) sub 8 jr c,ShowIt ld hl,Top cp (hl) jr z,ShowIt inc (hl) jr ShowLevels ScrollL_Up: ld (SetD+1),a ld hl,Top ld a,(hl) or a jr z, ShowIt dec (hl) Sh: jp ShowLevels ScrollUp: call ShowBar ld a,d or a jr z,ScrollL_Up dec d ShowIt: call ShowBar jr CL_KeyLoop AcceptLevel: ld a,0 Top = $-1 add a,d inc a call LoadLevelA ld de,20 add hl, de ;skip map desc. ret ShowBar: push de ld l,d ld h,72 bcall(MUL_HL) ld de,GRAPH_MEM+(8*12) add hl,de call Invert pop de ret Invert: ld bc,84 InvLoop: ld a,(hl) cpl ld (hl),a inc hl dec bc ld a,b or c jr nz,InvLoop jp _IonFastCopy LoadLevelA: ld b,a ld de,(progptr) LoadLevelB2: ex de,hl ld ix,(SearchString) push bc call _IonDetect pop bc djnz LoadLevelB2 ret