need 24bit registers help
- YasaSheep
- Posts: 205
- Joined: November 20th, 2005, 04:04
- Location: Portland (Also the discord)
- Contact:
need 24bit registers help
I just wanna make sure this is right cause I don't really understand it. I'm using x1 to address a variable location that has to be calculated. If I add to x1 and it goes above 0xFFFF will it spill over into XI as I expect? Even better, can I just mul l,a and HL will spill into I if it goes above 0xFFFF? That'd be a time saver.
need 24bit registers help
nope, if you do an operation on a register you only do an operation on THAT register. There are no overflows into other registers. For overflowing X1 into XI you have to move XI to A then do addc A, 0 and then move A back to XI... i believe
- YasaSheep
- Posts: 205
- Joined: November 20th, 2005, 04:04
- Location: Portland (Also the discord)
- Contact:
need 24bit registers help
Okay.. so what about just moving an address? I'm not sure what happens in mov x1,map1 but I do know that mov x2,cmap; mov [x2],x1 only moves two bytes. I'd like to store all three bytes.. do I have to do: mov x1,strings; movx a,strings; mov x2,cmap; mov [x2],a; inc x2; mov [x2],x1 ?
need 24bit registers help
Dont know what you are doing with x1 and movx a, strings (that opcode doesnt exist afaik because a, b and BA arent addressing registers)... but lets keep it general: If you want to store 3 bytes then you'll have to do a 1 and a 2 byte write operation. mov [x1], a ; inc x1 ; mov [x1], x2 - something like that. For adressing there are seperate 8 bit HIGH adress register for HL ( the I register), one for x1 and one for x2 - these can have different values. The adressing of the PM is 21 bit internally not 24 bit (even though you have to write 24 bits into the registers)... paged memory is a thing you find out best by trial and error
- YasaSheep
- Posts: 205
- Joined: November 20th, 2005, 04:04
- Location: Portland (Also the discord)
- Contact:
need 24bit registers help
Oh whoops, I was trying to take the first byte out of the address and put it into the a.. "strings" was also supposed to be "map1" So I guess the question was how to read the first byte of an address.
need 24bit registers help
Don't know if you've solved this yet, but it struck me today that one possible solution would be to force the page using the .org keyword, so at least you know what value to put in the high byte. That is: ".org $40000" will put the next 64k on page 4. Probably.