chipKIT® Development Platform

Inspired by Arduino™

ATARI ST Interface with the outer world

Created Thu, 15 Mar 2012 16:12:01 +0000 by vintageguy


vintageguy

Thu, 15 Mar 2012 16:12:01 +0000

I had a neat atari when I was young, now that is years ago. The one thing I never had, in the old days, was a hard disk. There have been a lot of such projects for the Atari, and even a project using a 400MHz blackfin CPU. I always considered them too complicated, or too bloated, and the minute I saw chipKIT Max32. It was like built to be as a peripheral interface.

Currently, I got the signal timing done. My idea is to use the PMP to communicate with the Atari, through it's SCSI like interface, ACSI. And simply, pipe through, the commands to an USB stick. Ultimately provide internet, printer, cd rom and hard disk communications through the simple ACSI interface.

So far, this is what I've got

void status_byte(byte p_status)
{  
   volatile int jiffies;
   
   SEL_AB = LOW;
   mACSI_Output();
   LATE = (LATE & 0xFF00) + p_status;
   HANDSHAKE = LOW;
   for( jiffies=0; PMRD == HIGH ; jiffies++ )
     if( jiffies > 300 )
       break;
   for(int i=0; i<10;i++);
   HANDSHAKE = HIGH;  
}

void AtariInterrupt()
{
   volatile int jiffies;
   volatile int _idx = 0;
   // Select the command interface
   SEL_AB = LOW;
   // Set lines RE0-7 as input lines.
   mACSI_Input();
 
   do {
     // Inactivate handshake
     HANDSHAKE = HIGH;
     // Get the raw data
     acsi_cdb.block[_idx++] = PORTE & 0xFF;
     // Only 6 byte SCSI commands, exit if done
     if( _idx == 6 )
       break;
     // Signal for next byte
     HANDSHAKE = LOW;
     // IF the CS line is low, wait for it to become inactive (default state)
     while( PMCS1 == LOW );
     // Now wait for a Write strobe, from the ATARI
     for( jiffies=0; PMWR == HIGH ; jiffies++ )
       if( jiffies > 200 )
         break;
   } while( PMWR == LOW );
   HANDSHAKE = HIGH;
   scsi_cmd = (_idx == 6);
}

There is some extra cirquitry involved, simple logic cirquitry that simplifies the hanshaking with the atari. The Atari has data and command handshaking, which I select with a 2 to 1 multiplexer. The start of a command, is also done by having two lines active at the same time, A1 and CS lines, which I use an OR, to indicate, and activate the above interrupt routine.

It may not look like much, but it does the job done. The goal is to have this done by interrupt, the PMP interrupt to be precise. But right now, I am still battling the poor documentation I have, to get a better understanding of the workings. I can communicate perfectly with the Atari, through it's interface, exchanging both command and data.

The Max32 is perfectly capable of handling this, typical jiffies in the above routine, vary around 90 jiffies. Which makes polling a bit bloated, and I intend to use a different routine to do the job. I only have this job basically outlined, at the moment.

Communicating with the Atari, with data, is also completed with the code below.

bool ACSI_ReadBuffer(volatile byte *data_p, volatile int length)
{
  volatile int jiffies=0;
  
  mACSI_Input();
  SEL_AB = HIGH;
               
  while( length-- && jiffies < 300 )
  {
     HANDSHAKE = LOW;
     for( jiffies=0; PMWR == HIGH ;jiffies++ )
       if( jiffies > 300 )
         break;
      if( PMWR == LOW )
       *data_p++ = PORTE & 0xFF;
     HANDSHAKE = HIGH;
     while( PMWR == LOW );
  }
  SEL_AB = LOW;
  if( jiffies >= 300 )
      Serial.println(length,DEC);
  return (jiffies < 300);
}

bool ACSI_WriteBuffer(volatile byte *data_p, volatile int length)
{
  volatile int jiffies=0;
  
  mACSI_Output();
  SEL_AB = HIGH;
  while( length-- && jiffies < 300 )
  {
    HANDSHAKE = LOW;
    LATE = (LATE & 0xFF00) + ((*data_p++) & 0xFF);
    for( jiffies=0; PMRD == HIGH; jiffies++ )
      if( jiffies > 300 )
        break;
    HANDSHAKE = HIGH;
    while( PMRD == LOW );
  } 
  SEL_AB = LOW;
  return (jiffies < 300);
}

Jacob Christ

Thu, 29 Mar 2012 07:12:15 +0000

I have a 20M (the M for Megabyte) Atari ST HDD I bought used for $500. I would be willing to let it go for about the same. I'm not sure if it works any more, but it did the last time it was turned on some 20 years ago. I cut over to a 386 PC clone when I couldn't find a EEPROM programmer to work with the Atari.

Jacob

P.S. Just kidding about selling the drive, though I'll probably never use it again, it has some code with sentimental value on it and my Megamax C Compiler.


vintageguy

Fri, 06 Apr 2012 21:04:38 +0000

I did a lot of looking around for good drives to use, and I've been looking at soldering an IDE inside the machine.

But, basically ... I wanna do it myself, not buy one :-) This is my "nostalgia", however I did get myself an atari with a good DMA chip, in case. The one I have, has a poor one ... but I'm still fighting the basics.

I've gone around and around, and to me it looks like the max32 is not quite suited for the job. It's very volatile, although it can do it, but I need to build too much hardware around it. I'm guess that a FPGA is needed. Hell no, I'm gonna fight this one ... I just packed up an old NE555, and put it up to do a 150ns pulse. I sacked my good old GAL20V8, but have a few extra on their way :-) Damn, I have this rubber mat here ... and did it give me static charge ... I saw blue lightning coming from my finger tips over to the GAL, when I was programming it ... damn.


Jacksonhall

Wed, 27 Jun 2012 12:35:16 +0000

I have a 20M (the M for Megabyte) Atari ST HDD I bought used for $500. I would be willing to let it go for about the same. I'm not sure if it works any more, but it did the last time it was turned on some 20 years ago. I cut over to a 386 PC clone when I couldn't find a EEPROM programmer to work with the Atari. Jacob P.S. Just kidding about selling the drive, though I'll probably never use it again, it has some code with sentimental value on it and my Megamax C Compiler.

I am with you bro...


Demolishun

Wed, 10 Oct 2012 21:38:06 +0000

USB OTG and flash drive?

Can you use the DMA at all to help with interface?