Login
Back to forumSee the full topicGo to last reply

Posted By

Csabo
on 2013-12-15
16:22:26
 Re: Some APS Adventures

The problem I run into is that I spend too much time on any one release, and try to make it "perfect" (even though there's no such thing). For FOE, these are the things that I notice (all of them using the original line numbers):

- The GOSUB 1000 in line 110 is not necessary, since that's the only place this "subroutine" is called. It should be "inlined". The GOSUB/RETURN just slows down the execution. (That code itself could be written much nicer, it checks items 1, 6, 8, 9, 10 and 15 and gives a point for each. The order of the items don't matter. If those particular items were reorganized to be the first 6, a simple loop could count them.)

- The IFs between 110-145 are clumsily written. There's no need to check/print each direction twice. Instead, the directions should all be added with a leading comma (e.g. ",NORTH" ",SOUTH" etc) and then the first character cut.

- The only real subroutine is in line 2000. BASIC doesn't have a line lookup table, so when you do a GOSUB 2000, it has to look through every single line to find where that is in the memory. Therefore, a simple trick you can do to speed up execution is to move that subroutine to line 1 (and line 0 of course would be a GOTO 2 to skip it).

- Otherwise, there's lot of very simple optimizations that can be done. SCNCLR is only one byte versus PRINTCHR$(147), which is 7 bytes. Instead of PRINT:PRINT:PRINT etc, one could do a single print and include the cursor down character.

So, I would spend too much time on these happy And I don't know if it's worth it. I'm always behind on Plus/4 stuff happy My recommendation would be: 1) fix that one bug (line 1075 is never reached, but a lot of the logic is there). 2) test that it can be played through. 3) pack it with BASIC packer and release it. happy



Back to top


Copyright © Plus/4 World Team, 2001-2024