Skip to content

Commit 84b3e05

Browse files
committed
feat(trek): pet-ready display (fixed-screen, chr$ digits, all-caps)
Bare-bones fixed-screen scans (cls + screenful, no scroll) plus chr$(48+digit) galaxy-record and axis digits replacing str$/right$/mid$ shrink the image enough to fit a 32K PET (with a ~480B C-stack). Also: LRS loop transposed to outer=row/inner=col, and (portable version) uppercased so it renders in graphics mode. trek now fits and runs on pet, the 6th cc65 target.
1 parent 01f0fae commit 84b3e05

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

examples/trek-portable.bas

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ end
7171
function TitleScreen()
7272
cls()
7373
print "-GENERIC SPACE BATTLE COMPUTER GAME-"
74-
print "(portable version)"
74+
print "(PORTABLE VERSION)"
7575
pause()
7676
return
7777

@@ -496,12 +496,12 @@ function ManeuverPOWER()
496496
return
497497
end function
498498

499-
function disp_quadrant_cell$(this_q_col, this_q_row)
500-
if (this_q_col < 1 or this_q_col > 8) or (this_q_row < 1 or this_q_row > 8) then
501-
return "=:=:="
499+
function disp_quadrant_cell$(this_row, this_col)
500+
if (this_row < 1 or this_row > 8) or (this_col < 1 or this_col > 8) then
501+
print "=:=:=";
502502
else
503-
cell_code = GALAXY(this_q_col, this_q_row)
504-
return str$(cell_code\100) + ":" + str$((cell_code\10)mod10) + ":" + str$(cell_code mod10)
503+
cell_code = GALAXY(this_row, this_col)
504+
print str$(cell_code\100) + ":" + str$((cell_code\10)mod10) + ":" + str$(cell_code mod10);
505505
end if
506506
end function
507507

@@ -527,14 +527,14 @@ function Lrs()
527527

528528

529529
' LONG RANGE SCAN LOOP
530-
q_col = QUADRANT_Y
531-
for q_row = QUADRANT_X-1 to QUADRANT_X+1
532-
533-
print disp_quadrant_cell$(q_col-1, q_row); " | ";
534-
print disp_quadrant_cell$(q_col, q_row); " | ";
535-
print disp_quadrant_cell$(q_col+1, q_row)
536-
537-
next q_row
530+
for scan_row = QUADRANT_Y-1 to QUADRANT_Y+1
531+
disp_quadrant_cell$(scan_row, QUADRANT_X-1)
532+
print " | ";
533+
disp_quadrant_cell$(scan_row, QUADRANT_X)
534+
print " | ";
535+
disp_quadrant_cell$(scan_row, QUADRANT_X+1)
536+
print "\n";
537+
next scan_row
538538

539539
K1=0 : if SLSFLAG=1 then SLSFLAG=0
540540

@@ -1050,8 +1050,7 @@ function ComputerGalacticRecord()
10501050

10511051

10521052
for J=1 to 8
1053-
J$=str$(J)
1054-
J$=right$(J$,1)
1053+
J$=chr$(48+J)
10551054
if A1=5 then RomanNumeral() : continue for
10561055
if J=QUADRANT_X then print " ";J$;" ";
10571056
if J<>QUADRANT_X then print " ";J;" ";
@@ -1064,8 +1063,7 @@ function ComputerGalacticRecord()
10641063
print O1$
10651064

10661065
for I=1 to 8
1067-
I$=str$(I)
1068-
I$=right$(I$,1)
1066+
I$=chr$(48+I)
10691067
if I=QUADRANT_Y then print " ";I$;"";
10701068

10711069
RowIsRegion=0
@@ -1077,10 +1075,10 @@ function ComputerGalacticRecord()
10771075
if I=QUADRANT_Y and J=QUADRANT_X then print "|"; : GALFLAG=1
10781076
if not (I=QUADRANT_Y and (J=QUADRANT_X or J-1=QUADRANT_X)) then print "|";
10791077
if VISITED_GALAXY(I,J)=0 then print " "; : continue for
1080-
G1$=right$(str$(VISITED_GALAXY(I,J)+1000),3)
1081-
print ECOL$;mid$(G1$,1,1);
1082-
print DCOL$;mid$(G1$,2,1);
1083-
print HCOL$;mid$(G1$,3,1);FCOL$;
1078+
GV=VISITED_GALAXY(I,J)
1079+
print ECOL$;chr$(48+GV\100);
1080+
print DCOL$;chr$(48+(GV\10)mod10);
1081+
print HCOL$;chr$(48+GV mod10);FCOL$;
10841082
if GALFLAG=1 then print "|"; : GALFLAG=0
10851083
next J
10861084
end if

0 commit comments

Comments
 (0)