> Do you guys feature any kind of "nonstandard" CPU usage in your programs
> (such as undocumented mnemonics, self-modifying code, stack feedback...)?
undocumented mnemonics I've used many times, but only these:
ld a,IXH etc... (adding 0DDh or 0FDh in front of mnemonics using H or
L registers causes use of IXH or IXL)
not extremely useful, I must add...
self modifiying code I've used many times, most notably for the protection
code of ARC (see webpages) and for the scrolling routines of Akin/Core Dump,
where I needed a pseudo mnemonic for this:
ld A,(table_address+A)
(where table_address is some constant) This needed to be extremely quick,
change as few registers as possible, etc. etc...
solution:
(1) constraint: (table_address div 256 == 0). in other words: the lowbyte is
zero.
(2) macro:
macro ldm(@table_address)
ld (@$YMldmx+1),A
@$YMldmx:
ld a,(@table_address)
endm
notation: @$YM precedes any label in a macro that is needed for every single
macro, and is replaced by a number. "@" signifies a macro parameter.
what happens is this: the first "ld" modifies the code of the second "ld",
changing the lower byte of the table_address constant. Because of the
constraint, this equals addition of A to the table_address constant.
I've found this to be very useful in the scrolling routines. The macro
consists of two commands (7 ticks each if memory serves me), and no
registers are changed except for A, which is the best you can get here. I
hope ;)
cheers,
Cas
--
Parallax !!
http://www.stack.nl/~cas/par/
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****