GEMDOS - BSS segment

All 680x0 related coding posts in this section please.

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
Cyprian
Atari God
Atari God
Posts: 1404
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

GEMDOS - BSS segment

Postby Cyprian » Wed Aug 02, 2017 6:54 pm

I use BSS segment to save some space in executable file. Till now I put it at the end of my code.
But now I'm wondering if it would be possible to place BSS segment in the middle of the code.
My code generate a huge chunk of a new code and BSS segment allows me to save executable file space.

e.g.

Code: Select all

   SECTION      CODE

      ;generate code for BSS section

   SECTION      BSS
      DS.W   12000
   SECTION      CODE

      ; some other code
   
   SECTION      DATA
      DC.w   0, 1, 2, 3
Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Aranym / Steem / Saint
http://260ste.appspot.com/

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2910
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: GEMDOS - BSS segment

Postby AtariZoll » Wed Aug 02, 2017 7:12 pm

Not possible. Executable file is 1 block: code (text), data , then relocation table. BSS segment starts where reloc table is, and it will be cleared by TOS after relocation. If there is large area with zeros in middle of exec. just use SFX packing.
Negative feedback has usually positive effect.

User avatar
Cyprian
Atari God
Atari God
Posts: 1404
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: GEMDOS - BSS segment

Postby Cyprian » Wed Aug 02, 2017 8:18 pm

Does it mean there is only one "DATA" segment?
Devpac allows to use it more than once, e.g:

Code: Select all

SECTION      CODE
   add.l   D0,A0
   
SECTION      DATA
   dc.l 0,1,2,3

SECTION      CODE
   move.l   D0,A0
   
SECTION      DATA
   dc.w 0,1,2,3
Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Aranym / Steem / Saint
http://260ste.appspot.com/

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 682
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: GEMDOS - BSS segment

Postby mfro » Wed Aug 02, 2017 8:29 pm

Cyprian wrote:Does it mean there is only one "DATA" segment?
Devpac allows to use it more than once, e.g:

Code: Select all

SECTION      CODE
   add.l   D0,A0
   
SECTION      DATA
   dc.l 0,1,2,3

SECTION      CODE
   move.l   D0,A0
   
SECTION      DATA
   dc.w 0,1,2,3


Yes. If you mix code and data, the linker will sort that out again (next data statement will continue where the last one left off). At least if you want to use the GEMDOS executable format, you have to adhere to it (and its contiguous nature).

If you want to have data in the middle of your code, however (e.g. to save some space using short addressing), there is nothing to prevent you from putting that into the code segment.

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1161
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: GEMDOS - BSS segment

Postby Greenious » Wed Aug 02, 2017 8:31 pm

No, you are confusing devpac's abilities/definitions with the executable file format definition defined by Atari.

This explains it all:
http://cd.textfiles.com/ataricompendium ... #processes

And since the header of an executable works with offsets rather than absolute addresses, the BSS segment cannot be moved.
Updated my guides as of june 28th, 2016. Check'em out and feedback!
viewtopic.php?t=5040


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 1 guest