Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > .offs in Tubro Macro Pro
2019-01-16 18:43
Marvin
Account closed

Registered: Oct 2003
Posts: 8
.offs in Tubro Macro Pro

The TMP manual gives the following example of the .offs directive:
       * = $2000
start  bit base0
       bit base 
       jmp * 
base0  * = $8000
base   .offs base0-*
       lda #>start
       jmp *

This works fine if you assemble with ←3. However it fails if you try to assemble to an object file (←5).
What's the best workaround to get code that contains .offs assembled to disk?

The only thing I can think of is to assemble to memory ←3, hit 's' to start the code and then save the memory to disk.
2019-01-16 20:03
chatGPZ

Registered: Dec 2001
Posts: 11386
you cant have "holes" (more than one PC assignment) when assembling to disk. you could work around it by putting a loop there that assembles .byte 0 statements until it hits the address you want it to be (but remember you can only skip forwards)
2019-01-16 20:43
soci

Registered: Sep 2003
Posts: 480
Almost. You can have more than one star assignment, however these must be sorted in increasing order. The reason is it can only insert padding zero bytes if the address doesn't go backwards.

For disk .offs doesn't do much unfortunately padding wise in the C64 implementations I know of, so the result will be wrong.

There's a workaround if you arrange it so that the target address is less than the compile address:
*=$1000
jmp i

.offs $100
*=*-$100 ; following assembled to $1003 with PC $f03
i jmp i

.C:1000  4C 03 0F    JMP $0F03
.C:1003  4C 03 0F    JMP $0F03

This gives the same result in memory as on disk.
2019-01-16 22:23
Marvin
Account closed

Registered: Oct 2003
Posts: 8
I don't want any padding in the final result, but maybe I'm missing something regarding the implementation?

Arranging the code so that the target address is always less than the compile address would be at least somewhat helpful, but I can't get your example to work. It writes the entire $1000 - $0f05 range to disk.

I've experimented with this before and tried additional */offs statements to get $1000 - $1005, but it doesn't work. I suppose that I only add an additional $100 bytes to the file and breaks something as I'm trying to write more than 64kb.
2019-01-16 23:04
soci

Registered: Sep 2003
Posts: 480
I've used this one:
Turbo Assembler Macro +++ 20051017
2019-01-16 23:29
chatGPZ

Registered: Dec 2001
Posts: 11386
oh forward skipping worked with pc assignment? ok :) one thing i remember is that after assembling to disk a few times i moved to crossassemblers :=)
2019-01-17 03:07
Six

Registered: Apr 2002
Posts: 293
I was going to point to the online docs, but realized you'd already referenced them. I've had enough trouble getting .offs to work properly that I've often resorted to making multiple files and including them as binaries.
2019-01-17 08:38
Count Zero

Registered: Jan 2003
Posts: 1932
I think the example is a bad choice.
.offs was mostly used for code that is later copied and executed elsewhere. I used it for drive code mostly.
The PC jump here is the culprit as already explained.
2019-01-17 15:03
Marvin
Account closed

Registered: Oct 2003
Posts: 8
Yes, drive code and other relocatable code is what I'm after. A combination of .offs and PC-changes is the only way to make the assembler handle this for me, right?
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Mike
visionvortex
Steffan/BOOM!
Rub_0201
Guests online: 95
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Party Elk 2  (9.6)
4 Cubic Dream  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.074 sec.