EXEC a HELLO (Make an Applesoft-Free Disk)

11 posts / 0 new
Last post
macintricks's picture
Offline
Last seen: 5 years 1 month ago
Joined: Jun 22 2007 - 22:36
Posts: 30
EXEC a HELLO (Make an Applesoft-Free Disk)
AttachmentSize
Image icon intstart1.gif2.48 KB
Image icon intstart2.gif1.74 KB
Image icon intstart3.gif2.88 KB
Image icon intstart2-1.gif1.66 KB
Binary Data master83.dsk140 KB
Binary Data intstart.dsk140 KB

For fun, I wanted to see if I could create an Applesoft-free disk that could start on any Apple II with at least 16K. By Applesoft-free, I mean a disk that does not contain any Applesoft BASIC programs, and especially not the HELLO program. I could have used the other option: Integer BASIC to INIT the startup program. Except Integer is only resident on the standard Apple II (right?) and on any other system a HELLO program written in Integer will produce "LANGUAGE NOT AVAILABLE".

It wasn't until I came across the Beagle Bros. Peeks, Pokes, & Pointers (PDF) sheet that I discovered you can use a command file as the DOS startup program. This is more complicated than just writing a BASIC program and issuing the INIT command. So here's how I started:

  • I booted the January 1983 version of the DOS 3.3 System Master disk (while emulating an Enhanced IIe). Since I have a penchant for Integer BASIC, I created a little program in Integer that would produce a sequential-access text file named "START".

    Lines 10,20, and 80 contain the necessary Control-D characters to invoke DOS file operations. I saved the program as "MAKE START" and ran it. The command file would appear like this if you looked at it in a text viewer:

    BLOAD LOADER.OBJ0
    CALL 4096
    INT
    CALL -936
    CATALOG

    Normally, command files are run in DOS using the EXEC command. In this case, I can type "EXEC START", the language card would be loaded with Integer BASIC, and the interpreter would activate. Theoretically, if the system had Integer BASIC resident, the loader routine would be bypassed. (This I don't know.)

  • According to the Beagle Bros. sheet linked above, I can type "POKE 40514,20" and then init a disk. The POKE directs DOS to execute a command file as the startup program instead of a BASIC program. Since I was still in Integer BASIC (though I could have switched to Applesoft), the POKE address would need to be converted to a valid Integer-range number: 40514 - 65536 = -25022. I then INITed the target disk in drive 2 using the name of my START command file.

    After initialization, the disk's catalog shows my START file as an Integer BASIC program. This is not what I want; the file type should be a "T" for text. The text file will need to be manually copied from the System Master disk in drive 1 using the FID program. Here are the other files I copied:

    START
    LOADER.OBJ0
    INTBASIC

    After swapping the new disk to drive 1, I restarted the computer. The command file worked. Integer BASIC loaded, the catalog displayed.

  • I want this disk to now be a master disk so the disk will boot on any Apple II with at least 16K RAM. This is where I'm having a problem. How can I use MASTER CREATE on a command file? I've tried this:

    Except the problem is that the master image replaces the EXEC instruction with RUN. When I boot my modified disk, I get "FILE TYPE MISMATCH". So now the master image of DOS thinks my START file is a BASIC program again.

Where to go from here? Might there be a way to insert that same EXEC instruction into the master DOS image and then update my disk from the "hacked" version? Attached are the System Master disk and the sample disk I made before updating the DOS image.

Help from anyone would be appreciated!

mmphosis's picture
Offline
Last seen: 3 days 9 hours ago
Joined: Aug 18 2005 - 16:26
Posts: 433
Re: EXEC a HELLO (Make an Applesoft-Free Disk)

You could patch the byte for the startup command directly onto the Master Disk that you've created. I did this in the past with a sector editor. Load the sector, change the byte, write the sector.

track $00, sector $D
byte $42:
change $06 for RUN to $14 for EXEC, (or $34 for BRUN.)

http://hoop-la.ca/apple2/2014/change-autorun-program-type/

MarkO's picture
Offline
Last seen: 1 week 1 day ago
Joined: Dec 10 2011 - 16:26
Posts: 688
Re: EXEC a HELLO (Make an Applesoft-Free Disk)

Do you happen to know how to get DOS 3.3 to run an Integer Program or an AppleSoft Program, depending on which ROM is installed??

MarkO

Offline
Last seen: 8 years 4 months ago
Joined: Apr 10 2006 - 20:01
Posts: 1013
Re: EXEC a HELLO (Make an Applesoft-Free Disk)

Do you happen to know how to get DOS 3.3 to run an Integer Program or an AppleSoft Program, depending on which ROM is installed??

It doesn't depend on which ROM is installed... it depends on the filetype (I vs. A).

macintricks's picture
Offline
Last seen: 5 years 1 month ago
Joined: Jun 22 2007 - 22:36
Posts: 30
Re: EXEC a HELLO (Make an Applesoft-Free Disk)

Interesting idea. According to another PEEK & POKE list in the Asimov archive, you can look at the value of PEEK(43702) or (-21834).

  • If it's 0, then the active language is Integer.
  • If it's 64, then it's Applesoft.
  • If it's 128, then it's cassette Applesoft.

I suppose you could create a command file that would (in one line) branch to your program of choice based on the PEEK. Since branching involves IF...THEN, the command would be passed to the active BASIC interpreter. So any DOS commands would require the PRINT "(control-D)RUN..." command in BASIC. For instance, say there exist two programs IPROG and APROG, written in Integer & Applesoft, respectively.

IF PEEK(-21834)=0 THEN PRINT "RUN IPROG"
IF PEEK(-21834)=64 THEN PRINT "RUN APROG"

with Control-D characters after each first quote. I used -21834 because it's a valid number in both interpreters.

These could branch to each BASIC program without the use of line numbers or assuming BASIC dialects in the first place, I guess.

macintricks's picture
Offline
Last seen: 5 years 1 month ago
Joined: Jun 22 2007 - 22:36
Posts: 30
Re: EXEC a HELLO (Make an Applesoft-Free Disk)

Thanks mmphosis! Your advice worked. I used Copy II Plus 5.5 to edit the sector, and after wrecking the Copy II disk itself (wrong drive), I successfully wrote the sector to my target disk. On reboot, DOS executed the command file like a charm. So now I have the relocatable DOS and a command file greeting program. Beautiful!

mmphosis's picture
Offline
Last seen: 3 days 9 hours ago
Joined: Aug 18 2005 - 16:26
Posts: 433
Re: EXEC a HELLO (Make an Applesoft-Free Disk)

[url=http://hoop-la.ca/apple2/2014/change-autorun-program-type/capt.bas.html][/url]

The Integer Basic program [url=http://hoop-la.ca/apple2/2014/change-autorun-program-type/]change autorun program type[/url] ([url=http://hoop-la.ca/apple2/2014/change-autorun-program-type/capt.bas.html]CAPT[/url]) has a few safety checks in it...

  • It does a simple check to see that the disk is DOS 3.3.
  • It loads the sector and displays the program type.
  • Once a new type is chosen, it rechecks to see that the disk is DOS 3.3
  • and the volume number needs to match,
  • then it checks that the original program type matches, and then it writes to the disk with the new program type.

It uses the last used slot and drive.

I used copies of disks to run tests. Here's what happens when you run CAPT with the Locksmith 5 disk:

[url=http://hoop-la.ca/apple2/2014/change-autorun-program-type/][/url]

macintricks's picture
Offline
Last seen: 5 years 1 month ago
Joined: Jun 22 2007 - 22:36
Posts: 30
CAPT

Nice program! That would have made things much easier. I tested it out by switching my hacked disk to RUN and then back to EXEC. If you don't mind, may I list your program here for future users? With due credit, of course.

mmphosis's picture
Offline
Last seen: 3 days 9 hours ago
Joined: Aug 18 2005 - 16:26
Posts: 433
Re: CAPT

Thanks. Your "Applesoft-Free" posting inspired me to write a program in Integer Basic.

mmphosis's picture
Offline
Last seen: 3 days 9 hours ago
Joined: Aug 18 2005 - 16:26
Posts: 433
Re: CAPT

http://www.whitmanarchive.org/about/faq.html

poem

MarkO's picture
Offline
Last seen: 1 week 1 day ago
Joined: Dec 10 2011 - 16:26
Posts: 688
Re: EXEC a HELLO (Make an Applesoft-Free Disk)

Interesting idea. According to another PEEK & POKE list in the Asimov archive, you can look at the value of PEEK(43702) or (-21834).
  • If it's 0, then the active language is Integer.
  • If it's 64, then it's Applesoft.
  • If it's 128, then it's cassette Applesoft.

I suppose you could create a command file that would (in one line) branch to your program of choice based on the PEEK. Since branching involves IF...THEN, the command would be passed to the active BASIC interpreter. So any DOS commands would require the PRINT "(control-D)RUN..." command in BASIC. For instance, say there exist two programs IPROG and APROG, written in Integer & Applesoft, respectively.

IF PEEK(-21834)=0 THEN PRINT "RUN IPROG"
IF PEEK(-21834)=64 THEN PRINT "RUN APROG"

with Control-D characters after each first quote. I used -21834 because it's a valid number in both interpreters.

These could branch to each BASIC program without the use of line numbers or assuming BASIC dialects in the first place, I guess.

Perfect!!!

So this would let you make an EXEC File, Execute "generic BASIC" and then RUN a Program in the Current BASIC..

I was wanting a way to Boot a Disk on an Apple ][ or Apple][+ and not load the Other BASIC from Disk, but have it Run a BASIC Program at StartUp...

Log in or register to post comments