World: r3wp
[rebcode] Rebcode discussion
older newer | first last |
Steeve 23-Feb-2007 [2004] | 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 | |
BrianH 23-Feb-2007 [2016] | It occurs to me that overflow on these inserts isn't handled the way you think. |
Steeve 23-Feb-2007 [2017x2] | ? |
explain | |
BrianH 23-Feb-2007 [2019] | If you poke a value over 255 into a string/binary, the upper bytes may be ignored rather that triggering an overflow error. Test that. |
Steeve 23-Feb-2007 [2020] | ok |
BrianH 23-Feb-2007 [2021] | It might save on some AND x 255 statements. |
Steeve 23-Feb-2007 [2022] | could be a usefull trick if it works |
BrianH 23-Feb-2007 [2023] | It doesn't work in REBOL code, but it might in rebcode. |
Steeve 23-Feb-2007 [2024x4] | you're right |
the upper byte of 16bit value is not kept | |
hum | |
so i could remove some and var 255 from my code | |
BrianH 23-Feb-2007 [2028] | That provides a way to optimize the 16-bit load/store ops, particularly if there are 16-bit registers. |
Steeve 23-Feb-2007 [2029] | hmm... |
BrianH 23-Feb-2007 [2030] | You could invalidate the affected 16-bit register if you use an 8-bit op, or perhaps combine 2 8-bit load/stores that would add up to a 16-bit load/store into their 16-bit operation. |
Steeve 23-Feb-2007 [2031] | perhaps... |
BrianH 23-Feb-2007 [2032x2] | This would be so much easier without self-modifying code - then we could just compile the code and be done with it. |
BTW, don't forget the ROTL and ROTR opcodes. They may help with 16-bit combination registers. | |
Steeve 23-Feb-2007 [2034x5] | hum, i think that write/read the 16bits register into/from memory need more instructions if i follow you |
because we perform 2 read/write ,even for 16bits registers, right ? | |
currently to write _bc register in memory , i write: pokez mem adr _c add.i adr 1 pokez mem adr _b | |
if _bc is handle as a 16 bit value, i need to do: pokez mem adr _bc add.i adr 1 rotr _bc 8 pokez mem adr _bc rotl _bc 8 | |
right ? | |
BrianH 23-Feb-2007 [2039x2] | I don't know, I haven't found the stores in your code yet. |
Is the Z80 a strict load/store architecture, or do they have other operations that can reference memory? | |
Steeve 23-Feb-2007 [2041] | i don't understand what u mean, Z80 is not concerned, that is how we perfom updates in memory with rebcode |
BrianH 23-Feb-2007 [2042] | I am asking if operations like ADD can add values directly to/from memory like it can on x86, or does it have to load first and store after? |
Steeve 23-Feb-2007 [2043x2] | no, only registers can read/wites memory |
Z80 can only perform operations on registers | |
BrianH 23-Feb-2007 [2045] | OK, strict load/store. |
Steeve 23-Feb-2007 [2046x3] | anyway that is not the problem, i just said, that handling 16bits registers in 16 bits values instead to have 2 register of 8 bits is much slower when we have to read/write into memory |
plus lost of time due to the syncronization between 16 and 8 bits registers | |
finally i'm not sure that it's a good idea to separate them | |
BrianH 23-Feb-2007 [2049] | Well, I would have to read more of that document to agree with you or not :( |
Steeve 23-Feb-2007 [2050x4] | but we would have a gain when performing operations between 16 bits registers |
quite balanced | |
in C it will not be a problem, 8 bits registers and 16 bits registers will share the same space adressing. | |
it's missing in rebol | |
older newer | first last |