Jump to content
IGNORED

RAM to EXE utility


Recommended Posts

I'm trying to accomplish to a work-around for some of Quick's limitations - namely the 20K program code limit. With the standard compiler, I have two options for a program, a) include all secondary data (graphic, sound, DL, etc) within the program space and create a standalone executable, or b) off-load everything but program code and load the secondary data into memory at run time. The problem with a) is it severely limits the amount of code in a program, the problem with b) is that I need to create and distribute an entire disk with the main executable and all of the secondary files. Ideally I'd like to be able to run the application, have it load up memory with the secondary data and then snapshot the contents of RAM into an executable that when loaded would populate memory with both the code and the secondary data.

 

Not sure if such a utility exists within the Atari, or I should be looking at a tool that could perhaps modify an Altirra save state file.

 

Any ideas would be greatly appreciated!

 

Link to comment
Share on other sites

I played around with the Altirra .altstate format and figured out a solution. If anyone is interested, I've included some VBS scripting code to convert the .Altstate file to an XEX.

 

 

Command line batch file (input file, output file)


cscript MakeXEX.vbs zatest.altstate zatest.xex

 

VB Script file (MakeXEX.vbs)

Dim fso
Dim fH
Dim InFileName 
Dim OutFileName
Dim StrData
Dim Header

Dim BinaryLoadFile
Dim StartLoadAddr
Dim EndLoadAddr
Dim RunAddr

'set parameters
 BinaryLoadFile = Chr(255) & Chr(255)
 LoadAddrStart = Chr(0) & Chr(0) 
 LoadAddrEnd = Chr(191) & Chr(253)
 RunAddress = Chr(0) & Chr(80)

'create file object
 Set fso = CreateObject("Scripting.FileSystemObject")

'get command line
 InFileName = Wscript.Arguments(0)
 OutFileName = Wscript.Arguments(1)

'open source file
 fSize = fso.GetFile(InFileName).Size
 Set fH = fso.OpenTextFile(InFileName)
 StrData = fH.Read(fSize)
 fH.Close

'strip Alirra 2.6 header
 StrData=Mid(StrData,260,65796)

'trim to 48K
 StrData = Mid(strData,1,49150)

'add new header
 Header = BinaryLoadFile & LoadAddrStart & LoadAddrEnd
 StrData = Header & StrData

'add footer
 StrData = StrData & RunAddress

'save dest file
 Set fH = fso.CreateTextFile(outFileName, True)

' Write
 fH.Write StrData
 fH.Close

Just make changes to the 'Set Parameters" section to adapt to your requirements. (Currently set to load all of RAM from $0000 to $BFFD and then execute at $5000)

 

The script also assumes .Altstate format 2.6 (not sure if this changes very often)

  • Like 1
Link to comment
Share on other sites

Ideally I'd like to be able to run the application, have it load up memory with the secondary data and then snapshot the contents of RAM into an executable that when loaded would populate memory with both the code and the secondary data.

 

No problem for Turbo Freezer.

Link to comment
Share on other sites

You can load snapshots into low memory $00-$3FF by buffering elsewhere then moving as the last operation before running.

But it's in no way guaranteed. The Ram based vectors will probably be different if the OS isn't the same so guaranteeing a crash.

 

A better way would be to make sure your program can survive a warmstart and just snapshot higher memory although doing the top half of Page 0 as well should be OK.

Link to comment
Share on other sites

You can load snapshots into low memory $00-$3FF by buffering elsewhere then moving as the last operation before running.

But it's in no way guaranteed. The Ram based vectors will probably be different if the OS isn't the same so guaranteeing a crash.

 

A better way would be to make sure your program can survive a warmstart and just snapshot higher memory although doing the top half of Page 0 as well should be OK.

Link to comment
Share on other sites

I think what you need is a linker - a program that adds segments to a binary file created by QUICK.

A decent linker that runs on Atari is in FLOP diskmag #37, side B - http://flop.atariportal.cz/archives/Flop_37.zip

 

If it is something you are looking for, I can translate the instructions from Czech to English.

In essence, the linker looks for LINK.PRJ file that contains instructions for it, e.g.

 

;Resulting binary file
;©D:FINAL.COM
;Intro
D:INTRO.PIC, 12288
D:INTRO.OBJ

;Init vector - show intro
INIT 14336
;Data
;Charsets
D:SADA1.FNT, $4000
D:SADA2.FNT, $4400
;Pictures
D:MAPA.PIC, $4800
;Main Program
D:MUJPROGR.OBJ

;Run vector
RUN $5000

Edited by baktra
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...