• Please review our updated Terms and Rules here

Copy of Star Trek for IMSAI basic

I’ll try it! I saw a version for the Sol20, but it required a VDM-1 card and was ML based.

Starting to think I’ll write my own ML version just to teach myself 8080 ML.

There is an Altair version in the links that were provided, that uses a minimal number of string arrays (just for listing 5 strings of text) that I’m working around with fixed strings and if then statements. A little cumbersome, but I think it might work….

Thanks!
 
I’ll try it! I saw a version for the Sol20, but it required a VDM-1 card and was ML based.

Starting to think I’ll write my own ML version just to teach myself 8080 ML.

There is an Altair version in the links that were provided, that uses a minimal number of string arrays (just for listing 5 strings of text) that I’m working around with fixed strings and if then statements. A little cumbersome, but I think it might work….

Thanks!
I'm referring to the BASIC/5 version in the list at Wayback. (sttr.bs5)
I think you're meaning TREK-80 for the SOL-20 which is not a BASIC program, it was ML.
 
I found this version while poking around one of the SimH pre-builts. "basiccollection.zip" It's the same but different.
I’m finally killing Klingons! Although technically not on my IMSAI yet. I had to go the SimH route for another part of the IMSAI project and when I got CP/M running I took a little detour with MBASIC and got that version running. Too much fun 😆. Thanks all!
 
So, tell us a little about your IMSAI setup.
It obviously is not running CP/M.
How are you loading BASIC to the machine?
 
If you're asking me, I'm not on an IMSAI. Sadly IMSAIs are way out of my budget range and my parents (because I'm 13) wont let me purchase one. I'm trying to run this on a BASIC-52.
 
The original poster (sterrant) Curious about his setup and why he needs an IMSAI specific game.
Is it some sort of cassette system, or maybe IMDOS?

The IMSAI is a CP/M capable machine, and it would be a good choice for OS as you can then run MBASIC which will allow you to run most of the BASIC code we have been discussing.
So the fact that you ran CP/M on simh begs the question why didn't you run CP/M on the IMSAI?

On my setup, I have 2 IMSAIs. One runs with dual 8" drives and a 33M hard drive. The OS is ZCPR3, a CP/M variant. The other has no drives, but a FlashRam chip loaded with software and a CP/M emulator I wrote in EPROM which handles all the console I/O for CP/M and allows me to run CP/M programs like MBASIC. The monitor program also has XMODEM, allowing me to load/save to a PC running a terminal emulator program. I do have a couple of 8" drives for it, but ever since the project to 'semiconductorize' everything, I just kept it as is.

And xp0nentz, you were asking about Altair BASIC descendants... MBASIC for CP/M is the direct descendant of the original Altair BASIC.
Which then moves to GWBASIC in the 16bit PC era.

-J
 
Hi all,

Let me provide a short history. Similar to xp0nentz I couldn’t afford an IMSAI until I came across one on eBay that I would classify as a “barn find”. Being an EE, I thought this would be a worthy project so I made an offer and (somewhat to my surprise) the seller accepted it.
It came with the following:
IMSAI Chassis, front panel and PSU
Compupro 8085-88 CPU
Memory Merchant 64k memory board
Compupro Interfacer 1 serial I/O card
Compupro Disk 1 (disk controller) - no disks

After a couple months of work (cleaning and troubleshooting) I got the front panel working with the CPU board and memory and was able to enter and run programs from the front panel.

Next I got the Interfacer 1 card running (some components were smoked) and modified ALTMON to run with the Interfacer 1 and installed it on a PROM in the last 2k of memory.

With ALTMON working I could now load .hex files and I turned my attention to IMSAI 4K and 8K basic. I found the source and modified those to work with the Interfacer 1. 4K basic was very limited, so got 8K basic running and with that I thought I’d re-live some of the days of my youth where I would stay late in my HS computer “lab” to play Star Trek on the teletypes 🤣

This catches us up to my original post where I was looking for a version that runs on IMSAI basic. Unfortunately, since it doesn’t support string arrays, that was not possible.

As has been suggested, the “next” phase of my IMSAI journey is getting the Disk 1 card up and running with CP/M , but I don’t have any drives, and so I switched tracks (pardon the pun) to exploring SimH so I could get a serial implementation of CP/M going using the Mike Douglas FDC Server (as described in his You Tube video -
).
Along the way I was able to bring up CP/M in SimH on my laptop and when I saw (and was able to run) mbasic, I grabbed a copy of that version of trek and so I’m finally killing Klingons (although not on the IMSAI).

Currently I’m following two paths to CP/M.
1. Make all the code mods necessary to get Mikes FDC Server working with my Interfacer 1 serial card (working on this now)
2. I’ve just purchased a floppy disk emulator and hope to bring that up with the Compupro Disk 1 and the appropriate CP/M disk image. This would be a prerequisite to connecting real disk drives at some point in the future when I purchase those.

Hope this explains things.
And very curious about your CP/M Emulator and It's capabilities. That might be another way...

Pete
 
I have one of Mike's FDC+ cards in my Altair 8800B which uses the turnkey card with a 2SIO type Altair serial.
It works with an original MITS 8" drive as well as a little laptop I have nearby to act as a server if I need more drives.
The Disk Server is very smooth and easy to use, but it was designed for the FDC+ card.
Getting the software to work with the Compupro card would be an interesting project

And IIRC, IMSAI BASIC was written to use the IMSAI serial cards. Are you patching it to work with the Compupro card?
The key to using the different BASICS is getting the I/O correct. Each serial card may use a different UART chip.
Each chip is configured for different ports and control codes - like to check if data is available.
This is the reason why Altair Basic won't run on a stock IMSAI. Then CP/M came along and virtualized the interface.
One interface with CP/M then the hardware specific BIOS underneath.

On the CP/M emulator I use, it is basically a BIOS that sits in the correct location that CP/M expects.
When it gets a call from a CP/M application (like MBASIC) it then sends out the appropriate codes for the IMSAI I/O board I have installed.
You could do the same simply by replacing the IMSAI codes with your Compupro ones.

It seems you could pull one of your RAM chips and replace it with a 2716 programmed with a CP/M emulator pretty easily.

-J
 
Last edited:
Here are some pertinent excerpts from my monitor...

Code:
CST:                    ; (CONSOLE STATUS)
        IN        TTS        ; GET STATUS BYTE FROM USART
        ANI        TTYDA    ; MASK BITS FOR "DATA AVAILABLE?"
        JZ        CST1    ; CONSOLE IS NOT READY
        ORI        0FFH    ; CONSOLE IS READY
CST1:    RET


CIN:                    ; (CONSOLE INPUT)
        ;CALL    CST        ; GET STATUS
        IN        TTS
        ANI        TTYDA
        
        JZ        CIN        ; WAIT FOR IT
        IN        TTI        ; GET BYTE
        ANI        7FH        ; STRIP PARITY BIT
        ;CALL    ledout    ; JUST FOR WHIMSY - DISPLAY CHAR ON LEDS
        RET
        
COT:                    ; (CONSOLE OUTPUT)
        IN        TTS        ; GET STATUS BYTE FROM USART
        ANI        TTYTR    ; MASK BITS FOR "TERMINAL READY?"
        JZ        COT        ; NOT READY - LOOP BACK
        MOV        A,C        ; DATA WAS PASSED FROM CALL PROGRAM VIA REG C
        ;CALL    ledout    ; JUST FOR WHIMSY - DISPLAY CHAR ON LEDS
        OUT        TTO        ; SEND THE CHAR OUT
        RET       
        


;------------------
;IMSAI 8080 EQUATES

LEDS    equ    0FFh    ;IMSAI front panel output LEDs (top left)
SWCH    equ    0FFh    ;IMSAI front panel input switches (left)
TTS     equ     03h     ;SIO channel A command port
TTI     equ     02h     ;SIO channel A data port (yes input=output)
TTO     equ     02h     ;SIO channel A data port
TTYDA   equ     02h     ;tty data available (ready to receive?)
TTYTR   equ     01h     ;tty terminal ready (ready to transmit?)

;------------------
;ASCII characters used

NUL                EQU        0        ; NULL (ZERO)
CR                EQU        0DH        ; Carriage return
LF                EQU        0AH        ; Line feed
CTRH            EQU     8       ; Ctl H Backspace
DEL             EQU     127     ; Delete char
TAB             EQU     9       ; Tab char
CTRX            EQU     24      ; Ctl X Cancel
CTRS            EQU     19      ; Ctl S Suspend
CTRQ            EQU     17      ; Ctl Q Resume
APOS            EQU     (39-'0') AND 0FFH  ;apostrophe


;------------------
;RUN A CPM PROGRAM
;  To run a CPM program this code:
;  1) Copies BDOS code to RAM @ BDLOC
;  2) Places a JMP to this code at 0005H
;  3) Places a JMP to wrmst at 0000H
;  4) Loads spaces to FCB (simulating no command line parameters)
;  5) CALLs 0100H
;  NOTE: App calls BDLOC that then jumps to lbdos in EPROM
;        App thinks BDLOC is real BDOS, but it's just a jump to real bdos in EPROM
run:
        MVI        A,0C3H    ; put 'JMP lbdos' before monitor
        STA        BDLOC    ;  so calling apps can determine start of avail mem
        LXI        H,lbdos    ;
        SHLD    BDLOC+1    ;

        MVI        A, 0C3H    ; put 'JMP BDLOC' @0005H
        STA        BDOS    ;
        LXI        H,BDLOC    ;
        SHLD    BDOS+1    ;
        
        MVI        A, 0C3H    ; put 'JMP START+3' @0000H  (TO ALLOW APPS TO ACCESS BIOS)
        STA        0H        ;
        LXI        H,START+3    ; WARM START IS 2ND BIOS VECTOR, HENCE '+3'
        SHLD    1H        ;
        
        MVI        A,20H    ; put <SPACE> in FCB
        STA        FCB        ;
        STA        FCB+1    ; need more?
        STA        FCB+2    ; need more?
        STA        FCB+3    ; need more?
        STA        FCB+4    ; need more?
        STA        FCB+5    ; need more?
        STA        FCB+6    ; need more?
        STA        FCB+7    ; need more?
        STA        FCB+8    ; need more?
        STA        FCB+9    ; need more?
        STA        FCB+10    ; need more?
        STA        FCB+11    ; need more?
    
        
        CALL    TPA        ; run the CPM program
        JMP        cldst    ; for those apps using a 'RET' to exit



  
;------------------
; Simplified Core IO Routines

;------------------
;Console Input

intt:
        CALL    instat          ;Check status
        IN      TTI             ;Get byte
        ANI     DEL
        CPI     CTRX            ;Abort?
        JZ      wrmst           ;
        RET

;------------------
;Console Output

outt:   
        PUSH    PSW
        CALL    outstat         
        POP     PSW
        OUT     TTO             ;Send Data
        RET


;------------------
;Check Console Input Status

instat:
        IN      TTS
        ANI     TTYDA
        JZ      instat
        RET

;------------------
;Check Console Output Status

outstat:
        IN      TTS             ;CHECK FOR USER INPUT CTRL-X
        ANI     TTYDA           ;
        JZ      out2            ;
        IN      TTI             ;
        ANI     DEL             ;
        CPI     CTRX            ;
        JZ      wrmst           ;

out2:   IN      TTS             ;Check Console Output Statuas
        ANI     TTYTR           ;
        JZ      outstat         ;
        RET

;-------------------
; Debug Routine
; displays contents of reg A on LEDs
; and waits for 01H on toggles to continue

;debug:
;
;    PUSH    PSW        ;save A
;    CALL    ledout
;dbg1:                ; must see a transition from 00H to 01H on toggles
;    IN      0FFH    ;
;    CPI        00H        ;
;    JNZ        dbg1    ;
;dbg2:                ;
;    IN        0FFH    ;
;    CPI     01H        ;
;    JNZ     dbg2    ;
;     
;    POP        PSW        ;restore A
;    RET

;============================
; BDOS Emulator Routines
;  Input: Reg C function code
;============================

lbdos:                        ; entry point

        LXI        H,0            ; save user's stack
        DAD        SP            ;
        SHLD    oldstk        ;
        LXI        SP, STACK    ; setup new stack for bdos use
        
        MOV        A,C
        ;CALL    ledout    ;show BDOS fn number on LEDs


;**** ANALYSIS CODE - DISPLAYS BDOS FN# REQUESTED BY CALLING PROGRAM
;PUSH    A
;CALL    ilprt
;DB        CR,LF,'IN BDOS FN# ',00H
;CALL    outhex
;POP    A
;****

        CPI        00h
        JZ        wrmst
        
        CPI     01h
        JZ      conin

        CPI     02h
        JZ      conout
        
        CPI     09h
        JZ      prstr
        
        CPI        0Bh
        JZ        bconst
        

xbdos:                        ; exit point
        LHLD    oldstk        ; restore user's stack
        SPHL                ;
        RET                    ; return to calling program

;-----------------------       
; BDOS Main Functions begin here

;-----------------------
; BDOS 01H - Console Input
conin:
        CALL    bdinst
        IN        TTI
        JMP        xbdos
;-----------------------
; BDOS 02H - Console Output
conout:
        MOV     A,E
  cout: PUSH    PSW
        CALL    bdoutst         
        POP     PSW
        OUT     TTO             ;Send Data
        JMP        xbdos

;-----------------------
; BDOS 09H - Print String
; POINTER TO STRING ARRIVES IN DE
; STRING IS TERMINATED WITH '$'

prstr:
        PUSH    D      ;SAVE DE
        XCHG            ;SWAP DE WITH HL
        PUSH    H       

FN9L:   
        MOV        A,M        ; cant use LDA M

        CPI     '$'     ; IS IT A DOLLAR SIGN?
        JZ      FN9E    ; YES - BRANCH TO END

        PUSH    PSW
        CALL    bdoutst         
        POP     PSW
        OUT     TTO             ;Send Data
        
        POP        H        ;
        INX        H        ;  must save H for next loop, it gets trashed in bdos??
           PUSH    H        ;

        JMP     FN9L    ; LOOP BACK TO PROCESS NEXT CHAR

FN9E:   
        POP        H
        XCHG
        POP     D

        JMP        xbdos

;-----------------------
; BDOS 0BH - Get Console Status

bconst:

        IN        TTS
        ANI        TTYDA

        JMP        xbdos

;------------------

;------------------
ledout:                         ;Display Register A on front panel LEDs
        CMA
        OUT     LEDS
        CMA
        RET
;------------------

;------------------
; BDOS Subroutines begin here
;------------------

;------------------
;Check Console Input Status

bdinst:
        IN      TTS
        ANI     TTYDA
        JZ      bdinst
        RET

;------------------
;Check Console Output Status

bdoutst:
        IN      TTS             ;CHECK FOR USER INPUT CTRL-X
        ANI     TTYDA           ;
        JZ      bdout2          ;
        IN      TTI             ;
        ANI     DEL             ;
        CPI     CTRX            ;
        RZ                        ;

bdout2: IN      TTS             ;Check Console Output Statuas
        ANI     TTYTR           ;
        JZ      bdoutst         ;
        RET


;-----------
 
I have one of Mike's FDC+ cards in my Altair 8800B which uses the turnkey card with a 2SIO type Altair serial.
It works with an original MITS 8" drive as well as a little laptop I have nearby to act as a server if I need more drives.
The Disk Server is very smooth and easy to use, but it was designed for the FDC+ card.
Getting the software to work with the Compupro card would be an interesting project

And IIRC, IMSAI BASIC was written to use the IMSAI serial cards. Are you patching it to work with the Compupro card?
The key to using the different BASICS is getting the I/O correct. Each serial card may use a different UART chip.
Each chip is configured for different ports and control codes - like to check if data is available.
This is the reason why Altair Basic won't run on a stock IMSAI. Then CP/M came along and virtualized the interface.
One interface with CP/M then the hardware specific BIOS underneath.

On the CP/M emulator I use, it is basically a BIOS that sits in the correct location that CP/M expects.
When it gets a call from a CP/M application (like MBASIC) it then sends out the appropriate codes for the IMSAI I/O board I have installed.
You could do the same simply by replacing the IMSAI codes with your Compupro ones.

It seems you could pull one of your RAM chips and replace it with a 2716 programmed with a CP/M emulator pretty easily.

-J
Hi John,

Answers and some more questions below:
And IIRC, IMSAI BASIC was written to use the IMSAI serial cards. Are you patching it to work with the Compupro card?
Yes, I modified the basic .ASM files to use the Interfacer 1 specific port addresses for control and data registers and their specific control flags.

It seems you could pull one of your RAM chips and replace it with a 2716 programmed with a CP/M emulator pretty easily.
Yes, that's possible. That's where ALTMON resides now in my setup. I programmed a 2716 and replaced the last 2K ram chip on my board with it so ALTMON resides at F800h.
How big is the CP/M emulator? I know I have 1k free in the ALTMON EPROM (from FC00h on).

The other has no drives, but a FlashRam chip loaded with software and a CP/M emulator I wrote in EPROM which handles all the console I/O for CP/M and allows me to run CP/M programs like MBASIC. The monitor program also has XMODEM, allowing me to load/save to a PC running a terminal emulator program.
Explain to me how this works... Where in the memory map is the "Flash RAM" chip (is this another EPROM or true Flash Memory)? And is that where you store the CP/M programs like MBASIC or do those get loaded via XMODEM?

And what monitor are you using?

Sorry for all the questions, but this approach is intriguing.

Pete
 
How big is the CP/M emulator? I know I have 1k free in the ALTMON EPROM (from FC00h on).
Not sure, I never calculated it. It's embedded in the monitor, which is 4K total. But 1K seems about right. The code I posted earlier shows how that part is done.
The monitor essentially writes some new code to setup everything CP/M expects. Self-modifying code.

Explain to me how this works... Where in the memory map is the "Flash RAM" chip (is this another EPROM or true Flash Memory)? And is that where you store the CP/M programs like MBASIC or do those get loaded via XMODEM?
The Flash RAM chip is not in the memory map. It's a 512K chip I use for storage - that's where MBASIC lives. I access it via some unused ports. I built the S100 interface card for it and wrote the code to control it. When I access memory and the specific port, the logic on the board knows to execute a read or write from the chip and moves data to/from RAM. It takes the place of a disk drive. I'm sure there are better ways to do this today, bigger chips, SD cards, etc. But I did all this over 20 years ago.
And yes, you can also use XMODEM to load a new CP/M program, then run it directly to check it out. And if you like it enough, you can then save it to the Flash RAM chip so you can run it without downloading in the future.

And what monitor are you using?
I wrote it. It's pretty specific for my IMSAI setup, Flash RAM access, XMODEM, EPROM programmer, and the usual dump, enter, etc.
I'll include the help screen code to give you an idea.

-J

Code:
;----------------------
help:
        CALL    ilprt

        db      lf,cr
        db        'IMSAI 8080 Monitor 7.2 Commands:',lf,cr
        db        '----------------------------------------------------------------',lf,cr
        db      ' Dxxxx yyyy      - Dump memory x to y',lf,cr
        db      ' Exxxx           - Enter data at address x',lf,cr
        db        ' Bxxxx yyyy zzzz - Block move x-y to z',lf,cr
        db        ' Fxxxx yyyy bb   - Fill memory x-y with byte b',lf,cr
;        db        ' K               - Display Stack Pointer',lf,cr
        db      ' Mxxxx yyyy      - Memory Test x-y',lf,cr   
        db        ' Vxxxx yyyy zzzz - Verify memory block x-y with block z',lf,cr   
        db      ' Cxxxx           - Call subroutine at x',lf,cr
        db      ' Jxxxx           - Jump to x',lf,cr
        db      ' R               - Run CPM Program @0100h',lf,cr
        db      ' TExxxx          - Text entry at x',lf,cr
        db      ' TDxxxx yyyy     - Text dump from x-y',lf,cr
        db      ' S               - Serial port SIO channel B',lf,cr
        db        ' Xxxxx           - XMODEM File Receive to memory at x',lf,cr
        db        ' Pxxxx           - Program EPROM @F000h with 1K block from x',lf,cr
        db        ' LL              - Load from Library Card to RAM',lf,cr
        db        ' LS              - Save from RAM to Library Card',lf,cr
        db        ' LE              - Erase Sector on Library Card',lf,cr
        db        ' LR              - Run a program from Library Card',lf,cr
        db      ' ?               - This help screen',lf,cr
        db      00h

        JMP     wrmst

;----------------------
 
How many different mainline variants of the Trek game are there, not counting the minor tweaks made within ports? Has anyone put together a list of the different Trek games along with their .bas code? It would be fun to play all the different versions.
 
Back
Top