And these are the completed versions we have toward the 67 games rom!
How much rom room do these take? What's left that could fit into the rest of the 4K space (or 8K space if we are already over 4k) ?
SpaceWar
SW67
Code:
; Space War
; From 67/97 Games Pac 1
; converted to 41C by ??
; ported to 41C by Robert Meyer
;
; Requires SIZE 026
;
; REGISTERS
; R00 TEMP (multi)
; R01 TEMP (multi)
; R02 TEMP LRSCAN, MOVE
; R03 TEMP Scan, MOVE
; R04 UNUSED
; R05 LBL 00 - how many Alglogs/bases detected?
; R06 Energy remaining (0-1000)
; R07 Torpedos remaining (0-3)
; R08 Days remaining (0-18)
; R09 Seed for random, then Alglogs remaining
; S10 SRSCAN S0
; S11 SRSCAN S1
; S12 SRSCAN S2
; S13 SRSCAN S3
; S14 SRSCAN S4
; S15 SRSCAN S5
; S16 SRSCAN S6
; S17 SRSCAN S7
; S18 SRSCAN S8
; S19 SRSCAN S9
; A20 Alglog 1 position QQ.SS
; B21 Alglog 2 position QQ.SS
; C22 Alglog 3 position QQ.SS
; D23 Base position QQ.SS
; E24 KH position QQ.SS
; I25 Indirect (multi use)
;
; ROUTINES
; a b c d e
; STATUS DOCK START
; SRSCAN LRSCAN PHASER TORPEDO MOVE
; A B C D E
;
; LBL A SRSCAN
; LBL B LRSCAN
; LBL C PHASER
; LBL D TORPEDO
; LBL E MOVE
; LBL a STATUS
; LBL b
; LBL c
; LBL d DOCK
; LBL e START
;
; LBL 00 Forward: LBL B: check one quadrant, LBL 07: add .01 and try again, LBL 04/05/06 disp
; LBL 01 Test if Alglog will be hit by torpedo
; LBL 02 Test if Alglog hit by Phaser
; LBL 03 Scan one line
; LBL 04 OUT OF TORPEDOS
; LBL 05 OUT OF DAYS
; LBL 06 OUT OF ENERGY
; LBL 07 QyQx.SySx (QQ.SS) Test not occupied
; LBL 08 Test to see if position (X) is occupied
; LBL 09 Compute ship positions
; LBL 10 Local to A clearing registers
; LBL 11 Print SRSCAN registers (10-19)
; LBL 12 Test whether an object is in KH's quadrant (X=obj pos, Y=object)
; LBL 13 Finds angle and distance from KH to Alglog
; LBL 14 UNUSED
;
; FLAGS
; F00 Have we hit an AlgLog?
; F01
; F02 Initialize - QQ.SS occupied?
; F03
;
; Positions are QyQx.SySx, where each digit is between 0-9 inclusive
; Moves are angle, distance with
; angle 0 to +/- 180, 0 at East and +/- 180 at west
; distance specified in terms of quadrants
;
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
LBL "SPW67"
;--------------------------------------------------------------------------------
LBL e ; START
FIX 2
CLRG
X=0? ; Seed is zero?
PI ; YES - Use PI
STO 09
20
STO 25
;--------------------------------------------------
LBL 09 ; Compute a ship positions using R25
RCL 09 ; RANDOM NUMBER GENERATOR
997 ; -
* ; -
FRC ; -
STO 09 ; -
E4 ; take left 4 digits
*
INT
E2 ; make QQ.SS
/
XEQ 08 ; test if occupied
FS?C 02 ; YES
GTO 09 ; Generate again
STO IND 25 ; save it
ISG 25 ; next position
CLX ; NOP
RCL 25
25
X#Y? ; are we done
GTO 09 ; NO - do next
E3
STO 06 ; Energy
3 ; YES - continue,
STO 07 ; Save Torpedo count
STO 09 ; Number of Alglogs remaining
18 ; Save days remaining
STO 08 ;
FIX 2
RCL 24 ; display KH position (X)
RTN
;--------------------------------------------------
LBL 08 ; Test to see if position (X) is occupied
RCL 20 ; RCL Alglog 1
X=Y? ; Same?
SF 02 ; YES - SF02
CLX ; NO - disable stack lift
RCL 21 ; RCL Alglog 2
X=Y? ; Same?
SF 02 ; YES - SF02
CLX ; NO - disable stack lift
RCL 22 ; RCL Alglog 3
X=Y? ; Same?
SF 02 ; YES - SF02
CLX ; NO - disable stack lift
RCL 23 ; RCL Base
X=Y? ; Same?
SF 02 ; YES - SF02
RDN ; return position in X
RTN ;
;--------------------------------------------------------------------------------
LBL B ; LRSCAN - long range scan
4
FIX 8
999
/ ; gives 00400400 (for LRSCAN)
STO 02
ADV
RCL 24
INT
STO 00 ; Save KH QQ into R00
E1
+
XEQ 03 ; scan one line (KH QQ + 10)
RCL 00
XEQ 03 ; scan one line (KH QQ)
RCL 00
E1
-
XEQ 03 ; scan one line ( KH QQ - 10)
RTN
;--------------------------------------------------
LBL 03 ; Scans one line (i.e. 3 quadrants)
RCL 02 ; 0.00400400 - mask (4's show separation)
STO 01
RDN
STO 03 ; QQ
ST+ 01 ; make R01 = QQ.00400400
1
-
XEQ 00 ; return XY (X=number AlgLogs, Y=number bases) in quadrant
E3
/
ST+ 01 ; set XY into R01 (gives QQ.XY400400)
RCL 03 ; QQ
XEQ 00 ; return XY (X=number AlgLogs, Y=number bases) in quadrant
E5
/
ST+ 01 ; set XY it R01 (gives QQ.xy4XY400)
RCL 03
1
+
XEQ 00 ; return XY (X=number AlgLogs, Y=number bases) in quadrant
E8
/
ST+ 01 ; set XY into R01 (gives QQ.xy4xy4XY)
RCL 01 ;
VIEW X ; display one line (3 quadrants)
PSE
RTN
;--------------------------------------------------
LBL 00 ; Checks one quadrant (X) for Alglogs or Base
0
STO 05 ; how many Alglogs detected
RDN
RCL 20
INT
X=Y?
ISG 05 ; ++R05
CLX ; NOP
RCL 21
INT
X=Y?
ISG 05 ; ++R05
CLX ; NOP
RCL 22
INT
X=Y?
ISG 05 ; ++R05
CLX ; NOP
E1 ; Move Alglogs into tens positon
ST* 05
RDN
RCL 23
INT
X=Y?
ISG 05 ; add in Base if found
CLX ; NOP
RCL 05 ; Alglogs detected (times 10) + Base detected
RTN
;--------------------------------------------------------------------------------
LBL E ; MOVE (X=distance, Y=angle)
P-R ; X=xdiff, Y=ydiff
FIX 1
RND ; Round xdiff to 1 decimal place
STO 00 ; [R00]=xdiff
X<>Y ; X=ydiff, Y=xdiff
RND ; Round ydiff to 1 decimal place
FIX 2 ;
RCL 24 ; KH position QyQx.SySx X=QyQx.SySx, Y=ydiff, Z=xdiff
E1
/
STO 03 ; [R03]= Qy.QxSySx X=Qy.QxSySx, Y=ydiff, Z=xdiff
INT ; Qy X=Qy, Y=ydiff, Z=xdiff
RCL 24 ; KH position QyQx.SySx X=QyQx.SySx, Y=Qy, Z=ydiff, T=xdiff
E1
* ; X=QxQySx.Sy, Y=Qx, Z=ydiff, T=ydiff
STO 02 ; [R02]=QyQxSy.Sx
INT ; QyQxSy X=QyQxSy, Y=Qy, Z=ydiff, T=ydiff
E1
/ ; QyQx.Sy
FRC ; 0.Sy X=0.Sy, Y=Qy, Z=ydiff, T=ydiff
+ ; Qy.Sy X=Qy.Sy, Y=ydiff, Z=ydiff, T=ydiff
+ ; Qy.Sy+ydiff X=new Qy.Sy, Y=ydiff, Z=ydiff, T=ydiff
FRC ; new Sy X=new Sy
LASTX ; new Qy.Sy X=new Qy.Sy, Y=new Sy
INT ; new Qy X=new Qy, Y=new Sy
E1 ;
* ; X=Qy0, Y=new Sy
+ ; new Qy0.Sy X=new Qy0.Sy0
RCL 02 ; QyQxSy.Sx X=QyQxSy.Sx, Y=new Qy0.Sy0
FRC ; 0.Sx X=0.Sx, Y=new Qy0.Sy0
RCL 03 ; Qy.QxSySx
FRC ; 0.QxSySx
E1 ;
* ; Qx.SySx
INT ; Qx X=Qx, Y=0.Sx, Z=new Qy0.Sy0
+ ; Qx.Sx X=Qx.Sx, Y=new Qy0.Sy0
RCL 00 ; xdiff X=xdiff, Y=Qx.Sx, Z=new Qy0.Sy0
+ ; Qx.Sx+xdiff X=new Qx.Sx, Y=new Qy0.Sy0
INT ; Qx X=Qx, Y=new Qy0.Sy0
LASTX ; new Qx.Sx X=Qx.Sx, Y=Qx, Z=new Qy0.Sy0
FRC ; 0.Sx X=Sx, Y=Qx, Z=new Qy0.Sy0
E1 ;
/ ; 0.0Sx X=0.0Sx, Y=Qx, Z=new Qy0.Sy0
+ ; new Qx.0Sx X=new Qx.0Sx. Y=new Qy0.Sy0
;--------------------------------------------------------------------------------
LBL 07 ; X=Qx.0Sx, Y=Qy0.Sy0 Test not occupied
+ ; X=new QyQx.SySx
XEQ 08 ; Test if occupied
FS?C 02 ; YES: GTO 00 - increment sector and try again
GTO 00
STO 24 ; Save new KH position
1
ST- 08 ; subtract a day
RCL 08
X<0? ; have we used all our days?
GTO 05 ; YES: display end
RCL 24 ; NO: return new KH position
RTN
;--------------------------------------------------------------------------------
LBL 00 ; Position occupied - add 0.1 and try again
.1 ; BUG: This could cause new position to go off grid!
GTO 07
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
LBL A ; SRSCAN - short range scan
FIX 9
ADV
;--------------------
19.009
STO 25
0
LBL 10 ; LOOP scan registers
STO IND 25 ; zero out R IND 25
DSE 25
GTO 10 ; NEXT scan register
;--------------------
3
RCL 24
XEQ 12 ; Test whether an object is in KH's quadrant
4
RCL 20
XEQ 12 ; Test whether Alglog1 is in KH's quadrant
4
RCL 21
XEQ 12 ; Test whether Alglog2 is in KH's quadrant
4
RCL 22
XEQ 12 ; Test whether Alglog3 is in KH's quadrant
7
RCL 23
XEQ 12 ; Test whether a base is in KH's quadrant
;--------------------
19.009
STO 25
LBL 11 ; Print R19-R10
RCL IND 25
VIEW X
PSE
DSE 25
GTO 11
RTN
;------------------------------
LBL 12 ; Test whether an objectc is in KH's quadrant
ENTER ; X=pos, Y= object (3=KH, 4=AlgLog, 7=base)
INT
RCL 24 ; KH Pos
INT
X#Y? ; Are object and KH in same Q?
RTN ; NO: return
RDN
RDN
FRC ; object SS
E1
*
INT
STO 25 ; which Sy for object
CLX
LASTX
FRC ; 0.Sx
E1
ST+ 25 ; since registers are 10-19, need to add 10 to sector to get register
*
CHS ; Sx
10^X ; put a 1 in the correct Sx position
* ; multiply by object
ST+ IND 25 ; store + into the srscan for that Sy
RTN
;--------------------------------------------------------------------------------
LBL D ; TORPEDO (can only hit one Alglog)
CF 00 ; Clear flag specifying a hit
STO 00 ; Save angle for firing
RCL 07 ; torpedos remaining
1
X>Y? ; Do we have at least one left?
GTO 04 ; NO: out of torpedos
-
STO 07 ; decrement torpedos by 1
19
STO 25 ; beginning value for indirect (increments first)
XEQ 01 ; Check Alglog 1
XEQ 01 ; Check Alglog 2
XEQ 01 ; Check Alglog 3
RCL 09 ; Number of Alglogs remaining
CF 00
RTN
;--------------------------------------------------
LBL 01 ; Test if Alglog will be hit by torpedo
ISG 25 ; which Alglog (20,21,22)
CLX ; NOP
FS? 00 ; already hit one?
RTN ; YES: return
RCL IND 25 ; Get Alglog position QQ.SS
INT
RCL 24 ; Get KH position QQ.SS
INT
X#Y? ; are Alglog and KH in different quadrants?
RTN ; YES: RETURN
XEQ 13 ; Find angle and distance from KH to Alglog
CLX ; ignore the distance
RCL 00 ; user specified angle for firing torpedo
-
ABS ; |angle diff|
1
X<=Y? ; Is the angle > 1?
RTN ; YES: return (no hit)
SF 00
CHS ; -1
STO IND 25 ; STO -1 in Alglog position
ST+ 09 ; decrement Alglogs remaining
RTN
;--------------------------------------------------
LBL 13 ; Finds angle and distance from KH to Alglog
RCL IND 25 ; Get Alglog position QQ.SS
FRC ; 0.SySx
E1
*
STO 01 ; Sy.Sx
INT ; Alglog Sy
RCL 24 ; Get KH position QQ.SS
FRC ; 0.SySx
E1
*
INT ; KH Sy
- ; ydiff (sector)
RCL 01 ; Alglog Sy.Sx
FRC ; Alglog 0.Sx
RCL 24 ; KH QQ.SS
E1
*
FRC ; KH 0.Sx
- ; 0.xdiff (sector)
E1
* ; X=xdiff, Y=ydiff
R-P ; X=distance, Y=angle
RTN
;--------------------------------------------------------------------------------
LBL C ; PHASER (can hit multiple Alglogs)
STO 00 ; Store phaser energy
ST- 06 ; subtract from KH energy
19
STO 25 ; beginning value for indirect (incrments first)
XEQ 02 ; Check Alglog 1
XEQ 02 ; Check Alglog 2
XEQ 02 ; Check Alglog 3
RCL 09 ; Number of Alglogs remaining
RTN
;--------------------------------------------------------------------------------
LBL 02 ; Test if Alglog hit by phaser
RCL 06 ; Energy
X<0? ; out of enegy?
GTO 06 ; YES: Ran out of energy!
ISG 25 ; increment Alglog
CLX ; NOP
RCL IND 25 ; Get Alglog Pos QQ.SS
INT ; Alglog QQ
RCL 24 ; Get KH Pos QQ.SS
INT ; KH QQ
X#Y? ; are Alglog and KH in different quadrants?
RTN ; YES: RETURN
E2
ST- 06 ; NO: take another 100 energy (from Alglog phasers?)
XEQ 13 ; Finds angle and distance from KH to Alglog
X^2 ; square of distance
E2 ;
+ ; distance squared + 100
RCL 00 ; phaser energy
X<=Y? ; is phaser energy < (distance squared + 100)?
RTN ; YES: miss, so RETURN
1
CHS
STO IND 25 ; set Alglog pos to -1
ST+ 09 ; decrement Alglogs remaining
RTN
;--------------------------------------------------------------------------------
LBL 04 ; Out of Torpedos
XEQ 00
>"TRPDO"
PROMPT
LBL 05 ; Ran out of days
XEQ 00
>"DAYS"
PROMPT
LBL 06 ; Ran out of energy
XEQ 00
>"ENRGY"
PROMPT
LBL 00
"OUT OF "
RTN
;--------------------------------------------------------------------------------
LBL d ; DOCK
RCL 23 ; Get Base Pos QQ.SS
INT ; Base QQ
RCL 24 ; Get KH Pos QQ.SS
INT ; KH QQ
X#Y? ; are they in the same quadrant?
GTO a ; NO: just display status
RCL 23 ; Base QQ.SS
FRC ; Base SS
E1
*
STO 00 ; Base Sy.Sx
INT ; Base Sy
RCL 24 ; KH QQ.SS
FRC ; KH SS
E1
* ;
STO 01 ; KH Sy.Sx
INT ; KH Sy
- ; ydiff
ABS ; |ydiff|
2 ;
X<=Y? ; are they withing +/- 1 y sector?
GTO a ; NO: just display status
RCL 00 ; Base Sy.Sx
FRC ; Base 0.Sx
E1
* ; Base Sx
RCL 01 ; KH Sy.Sx
FRC
E1
* ; KH Sx
- ; xdiff
ABS ; |xdiff|
2
X<=Y? ; are they within +/- 1 x sector?
GTO a ; NO: just display status
E3 ; YES: Successful DOCK
STO 06 ; replenish energy to 1000
3
STO 07 ; replenish torpedos to 3
;fall through to display status
;--------------------------------------------------------------------------------
LBL a ; STATUS - Display old energy and torpedoes
FIX 0
CF 29
"D:"
ARCL 08
>" E:"
ARCL 06
>" T:"
ARCL 07
AVIEW
FIX 2
SF 29
RCL 24 ; leave KH position in X
RTN
StarTrek
ST67
Code:
; Star Trek
; From 67/97 contributors library (#3398D) by John Nelson,
; ported to 41C by Robert Meyer
;
; Requires SIZE 013
;
; Ship values XX.YYZZZQQ where
; XX.YY = grid coordinates
; ZZZ.QQQ = cumulative damage
;
; REGISTERS
; R00 Sensor range (25)
; R01 Enemy 1 Ship
; R02 Enemy 2 Ship
; R03 Enemy 3 Ship
; R04 Enterprise Ship
; R05 Hit to sheild during attack
; R06 Enterprise Sheild Energy
; R07 Seed for random number generation
; R08 Enterprise Energy
; R09 Indirect (ship) pointer
; R10 100 Constant
; R11 TEMP distance to attacking ship, or ships YY, or warp bearing
; R12 TEMP warp amount, or phaser strength
;
; ROUTINES
; LBL A START (generate ships, etc)
; LBL B SCAN
; LBL C WARP (x=warp, y=bearing)
; LBL D SHEILDS (x=amount)
; LBL E ATTACK (x=ship)
; LBL a accumulate damage to enterprise
; LBL b SHOW DAMAGE (x=ship)
; LBL c REPAIR/DAMAGE (x=amount negative for repair), uses R09
; LBL d Isolate cumulative damage ZZZ.QQQ value
; LBL e SHIP DESTROYED (ship# in R09)
; LBL 00 END & DISPLAY - show Enterprise coords
; LBL 01 Use Energy (for warp uses F02, or for Shields)
; LBL 02 Get ships (R09) bearing (Y) and distance (X) from ent
; LBL 03 Sub for attack: reduce hit amount by sheild amt
; LBL 04 local to LBL 01
; LBL 05 local to LBL B
; LBL 06 local to LBL B
; LBL 07 Separate XX.YY into x=YY and y=XX
; LBL 08 RANDOM - return next random number
; LBL 09 local to A
; LBL 10 display damage
; LBL 11 Ship X is dead
;
;--------------------------------------------------
LBL "ST67"
LBL A ; START: Set seed, and generate ships
FIX 02
STO 07 ; Store Seed
2 E4
STO 08 ; Set starting energy to 20000 units
E2
STO 10 ; Save 100 as constant (byte savings)
4
STO 09 ; start with Enterprise to generate positions
/
STO 00 ; sensor range (25) as a constant
0
STO 05 ; Set damage to zero
STO 06 ; Set shields to zero
LBL 09 ; LOOP: generate ship positions
XEQ 08 ; Get random number
RCL 10
*
RND ; requires fix 02 - otherwise, numbers are in damage position
STO IND 09 ; Store ship position
DSE 09 ;
GTO 09 ; NEXT ship
;--------------------------------------------------
LBL 00 ; END DISPLAY; show Enterprise coords
FIX 02
"POS="
ARCL 04
PROMPT
;--------------------------------------------------
LBL 08 ; Get next random number
RCL 07
ATAN
FRC
STO 07
RTN
;--------------------------------------------------
LBL B ; SCAN:
3 ; Starting enemy ship
STO 09
LBL 06 ; LOOP: enemy ships
XEQ 02 ; get ships distance and bearing
X<0? ; distance < 0
GTO 05 ; YES - ship is dead, so next ship
RCL 00 ; sensor range
X<=Y? ; Is it within sensor range?
GTO 05 ; NO - next ship
RDN ; YES
CLA
FIX 0
CF 29
ARCL 09 ; ship #
>": d"
ARCL X ; distance
>" \0D" ; angle sign
ARCL Y ; bearing
AVIEW
PSE
PSE
FIX 2
SF 29
XEQ 08 ; Get random number (between 0 and 1)
LASTX ; atan of that random number (between 0 and 45)
ST+ 05 ; random hit on enterprise for each in range ship
LBL 05
DSE 09
GTO 06 ; NEXT enemy ship
XEQ a ; accumulate total damage to enterprise
GTO 00 ; Display Enterprise coords, STOP
;--------------------------------------------------
LBL 07 ; Separate XX.YY into XX and YY
INT
LASTX
FRC
RCL 10
*
INT
RTN
;--------------------------------------------------
LBL C ; WARP: X=warp, Y=bearing
STO 12 ; requested warp
X<>Y
STO 11 ; bearing
8
RCL 10
RCL 04
XEQ d ; Isolate ZZZ.QQQ cumulative damage
-
% ; calc maximum warp (8*(100-Dmg))/100
RCL 12
X>Y?
X<>Y ; use max warp
10
* ; distance moved is 10 * warp
STO 12 ; save distance
X^2
XEQ 01 ; Use energy
RCL 11 ; bearing
RCL 12 ; distance
P-R ; convert to rect delta
INT
ST+ 04 ; Add delta to XX
X<>Y
INT
RCL 10
/
ST+ 04 ; Add delta to YY
GTO 00 ; Display new Enterprise coords, STOP
;--------------------------------------------------
LBL 01 ; USE ENERGY (for warp or attack)
SF 02
;--------------------------------------------------
LBL D ; SHIELDS: add X to sheilds, subtract from energy
RCL 08 ; get energy
X<>Y
X<=Y? ; Are we out of energy?
GTO 04 ; NO
"ENERGY=0"
PROMPT ; ALL DONE
LBL 04 ; We have enough energy, so use it
ST- 08 ; Reduce energy
FS?C 02 ; Are we warping or attacking?
RTN ; YES, return
ST+ 06 ; NO, Add to sheilds
"SHLDS="
ARCL 06
PROMPT
;--------------------------------------------------
LBL E ; ATTACK: X= ship #
STO 09 ; Ship#
XEQ 02 ; Get ships bearing/dist from enterprise
X<0? ;
GTO 11 ; Ship is already dead
STO 11 ; Save off distance
RCL 06 ; Get Enterprise Sheild amount
RCL 10 ; Constant 100
RCL IND 09 ; Ship value
XEQ d ; Isolate cumulative damage (ship) ZZZ.QQQ
- ; 100-cum damage
XEQ 08 ; get random number
* ;
X>Y? ; Is hit greater than enterprise shields?
XEQ 03 ; reduce energy by hit, and then reduce hit by shields
ST- 06 ; hit on Enterprise shields
STO 05 ; save hit on our shields for later (lbl a)
"SHLDS="
ARCL 06
AVIEW
PSE
PSE
"PWR?"
PROMPT
STO 12 ; save phaser strength to temp
RCL 00
2
/ ; half sensor range
RCL 11 ; distance to ship
X>Y? ; if distance greater than half sensor, stop
GTO 00 ; Display Enterprise coords, STOP
X^2 ; square of distance
RCL 12 ; phaser strength
*
XEQ 01 ; Use energy
XEQ 08 ; get random number
RCL 10 ; 100 constant
*
RCL 11 ; distance
SQRT
/
XEQ c ; damage ship
XEQ a ; damage enterprise
GTO 00 ; Display Enterprise coords, STOP
;--------------------------------------------------
LBL 03 ; Here, hit is > sheilds, so reduce hit by shields
XEQ 01 ; Reduce energy by hit amount
R^ ; x=shields, y=hit
- ; reduce hit by shield amount (hit=hit-shields)
SF 03 ; indicate shields didn't hold (tested later in lbl a)
RTN
;--------------------------------------------------
LBL 02 ; Get ships (R09) bearing and distance from ent
RCL IND 09 ; enemy ship
X<0? ; is ship dead
RTN ; YES: return a negative distance
XEQ 07 ; Separate XX and YY
STO 11 ; save ships YY for later
RDN
RCL 04 ; enterprise coords
XEQ 07 ; separate XX and YY
RCL 11 ; Ships YY
X<>Y ;
- ; gives YY diff
RDN ;
- ; gives XX diff
RCL Z ; x=YYdiff, y=XXdiff
X<>Y ; x=XXdiff, y=YYdiff
R-P ; Distance/Bearing between two ships
RTN
;--------------------------------------------------
LBL e ; SHIP (R09) DESTROYED
RCL 09
CHS
STO IND 09
LBL 11
CLA
FIX 0
CF 29
ARCL 09
>": IS DEAD"
FIX 2
SF 29
PROMPT
;--------------------------------------------------
LBL b ; DISPLAY CUMULATIVE DAMAGE: X = ship#
STO 09
RCL IND 09 ; Get XX.YYZZZQQQ
XEQ d
XEQ 10
RTN
;--------------------------------------------------
LBL d ; Isolate cumulative damage value
RCL 10
*
FRC ; shift off coords
E3
* ; GET ZZZ.QQQ
RTN
;--------------------------------------------------
LBL a ; HIT on enterprise
RCL 05 ; sheild hit
X=0?
RTN
ST- 05 ; zero out R05
4
STO 09 ; Select Enterprise for damage
FS?C 03 ; Did sheilds fail
1/X ; yes, so multiply hit by 4
/ ; else divide by 4
;--------------------------------------------------
LBL c ; (+)DAMAGE/(-)REPAIR: ship# in R09, X=amount
XEQ 10
PSE
PSE
RCL IND 09
XEQ d ; Get cumulative damage
+
RCL 10 ; max damage (100)
X<=Y?
GTO e ; ship destroyed
RDN
E5
/
RCL IND 09
FIX 2
RND ; Clear out old damage
+ ; add in new total
STO IND 09 ; save back to ship
RTN
;--------------------------------------------------
LBL 10 ; display damage ship (R09), x=damage
CLA
FIX 0
CF 29
ARCL 09
>": DMG="
SF 29
FIX 2
ARCL X
AVIEW
TicTacToe
TTT
Code:
01 LBL "TTT"
02 LBL A
03 CLX
04 STO 00
05 STO 01
06 SF 05
07 SF 27
08 2
09 LBL 13
10 STO 02
11 1
12 ST+ 00
13 XEQ 10
14 LBL C
15 E6
16 XEQ 11
17 E3
18 XEQ 11
19 1
20 XEQ 11
21 ADV
22 RCL 02
23 RCL 01
24 +
25 FIX 09
26 CLD
27 STOP
28 LBL B
29 STO 02
30 2
31 XEQ 10
32 FS?C 05
33 GTO 12
34 RCL 02
35 XEQ 14
36 X=Y?
37 XEQ 14
38 GTO 13
39 LBL 12
40 XEQ IND 02
41 STO 03
42 XEQ 14
43 GTO 13
44 LBL 14
45 RCL 03
46 FRC
47 10
48 *
49 STO 03
50 INT
51 RTN
52 LBL 10
53 RCL 02
54 10^X
55 /
56 ST+ 01
57 RTN
58 LBL 11
59 FIX 03
60 RCL 01
61 *
62 FRC
63 RCL 00
64 +
65 CLD
66 VIEW X
67 PSE
68 RTN
69 LBL 01
70 .5873649
71 RTN
72 LBL 03
73 .5891467
74 RTN
75 LBL 04
76 .13598
77 RTN
78 LBL 05
79 .1374698
80 RTN
81 LBL 06
82 .31578
83 RTN
84 LBL 07
85 .13589
86 RTN
87 LBL 08
88 .3175964
89 RTN
90 LBL 09
91 .31587
92 END
Artilery
Artilery
Code:
01 LBL "ARTL"
02 LBL a
03 DEG
04 FIX 02
05 SF 27
06 PI
07 "SEED?"
08 PROMPT
09 STO 00
10 500
11 STO 08
12 3
13 STO 09
14 E2
15 STO 10
16 CLST
17 RTN
18 LBL A
19 ADV
20 CLX
21 STO 05
22 5 E3
23 ENTER
24 XEQ 00
25 +
26 360
27 XEQ 00
28 STO 07
29 R^
30 P-R
31 STO 01
32 X<>Y
33 STO 02
34 45
35 ST/ 07
36 RCL 07
37 FIX 00
38 RND
39 *
40 RTN
41 LBL C
42 RCL 02
43 RCL 01
44 R-P
45 E4
46 /
47 X<>Y
48 360
49 MOD
50 FIX 00
51 RND
52 +
53 FIX 04
54 RTN
55 LBL b
56 STO 08
57 RTN
58 LBL c
59 STO 09
60 RTN
61 LBL d
62 STO 10
63 RTN
64 LBL E
65 ISG 05
66 DEG
67 FIX 01
68 "BRNG: "
69 ARCL Y
70 AVIEW
71 PSE
72 "ELEV: "
73 ARCL X
74 AVIEW
75 PSE
76 CLD
77 ENTER
78 +
79 SIN
80 E4
81 *
82 P-R
83 STO 03
84 X<>Y
85 STO 04
86 RCL 01
87 XEQ 01
88 STO 01
89 RCL 02
90 XEQ 01
91 STO 02
92 CHS
93 RCL 04
94 +
95 RCL 03
96 RCL 01
97 -
98 R-P
99 STO 06
100 RCL 10
101 X<>Y
102 X>Y?
103 GTO 07
104 "*KILL*"
105 AVIEW
106 PSE
107 PSE
108 FIX 01
109 "DIST: "
110 ARCL X
111 AVIEW
112 ADV
113 RTN
114 LBL 01
115 RCL 08
116 XEQ 00
117 R^
118 SIGN
119 *
120 -
121 RTN
122 LBL 07
123 RDN
124 RDN
125 RCL 02
126 RCL 01
127 R-P
128 500
129 X>Y?
130 GTO 08
131 RDN
132 RDN
133 -
134 30
135 /
136 4
137 RCL 09
138 -
139 XEQ 09
140 LBL 05
141 12
142 MOD
143 FIX 00
144 RND
145 STO 07
146 RCL 06
147 .2
148 ENTER
149 4
150 RCL 09
151 -
152 *
153 *
154 X=0?
155 GTO 03
156 XEQ 09
157 RCL 10
158 LBL 03
159 X<=Y?
160 X<>Y
161 E4
162 /
163 FIX 03
164 RND
165 RCL 07
166 +
167 FIX 04
168 VIEW X
169 ADV
170 RTN
171 LBL 08
172 X<>Y
173 "TARGET CLOSE"
174 AVIEW
175 PSE
176 PSE
177 "+DESTROYED+"
178 AVIEW
179 ADV
180 RTN
181 LBL 09
182 -
183 LASTX
184 ENTER
185 +
186 XEQ 00
187 +
188 RTN
189 LBL 00
190 RCL 00
191 PI
192 +
193 X^2
194 FRC
195 STO 00
196 *
197 END
JiveTurkey
JT
Code:
01 LBL "JT"
02 FIX 00
03 SF 27
04 "JIVE TURKEY"
05 PROMPT
06 LBL A
07 STO 03
08 STO 00
09 ST- 00
10 RTN
11 LBL B
12 STO 02
13 XEQ 01
14 STO 01
15 LBL D
16 RCL 00
17 RTN
18 LBL C
19 ISG 00
20 ENTER
21 RCL 01
22 X=Y?
23 GTO D
24 -
25 SIGN
26 XEQ 01
27 -
28 SIGN
29 *
30 RTN
31 LBL 01
32 RCL 03
33 RCL 02
34 PI
35 +
36 X^2
37 FRC
38 STO 02
39 E2
40 *
41 INT
42 END
Lander
Lander
Code:
01 LBL "ML"
02 FIX 04
03 SF 27
04 "MOON LANDER"
05 PROMPT
06 LBL A
07 500
08 STO 01
09 -50
10 STO 02
11 60
12 STO 03
13 LBL 09
14 RCL 01
15 1 E4
16 /
17 RCL 02
18 ABS
19 +
20 RCL 02
21 SIGN
22 *
23 FIX 04
24 PSE
25 PSE
26 FIX 00
27 RCL 03
28 PSE
29 3
30 PSE
31 2
32 PSE
33 1
34 PSE
35 0
36 PSE
37 LBL 05
38 RCL 03
39 X<>Y
40 X>Y?
41 GTO 02
42 ST- 03
43 2
44 *
45 5
46 -
47 STO 04
48 2
49 /
50 RCL 01
51 +
52 RCL 02
53 +
54 RCL 04
55 ST+ 02
56 RDN
57 STO 01
58 INT
59 X>0?
60 GTO 09
61 LBL 03
62 FIX 00
63 RCL 02
64 LBL 04
65 PSE
66 GTO 04
67 LBL 02
68 RCL 03
69 2.5
70 -
71 ST+ 01
72 2
73 *
74 ST+ 02
75 RCL 01
76 10
77 *
78 RCL 02
79 X^2
80 +
81 SQRT
82 CHS
83 GTO 04
84 LBL B
85 5
86 ST- 03
87 0
88 GTO 05
89 END
One Arm Bandit
OAB
Code:
01 LBL "OB"
02 SF 27
03 FIX 02
04 "BANDIT"
05 PROMPT
06 LBL E
07 FIX 09
08 RCL 00
09 X=0?
10 RTN
11 FIX 00
12 1
13 ST- 00
14 RCL 05
15 FS?C 01
16 GTO 04
17 XEQ 02
18 RCL 04
19 X^2
20 *
21 LBL 04
22 STO 05
23 STO 03
24 RCL 06
25 FS?C 02
26 GTO 05
27 XEQ 02
28 RCL 04
29 *
30 LBL 05
31 STO 06
32 ST+ 03
33 RCL 07
34 FC?C 03
35 XEQ 02
36 STO 07
37 ST+ 03
38 RCL 03
39 FC?C 00
40 RTN
41 PSE
42 RCL 04
43 X^2
44 /
45 FRC
46 .11
47 /
48 FRC
49 X#0?
50 GTO 09
51 LASTX
52 ST+ 00
53 RCL 03
54 111
55 /
56 FRC
57 X#0?
58 GTO 01
59 LASTX
60 ST+ 00
61 GTO 01
62 LBL 09
63 RCL 03
64 123
65 /
66 FRC
67 X#0?
68 GTO 01
69 LASTX
70 4
71 *
72 ST+ 00
73 LBL 01
74 RCL 00
75 CHS
76 RTN
77 LBL A
78 SF 00
79 SF 01
80 RTN
81 LBL B
82 SF 00
83 SF 02
84 RTN
85 LBL c
86 SF 01
87 SF 02
88 LBL C
89 SF 00
90 SF 03
91 RTN
92 LBL 02
93 RCL 01
94 PI
95 +
96 X^2
97 FRC
98 STO 01
99 9
100 *
101 INT
102 1
103 +
104 RTN
105 LBL D
106 ST- 02
107 4
108 *
109 INT
110 ST+ 00
111 RCL 00
112 CHS
113 FIX 00
114 RTN
115 LBL d
116 RCL 00
117 4
118 /
119 RCL 02
120 +
121 FIX 02
122 RTN
123 LBL e
124 STO 01
125 10
126 STO 04
127 CLX
128 STO 00
129 STO 02
130 LBL b
131 CF 00
132 CF 01
133 CF 02
134 CF 03
135 END
Chess
Chess
Note: Line 244 below should be deleted before being put into a rom
Code:
01 LBL "CH"
02 FIX 01
03 CF 02
04 SF 27
05 XEQ 14
06 "CHESS"
07 PROMPT
08 LBL A
09 FIX 01
10 0
11 STO 25
12 RCL 00
13 XEQ 02
14 RCL 01
15 XEQ 07
16 INT
17 6
18 X=Y?
19 GTO C
20 RCL 02
21 XEQ 07
22 FRC
23 RCL 24
24 X=Y?
25 GTO D
26 RCL 03
27 XEQ 02
28 26
29 X!=Y?
30 GTO 00
31 RCL 04
32 LBL 08
33 XEQ 02
34 RCL 05
35 LBL 09
36 CHS
37 FIX 09
38 ISG 25
39 ENTER
40 RCL 25
41 E7
42 /
43 -
44 RTN
45 LBL 00
46 XEQ 06
47 X!=Y?
48 GTO 00
49 RCL 06
50 XEQ 02
51 GTO 05
52 LBL 00
53 XEQ 06
54 X!=Y?
55 GTO 00
56 RCL 06
57 CHS
58 XEQ 02
59 56
60 X!=Y?
61 GTO 05
62 RCL 08
63 GTO 09
64 LBL 00
65 XEQ 06
66 X!=Y?
67 GTO 00
68 RCL 10
69 XEQ 02
70 LBL 04
71 RCL 04
72 GTO 09
73 LBL 00
74 RDN
75 15
76 X!=Y?
77 GTO 00
78 RCL 11
79 GTO 08
80 LBL 00
81 RCL 12
82 GTO 08
83 LBL D
84 RCL 13
85 XEQ 02
86 18
87 X!=Y?
88 GTO 00
89 RCL 09
90 CHS
91 GTO 03
92 LBL 00
93 XEQ 06
94 X!=Y?
95 GTO 00
96 RCL 15
97 GTO 03
98 LBL 00
99 XEQ 06
100 X!=Y?
101 GTO 04
102 RCL 09
103 XEQ 02
104 28
105 X!=Y?
106 GTO 04
107 RCL 02
108 GTO 09
109 LBL C
110 RCL 04
111 XEQ 07
112 FRC
113 RCL 24
114 X=Y?
115 GTO B
116 RCL 03
117 XEQ 02
118 66
119 X!=Y?
120 GTO 00
121 RCL 16
122 XEQ 02
123 LBL 05
124 RCL 07
125 GTO 09
126 LBL 00
127 XEQ 06
128 X!=Y?
129 GTO 00
130 RCL 17
131 GTO 08
132 LBL 00
133 RDN
134 X>0?
135 GTO 00
136 RCL 19
137 GTO 09
138 LBL 00
139 RCL 18
140 GTO 08
141 LBL B
142 RCL 20
143 XEQ 02
144 68
145 X!=Y?
146 GTO 00
147 RCL 21
148 GTO 03
149 LBL 00
150 XEQ 06
151 X!=Y?
152 GTO 00
153 RCL 22
154 CHS
155 XEQ 02
156 68
157 X=Y?
158 GTO 05
159 RCL 21
160 GTO 09
161 LBL 00
162 RCL 21
163 CHS
164 LBL 03
165 XEQ 02
166 RCL 02
167 GTO 09
168 LBL 06
169 RCL 23
170 +
171 RTN
172 LBL 07
173 XEQ 02
174 RCL 23
175 /
176 RTN
177 LBL 02
178 X<0?
179 SF 02
180 ABS
181 ISG 25
182 ENTER
183 RCL 25
184 RCL 23
185 /
186 +
187 FS?C 02
188 CHS
189 STOP
190 RTN
191 LBL 14
192 164
193 STO 00
194 524
195 STO 01
196 527
197 STO 02
198 154
199 STO 03
200 557
201 STO 04
202 525
203 STO 05
204 3634
205 STO 06
206 537
207 STO 07
208 155
209 STO 08
210 336
211 STO 09
212 3525
213 STO 10
214 5527
215 STO 11
216 565
217 STO 12
218 325
219 STO 13
220 0
221 STO 14
222 346
223 STO 15
224 3534
225 STO 16
226 567
227 STO 17
228 5627
229 STO 18
230 353
231 STO 19
232 1523
233 STO 20
234 322
235 STO 21
236 334
237 STO 22
238 10
239 STO 23
240 .8
241 STO 24
242 0
243 STO 25
244 RTN
245 END
BlackJack
BJack
Note: Line 231 below should be deleted before being put into a rom
Code:
01 LBL "BJ"
02 CF 00
03 CF 01
04 CF 02
05 SF 27
06 FIX 00
07 "BLACKJACK"
08 PROMPT
09 LBL A
10 RCL 08
11 ABS
12 STO 08
13 9
14 STO 25
15 CF 00
16 CF 01
17 XEQ 00
18 ISG 25
19 ENTER
20 STO IND 25
21 STO 00
22 STO 02
23 FS?C 22
24 SF 00
25 XEQ 00
26 STO 04
27 STO 06
28 FS?C 02
29 SF 01
30 XEQ 00
31 ISG 25
32 ENTER
33 STO IND 25
34 STO 01
35 ST+ 02
36 FS?C 02
37 SF 00
38 XEQ 00
39 STO 05
40 ST+ 06
41 FS?C 02
42 SF 01
43 RCL 06
44 FS? 01
45 XEQ 07
46 STO 07
47 X=Y?
48 SF 02
49 FIX 00
50 RCL 00
51 PSE
52 RCL 01
53 PSE
54 RCL 02
55 VIEW X
56 PSE
57 PSE
58 PSE
59 CLD
60 RCL 04
61 CHS
62 FS?C 02
63 FS?C 02
64 RTN
65 PSE
66 GTO C
67 LBL 00
68 10
69 RCL 24
70 PI
71 -
72 X^2
73 FRC
74 STO 24
75 13
76 *
77 INT
78 X=0?
79 SF 02
80 1
81 +
82 X>Y?
83 RDN
84 RTN
85 LBL B
86 XEQ 00
87 ISG 25
88 ENTER
89 STO IND 25
90 STO 00
91 ST+ 02
92 FS?C 02
93 SF 00
94 21
95 RCL 02
96 X>Y?
97 GTO 02
98 FIX 00
99 RCL 00
100 PSE
101 LBL 01
102 RCL 02
103 VIEW X
104 PSE
105 PSE
106 PSE
107 CLD
108 RTN
109 LBL 02
110 CHS
111 STO 07
112 RCL 00
113 CHS
114 STO 05
115 GTO 05
116 LBL C
117 RCL 02
118 FS? 00
119 XEQ 07
120 STO 03
121 LBL 03
122 RCL 06
123 FS? 01
124 XEQ 07
125 STO 07
126 17
127 X<=Y?
128 GTO 04
129 RCL 05
130 CHS
131 PSE
132 RCL 06
133 CHS
134 VIEW X
135 PSE
136 PSE
137 PSE
138 CLD
139 XEQ 00
140 FS?C 02
141 SF 01
142 STO 05
143 RCL 06
144 +
145 STO 06
146 STO 07
147 22
148 X<=Y?
149 GTO 06
150 GTO 03
151 LBL 04
152 RCL 07
153 RCL 03
154 X=Y?
155 SF 02
156 X>Y?
157 GTO 06
158 LBL 05
159 RCL 08
160 CHS
161 STO 08
162 LBL 06
163 FIX 00
164 RCL 05
165 CHS
166 PSE
167 RCL 07
168 CHS
169 VIEW X
170 PSE
171 PSE
172 PSE
173 CLD
174 FIX 02
175 RCL 08
176 FS?C 02
177 CLX
178 ST+ 09
179 RTN
180 LBL 07
181 21
182 X<>Y
183 10
184 +
185 X<=Y?
186 RTN
187 LASTX
188 -
189 RTN
190 LBL a
191 FIX 00
192 9
193 X<> 25
194 STO 23
195 LBL 08
196 RCL 23
197 RCL 25
198 X=Y?
199 GTO 01
200 ISG 25
201 ENTER
202 RCL IND 25
203 PSE
204 GTO 08
205 LBL b
206 PI
207 +
208 STO 24
209 GTO b
210 LBL d
211 RCL 08
212 ABS
213 LBL D
214 FIX 02
215 RND
216 LASTX
217 X!=Y?
218 GTO c
219 X<0?
220 GTO c
221 X=0?
222 GTO c
223 STO 08
224 RTN
225 LBL e
226 CLX
227 STO 09
228 LBL E
229 FIX 02
230 RCL 09
231 RTN
232 END