;Remember ? v1.2 ;by Jean Carot ;Email : yhean@mailcity.com ;01/99 .nolist #include "asm83.inc" #include "sos.inc" ;-----> Variables block = SAVESSCREEN ;block number pos = SAVESSCREEN+2 ;block position dif = SAVESSCREEN+3 ;difficulty rb1 = SAVESSCREEN+4 ;what block in position 1 rb2 = SAVESSCREEN+5 ;' ' 2 rb3 = SAVESSCREEN+6 ;' ' 3 rb4 = SAVESSCREEN+7 ;' ' 4 rb5 = SAVESSCREEN+8 ;' ' 5 rbb1 = SAVESSCREEN+9 ;what block you choose in position 1 rbb2 = SAVESSCREEN+10 ;' ' 2 rbb3 = SAVESSCREEN+11 ;' ' 3 rbb4 = SAVESSCREEN+12 ;' ' 4 rbb5 = SAVESSCREEN+13 ;' ' 5 score = SAVESSCREEN+14 ;score .list .org $9327 ccf ;makes the program invisible to Ashell jr z,start ;'z' is "program invisible to SOS until ;INSTALL is installed" .dw libraries-$9327 ;pointer to the libraries ;use $0000 if no libraries are used .dw title ;-----> Display title screen start: ld hl,$0000 ;score = 0 ld (score),hl ; ld a,250 ld (dif),a ld hl,pic ; ld de,plotsscreen ; ld bc,144 ;display title ldir ; call grbufcpy_v ; ld hl,12*256+9 ld (pencol),hl ld hl,by call vputs ld hl,26*256+26 ld (pencol),hl ld hl,play call vputs ld hl,33*256+26 ld (pencol),hl ld hl,exit call vputs call dispHS ;display High Score ld hl,57*256+2 ld (pencol),hl ld hl,email call vputs ;-----> Play or Exit loop: call get_key cp $37 jr z,game cp $0F ret z jr loop GAME: call dispscore call waitkey call grbufclr ld a,-1 ld (pos),a ;-----> Draw five blocks (random) ld b,5 ;loop1 5 times loop1: ld a,b ;b->a push af ;remember a ld a,(pos) ; inc a ;(pos)+1->(pos) ld (pos),a ; call command ; st: pop af ;recall a ld b,a ;a->b djnz loop1 ;Decrement 'b' and Jump if Not Zero to loop1 call grbufcpy_v ;copy the sprites call delay ; ;-----> Player turn, choose blocks... call grbufclr call pos1 ; call load0 ; call draw ;draw the sprites call grbufcpy_v ;copy them getkey: call get_key cp $04 ;is it UP ? call z,UP cp $01 ;... DOWN ? call z,DOWN cp $0F ;... CLEAR ? jp z,save cp $09 ;... ENTER ? jr z,ENTER jr getkey ;no ? euhh.... again UP: call draw ld a,(block) ;block number inc a cp 5 call z,load0 ld (block),a call draw call grbufcpy_v ret DOWN: call draw ld a,(block) dec a cp -1 call z,load4 ld (block),a call draw call grbufcpy_v ret ENTER: call pl_turn ;valid your choice ld a,(pos) inc a cp 5 call z,FIN jp z,GAME ld (pos),a call draw call grbufcpy_v jr getkey FIN: call grbufclr call COMPARE ;check your score call dispscore RET load0: xor a ld (block),a ret load4: ld a,4 ld (block),a ret Command: call Grandom call remember call draw ret GRandom: ld b,5 call vector1 ;random (ZLIB) ld (block),a ret Delay: ld a,(dif) ld b,a ctn: halt halt djnz ctn ret ;-----> Save position and block numbers Remember: ld a,(pos) or a call z,rem1 dec a call z,rem2 dec a call z,rem3 dec a call z,rem4 dec a call z,rem5 ret rem1: ld a,(block) ld (rb1),a ret rem2: ld a,(block) ld (rb2),a ret rem3: ld a,(block) ld (rb3),a ret rem4: ld a,(block) ld (rb4),a ret rem5: ld a,(block) ld (rb5),a ret pl_turn: ld a,(pos) or a call z,remm1 dec a call z,remm2 dec a call z,remm3 dec a call z,remm4 dec a call z,remm5 ret remm1: ld a,(block) ld (rbb1),a ret remm2: ld a,(block) ld (rbb2),a ret remm3: ld a,(block) ld (rbb3),a ret remm4: ld a,(block) ld (rbb4),a ret remm5: ld a,(block) ld (rbb5),a ret ;-----> Compare position, increase score, high score... COMPARE: ld a,(rb1) call exchange ld a,(rbb1) call load_cp call z,increase_score ld a,(rb2) call exchange ld a,(rbb2) call load_cp call z,increase_score ld a,(rb3) call exchange ld a,(rbb3) call load_cp call z,increase_score ld a,(rb4) call exchange ld a,(rbb4) call load_cp call z,increase_score ld a,(rb5) call exchange ld a,(rbb5) call load_cp call z,increase_score ret exchange: ld l,a ld h,0d ex de,hl ret load_cp: ld l,a ld h,0d call cphlde ret dispscore: call clrlcd ld hl,2 ld (currow),hl ld hl,1 ld (curcol),hl ld hl,scoretxt call puts ld hl,2 ld (currow),hl ld hl,7 ld (curcol),hl ld hl,(score) ; call dispHL ;display hl ld hl,6 ld (currow),hl ld hl,1 ld (curcol),hl ld hl,pressakey call puts ret increase_score: ld hl,(score) inc hl ;increase score ld (score),hl ld a,(dif) cp 2 ; ret z ; dec a ;(delay)-2->(delay) dec a ; ld (dif),a ret save: ld de,(hscore) ld hl,(score) call vector2 ;check hiscore (ZLIB) ret nz ;no hs ? return ld hl,(score) ld (hscore),hl call setxxxxop2 call clrlcd jr NewHScore dispHS: ld hl,46*256+9 ld (pencol),hl ld hl,hs call vputs ld hl,46*256+46 ld (pencol),hl ld hl,(hscore) call setxxxxop2 ; call op2_to_op1 ;VdispHL (thx Joe :) ld a,6 call dispop1a ; ret NewHScore: ld b,50 finish: ld a,b push af set textinverse,(iy+textflags) ld hl,30*256+20 ld (pencol),hl ld hl,nhs call vputs res textinverse,(iy+textflags) pop af ld b,a djnz finish RET ;-----> Draw, sprites, title... DRAW: ld a,(block) or a call z,d1 dec a call z,d2 dec a call z,d3 dec a call z,d4 dec a call z,d5 ld a,(pos) or a call z,pos1 dec a call z,pos2 dec a call z,pos3 dec a call z,pos4 dec a call z,pos5 ld b,8 call vector0 ;draw sprite (ZLIB) ;b=size of sprite ret ;l=yc ;a=xc ;ix holds pointer pos1: xor a ld (pos),a ld a,14 ld l,28 ret pos2: ld a,1 ld (pos),a ld a,30 ld l,28 ret pos3: ld a,2 ld (pos),a ld a,46 ld l,28 ret pos4: ld a,3 ld (pos),a ld a,62 ld l,28 ret pos5: ld a,4 ld (pos),a ld a,78 ld l,28 ret d1: ld ix,spr1 ret d2: ld ix,spr2 ret d3: ld ix,spr3 ret d4: ld ix,spr4 ret d5: ld ix,spr5 ret spr1: .db %11111111 .db %10001111 .db %10001111 .db %10001111 .db %11110001 .db %11110001 .db %11110001 .db %11111111 spr2: .db %11111111 .db %10111111 .db %10011111 .db %10001111 .db %10000111 .db %11000011 .db %11100001 .db %11111111 spr3: .db %11111111 .db %10101011 .db %11010101 .db %10101011 .db %11010101 .db %10101011 .db %11010101 .db %11111111 spr4: .db %11111111 .db %10010001 .db %10100101 .db %11001101 .db %10011101 .db %10111101 .db %10000001 .db %11111111 spr5: .db %11111111 .db %10111101 .db %11000011 .db %11011111 .db %11111011 .db %11000011 .db %10111101 .db %11111111 pic: .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$1E,$00,$00,$00 .db $00,$7C,$00,$00,$00,$00,$C0,$00,$33,$00,$00,$00 .db $00,$7E,$00,$00,$00,$00,$C0,$00,$33,$00,$00,$00 .db $00,$66,$73,$F8,$73,$F8,$F8,$E7,$06,$00,$00,$00 .db $00,$66,$DB,$6C,$DB,$6C,$CD,$B7,$0C,$02,$30,$00 .db $00,$7C,$FB,$6C,$FB,$6C,$CD,$F6,$0C,$06,$08,$00 .db $00,$6C,$C3,$6C,$C3,$6C,$CD,$86,$00,$52,$10,$00 .db $00,$66,$DB,$6C,$DB,$6C,$CD,$B6,$0C,$52,$20,$00 .db $00,$66,$73,$6C,$73,$6C,$F8,$E6,$0C,$22,$B8,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ;-----> Text by: .db "By Jean Carot",0 play: .db $C1,"MODE] Start",0 exit: .db $C1,"CLEAR] Exit",0 email: .db "Email: yhean@mailcity.com",0 scoretxt: .db "Score: ",0 pressakey: .db "Press a key...",0 title: .db "Remember ? v1.2",0 hs: .db "High Score:",0 nhs: .db " New High Score ! ",0 hscore: .db 0,0 ;-----> SOS libraries libraries: .db "ZLIB",0,0,0,0,lib1,vec0 ;sprite .db "ZLIB",0,0,0,0,lib2,vec1 ;random .db "ZLIB",0,0,0,0,libD,vec2 ;high score .db $FF ;end of libraries table .end ;finish ! END ;happy end :). Good night ....