laanwj / sundog

A port of the Atari ST game SunDog: Frozen Legacy (1984) by FTL software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unknown Op Code

tpitman opened this issue · comments

I was able to find a SDL2 example project for iOS. I imported your project into that project and fixed up some compiler errors.

I then loaded it up and it seems to get started ok, but then encounters an unknown Op code and has a fatal error.

Here is the debug output:

psys_bootstrap: 1024 entries in global directory
Found SYSTEM.PASCAL at offset 380400
Found USERPROG at offset 0x380400, size 0x00000, globals_size 0x0000
Needs byteswap
Initial IPC at 0xf3ec:0x01:0x0002
Initial TIB at 0x006e
Initial EVEC at 0xf3b8
Initial EREC at 0xf3be
Initial SIB at 0xf3c8
Initial global MSCW at 0x008a
Initial local MSCW at 0xf3ae
SYSCOM at 0x0000
EXTM at 0x0060
Execution error 11 (fatal)
Traceback [tib=006e sp=efa4]
:0x01:0207 mp=0xf3ae base=0x008a erec=0xf3be
:0x01:0002 mp=0x008a base=0x008a erec=0xf3be

That is actually kind of exciting that it got that far at least. I am using a disc image from here:

https://www.oldgames.sk/en/game/sundog-frozen-legacy/download/8755/

The Execution error 11 seems to be triggered because the app is encountering an op code of 64 decimal or 0x40 hex. If I look that up in the header it is PSOP_UND40.

Any thoughts on why I might get that code?

The other thing that is interesting that you may not be able to help with is that on line 62 of the psys_bootstrap.c file I get a memory exception if I just let the app run.

When I went to debug this I put a breakpoint on that line. If I stop on that line with the breakpoint and then hit run or single step it works fine.

Is there some kind of threading thing or startup timing thing that would cause that to not work when it just runs versus stopping on that line and continuing?

I know this is an old repo, but am hoping maybe you can help me get this working. I am not interested in releasing it without permission or anything. I mainly just want to play it myself on my iPhone.

Thanks!

Okay that is strange. I'm not sure that that disk image works. Can you try with https://download.visucore.com/sundog/new_disk.st ?

At least it seems to be image related, the output here is:

psys_bootstrap: 4 entries in global directory
Found SYSTEM.PASCAL at offset 43800
Found USERPROG at offset 0x4cc00, size 0x01dee, globals_size 0x032c
  Needs byteswap
Initial IPC at 0xd5fe:0x01:0x1ab8
  Initial TIB at 0x006e
  Initial EVEC at 0xd5ca
  Initial EREC at 0xd5d0
  Initial SIB at 0xd5da
  Initial global MSCW at 0x008a
  Initial local MSCW at 0xd5c0
  SYSCOM at 0x0000
  EXTM at 0x0060

Copyright 1985 SofTech Microsystems/FTL Games/Oasis Systems, Inc.

I will give that image a try and let you know later...

Thanks!

I replaced the st file I was using with the one you referenced. Now I am getting a different unknown opcode:

psys_bootstrap: 1024 entries in global directory
Found SYSTEM.PASCAL at offset 380400
Found USERPROG at offset 0x380400, size 0x00000, globals_size 0x0000
Needs byteswap
Initial IPC at 0xf3ec:0x01:0x0002
Initial TIB at 0x006e
Initial EVEC at 0xf3b8
Initial EREC at 0xf3be
Initial SIB at 0xf3c8
Initial global MSCW at 0x008a
Initial local MSCW at 0xf3ae
SYSCOM at 0x0000
EXTM at 0x0060
Unknown OP code 83 (0x53)
Execution error 11 (fatal)
Traceback [tib=006e sp=efa4]
:0x01:0207 mp=0xf3ae base=0x008a erec=0xf3be
:0x01:0002 mp=0x008a base=0x008a erec=0xf3be

I just noticed that all of the output values from yours seem to be a lot smaller. The very first one being 1024 entries in the global dictionary where yours is 4. Are the rest of them memory locations that might be legit or should those values match what you are showing because they are inside of the pascal system and not actual ram in my computer?

If those values should all match then obviously I have some kind of parsing issue with the system reading things wrong from the start.

Any insight would be helpful...

If those values should all match then obviously I have some kind of parsing issue with the system reading things wrong from the start.

This should all match, given the same input image. They're properties of the P-system file system. There's something weirdly off with parsing, can't say I've seen this before.

It may be an endian issue (though as far as I know, Mac is also little-endian) or something sneaky with a compiler difference / C undefined behavior thing.

If you're using some different build system: are you passing -DFLIP_ENDIAN_HACK when compiling? If not, please try it with that.

That was it!!!! Horray. Now I can work on making the input work....

Thanks a ton!

This is running on my iPad:

Screen Shot 2022-12-30 at 6 31 15 PM

That's really awesome!!!

commented

This issue was solved and can now be closed, feel free to open a new one if you run into anything else.