f



CP/M-68K simulation

I am working on a simulator based CP/M-68K and it has reached a state
where others might find it useful.

1MB zip file is at:

http://home.earthlink.net/~schultdw/cpm68/simulator.html

I hope I packaged that up correctly.

-- 
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving


0
David
4/19/2014 1:01:01 AM
comp.os.cpm 3422 articles. 0 followers. Post Follow

10 Replies
677 Views

Similar Articles

[PageSpeed] 32

On Sat, 19 Apr 2014, David Schultz wrote:

> I am working on a simulator based CP/M-68K and it has reached a state
> where others might find it useful.
>
> 1MB zip file is at:
>
> http://home.earthlink.net/~schultdw/cpm68/simulator.html
>
> I hope I packaged that up correctly.
>
>

make: *** No rule to make target `sim.h', needed by `obj/cpmsim.o'.  Stop.

-uso.
0
Steve
4/19/2014 5:25:49 PM
On 04/19/2014 12:25 PM, Steve Nickolas wrote:
> On Sat, 19 Apr 2014, David Schultz wrote:
> 
>> I am working on a simulator based CP/M-68K and it has reached a
>> state where others might find it useful.
>> 
>> 1MB zip file is at:
>> 
>> http://home.earthlink.net/~schultdw/cpm68/simulator.html
>> 
>> I hope I packaged that up correctly.
>> 
>> 
> 
> make: *** No rule to make target `sim.h', needed by `obj/cpmsim.o'.
> Stop.
> 
> -uso.

That file is part of example.zip which comes with the simulator code.

Which prompted me to do something I should have done first: build from
scratch. So I downloaded a fresh copy of the simulator and tried that
which revealed other troubles. One was easy to fix.

I forgot that I had edited the m68kconf.h file so a copy of that goes
into my zip along with a copy of sim.h just so you don't have to drag it
out of the example.

The other errors are more mysterious.

More later.


-- 
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving


0
David
4/19/2014 6:06:18 PM
On 04/19/2014 01:06 PM, David Schultz wrote:
> The other errors are more mysterious.
> 
> More later.
> 
> 

I had to run the simulator source through dos2unix to make it work:

dos2unix *.h *.c


-- 
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving


0
David
4/19/2014 7:03:50 PM
On 4/19/14, 7:39 AM, David Schultz wrote:
> http://home.earthlink.net/~schultdw/cpm68/simulator.html

Awesome.  Thanks.

NOTE:  OS/X users will need this added to cpmsim.c:

#ifdef __APPLE__
#define TEMP_FAILURE_RETRY(expr) \
     ({ long int _res; \
         do _res = (long int) (expr); \
         while (_res == -1L && errno == EINTR); \
         _res; })
#endif

I have not done rigorous testing.

P.S. I used gcc and not clang

0
Egan
4/20/2014 1:01:01 AM
On 04/21/2014 01:47, Egan Ford wrote:
> On 4/19/14, 7:39 AM, David Schultz wrote:
>> http://home.earthlink.net/~schultdw/cpm68/simulator.html
>
> Awesome.  Thanks.

Indeed.


> NOTE:  OS/X users will need this added to cpmsim.c:
>
> #ifdef __APPLE__
> #define TEMP_FAILURE_RETRY(expr) \
>      ({ long int _res; \
>          do _res = (long int) (expr); \
>          while (_res == -1L && errno == EINTR); \
>          _res; })
> #endif

If you change __APPLE__ into __FreeBSD__ that patch works on FreeBSD as 
well. I used FreeBSD 8.4-stable:
tingo@kg-core1$ uname -a
FreeBSD kg-core1.kg4.no 8.4-STABLE FreeBSD 8.4-STABLE #0 r253646: Thu 
Jul 25 10:12:31 UTC 2013 
root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64

The emulator compiles:
tingo@kg-core1$ make
mkdir obj
gcc -Wall -O2 -c -Iobj -I. cpmsim.c -o obj/sim.o
gcc -Wall m68kmake.c -o obj/m68kmake
obj/m68kmake obj m68k_in.c

         Musashi v3.3 68000, 68010, 68EC020, 68020 emulator
         Copyright 1998-2000 Karl Stenerud (karl@mame.net)

Generated 1962 opcode handlers from 503 primitives
gcc -Wall -O2 -c -Iobj -I. m68kcpu.c -o obj/m68kcpu.o
gcc -Wall -O2 -c -Iobj -I. obj/m68kops.c -o obj/m68kops.o
gcc -Wall -O2 -c -Iobj -I. obj/m68kopac.c -o obj/m68kopac.o
gcc -Wall -O2 -c -Iobj -I. obj/m68kopdm.c -o obj/m68kopdm.o
gcc -Wall -O2 -c -Iobj -I. obj/m68kopnz.c -o obj/m68kopnz.o
gcc -Wall obj/sim.o obj/m68kcpu.o obj/m68kops.o obj/m68kopac.o 
obj/m68kopdm.o obj/m68kopnz.o m68kdasm.o -o cpmsim

> I have not done rigorous testing.

Well, the emulator starts:
tingo@kg-core1$ ./cpmsim
Read 32768 bytes from boot track


CP/M-68K(tm) Version 1.2  03/20/84
Copyright (c) 1984 Digital Research, Inc.

CP/M-68K BIOS Version 1.0
Simulated system of April 2014
TPA =16251  K

C>AUTOST.SUB
AUTOST.SUB?
and dir works:
C>dir
C: RELOC    68K : DUMP     68K : PIP      68K : STAT     68K : INIT     REL
C: LINK68   68K : SENDC68  68K : DDT      68K : DDT68000 68K : AS68     68K
C: CP68     68K : AS68INIT     : LIBF     A   : C068     68K : C168     68K
C: AR68     68K : CONFIG   68K : LO68     68K : MORE     68K : NM68     68K
C: LIBE     A   : SIZE68   68K : ASSERT   H   : CTYPE    H   : COPY     SUB
C: ERRNO    H   : OPTION   H   : OSIFERR  H   : PORTAB   H   : SETJMP   H
C: CLIB         : CE       SUB : CLINKE   SUB : CLINKF   SUB : CLINK    SUB
C: AS68SYMB DAT : C        SUB : RELOC3   SUB : SGTTY    H   : SIGNAL   H
C: STDIO    H   : STDINT   H   : ENDIAN   H   : ED       68K : S        O
C: CC       REL : CC       68K : WHEREIS  68K : BBYE     68K : UEMACS   68K
C: F83      BIN : PUTBOOT  68K : BYE      68K : CPM      SYS : GREEN    68K
C: MAKE     REL : MAKE     68K : ARC      68K : EMACS    68K : F83      68K
C: SPLIT    68K

but bye does not:
C>bye
CP/M-68K BIOS Version 1.0
Simulated system of April 2014
TPA =16251  K

C>AUTOST.SUB


Exception $0B at user address $0000041A.  Aborted.
What's bye supposed to do?
(Yes, I found this when I mistyped bbye)
bbye, stat, f83 and other things work.
drive M: looks suspicious:
C>dir m:
M:   :   :   :   :
M:   :   :   :   :
M:   :   :   :   :
M:   :   :   :   :
M:   :   :   :   :
M:   :   :   :   :
M:   :   :   :   :
(lots of more lines before it returns to the prompt again)
-- 
Torfinn Ingolfsen,
Norway
0
Torfinn
4/22/2014 1:01:01 AM
On 04/22/2014 03:59 PM, Torfinn Ingolfsen wrote:
> What's bye supposed to do?
> (Yes, I found this when I mistyped bbye)
> bbye, stat, f83 and other things work.
> drive M: looks suspicious:
> C>dir m:
> M:   :   :   :   :
> M:   :   :   :   :
> M:   :   :   :   :
> M:   :   :   :   :
> M:   :   :   :   :
> M:   :   :   :   :
> M:   :   :   :   :
> (lots of more lines before it returns to the prompt again)

Bye is almost exactly the same as bbye. It works by writing to an
address that is special to the simulator. The problem is that I changed
that address while working on a problem. Then when I used reloc to make
a new version of bye.68k, a typo made it bbye.68k. Then I failed to
remove the earlier version from user 0.

The addresses with special meaning started out in the block from $ff0000
to $ffffff. I moved that lower while tracking down a problem that
resulted in a wild pointer writing to $fffffc. A bonus to moving it
down, and the reason why I left it, is that programs that use 16 bit
addresses can use 64K of memory. Loading a 16 bit value to an address
register automatically sign extends it to 32 bits. So $8000 becomes
$ffff8000 or $ff8000 once trimmed to 24 bits.


As for drive M:, just like any RAM disk, it has to be initialized:
"init.rel m"

Until then, it is all zeroes.

-- 
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving


0
David
4/22/2014 10:13:36 PM
On 04/23/2014 00:13, David Schultz wrote:
>
> Bye is almost exactly the same as bbye. It works by writing to an
> address that is special to the simulator. The problem is that I changed
> that address while working on a problem. Then when I used reloc to make
> a new version of bye.68k, a typo made it bbye.68k. Then I failed to
> remove the earlier version from user 0.
>
> The addresses with special meaning started out in the block from $ff0000
> to $ffffff. I moved that lower while tracking down a problem that
> resulted in a wild pointer writing to $fffffc. A bonus to moving it
> down, and the reason why I left it, is that programs that use 16 bit
> addresses can use 64K of memory. Loading a 16 bit value to an address
> register automatically sign extends it to 32 bits. So $8000 becomes
> $ffff8000 or $ff8000 once trimmed to 24 bits.
>

Interesting.

>
> As for drive M:, just like any RAM disk, it has to be initialized:
> "init.rel m"
>
> Until then, it is all zeroes.
>

Ah - I didn't know that. Thanks!
-- 
Torfinn Ingolfsen,
Norway
0
Torfinn
4/23/2014 8:02:16 PM
Am Samstag, 19. April 2014 15:39:55 UTC+2 schrieb David Schultz:
> I am working on a simulator based CP/M-68K and it has reached a state
> 
> where others might find it useful.
> 
> 
> 
> 1MB zip file is at:
> 
> 
> 
> http://home.earthlink.net/~schultdw/cpm68/simulator.html
> 
> 
> 
> I hope I packaged that up correctly.
> 
> 
> 
> -- 
> 
> David W. Schultz
> 
> http://home.earthlink.net/~david.schultz
> 
> Returned for Regrooving

David,

I wonder, how did you make the whole thing work ? Back in early 90s I use to have a cp/m68k system. However when I started with linux, I missed tools like make, more, emacs. 
Btw, did you recompile the whole cp/m68k and tools from source ? 


roman
0
rp65536
5/17/2014 9:02:01 AM
On 05/17/2014 04:02 AM, rp65536.rp@gmail.com wrote:
> David,
> 
> I wonder, how did you make the whole thing work ? Back in early 90s I
> use to have a cp/m68k system. However when I started with linux, I
> missed tools like make, more, emacs. Btw, did you recompile the whole
> cp/m68k and tools from source ?
> 

I started with a 68000 simulator written by someone else. That is the
hard/tedious part. After that it was a lot like the time I did this on a
MEX68KECB. Figure out how to load the S-record image of the BDOS, write
a simple BIOS and load it as well, then run. Once that was working, use
the CP/M-68K tools to create another BIOS and a loader BIOS.

I did not recompile the whole thing. In fact, I have since replaced a
number of items from the 1.2 distribution for which source is available
with parts of the 1.3 distribution. Although I haven't posted the disk
image of that yet.

-- 
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving


0
David
5/17/2014 12:34:43 PM
Am Samstag, 17. Mai 2014 14:34:43 UTC+2 schrieb David Schultz:
> On 05/17/2014 04:02 AM, rp65536.rp@gmail.com wrote:
>=20
> > David,
>=20
> >=20
>=20
> > I wonder, how did you make the whole thing work ? Back in early 90s I
>=20
> > use to have a cp/m68k system. However when I started with linux, I
>=20
> > missed tools like make, more, emacs. Btw, did you recompile the whole
>=20
> > cp/m68k and tools from source ?
>=20
> >=20
>=20
>=20
>=20
> I started with a 68000 simulator written by someone else. That is the
>=20
> hard/tedious part. After that it was a lot like the time I did this on a
>=20
> MEX68KECB. Figure out how to load the S-record image of the BDOS, write
>=20
> a simple BIOS and load it as well, then run. Once that was working, use
>=20
> the CP/M-68K tools to create another BIOS and a loader BIOS.
>=20
>=20
>=20
> I did not recompile the whole thing. In fact, I have since replaced a
>=20
> number of items from the 1.2 distribution for which source is available
>=20
> with parts of the 1.3 distribution. Although I haven't posted the disk
>=20
> image of that yet.
>=20
>=20
>=20
> --=20
>=20
> David W. Schultz
>=20
> http://home.earthlink.net/~david.schultz
>=20
> Returned for Regrooving

Post your stuff, your should definitively do so.. At least one guy would in=
terested :) What I did, just don't have a page to post it, on Linux M68k an=
 CP/M 68k emulator. Basically I allocate memory in the own program space, w=
here I load the cp/m 68k binary and emulate the BDOS calls by exception rou=
tine. Converting CP/M file names to linux and back. Was fun to see it work.=
 CC did work.


The reason I'm writing this to you, I read on your page your attend to play=
 with the SD card. Now back on my CP/M 68k System, I didn't have HD at firs=
t.
So I had to load my HD driver first, catch the BIOS calls for FD/HD. When i=
t was for my HD do the stuff, otherwise pass it of to the original routine.

The same thing can be done with the BDOS calls and use other underlaying fi=
lesystem. Such as fat16/32. For example from http://elm-chan.org/fsw/ff/00i=
ndex_e.html for the SD card, which make it simpler for passing data from on=
e OS to CP/M and back.=20
Just a thought.=20

roman
0
rp65536
5/17/2014 1:08:31 PM
Reply: