Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user zschunky ! (Registered 2019-02-20) You are not logged in 
CSDb User Forums


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

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
Groepaz

Registered: Dec 2001
Posts: 9021
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: 419
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

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: 419
I've used this one:
Turbo Assembler Macro +++ 20051017
2019-01-16 23:29
Groepaz

Registered: Dec 2001
Posts: 9021
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: 228
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: 869
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

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
Skate/Plush
JackAsser/Booze Design
Zirias/Excess
Guests online: 57
Top Demos
1 Unboxed  (9.7)
2 Uncensored  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 Comaland 100%  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 Wonderland XII  (9.6)
9 C=Bit 18  (9.6)
10 X Marks the Spot  (9.5)
Top onefile Demos
1 Smile to the Sky  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 Dawnfall V1.1  (9.4)
4 FMX Music Demo  (9.4)
5 Crystal Gazer  (9.4)
6 Rewind  (9.4)
7 Pandemoniac Part 2 o..  (9.4)
8 Official X2018 Report  (9.4)
9 Arok 20 Invitation  (9.4)
10 Party Horse  (9.3)
Top Groups
1 PriorArt  (9.7)
2 Performers  (9.5)
3 Oxyron  (9.5)
4 Booze Design  (9.4)
5 Censor Design  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Splatterhead  (9.8)
3 Zyron  (9.8)
4 Walker  (9.7)
5 Acidchild  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2019
Page generated in: 0.061 sec.