October 2005
Got a working MAI2000, managed to change disks

October 17,2011
Got a BOSS/IX tape and tried to read the files. After the first 23 files (i assume about 1000), the tape got damaged due to the old belt in the drive. The next time i will definitly not try to read such an old tape without replacing the belt first. At least i got the loader, the kernel, the config file, the initial ramdisk as well as the boot partition from tape.

October 24,2011
Decided to make another backup to be sure i really have saved all. In addition i also saved the contents of all eproms in the machine. Have not yet an idea how to save the contents of nvram (64x4 bit Xicor x2210).



November 1,2011
While deleting old files i found an 68000 emulator (MUSASHI 3.3 written by Karl Stenerud) and decided trying to write an emulator for the MAI 2000. I have scanned the documentation i have and it should be possible. The technical manual for cs (the streamer controller) is missing, hope to figure it out without the docs. (i assume i need the mcsfs from the diags but i have the diags only on tape)
I have not done much in C (other than programming AVR's and some Netware NLM's) yet, so i will learn a bit more c programming doing this.

November 19,2011
Tried to connect a floppy, i used an old 80 track one (not a 1,2MB high desity drive) i had from my old cpm prof80 system and the floppy worked fine in the 2000. Created a boot floppy and was able to boot from floppy. Floppy access is very slow, i should try to change the 1k buffer sram on the cmb to an 8k sram but i only have 1k and 32k ones here.

November 23,2011
Found some documentation about the rom debugger and tried to show the contents of nvram but the values shown at address 0x680000 to 0x68003E des not seem to be a valid nvram content.

December 1,2011
Got a micropolis HH1050. Again i had to patch dutil for the drive parameters. Formatted the disk, installed the diags. Using the boot diskette i created the default partitions and restored the boot partition. After a reboot from disk into single user mode, i tried to create a filesystem for root but that did not work.
Now i checked the floppy disk format, it is 8 512 sectors per track. I copied the config record from a linux box to a floppy using dd (1 sector) and restored that on the 2000 (using debe). After renaming it to config.2000.ssn, i was able to install the config record using "iconf -new -save".
A reboot later, root could be created and i copied all files from the old disk to the new one. Made a backup (usung tsave -filesystem) of /dev/rwd0 to use that for the emulator, however, this backup does not contain the diag partition, have to figure out how to get these.

December 3,2011
Hacked a bit on the emulator. Does not do much yet but i can disassenble, step, set breakpoints and can log access to io-ports. I can see that the boot eprom fills memory, configures the scc (z8530), sets scc in loopback mode and sends some chars to the scc in loopback mode while checking the results. I have not yet done anything in 68000 assember, seems to be i have to learn a lot.
Debuged the start of rom and after the scc was initialized in loopback mode, the code sends some chars, strips bit 7 and compares the result, 16 times for each char. After 0x1f was tried, the routine hung because the 7th bit was stripped. Took me hours to find the problem: i had masked the eprom every 8kb, it is 16 bit -> 2x8k, means the 0x1f was not ment to be used at all. 
After changing the rom size to 0x4000, the rom routine passed both serial port loopback tests, done for today.

December 4,2011
Musashi 3.31 does not have support for bus errors, hacked it a bit to support bus errors but the rom code seems to have a problem with the emulator. It only runs in an endless loop after a bus error. I will try a new version from mame.

December 5,2011
The mame version is deeply integrated into mame, after hours i got a compilable version but have not yet integrated this version into the emulator.
Instead i tried to write a small test program to test bus errors on the mai 2000. I figured out that i can load s-record format (S2) using the load command in the internal debugger.
Next, i added a load command to the emulator and it jumped to crazy locations. Added a verify to the s-record loader and some bytes were not written correct.
It was a typo in musashi:
#define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[ADDR] = (VAL)%0xff
instead of
#define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[ADDR] = (VAL)&0xff
Ok, disabled all messages, added sit write to console and typed go and got:
<dbg>go

NV RAM checksum err
Enter 'CONFIG' command to reconfigure
<debug>
First succsess, we are in the internal rom debugger and after entering valid values:
                      MAI Basic Four Inc.
                            MAI 2000

System Self Test B4.3: SSN 2000-97894
cmb                                   fail: pita pita pita pita pita pita pita pita piti
memory   [size=2048 kbytes]           pass
fd                                    fail: fdcw fdrw
fw       [modules= 0,1,2,3]           fail: fwst-0-FF-FF fwst-1-FF-FF fwst-2-FF-FF fwst-3-FF-FF
wd       [modules= 0,1]               fail: wddr-00 wdvr-00 wdcs-00-20-20 wddr-01 wdvr-01 wdcs-01-20-20
ts                                    fail: tsdr tsvr tscs-20-20
cs                                    fail: csst-F
ln       [modules= 0,1,nodes= 3F,3F]  fail: lnwr

Booting from wd00                      fail: wdss-00-20

Boot device:
I copied the nvram contents (upper bank) by reading these out on a working machine (dw in the rom debugger).
of cause, all devices are shown because the bus error is not yet working, a lot more to be done.

December 11,2011
Used current musashi from mame 1.44s. It was a lot of work to separate the m68 emulator because it is deeply intergrated into mame.
Now, 'bset #$f,($8,a7)' that did not work with 3.32 works fine. Extended the bus error support for 68010 and now the wd controller will no longer be detected.
When trying to access the wd contoller, the bus error handler in rom simply sets the RR flag (dont know why this may be needed), removes all 29 bus error frame words from the stack, modifies carry flag in SR on stack and does rtr. (The return address as well as an empty SR were previously pushed)

                      MAI Basic Four Inc.
                            MAI 2000

System Self Test B4.3: SSN 2000-97894
cmb                                   fail: pita pita pita pita pita pita pita pita piti
memory   [size=2048 kbytes]           pass
fd                                    fail: fdcw fdrw
fw       [modules= 0,1,2,3]           fail: fwst-0-FF-FF fwst-1-FF-FF fwst-2-FF-FF fwst-3-FF-FF
ts                                    fail: tsdr tsvr tscs-20-20
cs                                    fail: csst-F
ln       [modules= 0,1,nodes= 3F,3F]  fail: lnwr
Boot dev not found

Boot device:

Ok, added the generation of bus errors for all, not yet known, adresses. Now there seems to be an address accessed that has to be present (it is in cmb), i have to check that:

                      MAI Basic Four Inc.
                            MAI 2000

System Self Test B4.3: SSN 2000-97894
cmb     
bus err: 00400EF6 

PC : 180040   SR : FFFE   CC : XNZV.      SSP : 000006   USP : 000000 
   D0       D1       D2       D3       D4       D5       D6       D7
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
   A0       A1       A2       A3       A4       A5       A6       SP
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

<debug>

Dont know where the register values are from. May be that the 68010 saves at least some in the "Internal Information, 16 Words" area of the bus error stack frame or the debugger is simly not yet initialized. 
400EF6 is the next instruction, the failing one is at 400EF4 and is move.b  D1, (A1) where A1=620020. This is the Parallel Interface/Timer, seems to be that i have to write the emulation for it next.

December 12,2011
Worked a bit on the bus fault stuff. Yesterdays changed implemented the bus error but because the instruction have been executed, the register contents were the contents after the execution of the failed instruction. Musashi 3.32 partly implemented a long jump from the memoty routine back to the exec loop. I have not done this because i'm not sure that all memory accesses are done before changing registers (in the instruction handlers). That resulted in another bus error in memory test. The initial rom routine seraching for the amount of ram, using some (A0)+, raised the bus error but A0 was the next value. Now i save all registers before and restore these on a bus error. Not sure if this is correct, what happens for a read write cycle instruction where the read is ok and the write raises a bus error ? I think i have to change that to along jump later.
Now, the memory test works also when not all possible memory is configured.
RTE was not supported for long 68010 bus error frames, i have implemented it for RR=1 now, processor retry is on my todo list. Implemented a first dummy for pit (68230) allowing only register R/W and a dummy for the floppy controller only containing the buffer. The errors shown are interrupt for the timer and the floppy controller, at least better than yesterday:


                      MAI Basic Four Inc.
                            MAI 2000

System Self Test B4.3: SSN 2000-97894
cmb                                   fail: piti
memory   [size=1536 kbytes]           pass
fd                                    fail: fdcw fdrw
Boot dev not found

Boot device:

December 13,2011
Implemented basic timer support for PI/T including interrupt and now the cmb test passed:

                      MAI Basic Four Inc.
                            MAI 2000

System Self Test B4.3: SSN 2000-97894
cmb                                   pass
memory   [size=1536 kbytes]           pass
fd                                    fail: fdcw fdrw

December 15,2011
Tried to implement wd controller support. I dont understand the status returned and expected by the boot code. For now, i'm giving up. Will try to implement the tape support to be able to load the diagnostics.

December 17,2011
Made a lot of debugging for boot from tape. Figured out how the tape interface works (there was some info in mcsfs and i tried mcsfs on a real MAI 2000 and thze dignostics manual contained some hints), really nice. The host builds IOPARAM blocks in memory, sends the address of the parameter block to the controller and the controller does all the work using dma. For now, REWIND,READ and SKIP works and boot the diagnostics from tape works. Loading diag files also works. This was a lot of work because i do not have any documentation for the CS controller.

                      MAI Basic Four Inc.
                            MAI 2000

System Self Test B4.3: SSN 2000-97894
cmb                                   pass
memory   [size=1536 kbytes]           pass
fd                                    fail: fdcw fdrw
cs                                    pass

Booting from cs0
-.........................................................................................................................................................
Boot Complete (mcs)
Currently Sizing
...

                               NOTICE

THIS SOFTWARE INCLUDES ORIGINAL WORKS OF AUTHORSHIP AND PROPRIETARY INFORMATION
PROTECTED BY COPYRIGHT AND TRADE SECRET LAWS.  THE COPYRIGHT ACT OF 1976
PROVIDES FOR CIVIL LIABILITY AND SEVERE CRIMINAL PENALTIES FOR UNAUTHORIZED
COPYING OR DISCLOSURE OF PROTECTED WORKS.  POSSESSION AND USE OF THIS SOFTWARE
IS RESTRICTED AND SUBJECT TO THE TERMS OF THE MAI BASIC FOUR, INC. LICENSE
AGREEMENT FOR THIS SOFTWARE ("AGREEMENT").  YOU SHALL NOT PUBLISH, REPRODUCE
OR TRANSMIT, IN WHOLE OR IN PART, THIS SOFTWARE IN ANY FORM OR BY ANY MEANS,
WHETHER ELECTRONIC, MECHANICAL, PHOTOGRAPHIC, OR OTHERWISE.  YOU SHALL NOT
DISCLOSE, OR FAIL TO MAKE YOUR BEST EFFORTS TO PREVENT THE INADVERTENT
DISCLOSURE OF, THIS SOFTWARE TO ANY THIRD PARTY EXCEPT TO YOUR EMPLOYEES ON A
NEED-TO KNOW BASIS, WHICH EMPLOYEES YOU SHALL BIND IN WRITING TO THE TERMS OF
THE AGREEMENT AND BE RESPONSIBLE FOR THEIR COMPLIANCE THEREWITH.  IF YOU FAIL
TO ACT IN ACCORDANCE WITH THIS NOTICE AND THE AGREEMENT, YOUR LICENSE TO THIS
SOFTWARE WILL BE IMMEDIATELY AND AUTOMATICALLY TERMINATED, AND YOU MAY EXPOSE
YOURSELF TO CIVIL AND CRIMINAL LIABILITY.

COPYRIGHT 1989, REV. 1987 MAI BASIC FOUR, INC.  All RIGHTS RESERVED.
MAI AND BASIC FOUR ARE REGISTERED TRADEMARKS OF MAI BASIC FOUR, INC.

<Cr> To Continue..<Esc> To Quit....

MAI SPx Diagnostic Executive Rev  D4.7         11:49:02  10/31/89

Controllers Present

FD0     FD1     MCS     

Disk Drive Subsystem Configuration:

Unit#     Interface     Controller     Base Address
-----     ---------     ----------     ------------
No Disk Drives Found Connected in System

 
<exec>ltape

diag7.5b*08
  NAME         SEQ     LENGTH         TIME      DATE    REVISION
exec            2       153         11:49:02  10/31/89   D4.7   
cmb             3       20          14:42:34  06/11/85  Unknown
disk            4       128         11:59:02  03/22/88   C3.1   
dutil           6       221         10:05:33  03/24/88   C3.1   
floppy          8       89          16:54:40  07/14/86   B8.1   
fway            9       109         11:25:53  06/13/88   B12    
iotst           11      14          18:07:51  08/23/85  Unknown
mcs             14      118         18:01:23  03/31/88   C2     
memory          16      31          16:51:53  08/06/85  Unknown
mmu             17      25          09:51:51  04/01/87   B4.1   
mts             18      126         15:59:54  10/27/89   C1     
nvram           20      12          11:05:11  06/10/86  Unknown
pit             21      25          16:46:00  09/18/87   C0.2   
ports           22      44          15:10:09  06/02/87   C1.5   
scc             23      33          17:10:53  05/18/87   B6.2   
sit             24      227         16:13:38  10/31/89   D5.6   
disk            28      128         11:59:02  03/22/88   C3.1   
dutil           32      221         10:05:33  03/24/88   C3.1   
fway            37      109         11:25:53  06/13/88   B12    
mcs             41      118         18:01:23  03/31/88   C2     
mts             45      126         15:59:54  10/27/89   C1     

End of tape
Total Blocks Used = 2927

<exec>help_wiz
Help for Wizards:

MAI SPx Diagnostic Executive Rev  D4.7         11:49:02  10/31/89
CPU Type             : 68010
CMB Hardware Version : 01
Kernel Revision      : B4.3
System Serial Number : 2000-97894
Current Load Dev     : CS00
Current Console Dev  : SC00
Contiguous Memory    : 0 - 17FFFF
Top of Exec          : 1B000
Warm Start Addr      : 1B550
Exec Variable Addr   : 24296
Bottom of Exec       : 26534
Command Parse Order  : Exec Test 

Controllers Present

FD0     FD1     MCS     

