Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The best way to accelerate a Macintoy is at 9.8 meters per second per second.


devel / comp.sys.apple2.programmer / Re: Load binary file using Assembler

SubjectAuthor
* Load binary file using AssemblerRodrigo Vale
`* Re: Load binary file using Assemblerfadden
 `* Re: Load binary file using AssemblerOliver Schmidt
  `* Re: Load binary file using AssemblerAntoine Vignau
   `- Re: Load binary file using AssemblerOliver Schmidt

1
Load binary file using Assembler

<1819f301-26b5-4241-a8e4-0256478c365en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=206&group=comp.sys.apple2.programmer#206

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:ac8:5c50:: with SMTP id j16mr29980029qtj.255.1640926712214;
Thu, 30 Dec 2021 20:58:32 -0800 (PST)
X-Received: by 2002:aca:aa49:: with SMTP id t70mr25501666oie.85.1640926711729;
Thu, 30 Dec 2021 20:58:31 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Thu, 30 Dec 2021 20:58:31 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=71.202.63.40; posting-account=o2yQJgoAAABF7p6C9zQB-FZFatx57vKl
NNTP-Posting-Host: 71.202.63.40
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1819f301-26b5-4241-a8e4-0256478c365en@googlegroups.com>
Subject: Load binary file using Assembler
From: rodrigo....@gmail.com (Rodrigo Vale)
Injection-Date: Fri, 31 Dec 2021 04:58:32 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 18
 by: Rodrigo Vale - Fri, 31 Dec 2021 04:58 UTC

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!

Re: Load binary file using Assembler

<29fa5da2-414d-4712-8b7d-567d4aa67c49n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=208&group=comp.sys.apple2.programmer#208

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:ac8:6d35:: with SMTP id r21mr32001560qtu.9.1640970520772;
Fri, 31 Dec 2021 09:08:40 -0800 (PST)
X-Received: by 2002:a05:6808:613:: with SMTP id y19mr27330896oih.47.1640970520483;
Fri, 31 Dec 2021 09:08:40 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Fri, 31 Dec 2021 09:08:40 -0800 (PST)
In-Reply-To: <1819f301-26b5-4241-a8e4-0256478c365en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.130.68.111; posting-account=UAtoeQoAAADrX7T-MHdWWRC4Fzf0dsLP
NNTP-Posting-Host: 24.130.68.111
References: <1819f301-26b5-4241-a8e4-0256478c365en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <29fa5da2-414d-4712-8b7d-567d4aa67c49n@googlegroups.com>
Subject: Re: Load binary file using Assembler
From: fad...@fadden.com (fadden)
Injection-Date: Fri, 31 Dec 2021 17:08:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 17
 by: fadden - Fri, 31 Dec 2021 17:08 UTC

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_.

Re: Load binary file using Assembler

<sqnnp8$hmg$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=210&group=comp.sys.apple2.programmer#210

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ol....@web.de (Oliver Schmidt)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Load binary file using Assembler
Date: Fri, 31 Dec 2021 20:04:56 -0000 (UTC)
Message-ID: <sqnnp8$hmg$1@solani.org>
References: <1819f301-26b5-4241-a8e4-0256478c365en@googlegroups.com>
<29fa5da2-414d-4712-8b7d-567d4aa67c49n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 31 Dec 2021 20:04:56 -0000 (UTC)
Injection-Info: solani.org;
logging-data="18128"; mail-complaints-to="abuse@news.solani.org"
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:oKTTq111P0Kx3u7gw77GX5I4Euc= sha1:z6o9eBjNE903t4j5qzqqc9hbAgY=
X-User-ID: eJwNysERwDAIA7CV0mAbGIeDsv8Ird6i6VE7RIHL1XsCFzq51TlxXf6PkCKILevctLyYGKLrA/6uED4=
 by: Oliver Schmidt - Fri, 31 Dec 2021 20:04 UTC

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

Re: Load binary file using Assembler

<5de0a6e0-345b-4992-8b4d-54fa8091793dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=213&group=comp.sys.apple2.programmer#213

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:a05:620a:9c3:: with SMTP id y3mr32148142qky.367.1641244497489;
Mon, 03 Jan 2022 13:14:57 -0800 (PST)
X-Received: by 2002:a05:6830:3486:: with SMTP id c6mr33744347otu.19.1641244497158;
Mon, 03 Jan 2022 13:14:57 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Mon, 3 Jan 2022 13:14:56 -0800 (PST)
In-Reply-To: <sqnnp8$hmg$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=90.91.254.173; posting-account=c4quJwoAAABUj_DOmUN3HIuXxN1tF7gT
NNTP-Posting-Host: 90.91.254.173
References: <1819f301-26b5-4241-a8e4-0256478c365en@googlegroups.com>
<29fa5da2-414d-4712-8b7d-567d4aa67c49n@googlegroups.com> <sqnnp8$hmg$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5de0a6e0-345b-4992-8b4d-54fa8091793dn@googlegroups.com>
Subject: Re: Load binary file using Assembler
From: ntn.vig...@gmail.com (Antoine Vignau)
Injection-Date: Mon, 03 Jan 2022 21:14:57 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 12
 by: Antoine Vignau - Mon, 3 Jan 2022 21:14 UTC

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

Re: Load binary file using Assembler

<sr3lgh$k52d$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=216&group=comp.sys.apple2.programmer#216

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ol....@web.de (Oliver Schmidt)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Load binary file using Assembler
Date: Wed, 5 Jan 2022 08:39:45 -0000 (UTC)
Message-ID: <sr3lgh$k52d$1@solani.org>
References: <1819f301-26b5-4241-a8e4-0256478c365en@googlegroups.com>
<29fa5da2-414d-4712-8b7d-567d4aa67c49n@googlegroups.com>
<sqnnp8$hmg$1@solani.org>
<5de0a6e0-345b-4992-8b4d-54fa8091793dn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 5 Jan 2022 08:39:45 -0000 (UTC)
Injection-Info: solani.org;
logging-data="660557"; mail-complaints-to="abuse@news.solani.org"
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:zTP01cMGOYbmwqCKAJ7ZJPLd0/4= sha1:7iP/cv7bj8XyxaI9eiOGzAAR8+Y=
X-User-ID: eJwNysEBgDAIA8CVCCSA61DL/iPovU+RyFNMJbXaiL1Pynzewll6YRbg7Q4z+v5d3m4uTBIfBoEPoA==
 by: Oliver Schmidt - Wed, 5 Jan 2022 08:39 UTC

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

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor