[net.micro.6809] Fixing cobbler and os9gen for COCO3 version 1 kernel.

draco@chinet.UUCP (Kent D. Meyers) (11/09/86)

 NAM fixcmds
 TTL Fix Cobbler and OS9gen for Relocated 1.00 or 1.01 kernel.

* Required for a "cc3fix"ed kernel.
*
* If assembled correctly the ident is:
*
*    Header for:  fixcmds 
*    Module size: $00A8    #168
*    Module CRC:  $72EA9D (Good) 
*    Hdr parity:  $80 
*    Exec. off:   $003A    #58
*    Data Size:   $00C8    #200
*    Edition:     $01      #1
*    Ty/La At/Rv: $11 $81 
*    Prog mod, 6809 obj, re-en 

* For Version 1.00.00 or 1.01.00 OS9 running on the COCO3. This
* utility will read Cobbler and OS9gen from the current execution
* directory, patch them, and rewrite them to the current execution
* directory as C3cobbler and C3os9gen. This patching is necessary
* to allow these commands to function properly with the relocated
* version 1.00.00 or 1.01.00 kernel on the COCO3.
*
* Kent D. Meyers. November 6, 1986.

 IFP1
 USE DEFSFILE
 ENDC

 MOD SIZE,NAME,PRGRM+OBJCT,REENT+1,ENTRY,MSIZ

 ORG 0
 RMB 200 stack
MSIZ EQU .

NAME FCS "fixcmds"
 FCB 1 edition

COBLRNAM FCS 'cobbler'
OS9GENAM FCS 'os9gen'
NEWCOBLR FCS 'C3cobbler'
NEWGEN FCS 'C3os9gen'

* Load module into memory.

LOAD CLRA
 OS9 F$LOAD
 BCS ERREXIT
 RTS

ENTRY LEAX COBLRNAM,PCR
 BSR LOAD
 LEAX NEWCOBLR,PCR
 LEAY $21D,U
 BSR MAKENEW
 LEAX OS9GENAM,PCR
 BSR LOAD
 LEAX NEWGEN,PCR
 LEAY $345,U
 BSR MAKENEW
 CLRB

ERREXIT OS9 F$EXIT

* Fix command and write new file to exec directory.

MAKENEW LDA #$EF
 STA ,Y
 PSHS X,U
 BSR MVERIFY
 PULS X,U
 LDA #EXEC.+UPDAT.
 LDB #PEXEC.+PREAD.+EXEC.+UPDAT.
 OS9 I$CREATE
 BCS ERREXIT
 LEAX ,U
 LDY M$SIZE,U
 OS9 I$WRITE
 BCS ERREXIT
 OS9 I$CLOSE
 BCS ERREXIT
 OS9 F$UNLINK
 RTS

* MVERIFY   by Kevin K. Darling
************************************************
* module verify in memory with CRC update.
*

MVERIFY TFR U,X x is mod address
 LDY M$SIZE,X y is mod size
 LEAY -3,Y beginning of chksum
 TFR Y,D y is byte count
 LEAU D,U set u to chksum
 LDA #$FF init chksum
 STA ,U
 STA 1,U
 STA 2,U
 PSHS U
 OS9 F$CRC calc new crc
 PULS U
 COM ,U+
 COM ,U+
 COM ,U
 RTS

 EMOD
SIZE EQU *
 END