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
[2066x3]
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
[2082x4]
ext8 (128 + 65536) = -128 instead of 128
fooooollll
no it works
ext 128 = -128
BrianH
24-Feb-2007
[2086x3]
I'm thinking that you may be able to efficiently store your 8-bit 
registers in your 16-bit registers and break them out when you need 
them.
Internally, they would really be 32-bit registers, of course.
Is the accumulator internally 8 or 16-bit?
Steeve
24-Feb-2007
[2089x3]
8
it is A
_a in my source
BrianH
24-Feb-2007
[2092]
What do 16-bit arithmetic instructions use for an accumulator?
Steeve
24-Feb-2007
[2093x2]
HL
but most of instructions act on A
BrianH
24-Feb-2007
[2095]
Is 8-bit or 16-bit code more common?
Steeve
24-Feb-2007
[2096x6]
8 bit
because it's more compact and faster
and many operations occur only on 8 bit registers
like rotation operations
and bit manipulations
but the first reason is that 8bit register operations are faster
BrianH
24-Feb-2007
[2102x2]
Well, there is no reason to change that balance - the code expects 
it. 16-bit operations can be sped up using a few tricks if necessary, 
like temporary registers that are used internally. You can even name 
those registers _bc, _de and _hl if you like :)
Do the rotation instructions affect the carry flag?
Steeve
24-Feb-2007
[2104x5]
some of them, it's an option
the carry flag can be injected to the left or to the right
or not
there are 12 different rotations
Z80 is good with rotation
BrianH
24-Feb-2007
[2109]
How does your code handle exchanges?
Steeve
24-Feb-2007
[2110x3]
badly
label EXX
	set.i tmp _b set.i _b _b' set.i _b' tmp 
	set.i tmp _c set.i _c _c' set.i _c' tmp
	set.i tmp _d set.i _d _d' set.i _d' tmp
	set.i tmp _e set.i _e _e' set.i _e' tmp
	set.i tmp _h set.i _h _h' set.i _h' tmp
	set.i tmp _l set.i _l _l' set.i _l' tmp
	(cont)
exchange of  b, c, d ,e , h , l, with b' , c', d', e', h', l'
BrianH
24-Feb-2007
[2113]
It could be worse.
Steeve
24-Feb-2007
[2114]
i don't see how :-)
BrianH
24-Feb-2007
[2115]
You could be accessing all of those values indirectly to make the 
swap easier, but slowing down everything else :)