[Coco] Modifying Level1/coco1 for 6309 native mode

Robert Gault robert.gault at att.net
Mon Jan 6 17:45:32 EST 2014


Luis Antoniosi (CoCoDemus) wrote:
> Robert,
>
> In my first tests the system hangs at the firs I$Write on sysgo to
> display NitrOS system name.
>
> put a 'TST $FF78' before it and you will trace it using 'wp ff78,1,rw'
> on debug window.
>

Excellent Luis!

The problem actually is in scf.asm which is where I$Write is located. It looks 
to me as though this is a generic issue and could be found in many other modules 
and commands. Here is the bias used in the NitrOS-9 scf code.

  IFGT  Level-1
   IFNE DH6309
   ELSE
   ENDC
  ELSE
  ENDC

Note the assumption is that a 6309 cpu will exist only for Level2 and therefore 
only in a Coco3. We are going to be forced to go through the source code looking 
for such constructions.

Now specifically in scf.asm and I$Write, the following change (and it is pretty 
ugly at the moment) gets one further through the boot process.

* Get new block of data to write into [PD.BUF]
* Only allows up to 32 bytes at a time, and puts them in the last 32 bytes of
* the 256 byte [PD.BUF] buffer. This way, can use TFR U,D/TSTB to see if fin-
* inshed
L04F1    pshs  y,x            Save write offset & path descriptor pointer
          tfr   x,d            Move data offset to D
          ldu   PD.RGS,y       Get register stack pointer
          ldx   R$X,u          Get pointer to users's WRITE string
          IFNE  H6309
          addr  d,x            Point to where we are in it now
          ldw   R$Y,u          Get # chars of original write
          subr  d,w            Calculate # chars we have left to write
          cmpw  #64            More than 64?
          bls   L0508          No, go on
          ldw   #64            Max size per chunk=64
L0508    ldd   PD.BUF,y       Get buffer ptr
          inca                 Point to PD.BUF+256 (1 byte past end
          subr  w,d            Subtract data size
          ELSE
          leax  d,x
          ldd   R$Y,u
          subd  ,s
          cmpd  #$0020
          bls   L0508
          ldd   #$0020
L0508    pshs  d
          ldd   PD.BUF,y
          inca
          subd  ,s
          ENDC
          tfr   d,u            Move it to U
          lda   #C$CR          Put a carriage return 1 byte before start
          sta   -1,u           of write portion of buffer
* This next section corrects the "6309 only in Level2" assumption.
* The code is indented to attempt to make it readable.
          IFGT  Level-1
           ldy   <D.Proc        Get current process pointer
           lda   P$Task,y       Get the task number
           ldb   <D.SysTsk      Get system task number
           IFNE  H6309
            tfr   w,y            Get number of bytes to move
           ELSE
            puls  y
           ENDC
           os9   F$Move         Move data to buffer
          ELSE
* This acknowledges that a 6309 cpu might exist in a coco1 or coco2.
           IFNE  H6309
            pshs  u
            tfm   x+,u+
            puls  u
           ELSE
            puls  y
            pshs  u
L0509      lda   ,x+
            sta   ,u+
            leay  -1,y
            bne   L0509
            puls  u
           ENDC
          puls  y,x            Restore path descriptor pointer and data offset

Now you get the initial login screen message.

Robert




More information about the Coco mailing list