Google Grupper understøtter ikke længere nye Usenet-opslag eller -abonnementer. Tidligere indhold er fortsat synligt.

Load binary file using Assembler

84 visninger
Gå til det første ulæste opslag

Rodrigo Vale

ulæst,
30. dec. 2021, 23.58.3230.12.2021
til
Hi folks,

I am having a lot of fun studying Apple II assembler but got stuck with a simple task: how to load a binary file into memory from an assembler application? Basically I am trying to load game levels (no surprises =).

I was able to find a high level description that it is possible to run BASIC commands from an assembler application by adding the BLOAD FILENAME, A$MEMORY command in a buffer and calling an address memory to execute it, but the same information didn't provide any detail about how to do it. Does anyone know how to do it?

I also found some assembler code teaching how to avoid DOS/PRODOS and write an assembler code to read from scratch, but I think that for my level I would prefer to go with the DOS/PRODOS command approach. (Avoiding DOS/PRODOS at this moment seems to add a lot of complexity on how to store, execute and test my code)

Thank you in advance!

fadden

ulæst,
31. dec. 2021, 12.08.4131.12.2021
til
On Thursday, December 30, 2021 at 8:58:32 PM UTC-8, rodrigo...@gmail.com wrote:
> I was able to find a high level description that it is possible to run BASIC commands from an assembler application by adding the BLOAD FILENAME, A$MEMORY command in a buffer and calling an address memory to execute it, but the same information didn't provide any detail about how to do it. Does anyone know how to do it?

In DOS you can just output the commands prefixed by Ctrl+M Ctrl+D, assuming you haven't redirected character I/O. For example, the Scott Adams adventure games used this to load and save games from disk. See https://6502disassembly.com/a2-scott-adams/GoldenVoyage.html#SymSaveGame (look for "dos_save_cmd"). (As examples go it's a bit convoluted... just write the characters to COUT like you would any other text.)

For ProDOS you can use a sequence of MLI commands (OPEN / READ / CLOSE). These work whether or not BASIC.System is active. See e.g. _Beneath Apple ProDOS_.

Oliver Schmidt

ulæst,
31. dec. 2021, 15.04.5831.12.2021
til
Hi,

> For ProDOS you can use a sequence of MLI commands (OPEN / READ / CLOSE).

A pretty straight forward example of doing just that:
https://github.com/oliverschmidt/contiki/blob/master/platform/apple2enh/lib/pfs.S

Regards,
Oliver

Antoine Vignau

ulæst,
3. jan. 2022, 16.14.5703.01.2022
til
Happy New Year,

DOS is not ProDOS.
DOS contains the BASIC file interpreter (eg. BLOAD) when ProDOS does not. It is included in the Basic Interpreter. When one wants to load files in the ProDOS file system, they use the MLI (Machine Language Interface) which is really simple and powerful to use.

If you want something common between the two environments, follow the advice of Andy.

Cheers,
Antoine

Oliver Schmidt

ulæst,
5. jan. 2022, 03.39.4705.01.2022
til
Hi,

> [...] the MLI (Machine Language Interface) which is really simple and powerful to use.

Full ACK - maybe except for this:

The MLI doesn't really have a notion of drives. The "usual", "expected"
behavior of allowing to save some file to (the root directory of) some
drive like S6,D1 (like e.g. BASIC.SYSTEM does) requires you to explicitly
get the volume name of the disk in that drive and build an absolute
pathname like

/<volume name>/<file name>

(Yes, I know about the prefix, but it doesn't apply in this scenario.)

If you (again like BASIC.SYSTEM) want to do this without specifying a
drive, then it gets even (somewhat) more complicated, because you need to
first get the last used drive and then do the above.

Many MLI newcomers expect this logic to be built into the PRODOS core
instead of being a BASIC.SYSTEM feature (which therefore needs to be
reimplemented by every MLI user).

Regards,
Oliver
0 nye opslag