Running (6 Digit) BASIC on a C4P/MF
Posted: Fri Jun 13, 2014 2:22 am
Hi Everyone.
When I purchased my C4P/MF, it didn't work. (You can read my other thread on how I got it working etc.) Once got it working, I was rather upset that BASIC didn't spring to life when I turned it on. My previous experience was with a Superboard II and a C1P (essentially the same machine) and back in the day I always drooled when I saw a C4P or a C4P with FLOPPIES! at the local computer store. They were WAY out of my price range. Now, I didn't realize that as the system gained features, they also lost them too! I figured the top of the line would have all the features the runt of the litter would have, but NO! OSI was a different company. If you have floppies, why would you need cassette input/output? And with all that RAM, we can do different things with it instead of dedicating the address space to BASIC, and only BASIC.
So, I have a working machine, and no floppies. I can turn it on, watch the beauty of the "H/D/M ? prompt on the screen and listen to the rhythmic whirring of the empty floppy drive with its beautiful LED glowing away..... and that is about it. Oh wait, I can key in some programs in machine language! (NOT going to happen!)
Feeling rather unsatisfied, I rolled up my sleeves and went to work. I wanted the machine to spring into "BASIC" life with as little effort as possible.
First Step: Disassemble what little ROM there is in the machine. See other Post.
Second Step: Get a copy of BASIC. I wanted the 6-digit precision version, not the 9-digit version that is part of OS65. Easy, right? There are loads of copies of the Basic roms on the web, even this site. Just download a copy. Wrong! Apparently the BASIC for the C4P is different than the BASIC for the C1P. And the C1P version is posted everywhere, not the C4P version. Getting a copy of C4P basic is a story all its own, and one for another day. Once I had a copy of C4P-BASIC, I ran it through the disassembler, and brushed the dust off my "OSI BASIC IN ROM" book. I tried the easy route first, load it into my C4P/MF and....wait....LOAD it? at 1200 baud over the modem port using a text program and 3 characters per byte.... Hell could freeze over! I clocked the throughput of the Monitor load speed at about 340 baud. It loads about 1K per minute. So 8K BASIC would take at least 8 minutes to load. Talk about springing to life! NOT!
Third Step: Decrease the software load time. I resolved this in two ways: First, I examined the schematics of the 505 board and carefully cut a trace, and added a jumper. Now the modem port cruises at 9600 baud. Second, I wrote QuickLoad. QuickLoad is 370 bytes of speed. Its job is to be small and fast. I will post the source and binaries for QuickLoad when I am finished it. Right now it is about a version 0.8. Unfortunately QuickLoad loads the old fashion way, at 340 baud through the monitor text interface and takes about a minute. QuickLoad then runs and then takes over and loads 8K of BASIC in 14 seconds! That works for me.
Fourth Step: Fix BASIC. So with a quick loader and C4P BASIC in hand, I simply loaded the BASIC image at $A000 and jumped to the cold start address. Nothing happened. As it turns out, C4P BASIC (and C1P BASIC) rely on SYNMON rom routines. And the C4P rom routines are not all available in the C4P/MF. So the trick here was to map the differences of the C4P (3 rom pages) and the C4P/MF (3 rom pages) , basically what is available on each machine between $FD00- $FFFF. Then locate the routines in the C4P BASIC that relied on on the C4P SYNMON pages and re-route them to use the counterpart routines in the C4P/MF SYNMON pages. This was not always possible, so some "glue" routines were written to replace them. Oh, and interestingly enough, C4P SYNMON relies on routines in the BASIC rom. That meant that those entry points in BASIC HAD to stay in the same locations. This killed the option of simply re-compiling the BASIC source (available on the web).
Well after a bunch of days of research, a few thousand compiles and links, I got it working. All except LOAD and SAVE. Those are next! They need to be routed from the cassette interface to the serial interface. Once I have those working I will post all the code, binaries, and instructions for all to enjoy.
Bringing Challenger back to life!
/Jeff
When I purchased my C4P/MF, it didn't work. (You can read my other thread on how I got it working etc.) Once got it working, I was rather upset that BASIC didn't spring to life when I turned it on. My previous experience was with a Superboard II and a C1P (essentially the same machine) and back in the day I always drooled when I saw a C4P or a C4P with FLOPPIES! at the local computer store. They were WAY out of my price range. Now, I didn't realize that as the system gained features, they also lost them too! I figured the top of the line would have all the features the runt of the litter would have, but NO! OSI was a different company. If you have floppies, why would you need cassette input/output? And with all that RAM, we can do different things with it instead of dedicating the address space to BASIC, and only BASIC.
So, I have a working machine, and no floppies. I can turn it on, watch the beauty of the "H/D/M ? prompt on the screen and listen to the rhythmic whirring of the empty floppy drive with its beautiful LED glowing away..... and that is about it. Oh wait, I can key in some programs in machine language! (NOT going to happen!)
Feeling rather unsatisfied, I rolled up my sleeves and went to work. I wanted the machine to spring into "BASIC" life with as little effort as possible.
First Step: Disassemble what little ROM there is in the machine. See other Post.
Second Step: Get a copy of BASIC. I wanted the 6-digit precision version, not the 9-digit version that is part of OS65. Easy, right? There are loads of copies of the Basic roms on the web, even this site. Just download a copy. Wrong! Apparently the BASIC for the C4P is different than the BASIC for the C1P. And the C1P version is posted everywhere, not the C4P version. Getting a copy of C4P basic is a story all its own, and one for another day. Once I had a copy of C4P-BASIC, I ran it through the disassembler, and brushed the dust off my "OSI BASIC IN ROM" book. I tried the easy route first, load it into my C4P/MF and....wait....LOAD it? at 1200 baud over the modem port using a text program and 3 characters per byte.... Hell could freeze over! I clocked the throughput of the Monitor load speed at about 340 baud. It loads about 1K per minute. So 8K BASIC would take at least 8 minutes to load. Talk about springing to life! NOT!
Third Step: Decrease the software load time. I resolved this in two ways: First, I examined the schematics of the 505 board and carefully cut a trace, and added a jumper. Now the modem port cruises at 9600 baud. Second, I wrote QuickLoad. QuickLoad is 370 bytes of speed. Its job is to be small and fast. I will post the source and binaries for QuickLoad when I am finished it. Right now it is about a version 0.8. Unfortunately QuickLoad loads the old fashion way, at 340 baud through the monitor text interface and takes about a minute. QuickLoad then runs and then takes over and loads 8K of BASIC in 14 seconds! That works for me.
Fourth Step: Fix BASIC. So with a quick loader and C4P BASIC in hand, I simply loaded the BASIC image at $A000 and jumped to the cold start address. Nothing happened. As it turns out, C4P BASIC (and C1P BASIC) rely on SYNMON rom routines. And the C4P rom routines are not all available in the C4P/MF. So the trick here was to map the differences of the C4P (3 rom pages) and the C4P/MF (3 rom pages) , basically what is available on each machine between $FD00- $FFFF. Then locate the routines in the C4P BASIC that relied on on the C4P SYNMON pages and re-route them to use the counterpart routines in the C4P/MF SYNMON pages. This was not always possible, so some "glue" routines were written to replace them. Oh, and interestingly enough, C4P SYNMON relies on routines in the BASIC rom. That meant that those entry points in BASIC HAD to stay in the same locations. This killed the option of simply re-compiling the BASIC source (available on the web).
Well after a bunch of days of research, a few thousand compiles and links, I got it working. All except LOAD and SAVE. Those are next! They need to be routed from the cassette interface to the serial interface. Once I have those working I will post all the code, binaries, and instructions for all to enjoy.
Bringing Challenger back to life!
/Jeff