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

World: r3wp

[rebcode] Rebcode discussion

BrianH
23-Feb-2007
[2033]
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
BrianH
23-Feb-2007
[2054]
Do you mean union types?
Steeve
23-Feb-2007
[2055x3]
yesp, that's what i mean
that will be the solution
definitivly
BrianH
23-Feb-2007
[2058]
Ah, according to the docs, Z80 is not strictly load/store.
Steeve
23-Feb-2007
[2059]
but the instructions which operate directly in memory are rarely 
used, because they consume more time.
BrianH
23-Feb-2007
[2060]
More time than the combination of a load to a register and an add 
from that register?
Steeve
23-Feb-2007
[2061x2]
yes
depending what operations follows , but right the most time
BrianH
23-Feb-2007
[2063]
Wow. It's the same amount of work, in fewer instructions, and it 
takes more time. How does that happen? Microcode?
Steeve
23-Feb-2007
[2064x5]
the reason is that most register operations use one opcode ob one 
byte length
*of one byte length
operation into memory use an opcode of 3 to 6  byte length
so in 1 operation into memory , we can perform several operation 
with registers
*so during 1 operation
BrianH
23-Feb-2007
[2069]
How many bytes in a load from memory? I suppose on the addressing 
mode...
Steeve
23-Feb-2007
[2070]
3
BrianH
23-Feb-2007
[2071]
*it depends on the addressing mode
Steeve
23-Feb-2007
[2072x2]
yep, you're right
3 is the minimum
Steeve
24-Feb-2007
[2074x4]
one for the operation opcode and 2 for the address on 16 bits
but in fact it can be occured in one opcode of  length 1, if the 
adress is already contained in one 16 bit register .
that's mostly the case
so, the correct answer is: 1
BrianH
24-Feb-2007
[2078]
What happens if you EXT8 a value that already has data in the higher 
bytes? I'm guessing it will just overwrite that data...
Steeve
24-Feb-2007
[2079]
wrong
BrianH
24-Feb-2007
[2080x2]
What happens? I don't have rebcode here to test.
I'm going off docs and memory here.
Steeve
24-Feb-2007
[2082]
ext8 (128 + 65536) = -128 instead of 128