I'm busy teaching myself all about the Apple II and starting off with a ProDOS ROM image written by Terence Boldt
Looking at the STARTUP code in CiderPress, it uses Applesoft to print a menu and then loads a game depending on which key you press.
I've worked out most of the simple basic commands but what is stumping me is how is the game actually loaded.
I would think there should be something like LOAD game?
The code reads the key pressed and sets a variable GAME = 0 to 26 (Depending on which key is pressed) Then the below routing is run.
400 DIM PREFIX$(26)
420 FOR X = 0 TO 25
430 READ PREFIX$(X)
440 NEXT X
500 DIM EXEC$(26)
510 FOR X = 0 TO 25
520 READ EXEC$(X)
530 NEXT X
What exaclty does this do? Looking at the applesoft commands it allocates an array of size 26 and then reads the array. What happens when it's read. Where is it read to?
After that it prints executing game to the screen, and then
1000 DATA "BC.QUEST"
1001 DATA "BOLO"
1002 DATA "BRUCE.LEE"
and continues listing each game.
How exactly does that load/run the game you have selected?
If it helps, here is a link to the .po file:
Great project to start with. Quite fond of it myself.
Off the top of my head it uses the variable and runs BRUN on the DATA path specified, but I haven't really torn into the code of his menu itself.
I have been working on a separate ROM image for II+ which is a whole topic in and of itself; I hope someone here is more familiar with how Terrence's menu is coded and can more specifically answer your question.
Looks like I missed this important bit out (On second thoughts this is just printing to the screen?)
I don't see any BRUN commands in the code.
The first part of the program populates two string arrays with the DATA statements below it. One array holds the prefix or directory to each game and the second holds an EXEC command that is used to execute the corresponding program from the "disk." Line 610 is where this command is executed causing the appropriate program to launch. You'll find the BRUN (or possibly the ProDOS "-") command in many of those EXEC strings. The EXEC command basically just emulates typing commands from the keyboard.
Thanks. the bit I was missing is the CHR(4) which is DOS command escape prefix. I thought it was just printing to the screen.
I think I"m following now:
READ PREFIX$(0) - reads the DATA from 1000
READ PREFIX$(1) - would then read the next data statement at 1001
Wow, very different to modern programming :)
It's not helping that I"m trying to compare it to Visual Basic!
Yeah, you need to get your head out of "C" and even VB.
Microsoft derived BASIC is a different animal altogether, but it did put programming power into the hands of the common person.
Even mere mortals could learn to write meaninful computer programs (we didn't call it "code" in the 80s) thanks to computers like the Apple II, the Commodore PET, C64 and of course, BASIC.
I'm not a professional coder, programmer or even a highly trained amateur. But when I spend days working out some vintage computer programming and then try to switch my mindset to something modern like Arduino "C" it sometimes seems like the most @#$%-ed up programming langugage ever devised (C, that is). Whoever thought camel-case was a neat idea should be drawn, quartered and fed to the pigs.
Yep, the dash is my favorite ProDOS command. If you have a program called foo then -foo just executes it. You don't have to care if it's written in Basic or it's binary, like you do when using RUN and BRUN.
Otherwise for anyone who is a modern programmer I would recommend going through this tutorial (takes about an hour or two to go thorugh and understand it):
Also you can copy any of the example programs and <Shift><Insert> them directly into AppleWin.