English Amiga Board

Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

Thread Tools
Old 25 January 2020, 12:05   #1
This cat is no more
jotd's Avatar
Join Date: Dec 2004
Location: FRANCE
Age: 49
Posts: 4,461
assemblers LOAD & ORG directives

I'm currently analyzing the code from ... Jim Power (for a possible CD32 remake)

I'm trying to rebuild it using VASM and I have issues. After having fixed obvious syntax differences I'm facing a bigger problem.

The boot/loader is ORGed at $400

Now this code references level sections, all ORGed at the same $5800 address. ALL OF THEM. It uses PC-relative addressing and .W addresses to save space (the final code for 1 level doesn't exceed 32k)

It means that the code is like this

     ORG $400
     ; boot/loader/shared

     ORG $5800

     IFEQ LEVEL-5  ; level 5
     LOAD $5800
     LOAD $178000

    ; same goes for all levels
What I understand is that the programmer wanted that the boot ($400) references/sees ALL symbols for all levels at the same time (with possible overlap) and tells the asm to skip it using this LOAD directive.

LEVEL is set at 1 in the code, but I suppose that the program is assembled 5 times and the module in $5800 is extracted each time to be put on disk.

The important thing is that it's easy to reference ANY of the levels from boot program, regardless of it being loaded or not (when the level isn't active, LOAD directive loads the program in some 2MB extension, just to tell the asm to get lost, while still ORGing the code at $5800 for proper relocs)

Problem is VASM doesn't seem to support "LOAD" directive. Seems that I'm stuck: how to set the proper offsets in loader for programs that overlap?

Another option would be to tell ORG to get lost, considering that the requirements for memory isn't as strict as before (Jim Power uses 512k chip only AFAIR). The aim is a CD32 conversion, so 2MB memory. Maybe this overlay not necessary. Just assemble everything in one section, skip the ORG & overlayed loading of level code in the game, correct the PC-relative addressing when not possible (replace by absolute), shift the data section (used for graphics/sounds/screen buffers...) and we have a 1MB chip game with simpler loading design.
jotd is offline  
Old 25 January 2020, 22:28   #2

phx's Avatar
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,731
I have only a minute to reply. I will check your problem in more detail tomorrow.

But what I can say is that the only LOAD directive I know is the one from Seka and AsmOne, which copies the assembled code directly to the given address in memory. This is nothing you usually want to do. Especially not in a cross-assembling environment. Therefore vasm ignores LOAD with a warning.

So the most important question is: where did the LOAD come from? Was is emitted by a reassembler? Did you write it yourself? Did you find an old source? Which meaning do you think it should have?
phx is offline  
Old 25 January 2020, 22:52   #3
This cat is no more
jotd's Avatar
Join Date: Dec 2004
Location: FRANCE
Age: 49
Posts: 4,461
thanks for replying, no need to investigate more, I think I figured it out.

The LOAD (yes, it's probably SEKA that they were using) was of course present in the source from Jim Power (as stated in the first post). It's a very clever way to create overlayed game code while hooking to the existing low-address boot code and be able to test it.

I found out later that the actual released game had more files to load than the source I'm seeing. And those extra files are loaded at the very address of the LOAD, from disk. I suppose that the makers just dumped the memory to create them in the end. The source was configurable (with level as a constant), allowing them to test such or such level

But nevermind. I just removed the LOAD & ORG directives as I have enough chipmem (game shoehorned in 512k I don't need that), shifted the data area by $10000 bytes, fixed the parts where branch distance is too long now, that should do it. Thanks again for VASM too (game assembles in less than 1 second)

It's just great to be able to check this source and all the tricks. Fernando Velez was a very good coder (I heard he passed away in 2018). I've been asked to look into it to see if we can revamp it for the CD32.
jotd is offline  
Old 26 January 2020, 14:03   #4
Zone Friend
kamelito's Avatar
Join Date: May 2006
Location: France
Posts: 1,194
Show us the code
kamelito is offline  
Old 26 January 2020, 16:00   #5
This cat is no more
jotd's Avatar
Join Date: Dec 2004
Location: FRANCE
Age: 49
Posts: 4,461
I wish that I could, but I can't
jotd is offline  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Save & Load States Washac support.FS-UAE 4 20 May 2018 15:13
Macro68k compatible cross assemblers kamelito Coders. Asm / Hardware 3 28 October 2015 10:38
FS-UAE Portable with Kickstart, WHD-Load-Key & ClassicWB rotaxt support.FS-UAE 2 03 October 2014 02:29
atari2600.org jman Retrogaming General Discussion 9 25 August 2011 00:07
Amiga.org Amigaboy Amiga websites reviews 9 02 February 2005 10:13

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 02:22.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06788 seconds with 15 queries