#INCLUDE "sos.inc" #INCLUDE "squish.inc" #DEFINE numitems 8265h ;number of items in list #DEFINE curitem 8266h ;current item, for use with guessing #DEFINE ilist 8267h ;list of items .org 9327h ccf ;SOS program! jr init .dw libs-$9327 ;lib location .dw title ;description init: ld hl,5*256+25 ld (PENCOL),hl ld hl,name call _vputs ld de,15*256+37 ld (PENCOL),de call _vputs ;version ld de,30*256+31 ld (PENCOL),de call _vputs ;author ld hl,40*256+15 ; ld (PENCOL),hl ld hl,hiscr_string call _vputs ;disps "High Score:" ld hl,40*256+56 ld (PENCOL),hl ld a,(high_score) call _SETXXOP1 ld a,2 call _DISPOP1A ;disps the current highscore ld hl,50*256+7 ld (PENCOL),hl ld hl,anykey call _vputs call endloop call _clrlcdfull xor a ld (numitems),a ld (curitem),a ld b,a ld c,1 ld d,94 ld e,63 ld h,c call _ILINE ld c,e ld e,1 call _ILINE main: call addone ld a,1 ld (curitem),a call displist ld a,1 ld (curitem),a call getlist dec a jp z,lost ld a,(numitems) cp 97 jp z,win ld b,40 mloop: halt djnz mloop jr main lost: ;you lose. disp gameover stuff call _clrlcdfull ld hl,10*256+28 ld (PENCOL),hl ld hl,gameover call _vputs ld hl,20*256+15 ld (PENCOL),hl ld hl,yourscore call _vputs ld hl,20*256+68 ld (PENCOL),hl ld a,(numitems) dec a push af call _SETXXOP1 ld a,2 call _DISPOP1A pop bc ld a,(high_score) cp b ;is there a new highscore jr nc,no_high_score ld a,b ld (high_score),a ld hl,30*256+20 ld (PENCOL),hl ld hl,nhs_string call _vputs no_high_score: ;no new highscore ld hl,50*256+7 ld (PENCOL),hl ld hl,anykey call _vputs endloop: call _getk ;wait for clear key cp 15 jr nz,endloop ret ;The end win: ;You've won (hehheh) call _clrlcdfull ld hl,20*256+25 ld (PENCOL),hl ld hl,youwin call _vputs jr endloop ret getlist: gloop: call _getk ld d,4 dec a jr z,gnext ld d,1 dec a jr z,gnext ld d,3 dec a jr z,gnext dec d dec a jr z,gnext cp 15-4 jr z,donel jr gloop gnext: ld a,d push de call coordfind call dispx ld hl,ilist ld a,(curitem) ld b,0 ld c,a add hl,bc dec hl ld a,(hl) pop de cp d jr nz,donel ld a,(numitems) ld b,a ld a,(curitem) cp b jr z,donew ld a,(curitem) inc a ld (curitem),a jp gloop donel: ld a,1 ret donew: xor a ret addone: ld hl,ilist ld a,(numitems) ld c,a ld b,0 add hl,bc ld a,r rra and 3 inc a ld (hl),a ld a,(numitems) inc a ld (numitems),a ret displist: ;display all the past places ld b,16 dloop: halt djnz dloop ld hl,ilist ld a,(curitem) ld c,a ld b,0 add hl,bc dec hl ld a,(hl) call coordfind call dispx ld bc,(numitems) ld a,(curitem) cp c ret z ld a,(curitem) inc a ld (curitem),a jr displist ret coordfind: ld bc,8*256+22 dec a ret z ld bc,38*256+42 dec a ret z ld bc,67*256+23 dec a ret z ld bc,36*256+5 ret dispx: ;display the 'x' on the screen ld a,b add a,15 ld d,a ld a,c add a,15 ld e,a ld h,1 call _ILINE ld a,c ld c,e ld e,a call _ILINE push bc push af push de ld a,b ld bc,200*256+255 cp 8 call z,vector1 ld bc,200*256+215 cp 38 call z,vector1 ld bc,200*256+165 cp 67 call z,vector1 ld bc,200*256+115 cp 36 call z,vector1 ei ld b,15 leave_x_on_loop: halt djnz leave_x_on_loop pop de pop af pop bc ld h,0 call _ILINE ld a,c ld c,e ld e,a jp _ILINE yourscore: .db "Your Score is:",0 gameover: .db "Game Over!",0 youwin: .db "YOU WIN?!?!",0 title: .db "Simon 83 1.3 by: Dulce",0 name: .db "SIMON 83 ASM",0 version: .db "V.1.3",0 author: .db "By: Dulce",0 anykey: .db "Press Clear to Continue",0 high_score: .db $00 hiscr_string: .db "High Score:",0 nhs_string: .db "New High Score",0 libs: .db "ZLIB",0,0,0,0,lib0,vec1,$FF .end