I am trying to run the source code found at https://taipangame.com/BASIC.txt on Epple 2 (with Apple II+ roms) to eventually run on my own Apple II+, but the program keeps crashing.

First, I used a python script to clean up the text and remove all spaces not between quotes. The reason for this is some of the lines are too long to type in with spaces and the batch paste ends up not working correctly.

text = """<the code starting from 10 without the final bracket>"""
lines = text.split("\n")
for i in range(len(lines)):
    if lines[i].startswith(" "):
            lines[i] = lines[i][1:]
for i in range(len(lines)-1,-1,-1):
    if lines[i].startswith("    "):
        lines[i-1] += lines[i][4:]
while i<len(lines):
    if lines[i].startswith("    "):
        del lines[i]
for i in range(len(lines)):
    lines[i] = re.sub(r"\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)", "", lines[i]) # deletes all spaces not between quotes
    lines[i] = re.sub(r"(^\d*)",r"\1 ",lines[i]) # adds back space after line number

However, after copying this script into Epple (and running LIST to make sure it looked fine) I RUN it and it gives the error 1842- A=31 X=9C Y=06 P=31 S=F9.

At this point, the computer starts acting very weird. I tried running LIST, RUN, PRINT and 1 REM and all of them errored at address 012A. Address 012A contained the byte 03.

I am not sure what steps to take next. The issue could be with the emulator, or the python script, or even the website I got the code from. Any help would be much appreciated.

(Note: My final goal is to save Taipan as a cassette .wav to play into the Apple II's cassette jack from my phone, since I do not have a floppy drive.)

  • 1
    It could be a help if you also added a link to the "fixed" textfile also.
    – UncleBod
    Nov 26, 2023 at 10:06
  • 2
    Is the linked source written for an Apple II+? If not it might very well crash since it contains both POKE (change of memory) USR and CALL (both calling a machine code in the ROM (or wherever you point them)). It might be the TRS-80 source code that is linked as "Original BASIC source".
    – UncleBod
    Nov 26, 2023 at 10:58
  • 1
    The various implementations I've looked at use DOS tricks to wrap the title screen and assembly subroutines with the Applesoft program. I think you're running into some latent copy protection. Transferring it to cassette may not be straightforward.
    – fadden
    Nov 26, 2023 at 15:40
  • Sorry about the delay, here is the compressed code I made: pastebin.com/tuFvnveM Nov 26, 2023 at 15:52
  • @UncleBod It is most likely Applesoft code from the use of VTAB and HTAB, which from what I can tell are Applesoft specific commands. Nov 26, 2023 at 15:55

2 Answers 2


You don't need to follow the listing far to see the problem.

Line 10 ends with GOTO 10000, and 10000 starts with CALL 6147, which is $1803, smack in the middle of the Applesoft source code, which continues up to around $4200 if it starts at the default of $800.

There are many other CALLs in the listing. The original program had assembly language routines - at least for the HRCG (Hires Character Generator for hires text). And because it used hires, the Applesoft portion of the code had to run higher in memory.

If you look at the version of Taipan on the disk image on this page named "taipan+.dsk", the Applesoft that corresponds to your listing starts at offset $3800 in the file.

If you boot the disk and LOAD TAIPAN, you can see the game's title screen on hires page 1, and at $1803 there's the routine it should be calling. Your listing starts at $801 + $3800 = $4001.

The pure Applesoft version in the book on that Taipan website seems quite different.

  • That does make sense. I for some reason was thinking that CALL 6147 corresponded with $6147, which is just in free ram. I thought somehow it loaded raw data not part of the basic code to that section of ram, which would be really weird when I think about it. I suppose the code in the book is different since it isn't compressed to as small as possible, but I'm not sure where the website's code gets the graphics from, too. It starts to make less and less sense the more I read it. Nov 26, 2023 at 15:50
  • I wonder why the technique of relocating start of BASIC code to $4000 or $6000 wasn't used more often? It allows a single loadable file to contain one or two title screen pictures that can be jetissoned after they are displayed, and it avoids the danger of having hires graphics commands clobber a BASIC program, variables, or strings.
    – supercat
    Nov 26, 2023 at 18:43
  • 2
    EvanTheGamer: as mentioned by @fadden the structure of Applesoft program files (which is basically a linked list) can be modified so create space and place code or data between lines of Applesoft. That's the case with the version I linked to, where it starts (at $801) with one line of basic, then it has assembly routines and the initial title screen all the way up to $4000, where it continues with your listing. The original .WOZ file is available in this Facebook post if you want to explore it. It's a 13-sector disk. Nov 27, 2023 at 0:12

You might have more luck with the BASIC program from this disk: Taipan Hayden Book Version, which was apparently keyed from the Taipan: A Historical Adventure For The Apple Computer book.

It at least starts on an emulated Apple II. I dumped the source via AppleCommander: scruss/TAIPANH.bas

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .