Computers Overview
Commodore PET
    Adverts
    Articles
    Documents
    Options
    Photos
    Projects
        Documents
        MemoPET
        PET ROMs
        petSD+
    Repairs
    Software
Sinclair ZX80
Sinclair ZX81
BBC Micro
Commodore 64
Sinclair ZXSpectrum
Memotech MTX
Memotech CP/M
Tatung Einstein
Atari ST
Commodore Amiga
PDAs
DEC 3000 AXP
OpenVMS
Raspberry Pi

 

 
 
 

Commodore PET Projects

MemoPET

   
   

UNDER CONSTRUCTION !

Introduction

MemoPET is a co-processor board designed for use in MTXPlus+; a project developed by Martin Allcorn and myself to build a "super Memotech MTX". The project is still in the development stage but three working prototypes have been built and running.

 The system architecture uses a multi-slot backplane with separate cards used for the CPU, video display and I/O functions. The core processor is a Z80 but the system supports co-processors installed on their own boards. Martin has already designed a 6502 co-processor board that can be used to emulate a BBC Model B micro.

MemoPET is another 6502 co-processor board, designed to emulate a Commodore PET. Martin describes development of MemoPET below :

Introducing MemoPET

A 6502 based coprocessor designed for the MTXPlus+. (Other than ensuring the MTX PSU has enough power the basic design should also work with the MTX500/512)

Whilst the software is very much work in progress the prototype board has achieved most of the design goals.

The original 6502 co-processor used a minimal design and relies on the MTXPlus+ for all of the input/output, the 6502 can only “see” memory. The new board aims to supply the 6502 with a limited set of peripherals.

The two biggest I/O bottlenecks are the display and disc storage, so those I wanted to put on the board. Keyboard and sound will be passed back to the MTXPlus to deal with. Originally, I wanted to try a large memory system using the 65816 rather than the 6502, however the extra design considerations for accessing the extended memory would have required a completely new OS.

The next option was to go do small memory system like the Acorn Atom or Commodore VIC-20 using the 65816 in 6502 emulation mode. With a patched version of the original OS to allow access to the extra memory banks. However, the video hardware on both systems would have been a struggle to fit into the CPLDs I have available.

The character based display of the older Commodore PET range in not unlike the MTX 80 column display, but without the colour attribute. The VHDL code for that fits the CPLD with room to spare.

Fitting all of the PET components required for the IEEE expansion would have required more space than the Eurocard format allows. However, using the serial IEC port from the Vic and C64 would fit into the space, at the expense of complicating the software.

So, the original design had a 65816 CPU, 512k RAM 512k ROM, along with the external hardware to latch the top 8 bits of the address bus. The video display needed 2k of dual port RAM and an 84 pin CPLD to generate the VGA timing for the 80 column display. The display also needs a ROM with the character definitions . The IEC serial port needs a 6522 VIA.

Since I wanted to try and emulate the 40 column pet display as well as the larger one, the shift register, colour register and colour multiplexer are all external components. This leaves the maximum available space in the CPLD for logic.

VGA at 640x480 specifies a 25.175MHz clock so the board needs an oscillator, most monitors will lock on to VGA generated from a 25MHz clock. Since that’s not available from the MTXPlus+ either, I fitted the correct speed part. That needs dividing by 2 to generate the clock for the 40 column display, halving that again would produce a clock just under 6.3mhz that I was going to try and run the CPU from.

Communication with the MTXPlus+ required some way to transmit between the 2 CPU’s Rather than use another 48 pin (and expensive) dual port ram I decided to use two pairs of 4 bit registers to allow for 4 byte data transfers in each direction. Mapping that into the Z80’s I/O map needed a small CPLD even if there’s available space, and at the time I wasn’t sure there would be, there aren’t enough pins on the big CPLD.

It took several attempt, but eventually I had a design that would fit the 19 chips and other parts into the available space.

The Fist 64k of the memory map was designed to be as close to a real pet as possible.

 

Memory Map of real pet   Proposed low memory map
FFFF 4k Kernal   FFFF 5.75k ROM
F000 Remainder of Editor
ROM on later models
     
F900 I/O Area   F900 E840VIA
  E880 CRT Controller     E8B0 Colour Latch
  E840 VIA     E8A0  Comm Regs In
  E820 PIA     E890 Comm Regs Out
E800 E810 PIA   E800 E800 Spare
  2k Screen Editor 22k ROM
E000 12k ? BASIC      
D000        
B000 4k EPROM Space      
A000 4k EPROM Space      
9000 Available for Screen   9000 Shadow Copy of Screen RAM
8800 80 Column Screen RAM   8800 80 Column Screen RAM
8000 32k RAM   8000 32k RAM
         
         
0000     0000  

 

Full 1MB Memory Ma
FFFFF
F0000
Data RAM

E0000
Data RAM

D0000
Data RAM

C0000
Data RAM

B0000
Data RAM

A0000
Data RAM

90000
Data RAM
88000
80000
Data RAM
Low Memory RAM

70000
Data ROM

60000
Data ROM

50000
Data ROM

40000
Data ROM

30000
Data ROM

20000
Data ROM

10000
Data ROM

00000
Low Memory Block

The extended memory map was kept simple, and split evenly between ROM and RAM

Initial tests showed issues either from the wiring of memory, or the memory paging arrangement. In order to sort determine where the issues were, the board was re-wired to take the current production version of the 6502, which is the W65C02S.

Dispensing with the 65816 allowed for the removal of the 2 devices involved in separating the data bus and upper address bus. It also allowed for the fitting of a physically smaller 32k ram. A smaller 28 pin eeprom could have been used but they’re usually slower than the 32 pin flash devices. The prototype still has a 32pin device, but only portions of the first 32k are used.

That leaves the board with a just the low part of the memory map, very much like the original pet. The major differences are in the I/O area.

Re-wiring for the 6502 helped identify an issue with the address bus preventing the system working. At which point I had the basic components CPU, ROM & RAM connected and working.

Adapting the VHDL display code from the CFX-3 to produce a mono display with 40 and 80 column options is more or less complete, allowing for further testing of the rest of the board. The extra logic to allow for the separate display opting turned out to only need a couple of extra macro-cells, however the number of pins in use means incorporating the external video components isn’t an option.

The 6502 chip like the Z80 has 2 interrupt pins IRQ that can be turned off in software, and NMI that cannot. The PET Kernel uses the NMI to trigger the break process and return to the system prompt. In order for the Z80 side, which will provide the keyboard support to be able to support this, a extra pin from the second logic device has been programmed to issue a short pulse when a designated I/O port is accessed.

The other interrupt supports both the 50/60hz system counter and the 6522 VIA, so the interrupt out from the VIA has to be connected to the CPLD where it can be mixed with vsync and passed to the CPU.

2 way communication with the Z80 CPU to provide keyboard input has been incorporated into a modified pet “Editor” rom. The Z80 side is currently a short basic program that scans the keyboard on request. That’s enough to type in and run short programs in Commodore Basic 4 on the MemoPET board.

The board itself beats expectations for the speed at which it will run at. It has shown no signs of instability when running off the 12.6mhz clock intended for the 40 column VGA display instead of the 6.3 clock I had intended to use. Part of this may be the decision to use the 6502 in place of the 65816 so for now there are no plans to revert back to the bigger chip, the Memopet will retain the older CPU and smaller memory map.

On thing that hasn’t be successful so far is the IEC interface, the timing for the serial interface is entirely done in software and to date I’ve not managed to get the board to connect to any IEC peripherals.

To try and get to the bottom of the, I’ve built an additional clock board that plus into the sockets freed up by the 65816 to 6502 re-wire. That clock runs at the same frequency as the clock in the Vic20 so while further code testing takes place the IEC code from the Vic can be used without needing to “tweak” the timing delays.

Merging the IEC code into the Pet roms still needs to be done and that is the next task. That needs more investigations of exactly how the Pet handles the IEEE interface so could take some time.  

 

 

         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         

 

Placeholder





mailto: Webmaster

 Terms & Conditions