jacobus Posted August 7, 2016 Share Posted August 7, 2016 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! Quote Link to comment Share on other sites More sharing options...
jacobus Posted August 8, 2016 Author Share Posted August 8, 2016 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) 1 Quote Link to comment Share on other sites More sharing options...
pirx Posted August 8, 2016 Share Posted August 8, 2016 buuuuuuut, how it is being loaded from $0000? This can't possibly work outside emulator (?) 1 Quote Link to comment Share on other sites More sharing options...
Bunsen Posted August 8, 2016 Share Posted August 8, 2016 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. Quote Link to comment Share on other sites More sharing options...
Rybags Posted August 9, 2016 Share Posted August 9, 2016 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. Quote Link to comment Share on other sites More sharing options...
Rybags Posted August 9, 2016 Share Posted August 9, 2016 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. Quote Link to comment Share on other sites More sharing options...
phaeron Posted August 9, 2016 Share Posted August 9, 2016 Why not just wrap a load segment around the assets and concatenate them with the Quick executable? It's pretty easy to pull in binary files in MADS assembly. Quote Link to comment Share on other sites More sharing options...
snicklin Posted August 9, 2016 Share Posted August 9, 2016 Wouldn't it be nice if we just had a Quick cross-compiler so that we didn't have to worry about the 20K limit? Quote Link to comment Share on other sites More sharing options...
baktra Posted August 9, 2016 Share Posted August 9, 2016 (edited) 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;IntroD:INTRO.PIC, 12288D:INTRO.OBJ ;Init vector - show introINIT 14336;Data;CharsetsD:SADA1.FNT, $4000D:SADA2.FNT, $4400;PicturesD:MAPA.PIC, $4800;Main ProgramD:MUJPROGR.OBJ ;Run vectorRUN $5000 Edited August 9, 2016 by baktra 2 Quote Link to comment Share on other sites More sharing options...
baktra Posted August 9, 2016 Share Posted August 9, 2016 Here are the instructions translated to English. linker.pdf 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.