r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[rebcode] Rebcode discussion

Steeve
23-Feb-2007
[1829x2]
mostly Game roms
they don't need multi trheading
BrianH
23-Feb-2007
[1831]
Probably not, then. You might want to wrap this all in a context 
statement to capture the global variables you're using.
Steeve
23-Feb-2007
[1832x3]
currently i'm looking for a good implementation of DDA opcode (Decimal 
adjust for BDC numbers)
quite difficult
*BCD numbers
BrianH
23-Feb-2007
[1835]
BCD numbers in games?
Steeve
23-Feb-2007
[1836]
yes for displaying score or other human readable numbers
BrianH
23-Feb-2007
[1837]
That platform has BCD-based output opcodes? Surprising - most use 
integers and string conversion.
Steeve
23-Feb-2007
[1838x4]
i found one that uses a look-up table of 4096 entries... little big
yes but addition and substractions are performed on char! (byte)
so, this instruction is used to addapt the result in a bcd form
for example if you add 06h and 04h, you get 0Ah which is the correct 
result in byte form, using DAA after such addition, convert the result 
into 10h which is the correct result in BCD form
BrianH
23-Feb-2007
[1842]
DDA operates on a per-byte basis?
Steeve
23-Feb-2007
[1843x2]
yep
DAA instead of DDA (made a mispell)
BrianH
23-Feb-2007
[1845]
How does it handle out-of-range values?
Steeve
23-Feb-2007
[1846]
it sets a flag which we calls carry (like the T flag in rebcode)
BrianH
23-Feb-2007
[1847]
I would think a pickz on a 256-byte binary would do for a lookup 
table, putting a flag value in the invalid slots. Then you could 
react to the flag afterwards.
Steeve
23-Feb-2007
[1848x4]
yes but it's a little more difficult
DAA react diffenrently after an addition or a cubstraction
*substraction
256 entries for the lookup table is not enough
BrianH
23-Feb-2007
[1852]
More than one lookup table, depending on circumstances?
Steeve
23-Feb-2007
[1853]
4096 entries are requested to cover all possiblities
BrianH
23-Feb-2007
[1854]
Perhaps some math to do much of the work would be preferable.
Steeve
23-Feb-2007
[1855]
finally, 4ko, is not so huge
BrianH
23-Feb-2007
[1856]
You are right there...
Steeve
23-Feb-2007
[1857]
*4 kb :-)
BrianH
23-Feb-2007
[1858]
I forget (and don't have rebcode installed on this PC), what happens 
if you pick out-of-range in rebcode?
Steeve
23-Feb-2007
[1859x4]
don't konw , never occured
i test
** Script Error: Out of range or past end
** Where: f
** Near: pickz a b 10
quite good
BrianH
23-Feb-2007
[1863]
Not for what I was thinking. I was trying a multistep process where 
the need for the next step is determined by whether the pick of the 
earlier succeeded. I suppose the same could be accomplished by math, 
but a pick would have allowed smaller lookup tables.
Steeve
23-Feb-2007
[1864]
and using past?
BrianH
23-Feb-2007
[1865]
How does the DAA react differently after an add or a sub? Could you 
simplify things by combining the add/sub and the daa into a larger 
logical opcode? It occured to me, looking at your code earlier, that 
you could combine strings of opcodes that didn't include writes to 
memory into larger virtual opcodes, to cut down on interpreter overhead 
when not necessary.
Steeve
23-Feb-2007
[1866]
i see, but DAA not follows sub or add opcodes, he can act severall 
opcodes later
BrianH
23-Feb-2007
[1867]
It would mean more branch tables or some branch index arithmetic, 
but the interpreter could be made much faster in certain cases.
Steeve
23-Feb-2007
[1868]
Z80 just remember if the last math operation was an add or a substract
BrianH
23-Feb-2007
[1869]
What is the effect of the add/sub that affects the DAA? Is it some 
flag?
Steeve
23-Feb-2007
[1870x2]
yes a flag, but this flag is not visible
so in rebcode , i will have to manage this trick by myself, with 
seting my own DaaFlag after a sub or an add
BrianH
23-Feb-2007
[1872]
Sorry, that answers my question. Perhaps putting the DAA implementation 
in the blocks of an either statement on that flag would lessen the 
lookup overhead.
Steeve
23-Feb-2007
[1873]
*by setting
BrianH
23-Feb-2007
[1874]
I'm curious as to what the effect really is. Perhaps a positive/negative 
issue?
Steeve
23-Feb-2007
[1875x2]
you can sse the trick here http://www.zilog.com/docs/z80/um0080.pdf
*see
BrianH
23-Feb-2007
[1877x2]
So, it looks like 3 flags, one of which may be set afterwards, and 
some ranges. Either that means some really interesting math, or a 
4096 byte lookup table :(
What's the H flag?