Anybody thought of a light port of Applesoft?

Discuss software for the Apple 1/replica 1

Postby cowgod » May Wed 07, 2008 12:53 am

Man, this already made it to A2Central: http://www.a2central.com/portal/?p=1495. Those guys are quick!

The tokenized files won't be directly compatible due to commands being removed. The token values are shifted around a bit. Code in text format should work, except any missing commands will result in a syntax error.

The default start address is at $0801, which reminds me, it should be actually possible to bump this down to $0401. The cassette LOAD/SAVE routines use $67/68 to get the start address and $AF/B0 for the end, though the start address should never change.

I'm sure it would be possible to get the CFFA1 to store the programs, but that's another project :)

Tom
cowgod
 
Posts: 31
Joined: Sep Fri 14, 2007 10:38 pm
Location: New Jersey

Postby vbriel » May Wed 07, 2008 3:01 pm

Well, I ran some small tests. You can store the program by just saving the address with a write command in the CFFA1 menu.

When you power up the replica 1 and reset it, go into Applesoft to setup the warm start address 0000. Next, go into the CFFA1 menu at 9000 and load the program. Exit the CFFA1 menu and 0R to go back into Applesoft and your program is loaded and ready to go. I'm sure an update can be done on the CFFA1 firmware to save Applesoft format programs but this works for now. I'll try some more tests.

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby vbriel » May Wed 07, 2008 4:24 pm

Hey Tom, any way to fix the tokenized commands so they match the 2. I can dump from serial like you mentioned but if you find it possible to match the commands, let me know. I'm going to try and dump some larger text only creative computing games in and see how they do. Most of them are directly Applesoft compatible.

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby cowgod » May Wed 07, 2008 8:50 pm

The only way I can think of to make the tokens line up is to add the unused tokens back to the token table (but have them do nothing). I don't think there is enough space left to fit them in, and it doesn't seem like a huge loss to have incompatible token formats.

As for loading/saving from CFFA1, the cassette LOAD routine does the following:

- read 3-byte header from tape (program length + lock flag)
- store program end address at $69/6A
- store lock byte at $D6
- load program from tape
- if locked, start running, otherwise jump to "FIX.LINKS" routine

It would be cool to add back the SAVE and LOAD commands, but have them work with the CFFA1 instead of cassette. I wonder if that could fit in less than 100 bytes....

Tom
cowgod
 
Posts: 31
Joined: Sep Fri 14, 2007 10:38 pm
Location: New Jersey

Postby vbriel » May Wed 07, 2008 9:15 pm

I agree, just being able to use Applesoft is sweet. It is possible to add the load and save commands but we would have to get Dave Lyons involved as he was the one who wrote the CFFA1 firmware. There are API's locations for file loading and storage, it would just some work to get it done right.

Is that 100 bytes for both commands?

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby cowgod » May Wed 07, 2008 10:13 pm

Yeah, its actually a little less than 100 I think... I'll have to check exactly how much space is left. There are a few bytes here and there that I should be able to free up, but it's pretty tight.

I'm looking at the CFFA1 API right now. It seems fairly straight forward, its just a matter of trying to wedge the necessary code in.

Tom
cowgod
 
Posts: 31
Joined: Sep Fri 14, 2007 10:38 pm
Location: New Jersey

Postby vbriel » May Wed 07, 2008 10:43 pm

Well, I've been testing out commands. I obviously skipped the graphics commands. Here's the ones I've tested so far:

DATA, READ, RESTORE, FOR/NEXT, ON c GOTO, GOSUB/RETURN, VAL,CHR$,STR$,LEFT$,RIGHT$, MID$, LEN(A$), IF n=x THEN
PRINT, REM, GOTO, CALL, STOP, END, PEEK(x), POKE(x), CONT, RND(1), INT(RND(1)). NEW, CLEAR, RUN, GET A$, DIM A$(255,2),

I haven't done the math stuff but so far everything is working. TAB shows as a variable and does not space over, no big deal.

SPEED is now a variable, not a text speed command (not needed).

Another nice feature in only having 32K is that FRE(0) doesn't require adding 32K to get the correct value.

So far, this is great!!

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby cowgod » May Wed 07, 2008 11:10 pm

Thanks for testing all those, glad to hear most stuff is working. I put up a page with a short writeup, which includes a list of what tokens were removed: http://cowgod.org/replica1/applesoft/ Hopefully those commands won't be missed too much.

All the math stuff should work except for the trigonometric functions (COS/SIN/TAN/ATN)... those just took up too much space.

SPEED relies on a routine in the Apple II monitor, so that was out. I figure the Apple-1 display is slow enough as it is. :)

TAB doesn't work because there's no way to read/change the cursor position (as far as I know?) SPC should work though.

I added one token in place of HOME... "CLS" will output 24 CR's to clear the screen, but leaves the cursor at the bottom. It seemed like a good idea at the time.

Tom
cowgod
 
Posts: 31
Joined: Sep Fri 14, 2007 10:38 pm
Location: New Jersey

Postby vbriel » May Wed 07, 2008 11:32 pm

Yeah, I think this is working out just great. I tried a creative computing FP Basic program and only had minor mods to get it to work.

One thing to note is PRINT A,B did not put a space between the variables when printed. I can't remember the spacing, I think it was 5 or 8 like a tab but it is easy to replace in the line. I'm just noting these things, NOT complaining, FYI. This will help for anybody using it to know what works and what was removed for room. The fact that it fits in less than 8K is sweet.

I can't wait to look at the source when finished. I like calling it Applesoft "Lite", it fits.

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby cowgod » May Thu 08, 2008 2:08 am

Vince, give this ROM image a try: http://cowgod.org/replica1/applesoft/ap ... 1-cffa.bin

I managed to fit some CFFA I/O code, mostly by trimming the error messages and removing my CLS routine. The new code just barely fit, there are 0 bytes left now.

Anyway, I added LOAD, SAVE, and a MENU command to bring up the CFFA menu. Load and save take a filename as a parameter. I'm not sure that the file name parsing works exactly right, but its close enough for now. I tested things out with a one-line program and it seemed to work OK. The files are saved with ProDOS type $F8.

Tom
cowgod
 
Posts: 31
Joined: Sep Fri 14, 2007 10:38 pm
Location: New Jersey

Postby vbriel » May Thu 08, 2008 4:56 pm

Oh Tom, you have outdone yourself. Load and store and menu work sweet! I just did a full creative computing program and it works perfect.

I like how the error response from the CFFA get transferred and displayed too! This means you can just type "LOAD PROGRAMNAME" from applesoft, no need to enter the menu. This way exceeds what I was wanting.

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby cowgod » May Thu 08, 2008 10:19 pm

Yeah, it only cost 4 bytes to have the CFFA card display the error, there's a DisplayError function built into the API.

One last thing I wanted to add if I can find the room is to verify whether there is actually a CFFA board present prior to trying to access it. The API documentation says there should be ID bytes $CF and $FA at AFFC-AFFD, but my card shows $00's at those locations. I don't know whether this is an error in the documentation, a problem with my card, or something else... Can you tell me what you have at AFFC-AFFD and also AFDC-AFDE?

Tom
cowgod
 
Posts: 31
Joined: Sep Fri 14, 2007 10:38 pm
Location: New Jersey

Postby vbriel » May Thu 08, 2008 11:31 pm

At AFFC I have 00. At AFDC CF and AFDD is FA (CFFA). Funny code check. So, it looks like your verify CFFA1 is at memory locations AFDC & AFDD.

I can't get over the LOAD, SAVE & MENU commands. A CAT command would be great :)

But then again, so would DEL, FORMAT, CD. I guess you just reach a point where nothing else fits.

I dumped, saved, loaded a creative computing program with much success. I even created a directory just for this test. Files are obviously stored in the current working directory.

Do you really need to verify the CFFA1 for the LOAD/SAVE commands? I think it is acceptible to lock up if you don't have a card installed.

One idea that might be possible, since you are dealing with CFFA1 specific stuff is to stuff the commands into the ROM of the CFFA1? There is unused space on the EEPROM! AA00-AFDB is open and I don't expect any revision to the firmware. Is that possible?

Applesoft is already working in the ROM so this would just be enhanced CFFA1 specific code. Then again, I wouldn't know.

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby cowgod » May Fri 09, 2008 12:48 am

Strange... I have $FF's at AFDC-AFDD. Maybe my card's ROM isn't quite right, I'll have to look into that. I see Rich Dreher just posted the firmware for download, or at least I didn't see it on his site earlier.

Of course it's not strictly necessary to look for the card first, it just seems more user-friendly to spit out an error rather than crashing. There actually might be enough room to at least have the commands do nothing if the board is not present. I think it would be preferable to not modify the CFFA firmware if possible, but the CFFA I/O stuff could be loaded there in theory.

Don't think I can fit CAT, but that stuff can always be done via the menu. :)

I started to clean up the source files today, hopefully I can get a somewhat-presentable copy posted in the next few days.

I was thinking of moving the program start address down to $401, but I guess its not a bad idea to leave $400-$7FF for other uses. I'm using parts of page 3 as temporary storage for the CFFA routines.

Tom
cowgod
 
Posts: 31
Joined: Sep Fri 14, 2007 10:38 pm
Location: New Jersey

Postby sfahey » May Sat 10, 2008 1:19 am

vbriel wrote:
I can't wait to look at the source when finished. I like calling it Applesoft "Lite", it fits.
as
Vince


Replicasoft BASIC? It's a Replica of Applesoft, for the Replica 1. ;)
sfahey
 
Posts: 4
Joined: Jan Thu 04, 2007 11:58 am

PreviousNext

Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest