Showing posts with label cp/m. Show all posts
Showing posts with label cp/m. Show all posts

Monday, June 8, 2015

68kavr ver 2560/0.00.02 is out

If anyone cares, I've updated my 68kavr firmware and BIOS. Lots of changes, but I'm lazy to build a normal release (because of summer) so this release is incremental. And, it is numbered 0.00.02!

Friday, December 19, 2014

Mathew Brandt's c68 and CP/M 68

While looking for C compiler for CP/M 68 looks I've found something that looks quite fine.
As for version "5.1 (beta)/25 Apr 2002" c68 taken from http://homepage.ntlworld.com/itimpi/compsrc.htm has
-cpm68 option and it somehow work. It even claims that it generates AS68compatible source.
There are a lot of versions of this compiler on the net, but this one is surely the best I've tried (but as I understand it's unable to compile itself, what a pity)
The way it does not work is writing hex as 0xXX, not as $XX, so here is a fix:
out68k_c.c:
PRIVATE void put_byte P1 (UVAL,val)
{        
    put_header (bytegen, alignment_of_type (tp_char));
    oprintf ("$%lx", (unsigned long) (val & OxffUL));
/*DtZ     oprintf ("0x%lx", (unsigned long) (val & OxffUL)); */
    outcol += 4; /* or  should be changed to +3 ? */
}

PRIVATE void put_word P1 (UVAL, val)
{
   put_header (wordgen, alignment_of_type (tp_short));
/*DtZ     oprintf ("0x%lx", (unsigned long) (val & OxffffUL)); */
    oprintf ("$%lx", (unsigned long) (val & OxffffUL));
    outcol += 6; /* or should be changed to +7? */
} 

Next, AS68 does not need/want "\t.sect", it accepts .data and .text directly.
out68k_c.c:
static void seg P3 (enum e_sg, segtype, const char *, segname, SIZE, al)
{
 nl();
 if (curseg != segtype) {                                                                                     
/*DtZ   oprintf ("\t.sect\t%s%s", segname, newline);*/                                                        
        oprintf ("\t%s * Segment %s", segname, newline);                                                       

And you should edit config.h the way it can generate for 68000 and to check the compiler binary you get can do -cpm68k and -int=16.
Next, remember that's just compiler, not even preprocessor: so on unix side I had to do
cc -E -I/home/dtz/8BIT/68K/CPM1.3/DISK4 main.c > p_main.c
./cc68 -int=16 -cpm68k -v p_main.c > main.s
Also, note that standard CP/M 68's headers lacks most of the C functions; so I had to copy them from "C language programming manual" (do not forget to add link link there!)
On CP/M system, assemble the file with AS68 -U file.o, and then link it with CLINK.SUB
UPD: More, the code it generates can be feed to jas assembler mentioned some time ago.
UPDD: Looks like optimization code is faulty.
UPDDD: 201607 Mirrored Here

Monday, December 8, 2014

Sozobon's JAS runs at CP/M 68K

As I expected, JAS from Sozobon C compiler for Atari was easy to port back to CP/M 68 and it works natively.
To do it, do the following: compile Sozobon C on unix host (see virtuallyfun.superglobalmegacorp.com/?p=97 (or mirrored on my site), then compile jas by xhcc, now using makefile , not make.unx.
First, make a small patch in main.c:
        if ( freopb( ofile, "w", stdout ) ==  NULL )
                error( 0, "can't open object file for writing" );
      if ( freopen( ofile, "bw", stdout ) == (FILE *) NULL )
             error( 0, "can't open object file for writing" );


Then take CP/M-68 1.3 distribution files; here you'll find DISK4 and header files on it. You have to convert them to lowercase and erase all symbols after (and including) ^Z.
Then edit makefile to became smth like that:
CC = ./xhcc
CFLAGS = -c -v -O -I/home/dtz/8BIT/68K/CPM1.3/DISK4
Run make, you'll get 10 *.s files; then assemble them by jas:
#!/usr/local/bin/tclsh
foreach f [glob *.s] {
 exec ./xjas -8 $f
}
You'll get 10 .o files. Transfer them to CP/M 68K host and link by DRI's LO68: c:lo68 -R -u_nofloat -o jas.68k c:s.o CBUF.O CPY.O GEN.O HDR.O LEX.O MAIN.O OPS.O OPT.O PARSE.O PASS.O SCAN.O SYM.O c:clib And know what? It works! (do not forget to add -8 switch when calling jas). However, that's not very useful as assembler, but better to have an assembler with SOURCE as alternative to AS68.
Get it from here ;-) [ok from here]

Sunday, December 7, 2014

Use of Sozobon C on CP/M 68

I've tried to make some use of Sozobon C compiler to be somehow-used on[or together with] CP/M 68.
First, it can be compiled on modern Linux/MacOSX; that's good. And the thing that is useful is xjas assembler. At least with -8 flag it generates .o files with can be linked natively on CP/M'68 lo68.

And, what I say? I say: GOOOOOOOOOD!

Tuesday, November 18, 2014

Hello world assember 68k / as68

One more reminder to myself: the skeleton of assembler program
        text
        globl   _main
_main:
        move.b  #'*',d1
        move.w  #2,d0           * calling BDOS '2'
        trap    #2
        move.b  #'*',d1
        move.w  #2,d0           * calling BDOS '2'
        trap    #2
        move.b  #$0A,d1
        move.w  #2,d0           * calling BDOS '2'
        trap    #2
        move.b  #$0D,d1
        move.w  #2,d0           * calling BDOS '2'
        trap    #2
        rts

Assemble
AS68 hello.s
Link

LO68 -R -O hello.68K hello.O


Friday, September 19, 2014

CP/M 68: linking an C and asm file together

I've googled for this stuff for some time, but finished with reading docs. May be that will be usefull for someone else (notibly me when I will look for that once again)
dtzputs.s , implements dtzputs via calling BDOS fn 2

        text
        globl   _dtzputs
_dtzputs:
        move.l  4(sp),a1        *taking argument from stack
dtzputsl:
        move.b  (a1)+,d1        *take next char; should if be ANDed with 0x00FF ? A1 expected to be w
        cmpi.b  #0,d1
        beq     dtzputse
        move.l  a1,-(sp)        *storing string pointer to stack
        move.w  #2,d0           * calling BDOS '2'
        trap    #2
        move.l  (sp)+,a1
        bra     dtzputsl
dtzputse:
        rts

Assemble it with AS68 -L -U -S 0: dtzputs.s , get dtzputs.o
test.c ,calls dtzputs

main()
{
 dtzputs("Fuck a duck");
}

Compile it with C TEST like that:
9C>c test

9C>CP68 -I 0: TEST.C TEST.I

9C>C068 TEST.I TEST.1 TEST.2 TEST.3 -F

9C>ERA TEST.I

9C>C168 TEST.1 TEST.2 TEST.S

9C>ERA TEST.1

9C>ERA TEST.2

9C>AS68 -L -U -S 0: TEST.S

9C>ERA TEST.S

9C>
And link it

9C>clink test dtzputs

9C>LO68 -R -U_NOFLOAT -O TEST.68K 0:S.O TEST.O DTZPUTS.O .O .O .O .O .O .O .O 0:CLIB

9C>test
Fuck a duck

Quack! Quack! Quack!
The next thing to understand is how to get rid of S.O and CLIB, but it is not for today.

Friday, September 5, 2014

Some more news on SGSBCSD

Looks like I have the code working with SDHC. I'll test in in a few days and release 0.00.04/2491.
So my future plans to port it to m68k code and update 68kavr project. UPD: 2491 version of Searle Grant SBC SD interface released. It works!

Wednesday, September 3, 2014

Huge SGSBCSD update - 2490

A lot of bug fixes for my SD interface for Searle Grant's SBC. A loot! If anyone have it installed - update it now

Friday, August 29, 2014

In a few days I plan to release a significant SGSBCSD [SD interface for Z80] code upgrade. At least a lot of bugfixes.
If anyone cares. Or otherwise, I do not care.

Friday, June 27, 2014

QooltermII at version 0.00.02 - first time update scince 1999!

Well
QoolTermII is [partitial] vt52 terminal emulator for Robotron PC 1715 now gets an updated version - 0.00.02. I bet it is the rarest updated software ever!
Now works with IOByte as well (saying, as bad) as with direct SIO.
Get it here

Tuesday, May 20, 2014

68kavr - considered competed

So that happened.
I consider 68kavr project competed.
That means that it loads OS from SD card
Today I've published my SD card image with the source of BIOS/LDRBIOS, as usuially, here , I'll check two last chapters and copy them there (to be able to discuss them and just they not to be lost one day) in few days.

Thursday, April 24, 2014

68k project: step 7 - CP/M 68, booting from Srecords

Ok, lets start from code. Code for ChVII
  The firmware is mostly [or exactly?] the same, but there are two new directories - BIOS ,which contains BIOS (sort of ugly bios), and Disk, which contains pretty empty disk image and diskdefs for cpmtools. (local)
The disk image itself contains A: - P: drives, cpmtools with this diskdefs are able to write to A: . Write there a whole CP/M distribution. The disk image comes from Searle Grant's Z80 SBC, (or even my mentioned SD interface for it) as all the DPB stuff.
  For the bios reassembly use assemble script, you'll get bios.s. Next, load it and CPM15000.SR via cut-and-paste to SBC console.
  Personally I do it with kermit. It's much better for our use then saying minicom.
  Here is my kermit initialization (I hope I forgot nothing:)
set line /dev/ttyS0
set car off
set speed 38400
set flow rts
set transmit timeout 10

(and set input echo on, but I forgot what it is for and if it is really needed)    So from SBC prompt say
* boot
, it will initialise the card and load something ($2000 bytes?) to somewhere ($1000?). But currently we do not care.
  Next, load bios.s and CPM15000.SR by

 C-Kermit> transmit CPM15000.SR

and

 C-Kermit> transmit bios.s

Next, run it via go15000 and get A:.
  The next thing is to create CPMLDR and CPM.SYS. Sure, we will create them on the board. But I refuse to learn CP/M ed!
So, the next thing I going to do is to get some text editor. And that will be separate chapter or two.


Some things to mention:
  • First, get .68K files from .REL . That's done by series of RELOCX.SUB scripts
  • if AS68 says can't open 0:AS68SYMB.DAT, ensure you have AS68INIT from DISK3 and run AS68 -I AS68INIT for every TPA change
  • http://forums.debian.net/viewtopic.php?f=16&t=112244 A very good article how to recalculate DPBs into cpmtools diskdefs.
    It does not help me much because it is long and clever; I always guess some things (and probably wrong)

A working CP/M 68K emulator found

it is fresh and newly-written, but it works
Also, it contains a working version of emacs! That solves my need for a text editor for CP/M 68k (but not a reason to finish my attempts to port dealin and ted editors)

Monday, April 21, 2014

I have a bootable CP/M 68!

Yes,I did it!
Looks like AS68 has some problems with conditional assembling, so I had to pass my assembler source via linux's cpp. As well it does not like symbols longer then 8 chars (and it's clear why), so using cpp was a good idea (and then transfer it on board).
Anyway, I've got an $18000 TPA. Good!

Wednesday, April 9, 2014

68k project: step 6 - lets' start thinking about CP/M

First, some news of the project: The updated scheme HERE . Generally nothing new, only MAX232A is drawn
Here is the picture of my board taken 20140325.
First, I have some minor (but nice!) changes in my firmware. First is
GOaddressmonitor command , which goes to the specified address.
And the second... (have I ever told you I'm genius? REALLY? Oh, sorry) - I catch the BREAK from a serial line and inititate CPU Reset! (actually, even MCU reset).
So, in C-Kermit> (if you use C-Kermit as do I) 's terminal mode, I can press [CTRL]+[\] [B] , and get a reset!
More, I own an HP 9000 A500 server and it has as "Service Processor". And I'd like to have a full Service Processor console in future like the one on that server. Saying, it can turn on and off ATX power (if I have a spare pin and free memory on Atmega8)....
Sometimes in future
So, let's talk about CP/M iteself
This is my first attempt to port CP/M to any computer by the method explained in, our case, "System Guide". The prerequestings are:
  • I should have System Guide (I do)
  • I should have CP/M 68 in S-records (I do from http://www.cpm.z80.de/binary.html : I use this)
  • The system must accept S-Records (my does)
  • I must have an assembler which generates S-Records (I use A68k from TI 68K calculator project:
    
    68000 Assembler - version 2.71.F3s (Sep 21, 2004)
    Copyright 1985 by Brian R. Anderson
    AmigaDOS conversion copyright 1991 by Charlie Gibbs.
    Adapted for use with Fargo by David Ellsworth.
    Bugfixes and additions by Julien Muchembled, Paul Froissart and Kevin Kofler
    
    
    Warning: do not use asm68k
    
    asmx multi-assembler version 2.0b5
    Copyright 1998-2007 Bruce Tomlin
    
    
    buggy as shit. May be vasm is good - but I'm not ready to write linker scripts just to get SRecord from the source with static lables and given ORG)
So, on the CP/M distribution there is a file CPM15000.SR - that's an CP/M in S-Records (which is loaded from address $15000).
On the first disk of distribution set there is a very useful README.TXT which says that to create a BIOS I should figure out _init (== ORG of BIOS == $1B000) and _ccp ($150BC) symbols in CPM15000.MAP (and that differs from what is written in "System Guide"; there said you should patch Srecords file [for 1.0 and 1.1 CP/M 68k vers.]).
So lets go to "System Guide" directly to the Appendix B on page 59 and start type "Sample Bios" into text editor.
As you can see, BIOS install TRAP #3 and CP/M works with BIOS via this TRAP. I've tried to start with
  • constat
  • conin
  • conout
, but it was not enough; setexc also a must for CP/M to show you it's A:>. The first thing it does, it installs an TRAP handlers for almost all the TRAPS! I will not retype it here, that will be attached later, when it will be at least read/write sectors. To start CP/M first load CP/M itself, then BIOS, then type go15000
After I wrote basic sector read/write access I was able to say DIR,TYPE and even REN. But could not run any program, that's because I've forgot getseg call at all. And then I was able to run DDT68000, but during read it compained "Cannot write sector" (and it was not writing sector at all!)
That was because I forgot flush call.
Funny - this code contains *No* CP/M specific code yet, and is just update of firmware ;-) Code for ChVI

Tuesday, April 8, 2014

Looking for text editor for CP/M 68K

So, I have plain 68K system where I can CP/M by loading it via SRecords.
I want to build CPMLDR & CPM.SYS, so I want to edit them on board to assemble and link. Edit means editor, and I refuse to understand how cp/m's ED work.
So I want to compile some editor, what's the simpliest? Edlin, for sure.
So we have:
  • FreeDOS's edlin
  • Terry McConnell's deadlin
Both are good edlins. Deadlin's code is simpler, but it uses fgetpos, which CP/M 68K's compiler lacks. FreeDOS's edlin is more complicated.
So currenlty I'm trying to compile them, or find some other edlin clone. I know that MicroEmacs/CP/M-68K exists, that's an apportunity, too.

Sunday, February 24, 2013

Some notes on accessing track 0 on SGSBCSD

Well, I've told that C000h TPA (strictly speaking, not TPA, but start of CCP) based CP/M image starts from track 0 / sector 0, the C200h system should start from SD offset 200h - i.e. track 0 / sector 1,D000h TPA - from track 0 / sector 8 That leads to a significant problem: everything works until you do not try to rewrite/regenerate CP/M itself inside of SBC, because the changes will we written to track 0 / sector 0 which will led to unusable boot image. So, if you want to do system change inside of SBC - use C000h based systems for now. In future I plan to change the algorythm of accessing track 0. Saying we have C800h TPA system starting from sector 4 and trying to write track 0/sector 0. I will add 4 to sector number so you'll access sector 4 as expected. That will lead to the situation you will not be able to access track 0 sector 0-3 at all. I think this is not a significant loss.

Tuesday, February 5, 2013

Bugfix release 2322

I had an awfull error writing sector. I waited just 255 times for non-zero byte after SD_CMD24 command.
It was wrong. Now I wait for FFFF ticks max - that works with my Apacer 1G card.

I hope next weekend I'll go to the Mitino market and buy a pocket of the most strange SD and MMC cards to test.
The release, as usually, here

UPD: I've attached c-kermit (version 2.2/IOBYTE) on the disk image inside of distribution. And it's even possible to transmit something.
On the CP/M side, tell kermit
set port tty
On unix side, tell your local kermit
set streaming off
and something somehows transmits, but with a huge number of errors. That's a topic to be explored.