title STOMP for SOL name ('GOBBLE') ; DASMed version of the SOL game STOMP - Original version ; Try to swat the flies ; Game starts at 0x0000 .phase 0000h maxrow equ 16 ; Maximale Zeilen maxcol equ 64 ; Maximale Spalten ; vidspc equ maxcol*maxrow _stmp equ 05h _crc equ 1bh _bug equ 7fh esc equ 1bh _eol equ 7bh _eot equ 7dh MSB equ 10000000b BACK equ 10000000b _maxbug equ 10 ; Number of bugs _minply equ 1 ; Min players _maxply equ 6 ; Max players _minspd equ 0 ; Min speed _maxspd equ 9 ; Max speed _dello equ 004ffh ; Low delay _delhi equ 090ffh ; High delay _delvhi equ 0ffffh ; Very high delay SOL.OS equ 0c000h ; Exit to SOL OS SOLvid equ 0cc00h ; Start of video RAM VidTop equ SOLvid+vidspc ; End of video RAM nop nop nop jp l07fc ; l0006: db 00h,'ENTER SPEED (0-9, 9=FASTEST):',_eol,_eot l0026: db 00h,'ENTER # OF PLAYERS (1-6):',_eol,_eot ; ; Reverse message: ; ; 00h,'ILLEGAL ENTRY - TRY AGAIN',_eol,_eot ; l0042: db 00h,0c9h,0cch,0cch,0c5h,0c7h,0c1h,0cch db 0a0h,0c5h,0ceh,0d4h,0d2h,0d9h,0a0h db 0adh,0a0h,0d4h,0d2h,0d9h,0a0h,0c1h db 0c7h,0c1h,0c9h,0ceh,_eol,_eot l005e: db 00h l005e.1: db 'PLAYER # ' _plyloc equ $-l005e.1 l005e.2: db ' SCORE: ' _scrloc equ $-l005e.2 db ' /10',_eol,_eot l007a: db 00h,'ANOTHER GAME? (Y OR N):',_eol,_eot ; ; Move control table ; Byte 0 : Character to display on screen ; Bytes 1,2: Move direction ; l0094: db _crc db BACK+2,0 db _bug db BACK+1,0 db _bug db 0,0 db _bug db 1,0 db '-' db 2,0 db '-' db 3,0 db '-' db 4,0 db '-' db 5,0 db '-' db 6,0 db '\' db BACK+1,BACK+1 db '|' db 0,BACK+1 db '/' db 1,BACK+1 db '/' db BACK+1,1 db '|' db 0,1 db '\' db 1,1 db '.' l00c2: db '-' db BACK+4,0 db '-' db BACK+3,0 db 'S' db BACK+2,0 db 'P' db BACK+1,0 db 'L' db 0,0 db 'A' db 1,0 db 'T' db 2,0 db '-' db 3,0 db '-' db 4,0 db '\' db BACK+2,BACK+1 db '|' db 0,BACK+1 db '/' db 2,BACK+1 db '/' db BACK+2,1 db '|' db 0,1 db '\' db 2,1 db '.' l00f0: ; Bug's coordinate db 29 ; Column db 8 ; Row l00f2: db 0 ; Selected speed l00f3: db 0 ; Selected number of players l00f4: ds _maxply ; Player score list l00fa: ; Player's coordinate db 1 ; Column db 0 ; Row ; ; Clear screen ; l00fc: ld hl,SOLvid ; Init base of video l00ff: ld (hl),' ' ; Blank screen inc hl ld a,HIGH VidTop-1 sub h jp p,l00ff ret ; ; Get random number into Accu as well as reg C ; l0109: ld hl,(l013e) ; Get pointer to random list ld a,l sub LOW l013d ; Test end of list jp z,l011d ; Yeap ld a,(hl) ; Load byte inc hl add a,(hl) ; Combine with next dec hl ld (hl),a ; Store it ld c,a ; Get into reg C, too inc hl l0119: ld (l013e),hl ; Set pointer to random list ret l011d: ld a,(l0129) ; Get first entry add a,(hl) ; Add it ld (hl),a ; Store it ld c,a ld hl,l0129 ; Set start of list jp l0119 ; l0129: db 0a1h,075h,027h,056h,092h,0eeh,04ah db 011h,083h,0b3h,06dh,0f3h,00eh,025h db 03bh,0c5h,0e2h,0c0h,0d7h,052h,0eah l013d equ $-1 ; ; Pointer to random list ; l013e: dw l0129 ; ; Get random number 1..B ; l0140: call l0109 ; Get random number ld a,c ; Get result l0144: sub b ; Truncate for max jp nc,l0144 add a,b inc a ld c,a ; Get result ret ; ; Put message ^DE to screen ^BC ; ; Message starts with offset in line ; After end of line another offset line follows ; ; Control characters: ; 0x7D : End of string ; 0x7B : End of line ; l014c: ld h,b ; Copy screen address ld l,c ld a,(de) ; Get character sub _eot ; Test end of output ret z ; Yeap ld a,(de) ; Get offset add a,l ; Position on screen jp nc,l0158 inc h ; Remember carry l0158: ld l,a l0159: inc de ld a,(de) ; Get character from current line sub _eol ; Test end of line jp nz,l016b ; Nope inc de ; Skip end of line ld a,c add a,maxcol ; Advance to next line jp nc,l0168 inc b ; Remember carry l0168: jp l07ea ; Save pointer and keep on printing l016b: ld a,(de) ; Get character ld (hl),a ; Store in video RAM inc hl jp l0159 ; ; Ask for number of players and start the game ; l0171: call l00fc ; Clear screen ld de,l0026 ld bc,SOLvid+maxcol call l014c ; Ask for number of players ld a,' '+MSB ; Set blank ld (SOLvid+maxcol+25),a l0182: call l019d ; Get character from console ld (l00f3),a ; Save number of players cp _minply+'0' ; Test less min jp nc,l01a9 ; Nope, try max l018d: call l0193 ; Tell invalid entry jp l0182 ; Try again ; ; Tell invalid entry ; l0193: ld de,l0042 ld bc,SOLvid+8*maxcol call l014c ; Tell invalid entry ret ; ; Get character from console ; l019d: call l080b ; Get input from console jp z,l019d ; Nope, wait cp esc ; Test abort jp z,SOL.OS ; Exit to SOL OS if so ret ; ; Ask for speed ; l01a9: cp _maxply+'0'+1 ; Verify max not exceeded jp nc,l018d ; Inbalid, retry call l00fc ; Clear screen ld de,l0006 ld bc,SOLvid+maxcol call l014c ; Ask for speed ld a,' '+MSB ; Set blank ld (SOLvid+maxcol+29),a l01bf: call l019d ; Get character from console ld (l00f2),a ; Save speed cp _minspd+'0' ; Verify range jp nc,l0252 ; Ok, try max l01ca: call l0193 ; Tell invalid entry jp l01bf ; Try again ; l01d0: db 0 ; Current player l01d1: db 0 ; Bug count ; ; Start the game ; l01d2: ld a,1 ld (l01d0),a ; Init current player l01d7: ld a,_maxbug ld (l01d1),a ; Init bug count ld hl,l023e ; Point to bug list l01df: ld (hl),0 ; Clear list inc hl ld a,l cp LOW l0252 jp nz,l01df ld hl,256*8+29 ld (l00f0),hl ; Init bug's coordinate ld hl,256*0+1 ld (l00fa),hl ; Init player's coordinate call l00fc ; Clear screen ld de,l026c ld bc,SOLvid call l014c ; Tell player to start ld a,(l01d0) ; Get current player add a,'0' ; Make ASCII ld (SOLvid+_plyloc),a call l019d ; Get character from console call l00fc ; Clear screen l020e: call l0326 l0211: call l080b ; Get input from console jp z,l0296 ; No key pressed cp esc ; Test abort jp z,SOL.OS ; Exit to SOL OS if so cp 'S' ; Test activate stomper jp z,l03c3 cp '1' ; Validate direction jp c,l0296 cp '9'+1 jp nc,l0296 sub '0' ; Make 1..9 ld hl,l025a-2 ; Point to table l0230: inc hl ; Position in table inc hl dec a jp nz,l0230 ld d,(hl) ; Get column direction inc hl ld e,(hl) ; Get row direction jp l04c6 ; Do the move ; l023c: dw 0 l023e: ds 2*10 ; ; *** PATCH *** ; l0252: cp _maxspd+'0'+1 ; Verify max jp nc,l01ca ; Invalid input jp l01d2 ; Start the game ; ; Direction table ; col row l025a: ; === === db BACK+1,1 ; 1: left down db 0,1 ; 2: - down db 1,1 ; 3: right down db BACK+1,0 ; 4: left - db 0,0 ; 5: - - db 1,0 ; 6: right - db BACK+1,BACK+1 ; 7: left up db 0,BACK+1 ; 8: - up db 1,BACK+1 ; 9: right up l026c: db 00h,'PLAYER # TYPE ANY LETTER TO START.',_eol,_eot,0,0,0 ; ; ; l0296:: call l0109 ; Get random number ld a,(l00f2) ; Get speed sub '0'-1 sub c ; Test within speed jp c,l0211 ; Nope jp l04dc ; ds 5 ; ; Update players's coordinate ; l02aa: ld hl,(l00fa) ; Get player's coordinate ld a,d ; Get column direction cp BACK+1 ; Test move left jp z,l02b6 ; Yeap add a,l ld l,a inc l l02b6: dec l ld a,l cp 0 jp nz,l02be inc l l02be: cp maxcol+1 jp nz,l02c4 dec l l02c4: ld a,e ; Get row direction cp BACK+1 jp z,l02cd add a,h ld h,a inc h l02cd: dec h ld a,h cp -1 jp nz,l02d5 inc h l02d5: cp maxrow jp nz,l02db dec h l02db: ld (l00fa),hl ; Set player's coordinate ret ; ; ; l02df:: ld b,9 call l0140 ; Get random number 1..9 ld a,c ld hl,l025a-2 ; Point to table l02e8: inc hl ; Position in table inc hl dec a jp nz,l02e8 ld d,(hl) ; Get column direction inc hl ld e,(hl) ; Get row direction ld hl,(l00f0) ; Get bug's coordinate ld a,d ; Get column cp BACK+1 jp z,l02fd add a,l ld l,a inc l l02fd: dec l ld a,l cp 4 jp nz,l0305 inc l l0305: cp maxcol-4-1 jp nz,l030b dec l l030b: ld a,e ; Get row cp BACK+1 jp z,l0314 add a,h ld h,a inc h l0314: dec h ld a,h cp 0 jp nz,l031c inc h l031c: cp maxrow-1 jp nz,l0322 dec h l0322: ld (l00f0),hl ; Set bug's coordinate ret ; ; ; l0326:: call l00fc ; Clear screen l0329: ld hl,l023e ; Point to bug list l032c: ld a,(hl) cp 0 ; Test free jp nz,l0362 ; Nope l0332: inc hl ; Point to next inc hl ld a,l cp LOW l0252 ; Test end of list jp nz,l032c ; Nope, keep on searching ld de,l0094 ; Init table l033d: ld a,(de) ; Get entry cp '.' ; Test end of table jp z,l0359 ; Yeap inc de ld a,(de) ; Load move control ld b,a ; Get column inc de ld a,(de) ld c,a ; Get row ld hl,(l00f0) ; Get bug's coordinate call l038a ; Calculate screen address from row (reg C) and column (reg B) dec de ; Position to entry dec de ld a,(de) ld (hl),a ; Display value inc de ; Advance to next inc de inc de jp l033d l0359: ld hl,(l00fa) ; Get player's coordinate call l039a ; Calculate screen address ld (hl),_stmp ; Set stomper ret l0362: ld (l0375),hl ; Save bug's address ld de,l00c2 l0368: ld a,(de) ; Get entry cp '.' ; Test end of table jp z,l0384 ; Yeap inc de ld a,(de) ; Load move control ld b,a ; Get column inc de ld a,(de) ld c,a ; Get row l0375 equ $+1 ld hl,($-$) ; Load bug's address call l038a ; Calculate screen address dec de ; Position to entry dec de ld a,(de) ld (hl),a ; Display value inc de ; Advance to next inc de inc de jp l0368 l0384: ld hl,(l0375) ; Get back address jp l0332 ; Loop on ; ; Calculate screen address from row (reg C) and column (reg B) ; l038a: ld a,b ; Get column cp BACK ; Test backward jp nc,l03af ; Yeap add a,l ; Add offset ld l,a l0392: ld a,c ; Get row cp BACK ; Test backward jp nc,l03b9 ; Yeap add a,h ; Add offset ld h,a l039a: ld b,h ; Save result nop ld h,HIGH SOLvid dec hl l039f: ld a,b cp 0 ; Test end reached ret z ; Yeap dec b ld a,l add a,maxcol ; Point to next line ld l,a jp nc,l039f inc h ; Remember carry jp l039f l03af: sub BACK ; Strip off offset l03b1: dec l ; Go back dec a jp nz,l03b1 jp l0392 l03b9: sub BACK ; Strip off offset l03bb: dec h ; Go back dec a jp nz,l03bb jp l039a ; ; Input 'S': Stomper activated ; l03c3: ld hl,(l00f0) ; Get bug's coordinate ex de,hl ld hl,(l00fa) ; Get player's coordinate ld a,h cp d ; Verify same row jp nz,l0402 ld a,l cp e ; Test same column jp z,l03e0 ld a,l inc a ; Test next column cp e jp z,l03e0 ld a,l dec a cp e ; Test previous column jp nz,l0402 l03e0: ld hl,l023e-2 ; Point to bug list l03e3: inc hl inc hl ld a,(hl) ; Test empty entry cp 0 jp nz,l03e3 ld (hl),e ; Save coordinate inc hl ld (hl),d ld hl,256*35+0 ld (l00fa),hl ; Set player's coordinate ld (l00f0),hl ; Set bug's coordinate ld a,(l01d0) ; Get current player nop nop ld hl,l00f4-1 ; Point to player score list add a,l ; Select current one ld l,a inc (hl) ; Advance score count l0402: call l0326 ld b,3 l0407: ld hl,_delvhi l040a: dec hl ld a,l or h jp nz,l040a ; Delay a bit dec b jp nz,l0407 ; ld hl,256*8+29 ld (l00f0),hl ; Init bug's coordinate call l04b9 ; Clear screen and reset player's coordinate ld (l00fa),hl ; Set player's coordinate ld a,(l01d1) ; Update bug count dec a ld (l01d1),a jp nz,l020e ; Still more ld a,(l01d0) ; Update current player inc a ld (l01d0),a ld b,a ld a,(l00f3) ; Get number of players sub '0' sub b ; Test still more jp nc,l01d7 ; Yeap, try next player ld a,'1' ld (l01d0),a ; Init current player l0440: ld de,l005e ; Init player message ld a,(l01d0) ; Get current player sub '0' ld hl,SOLvid ; Init status address ld b,a l044c: dec b jp z,l045b ld a,l add a,maxcol ; Advance to next player status line ld l,a jp nc,l044c inc h jp l044c l045b: ld (l023c),hl ; Save screen address ld b,h ; Copy it ld c,l call l014c ; Tell player ld hl,(l023c) ; Get back screen address ld a,l add a,_plyloc ; Build offset ld l,a ld a,(l01d0) ; Get current player ld (hl),a ; Store player ld de,l00f4-1 ; Point score list ld a,(l01d0) ; Get current player sub '0' l0476: inc de ; Advance in score list dec a jp nz,l0476 ld a,l add a,_scrloc ; Point to score call l04c0 ; Store ASCII score ld a,(l01d0) ; Update current player inc a ld (l01d0),a dec a ld b,a ld a,(l00f3) ; Get number of players cp b ; Test status ready jp nz,l0440 ; Not yet, loop on ld hl,l00f4 ; Point to score list l0494: ld (hl),0 ; Clear list inc hl ld a,l cp LOW (l00f4+_maxply) jp nz,l0494 ld de,l007a ld bc,SOLvid+7*maxcol call l014c ; Ask for another game l04a6: call l019d ; Get character from console cp 'Y' jp z,l0171 ; Ask for number of players and go cp 'N' jp z,SOL.OS ; Exit to SOL OS call l0193 ; Tell invalid entry jp l04a6 ; Get correct answer ; ; Clear screen and reset player's coordinate ; l04b9: call l00fc ; Clear screen ld hl,1 ; Reset coordinate ret ; ; Store ASCII score ; l04c0: ld l,a ; Save column jp l07ee ; If score is 10 never return l04c4: ld (hl),a ; Else save digit ret ; ; Move player ; l04c6: call l02aa ; Update players's coordinate jp l020e ; Get next input ; ; Init stomper cont'd (1) ; l04cc: ld hl,l023e ; Point to bug list l04cf: ld (hl),0 ; Clear it inc hl ld a,l cp LOW l0252 jp nz,l04cf jp l04ee ; ds 1 l04dc:: call l0109 ; Get random number ld a,(l00f2) ; Get speed sub '0'-1 sub c ; Test within speed jp c,l0211 ; Nope call l02df jp l020e ; ; Init stomper cont'd (2) ; l04ee:: ld a,0 out (0feh),a ; Reset VDM port call l00fc ; Clear screen ld hl,256*1+58 ld (l00f0),hl ; Init bug's coordinate ld hl,256*35+0 ld (l00fa),hl ; Init player's coordinate l0501: call l05a4 ld a,(l00f0) ; Get bug's column dec a ; Count down ld (l00f0),a cp 4 ; Test most left jp nz,l0501 ; Nope l0510: call l05a4 ld a,(l00f0+1) ; Get bug's row inc a ld (l00f0+1),a cp 14 jp nz,l0510 l051f: call l05a4 ld a,(l00f0) ; Get bug's column inc a ld (l00f0),a cp 29 jp nz,l051f l052e: call l05a4 ld a,(l00f0+1) ; Get bug's row dec a ld (l00f0+1),a cp 8 jp nz,l052e call l05a4 ld hl,256*35+0 ld (l00f0),hl ; Init bug's coordinate ld hl,256*8+29 ld (l023e),hl call l05a4 ld b,6 l0551: call l07e4 dec b jp nz,l0551 call l00fc ; Clear screen ld de,l05b1 ld bc,SOLvid call l014c ; Tell rules l0564: call l019d ; Get character from console cp ' ' ; Wait for blank jp nz,l0564 ld de,l023e+2 l056f: ld b,55 call l0140 ; Get random number ld a,c add a,4 ld (de),a inc de ld b,14 call l0140 ; Get random number ld a,c ld (de),a inc de ex de,hl ld (l023c),hl ; Save coordinate of player call l07e1 nop nop nop ld hl,(l023c) ; Get coordinate of player ex de,hl ld a,e cp LOW l0252 ; Test end of list jp nz,l056f ; Nope ld hl,l023e ; Re-init pointer l0598: ld (hl),0 inc hl ld a,l cp LOW l0252 jp nz,l0598 jp l0171 ; ; Delay a bit ; l05a4: call l0326 ld hl,_dello l05aa: dec hl ld a,l or h jp nz,l05aa ret ; l05b1: db 1bh,'S T O M P',_eol db 00h,_eol db 18h,'By Ray G. White',_eol db 00h,_eol db 02h,'The object is to "stomp" the bug moving on the screen by',_eol db 00h,'positioning your "stomper" (',_stmp,') over the main body of the',_eol db 00h,'bug (',_bug,_bug,_bug,'). Once done you must press the "S" key to activate the',_eol db 00h,'stomper and, (hopefully), hit the bug.',_eol db 00h,_eol db 00h,'7 8 9 The diagram on the left indicates the keys used to',_eol db 02h,'\ | / move the stomper to its respective position. At any',_eol db 00h,'4 - ',_stmp,' - 6 time you may press the escape key to exit the',_eol db 02h,'/ | \ program. Each player gets ten bugs to stomp, one at',_eol db 00h,'1 2 3 a time.',_eol db 00h,_eol db 11h,'*PRESS SPACE BAR TO CONTINUE*',_eol,_eot,_eot ; ; *** PATCH *** ; l07e1: call l0329 l07e4: ld hl,_delhi jp l05aa ; ; *** PATCH *** ; l07ea: ld c,a ; Save column jp l014c ; Keep on printing ; ; *** PATCH *** ; l07ee: ld a,(de) ; Get score add a,'0' ; Make ASCII cp '9'+1 ; Test 10 jp nz,l04c4 ; Nope, store digit ld (hl),'0' ; Store max score dec hl ld (hl),'1' ret ; ; Init stomper ; l07fc: ld hl,l00f4 ; Point to score list l07ff: ld (hl),0 ; Clear list inc hl ld a,l cp LOW (l00f4+_maxply) jp nz,l07ff jp l04cc ; ; Get input from console ; Z indicates no character available ; l080b: in a,(0fah) ; Get control cpl and 1 ; Test character pending ret z ; Nope in a,(0fch) ; Get character ret .dephase end