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
[1966x3]
gt.i decal 127 ift [sub.i decal 256]
by this: ext8 decal
eureka !!!!
BrianH
23-Feb-2007
[1969]
Looks like.
Steeve
23-Feb-2007
[1970x2]
thi code is the macro i use the most
*is in the macro
BrianH
23-Feb-2007
[1972]
I wonder how much other code generated by your macros could be optimized...
Steeve
23-Feb-2007
[1973x3]
not as much as that
i hope
but surely some of them
BrianH
23-Feb-2007
[1976x3]
Perhaps some of those and x 255 operations could be put off until 
the value is written to memory.
While the values are in the registers, who cares what precision they 
are internally.
It would make the C flag easy to keep track of. Perhaps some of the 
multibyte operation sequences could be combined.
Steeve
23-Feb-2007
[1979]
hum
BrianH
23-Feb-2007
[1980]
Where it matters you could replicate the overflow behavior on purpose.
Steeve
23-Feb-2007
[1981]
but you see, the 8bit registers are often combined into 16bits registers, 
so i should perform AND 255 before to translate them into 16 bit, 
i'm not sure  there is a real gain
BrianH
23-Feb-2007
[1982x4]
That combination of 8-bit values into 16-bit registers has got to 
be a common code pattern. Are the 16-bit operations distinct from 
the 8-bit ones? This is the kind of code pattern that you could combine 
and optimize. Internally, do you need to have the 16-bit registers 
be a combination of the 8, or could they be seperate and have their 
values transfered over if it would be faster?
Are the 16-bit values loaded in one statement or two?
Need there be a difference?
It's what the modern processor designers call register renaming :)
Steeve
23-Feb-2007
[1986x2]
sorry,
disconnected
not sure to understand what u mean
BrianH
23-Feb-2007
[1988x2]
I would have to read your Z80 manual to be sure, but it seems to 
me that these 16-bit operations seem to be great candidates for opcode 
combining. It may even be a good idea to have the 16-bit registers 
be seperate variables internally.
At the very least you should have seperate macros for 16-bit reads 
from and writes to memory, rather than a combination of 8-bit ops.
Steeve
23-Feb-2007
[1990x3]
but i'm afraid that synchronization of 16bits registers with the 
8bits (transfer of values) cause an overhead
what u gain in one side, u lost it in the other side
synchronisation needs more operations
BrianH
23-Feb-2007
[1993]
How does that overhead compare to that of doing it the straight-forward 
way? Remember that every loop of the interpreter is overhead.
Steeve
23-Feb-2007
[1994x11]
moreover , i'm not that writing/reading  a word in memory is more 
faster than to write/read 1 byte 2 times
*i'm not sure
i explain
because instructions in rebcode are different
i have to test
to write a word, u need to use change
and you need to build a binary data
for example to write 01 and 02 , you need to build the serie #{0102}
u see what i mean ?
u can not just write a 16 bit value like that
i could handle 16 bit registers directly in binary series
BrianH
23-Feb-2007
[2005]
Yeah, that is likely slower. You are likely to have to do some bytewise 
reads and writes internally. You would be faster if you had seperate 
read/write macros for the 16-bit load/store instructions.
Steeve
23-Feb-2007
[2006x3]
hu ?
what are you saying ?
i said that the faster way is to write 2 times 8bit instead of writing 
16 bit in one time
BrianH
23-Feb-2007
[2009]
I was agreeing.
Steeve
23-Feb-2007
[2010x3]
so there is no optimization to have different macro for access/writing 
16bit or 8bits registers
ah ok
'scuse me
BrianH
23-Feb-2007
[2013]
I wonder if there would be a fast way to cache the 16-bit values 
in _HL, _BC and such, and writing them quickly.
Steeve
23-Feb-2007
[2014x2]
that could be faster if 16 bits register was handled internally as 
binary series
but that will be a problem to perform math operation on them