home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #4
/
Commodore_Disk_User_Vol.4_4_1991_-.d64
/
ge.info
< prev
next >
Wrap
Text File
|
2022-10-26
|
9KB
|
354 lines
GALACTIC ENCOUNTER- EXTRA INFO
================================
-* By P. Makepeace *-
-* (C) Alphavite Publications *-
Machine Code Routines
-----------------------
The Machine Code uses a Jump Table
starting at $c000 (49152). The start
address of each routine is followed by
the variable which is used in the BASIC
program to run it, e.g SYS FX,1
An asterisk denotes the routine is on
the utilities section (see below). The
address below is the one used in the
utilities section.
WARNING! These routines cannot be used
from within machine code as they read
parameters from BASIC.
The Utilities Section
-----------------------
On the disk is a shortened version of
the machine code section which contains
some useful routines that could be used
in other BASIC programs. To use these,
LOAD"GE.MC UTILS",8,1. Then any of the
following can be used:
AT=49152 Print AT
SP=49155 Pulsing Sprite 1
SE=49158 Flash Sprite 1 momentarily
FX=49161 Four sounds
PU=49164 Pulse a line of text
CS=49167 'Chase Lights' effect on text
RV=49170 Reverse text
SC=49173 Scroll a message!
After defining the variables above,
the routines can be used by SYS FX,1
or whichever.
* 49152 AT,pos (0-999),string
49152
This positions the cursor at 'pos' and
prints the following string. Examples:
SYS AT,80,"Hello!"
SYS AT,120,"";
SYS AT,20,a$+"Hi.";
etc.
N.B. The version of this on the
Utilities Section requires an X,Y
[(0,0) is the top-left, (39,24) the
bottom-right] position rather than a
screen position. Otherwise, they are
the same.
* 49155 SI,speed (0-255)
49155
This turns on Sprite 1, and sets up an
IRQ at $0314 to pulse the sprite at
'speed' speed.
POKing 251,1 makes the sprite flash
black and white until POKE 251,0
$02 is used as a countdown for the
next colour change.
$FC contains the current colour of the
sprite.
This routine perfroms the necessary
bank-switching to allow the character
set at $7800 to be accessed. The screen
position must also be changed to $7400.
All this is done by:
POKE 648,116 Move screen to $7400
POKE 56576,150 Point VIC Chip to Bank1
POKE 53272,223 Point VIC Chip to:
$7400 - Screen.
$7800 - Character set.
49158 CH,X (0-6),Y (0-6),
character (0-17)
This prints one of the board
characters on to the board in the
appropriate place on the screen, the
calculations are done in MC.
The characters are:
0: Blank space
1: Blackhole
2-5: Player One ships
6: destroyer
7-10: Player Two ships
11: destroyer
12-13: Big :
14-15: Medium :Debris Cloud
16-17: Large :
49161 SP,X,Y,Flag
This moves sprite 1 to the board
postion X,Y. If Flag is 1 then the
sprite will move smoothly otherwise it
will move there directly.
*49164 SE,speed (0-255)
49158
This sets 251 to 1 for a short time
depending on the speed, then resets it
to pulsing. It also changes the sprite
pointer 2040 from 13 to 15
(EOR #2 in MC) and back again when it
is SYSed again.
*49167 FX,sound (0-3)
49161
This makes one of the following
sounds:
0: 'ding'
1: 'barp'
2: launch of the bullet
(POKE 54276,129 to finish the
sound).
3: An explosion sound
49170 B1,colour (0-15)
This prints the border around the edge
of the screen in 'colour'.
$C015 49173 B2,colour (0-15)
This prints the board in 'colour'.
*49176 PU,pos,length (0-255),speed,Flag
49164 PU,X,Y,....
This pulses a line or lines of text
starting at pos and pulsing 'length'
number of characters after it at
'speed'. If Flag is 1-255, the routine
will pulse the line ABOVE too, this is
used for underlined text. Remember to
set pos to the line below the text if
Flag is set.
*49179 CS,(see above)
49167
This is identical to 'PU'lse but the
effect is like American Police Car
lights, a sort of strobe. See the
STATUS REPORT just before a message.
49182 BL,X,Y,Flag
This is the same as 'SP'rite-move but
changes Sprite 1 to the bullet (POKE
2040,15) before moving it. Flag is
always set to 1-255 so the bullet moves
slowly.
49185 SR,speed
This is half way through SPRIRQ (SI),
which resets the sprite to 13 and sets
sprite priority LOW (it is seen behind
text). It also clears the keyboard
buffer.
49188 WP
This clears the right hand side of the
screen for use in Setup and clearing
the different menus.
*49191 RV,pos,length
49170 RV,X,Y,length
This reverses 'length' number of
characters starting at 'pos'. It is
used in Setup to move the select bar.
It reverses the characters by EORing
them with 128 so the routine will need
to be SYSed twice to get the text back
to normal.
*49194 SC,string name,pos/X,Y,length,
49173 speed,Flag
This is a very handy routine. It looks
for a string called 'string name', this
can either be 1 or 2 characters long.
It scrolls this message at 'pos'. The
length of the scroll message is
'length' and the scroll speed is
'speed'. If Flag is set, the scrolling
will stop at the end of the string,
otherwise the scrolling will continue
till the message is no longer visible.
During scrolling, pressing Space or
the joystick button will speed up
scrolling by about 8 times whereas
pressing any other key will temporarily
halt the scrolling. Moving the joystick
will also do this. The keyboard buffer
is cleared after the routine
Example: (Using the Utilities):
ZZ$="Hello there !":SC=49176
SYS SC,ZZ,1024,5,30,0
49197 EX,X,Y,speed
This makes a explosion at X,Y on the
board by printing the debris clouds
repeatedly.
49200 PB
This prints all the pieces on to the
board by looking at the integer array
BO(ard)%(0,0). This routine executes in
a fraction of a second, whereas BASIC
does it in around 20 seconds!
=======================================
BASIC Variables
-----------------
Apart from the variables used to jump
to the machine code, the main variables
used in the BASIC program are listed
below with a brief explanation of their
use:
BO%(6,6) This integer array contains
the characters on the board. 0,0 is at
the top-left.
X,Y These contain the coordinates for
BO%(X,Y). X and Y are also used in
moving the sprite using SP (see above)
BR$(0-10) These contain the
descriptions for BO%(X,Y)
e.g. PLR.1 SHIP etc.
R$(0-5) These contain the results
of firing i.e. hit, miss etc.
BR This contains BO%(X,Y)
Z This is the position for AT
MV Number of moves
M(0/1) Number of moves remaining for
Player One/Two
DH Number of hits to zap destroyer
D(0/1) Number of hits remaining for
Destoyers 1 and 2
SC$ This contains the message to be
scrolled using SYS SC,...
SL Length of scrolling message
P Current player: 0 for Pl.1
1 for Pl.2
C1,C2,C3 Counters used in FOR.NEXT
loops
P1,P2,P3 Pause lengths for Scrolling,
Select and
Explosion.
V 53248, the start of the VIC chip.
J1 56320 location for JOY Port 2
J Contents of J1 (J=PEEK(J1))
K$ Used to get keys
UP$,DO$,LE$,RI$,FI$ Keys for movement
UP 126 :
DO 125 :Values for joystick movements
LE 123 :
RI 119 :
FI 111 :
U,D,L,R,S These flags are set when J
equals any of UP,DO etc. or
K$ equals UP$,DO$ etc.
F This is a flag for when Spc/Ret is
pressed
========================================
BASIC Routines
----------------
10 Start, set up variables and
print board.
100 START, Setup option.
200 MAIN LOOP. This moves the
cursor around till a piece is
selected.
400 CHECK Check for valid selection
500 SELECT Piece selected, main
loop for moving piece.
700 FORWARD Move piece on square
forward.
900 ROTATE Rotates piece depending
on L and R flags.
1000 FIRE! This also checks to see
whether the player has no ships
if so, ends game or play again.
2000 DEBRIS diminishes debris.
2200 REDUCE TURNS Decrement M(P). If
this is zero, EN=1
2300 FIND PLAYER Used at the
beginning of each round to move
cursor on to a ship.
2500 COMMENTS Prints a description
of the piece under the cursor.
3000 SCROLL Scrolls message in SC$
at Z, SL length at P1 speed.
This also pulses STATUS REPORT
when Z=1890.
3300 KEY/JOY Gets a Key/Joystick
press/movement and sets U,D,L,R
F and S accordingly
4000 Y/N? Gets Yes/No response and
sets PO if POsitive reply.
Spc/Ret or Fire Button=Yes
6000 SETUP
7000 Load/Save/Default
7200 Load
7500 Save
7600 Default
8000 EDIT PIECES.
8700 REDEFINE KEYS
9000 PRINT BOARD and rest of screen.
10000 VARIABLES Sets up ALL variables
11000 DATA for variables.
********By P. Makepeace, Nov '89********
~
'1;eoyCMW{SHIFT-POUND}{CBM-W}{CBM-X}GQ{SHIFT-+}{$e5}{$ef}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~