Offsets
Re: Offsets
Let's all kiss and make up eh?
Right then, so now we're back on track what's the best way to control the offset directive? Could it be something as simple as using 'offs <value>' to set it and then 'offs' without a value to cancel it? Sounds too easy to me...
Right then, so now we're back on track what's the best way to control the offset directive? Could it be something as simple as using 'offs <value>' to set it and then 'offs' without a value to cancel it? Sounds too easy to me...
Try out CBM prg Studio for all your Commodore development needs!
Stay a while...stay for erm quite a while!
Stay a while...stay for erm quite a while!
Re: Offsets
yes, that was my whole point. use directives, and dont tie it to a scope (like kickassembler does) - because that creates the problems that kickassembler does have =P
Re: Offsets
A couple more questions:
1) Does the offset only apply to 16 bit addresses, or could you apply it to zero page too?
2) Does the 65816 us offsets in the same way?
1) Does the offset only apply to 16 bit addresses, or could you apply it to zero page too?
2) Does the 65816 us offsets in the same way?
Try out CBM prg Studio for all your Commodore development needs!
Stay a while...stay for erm quite a while!
Stay a while...stay for erm quite a while!
Re: Offsets
it should be applied to all addresses that are located between the .offs and .endoffs (or whatever you call it) directivesDoes the offset only apply to 16 bit addresses, or could you apply it to zero page too?
that technique can be used in any architecture, so yes, sureDoes the 65816 us offsets in the same way?
Re: Offsets
How can offsets be applied to zero page? For example if I've set a 1000 byte offset and then assemble some zero page code, I would end up with a 16 bit address which would change the addressing mode. Or should I just guard against this and return an error of the address is too large for the instruction's address mode?
Try out CBM prg Studio for all your Commodore development needs!
Stay a while...stay for erm quite a while!
Stay a while...stay for erm quite a while!
Re: Offsets
first off all, dont think "offset" but "program counter base" - which is what it really is. look at this:
basically in your assemble you need to have two address pointers, one that is (only) used for placing the code in memory, and another that is used as the program counter when generating ml code.
Code: Select all
* = $1000 ; place code at $1000
.org $02 ; assemble as if it is placed at $02
lda tab ; assembles lda zp
tab: .byte 0
.reloc
Re: Offsets
Yes, but what if the code is like this:dudz wrote:basically in your assemble you need to have two address pointers, one that is (only) used for placing the code in memory, and another that is used as the program counter when generating ml code.
Code: Select all
* = $1000 ; place code at $1000
.org $2000 ; assemble as if it is placed at $2000
lda tab ; assembles lda zp
tab: .byte 0
.reloc
Try out CBM prg Studio for all your Commodore development needs!
Stay a while...stay for erm quite a while!
Stay a while...stay for erm quite a while!
Re: Offsets
You've answered your own question there Arthur.ajordison wrote:Yes, but what if the code is like this:dudz wrote:basically in your assemble you need to have two address pointers, one that is (only) used for placing the code in memory, and another that is used as the program counter when generating ml code.'tab' isn't in page zero now, or am I missing something here?Code: Select all
* = $1000 ; place code at $1000 .org $2000 ; assemble as if it is placed at $2000 lda tab ; assembles lda zp tab: .byte 0 .reloc
Re: Offsets
My mistake. The code was supposed to be:
So like I said, 'tab' is effectively at $2002 now so how could this work?
Code: Select all
* = $02 ; place code at $02
.org $2000 ; assemble as if it is placed at $2000
lda tab ; assembles lda zp
tab: .byte 0
.reloc
Try out CBM prg Studio for all your Commodore development needs!
Stay a while...stay for erm quite a while!
Stay a while...stay for erm quite a while!
Re: Offsets
AJ,
For a decent explanation of how all this works (instead of getting your info here in small pieces) you might want to take a look at Soci's 64Tass assembler docs (and source). The assembler has actually been around long before Soci took it over. It's written in C and covers everything you're asking about. We're getting into multiple concepts here, too, and not just offset coding. The zero page data sounds more like a thing called a section in 64Tass.
I sat here last night trying to answer your question about the zp data, and I kept turning my answer into spaghetti. That's when I realized it's an answer too long for a forum post. If you need help finding any of that stuff, give me a jingle.
For a decent explanation of how all this works (instead of getting your info here in small pieces) you might want to take a look at Soci's 64Tass assembler docs (and source). The assembler has actually been around long before Soci took it over. It's written in C and covers everything you're asking about. We're getting into multiple concepts here, too, and not just offset coding. The zero page data sounds more like a thing called a section in 64Tass.
I sat here last night trying to answer your question about the zp data, and I kept turning my answer into spaghetti. That's when I realized it's an answer too long for a forum post. If you need help finding any of that stuff, give me a jingle.
Who is online
Users browsing this forum: No registered users and 5 guests