Pages

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.


Addendum

This game will not fit into the new MCX Micro32 SD expansion card for the MC-10.

No comments:

Post a Comment