Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 17 of 17

Thread: [queued] Tape Simulator for Exidy Sorcerer

  1. #1

    [queued] Tape Simulator for Exidy Sorcerer

    The Exidy Sorcerer (http://oldcomputers.net/sorcerer.html) is an early personal computer, arriving in 1978 on the heels of the Apple II, TRS-80, and PET. It features a 2 MHz Z80, up to 48K RAM, ROM cartridges (made from 8-track tape cases!), and a high-resolution monochrome display. Half the character set is based in RAM, so 512 by 240 pixel graphic displays are possible.

    The Sorcerer comes with a cassette tape interface which can run at either 300 or 1200 baud, pretty good for its day (but not entirely reliable). The Teensy-based simulator replaces the cassette interface and transmits software from a microSD card at 20833 baud. Instead of queuing up a tape and waiting 15 minutes for a 24K program to load at 300 baud (or trying it twice at 1200 baud), the user loads a menu, selects the program, and loads it, all in under a minute.

    Teensy 3.5 has 300 times the speed and 10 times the memory of the Sorcerer, so making it a storage peripheral is like the tail wagging the dog. But Teensy is cheap and easy, and using it this way preserves the best part of the retrocomputing experience as no system emulator can.

    The Sorcerer's cassette interface is on a daughterboard which feeds a UART on the motherboard. The UART chip's spec is good up to 30k baud. The Teensy replaces the daughterboard and generates the UART clock signal (16 times the baud rate) using the FrequencyTimer2 library. In practice, the Sorcerer's ROM-based loader can't keep up at 30k baud, but it can at 21k (and 2 stop bits). Teensy's second serial port connects directly to the 5V UART chip with no level converters required.

    In operation, Teensy repeatedly transmits a small piece of Z80 code, the terminal/loader, along with the required 5-second header. When the user enters LOG (LOad and Go) the Sorcerer runs the code and signals Teensy to send a menu. Teensy uses the SDFAT library to build the menu and sends it off. Sorcerer waits for a keypress and asks Teensy for another menu or for a file. The simulator presently supports 3 file types: .BAS for BASIC files, .COM for CP/M executable files, or .BIN for MESS/MAME binary files. When a file is selected, Sorcerer jumps to its ROM-based loader and Teensy transmits the header and program at a blazing 20833 baud (actually faster than some floppy drives of the day).

    Long ago I happened on a Sorcerer motherboard without case, keyboard, and cassette interface. I upgraded its RAM to 56K and modified its ROM for a third-party keyboard, but then it languished for decades with no software to run. Thanks to Teensy and software libraries from the Internet, my Sorcerer has a new life. I decorated it with LEDs driven from a data bus buffer and hung it on the wall. A friend of mine with a complete Sorcerer uses the Teensy now instead of playing WAV files off a CD into the cassette port (still less than reliable). The Teensy 3.5 is visible at upper left, below the colored clip leads.

    Click image for larger version. 

Name:	ExTeensy.jpg 
Views:	138 
Size:	85.7 KB 
ID:	16317

  2. #2
    Quote Originally Posted by Citabria View Post
    A friend of mine with a complete Sorcerer uses the Teensy now instead of playing WAV files off a CD into the cassette port (still less than reliable).
    I meant to say that CD WAV file loading is less than reliable. Teensy has proven quite reliable.

  3. #3
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    671
    Very cool! Thanks for sharing this. This would be great for the PJRC projects page.

  4. #4
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    339
    Very nice! Congratulations!

  5. #5
    Thanks!

    At 20833 baud with 2 stop bits, the transfer rate is 1.85K bytes/sec. I don't know what the typical rate was for CP/M machines but the Atari 810 was about 1.0 and the CBM 1541 about 0.5 KB/sec (they used serial ports). Apple Disk II was as high as 15 KB/sec!

  6. #6
    Wiring diagram for early (32K) Sorcerers:

    Remove cassette interface daughterboard and connect Teensy as shown:

    Click image for larger version. 

Name:	ExiCass2.jpg 
Views:	53 
Size:	150.3 KB 
ID:	18066
    Last edited by Citabria; 10-31-2019 at 02:34 PM.

  7. #7
    In model II (48K) Sorcerers, the cassette interface is on the motherboard, so the Teensy must connect directly to the UART:

    Remove the power supply daughterboard. Remove the UART IC from its socket at 9E. Slightly bend up pins 17, 20, 25, and 40, just enough to clear the socket when it's plugged back in. With clip leads, connect Teensy to the UART pins:
    UART Teensy
    1 --- +5V
    3 --- Gnd
    17 -- 5 FreqOut
    20 -- 1 Tx1
    25 -- 0 Rx1
    40 -- 5 FreqOut

    Replace the daughterboard. If it interferes with the clip leads, add a spacer under the right side bolts.

  8. #8
    Senior Member
    Join Date
    Apr 2019
    Posts
    159
    can you use this tape emulator on other devices - eg CBM 64 / Spectrum ?

  9. #9
    This simulator implements the Exidy tape file format, so it's not directly portable to other systems. However, it could be adapted. I don't know C64 nor Spectrum well, but I suspect there are already several more capable disk emulators available for them. The Sorcerer had no built-in disk support, and this simulator provides some disk-like features without the need to modify Exidy's original ROMs.

  10. #10
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    706
    I remember playing with an Exidy Sorcerer one summer, on loan from a family friend. That was the first computer we had in the house; maybe a year before we got our own Apple II. I remember the Sorcerer's tape drive storage was pretty frustrating, I thought maybe I just had a bad tape recorder. Guess I wasn't the only one!

  11. #11
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    339
    I remember fussing over the "azimuth calibration" of my Commodore64 Tape Unit. Tapes were not fun!! Purchased a 1541 disk unit after two years of saving weekly allowance.

  12. #12
    Very cool! Thanks for sharing this.

  13. #13
    Junior Member
    Join Date
    Aug 2020
    Posts
    3
    Quote Originally Posted by Citabria View Post
    The Teensy-based simulator replaces the cassette interface and transmits software from a microSD card at 20833 baud. Instead of queuing up a tape and waiting 15 minutes for a 24K program to load at 300 baud (or trying it twice at 1200 baud), the user loads a menu, selects the program, and loads it, all in under a minute.
    This is brilliant! I have just started renovating a Sorcerer, the same one I learned to program on in 1979, the start of a 35-year career in software! To my amazement, the hardware mostly still works but I am really struggling to load software from WAV files via cassette interface... only one successful load so far. I just found your post while googling for ideas.

    Is your software posted somewhere? I have a couple of questions:
    • I guess you must have written a Z80 module to receive and present the menu, is that right?
    • How did you convert the WAV files software to binary?


    It's a beautiful idea, I hope to do something similar, maybe with a different microcontroller.

    Rob

  14. #14
    Thanks!

    Yes, I wrote the Z80 code which works as described above: "In operation, Teensy repeatedly transmits a small piece of Z80 code, the terminal/loader, along with the required 5-second header. When the user enters LOG (LOad and Go) the Sorcerer runs the code and signals Teensy to send a menu. Teensy uses the SDFAT library to build the menu and sends it off. Sorcerer waits for a keypress and asks Teensy for another menu or for a file. The simulator presently supports 3 file types: .BAS for BASIC files, .COM for CP/M executable files, or .BIN for MESS/MAME binary files. When a file is selected, Sorcerer jumps to its ROM-based loader and Teensy transmits the header and program at a blazing 20833 baud (actually faster than some floppy drives of the day)."

    I have not yet posted the code. I was in the process of prettifying it when my W10 laptop updated itself to death. I managed to recover the code but have not yet reinstalled Arduino and Teensyduino and libraries to continue the work. It will be a project for this winter.

    This thread traces the development and also has a utility to convert wav files. I haven't tried it, since I started with binaries collected from the 'net. http://www.vcfed.org/forum/showthrea...r-II-Questions

    This page describes another installation of the TapeSim: http://www.atariprotos.com/othersyst...sc/tapesim.htm

  15. #15
    Junior Member
    Join Date
    Aug 2020
    Posts
    3
    Thanks for replying, I guess you are ClausB over on vcfed. I found that thread there, and subsequently posted my WAV to binary converter, written in python. Still would be very interested to see your Z80 program at some point. Sorry to hear about W10 crisis!

    All the best
    Rob

  16. #16
    That's me. Saw your post there. Sorry, didn't connect.

    Here's the Z80 side of the code, not quite pretty:
    Code:
    const char trmld[] = {  // Z80 code TRMLD:
      0x3E,0x0C,      //TL LD A,FF 
      0xCD,0x1B,0xE0, //   CALL VIDEO  clear screen
      0x06,0x0E,      //   LD B,14
      0x3E,0x0A,      //LL LD A,LF   
      0xCD,0x1B,0xE0, //   CALL VIDEO  set cursor position
      0x10,0xF9,      //   DJNZ LL
      0x11,0x40,0x00, //   LD DE,$0040
      0x21,0xC0,0xF0, //   LD HL,VID+$40  screen RAM pointer
      0x3E,0xCB,      //   LD A,$CB
      0xD3,0xFC,      //   OUT A,UARTD  ask Teensy for file list
      0xDB,0xFD,      //IL IN A,UARTS   
      0xCB,0x4F,      //   BIT 1,A
      0x28,0xFA,      //   JR Z,IL  wait for byte
      0xDB,0xFC,      //   IN A,UARTD
      0xFE,0xCB,      //   CP A,$CB  end of list signal
      0x28,0x15,      //   JR Z,KL
      0xFE,0x0D,      //   CP A,CR  handle Carriage Return
      0x28,0x08,      //   JR Z,RC
      0xFE,0x0A,      //   CP A,LF  handle Line Feed
      0x28,0x0A,      //   JR Z,FL
      0x77,           //   LD (HL),A  write text to screen
      0x23,           //   INC HL
      0x18,0x07,      //   JR DN
      0x7D,           //RC LD A,L  Carriage Return
      0xE6,0xC0,      //   AND A,$C0
      0x6F,           //   LD L,A  reset pointer to start of line
      0x18,0x01,      //   JR DN
      0x19,           //FL ADD HL,DE  Line Feed, advance pointer
      0x18,0xDF,      //DN JR IL
      0xDB,0xFD,      //KL IN A,UARTS
      0xCB,0x47,      //   BIT 0,A
      0x28,0xFA,      //   JR Z,KL  wait for UART ready to send
      0x3E,0xCB,      //   LD A,$CB
      0xD3,0xFC,      //   OUT A,UARTD  send signal that TRMLD is waiting for user
      0xCD,0x18,0xE0, //   CALL KEYBRD
      0x28,0xF1,      //   JR Z,KL  wait for user choice
      0x77,           //   LD (HL),A  display it
      0xDB,0xFD,      //UL IN A,UARTS
      0xCB,0x47,      //   BIT 0,A
      0x28,0xFA,      //   JR Z,UL  wait for UART ready to send
      0x7E,           //   LD A,(HL)
      0xD3,0xFC,      //   OUT A,UARTD  send user choice to Teensy
      0xFE,0x0D,      //   CP A,CR
      0x28,0xAA,      //   JR Z,TL  loop if next list
      0xDB,0xFD,      //IL IN A,UARTS   
      0xCB,0x4F,      //   BIT 1,A
      0x28,0xFA,      //   JR Z,IL  wait for signal from Teensy
      0xDB,0xFC,      //   IN A,UARTD
      0xFE,0xCB,      //   CP A,$CB
      0x28,0x03,      //   JR Z,LD  jump to loader
      0xC3,0xFA,0xDF, //   JP PWARM  or jump to BASIC
      //0xC3,0xFD,0xDF, //   JP PCOLD
      0xBF,           //LD CP A,A
      0xF5,           //   PUSH AF
      0xC3,0x2D,0xE0, //   JP BASLOD  jump to ROM loader
      0};

  17. #17
    Junior Member
    Join Date
    Aug 2020
    Posts
    3
    Cool thanks! I'm away from home for a couple of weeks now, but will try it when I get back.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •