Running 6502 assembly program on boot for the Apple //e

Topics related to older 6502-based hardware and systems including (but not limited to) the MOS Technology KIM-1, Synertek SYM-1, and Rockwell AIM-65.
Post Reply
User avatar
Johnny Starr
Posts: 58
Joined: 30 May 2012
Location: Dallas, TX
Contact:

Running 6502 assembly program on boot for the Apple //e

Post by Johnny Starr »

This may be the wrong forum, but I'm hoping I catch the attention of an old-school Apple ii dev.
I have been writing so programs for the Apple //e and I'm really enjoying it. I've broken away from
Atari 2600 development for a bit to see what a real machine can do.

I've played around with Applesoft Basic in the past, and have written some crummy games with it. Now that I know how to write 6502 assembly, I'm wanting to write a homebrew game for the Apple //e.

I'm not sure though what needs to be done to run the application on boot. Is it a situation where you do a BRUN / BLOAD somehow?
ChuckT
Posts: 491
Joined: 20 May 2009

Re: Running 6502 assembly program on boot for the Apple //e

Post by ChuckT »

It has been since high school that I've touched an Apple II, II+ or Apple IIe.

What I remember was that memory was divided up into two or three segments depending on how much memory you had which served as a kind of copy protection.

I used Google to find your answer:

http://www.landsnail.com/a2ref3.htm

You may also need to find a proper memory map of the Apple of your choice.

Use Google as your friend.
nyef
Posts: 235
Joined: 28 Jul 2013

Re: Running 6502 assembly program on boot for the Apple //e

Post by nyef »

A quick bit of searching via google leads to http://en.wikipedia.org/wiki/Apple_DOS#Boot_loader the text of which suggests that having a BASIC program file named "HELLO" might suffice for an automatic start with stock DOS. I don't know if it would work for a binary program. You could also patch the DOS image on the disk to load a different file, or if you're going to be working in assembler anyway you might go with a substantially customized startup procedure.

It's been a while since I've done any serious apple2 work, so I'm more than a bit rusty on the details, I'm afraid. I should have access to some of my old manuals in about a week, though.
User avatar
KC9UDX
Posts: 246
Joined: 07 Dec 2013
Location: The Kettle Moraine

Re: Running 6502 assembly program on boot for the Apple //e

Post by KC9UDX »

I have a disk which boots a machine code program I wrote. There is the classic "HELLO" file ('cept I named mine "IALIZE") but it's type B instead of type A or I. It runs on boot. Frankly, I have no idea how I did that.
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Running 6502 assembly program on boot for the Apple //e

Post by barrym95838 »

For a ][+ or newer:

Code: Select all

NEW
10 TEXT : HOME : PRINT "... INITIALIZING ... ONE MOMENT ..."
20 PRINT CHR$(4)"BRUN GAME"
SAVE HELLO
For an original ][:

Code: Select all

NEW
10 TEXT : CALL -936: PRINT "... INITIALIZING ... ONE MOMENT ..."
20 PRINT "BRUN GAME" : REM INVISIBLE CTRL-D BEFORE BRUN
30 END
SAVE HELLO
Actually, the second one is the most portable, although not the most readable.

Mike B.
User avatar
Virtual1
Posts: 17
Joined: 01 Aug 2025

Re: Running 6502 assembly program on boot for the Apple //e

Post by Virtual1 »

KC9UDX wrote:
I have a disk which boots a machine code program I wrote. There is the classic "HELLO" file ('cept I named mine "IALIZE") but it's type B instead of type A or I. It runs on boot. Frankly, I have no idea how I did that.
There's a POKE you can do to change the file type it expects when it runs the default program name. And when you INIT a disk, you don't have to say "INIT HELLO", it can be any legal name, and that's the file name it'll search for on boot.

so find the poke and do it, INIT whatever, (and it'll save the BASIC program as whatever. then delete whatever and bsave your binary with the whatever name.

though just having a basic program BRUN it is definitely the easier option.


there is also a hook inside DOS that's just BEGGING to be used for this btw. It does a useless call RIGHT before loading and running the hello program. Replace that with a call to some ML embedded in one of the unused little nooks inside dos, and the startup ML doesn't even have to be a FILE. (and is also very hard to stop) Good place for something that requests a password for your disk :)
TMorita
Posts: 217
Joined: 15 Sep 2002

Re: Running 6502 assembly program on boot for the Apple //e

Post by TMorita »

If you want to run a program on boot, then you need to burn it into an EPROM and put it on an expansion card.

If the program is less than 256 bytes, you can put it map it into $CX00 where X is the slot number.
The first few bytes need to be the ID of a disk controller so the ROM will jump to the code.

If the program is >256 bytes but <2K, then you probably want to map it to $C800
You still need some minimal code to $CX00 to jump to $C800.

Toshi
Post Reply