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

World: r3wp

[rebcode] Rebcode discussion

Steeve
13-Feb-2008
[2346]
i' made a Z80 emulator using rebcode (not complete), you can see 
it in galaga.r on rebol.org
Geomol
13-Feb-2008
[2347]
Ah, that was you. Someone mentioned that one lately.
Steeve
13-Feb-2008
[2348x3]
ah BrianH, i remember that you made the same proposal for my z80 
emu (peephole optimzation)
hard to do
interesting to do on ROMs (static analysis before to launch the code) 
but not valuable in RAM because the code can be modified
Geomol
13-Feb-2008
[2351]
Steeva, about flags: e.g. the zero flag Z (bit 1 of P). In stead 
of that I set it each time A, X or Y become zero, I could save any 
of those (A, X or Y) in a variable, and then test on that var and 
set the flag correctly, if and when the flag is actual used. Is that 
what you mean?
Steeve
13-Feb-2008
[2352x3]
and limited because on 6502 for example, many branchements are calculated 
(not statics)
yes Geomol, it's that
Flags are calculated on the last accumulator value if i don't do 
mistakes
Geomol
13-Feb-2008
[2355]
ok. One optimization, I consider, is to cross-compile 6502 opcodes 
to rebcode, instead of emulating the 6502. That won't work with self-modifying 
code and branches will be a problem. So it's hard, but I think, it 
might work.
Steeve
13-Feb-2008
[2356x2]
in theory
i give you an example with the TAX opcode

; updating flags in real time

label TAX
seti X A
eq X 0
either [or P 2] [and P 253]
seti i X
and i 128
eq i 128
either [or P 128] [and P 127]
bra continue

;  delay the calcul of flags

label TAX
seti X A

or maskA (2 + 128)     ; remember that we have to recalculate zero 
and negative flags using A, but don't do it now
bra continue
Geomol
13-Feb-2008
[2358]
Thanks!
Steeve
13-Feb-2008
[2359]
you got the idea ? ;-)
Geomol
13-Feb-2008
[2360]
Yup! :)
Steeve
13-Feb-2008
[2361x2]
did you think that using PC as an offset (integer) instead of as 
a serie could be faster ?
I should do a test before saying that
Geomol
13-Feb-2008
[2363]
I didn't consider much in deep actually. It can be improved, I'm 
sure. :)
Andreas
7-Jan-2010
[2364]
anyone happes to still have a rebol/core binary with rebcode functionality 
archived somewhere?
Steeve
7-Jan-2010
[2365]
it's not in the download section of rebol.com anymore ?
Andreas
7-Jan-2010
[2366x2:last]
ah, got it: http://www.rebol.net/builds/042/rebview1350042.tar.gz
resp. http://www.rebol.net/builds/031/rebview1350031.exefor windows