Tuesday, 19 November 2019

The Maze of Argon

I'm really quite proud of how this game port came out. David Maunder recovered this game for the Dick Smith VZ-200 computer from an old cassette tape. The machine language portion of the game that draws the 3D maze was corrupted.


However, the BASIC part, which handles all the other functions of the game, was ok. So I rewrote the wall rendering in BASIC and it came up very speedy.


I had to change how the maze data was stored too. It was set/reset into hires graphic screen area, but that area was never displayed. It was just used to store the 2D map info from each level that were read by the wall rendering subroutine.  Values for the maze in the sightline of the virtual player (represented in the following by "^") were poked into memory before a call was made to the USR M/L subroutine:

  8
  6
 475
  3
 1^2

I had to recreate the maps and store them as strings into which I POKEd the various items you can find (Pits, Energy packs, exit). This was greatly aided by David, who was able to halt the program and display the graphic screen to show the maps.



I used the screenshot that he provided to redraw the maps as a string array using # symbols to represent the walls, ! symbols for pits, % symbols for energy packs and $ for the secret exit.  These latter items had to poked into the strings  rather than using BASIC string handling commands (MID$, LEFT$, RIGHT$) because otherwise, the strings would be reallocated to string space, and there wasn't enough memory for that to be possible.  I had to readjust the offsets used to perform operations on the maps.  In the VZ each of the 3 levels takes a 40 wide space in the x axis and are set down from the top of the graphic screen by 24 pixels.  In my versions the levels each have 32 spaces in the X axis and only a 4 space offset from the top of the string array:

7001 M$(01)="                                                                                                 "
7002 M$(02)="                                                                                                 "
7003 M$(03)="                                                                                                 "
7004 M$(04)="   ###########################     ###########################     ###########################   "
7005 M$(05)="   #           #   #   #   # #     #                         #     #       #       # #   #   #   "
7006 M$(06)="   # # ### ### # # # # # # # #     # ########### ### ### ### #     # # ### # # ### # # ### # #   "
7007 M$(07)="   #   #   # #   #   #   #   #     # #         #   # #     # #     # #   #   #             # #   "
7008 M$(08)="   # ### # # ### # ### # #####     # # ####### # # # # # # # #     # ### # # ##### # ##### # #   "
7009 M$(09)="   #     #       #     #   # #     # # #     # #   # # # #   #     #     # # #   # # #   #   #   "
7010 M$(10)="   ### # ### # # # # ##### # #     # # ##### # # # # # # ### #     ### # # # # # # # # # # # #   "
7011 M$(11)="   #   # # # # # #   #   # # #     # #       # # #   # #     #     # # # # # # # # # # # # # #   "
7012 M$(12)="   # # # # # # # # # # # # # #     # ######### # # # # ##### #     # # # # # # # # # # # # # #   "
7013 M$(13)="   # # #     #   # #   #     #     #           # #   #   # # #     # # # # # # # # # # # # # #   "
7014 M$(14)="   # # ### ##### # # ##### ###     ######### ### ### ### # # #     # # # # # # # # # # # # # #   "
7015 M$(15)="   #   #   #     #     #     #     #     #   #         #     #     #   #   #   #   #   #   # #   "
7016 M$(16)="   ### # # # ### # # # # # ###     # ### # ### # ### # ##### #     # ### ### ### ### ### ### #   "
7017 M$(17)="   #     #       # # #   #   #     # #   #     #   # #       #     # #   #   #   #   #   #   #   "
7018 M$(18)="   # ### ### ##### # ### # # #     # # # # # ####### # ##### #     # # # # # # # # # # # # # #   "
7019 M$(19)="   #   #   #     #         # #     # # #   # #       # #     #     # # # #   # #   # # # # # #   "
7020 M$(20)="   ### ### # # # # # ##### # #     ########### ####### # #####     # # # # # # # # # # # # # #   "
7021 M$(21)="   #         # # # #       # #     #                   #   # #     #   # # #   # # #   #     #   "
7022 M$(22)="   # # ### # # # # ### ### # #     # ### ########### # ##### #     ##### # ##### # ###########   "
7023 M$(23)="   # #     #   # # #     #   #     # #   #   #   #   #       #     #     # #   # # #         #   "
7024 M$(24)="   # # # # ### # # # ### #####     # # # # # # # # # ##### ###     # # # # # # # # # ####### #   "
7025 M$(25)="   #   # # #         #       #     # # # # # #   # #   # #   #     #   #       # #   #     # #   "
7026 M$(26)="   ### # # # # # # # # ##### #     # ### # # # # # ### # ### #     ### ### # # # # ### # # # #   "
7027 M$(27)="   #     #   #   #   #       #     #   #   #   #   #   #     #     #   #   #     #     # #   #   "
7028 M$(28)="   ###########################     ###########################     ###########################   "
7029 M$(29)="                                                                                                 "
7030 M$(30)="                                                                                                 "
7031 M$(31)="                                                                                                 "


The game is pretty fun and very challenging.  The original starts you with a countdown timer of 10000, but I bumped this to 12000 for the MC-10 because I think it runs a little faster than the VZ.  The VZ version also has a funky musical interlude at the end of the game ("Lara's Theme" from Doctor Zhivago), which also had to be dropped for memory reasons.  I did preserve the other fanfares for losing and winning.  I just use the VZ BASIC manual to convert the note numbers from VZs SOUND command to their equivalent values for the  MC-10 SOUND command.

I used James the Animal Tamer's JVZ_021 emulator to load the original program and the to LLIST it to a text file for editing.  Thanks James!

Saturday, 26 October 2019

RetroChallenge 2019/10: Akalabeth Converted to TRS-80 Coco



I've finished condensing the code of my MC-10 MCX conversion of the Akalabeth source code and have edited it so it will work on the Coco. It is running in the video above on VCC using the high speed poke, which is line 415 (the end of the program):
415 GOSUB11:NEXT:POKE65497,0:GOTO14
For the coco 2 use POKE 65495,0 instead.

The box fill routine is slower on the Coco than in MCX Basic. Looks a bit like a cinematic wipe. Curtis Boyle mentioned in a comment on Youtube that it might be possible to speed up the screen clear by poking a small assembly routine into the cassette buffer area to do "a stack blast clear or two." If anyone wants to try to hack the code, the upper screen clear routine is on line 7:
7 IFG1 THENLINE(0,0)-(255,159),PRESET,BF:RETURN
I used  my son Charlie's idea for converting the LINE statements for drawing the monsters to DATA  statements and then just using a single draw routine.  After doing this I was able to get Akalabeth to fit in the 25K left on a Coco after it is configured for a PMODE2 graphics screen. Thanks Charlie!

The problem was that LINE statements on the Coco require using the PSET command to designate the color attribute rather than a number literal like "1", which would have taken up even more space.  Since I was already maxed out, this would have been a disaster.  But using DATA statements allowed me to shrink everything down to a point that I even had almost 1000 bytes to spare.

I used a routine provided to me by Pippa (from the IF Solutions Archive) that allows me to PEEK and POKE back in the address pointer for the READ statement used with DATA. This allowed me to simply move the pointer to the beginning of the DATA that needed to be read for each monster. On the MC-10 the pointer address is stored at 173 and 174, but I was able to look up the equivalent locations in a Coco ROM Disassembly, which are 51 and 52.  Here is a little demo of Pippa's routines:
1 GOSUB8:PRINTJ:GOSUB9:GOTO1
8 OD=PEEK(173)+256*PEEK(174):READJ:RETURN
9 POKE174,INT(OD/256):POKE173,OD-256*PEEK(174):RETURN
10 DATA 1
The following table clearly shows how much memory is saved by switching to DATA statements:

Here’s a test routine that uses the DATA
Here’s the original routine
0 B=100:C=127:D=1:PMODE2,1:SCREEN1,1:
1 FORZZ=1TO10:PCLS:GOSUB9
2 IFINKEY$=""THEN2
3 NEXT:
4 GOTO4

9 READT,A,G,Q:IFT=99THENRETURN
10 LINE(C+T/D,B+A/D)-(C+G/D,B+Q/D),PSET:GOTO9

74 DATA-23,,-15,,-15,,-15,-15,-15,-15,-8,-30,-8,-30,8,-30,8,-30,15,-15,15,-15,15,,15,,23,,,-26,,-65,-2,-38,2,-38,-3,-45,3,-45,-5,-53,5,-53,-23,-56,-30,-53,-30,-53,-23,-45,-23,-45,-23,-53,-23,-53,-8,-38,-15,-45,-8,-60,-8,-60,8
75 DATA-60,8,-60,15,-45,15,-42,15,-57,12,-45,20,-45,,-75,-5,-80,-5,-80,-8,-75,-8,-75,-5,-65,-5,-65,5,-65,5,-65,5,-68,5,-68,-5,-68,-5,-68,-5,-65,-5,-65,5,-65,5,-65,8,-75,8,-75,5,-80,5,-80,-5,-80,-3,-72,-2,-72,3,-72,4,-72,99,,,

80 DATA,-56,,-8,,-8,10,,10,,30,,30,,30,-45,30,-45,10,-64,10,-64,,-56,,-56,-10,-64,-10,-64,-30,-45,-30,-45,-30,,-30,,-10,,-10,,,-8,-10,-64,-10,-75,-10,-75,,-83,,-83,10,-75
81 DATA10,-75,,-79,,-79,-10,-75,-10,-75,,-60,,-60,10,-75,10,-75,10,-64,99,,,

82 DATA5,-30,,-25,,-25,-5,-30,-5,-30,-15,-5,-15,-5,-10,,-10,,10,,10,,15,-5,15,-5,20,-5,20,-5,10,,10,,15,-5,15,-5,5,-30,5,-30,10,-40,10,-40,3,-35,3,-35,-3,-35,-3,-35,-10,-40,-10,-40,-5,-30
84 DATA-5,-33,-3,-30,5,-33,3,-30,-5,-20,-5,-15,5,-20,5,-15,-7,-20,-7,-15,7,-20,7,-15,99,,,

86 DATA,,-15,,-15,,-8,-8,-8,-8,-8,-15,-8,-15,-15,-23,-15,-23,-15,-15,-15,-15,-23,-23,-23,-23,-23,-45,-23,-45,-15,-53,-15,-53,-8,-53,-8,-53,-15,-68,-15,-68,-8,-75,-8,-75,,-75
88 DATA,,15,,15,,8,-8,8,-8,8,-15,8,-15,15,-23,15,-23,15,-15,15,-15,23,-23,23,-23,23,-45,23,-45,15,-53,15,-53,8,-53,8,-53,15,-68,15,-68,8,-75,8,-75,,-75
90 DATA-15,-68,15,-68,-8,-53,8,-53,-23,-15,8,-45,-8,-68,,-60,,-60,8,-68,8,-68,8,-60,8,-60,-8,-60,-8,-60,-8,-68,,-38,-8,-38,-8,-38,8,-53,8,-53,8,-45,8,-45,15,-45,15,-45,,-30,,-30,,-38,99,,,

93 DATA-10,-15,-10,-30,-10,-30,-15,-20,-15,-20,-15,-1,-15,-1,-15,,-15,,15,,15,,15,-15,15,-15,-15,-15,-15,-10,15,-10,-15,-5,15,-5,,-15,-5,-20,-5,-20,-5,-35,-5,-35,5,-35,5,-35,5,-20,5,-20,10,-15,-5,-20,5,-20,-5,-25,5,-25
97 DATA-5,-30,5,-30,-10,-35,-10,-40,-10,-40,-5,-45,-5,-45,5,-45,5,-45,10,-40,10,-40,10,-35,-10,-40,,-45,,-45,10,-40,-5,-40,5,-40,5,-40,15,-30,15,-30,,-40,,-40,-15,-30,-15,-30,-5,-40,99,,,

101 DATA-20,-88,-30,-83,-30,-83,-30,-78,20,-88,30,-83,30,-83,40,-83,-15,-86,-20,-83,-20,-83,-20,-78,-20,-78,-30,-73,-30,-73,-30,-68,-30,-68,-20,-63,-10,-83,-10,-58,-10,-58,,-50,10,-83,10,-78,10,-78,20,-73,20,-73,20,-40
104 DATA15,-85,20,-78,20,-78,30,-76,30,-76,30,-60,,-83,,-73,,-73,10,-68,10,-68,10,-63,10,-63,,-58,99,,,

106 DATA5,-10,-5,-10,-5,-10,,-15,,-15,10,-20,10,-20,5,-15,5,-15,5,-10,5,-10,7,-6,7,-6,5,-3,5,-3,-5,-3,-5,-3,-7,-6,-7,-6,-5,-10,2,-3,5,,5,,8,,-2,-3,-5,,-5,,-8,,3,-8,3,-8,-3,-8,-3,-8,3,-5,-3,-5,99,,,

111 DATA99,,,

112 DATA-14,-46,-12,-37,-12,-37,-20,-32,-20,-32,-30,-32,-30,-32,-22,-24,-22,-24,-40,-17,-40,-17,-40,-7,-40,-7,-38,-5,-38,-5,-40,-3,-40,-3,-40,,-40,,-36,,-36,,-34,-2,-34,-2,-32,,-32
113 DATA,-28,,-28,,-28,-3,-28,-3,-30,-5,-30,-5,-28,-7,-28,-7,-28,-15,-28,-15,,-27,14,-46,12,-37,12,-37,20,-32,20,-32,30,-32,30,-32,22,-24,22,-24,40,-17,40,-17,40,-7,40,-7,38,-5,38,-5,40,-3,40,-3,40,
115 DATA40,,36,,36,,34,-2,34,-2,32,,32,,28,,28,,28,-3,28,-3,30,-5,30,-5,28,-7,28,-7,28,-15,28,-15,,-27,6,-48,38,-41,38,-41,40,-42,40,-42,18,-56,18,-56,12,-56,12,-56,10,-57,10,-57,8,-56,8,-56,-8,-56,-8,-56,-10,-58
116 DATA-10,-58,14,-58,14,-58,16,-59,16,-59,8,-63,8,-63,6,-63,6,-63,2,-70,2,-70,2,-63,2,-63,-2,-63,-2,-63,-2,-70,-2,-70,-6,-63,-6,-63,-8,-63,-8,-63,-16,-59,-16,-59,-14,-58,-14,-58,10,-57,10,-57,-12,-56,-12,-56,-18,-56,-18
117 DATA-56,-36,-47,-36,-47,-36,-39,-36,-39,-28,-41,-28,-41,-28,-46,-28,-46,-20,-50,-20,-50,-18,-50,-18,-50,-14,-46,-28,-41,30,-55,28,-58,22,-56,22,-56,22,-53,22,-53,28,-52,28,-52,34,-54,34,-54,20,-50,20,-50,26,-47
118 DATA10,-58,10,-61,10,-61,4,-58,-10,-58,-10,-61,-10,-61,-4,-58,40,-9,50,-12,50,-12,40,-7,-8,-25,6,-7,6,-7,28,-7,28,-7,28,-9,28,-9,20,-9,20,-9,6,-25,99,,,

120 DATA6,-60,30,-90,30,-90,60,-30,60,-30,60,-10,60,-10,30,-40,30,-40,15,-40,-6,-60,-30,-90,-30,-90,-60,-30,-60,-30,-60,-10,-60,-10,-30,-40,-30,-40,-15,-40,,-25,6,-25,6,-25,10,-20,10,-20,12,-10,12,-10
122 DATA10,-6,10,-6,10,,10,,14,,14,,15,-5,15,-5,16,,16,,20,,20,,20,-6,20,-6,18,-10,18,-10,18,-20,18,-20,15,-30,15,-30,15,-45,15,-45,40,-60,40,-60,40,-70,40,-70,10,-55,10,-55,6,-60,6,-60,10,-74,10,-74,6,-80,6,-80
124 DATA4,-80,4,-80,3,-82,3,-82,2,-80,2,-80,,-80,,-25,-6,-25,-6,-25,-10,-20,-10,-20,-12,-10,-12,-10,-10,-6,-10,-6,-10,,-10,,-14,,-14,,-15,-5,-15,-5,-16,,-16,,-20,,-20,,-20,-6,-20,-6,-18,-10,-18,-10
126 DATA-18,-20,-18,-20,-15,-30,-15,-30,-15,-45,-15,-45,-40,-60,-40,-60,-40,-70,-40,-70,-10,-55,-10,-55,-6,-60,-6,-60,-10,-74,-10,-74,-6,-80,-6,-80,-4,-80,-4,-80,-3,-82,-3,-82,-2,-80,-2,-80,,-80
128 DATA-6,-25,,-6,,-6,10,,10,,4,-8,4,-8,6,-25,-40,-64,-40,-90,-40,-90,-52,-80,-52,-80,-52,-40,40,-86,38,-92,38,-92,42,-92,42,-92,40,-86,40,-86,40,-50,4,-70,6,-74,-4,-70,-6,-74,,-64,,-60,99,,,


73 LINE(C-23/D,B)-(C-15/D,B),1:LINE-(C-15/D,B-15/D),1:LINE-(C-8/D,B-30/D),1:LINE-(C+8/D,B-30/D),1:LINE-(C+15/D,B-15/D),1:LINE-(C+15/D,B),1:LINE-(C+23/D,B),1
74 LINE(C,B-26/D)-(C,B-65/D),1:LINE(C-2/D+.5,B-38/D)-(C+2/D+.5,B-38/D),1:LINE(C-3/D+.5,B-45/D)-(C+3/D+.5,B-45/D),1:LINE(C-5/D+.5,B-53/D)-(C+5/D+.5,B-53/D),1
75 LINE(C-23/D,B-56/D)-(C-30/D,B-53/D),1:LINE-(C-23/D,B-45/D),1:LINE-(C-23/D,B-53/D),1:LINE-(C-8/D,B-38/D),1
76 LINE(C-15/D,B-45/D)-(C-8/D,B-60/D),1:LINE-(C+8/D,B-60/D),1:LINE-(C+15/D,B-45/D),1:LINE(C+15/D,B-42/D)-(C+15/D,B-57/D),1:LINE(C+12/D,B-45/D)-(C+20/D,B-45/D),1
77 LINE(C,B-75/D)-(C-5/D+.5,B-80/D),1:LINE-(C-8/D,B-75/D),1:LINE-(C-5/D+.5,B-65/D),1:LINE-(C+5/D+.5,B-65/D),1:LINE-(C+5/D+.5,B-68/D),1:LINE-(C-5/D+.5,B-68/D),1:LINE-(C-5/D+.5,B-65/D),1
78 LINE-(C+5/D+.5,B-65/D),1:LINE-(C+8/D,B-75/D),1:LINE-(C+5/D+.5,B-80/D),1:LINE-(C-5/D+.5,B-80/D),1:PSET(C-5/D+.5,B-72/D):PSET(C+5/D+.5,B-72/D):GOTO131
79 LINE(C,B-56/D)-(C,B-8/D),1:LINE-(C+10/D,B),1:LINE-(C+30/D,B),1:LINE-(C+30/D,B-45/D),1:LINE-(C+10/D,B-64/D),1:LINE-(C,B-56/D),1
80 LINE-(C-10/D,B-64/D),1:LINE-(C-30/D,B-45/D),1:LINE-(C-30/D,B),1:LINE-(C-10/D,B),1:LINE-(C,B-8/D),1:LINE(C-10/D,B-64/D)-(C-10/D,B-75/D),1:LINE-(C,B-83/D),1:LINE-(C+10/D,B-75/D),1
81 LINE-(C,B-79/D),1:LINE-(C-10/D,B-75/D),1:LINE-(C,B-60/D),1:LINE-(C+10/D,B-75/D),1:LINE-(C+10/D,B-64/D),1:GOTO131
82 LINE(C+5/D,B-30/D)-(C,B-25/D),1:LINE-(C-5/D,B-30/D),1:LINE-(C-15/D,B-5/D),1:LINE-(C-10/D,B),1:LINE-(C+10/D,B),1:LINE-(C+15/D,B-5/D),1
83 LINE-(C+20/D,B-5/D),1:LINE-(C+10/D,B),1:LINE-(C+15/D,B-5/D),1:LINE-(C+5/D,B-30/D),1:LINE-(C+10/D,B-40/D),1:LINE-(C+3/D+.5,B-35/D),1:LINE-(C-3/D+.5,B-35/D),1:LINE-(C-10/D,B-40/D),1:LINE-(C-5/D,B-30/D),1
84 LINE(C-5/D,B-33/D)-(C-3/D+.5,B-30/D),1:LINE(C+5/D,B-33/D)-(C+3/D+.5,B-30/D),1:LINE(C-5/D,B-20/D)-(C-5/D,B-15/D),1
85 LINE(C+5/D,B-20/D)-(C+5/D,B-15/D),1:LINE(C-7+D,B-20/D)-(C-7/D,B-15/D),1:LINE(C+7/D,B-20/D)-(C+7/D,B-15/D),1:GOTO131
86 LINE(C,B)-(C-15/D,B),1:LINE-(C-8/D,B-8/D),1:LINE-(C-8/D,B-15/D),1:LINE-(C-15/D,B-23/D),1:LINE-(C-15/D,B-15/D),1:LINE-(C-23/D,B-23/D),1
87 LINE-(C-23/D,B-45/D),1:LINE-(C-15/D,B-53/D),1:LINE-(C-8/D,B-53/D),1:LINE-(C-15/D,B-68/D),1:LINE-(C-8/D,B-75/D),1:LINE-(C,B-75/D),1
88 LINE(C,B)-(C+15/D,B),1:LINE-(C+8/D,B-8/D),1:LINE-(C+8/D,B-15/D),1:LINE-(C+15/D,B-23/D),1:LINE-(C+15/D,B-15/D),1:LINE-(C+23/D,B-23/D),1
89 LINE-(C+23/D,B-45/D),1:LINE-(C+15/D,B-53/D),1:LINE-(C+8/D,B-53/D),1:LINE-(C+15/D,B-68/D),1:LINE-(C+8/D,B-75/D),1:LINE-(C,B-75/D),1
90 LINE(C-15/D,B-68/D)-(C+15/D,B-68/D),1:LINE(C-8/D,B-53/D)-(C+8/D,B-53/D),1:LINE(C-23/D,B-15/D)-(C+8/D,B-45/D),1
91 LINE(C-8/D,B-68/D)-(C,B-60/D),1:LINE-(C+8/D,B-68/D),1:LINE-(C+8/D,B-60/D),1:LINE-(C-8/D,B-60/D),1:LINE-(C-8/D,B-68/D),1
92 LINE(C,B-38/D)-(C-8/D,B-38/D),1:LINE-(C+8/D,B-53/D),1:LINE-(C+8/D,B-45/D),1:LINE-(C+15/D,B-45/D),1:LINE-(C,B-30/D),1:LINE-(C,B-38/D),1:GOTO131
93 LINE(C-10/D,B-15/D)-(C-10/D,B-30/D),1:LINE-(C-15/D,B-20/D),1:LINE-(C-15/D,B-15/D),1:LINE-(C-15/D,B),1:LINE-(C+15/D,B),1:LINE-(C+15/D,B-15/D),1:LINE  -(C-15/D,B-15/D),1
94 LINE(C-15/D,B-10/D)-(C+15/D,B-10/D),1:LINE(C-15/D,B-5/D)-(C+15/D,B-5/D),1
95 LINE(C,B-15/D)-(C-5/D,B-20/D),1:LINE-(C-5/D,B-35/D),1:LINE-(C+5/D,B-35/D),1:LINE-(C+5/D,B-20/D),1:LINE-(C+10/D,B-15/D),1
96 LINE(C-5/D,B-20/D)-(C+5/D,B-20/D),1:LINE(C-5/D,B-25/D)-(C+5/D,B-25/D),1:LINE(C-5/D,B-30/D)-(C+5/D,B-30/D),1
97 LINE(C-10/D,B-35/D)-(C-10/D,B-40/D),1:LINE-(C-5/D,B-45/D),1:LINE-(C+5/D,B-45/D),1:LINE-(C+10/D,B-40/D),1:LINE-(C+10/D,B-35/D),1
98 LINE(C-10/D,B-40/D)-(C,B-45/D),1:LINE-(C+10/D,B-40/D),1
99 LINE(C-5/D,B-40/D)-(C+5/D,B-40/D),1:LINE-(C+15/D,B-30/D),1:LINE-(C,B-40/D),1:LINE-(C-15/D,B-30/D),1:LINE-(C-5/D+.5,B-40/D),1:GOTO131
100 LINE(C-20/D,79-Y(D))-(C-20/D,B-88/D),1:LINE-(C-10/D,B-83/D),1:LINE-(C+10/D,B-83/D),1:LINE-(C+20/D,B-88/D),1:LINE-(C+20/D,79-Y(D)),1:LINE-(C-20/D,79-Y(D)),1
101 LINE(C-20/D,B-88/D)-(C-30/D,B-83/D),1:LINE-(C-30/D,B-78/D),1:LINE(C+20/D,B-88/D)-(C+30/D,B-83/D),1:LINE-(C+40/D,B-83/D),1
102 LINE(C-15/D,B-86/D)-(C-20/D,B-83/D),1:LINE-(C-20/D,B-78/D),1:LINE-(C-30/D,B-73/D),1:LINE-(C-30/D,B-68/D),1:LINE-(C-20/D,B-63/D),1
103 LINE(C-10/D,B-83/D)-(C-10/D,B-58/D),1:LINE-(C,B-50/D),1:LINE(C+10/D,B-83/D)-(C+10/D,B-78/D),1:LINE-(C+20/D,B-73/D),1:LINE-(C+20/D,B-40/D),1
104 LINE(C+15/D,B-85/D)-(C+20/D,B-78/D),1:LINE-(C+30/D,B-76/D),1:LINE-(C+30/D,B-60/D),1
105 LINE(C,B-83/D)-(C,B-73/D),1:LINE-(C+10/D,B-68/D),1:LINE-(C+10/D,B-63/D),1:LINE-(C,B-58/D),1:GOTO131
106 LINE(C+5/D+.5,B-10/D)-(C-5/D+.5,B-10/D),1:LINE-(C,B-15/D),1:LINE-(C+10/D,B-20/D),1:LINE-(C+5/D+.5,B-15/D),1:LINE-(C+5/D+.5,B-10/D),1
107 LINE-(C+7/D+.5,B-6/D),1:LINE-(C+5/D+.5,B-3/D),1:LINE-(C-5/D+.5,B-3/D),1:LINE-(C-7/D+.5,B-6/D),1:LINE-(C-5/D+.5,B-10/D),1:LINE(C+2/D+.5,B-3/D)-(C+5/D+.5,B),1:LINE-(C+8/D,B),1
108 LINE(C-2/D+.5,B-3/D)-(C-5/D+.5,B),1:LINE-(C-8/D,B),1:PSET(C+3/D+.5,B-8/D):PSET(C-3/D+.5,B-8/D):LINE(C+3/D+.5,B-5/D)-(C-3/D+.5,B-5/D),1:GOTO131
109 LINE(127-10/D,E(D,3))-(127-10/D,E(D,3)-10/D),1:LINE-(127+10/D,E(D,3)-10/D),1:LINE-(127+10/D,E(D,3)),1:LINE-(127-10/D,E(D,3)),1
110 LINE(127-10/D,E(D,3)-10/D)-(127-5/D,E(D,3)-15/D),1:LINE-(127+15/D,E(D,3)-15/D),1:LINE-(127+15/D,E(D,3)-5/D),1:LINE-(127+10/D,E(D,3)),1
111 LINE(127+10/D,E(D,3)-10/D)-(127+15/D,E(D,3)-15/D),1:GOTO131
112 LINE(C-14/D,B-46/D)-(C-12/D,B-37/D),1:LINE-(C-20/D,B-32/D),1:LINE-(C-30/D,B-32/D),1:LINE-(C-22/D,B-24/D),1:LINE-(C-40/D,B-17/D),1:LINE-(C-40/D,B-7/D),1:LINE-(C-38/D,B-5/D),1:LINE-(C-40/D,B-3/D),1:LINE-(C-40/D,B),1
113 LINE-(C-36/D,B),1:LINE-(C-34/D,B-2/D),1:LINE-(C-32/D,B),1:LINE-(C-28/D,B),1:LINE-(C-28/D,B-3/D),1:LINE-(C-30/D,B-5/D),1:LINE-(C-28/D,B-7/D),1:LINE-(C-28/D,B-15/D),1:LINE-(C,B-27/D),1
114 LINE(C+14/D,B-46/D)-(C+12/D,B-37/D),1:LINE-(C+20/D,B-32/D),1:LINE-(C+30/D,B-32/D),1:LINE-(C+22/D,B-24/D),1:LINE-(C+40/D,B-17/D),1:LINE-(C+40/D,B-7/D),1:LINE-(C+38/D,B-5/D),1:LINE-(C+40/D,B-3/D),1:LINE-(C+40/D,B),1
115 LINE-(C+36/D,B),1:LINE-(C+34/D,B-2/D),1:LINE-(C+32/D,B),1:LINE-(C+28/D,B),1:LINE-(C+28/D,B-3/D),1:LINE-(C+30/D,B-5/D),1:LINE-(C+28/D,B-7/D),1:LINE-(C+28/D,B-15/D),1:LINE-(C,B-27/D),1
116 LINE(C+6/D,B-48/D)-(C+38/D,B-41/D),1:LINE-(C+40/D,B-42/D),1:LINE-(C+18/D,B-56/D),1:LINE-(C+12/D,B-56/D),1:LINE-(C+10/D,B-57/D),1:LINE-(C+8/D,B-56/D),1:LINE-(C-8/D,B-56/D),1:LINE-(C-10/D,B-58/D),1:LINE-(C+14/D,B-58/D),1
117 LINE-(C+16/D,B-59/D),1:LINE-(C+8/D,B-63/D),1:LINE-(C+6/D,B-63/D),1:LINE-(C+2/D+.5,B-70/D),1:LINE-(C+2/D+.5,B-63/D),1:LINE-(C-2/D+.5,B-63/D),1:LINE-(C-2/D+.5,B-70/D),1:LINE-(C-6/D,B-63/D),1:LINE-(C-8/D,B-63/D),1
118 LINE-(C-16/D,B-59/D),1:LINE-(C-14/D,B-58/D),1:LINE-(C+10/D,B-57/D),1:LINE-(C-12/D,B-56/D),1:LINE-(C-18/D,B-56/D),1:LINE-(C-36/D,B-47/D),1:LINE-(C-36/D,B-39/D),1:LINE-(C-28/D,B-41/D),1:LINE-(C-28/D,B-46/D),1
119 LINE-(C-20/D,B-50/D),1:LINE-(C-18/D,B-50/D),1:LINE-(C-14/D,B-46/D),1:GOTO242
120 LINE(C+6/D,B-60/D)-(C+30/D,B-90/D),1:LINE-(C+60/D,B-30/D),1:LINE-(C+60/D,B-10/D),1:LINE-(C+30/D,B-40/D),1:LINE-(C+15/D,B-40/D),1
121 LINE(C-6/D,B-60/D)-(C-30/D,B-90/D),1:LINE-(C-60/D,B-30/D),1:LINE-(C-60/D,B-10/D),1:LINE-(C-30/D,B-40/D),1:LINE-(C-15/D,B-40/D),1
122 LINE(C,B-25/D)-(C+6/D,B-25/D),1:LINE-(C+10/D,B-20/D),1:LINE-(C+12/D,B-10/D),1:LINE-(C+10/D,B-6/D),1:LINE-(C+10/D,B),1:LINE-(C+14/D,B),1:LINE-(C+15/D,B-5/D),1:LINE-(C+16/D,B),1:LINE-(C+20/D,B),1
123 LINE-(C+20/D,B-6/D),1:LINE-(C+18/D,B-10/D),1:LINE-(C+18/D,B-20/D),1:LINE-(C+15/D,B-30/D),1:LINE-(C+15/D,B-45/D),1:LINE-(C+40/D,B-60/D),1:LINE-(C+40/D,B-70/D),1
124 LINE-(C+10/D,B-55/D),1:LINE-(C+6/D,B-60/D),1:LINE-(C+10/D,B-74/D),1:LINE-(C+6/D,B-80/D),1:LINE-(C+4/D+.5,B-80/D),1:LINE-(C+3/D+.5,B-82/D),1:LINE-(C+2/D+.5,B-80/D),1:LINE-(C,B-80/D),1
125 LINE(C,B-25/D)-(C-6/D,B-25/D),1:LINE-(C-10/D,B-20/D),1:LINE-(C-12/D,B-10/D),1:LINE-(C-10/D,B-6/D),1:LINE-(C-10/D,B),1:LINE-(C-14/D,B),1:LINE-(C-15/D,B-5/D),1:LINE-(C-16/D,B),1:LINE-(C-20/D,B),1
126 LINE-(C-20/D,B-6/D),1:LINE-(C-18/D,B-10/D),1:LINE-(C-18/D,B-20/D),1:LINE-(C-15/D,B-30/D),1:LINE-(C-15/D,B-45/D),1:LINE-(C-40/D,B-60/D),1:LINE-(C-40/D,B-70/D),1
127 LINE-(C-10/D,B-55/D),1:LINE-(C-6/D,B-60/D),1:LINE-(C-10/D,B-74/D),1:LINE-(C-6/D,B-80/D),1:LINE-(C-4/D+.5,B-80/D),1:LINE-(C-3/D+.5,B-82/D),1:LINE-(C-2/D+.5,B-80/D),1:LINE-(C,B-80/D),1
128 LINE(C-6/D,B-25/D)-(C,B-6/D),1:LINE-(C+10/D,B),1:LINE-(C+4/D+.5,B-8/D),1:LINE-(C+6/D,B-25/D),1:LINE(C-40/D,B-64/D)-(C-40/D,B-90/D),1:LINE-(C-52/D,B-80/D),1:LINE-(C-52/D,B-40/D),1
129 LINE(C+40/D,B-86/D)-(C+38/D,B-92/D),1:LINE-(C+42/D,B-92/D),1:LINE-(C+40/D,B-86/D),1:LINE-(C+40/D,B-50/D),1
130 LINE(C+4/D+.5,B-70/D)-(C+6/D,B-74/D),1:LINE(C-4/D+.5,B-70/D)-(C-6/D,B-74/D),1:LINE(C,B-64/D)-(C,B-60/D),1


I think this is the end of my main RetroChallenge activity for this month. I also did a little work on another classic dungeon crawl game "Stronghold of the Dwarven Lords" from Tim Hartnell's book Giant Book of Computer Games (1984), subtitled "For most popular home computers that use BASIC."  I used OCR from a version of the book for the VZ200 computer, but it was missing a page, so I had to use another version for the TI99/4a to type in what was missing.  After some correcting and adjustments for the MC-10 it seemed to work fine.


Maybe next year I will try converting Akalabeth to BASIC09 under NitrsOS9.

Working directory on Github for this project: https://github.com/jggames/trs80mc10/tree/master/quicktype/MCX/Akalabeth

Sunday, 13 October 2019

RetroChallenge 2019/10: Akalabeth fully functional on MCX


Listened to Stevie Strowbridge's webcast yesterday. Curtis reported on my progress. He suggested that I was having trouble fitting the full program into the MCX.  I think he might be thinking of some of my prior posts about the game Telengard, where I had to make some edits that cut out a few features of the program (Mysterious Cubes and thrones, for example) to get it to fit in the regular 20K expansion pack. But the only compromises I have made in the MCX expansion pack version of Akalabeth is to shorten some messages. This was done in the name of speed and also memory conservation, but otherwise the program is fully functional. I don't think anything of major importance was lost in terms of information, except a few aspects of the ye-olde medieval flavour of some of the messages.  Otherwise, the 28K memory space provided by MCX (as implemented on the VMC10 emulator) is sufficient.

I have taken the much slimmed version I developed for the Coco and ported it back to MC-10, and I can report that it is now even faster in its screen drawing. I also now have 1K to spare after all the variables are declared.  I'll post it shortly after having my son go at it a little for bug testing.  My son also helped me figure out a way to slim the program even further, which will I hope allow it to fit in the more confined 25K space of Extended Color Basic (after PCLEAR2). The routine for drawing the creatures is the biggest chunk of drawing commands:

73 LINE(C-23/D,B)-(C-15/D,B),1:LINE-(C-15/D,B-15/D),1:LINE-(C-8/D,B-30/D),1:LINE-(C+8/D,B-30/D),1:LINE-(C+15/D,B-15/D),1:LINE-(C+15/D,B),1:LINE-(C+23/D,B),1
74 LINE(C,B-26/D)-(C,B-65/D),1:LINE(C-2/D+.5,B-38/D)-(C+2/D+.5,B-38/D),1:LINE(C-3/D+.5,B-45/D)-(C+3/D+.5,B-45/D),1:LINE(C-5/D+.5,B-53/D)-(C+5/D+.5,B-53/D),1
75 LINE(C-23/D,B-56/D)-(C-30/D,B-53/D),1:LINE-(C-23/D,B-45/D),1:LINE-(C-23/D,B-53/D),1:LINE-(C-8/D,B-38/D),1
76 LINE(C-15/D,B-45/D)-(C-8/D,B-60/D),1:LINE-(C+8/D,B-60/D),1:LINE-(C+15/D,B-45/D),1:LINE(C+15/D,B-42/D)-(C+15/D,B-57/D),1:LINE(C+12/D,B-45/D)-(C+20/D,B-45/D),1
77 LINE(C,B-75/D)-(C-5/D+.5,B-80/D),1:LINE-(C-8/D,B-75/D),1:LINE-(C-5/D+.5,B-65/D),1:LINE-(C+5/D+.5,B-65/D),1:LINE-(C+5/D+.5,B-68/D),1:LINE-(C-5/D+.5,B-68/D),1:LINE-(C-5/D+.5,B-65/D),1
78 LINE-(C+5/D+.5,B-65/D),1:LINE-(C+8/D,B-75/D),1:LINE-(C+5/D+.5,B-80/D),1:LINE-(C-5/D+.5,B-80/D),1:PSET(C-5/D+.5,B-72/D):PSET(C+5/D+.5,B-72/D):GOTO131
79 LINE(C,B-56/D)-(C,B-8/D),1:LINE-(C+10/D,B),1:LINE-(C+30/D,B),1:LINE-(C+30/D,B-45/D),1:LINE-(C+10/D,B-64/D),1:LINE-(C,B-56/D),1
80 LINE-(C-10/D,B-64/D),1:LINE-(C-30/D,B-45/D),1:LINE-(C-30/D,B),1:LINE-(C-10/D,B),1:LINE-(C,B-8/D),1:LINE(C-10/D,B-64/D)-(C-10/D,B-75/D),1:LINE-(C,B-83/D),1:LINE-(C+10/D,B-75/D),1
81 LINE-(C,B-79/D),1:LINE-(C-10/D,B-75/D),1:LINE-(C,B-60/D),1:LINE-(C+10/D,B-75/D),1:LINE-(C+10/D,B-64/D),1:GOTO131
82 LINE(C+5/D,B-30/D)-(C,B-25/D),1:LINE-(C-5/D,B-30/D),1:LINE-(C-15/D,B-5/D),1:LINE-(C-10/D,B),1:LINE-(C+10/D,B),1:LINE-(C+15/D,B-5/D),1
83 LINE-(C+20/D,B-5/D),1:LINE-(C+10/D,B),1:LINE-(C+15/D,B-5/D),1:LINE-(C+5/D,B-30/D),1:LINE-(C+10/D,B-40/D),1:LINE-(C+3/D+.5,B-35/D),1:LINE-(C-3/D+.5,B-35/D),1:LINE-(C-10/D,B-40/D),1:LINE-(C-5/D,B-30/D),1
84 LINE(C-5/D,B-33/D)-(C-3/D+.5,B-30/D),1:LINE(C+5/D,B-33/D)-(C+3/D+.5,B-30/D),1:LINE(C-5/D,B-20/D)-(C-5/D,B-15/D),1
85 LINE(C+5/D,B-20/D)-(C+5/D,B-15/D),1:LINE(C-7+D,B-20/D)-(C-7/D,B-15/D),1:LINE(C+7/D,B-20/D)-(C+7/D,B-15/D),1:GOTO131
86 LINE(C,B)-(C-15/D,B),1:LINE-(C-8/D,B-8/D),1:LINE-(C-8/D,B-15/D),1:LINE-(C-15/D,B-23/D),1:LINE-(C-15/D,B-15/D),1:LINE-(C-23/D,B-23/D),1
87 LINE-(C-23/D,B-45/D),1:LINE-(C-15/D,B-53/D),1:LINE-(C-8/D,B-53/D),1:LINE-(C-15/D,B-68/D),1:LINE-(C-8/D,B-75/D),1:LINE-(C,B-75/D),1
88 LINE(C,B)-(C+15/D,B),1:LINE-(C+8/D,B-8/D),1:LINE-(C+8/D,B-15/D),1:LINE-(C+15/D,B-23/D),1:LINE-(C+15/D,B-15/D),1:LINE-(C+23/D,B-23/D),1
89 LINE-(C+23/D,B-45/D),1:LINE-(C+15/D,B-53/D),1:LINE-(C+8/D,B-53/D),1:LINE-(C+15/D,B-68/D),1:LINE-(C+8/D,B-75/D),1:LINE-(C,B-75/D),1
90 LINE(C-15/D,B-68/D)-(C+15/D,B-68/D),1:LINE(C-8/D,B-53/D)-(C+8/D,B-53/D),1:LINE(C-23/D,B-15/D)-(C+8/D,B-45/D),1
91 LINE(C-8/D,B-68/D)-(C,B-60/D),1:LINE-(C+8/D,B-68/D),1:LINE-(C+8/D,B-60/D),1:LINE-(C-8/D,B-60/D),1:LINE-(C-8/D,B-68/D),1
92 LINE(C,B-38/D)-(C-8/D,B-38/D),1:LINE-(C+8/D,B-53/D),1:LINE-(C+8/D,B-45/D),1:LINE-(C+15/D,B-45/D),1:LINE-(C,B-30/D),1:LINE-(C,B-38/D),1:GOTO131
93 LINE(C-10/D,B-15/D)-(C-10/D,B-30/D),1:LINE-(C-15/D,B-20/D),1:LINE-(C-15/D,B-15/D),1:LINE-(C-15/D,B),1:LINE-(C+15/D,B),1:LINE-(C+15/D,B-15/D),1:LINE  -(C-15/D,B-15/D),1
94 LINE(C-15/D,B-10/D)-(C+15/D,B-10/D),1:LINE(C-15/D,B-5/D)-(C+15/D,B-5/D),1
95 LINE(C,B-15/D)-(C-5/D,B-20/D),1:LINE-(C-5/D,B-35/D),1:LINE-(C+5/D,B-35/D),1:LINE-(C+5/D,B-20/D),1:LINE-(C+10/D,B-15/D),1
96 LINE(C-5/D,B-20/D)-(C+5/D,B-20/D),1:LINE(C-5/D,B-25/D)-(C+5/D,B-25/D),1:LINE(C-5/D,B-30/D)-(C+5/D,B-30/D),1
97 LINE(C-10/D,B-35/D)-(C-10/D,B-40/D),1:LINE-(C-5/D,B-45/D),1:LINE-(C+5/D,B-45/D),1:LINE-(C+10/D,B-40/D),1:LINE-(C+10/D,B-35/D),1
98 LINE(C-10/D,B-40/D)-(C,B-45/D),1:LINE-(C+10/D,B-40/D),1
99 LINE(C-5/D,B-40/D)-(C+5/D,B-40/D),1:LINE-(C+15/D,B-30/D),1:LINE-(C,B-40/D),1:LINE-(C-15/D,B-30/D),1:LINE-(C-5/D+.5,B-40/D),1:GOTO131
100 LINE(C-20/D,79-Y(D))-(C-20/D,B-88/D),1:LINE-(C-10/D,B-83/D),1:LINE-(C+10/D,B-83/D),1:LINE-(C+20/D,B-88/D),1:LINE-(C+20/D,79-Y(D)),1:LINE-(C-20/D,79-Y(D)),1
101 LINE(C-20/D,B-88/D)-(C-30/D,B-83/D),1:LINE-(C-30/D,B-78/D),1:LINE(C+20/D,B-88/D)-(C+30/D,B-83/D),1:LINE-(C+40/D,B-83/D),1
102 LINE(C-15/D,B-86/D)-(C-20/D,B-83/D),1:LINE-(C-20/D,B-78/D),1:LINE-(C-30/D,B-73/D),1:LINE-(C-30/D,B-68/D),1:LINE-(C-20/D,B-63/D),1
103 LINE(C-10/D,B-83/D)-(C-10/D,B-58/D),1:LINE-(C,B-50/D),1:LINE(C+10/D,B-83/D)-(C+10/D,B-78/D),1:LINE-(C+20/D,B-73/D),1:LINE-(C+20/D,B-40/D),1
104 LINE(C+15/D,B-85/D)-(C+20/D,B-78/D),1:LINE-(C+30/D,B-76/D),1:LINE-(C+30/D,B-60/D),1
105 LINE(C,B-83/D)-(C,B-73/D),1:LINE-(C+10/D,B-68/D),1:LINE-(C+10/D,B-63/D),1:LINE-(C,B-58/D),1:GOTO131
106 LINE(C+5/D+.5,B-10/D)-(C-5/D+.5,B-10/D),1:LINE-(C,B-15/D),1:LINE-(C+10/D,B-20/D),1:LINE-(C+5/D+.5,B-15/D),1:LINE-(C+5/D+.5,B-10/D),1
107 LINE-(C+7/D+.5,B-6/D),1:LINE-(C+5/D+.5,B-3/D),1:LINE-(C-5/D+.5,B-3/D),1:LINE-(C-7/D+.5,B-6/D),1:LINE-(C-5/D+.5,B-10/D),1:LINE(C+2/D+.5,B-3/D)-(C+5/D+.5,B),1:LINE-(C+8/D,B),1
108 LINE(C-2/D+.5,B-3/D)-(C-5/D+.5,B),1:LINE-(C-8/D,B),1:PSET(C+3/D+.5,B-8/D):PSET(C-3/D+.5,B-8/D):LINE(C+3/D+.5,B-5/D)-(C-3/D+.5,B-5/D),1:GOTO131
109 LINE(127-10/D,E(D,3))-(127-10/D,E(D,3)-10/D),1:LINE-(127+10/D,E(D,3)-10/D),1:LINE-(127+10/D,E(D,3)),1:LINE-(127-10/D,E(D,3)),1
110 LINE(127-10/D,E(D,3)-10/D)-(127-5/D,E(D,3)-15/D),1:LINE-(127+15/D,E(D,3)-15/D),1:LINE-(127+15/D,E(D,3)-5/D),1:LINE-(127+10/D,E(D,3)),1
111 LINE(127+10/D,E(D,3)-10/D)-(127+15/D,E(D,3)-15/D),1:GOTO131
112 LINE(C-14/D,B-46/D)-(C-12/D,B-37/D),1:LINE-(C-20/D,B-32/D),1:LINE-(C-30/D,B-32/D),1:LINE-(C-22/D,B-24/D),1:LINE-(C-40/D,B-17/D),1:LINE-(C-40/D,B-7/D),1:LINE-(C-38/D,B-5/D),1:LINE-(C-40/D,B-3/D),1:LINE-(C-40/D,B),1
113 LINE-(C-36/D,B),1:LINE-(C-34/D,B-2/D),1:LINE-(C-32/D,B),1:LINE-(C-28/D,B),1:LINE-(C-28/D,B-3/D),1:LINE-(C-30/D,B-5/D),1:LINE-(C-28/D,B-7/D),1:LINE-(C-28/D,B-15/D),1:LINE-(C,B-27/D),1
114 LINE(C+14/D,B-46/D)-(C+12/D,B-37/D),1:LINE-(C+20/D,B-32/D),1:LINE-(C+30/D,B-32/D),1:LINE-(C+22/D,B-24/D),1:LINE-(C+40/D,B-17/D),1:LINE-(C+40/D,B-7/D),1:LINE-(C+38/D,B-5/D),1:LINE-(C+40/D,B-3/D),1:LINE-(C+40/D,B),1
115 LINE-(C+36/D,B),1:LINE-(C+34/D,B-2/D),1:LINE-(C+32/D,B),1:LINE-(C+28/D,B),1:LINE-(C+28/D,B-3/D),1:LINE-(C+30/D,B-5/D),1:LINE-(C+28/D,B-7/D),1:LINE-(C+28/D,B-15/D),1:LINE-(C,B-27/D),1
116 LINE(C+6/D,B-48/D)-(C+38/D,B-41/D),1:LINE-(C+40/D,B-42/D),1:LINE-(C+18/D,B-56/D),1:LINE-(C+12/D,B-56/D),1:LINE-(C+10/D,B-57/D),1:LINE-(C+8/D,B-56/D),1:LINE-(C-8/D,B-56/D),1:LINE-(C-10/D,B-58/D),1:LINE-(C+14/D,B-58/D),1
117 LINE-(C+16/D,B-59/D),1:LINE-(C+8/D,B-63/D),1:LINE-(C+6/D,B-63/D),1:LINE-(C+2/D+.5,B-70/D),1:LINE-(C+2/D+.5,B-63/D),1:LINE-(C-2/D+.5,B-63/D),1:LINE-(C-2/D+.5,B-70/D),1:LINE-(C-6/D,B-63/D),1:LINE-(C-8/D,B-63/D),1
118 LINE-(C-16/D,B-59/D),1:LINE-(C-14/D,B-58/D),1:LINE-(C+10/D,B-57/D),1:LINE-(C-12/D,B-56/D),1:LINE-(C-18/D,B-56/D),1:LINE-(C-36/D,B-47/D),1:LINE-(C-36/D,B-39/D),1:LINE-(C-28/D,B-41/D),1:LINE-(C-28/D,B-46/D),1
119 LINE-(C-20/D,B-50/D),1:LINE-(C-18/D,B-50/D),1:LINE-(C-14/D,B-46/D),1:GOTO242
120 LINE(C+6/D,B-60/D)-(C+30/D,B-90/D),1:LINE-(C+60/D,B-30/D),1:LINE-(C+60/D,B-10/D),1:LINE-(C+30/D,B-40/D),1:LINE-(C+15/D,B-40/D),1
121 LINE(C-6/D,B-60/D)-(C-30/D,B-90/D),1:LINE-(C-60/D,B-30/D),1:LINE-(C-60/D,B-10/D),1:LINE-(C-30/D,B-40/D),1:LINE-(C-15/D,B-40/D),1
122 LINE(C,B-25/D)-(C+6/D,B-25/D),1:LINE-(C+10/D,B-20/D),1:LINE-(C+12/D,B-10/D),1:LINE-(C+10/D,B-6/D),1:LINE-(C+10/D,B),1:LINE-(C+14/D,B),1:LINE-(C+15/D,B-5/D),1:LINE-(C+16/D,B),1:LINE-(C+20/D,B),1
123 LINE-(C+20/D,B-6/D),1:LINE-(C+18/D,B-10/D),1:LINE-(C+18/D,B-20/D),1:LINE-(C+15/D,B-30/D),1:LINE-(C+15/D,B-45/D),1:LINE-(C+40/D,B-60/D),1:LINE-(C+40/D,B-70/D),1
124 LINE-(C+10/D,B-55/D),1:LINE-(C+6/D,B-60/D),1:LINE-(C+10/D,B-74/D),1:LINE-(C+6/D,B-80/D),1:LINE-(C+4/D+.5,B-80/D),1:LINE-(C+3/D+.5,B-82/D),1:LINE-(C+2/D+.5,B-80/D),1:LINE-(C,B-80/D),1
125 LINE(C,B-25/D)-(C-6/D,B-25/D),1:LINE-(C-10/D,B-20/D),1:LINE-(C-12/D,B-10/D),1:LINE-(C-10/D,B-6/D),1:LINE-(C-10/D,B),1:LINE-(C-14/D,B),1:LINE-(C-15/D,B-5/D),1:LINE-(C-16/D,B),1:LINE-(C-20/D,B),1
126 LINE-(C-20/D,B-6/D),1:LINE-(C-18/D,B-10/D),1:LINE-(C-18/D,B-20/D),1:LINE-(C-15/D,B-30/D),1:LINE-(C-15/D,B-45/D),1:LINE-(C-40/D,B-60/D),1:LINE-(C-40/D,B-70/D),1
127 LINE-(C-10/D,B-55/D),1:LINE-(C-6/D,B-60/D),1:LINE-(C-10/D,B-74/D),1:LINE-(C-6/D,B-80/D),1:LINE-(C-4/D+.5,B-80/D),1:LINE-(C-3/D+.5,B-82/D),1:LINE-(C-2/D+.5,B-80/D),1:LINE-(C,B-80/D),1
128 LINE(C-6/D,B-25/D)-(C,B-6/D),1:LINE-(C+10/D,B),1:LINE-(C+4/D+.5,B-8/D),1:LINE-(C+6/D,B-25/D),1:LINE(C-40/D,B-64/D)-(C-40/D,B-90/D),1:LINE-(C-52/D,B-80/D),1:LINE-(C-52/D,B-40/D),1
129 LINE(C+40/D,B-86/D)-(C+38/D,B-92/D),1:LINE-(C+42/D,B-92/D),1:LINE-(C+40/D,B-86/D),1:LINE-(C+40/D,B-50/D),1
130 LINE(C+4/D+.5,B-70/D)-(C+6/D,B-74/D),1:LINE(C-4/D+.5,B-70/D)-(C-6/D,B-74/D),1:LINE(C,B-64/D)-(C,B-60/D),1

Charlie pointed out that it probably represents 7K+ of repeated draw commands.  His idea is to turn all those commands into lists of DATA for each creature that can then just get processed with a subroutine to process and display the line draw vectors.  Here's an example of a line I have converted:

73 LINE(C-23/D,B)-(C-15/D,B),1:LINE-(C-15/D,B-15/D),1:LINE-(C-8/D,B-30/D),1:LINE-(C+8/D,B-30/D),1:LINE-(C+15/D,B-15/D),1
:LINE-(C+15/D,B),1:LINE-(C+23/D,B),1

73 DATA-23,,-15,,-15,,-15,-15,-15,-15,-8,-30,-8,-30,8,-30,8,-30,15,-15,15,-15,15,,15,0,23,0,99,99,99,99

Then I can just use some kind of simple subroutine to plot these 2 groups of 2 coordinates for each LINE command like this:

10 READW,X,Y,Z:IFW=999THEN131
20 LINE(C+W/D,B+X/D)-(C+Y/D,B+Z/D),PSET:GOTO50

This will be critical in pairing down all the individual LINE commands. This is especially important because I discovered that unlike MCX Basic, ECB doesn't allow a literal number for the line color argument. You have to specify PSET, or PRESET and then set the color beforehand using the COLOR command. This means I'll have to swap a bunch of 1s for PSETs.  This would be fatal if I had to do it for the chunk of code above.

Hopefully with Charlie's idea.  I'll get it all to work in 25K on a Coco.

Stay tuned.

Saturday, 12 October 2019

RetroChallenge 2019/10: Extended Color Basic Akalabeth a Possibility


Akalabeth being played on real MCX Hardware

I was perhaps a little hasty in predicting that a Extended Color Basic version of Akalabeth might not be possible.  With a little coaxing and some suggestions from L. Curtis Boyle, I looked into some "slimming" techniques that could be used on the code.  By replacing some heavily used double character variables for single character variables, and renumbering the program using an increment of 1 for lines numbers, I was able to get the code down to about 25K.  Here are some of the main switches in variable names:

MM==>M
X1==>P
Y1==>O
DI==>D
GO==>G1 (this is just because Extended Color Basic doesn't like the word "GO" being used)

It also turned out to be fairly easy finding and inserting the places where Extended Color requires spaces before Basic keywords.  These didn't turn out to be needed in too many places, so the code only grew a little after doing this.  I was able to move the text of the source onto a Coco .DSK image and load it up.  However, it produced an OM error when it hit the array variable declarations.  I might need to find a few more K.

One possibility will be to remove the "Adventurer Shop" section and then chain the programs together and then load any shared variables needed between them.  However, the Shop component already doubles as the Items report, so this tactic might not be possible, or save as much memory as I expect.  I'll have to do some careful testing to get a better sense of how much more memory I need for variables.  But at least things are looking a little more positive than my last post.


Thursday, 10 October 2019

RetroChallenge 2019/10 Coco Version Akalabeth on the Rocks?

On to a new project?
The amount of memory reported by MCX Basic running on the emulator is 28703.  I think you get even more memory on real hardware. And you don't have to clear memory for use by hires commands.  It's just reserved automatically. The amount of memory reported by Coco Basic if I PCLEAR 2 (2 X 1.5 memory pages), which is needed for the PMODE2 screen leaves only 25889 bytes.  I'm starting to fear that the program won't fit on the Coco.

I have only a few hundred bytes free after all the array variables and other variables are declared in the MCX version.  In the Coco version I will also have to insert spaces in all the following instances of variable names touching directly on Basic command keywords:
ON T_GOSUB
FORT=D_TO10
IF A>D_THEN
IF P_ANDP_OR
B_STEP
The MC-10's Basic is fixed to be able to search in a way that it can differentiate between variable names and Basic keywords.  This means you don't need to put any spaces between commands and variables, which is really handy for saving memory and squeezing programs into the MC-10.

I don't think 25K will be enough to run this very large program.  This will leave it to Curtis to bring the game to Coco in the form of a Basic09 program. There might be some troubles here too, as I remember that memory management, as least on level 1 Basic09 can be a little tricky.  I think the largest program I ever compiled was one that needed me to use the #32 argument when running Basic09.  Probably easier in level 2 to get all the Graphics routines loaded up.  Hope so. I'd really like to see this game ported to a windowed program running under Nitros09.

So this might be the end of my Akalabeth porting project. I've been play testing a bit, and the program seems pretty stable.  However, my son Charlie is coming home this weekend for Canadian Thanksgiving, so I'll abuse my fatherly authority and position as family cook to extort some game testing out of him.  He's always really good at sniffing out bugs and takes great relish in pushing programs into situations where conditions are generated that reveal bugs.  I think it's his way of getting some revenge for me making him do beta testing of my crappy old Basic games.

So it might be onto the next project for me. I'm thinking of taking the example program "Mazies and Crazies" for the TRS-80 and typing it in and porting it to MC-10.  I haven't found a working version available anywhere on the Net.  Just the scan of the book by Frank De Costa, "Writing Basic Adventure Programs for the TRS-80" in which it appears.  Or maybe a text adventure of some kind.  Hmmm....

Tuesday, 8 October 2019

RetroChallenge 2019/10: Comparisons with the Original Apple Akalabeth

The resolution of PMODE2 which is the maximum resolution the TRS-80 MCX can handle, is bit courser than the 256 horizontal resolution of the MSX standard (which Nanochess converted the Apple source to).  However, it might be closer to what things look like on the original Apple version, which I think was something like 180X192, with the bottom 4 rows reserved for text.


Apple Versions









TRS-MC-10 Versions





PMODE2 halves the 256 horizontal resolution, so you have 128X192. However, every graphic command still uses the 256X192 resolution for plotting purposes, so I didn't have to convert the resolution of any of the commands from Nanochess's version.  I just had to add a few color numbers, which are not just assumed to be a certain default if not specified.

As Darren Atkinson points out about the limits of graphics on the MC-10:
Three of the 6847’s graphics modes are now available from Basic. Unfortunately, Tandy’s decision to limit the internal RAM to 4K means that modes RG6 and CG6 (aka PMODEs 3 and 4) can’t be displayed without wrap-around. For this reason, MCX Basic supports only RG2, CG3 and RG3 (aka PMODEs 0, 1 and 2). Although the maximum horizontal resolution in these modes is 128 pixels, MCX Basic has adopted the Extended Color Basic convention that all modes are addressed using horizontal coordinate values from 0 to 255 and vertical coordinate values from 0 to 191. These values are then scaled to fit the actual 128 x 96 or 128 x 192 screen size for the current mode.
One additional compromise made in the MCX version is that snow can appear on screen in the RG3 (PMODE2) resolution.  As Darren mentions:
A timing problem in the MC-10 can cause modes 0 and 2 to produce a very noisy display. This depends on whether the VDG syncs with the rising or falling edge of the clock. 
So any of you folks who run this program on real hardware, you might have to switch your machine on and off a number of times before you get the right timing.  Darren had a similar problem with his M/L Asteroids and provides these helpful instructions to work around the problem

ASTEROIDS for MC-10 When playing on a real MC-10 the monochrome graphics mode used for this game may display random sparkles on the screen. This is due to a defect in the design of the MC-10 hardware.
There is a 50% chance that the problem will occur and it depends on which edge of the clock the video chip synchronizes with when the computer is powered on.
You may want to check if the problem will occur before loading the game. You can preview the graphics mode by entering the command:
POKE 49151,120
If you see a lot of random white pixels moving across the entire screen then you should turn the computer off for several seconds and try again.
When the screen is mostly stable (just 2 or 3 rows where the pixels appear to be changing), press the RESET button to get back to the normal text screen. Then enter CLOADM to load the game and EXEC to run it.
Follow a similar procedure for AKALABET, or just consider the sparklies to be "dust" falling from the dungeon's ceiling or snow from the sky (i.e. treat it as an atmospheric feature, rather than a bug:).  It's just one of those limitations that one has to deal with in a beloved machine.  At least it won't be a problem when I port to the Coco as all its graphics modes work properly.  I haven't been able to locate my cable for plugging in my MC-10 to the RS232 port of my PC so I haven't been able to see the game on real hardware yet.  So many cable all stored in vast knots in my basement and attic... 


Sunday, 6 October 2019

RetroChallenge 2019/10: Akalabeth-- Another Error in the Original Code?


L Curtis Boyle (of Coco game list fame) suggested that I could speed up the text a little more by not reprinting all the labels in the lower windows.  It was a good idea. So now only the numbers for your FO, HP and GP are reprinted.  The labels remain. Similarly, the "Command" prompt is only reprinted if it gets erased.  I think I've got it to a very good speed now.  It's hardly frustrating at all!

While I was testing the new mods I ran across what I think is another error in the original code. If you use a playthrough trick I learned about from the website I mentioned in one of my prior posts, of choosing Mage and then using the Magic Amulet "Bad" spell to turn into a lizard man, your stats can get doubled or tripled.  If you do this *before* going to the castle to get your mission, when Lord British gives you your task, the program looks at your stats to determine the power of monster you will get next.  But in the case of the powerful lizard man, this seems to result in the calculation of a number higher than the max number of monsters in the dungeons, which is 10 (the Balrog).  This blows the lid off the monster array and causes an error.  So I put in a little code to detect if a monster # higher than 10 is generated, and if so to change it to 10.

Curtis says he's hoping to convert the game to Nitros9 and Basic09 to run in a window on a high res screen.  It will look pretty cool to see it running with other programs at the same time.  It will take a lot of work to convert all the graphics commands to GFX2 subroutine calls, but I have done some of this myself in the past with a minesweeper conversion and an Astronomy program for plotting the moons of Jupiter. It's tedious but can be done.  I might be able to help him.

Still not 100% sure that there are no more errors, but I will keep bug testing. I played down to a level to get the Balrog and then cheated myself back to the surface.  The routine of returning to Lord British's Castle seemed to work okay and recognized my accomplishment and then offered to bump me up to the next level of difficulty.  This game continues until you kill a Balrog on difficulty level 10. Then all you get is a measly "Congratulations!" and can keep playing some more. Achieving this would be pretty brutal without a game save feature.  Well, there's another mod I can consider doing--adding game saving!  But first, I'll try porting the program to Coco and Extended Color Basic.

I don't know who else is doing RetroChallenge this month.  All the best to anyone out there who is also doing the contest.  And thanks to anyone for reading!

I'm now up to AKALABETH_MCX13.TXT

See: https://github.com/jggames/trs80mc10/tree/master/quicktype/MCX/Akalabeth