I’m on an extended work trip, so I’ve been unable to do much of anything blog like the last few weeks. But as a bonus I have about 6 months worth of random crap from Ebay packed up to take back to Hong Kong to review.
And yes, It’s nearly been a year in the making for this one, but rest assured unless the disks are un-readable this will happen!
Otherwise, the Diablo thing with the release to mobile only went over like a proverbial lead balloon. Kind of gutsy to host a convention to die hard PC fans and try to keynote on a re-skinned rip off phone app, that’s just been accepted as now ‘official’. Talk about outsourcing gone wrong.
UPDATE: sad news I have a piece of luggage MIA. This may not be happening now.
UPDATE2: Bag showed up, loaded the disks, and after 7% of disk one, my 5 1/4″ drive just died.
I just found this post over @pagetable.com, the source code to a bunch of old Commodore 8 bit products have been located and recovered, and place online over on github. Even better there is detailed instructions on cross assembling from a suitable PET machine for building your own KERNAL ROM.
Other sources include:
BASIC_C64 reindented BASIC_C64, KERNAL_C64 and DOS_1540 to approximate the LST
BASIC_CBM2_A reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
BASIC_CBM2_B reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
DOS_4040 reindented DOS_4040 to approximate the LST output of the assembler
DOS_8070 reindented DOS_8070 to approximate the LST output of the assembler
DOS_8250 reindented DOS_8250 to approximate the LST output of the assembler
DOS_D9065 reindented DOS_D9065 to approximate the LST output of the assembler
EDITOR_CBM2 reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
KERNAL_C64_01 added KERNAL_C64_03 and renamed the existing KERNAL_C64 to KERNAL_C64_01
KERNAL_C64_03 fix disclaimer of C64 KERNAL -03 to reflect the LST printout
KERNAL_CBM2_A reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
KERNAL_CBM2_B reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
Super late, but pretty cool too!
Of interest is the PET2001 Basic sources. While there have been reversed efforts dating back for years, this is the actual source code. Namely the header.
TITLE BASIC M6502 8K VER 1.1 BY MICRO-SOFT
RADIX 10 ;THROUGHOUT ALL BUT MATH-PAK.
$Z:: ;STARTING POINT FOR M6502 SIMULATOR
ORG 0 ;START OFF AT LOCATION ZERO.
;0=PDP-10 SIMULATING 6502
Which is pretty damned interesting. The infamous “WAIT6502,1” feature is also included!
Back before there was sim city, the first popular simulation thing I can think of on our ancient basic bound 8 bit machines (and even mainframes running basic!) was Lemonade. Wikipedia, naturally is full of Apple citations, and of course, is absent of any mention of the most popular selling home computer of all time, as Commodore is usually scrubbed from history in favor of this narrative that Apple was some how popular (it wasn’t).
Oddly enough tracking down these older versions of Lemonade is really hard. But thankfully others have done the hard work for me!
First from The Sleeping Elephant, and here is lemonade!.prg for the Pet microcomputer. It’ll run fine in Vice, although it’ll run best using a Pet 3016 – 3032 and the model 4016 and 4032. It needs more than 8kb of RAM, so the original models are out, and the ‘graphcis’ don’t display corrrectly on the larger 8000 models, although the game does run.
But what about the Commodore 64?
By the time the Commodore 64 came out, Commodore had stepped upped their game, and made available a large number of basic programs ported to the Commodore 64. As always the thinking is if you can convince parents that this is educational and it’ll help their kids, they’ll buy one. Well in this case they were right! Although lacking the cool animation of the PET, it does include more documentation. And thanks to vcfed.org, You can download a tape file image here.
Unsurprisingly the game play is pretty much the same. You buy your Lemon concentrate, sugar and cups, try to predict demand based on your price and the weather. You set a price, and sit back and hope for the best.
Once you figured out that the first few lines (3-5 on the C64) were there to not let you alter it, you were golden. With the source, you could make summer last 10 years if you wished, or change any of the seemingly arbitrary limits. If you were really keen on it, you could also print the source code and work out the logic flow with a pencil, something that you really needed back in the days of 40 column screens.
And now you can click the printer #4 tab and set it to output a to a file
Assuming you have the program loaded you can then just type in:
*Remember that Vice emulates the Commodore layouts, which means on the PET machines, they use a number pad.
The above commands will open up the printer, print the listing output to the printer, then close the printer device. If all went well you’ll have the source dumped to viceprnt.out although PETSCII won’t render on ASCII systems, nor will the machine language portion, and a lot of the BASIC may get down shifted but you can always fix that with tr.
BEGINBASIC(int,main,(int argc, char* argv))
10 PRINT “Hello, world!”;
20 GOTO 40;
30 PRINT “I am not printed”;
It’s compiled with GCC like this:
c++ -pipe -xc++ -fpermissive -w -o hello.exe hello.bas
And then run it!
From the docs in the main .cc file:
Implemented a BASIC language dialect/subset, with the following restrictions:
All variables and statements must be allcaps
All lines must begin with a line number from 1 to 32767
All lines must have a trailing semicolon
One statement per line (except IF-THEN)
“THEN” must NOT be followed by a “GOTO” nor “GOSUB”!
IF <C-style expression with “==” in case of equality> THEN <label>
GOSUB <label> / RETURN
STOP [optional errorlevel/return value]
END [optional errorlevel/return value]
PRINT <strings and/or variables in arbitrary order>
INPUT <one or more variables>
DIM <array variables with number of elements, p.ex. “NP(42)”>
FOR/NEXT loop (NEXT’s argument is mandatory, exactly one variable)
PRINT interprets comma as semicolon, except on the ENDS
thus PRINT does NOT interpret comma as tab injection
basically, PRINT is some kind of writeln()
but can be tricked: if CHR$(0) is inserted somewhere, it won’t print
the remaining part including the trailing newline!
variables are all float types, predeclared, and their names at most 2 chars long
(numerical) arrays can be used, must be declared before their first usage
Array numberings: DIM A(8) means that A(0) till A(7) are declared this way
So it’s not 100%, there is no strings, not even a REM (conver to C++ comments) so it’ll be a while until you can build more traditional basic programs.
Back in the 1980’s home computers were a new and exciting thing, and with these machines came very technical manuals. But us young children wanted to program, and thankfully companies like Usborne filled the gap by providing programming books geared towards kids! It was a golden age as every machine had a basic interpreter. Then for some reason software companies (Microsoft/IBM) didn’t think it was a good thing anymore bundling in languages with their OS’s, or worse thinking that development tools should be a source of revenue and pricing amateurs out of the market (seriously SCO, $5000 for a C compiler?) But now thanks to the common carrier network we all have (the internet) the rise of open and free software hackers have taken things into their hands, and we are back to empowering users.
So I thought it was interesting that Usborne opened up a bunch of it’s older books. All available in PDF, free for personal use.
I found this repository by accident, cbmbasic which is a ‘portable’ version of the old Microsoft Basic for the Commodore 8bit computers in C which can run on any manner of machine.
Really cool, right?
So for the heck of it, I fired up the x68000 toolchain, and in no time after gutting the file open operation as some stuff isn’t defined, and I wanted to see it run, I had a working executable.
All the commands MUST BE IN UPPERCASE… Then again the Commodore did default to upper case, so I guess that isn’t a surprise. There is no ‘system’ command to take you out of basic, but Control-C works just the same.
To celebrate, there is the GE simulator ‘true basic‘ on Dartmouth , and another more obscure (and seemingly deleted) simulator for MS-DOS. Which is interesting at least for more demo programs.
There is even a ‘web‘ based simulator, but I haven’t tried it.
For the heck of it, I took an old ‘game’ taxman.bas (Downloaded from here, and which I extracted with SIMH) and with a couple of line changes, got it to run.
10 DIM T(10)
20 DIM L(50)
104 PRINT”HI, I’M THE TAXMAN”
106 PRINT”DO YOU WANT THE REGULATIONS”
108 LET R = 1
110 IF R<>0 THEN 900
120 REM ***INITIALZATION
122 GOSUB 800
124 REM ***THE HUMAN TAKES A NUMBER
126 GOSUB 500
128 REM *** COMPUTE THE HUMAN’S AND TAXMANS TOTLES
130 GOSUB 570
132 REM *** PRINT THE NEW LIST
134 GOSUB 600
136 REM *** CHECK IF ANY NUMBERS STILL HAVE FACTORS
138 GOSUB 650
140 IF M=1 THEN 126
142 REM *** FIND THE WINNER
144 GOSUB 700
146 REM *** AGAIN?
148 GOTO 750
497 REM *** THE HUMAN MOVES
504 PRINT”YOU TAKE”;
506 INPUT K
508 LET K=INT(K)
510 IF K <= 0 THEN 750
512 IF K <=N THEN 518
514 PRINT K;”IS NOT IN THE LIST — TRY AGAIN.”
516 GOTO 502
518 IF L(K)=0 THEN 514
520 REM FIND ALL THE FACTORS
522 IF K>1 THEN 530
524 PRINT”THERE ARE NO FACTORS OF”;K;”FOR ME.”
526 PRINT”ARE YOU TRYING TO SHORT-CHANGE THE TAXMAN?”
528 GOTO 502
530 LET M=0
532 FOR I=1 TO K/2
534 IF L(I)=0 THEN 544
536 IF K <> I*INT(K/I) THEN 544
538 LET M=M+1
540 LET T(M)=I
542 LET L(I)=0
544 NEXT I
546 REM CHECK WETHER THERE WERE ANY FACTORS
548 IF M=0 THEN 524
550 LET L(K)=0
567 REM *** COMPUTE THE HUMAN’S AND TAXMAN’S TOTALS
570 LET Y=Y+K
572 PRINT”YOUR TOTAL IS”;Y
574 PRINT”I GET”;
576 FOR I=1 TO M
578 PRINT T(I);
580 LET Z=Z+T(I)
582 NEXT I
586 PRINT”MY TOTAL IS”;Z
597 REM *** PRINT THE NEW LIST
602 PRINT”NEW LIST:”;
604 LET M=0
606 FOR I=1 TO N
608 IF L(I)=0 THEN 614
610 PRINT I;
612 LET M=1
614 NEXT I
647 REM *** CHECK IF ANY NUMBERS STILL HAVE FACTORS
649 REM CHECK IF THE LIST IS EMPTY
650 IF M=0 THEN 690
652 FOR I=N TO 4 STEP -1
654 FOR J=2 TO I/2
656 IF L(J)=0 THEN 664
658 IF I<> J*INT(I/J) THEN 664
660 LET M=1
664 NEXT J
666 NEXT I
668 REM THE TAXMAN GETS THE REST OF THE NUMBERS
672 PRINT”I GET”;
674 FOR I=1 TO N
676 IF L(I)=0 THEN 682
678 PRINT I;
680 LET Z=Z+I
682 NEXT I
684 PRINT”BECAUSE NO FACTORS OF ANY NUMBER ARE LEFT.”
686 PRINT”MY TOTAL IS”;Z
688 LET M=0
697 REM *** FIND THE WINNER
702 IF Z>Y THEN 708
704 PRINT”YOU”;Y;” TAXMAN”;Z;” YOU WIN!!!”
708 PRINT”TAXMAN”;Z;” YOU”;Y;” THE TAXMAN WINS.”
747 REM *** AGAIN?
754 PRINT”AGAIN (Type 0 for NO)”;
756 INPUT R
759 IF R=0 THEN 999
760 GOTO 122
797 REM *** INITIALATION
802 PRINT”HOW MANY NUMBERS DO YOU WANT IN THE LIST”;
804 INPUT N
806 LET N=INT(N)
808 IF N <= 0 THEN 999
810 IF N=50 THEN 818
811 IF N<50 THEN 818
812 PRINT”AT THIS TIME, REGULATIONS ALLOW A MAXIMUM OF 50 NUMBERS.”
814 GOTO 800
818 LET Y=0
820 LET Z=0
824 PRINT”THE LIST IS:”;
826 FOR I=1 TO N
828 PRINT I;
830 LET L(I)=1
832 NEXT I
834 IF N>1 THEN 844
838 PRINT”HOW VERY GENEROUS OF YOU TO FORFEIT ALL TO THE TAXMAN.”
840 PRINT”TAXMAN 1 YOU 0 THE TAXMAN WINS.”
842 GOTO 750
897 REM *** INSTRUCTIONS
901 PRINT”YOU TRY TO BEAT THE TAXMAN.”
904 PRINT”WE START WITH A LIST OF WHOLE NUMBERS IN NUMERICAL”
906 PRINT”ORDER (YOU DECIDE HOW MANY).”
910 PRINT”YOU TAKE A NUMBER FROM THE LIST — THE TAXMAN GETS”
912 PRINT”ALL THE FACTORS OF YOUR NUMBER THAT ARE STILL LEFT”
914 PRINT”YOUR NUMBER AND ALL OF ITS FACTORS ARE THEN DELETED”
916 PRINT”FROM THE LIST.”
920 PRINT”FOR EXAMPLE, SUPPOSE YOU WANT TEN NUMBERS TO BE IN THE LIST.”
922 PRINT”THEN THE LIST WOULD BE: 1 2 3 4 5 6 7 8 9 10″
926 PRINT”IF YOU TOOK 8, THE TAXMAN WOULD GET: 1, 2, AND 4″
928 PRINT”AND THE NEW LIST WOULD BE: 3 5 6 7 9 10″
929 PRINT”TYPE <RETURN> TO GO ON”
932 PRINT”THE TAXMAN MUST GET SOMTHING EVERY TIME SO YOU CAN”
934 PRINT”ONLY PICK A NUMBER THAT HAS FACTORS LEFT,”
938 PRINT”WHEN NONE OF THE REMAINING FACTORS,”
940 PRINT”THE TAXMAN GETS THEM!!!”
944 PRINT”YOUR SCORE IS THE SUM OF NUMBERS YOU TAKE.”
946 PRINT”IF YOU WANT TO GIVE UP, TAKE 0.”
948 PRINT”GOOD LUCK !!!”
950 GOTO 122
It’s not much to look at, but it is kinda neat to see it run.
I had just found out that the Oregon Trail game is a LOT older than the Apple II version that infested schools in the 1980’s and gave us the infamous broken axle. As a matter of fact it was first written for the HP 2100, in BASIC.
There is a most excellent blog, The Digital Antiquarianthat goes over the restoration of this old gem. Even better they managed to get it loaded up onto a timesharing image, on the internet so you can play it! (it’s been since taken offline. sorry).
1. Telnet to mickey.ath.cx. (Telnet, mind you. None of that newfangled SSH!) 2. Slowly alternate CTL-J and CTL-M until you see a “PLEASE LOG IN” message. 3. Enter “HEL-T001,HP2000,1″. Without the quotes, of course — and note that those are zeroes. Oh, and the system isn’t case-sensitive, but for the authentic experience you might want to have your caps lock on. 4. Enter “GET-OREGON” to load the 1975 version, “GET-ORE2″ to load the 1978 version. 5. “LIST” the program if you like, or just “RUN” it.
Well I was looking at some stuff on old games, and naturally everyone always did love Duke Nukeem 3D!
Now what is really cool, is that that the guy behind the build engine, Ken Silverman released the source to the ‘build’ engine, but also some of the builds of build as it progressed.
Ken is a big fan of QuickBasic, so to compile his earliest version, you’ll need QuickBasic 4.5, or the QBasic that came with MS-DOS 5.0 and above.
Download picrot4.bas, and run it through basic, and you’ll get this:
Under some emulators (Virtual PC) you’ll get a corrupted screen at first, hit any of the arrow keys, and it’ll redraw the screen into what it should look like. Considering the 8kb of basic code includes the engine, and the map it’s pretty snazzy!
You can find the timeline, and other versions of the build engine as it progressed on Ken’s web page.
As the engine improved, and was ported into C, it only got better! Then it was sold and licensed out, which gave rise to great games like 3D Realms Duke Nukem!
After the build engine went open, 3D realms followed up, in releasing their extensive modifications to build which can be found here.
With the release of Build & Duke 3D, it’s only natural that they shed their humble MS-DOS beginnings and found their way onto Windows as full Win32 applications taking advantage of the hardware. Thanks to the work of Ken & Jonathon. You can find the results on Jonathon Fowler’s page here.
I suppose later I’ll have to see if it’ll build with the win64 tools… It’s be neat for a 64bit version of Duke!