A downloadable game

PACMINE ---------------------------------------------------------------------

 BY LUIS PIERI <https: lupoman.itch.io=""></https:>

 ZX SPECTRUM BASIC to be converted using ZMakeBas

            (http://freestuff.grok.co.uk/zxtext2p/index.html)

             

 DATE      : 10-MAR-2024 TO 15-MAR-2024

 COMPO     : https://gkanold.wixsite.com/homeputerium/copy-of-rules

 DEADLINE  : March 16th, 2024

 DATA      :  Include the following in a ZIP file with your submission: 

              - The program (on disk or tape image file); 

              - a text file with the program description and instructions;

              - a short description of how to start the game using the emulator;

              - a screenshot in jpg or png format (or an animated screenshot in gif format);

              - a program listing that proves the program does not have more characters 

                than allowed for the category. 

              - For program descriptions and code explanations there can be up to 0.5 bonus points in the rating.

              - If anything is missing (image, screenshot, proof), up to 0.5 points can be deducted.

              - Contestants agree to the publication of their programs, descriptions and instructions by the Organizer.

              - Send to GKANOLD-at-GMAIL dot COM, get a confirmation by e-mail or in the 10Liner forum.

 IDEA      : You control a pacman going down in a mine, avoid the ghosts!

             Use Q or A to control the pacman

             The scroll effect is created changing only the attributes with

             LPRINT Hack! (redirecting LPRINT TO attrib RAM from

             https://blog.jafma.net/2020/08/29/efficient-basic-coding-for-the-zx-spectrum-v/#en_5)

             We create UDG as columns of 8 attribs rows to be lprinted

             We put all the udg (to be used as attrib data) in a string that is scrolled


CODE EXPLANATION --------------------------------------------------------------

  - The code below is formated to be converted with the utility ZMakeBAS.

  - Once converted the lines are much shorter in the ZX Spectrum Basic.

  - You can see the final listing loading the .TAP file on the emulator.

# LINE 1  -------------------------------------------------------------------========================================

# Seed the RND. Define all the UDG. Set the colors for the screen and clear the screen.

#

1 randomize:restore 9:FOR f=0to79:read a:poke usr"a"+f,a+(f>23)*a*(64+RND*5):next f:BRIGHT 1:PAPER 1:INK 7:BORDER 1:CLS

# LINE 2 ----------------------------------------------------------------------========================================

# Init vars and Print the title

# Var Y: Pac Y coord

# Var S: Score

# Var L: pacs left

# Var C: for animation

# Var S$: The level (a string of UDG to be treated as screen atributes)

#

2 let Y=11:let S=0:let L=3:let C=0:let S$="\d\d\d\d\d\e\e\d\d\d\f\f\d\d\d\e\e\d\d\d\g\g\d\d\d\f\f\d\d\d\e\e\d\d\d\h\h\d\d\d\j\j\d\d\d\i\i\d\d\d\h\h\d\d\d":PRINT AT 1,9;"\a PAC MINE \a"

# LINE 3 ----------------------------------------------------------------------========================================

# Print BACKGROUND

# A list of the Ghost UDG for 8 lines.

#

3 FOR F=8 TO 15:PRINT AT F,0;"\{16}\{00}\{17}\{00}\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\{17}\{07}":NEXT F

# LINE 4 -------------------------------------------------------------------========================================

# Scroll left the sections every other time

# Check for need to add another random section at the end

# Update score and print it.

#

4 let S$=S$(C+1TO):IF len S$<34 then let S$=S$+chr$ R+chr$ R+"\d\d\d":LET S=S+1:PRINT AT 6,1;"1UP:";S

# LINE 5 -------------------------------------------------------------------========================================

# LPrint section

# Use lprint attr hack (89*256 = 22784) Redirect LPRINT TO Attrib RAM area

# the ghost were printed in all the columns, and the scroll effect is created

# moving only the attrib (scrolling left)

# We poke the correct attrib where the pac is (22529+Y*32) to minimize flickering!

# Using this line also for update anim var and print Pacs left

5 POKE 23680,0:POKE 23681,89:LPRINT S$(TO32):POKE 22529+Y*32,70:LET C=NOT C: PRINT AT 6,26;"Pac:";L

# LINE 6 OK -------------------------------------------------------------------========================================

# Move pac up and down. Randomize the next section to be added at the end of the string.

# Calculate the attribute of where the pac is going to be

#

6 let O=PEEK 23560: POKE 23560,0: let P=Y: let R=147+RND*6:let Y=Y-(O=113)+(O=97):let N=PEEK(22530+Y*32)

# LINE 7 OK -------------------------------------------------------------------========================================

# Check collision (using var N calculated in the above line)

# black section is 0 (no flash, no bright, paper=ink=black)

# If collision, lose a life, make sound

# Check for game over (L<1) make sound, print Game Over go to 2 to start over

#

7 IF N<>0 THEN LET L=L-1:BEEP .5,-30:LET S$="\d\d\d\d\d"+S$(4TO):IF L<1 THEN PRINT AT 12,11;"\{16}\{06}GAME OVER":BEEP 1,-50:GOTO 2

# LINE 8 OK -------------------------------------------------------------------========================================

# Print pacman, delete previous pos

# make sound if Pac moves

8 PRINT AT Y,1;"\{16}\{06}\{17}\{00}"+CHR$(144+C):IF P<>Y THEN PRINT AT P,1;"\{16}\{00}\{17}\{00}\c\{17}\{07}":BEEP .01,O/2

# LINE 9 OK -------------------------------------------------------------------========================================

# End of loop

# UDG DATA USR "A", "B" & "C" for pac (open, close) and ghost

#

9 GO TO 4:DATA 126,255,248,224,224,248,255,126,126,255,255,255,255,255,255,126,126,255,153,153,255,255,255,219

# LINE 10 OK ------------------------------------------------------------------========================================

# UDG DATA USR "D", "E", "F", "G", "H", "I", J"  for 7 segments:

# it should be 0 or 1, then its multiply with random ink in the poke in the line 1.

# udg data sectors

#

10 DATA 1,0,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1

LOG ---------------------------------------------------------------------------

 2024-03-10: Started basic coding, UDG, explorig attrib scrolling with LPRINT.

 2024-03-11: Creating UDG, changing the orientation to horizontal

 2024-03-12: First run, debugging (UDG working)

             Keyboard movement fixed

             Drawing and deleted pac working 

             Drawing all ghosts as background

             We need to hurry only 4 days left in the contest!

             lprint hack works like a charm!! to fast? add beep?

 2024-03-13: (early)

             Add multicolor ghosts with RND

             Add RND for sections, space sections with another blank col

             Fixed some bugs

             PEND:  Add beep, add collision, move pac, to col 1??

             (late)

             Prepare lines for contest, pack code as much as possible

             Added Pac animation

             Move pac from col0 to col1

 2024-03-14: Time is running out

             Add more space between sections

             Print lives. Adjust beeps 

             Try a couple of strategies to reduce pac flickering

             Just poke the attrib with pac colors works (after lprint)

             Enabled collision, add sound to death.

             Tweak collission with front char, add GAME OVER.

             When collission occurs, clear the section.

 2024-03-15: Prep the files to submit!

-------------------------------------------------------------------------------

StatusReleased
Rating
Rated 3.0 out of 5 stars
(1 total ratings)
AuthorBASIC 10Liner
GenreAction
Tags10liner, 8-Bit, basic, sinclair, ZX Spectrum

Download

Download
pacmine.tap 1 kB
Download
pacmine.txt 8 kB

Install instructions

INSTRUCTIONS ------------------------------------------------------------------

  - Open zx Spectrum emulator (FUSE / ZX32 / SPUD, etc)

  - Menu File -> Open Tape -> Select pacmine.tap

  - Type L (LOAD Command) and shift-P twice 

  - Wait until "0/0" appears

  - If you press Enter key the listing will appear.

  - Press R for RUN command and then enter

  - You need to wait for the UDG data to be loaded

  - Then the level will scroll down and you can try to advance without touching the ghosts.

  - In the left corner, you will see the score (increases with each sector you cleared).

  - Over the Right are the lives left.

Leave a comment

Log in with itch.io to leave a comment.