Jump to content
IGNORED

ColecoVision Games in PASCAL? Using forensic tools to confirm lore.


tschak909

Recommended Posts

I have disassembled a &&&& load of original Colecovision games and have already discovered plenty of pascal calls.
I would have to go through the code to give an accurate listing but off the top of my head Smurf Rescue I believe was one of them.
 

 

edit....

 

I just checked and both Smurf Rescue and Donkey Kong 24k both use Pascal entry points.

Does this mean they were written in pascal?  No clue but the Pascal BIOS calls are abundantly clear.

Edited by Captain Cozmos
  • Like 1
Link to comment
Share on other sites

6 minutes ago, Captain Cozmos said:

I have disassembled a &&&& load of original Colecovision games and have already discovered plenty of pascal calls.
I would have to go through the code to give an accurate listing but off the top of my head Smurf Rescue I believe was one of them.
 

 

edit....

 

I just checked and both Smurf Rescue and Donkey Kong 24k both use Pascal entry points.

Does this mean they were written in pascal?  No clue but the Pascal BIOS calls are abundantly clear.

Yes.

 

-Thom

Link to comment
Share on other sites

find-pascal returns the following for Zaxxon:
 

thomc@TMA-2:~/Workspace/tnfs-backup/Coleco Adam/Games/ColecoVision/Z$ find-pascal Zaxxon\ \(1982\)\ \(Coleco\).rom 
Zaxxon (1982) (Coleco).rom:
	WRITE_VRAMP

 

so it's a maybe. It may have been at one point, but converted to assembler, with this routine remaining, or maybe it was more convenient to have the arguments in pascal order at this point in the code.

 

-Thom

 

Link to comment
Share on other sites

46 minutes ago, Captain Cozmos said:

Smurf.zip 21.73 kB · 2 downloads

 

recompile it with a drag and drop on TNIASM

 

I also set this to bypass the Colecovision logo screen, strait to player select.

 

 

Great work BTW....
You actually have tools but I found these totally by accident.

Find more and I'll de-compile when I get some time.

Thank you, I wrote the tool, myself.

 

The source code:

/**
 * @name find-pascal
 * @brief a tool to scan Coleco game cartridges for Pascal vector usage
 * @author Thomas Cherryhomes
 * @email thom dot cherryhomes at gmail dot com
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>

/**
 * @brief Pasca functoins detected?
 */
bool hasPascalFuncs = false;

/**
 * @brief Vector table with function names
 */
struct _vectorTable
{
  unsigned short addr;
  char name[32];
} vectorTable[] =
  {
    {0x1F64, "ACTIVATEP"},
    {0x1F67, "PUTOBJP"},
    {0x1F8B, "INIT_TABLEP"},
    {0x1F8E, "GET_VRAMP"},
    {0x1F91, "PUT_VRAMP"},
    {0x1F94, "INIT_SPR_ORDERP"},
    {0x1F97, "WR_SPR_NM_TBLP"},
    {0x1F9A, "INIT_TIMERP"},
    {0x1F9D, "FREE_SIGNALP"},
    {0x1FA0, "REQUEST_SIGNALP"},
    {0x1FA3, "TEST_SIGNALP"},
    {0x1FA6, "WRITE_REGISTERP"},
    {0x1FA9, "WRITE_VRAMP"},
    {0x1FAC, "READ_VRAMP"},
    {0x1FAF, "INIT_WRITERP"},
    {0x1FB2, "SOUND_INITP"},
    {0x1FB5, "PLAY_ITP"}
  };

bool hasPascalFuncs;

int main(int argc, char *argv[])
{
  if (argc < 2)
    {
      printf("%s <filename>\n",argv[0]);
      return 1;
    }

  FILE *fp = fopen(argv[1],"rb");

  if (!fp)
    {
      perror(argv[0]);
      return 1;
    }

  while (!feof(fp))
    {
      unsigned char b = fgetc(fp);

      if (b == 0xCD) // CALL
	{
	  unsigned short a;

	  fread(&a,sizeof(unsigned short),1,fp);
	  for (int i=0;i<17;i++)
	    {
	      if (a == vectorTable[i].addr)
		{
		  if (hasPascalFuncs == false)
		    {
		      printf("%s:\n",argv[1]);
		      hasPascalFuncs=true;
		    }
		  printf("\t%s\n",vectorTable[i].name);
		}
	    }
	}
    }

  if (hasPascalFuncs == true)
    printf("\n");
  
  fclose(fp);
  
  return 0;
}

 

-Thom

Link to comment
Share on other sites

If you found only one pascal entry point in Zaxxon then that is all there will be.  Your tool is very thorough.

3 of my kids and grandson are coming in this weekend for their sisters graduation from HS so I can't promise a Zaxxon disassembly right away but I will get to it.
Because I have to scour through every inch of the code to identify tables and such I have learned a great deal of Z80 assembly language so this is homework/refresher course.

 

Link to comment
Share on other sites

2 minutes ago, Gemintronic said:

Any chance we'll discover the Pascal dev kit someday?  It would be amazing to have as another option besides asm and C.

Well, the environment itself is the 64000 development system, its editor, and the pascal and c compilers.

 

As part of that, there were bindings to marshal parameters to the calls in the jump table in the OS7 ROM. There was a graphic editor (which has been found and released) but otherwise, that's pretty much it.

 

There's not much magic to it.

 

-Thom

 

Link to comment
Share on other sites

The Pascal stuff is pretty wasteful of CPU resources.  The C routines pass args in and out through register calling convention.  Pascal uses the stack exclusively.  They wrote a generic function that all the P-versions of the calls would call to then pop the args off the stack, store them into the appropriate registers, and then fall through to the C version of the code.  So other than the "thrill" of using Pascal, I see no reason to use those calls.  I was quite surprised to see that my DK cartridge used it.

  • Like 1
Link to comment
Share on other sites

Just now, ChildOfCv said:

The Pascal stuff is pretty wasteful of CPU resources.  The C routines pass args in and out through register calling convention.  Pascal uses the stack exclusively.  They wrote a generic function that all the P-versions of the calls would call to then pop the args off the stack, store them into the appropriate registers, and then fall through to the C version of the code.  So other than the "thrill" of using Pascal, I see no reason to use those calls.  I was quite surprised to see that my DK cartridge used it.

Correct. I've been slowly piecing together enough of a 64000 environment to show how things were done at COLECO, but it will probably take me a few more years to get the missing bits (e.g. the 64800 compilers option)

 

There was an initial decision to try and use Pascal at Coleco to quickly speed up game development. They had an idea of using e.g. high school or college interns to write the game code, this way. But it didn't work out. While the code was definitely fast enough, both the density of the compiled code, and the function call overhead ultimately meant that COLECO were going to lose money needing to produce additional ROMs to hold the data.

 

--- ON ANOTHER POINT ---

 

One thing I want to try to demonstrate at some point, is to demonstrate how OS7's display object management code worked, and how it resulted in making complex spite and tile interactions easier to program, as almost no code today uses these routines, and there are no visible examples of it.

 

(I know, I can hear those of you screaming at me saying "WHY BOTHER?!" This is all in the spirit of preserving knowledge and historical context)

 

-Thom

  • Like 3
Link to comment
Share on other sites

6 minutes ago, youki said:

Did you scan Cosmic Avenger?  I think it has been the first game developped for the colecovision as proof of concept.  May be it is before they decided to code in pascal..

Yes, as I have stated before, I scanned my entire collection at once, and your assertion of it being the proof of concept may not be correct.

 

thomc@TMA-2:~/Workspace/tnfs-backup/Coleco Adam/Games/ColecoVision/C$ find-pascal Cosmic\ Avenger\ \(1982\)\ \(Coleco\).rom 
thomc@TMA-2:~/Workspace/tnfs-backup/Coleco Adam/Games/ColecoVision/C$ 

 

-Thom

Link to comment
Share on other sites

33 minutes ago, tschak909 said:

Yes, as I have stated before, I scanned my entire collection at once, and your assertion of it being the proof of concept may not be correct.

 

thomc@TMA-2:~/Workspace/tnfs-backup/Coleco Adam/Games/ColecoVision/C$ find-pascal Cosmic\ Avenger\ \(1982\)\ \(Coleco\).rom 
thomc@TMA-2:~/Workspace/tnfs-backup/Coleco Adam/Games/ColecoVision/C$ 

 

-Thom

It is what i read in an interview from the developper of Cosmic Avenger few years ago.  I don't remember where i read it however.  May be in one of retrogamer magazine issue.

 

Lot of believe that Donkey kong was the first game developped for the colecovision but in fact it is Cosmic Avenger. (at least it is what that stated in the article).

 

 

Link to comment
Share on other sites

Could this talk of Pascal being wasteful on resources be the reason why both Donkey Kong and Smurf Rescue were later re-released as 16K ROM carts? I know Smurf Rescue was cleaned up first, as very few 24K ROM carts exist (at least one was known to exist in Canada!), but Donkey Kong wasn't cleaned up until early 1983, around the time its sequel Donkey Kong, Jr. was released for the console.

 

~Ben

Edited by ColecoFan1981
Link to comment
Share on other sites

3 minutes ago, ColecoFan1981 said:

Could this talk of Pascal being wasteful on resources be the reason why both Donkey Kong and Smurf Rescue were later re-released as 16K ROM carts? I know Smurf Rescue was cleaned up first, as very few 24K ROM carts exist (at least one was known to exist in Canada!), but Donkey Kong wasn't cleaned up until early 1983, around the time its sequel Donkey Kong, Jr. was released for the console.

 

~Ben

it was a simple cost reduction, an additional ROM is a significant hit on bill of materials. ;)

 

-Thom

 

Link to comment
Share on other sites

6 hours ago, youki said:

Did you scan Cosmic Avenger?  I think it has been the first game developped for the colecovision as proof of concept.  May be it is before they decided to code in pascal..

As far as everything that has been shared, Cosmic Avenger was indeed the first CV game that was developed as a proof of concept. As far as what I’ve heard, Coleco partnered with Nuvatec to complete the CV and more importantly make it easily expandable with the idea of expansion into a full fledged computer.

 

I forget the rest of the details re if a Coleco or Nuvatec programmer wrote Cosmic Avenger, but again it was reported as being the first CV game.

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

Have you made an updated list of Games?
Smurf Rescue has it's shares and now I know how to reference them in the disassemble process.
My own investigating is the Donkey Kong 24k version and I will find more as I go down the list.

Through your own finding what others since this post.
I have an itch to get through those early on.

My plan is to disassemble and publish every Colecovsion (early games, 1980's) source code.
When I say all, I mean "all"

Smurf and Centipede are 99% but I can do better.
I want to eventually go back to them, label everything with comments as well as a brief description about it's basic outline.

 

O3 Cozmos

Link to comment
Share on other sites

6 hours ago, Captain Cozmos said:

Have you made an updated list of Games?
Smurf Rescue has it's shares and now I know how to reference them in the disassemble process.
My own investigating is the Donkey Kong 24k version and I will find more as I go down the list.

Through your own finding what others since this post.
I have an itch to get through those early on.

My plan is to disassemble and publish every Colecovsion (early games, 1980's) source code.
When I say all, I mean "all"

Smurf and Centipede are 99% but I can do better.
I want to eventually go back to them, label everything with comments as well as a brief description about it's basic outline.

 

O3 Cozmos

The list I posted is literally the exhaustive scan using the software that I wrote, against all the Coleco titles.

 

-Thom

Link to comment
Share on other sites

11 minutes ago, tschak909 said:

The list I posted is literally the exhaustive scan using the software that I wrote, against all the Coleco titles.

 

-Thom

Thanks, just touching base because you never know.

I deciphered how to use the Pascal entry points and I know how to remove them if necessary.

I watched your video and I do have to go off interviews, things I have read and what not but...
I can be fully on board with DK 24 being written in Pascal, I have yet to completely disassemble it though.
As far as the Smurf Rescue, I posted the completed version in the revisited thread.
It only uses a few Pascal entry point while the rest are standard.

If I had to make a hypothesis it would be that they switched gears in the middle of programing it for whatever reason.  Be it trying to fit within 16k or whatever.
The Timers are Pascal entry points which would be a pain to root out.

While most of the rest is pure assembly with maybe 1 being a Sound_Init or some deal.
Check it out if your interested.

 

I haven't worked on Zaxxon yet.  That will be soon.

Edited by Captain Cozmos
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...