Something like this:
Code: Select all
MODDLST:(NO_PUSH)
asm
PUSH
endasm
MODDLST1:
print "TITLE3"
return
Code: Select all
MODDLST:(NO_PUSH)
asm
PUSH
endasm
MODDLST1:
print "TITLE3"
return
Code: Select all
The & symbol is used to control how branches and jumps are optimised. e.g.
No '&' symbol produces ordinary code that allows the full use of relational logic, (but produces the slowest and
largest code).
if (a = 1) AND (b = 2)
...
endif
One '&' symbol removes the call to the runtime relational logic subroutines and uses jump macros that can jump
between pages, (this produces faster and slightly smaller code at the expense of not allowing relational operators).
So to implement the above if statement you would need to do something like this:
if &a = 1
if &b = 2
...
endif
endif
Two '&&' symbols does the same as one '&' symbol but goes even further and replaces the jump macros with inline
branches for the most optimal production of code in terms of speed and size, (branches are limited to branching
within the same page which can be quite limiting depending on the size of the page, e.g. offscreen video memory pages).
if &&a = 1
if &&b = 2
...
endif
endif
I use option 1 for general code readability and when debugging algorithms.
I use option 2 when beginning the optimisation phase, it can substantially increase code speed but more importantly reduce
code size and thus allowing for more code to be added once you start hitting the Gigatron's RAM limits.
I use option 3 inside tight loops and when I have completely run out of Gigatron RAM, it's the most powerful of the user
controllable optimisation hints, but produces code that is inherently page limited with branches. e.g. you optimise a
subroutine using '&&' which may save you many tens of bytes, this now relocates all subsequent code at higher addresses by
those tens of bytes. If any of the subsequent code at higher addresses also contains '&&' optimisations then it has a good
chance of breaking as it produces code that tries to branch between pages, (the optimiser pass will warn you of these
situations and not allow the code to compile or run).
I basically never use '&&' unless the code is in an inner tight loop or I have run out of RAM, PucMon extensively uses it
throughout the entirety of it's code, without this hint PucMon would never have been possible with sound effects, (the '&&'
hint saved around 3.5K of RAM for the entire project).
Note the '&' hint can be used on for next loops, repeat until loops, goto's and gosub's as well, basically code that can
generate some kind of jump can be optimised into a branch using '&'.
The '&&' hint is only used for IF statements.
Code: Select all
const EOP = 0x40 ' End of phrase
const EOS = 0x80 ' End of segment
const LONG = 0xC0 ' Display title phrase for a long time
' Title Phrase Offset, Text
DIM PHRASETAB%(129) = {0x00, ' (unused)
0x05,0x06,0x02 OR EOP, ' $01 "ATTACK COMPUTER ON"
0x05,0x06,0x03 OR EOP, ' $04 "ATTACK COMPUTER OFF"
0x04,0x02 OR EOP, ' $07 "SHIELDS ON"
0x04,0x03 OR EOP, ' $09 "SHIELDS OFF"
0x06,0x07,0x02 OR EOP, ' $0B "COMPUTER TRACKING ON"
0x07,0x03 OR EOP, ' $0E "TRACKING OFF"
0x08 OR EOP, ' $10 "WHATS WRONG?"
0x09,0x0A OR EOP, ' $11 "HYPERWARP ENGAGED"
0x0B,0x0D OR LONG, ' $13 "STARBASE SURROUNDED"
0x0B,0x0C OR LONG, ' $15 "STARBASE DESTROYED"
0x09,0x0E OR EOP, ' $17 "HYPERWARP ABORTED"
0x09,0x0F OR EOP, ' $19 "HYPERWARP COMPLETE"
0x10 OR LONG, ' $1B "HYPERSPACE"
0x11,0x12 OR EOS, ' $1C "ORBIT ESTABLISHED"
0x16 OR EOP, ' $1E "STANDBY"
0x13,0x0E OR EOP, ' $1F "DOCKING ABORTED"
0x15,0x0F OR EOP, ' $21 "TRANSFER COMPLETE"
0x38 OR EOS, ' $23 " "
0x17 OR EOS, ' $24 "STAR FLEET TO"
0x19 OR EOS, ' $25 "ALL UNITS"
0x18 OR EOS, ' $26 "STAR CRUISER 7"
0x0C OR EOS, ' $27 "DESTROYED"
0x1D OR EOS, ' $28 "BY ZYLON FIRE"
0x1E,0x1F OR EOS, ' $29 "POSTHUMOUS RANK IS:"
0xFD, ' $2B "<PLACEHOLDER FOR RANK>"
0x25,0xFC, ' $2C "CLASS <PLACEHOLDER FOR CLASS>"
0x38 OR EOP, ' $2E " "
0x1B OR EOS, ' $2F "STAR RAIDERS"
0x20 OR EOP, ' $30 "COPYRIGHT ATARI 1979"
0x38 OR EOS, ' $31 " "
0x17 OR EOS, ' $32 "STAR FLEET TO"
0x18 OR EOS, ' $33 "STAR CRUISER 7"
0x1A,0x0E OR EOS, ' $34 "MISSION ABORTED"
0x1C,0x14 OR EOS, ' $36 "ZERO ENERGY"
0x24,0x1F OR EOS, ' $38 "NEW RANK IS"
0xFD, ' $3A "<PLACEHOLDER FOR RANK>"
0x25,0xFC, ' $3B "CLASS <PLACEHOLDER FOR CLASS>"
0x27 OR EOS, ' $3D "REPORT TO BASE"
0x28 OR EOP, ' $3E "FOR TRAINING"
0x38 OR EOS, ' $3F " "
0x17 OR EOS, ' $40 "STAR FLEET TO"
0x18 OR EOS, ' $41 "STAR CRUISER 7"
0x1A,0x0F OR EOS, ' $42 "MISSION COMPLETE"
0x24,0x1F OR EOS, ' $44 "NEW RANK IS:"
0xFD, ' $46 "<PLACEHOLDER FOR RANK>"
0x25,0xFC, ' $47 "CLASS <PLACEHOLDER FOR CLASS>"
0x26 OR EOP, ' $49 "CONGRATULATIONS"
0x2C,0x1A OR EOP, ' $4A "NOVICE MISSION"
0x2E,0x1A OR EOP, ' $4C "PILOT MISSION"
0x31,0x1A OR EOP, ' $4E "WARRIOR MISSION"
0x33,0x1A OR EOP, ' $50 "COMMANDER MISSION"
0x38 OR EOS, ' $52 " "
0x34,0x36 OR EOP, ' $53 "DAMAGE CONTROL"
0x37,0x35 OR EOS, ' $55 "PHOTONS DAMAGED"
0x38 OR EOP, ' $57 " "
0x37,0x0C OR EOS, ' $58 "PHOTONS DESTROYED"
0x38 OR EOP, ' $5A " "
0x23,0x35 OR EOS, ' $5B "ENGINES DAMAGED"
0x38 OR EOP, ' $5D " "
0x23,0x0C OR EOS, ' $5E "ENGINES DESTROYED"
0x38 OR EOP, ' $60 " "
0x04,0x35 OR EOS, ' $61 "SHIELDS DAMAGED"
0x38 OR EOP, ' $63 " "
0x04,0x0C OR EOS, ' $64 "SHIELDS DESTROYED"
0x38 OR EOP, ' $66 " "
0x06,0x35 OR EOS, ' $67 "COMPUTER DAMAGED"
0x38 OR EOP, ' $69 " "
0x06,0x0C OR EOS, ' $6A "COMPUTER DESTROYED"
0x38 OR EOP, ' $6C " "
0x22 OR EOS, ' $6D "SECTOR SCAN"
0x35 OR EOP, ' $6E "DAMAGED"
0x22 OR EOS, ' $6F "SECTOR SCAN"
0x0C OR EOP, ' $70 "DESTROYED"
0x21 OR EOS, ' $71 "SUB-SPACE RADIO"
0x35 OR EOP, ' $72 "DAMAGED"
0x21 OR EOS, ' $73 "SUB-SPACE RADIO"
0x0C OR EOP, ' $74 "DESTROYED"
0x01 OR LONG, ' $75 "RED ALERT"
0x38 OR EOS, ' $76 " "
0x17 OR EOS, ' $77 "STAR FLEET TO"
0x18 OR EOS, ' $78 "STAR CRUISER 7"
0x1A,0x0E OR EOS, ' $79 "MISSION ABORTED"
0x24,0x1F OR EOS, ' $7B "NEW RANK IS:"
0xFD, ' $7D "<PLACEHOLDER FOR RANK>"
0x25,0xFC, ' $7E "CLASS <PLACEHOLDER FOR CLASS>"
0x26 OR EOP} ' $80 "CONGRATULATIONS"
Code: Select all
std::string initText = codeLine._code.substr(equalsPos + 1);
Expression::stripWhitespace(initText);
std::vector<std::string> initTokens = Expression::tokenise(initText, ',', true);
Code: Select all
lineToken = Expression::removeCommentsNotInStrings(lineToken);
inp._text += lineToken;
Code: Select all
A = 60
PRINT "JOYSTICKX INIT1f = ";JOYSTICKX
TEST = L_TOKEN AND 0xC0 ' Test Bits 6 and 7
PRINT "JOYSTICKX INIT1g = ";JOYSTICKX
PRINT "TEST = ";TEST
WAIT 500
IF TEST = 0 THEN GOTO SKIP182 ' %00 -> Copy next word to title line
IF TEST = 0x40 THEN GOTO SKIP183 ' %01 -> End-of-phrase, short delay, hide title line
A = 254 ' Title segment lifetime := 60 game loops