Mercurial > hg > Members > kono > os9 > sbc09
changeset 94:f20bf9874697
fix os9 dir
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 25 Dec 2018 15:57:05 +0900 |
parents | 03a26438ab8d |
children | ee2e221320e2 |
files | OS9.dsk WORK.dsk os9/Makefile os9/OS9.dsk os9/WORK.dsk os9/crc.c os9/level1/Makefile os9/level1/clock.asm os9/level1/cmds/Makefile os9/level1/d0.asm os9/level1/d1.asm os9/level1/defsfile os9/level1/init.asm os9/level1/pdisk.asm os9/level1/pty-dd.asm os9/level1/pty.asm os9/level1/sysgo.asm os9/level1/v0.asm os9/level2/Makefile os9/level2/boot.asm os9/level2/clock.asm os9/level2/cmds/Makefile os9/level2/cmds/defsfile os9/level2/cmds/fixbasic.pl os9/level2/cmds/loop.asm os9/level2/cmds/sbc09.asm os9/level2/d0.asm os9/level2/d1.asm os9/level2/defsfile os9/level2/init.asm os9/level2/pdisk.asm os9/level2/pty-dd.asm os9/level2/sysgo.asm os9/level2/v0.asm os9/level2/vector.asm os9/level2/vrbf.asm os9/makerom.c os9/os9.h os9/os9mod.c src/os9/Makefile src/os9/crc.c src/os9/level1/Makefile src/os9/level1/clock.asm src/os9/level1/cmds/Makefile src/os9/level1/d0.asm src/os9/level1/d1.asm src/os9/level1/init.asm src/os9/level1/pdisk.asm src/os9/level1/pty-dd.asm src/os9/level1/pty.asm src/os9/level1/sysgo.asm src/os9/level1/v0.asm src/os9/level2/Makefile src/os9/level2/boot.asm src/os9/level2/clock.asm src/os9/level2/cmds/Makefile src/os9/level2/cmds/defsfile src/os9/level2/cmds/fixbasic.pl src/os9/level2/cmds/loop.asm src/os9/level2/cmds/sbc09.asm src/os9/level2/d0.asm src/os9/level2/d1.asm src/os9/level2/defsfile src/os9/level2/init.asm src/os9/level2/pdisk.asm src/os9/level2/pty-dd.asm src/os9/level2/sysgo.asm src/os9/level2/v0.asm src/os9/level2/vector.asm src/os9/level2/vrbf.asm src/os9/makerom.c src/os9/os9.h src/os9/os9mod.c |
diffstat | 73 files changed, 3943 insertions(+), 3920 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/Makefile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,35 @@ +all: os9mod make9rom os9v2.rom os9v1.rom level1/init level2/init + +CC=clang +CFLAGS = -g + +os9mod : crc.c os9.h os9mod.c os9.h + $(CC) $(CFLAGS) -o os9mod crc.c os9mod.c + +make9rom : makerom.c + $(CC) $(CFLAGS) -o make9rom makerom.c + +clean : + rm -rf makerom *.rom os9mod *.dSYM + +os9v1.rom : make9rom level1/init + ./make9rom -o os9v1.rom level1/shell level1/sysgo level1/ioman level1/term level1/pty level1/pdisk level1/d0 level1/d1 level1/vrbf level1/v0 level1/clock level1/scf level1/rbf level1/init level1/os9p2 level1/os9p1 + +os9v2.rom : make9rom level2/init + ./make9rom -o os9v2.rom -2 level2/Shell level2/dir level2/d1 level2/ioman level2/os9p3_perr level2/os9p4_regdump level2/pipe level2/piper level2/pipeman level2/v0 level2/vrbf level2/scf level2/rbf level2/os9p2 level2/sysgo level2/clock level2/pdisk level2/d0 level2/pty level2/term level2/init level2/boot level2/os9p1 + +level1/init : nitros9-code + cd level1 ; make + +level2/init : nitros9-code + cd level2 ; make + +nitros9-code : + hg clone http://hg.code.sf.net/p/nitros9/code nitros9-code + +runv2 : + ../src/v09c -rom os9v2.rom -0 OS9.dsk -1 WORK.dsk + +runv1 : + ../src/v09 -rom os9v1.rom -0 OS9.dsk -1 WORK.dsk +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/crc.c Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,49 @@ +#include <stdio.h> + +#include "os9.h" + +int os9_crc(OS9_MODULE_t *mod) +{ + int i; + u_char crc[3] = {0xff, 0xff, 0xff}; + u_char *ptr = (u_char *) mod; + u_char a; + + for (i = 0; i < INT(mod->size); i++) + { + a = *(ptr++); + + a ^= crc[0]; + crc[0] = crc[1]; + crc[1] = crc[2]; + crc[1] ^= (a >> 7); + crc[2] = (a << 1); + crc[1] ^= (a >> 2); + crc[2] ^= (a << 6); + a ^= (a << 1); + a ^= (a << 2); + a ^= (a << 4); + if (a & 0x80) { + crc[0] ^= 0x80; + crc[2] ^= 0x21; + } + } + if ((crc[0] == OS9_CRC0) && + (crc[1] == OS9_CRC1) && + (crc[2] == OS9_CRC2)) + return 1; + + return 0; +} + +int os9_header(OS9_MODULE_t *mod) +{ + u_char tmp = 0x00; + u_char *ptr = (u_char *) mod; + int i; + + for (i = 0; i < OS9_HEADER_SIZE; i++) + tmp ^= *(ptr++); + + return tmp; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/Makefile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,89 @@ + +OS9SRC = ../nitros9-code +SRCDIR = $(OS9SRC)/level1/modules +SRCCMD = $(OS9SRC)/level1/cmds +SRCDIR2 = $(OS9SRC)/level2/modules + +A09 = ../../src/a09 -I $(OS9SRC)/defs/ + +MOD = pdisk init os9p1 os9p2 ioman pipe piper rbf scf term pty d0 d1 vrbf v0 clock shell dir mdir sysgo shell + +all : ${MOD} + cd cmds; make + +clean : + cd cmds; make clean + rm -f $(MOD) *.lst krn.asm + +LST = -l $@.lst + +# our own module for sbc09 +# CoCoOS9's level1/os9p1.asm has wrong vector value, use our own + +pdisk : + $(A09) pdisk.asm -o pdisk $(LST) + +#boot : boot.asm +# $(A09) boot.asm -o boot $(LST) + +init : init.asm + $(A09) ${SRCDIR}/init.asm -o $@ $(LST) +# $(A09) init.asm -o init $(LST) + +pty : pty.asm + $(A09) pty.asm -o pty $(LST) + +term : pty-dd.asm + $(A09) pty-dd.asm -o term $(LST) + +d0 : d0.asm + $(A09) d0.asm -o d0 $(LST) + +d1 : d1.asm + $(A09) d1.asm -o d1 $(LST) + +clock : clock.asm + $(A09) clock.asm -o clock $(LST) + +vrbf : + $(A09) ../level2/vrbf.asm -o $@ $(LST) + +v0 : + $(A09) v0.asm -o $@ $(LST) + +# os9 level1 moduels + +shell : $(SRCCMD)/shell_21.asm + $(A09) $< -o $@ $(LST) + +mdir : ${SRCCMD}/mdir.asm + $(A09) $< -o $@ $(LST) + +dir : ${SRCCMD}/dir.asm + $(A09) ${SRCCMD}/dir.asm -o dir $(LST) + +os9p1 : + cat ${OS9SRC}//defs/coco.d ${SRCDIR}/kernel/krn.asm > krn.asm + $(A09) -I ../nitros9-code/level1/modules/kernel/ krn.asm -o os9p1 $(LST) + +os9p2 : + $(A09) ${SRCDIR}/kernel/krnp2.asm -o os9p2 $(LST) + +sysgo : + $(A09) sysgo.asm -o sysgo $(LST) + +ioman : + $(A09) ${SRCDIR}/ioman.asm -o ioman $(LST) + +pipe : + $(A09) ${SRCDIR}/pipe.asm -o pipe $(LST) + +piper : + $(A09) ${SRCDIR}/piper.asm -o piper $(LST) + +rbf : + $(A09) ${SRCDIR}/rbf.asm -o rbf $(LST) + +scf : + $(A09) ${SRCDIR}/scf.asm -o scf $(LST) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/clock.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,108 @@ +******************************************************************** +* Clock - OS-9 Level One V2 Clock module +* +* $Id: clock.asm,v 1.1.1.1 2001/02/21 23:30:52 boisy Exp $ +* +* NOTE: This clock is TOTALLY VALID for ALL DATES between 1900-2155 +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 5 Tandy/Microware original version +* 6 Modified to handle leap years properly for BGP 99/05/03 +* 1900 and 2100 A.D. + + nam Clock + ttl OS-9 Level One V2 Clock module + + ifp1 + use defsfile + endc + +tylg set Systm+Objct +atrv set ReEnt+rev +rev set $01 +edition set $06 +TimerPort set $e030 +TkPerSec set 60 +TkPerTS equ TkPerSec/10 ticks per time slice + + + mod eom,name,tylg,atrv,ClkEnt,size + +size equ . + +name fcs /Clock/ + fcb edition + +SysTbl fcb F$Time + fdb FTime-*-2 + fcb $80 + + +ClockIRQ ldx #TimerPort + lda ,x + bita #$10 + bne L00B4 +L00AE jsr [>D.Poll] poll ISRs + bcc L00AE keep polling until carry set + jmp [>D.AltIRQ] jump into an alternate IRQ if available + +L00B4 + ldb #$8f start timer + stb ,x + + dec <D.Tick + bne L007F go around if not zero + ldb <D.Sec get minutes/seconds +* Seconds increment + incb increment seconds + cmpb #60 full minute? + blo L007F + ldb <D.TSec + stb <D.Tick + bsr FTime +L007F stb <D.Sec + + jmp [>D.Clock] + +ClkEnt equ * + ldd #59*256+$01 last second and last tick + std <D.Sec will prompt RTC read at next time slice + ldb #TkPerSec + stb <D.TSec set ticks per second + stb <D.Tick set ticks per second + ldb #TkPerTS get ticks per time slice + stb <D.TSlice set ticks per time slice + stb <D.Slice set first time slice + pshs cc + orcc #FIRQMask+IRQMask mask ints + leax <ClockIRQ,pcr + stx <D.IRQ +* install system calls + leay <SysTbl,pcr + os9 F$SSvc + ldx #TimerPort + ldb #$8f start timer + stb ,x + puls pc,cc + +* F$Time system call code +FTime ldx R$X,u + ldy #TimerPort + ldb #$04 + stb ,y + ldd 1,y + std ,x + std <D.Year + ldd 3,y + std 2,x + std <D.Day + ldd 5,y + std 4,x + std <D.Min + clrb + rts + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/cmds/Makefile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,109 @@ +SRC2 = ../../nitros9-code/level2/cmds +SRC1 = ../../nitros9-code/level1/cmds + +OBJ2 = mdir mfree proc + +OBJ1 = asm attr calldbg cmp config copy cputype date debug del deldir devs dir dir_cb dirsort dump echo edit \ + error free help ident irqs link list load login makdir pxd pwd procs prompt shellplus sleep tee touch tsmon unlink game09 + +all : $(OBJ2) $(OBJ1) + +A09 = ../../../src/a09 -I ../ + +clean : + rm -rf *.lst $(OBJ2) $(OBJ1) + +game09 : + $(A09) -l $@.lst -o $@ ../../../game09/$@.asm + +mdir : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +mfree : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +proc : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +procs : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +reboot : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +smap : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm + +asm : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +attr : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +calldbg : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +cmp : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +config : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +copy : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +cputype : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +date : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +debug : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +del : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +deldir : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +devs : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dir : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dir_cb : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dirsort : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +disasm : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dump : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dw.as : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +echo : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +edit : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +error : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +free : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +help : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +ident : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +irqs : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +link : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +list : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +load : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +login : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +makdir : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +pxd : + $(A09) -D PXD -l $@.lst -o $@ $(SRC1)/pd.asm +pwd : + $(A09) -D PWD -l $@.lst -o $@ $(SRC1)/pd.asm +prompt : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +shellplus : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +sleep : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +tee : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +touch : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +tsmon : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +unlink : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/d0.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,50 @@ +******************************************************************** +* progname - program module +* +* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* - Original Dragon Data distribution version +* +* $Log: d0.asm,v $ +* Revision 1.1 2002/06/14 12:35:43 roug +* Add work done on ideal devices +* +* + + nam D0 + ttl 40-track floppy disk device descriptor + + ifp1 + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $02 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $FF mode byte + fcb $00 extended controller address + fdb $E040 physical controller address + fcb initsize-*-1 initilization table size + fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $00 drive number + fcb $00 step rate + fcb $20 drive device type + fcb $01 media density:0=single,1=double + fdb $0100 number of cylinders (tracks) + fcb $01 number of sides + fcb $00 verify disk writes:0=on + fdb $0012 # of sectors per track + fdb $0012 # of sectors per track (track 0) + fcb $01 sector interleave factor + fcb $08 minimum size of sector allocation +initsize equ * +name equ * + fcs /D0/ +mgrnam equ * + fcs /RBF/ +drvnam equ * + fcs /PDisk/ + emod +eom equ *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/d1.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,50 @@ +******************************************************************** +* progname - program module +* +* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* - Original Dragon Data distribution version +* +* $Log: d0.asm,v $ +* Revision 1.1 2002/06/14 12:35:43 roug +* Add work done on ideal devices +* +* + + nam D1 + ttl 40-track floppy disk device descriptor + + ifp1 + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $02 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $FF mode byte + fcb $00 extended controller address + fdb $E040 physical controller address + fcb initsize-*-1 initilization table size + fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $01 drive number + fcb $00 step rate + fcb $20 drive device type + fcb $01 media density:0=single,1=double + fdb $0100 number of cylinders (tracks) + fcb $01 number of sides + fcb $00 verify disk writes:0=on + fdb $0012 # of sectors per track + fdb $0012 # of sectors per track (track 0) + fcb $01 sector interleave factor + fcb $08 minimum size of sector allocation +initsize equ * +name equ * + fcs /D1/ +mgrnam equ * + fcs /RBF/ +drvnam equ * + fcs /PDisk/ + emod +eom equ *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/defsfile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,17 @@ +* Main defsfile for OS-9 Level One V2 +* +* +* OS-9 Level and Version equates +Level equ 1 +OS9Vrsn equ 1 +OS9Major equ 0 +OS9Minor equ 1 +NOS9VER equ OS9Vrsn +NOS9MAJ equ OS9Major +NOS9MIN equ OS9Minor + + use ../../nitros9-code/defs/coco.d + use ../../nitros9-code/defs/os9.d + use ../../nitros9-code/defs/scf.d + use ../../nitros9-code/defs/rbf.d +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/init.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,28 @@ +* OS9 standard init modul. + nam Init + ttl os9 system module + + ifp1 + use defsfile + endc +null set $0000 +tylg set Systm+$00 +atrv set ReEnt+rev +rev set $01 + mod eom,initnam,tylg,atrv + fcb 0 + fdb $c000 + fcb $0C + fcb $0C + fdb sysgo + fdb sysdev system device (sysdev) (nitors9 requires this) + fdb systerm + fdb bootst bootstrap module (bootst) +initnam fcs "Init" +sysgo fcs "SysGo" +sysdev fcs "/D0" +systerm fcs "/Term" +bootst fcs "Boot" + emod +eom equ * +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/pdisk.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,124 @@ +********************************************* +* Rdisk +* A driver for a Ram disk! +* Modified for os9l1 emulator by Soren Roug 2001 +* + + nam Pdisk + ttl A Device Driver for a RAM Disk + + ifp1 + use defsfile + endc + +*********************** +* Edition History + +* # date Comments +* -- -------- ---------------------------------------------- + +Revision equ 1 +NumDrvs set 2 Number of drives + + org Drvbeg + rmb NumDrvs*DrvMem +RAMSTA equ . + + mod RAMEND,RAMNAM,Drivr+Objct,Reent+Revision,RAMENT,RAMSTA + fcb $FF mode byte + +RAMNAM fcs /Pdisk/ + +RAMENT lbra INIT + lbra READ + lbra WRITE + lbra GETSTA + lbra PUTSTA + lbra TERM + +***************************** +* INIT +* Set up the v09 disk + +INIT ldb #NumDrvs Set no drives to 2 +* Setup drive tables + stb V.NDRV,u save it + lda #$FF + leax DRVBEG,u point to drive table start +L0111 sta DD.TOT+1,x + sta <V.TRAK,x + leax <DRVMEM,x + decb + bne L0111 + clrb +INITXIT rts + +SETUPDT lda <PD.DRV,y Get the drive number + ldu V.PORT,u + sta 1,u drive number + stb 2,u msb of lsn + tfr x,d + sta 3,u + stb 4,u + ldd PD.BUF,y + sta 5,u buffer address + stb 6,u + rts + +***************************** +* READ +* read a sector from disk +* Entry: U = Static Storage +* Y = Path Descriptor +* B = MSB of LSN +* X = LSB's of LSN +* Exit: 256 byte sector in PD.BUF buffer +* +READ bsr SETUPDT + lda #$81 + sta ,u // perform io + ldb ,u // return status + rts + +***************************** +* WRITE +* Write a sector to disk +* Entry: U = Static Storage +* Y = Path Descriptor +* B = MSB of LSN +* X = LSB's of LSN +* PD.Buf = Sector to write +* +WRITE bsr SETUPDT + lda #$55 + sta ,u // perform io + ldb ,u // return status +WRIT99 rts + +************************** +* GETSTA +* get device status +* +GETSTA +Unknown comb + clrb + rts + +************************** +* PUTSTA +* Set device Status +* +PUTSTA +PUTSTA90 clrb + rts + +***************************** +* TERM +* terminate Driver +* +TERM clrb + rts + + emod +RAMEND equ * +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/pty-dd.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,48 @@ +**************************************** +* PTY Descriptor module +* +* Source by Soren Roug 2001 +* + ifp1 + use defsfile + endc + + nam P1 + ttl PTY Device Descriptor + + mod PEND,PNAM,DEVIC+OBJCT,REENT+1,PMGR,PDRV + + fcb READ.+WRITE.+SHARE. + fcb $FF IOBlock (unused) + fdb $E000 hardware address + fcb PNAM-*-1 option byte count + fcb $0 SCF device + fcb $0 Case (upper & lower) + fcb $1 Erase on backspace + fcb $0 delete (BSE over line) + fcb $1 echo on + fcb $1 lf on + fcb $0 eol null count + fcb $0 no pause + fcb 24 lines per page + fcb $8 backspace + fcb $18 delete line char + fcb $0D end of record + fcb $1b eof + fcb $04 reprint line char + fcb $01 duplicate last line char + fcb $17 pause char + fcb $03 interrupt char + fcb $05 quit char + fcb $08 backspace echo char + fcb $07 bell + fcb $00 n/a + fcb $00 n/a + fdb pnam offset to name + fdb $0000 offset to status routine +pnam fcs "TERM" +pmgr fcs "SCF" +pdrv fcs "PTY" + emod +pend equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/pty.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,132 @@ +******************************************* +* PTY +* Device Driver for emulated terminal +* Emulates the 6850 UART seen in usim +* Protocol: +* V.port is the control port. +* V.port+1 is the data port. It is bidirectional. +* bit 1: 1=data ready to read/0=no data +* bit 2: 1=ready for output +* + + nam PTY + ttl Pseudo Terminal + + ifp1 + use defsfile + endc + +*********************** +* Edition History +* +* # date Comments +* - -------- ------------------------------- +* 1 16.11.01 Driver first written. SMR + +Revision equ 1 + + org V.SCF +PST equ . + + mod PEND,PNAM,Drivr+Objct,Reent+Revision,PENT,PST + fcb READ.+WRITE. +PNAM fcs /PTY/ + +PENT lbra INIT + lbra READ + lbra WRITE + lbra GETSTA + lbra PUTSTA + lbra TERM + +********************** +* INIT +* Entry: U = Static storage +* Setup the PIA +* +INIT clrb + rts + +********************** +* READ +* Entry: U = Static Storage +* Y = Path Descriptor +* Exit: A = Character read +* +* Read a byte from Port B +* +READ ldx V.PORT,u load port address +readlp ldb ,x + bitb #$01 + bne readbyte + pshs x sleep for a bit if not + ldx #1 + os9 f$sleep + puls x + bra readlp +readbyte lda 1,x read byte + clrb + rts +********************** +* WRITE +* Entry: U = Static storage +* Y = Path Descriptor +* A = Char to write +* +* Write a byte to Port B +* +WRITE ldx V.PORT,u load port address +write1 ldb ,x + bitb #$02 + bne wrt + pshs x + ldx #1 + os9 f$sleep + puls x + bra write1 +wrt sta 1,x write byte +ok clrb + rts + +********************** +* GETSTA +* U = Static Storage +* Y = Path Descriptor +* +GETSTA ldx PD.Rgs,y X=pointer to registers + lda R$B,x A=contents of B reg. + cmpa #SS.Ready check for ready code + bne gsta1 if not, check next + ldx V.Port,u use the PIA to determine + ldb ,x if data is available + bitb #$01 + bne ok + ldb #E$NotRdy + coma sets the carry flag + rts +gsta1 cmpa #SS.EOF check for eof code + beq ok which always returns ok + comb otherwise return + ldb #E$UnkSVC unknown code error + rts + +********************** +* PUTSTA +* Always return error +* +PUTSTA ldx PD.Rgs,y X=register stack + ldb R$B,x B=contents of reg B + comb otherwise return error. + ldb #E$UnkSVC + rts + +********************** +* TERM +* Terminate Driver +* +TERM clrb + rts + + emod +PEND equ * +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/sysgo.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,335 @@ +******************************************************************** +* SysGo - Kickstart program module +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 5 1998/10/12 Boisy G. Pitre +* Taken from OS-9 L2 Tandy distribution and modified banner for V3. +* +* 5r2 2003/01/08 Boisy G. Pitre +* Fixed fork behavior so that if 'shell startup' fails, system doesn't +* jmp to Crash, but tries AutoEx instead. Also changed /DD back to /H0 +* for certain boot floppy cases. +* +* 2003/09/04 Boisy G. Pitre +* Back-ported to OS-9 Level One. +* +* 5r3 2003/12/14 Boisy G. Pitre +* Added SHIFT key check to prevent startup/autoex from starting if +* held down. Gene Heskett, this Bud's for you. + + nam SysGo + ttl Kickstart program module + + IFP1 + use defsfile + ENDC + +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $03 +edition set $05 + + mod eom,name,tylg,atrv,start,size + + + org 0 +InitAddr rmb 2 + rmb 250 +size equ . + +name fcs /SysGo/ + fcb edition + +* Default process priority +DefPrior set 128 + +Banner equ * + fcc /(C) 2014 The NitrOS-9 Project/ +CrRtn fcb C$CR,C$LF + + IFEQ ROM + IFNE NOS9DBG + fcc "** DEVELOPMENT BUILD **" + fcb C$CR,C$LF + fcc "** NOT FOR DISTRIBUTION! **" + fcb C$CR,C$LF + ENDC +* dts + fcb C$CR,C$LF + fcc !http://www.nitros9.org! + fcb C$CR,C$LF + ENDC + + fcb C$LF +BannLen equ *-Banner + + IFEQ ROM +DefDev equ * + fcc "/V0" +* IFNE DD +* fcc "/DD" +* ELSE +* fcc "/H0" +* ENDC + fcb C$CR +HDDev equ * + fcc "/V0" +* IFNE DD +* fcc "/DD/" +* ELSE +* fcc "/H0/" +* ENDC +ExecDir fcc "/V0/CMDS" + fcb C$CR + ENDC + +Shell fcc "Shell" + fcb C$CR +AutoEx fcc "AutoEx" + fcb C$CR +AutoExPr fcc "" + fcb C$CR +AutoExPrL equ *-AutoExPr + + IFEQ ROM +Startup fcc "startup -p" + fcb C$CR +StartupL equ *-Startup + ENDC + +ShellPrm equ * + IFGT Level-1 + fcc "i=/1" + ENDC +CRtn fcb C$CR +ShellPL equ *-ShellPrm + +* Default time packet +DefTime + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 +* dtb + + IFEQ atari+corsham + IFEQ Level-1 +* BASIC reset code (CoCo port only) +* BasicRst fcb $55 +* neg <$0074 +* nop +* clr >PIA0Base+3 +* nop +* nop +* sta >$FFDF turn off ROM mode +* jmp >Bt.Start+2 jump to boot +* BasicRL equ *-BasicRst + ENDC + ENDC + +Init fcs /Init/ + +* Entry: X = pointer to start of nul terminated string +* Exit: D = length of string +strlen pshs x + ldd #-1 +go@ addd #$0001 + tst ,x+ + bne go@ + puls x,pc + +* Display carriage-return/line-feed. +WriteCR pshs y + leax CrRtn,pcr + ldy #$0001 + os9 I$WritLn + puls y,pc + +********************************************************** +* SysGo Entry Point +********************************************************** +start leax >IcptRtn,pcr + os9 F$Icpt +* Set priority of this process + os9 F$ID + ldb #DefPrior + os9 F$SPrior + +* Write OS name and Machine name strings + leax Init,pcr + clra + pshs u + os9 F$Link + bcs SignOn + stx <InitAddr + ldd OSName,u point to OS name in INIT module + leax d,u point to install name in INIT module + bsr strlen + tfr d,y + lda #$01 + os9 I$Write + bsr WriteCR + ldd InstallName,u + leax d,u point to install name in INIT module + bsr strlen + tfr d,y + lda #$01 + os9 I$Write + bsr WriteCR + +* Show rest of banner +SignOn + ldu ,s + leax >Banner,pcr + ldy #BannLen + lda #$01 standard output + os9 I$Write write out banner + +* Set default time and start Clock module + leax >DefTime,pcr + os9 F$STime set time to default + + IFEQ 1 + leax >MDIR,pcr + leau >mdirprm,pcr + ldd #$0100 + ldy #$0003 + os9 F$Fork + bcs mdirend AutoEx failed.. + os9 F$Wait + ldu ,s + bra mdirend +MDIR fcc "mdir" + fcb $0d +mdirprm fcc "-e" + fcb C$CR +mdirend + ldu ,s + ENDC + +* IFEQ ROM +* Change EXEC and DATA dirs + leax >ExecDir,pcr + lda #EXEC. + os9 I$ChgDir change exec. dir + leax >DefDev,pcr +* Made READ. so that no write occurs at boot (Boisy on Feb 5, 2012) + lda #READ. + os9 I$ChgDir change data dir. + bcs L0125 +* leax >HDDev,pcr +* lda #EXEC. +* os9 I$ChgDir change exec. dir to HD +* ENDC + +L0125 equ * + IFEQ atari+corsham + IFEQ Level-1 +* Setup BASIC code (CoCo port only) +* leax >BasicRst,pcr +* ldu #D.CBStrt +* ldb #BasicRL +*CopyLoop lda ,x+ +* sta ,u+ +* decb +* bne CopyLoop + ELSE + os9 F$ID get process ID + lbcs L01A9 fail + leax ,u + os9 F$GPrDsc get process descriptor copy + lbcs L01A9 fail + leay ,u + ldx #$0000 + ldb #$01 + os9 F$MapBlk + bcs L01A9 + +* lda #$55 set flag for Color BASIC +* sta <D.CBStrt,u +* Copy our default I/O ptrs to the system process + ldd <D.SysPrc,u + leau d,u + leau <P$DIO,u + leay <P$DIO,y + ldb #DefIOSiz-1 +L0151 lda b,y + sta b,u + decb + bpl L0151 + ENDC + ENDC +* +* IFEQ ROM +* Fork shell startup here +* IFEQ atari+corsham +* Added 12/14/03: If SHIFT is held down, startup is not run (CoCo only) +* lda #$01 standard output +* ldb #SS.KySns +* os9 I$GetStt +* bcs DoStartup +* bita #SHIFTBIT SHIFT key down? +* bne L0186 Yes, don't to startup or autoex +* ENDC + +*DoStartup leax >Shell,pcr +* leau >Startup,pcr +* ldd #256 +* ldy #StartupL +* os9 F$Fork +* bcs DoAuto Startup failed.. +* os9 F$Wait +* ENDC + +* Fork AutoEx here +*DoAuto leax >AutoEx,pcr +* leau >CRtn,pcr +* ldd #$0100 +* ldy #$0001 +* os9 F$Fork +* bcs L0186 AutoEx failed.. +* os9 F$Wait + +L0186 equ * + ldu ,s +FrkShell leax >ShellPrm,pcr + leay ,u + ldb #ShellPL +L0190 lda ,x+ + sta ,y+ + decb + bne L0190 +* Fork final shell here + leax >Shell,pcr + lda #$01 D = 256 (B already 0 from above) + ldy #ShellPL + IFGT Level-1 + os9 F$Chain Level 2/3. Should not return.. + ldb #$06 it did! Fatal. Load error code + bra Crash + +L01A9 ldb #$04 error code +Crash clr >DPort+$08 turn off disk motor + jmp <D.Crash fatal error + ELSE + os9 F$Fork Level 1. + bcs DeadEnd Fatal. + os9 F$Wait + bcc FrkShell OK, go start shell. +DeadEnd bra DeadEnd + ENDC + +IcptRtn rti + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level1/v0.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,50 @@ +******************************************************************** +* progname - program module +* +* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* - Original Dragon Data distribution version +* +* $Log: d0.asm,v $ +* Revision 1.1 2002/06/14 12:35:43 roug +* Add work done on ideal devices +* +* + + nam V0 + ttl 40-track floppy disk device descriptor + + ifp1 + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $02 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $FF mode byte + fcb $00 extended controller address + fdb $e040 physical controller address + fcb initsize-*-1 initilization table size + fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $00 drive number + fcb $00 step rate + fcb $20 drive device type + fcb $01 media density:0=single,1=double + fdb $0100 number of cylinders (tracks) + fcb $01 number of sides + fcb $00 verify disk writes:0=on + fdb $0012 # of sectors per track + fdb $0012 # of sectors per track (track 0) + fcb $01 sector interleave factor + fcb $08 minimum size of sector allocation +initsize equ * +name equ * + fcs /V0/ +mgrnam equ * + fcs /VRBF/ +drvnam equ * + fcs /PDisk/ + emod +eom equ *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/Makefile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,95 @@ +OS9SRC=../nitros9-code +SRCDIR=$(OS9SRC)/level2/modules +SRCCMD=$(OS9SRC)/level1/cmds +SRCCMD2=$(OS9SRC)/level2/cmds + +A09 = ../../src/a09 -I $(OS9SRC)/defs/ + +ALL = ioman pdisk init os9p1 os9p2 os9p3_perr os9p4_regdump pipe pipeman pipeman_named piper rbf scf term pty d0 d1 clock vector boot shell dir mdir sysgo v0 vrbf + +all : $(ALL) + cd cmds ; make + +clean : + cd cmds ; make clean + rm -rf $(ALL) *.lst *.dSYM + +LST = -l $@.lst +pdisk : + $(A09) pdisk.asm -o pdisk $(LST) $(LST) + +boot : boot.asm + $(A09) boot.asm -o boot $(LST) + +sysgo : sysgo.asm + $(A09) sysgo.asm -o sysgo $(LST) + +init : init.asm + $(A09) init.asm -o $@ $(LST) + +vector : vector.asm + $(A09) vector.asm -o vector $(LST) + +term : pty-dd.asm + $(A09) pty-dd.asm -o term $(LST) + +d0 : d0.asm + $(A09) d0.asm -o d0 $(LST) + +d1 : d1.asm + $(A09) d1.asm -o d1 $(LST) + +v0 : v0.asm + $(A09) $@.asm -o $@ $(LST) + +clock : + $(A09) clock.asm -o clock $(LST) + +pty : + $(A09) ../level1/pty.asm -o pty $(LST) + +shell : + $(A09) ${SRCCMD}/shell_21.asm -o shell $(LST) + +mdir : + $(A09) ${SRCCMD2}/mdir.asm -o mdir $(LST) + +dir : + $(A09) ${SRCCMD}/dir.asm -o dir $(LST) + +os9p1 : + $(A09) -I $(OS9SRC)/level1/modules/kernel/ ${SRCDIR}/kernel/krn.asm -o os9p1 $(LST) + +os9p2 : + $(A09) ${SRCDIR}/kernel/krnp2.asm -o os9p2 $(LST) + +os9p3_perr : + $(A09) ${SRCDIR}/krnp3_perr.asm -o os9p3_perr $(LST) + +os9p4_regdump : + $(A09) ${SRCDIR}/krnp4_regdump.asm -o os9p4_regdump $(LST) + +ioman : + $(A09) ${SRCDIR}/ioman.asm -o ioman $(LST) + +pipe : + $(A09) $(OS9SRC)/level1/modules/pipe.asm -o $@ $(LST) + +pipeman : + $(A09) $(OS9SRC)/level1/modules/pipeman.asm -o $@ $(LST) + +pipeman_named : + $(A09) ${SRCDIR}/pipeman_named.asm -o pipeman_named $(LST) + +piper : + $(A09) $(OS9SRC)/level1/modules/piper.asm -o $@ $(LST) + +rbf : + $(A09) ${SRCDIR}/rbf.asm -o rbf $(LST) + +vrbf : vrbf.asm + $(A09) vrbf.asm -o vrbf $(LST) + +scf : + $(A09) $(OS9SRC)/level1/modules/scf.asm -o $@ $(LST) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/boot.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,94 @@ +******************************************************************** +* Boot - V09 Boot module +* +* $Id: boot_1773.asm,v 1.1.1.1 2001/02/21 23:30:54 boisy Exp $ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ + + nam Boot + ttl v09 Boot module + + ifp1 + use defsfile + endc + +* +* map extended rom on page 0x40- +* first two bytes are extra rom module size + +tylg set Systm+Objct +atrv set ReEnt+rev +rev set $01 +edition set 1 + + mod eom,name,tylg,atrv,start,size + +size equ . + +name fcs /Boot/ + fcb edition + +start + lbra entry + lbra btdebug +entry + ldy #$40 extended rom page no. + clra + clrb + pshs d,x,y,u + tfr d,x + leay 4,s pointer to page no + ** read boot rom file size + os9 F$LDDDXY + bcs last + addb #$ff + adca #0 + clrb + std ,s size return as d + ** OS9 lv2 use $a000-$dfff as a temporary page + ** demand at least that size ( ROM start at $ed00 ) + cmpa #$ed-$a0 + bhi ok + lda #$ed-$a0 +ok + os9 F$BtMem + bcs last + ** u points the memory + stu 2,s return as x + ldd ,s + std 6,s + ldx #0 + ** copy to Bt BtRAM +pagel ldd #$2000 + cmpd 6,s + blo lo + ldd 6,s +lo tfr d,y + lda 5,s + sta $ffa0 + tfr y,d +loop ldy ,x++ + sty ,u++ + subd #2 + bne loop + clr $ffa0 back to system map + ldd 6,s + subd #$2000 + bmi last all transfered + std 6,s + ** 2k boundary + inc 5,s + ldx #0 + bra pagel +last clr $ffa0 + puls d,x,y,u,pc + + ** put lbsr btdebug on <$5e +btdebug anda #$7f + sta $ff81 + rts + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/clock.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,117 @@ +******************************************************************** +* Clock - OS-9 Level One V2 Clock module +* +* $Id: clock.asm,v 1.1.1.1 2001/02/21 23:30:52 boisy Exp $ +* +* NOTE: This clock is TOTALLY VALID for ALL DATES between 1900-2155 +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 5 Tandy/Microware original version +* 6 Modified to handle leap years properly for BGP 99/05/03 +* 1900 and 2100 A.D. + + nam Clock + ttl OS-9 Level One V2 Clock module + + ifp1 + use defsfile + endc + +usefirq equ 0 + +tylg set Systm+Objct +atrv set ReEnt+rev +rev set $01 +edition set $06 +TimerPort set $ffb0 + + mod eom,name,tylg,atrv,ClkEnt,size + +size equ . + +name fcs /Clock/ + fcb edition + +SysTbl fcb F$Time + fdb FTime-*-2 + fcb F$STime + fdb FSTime-*-2 + fcb $80 + + + ifeq usefirq-1 +ClockFIRQ + leas -1,s + pshs d,dp,x,y + lda 8,s + ora #$80 Entire flag + pshs a + stu 8,s + jmp [$FFF8] + endc +ClockIRQ + ldx #TimerPort + lda ,x + bita #$10 + beq L00AE +L00AE leax ClockIRQ1,pcr + stx <D.SvcIRQ + jmp [D.XIRQ] Chain through Kernel to continue IRQ handling +ClockIRQ1 + inc <D.Sec go up one second + lda <D.Sec grab current second + cmpa #60 End of minute? + blo VIRQend No, skip time update and alarm check + clr <D.Sec Reset second count to zero +VIRQend + ldx #TimerPort + lda #$8f + sta >TimerPort + jmp [>D.Clock] + +TkPerTS equ 2 + +ClkEnt equ * + pshs cc + orcc #FIRQMask+IRQMask mask ints + leax >ClockIRQ,pcr + stx <D.IRQ + ifeq usefirq-1 + leax >ClockFIRQ,pcr + stx $FFF6 must be a RAM + endc +* install system calls + leay >SysTbl,pcr + os9 F$SSvc + ldd #59*256+TkPerTS last second and time slice in minute + std <D.Sec Will prompt RTC read at next time slice + stb <D.TSlice set ticks per time slice + stb <D.Slice set first time slice + lda #TkPerSec Reset to start of second + sta <D.Tick + + ldx #TimerPort + ldb #$8f start timer + stb ,x + puls pc,cc + +* F$Time system call code +FTime ldx #TimerPort + ldb #$04 + stb ,x + leax 1,x Address of system time packet +RetTime ldy <D.Proc Get pointer to current proc descriptor + ldb P$Task,y Process Task number + lda <D.SysTsk From System Task + ldu R$X,u +STime.Mv ldy #6 Move 6 bytes +FMove os9 F$Move + rts + +FSTime clrb + rts + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/cmds/Makefile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,131 @@ +SRC2 = ../../nitros9-code/level2/cmds +SRC1 = ../../nitros9-code/level1/cmds + +OBJ2 = mdir mfree proc procs reboot dmem pmap smap mmap + +OBJ1 = asm attr calldbg cmp config copy cputype date debug del deldir devs dir dir_cb dirsort dump echo edit \ + error free help ident irqs link list load login makdir pxd pwd procs prompt shellplus sleep tee touch tsmon unlink \ + game09 sbc09 kernel09.s basic.s + + +all : $(OBJ2) $(OBJ1) + +A09 = ../../../src/a09 + +clean : + rm -rf *.lst $(OBJ2) $(OBJ1) + +game09 : + $(A09) -l $@.lst -o $@ ../../../game09/$@.asm + +sbc09 : + $(A09) -l $@.lst -o $@ $@.asm + +# sbc09 cmds/kernel09.s +kernel09.s : ../../../examples_forth/kernel09 + cp ../../../examples_forth/kernel09 kernel09.s + +# sbc09 cmds/basic.s +basic.asm : ../../../basic/basic.asm + perl fixbasic.pl ../../../basic/basic.asm > basic.asm + +basic.s : basic.asm + $(A09) -l $@.lst -s $@ basic.asm + +mdir : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +mfree : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +proc : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +procs : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +reboot : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +smap : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +mmap : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +pmap : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm +dmem : + $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm + +asm : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +attr : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +calldbg : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +cmp : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +config : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +copy : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +cputype : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +date : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +debug : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +del : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +deldir : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +devs : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dir : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dir_cb : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dirsort : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +disasm : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dump : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +dw.as : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +echo : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +edit : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +error : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +free : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +help : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +ident : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +irqs : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +link : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +list : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +load : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +login : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +makdir : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +pxd : + $(A09) -D PXD -l $@.lst -o $@ $(SRC1)/pd.asm +pwd : + $(A09) -D PWD -l $@.lst -o $@ $(SRC1)/pd.asm +prompt : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +shellplus : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +sleep : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +tee : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +touch : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +tsmon : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm +unlink : + $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/cmds/defsfile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,3 @@ +* Main defsfile for OS-9 Level One V1 +* + use ../defsfile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/cmds/fixbasic.pl Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,49 @@ +#!/usr/bin/perl +# + +while(<>) { + next if (/^ACIA/ .. /^TDRE/) ; + next if (/^TSTBRK/ .. /^ END/) ; + if (/^CLEAR/) { +print <<"EOFEOF" + JSR \$24 ;; echo off (but it is not suuported on pty.asm ) +EOFEOF + } + if (/^GL02/) { + print "GL02\n"; # do not echo input + next; + } + print; +} + + +print <<"EOFEOF" +****************************** +****************************** +TSTBRK bsr BRKEEE + bcc GETC05 +GETCHR bsr INEEE + CMPA \#ETX ; 3 + BNE GETC05 + JMP BREAK +INTEEE +GETC05 RTS +PUTCHR INC ZONE + JMP OUTEEE +****************************** +****************************** +INEEE PSHS D + JSR 0 + STB ,S + PULS D,PC +OUTEEE PSHS D + TFR A,B + JSR 3 + PULS D,PC +BRKEEE PSHS D + JSR \$F + PULS D,PC +****************************** +****************************** + END +EOFEOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/cmds/loop.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,45 @@ +******************************************************************** +* loop dummy loader +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1 2018/07/30 S. Kono + + nam Loop + ttl Dummy loop + + ifp1 + use defsfile + endc + +* Module header definitions +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $00 +edition set 1 + + mod eom,name,tylg,atrv,start,size + + org 0 +count rmb 2 +size equ . + +name fcs /Loop/ + fcb edition + +start ldy #4000 +l1 ldx #0 +l0 leax -1,x + bne l0 + leay -1,y + bne l1 +Exit clrb + os9 F$Exit + + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/cmds/sbc09.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,264 @@ +******************************************************************** +* sbc09 emulator +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1 2018/08/20 S. Kono +* Emulatoe sbc09 on os9 lv2 + + nam Sbc09 + ttl Sbc09 emulator + + ifp1 + use defsfile + endc + +* Module header definitions +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $00 +edition set 1 + + mod eom,name,tylg,atrv,start,size + + org 0 +ioentry rmb $80 +filepath rmb 2 +parmptr rmb 2 +stdin rmb 1 +chksum rmb 1 +bcount rmb 1 +adr rmb 2 +work rmb 2 +readbuff rmb $100 + org $400 +emstart rmb $e000-. +size equ . + +name fcs /Sbc09/ + fcb edition + +start + clr <stdin + stx <parmptr save parameter pointer + stu <work save parameter pointer + lda #READ. read access mode + os9 I$Open open file + bcs L0049 branch if error + sta <filepath else save path to file + stx <parmptr and updated parm pointer +L001F lda <filepath get path + leax readbuff,u point X to read buffer + ldy #200 read up to 200 bytes + os9 I$ReadLn read it! + bcs L0035 branch if error + bsr srecords + bra L001F else exit +L0035 cmpb #E$EOF did we get an EOF error? +* bne L0049 exit if not + lda <filepath else get path + os9 I$Close and close it + bcs L0049 branch if error +* ldx <parmptr get param pointer +* lda ,x get char +* cmpa #C$CR end of command line? +* bne start branch if not + +copytbl + lda #$17 lbra + sta $e400 + leax Exit,pcr + leax -$e403,x + stx $e401 + leax iotbl,pcr + leay iotblend,pcr + pshs x,y + ldy #(iotblend-iotbl) +l1 ldb #$7e * JMP + stb ,u+ + ldd ,x++ + addb 1,s + adca ,s + std ,u++ + cmpx 2,s + ble l1 + puls x,y + jmp $400 + +Exit clrb + os9 F$Exit + +iotbl + fdb getchar-iotbl ; 0 + fdb putchar-iotbl ; 3 + fdb getline-iotbl ; 6 + fdb putline-iotbl ; 9 + fdb putcr-iotbl ; $C + fdb getpoll-iotbl ; $F + fdb xopenin-iotbl ; $12 + fdb xopenout-iotbl ; $15 + fdb xabortin-iotbl ; $18 + fdb xclosein-iotbl ; $1B + fdb xcloseout-iotbl ; $21 + fdb delay-iotbl ; $24 + fdb noecho-iotbl ; $27 +iotblend + +L0049 +err ldb #1 + bra Exit + +srecords + leax readbuff,u + clr <chksum +sline lda ,x+ + cmpa #'S' + bne slast + lda ,x+ + cmpa #'1' + bne slast + bsr gthex2 + subb #3 + stb <bcount + bsr gthex2 + stb <adr + bsr gthex2 + stb <adr+1 + lda <bcount + ldy <adr +sbyte bsr gthex2 + stb ,y+ + deca + bgt sbyte +slast + bsr gthex2 + lda <chksum + cmpa #$ff + bne err1 +err1 + rts + +gthex4 pshs d + bsr gthex2 + stb ,s + bsr gthex2 + stb 1,s + puls d,pc + +gthex2 pshs b + bsr gthex1 + aslb + aslb + aslb + aslb + stb ,s + bsr gthex1 + addb ,s + stb ,s + addb <chksum + stb <chksum + puls b,pc + +gthex1 ldb ,x+ + subb #'0' + blo rgethex1 + cmpb #9 + bls rgethex1 + subb #7 +rgethex1 + rts + +putchar * Output one character in B register. + PSHS X,Y + BRA OUTCH1 +getchar * Input one character into B register. + PSHS A,B,X,Y +GETCH0 + LDA #0 + LEAX 1,S + LDY #1 + OS9 I$Read + BCS GETCH0 + PULS A,B,X,Y,PC +putcr * Output a newline. + LDB #C$CR + bsr putchar + LDB #C$LF + PSHS X,Y +OUTCH1 PSHS A,B + LEAX 1,S + LDA #1 + LDY #1 + OS9 I$Write + PULS A,B,X,Y,PC +getpoll + PSHS X,Y,D + LDA #0 + LDB #SS.Ready + OS9 I$GetStt + CMPB #$F6 Not Ready + BNE RSENSE + CLRB + PULS X,Y,D,PC +RSENSE + ORCC #1 set carry to indicate ready +RNSENSE + PULS X,Y,D,PC + +getline * Input line at address in X, length in B. + PSHS A,B,X,Y +GETLN0 + CLRA + TFR D,Y + LDA <stdin + OS9 I$ReadLn + BCS GETLN0 + LEAY -1,Y + TFR Y,D +* LDA D,X +* CMPA #C$CR +* BNE GETLN1 +* LEAY -1,Y +GETLN1 STY ,S + PULS A,B,X,Y,PC +putline * Output string at address in X, length in B. + PSHS A,B,X,Y + CLRA + TFR D,Y + LDA <stdin + OS9 I$WritLn + PULS A,B,X,Y,PC +xopenin +xopenout +xabortin +xclosein +xcloseout + RTS + +noecho LDA <stdin + CLRB + LDX <work + leax readbuff,X + OS9 I$GetStt + bcs err2 + CLR IT.EKO,X + CLRB + OS9 I$SetStt +err2 + RTS + +delay PSHS D,X * address **$21** + * On input the D register contains the number of timer + * ticks to wait. Each timer tick is 20ms + TFR D,X + OS9 F$Sleep + PULS D,X,PC + + + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/d0.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,50 @@ +******************************************************************** +* progname - program module +* +* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* - Original Dragon Data distribution version +* +* $Log: d0.asm,v $ +* Revision 1.1 2002/06/14 12:35:43 roug +* Add work done on ideal devices +* +* + + nam D0 + ttl 40-track floppy disk device descriptor + + ifp1 + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $02 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $FF mode byte + fcb $00 extended controller address + fdb $ffc0 physical controller address + fcb initsize-*-1 initilization table size + fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $00 drive number + fcb $00 step rate + fcb $20 drive device type + fcb $01 media density:0=single,1=double + fdb $0100 number of cylinders (tracks) + fcb $01 number of sides + fcb $00 verify disk writes:0=on + fdb $0012 # of sectors per track + fdb $0012 # of sectors per track (track 0) + fcb $01 sector interleave factor + fcb $08 minimum size of sector allocation +initsize equ * +name equ * + fcs /D0/ +mgrnam equ * + fcs /RBF/ +drvnam equ * + fcs /PDisk/ + emod +eom equ *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/d1.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,50 @@ +******************************************************************** +* progname - program module +* +* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* - Original Dragon Data distribution version +* +* $Log: d0.asm,v $ +* Revision 1.1 2002/06/14 12:35:43 roug +* Add work done on ideal devices +* +* + + nam D1 + ttl 40-track floppy disk device descriptor + + ifp1 + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $02 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $FF mode byte + fcb $00 extended controller address + fdb $ffc0 physical controller address + fcb initsize-*-1 initilization table size + fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $01 drive number + fcb $00 step rate + fcb $20 drive device type + fcb $01 media density:0=single,1=double + fdb $0100 number of cylinders (tracks) + fcb $01 number of sides + fcb $00 verify disk writes:0=on + fdb $0012 # of sectors per track + fdb $0012 # of sectors per track (track 0) + fcb $01 sector interleave factor + fcb $08 minimum size of sector allocation +initsize equ * +name equ * + fcs /D1/ +mgrnam equ * + fcs /RBF/ +drvnam equ * + fcs /PDisk/ + emod +eom equ *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/defsfile Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,17 @@ +* Main defsfile for OS-9 Level One V2 +* +* +* OS-9 Level and Version equates +Level equ 2 +OS9Vrsn equ 1 +OS9Major equ 0 +OS9Minor equ 1 +NOS9VER equ OS9Vrsn +NOS9MAJ equ OS9Major +NOS9MIN equ OS9Minor + + use ../../nitros9-code/defs/coco.d + use ../../nitros9-code/defs/os9.d + use ../../nitros9-code/defs/scf.d + use ../../nitros9-code/defs/rbf.d +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/init.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,188 @@ +******************************************************************** +* Init - NitrOS-9 Configuration module +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 204 1998/10/12 Boisy G. Pitre +* Original OS-9 L2 Tandy distribution. +* +* 205 1998/10/20 Boisy G. Pitre +* Added CC3IO and Clock sections. +* +* 205r2 1998/10/20 Boisy G. Pitre +* Removed clock information from here. +* +* 1 2003/01/08 Boisy G. Pitre +* Restarted edition number back to 1, removed CMDS/cc3go reference and +* just have cc3go so that in certain cases, cc3go can be in the bootfile, +* and so that ROMmed systems don't have to have a special init module. +* +* 2003/11/05 Robert Gault +* Corrected CC3IO info regards mouse. Changed from fcb to fdb low res/ right +* Corrected OS9Defs to match. +* +* 2006/07/06 P.Harvey-Smith. +* Conditionally excluded port messages on Dragon Alpha, due to insufficient +* space ! +* + + nam Init + ttl NitrOS-9 Configuration module + + ifp1 + use defsfile + IFGT Level-1 + use cocovtio.d + ENDC + endc + +tylg set Systm+$00 +atrv set ReEnt+rev +rev set $00 +edition set 1 + +* +* Usually, the last two words here would be the module entry +* address and the dynamic data size requirement. Neither value is +* needed for this module so they are pressed into service to show +* MaxMem and PollCnt. For example: +* $0FE0,$0015 means +* MaxMem = $0FE000 +* PollCnt = $0015 +* + mod eom,name,tylg,atrv,$0FE0,$0015 + +***** USER MODIFIABLE DEFINITIONS HERE ***** + +* +* refer to +* "Configuration Module Entry Offsets" +* in os9.d +* +start equ * + fcb $27 entries in device table + fdb DefProg offset to program to fork + fdb DefDev offset to default disk device + fdb DefCons offset to default console device + fdb DefBoot offset to boot module name + fcb $01 write protect flag (?) + fcb Level OS level + fcb NOS9VER OS version + fcb NOS9MAJ OS major revision + fcb NOS9MIN OS minor revision + IFNE H6309 + fcb Proc6309+CRCOff feature byte #1 + ELSE + fcb CRCOff feature byte #1 + ENDC + fcb $00 feature byte #2 + fdb OSStr + fdb InstStr + fcb 0,0,0,0 reserved + + IFGT Level-1 +* CC3IO section + fcb Monitor monitor type + fcb 0,1 mouse info, low res right mouse + fcb $1E key repeat start constant + fcb $03 key repeat delay constant + ENDC + +name fcs "Init" + fcb edition + +DefProg fcs "SysGo" +DefDev fcs "/V0" +DefCons fcs "/Term" +DefBoot fcs "Boot" + +* +* The DragonAlpha is so pushed for boot track space, that we have to exclude these +* messages ! +* + + IFEQ dalpha +OSStr equ * + fcc "NitrOS-9/" + IFNE H6309 + fcc /6309 / + ELSE + fcc /6809 / + ENDC + fcc /Level / + fcb '0+Level + fcc / V/ + fcb '0+NOS9VER + fcc /./ + fcb '0+NOS9MAJ + fcc /./ + fcb '0+NOS9MIN + fcb 0 + +InstStr equ * + IFNE coco1 + fcc "Radio Shack Color Computer" + ELSE + IFNE deluxe + fcc "Deluxe Color Computer" + ELSE + IFNE coco2 + fcc "Radio Shack Color Computer 2" + ELSE + IFNE coco2b + fcc "Tandy Color Computer 2" + ELSE + IFNE coco3 + fcc "Tandy Color Computer 3" + ELSE + IFNE tano + fcc "Tano Dragon (US)" + ELSE + IFNE d64 + fcc "Dragon 64 (UK)" + ELSE + IFNE dalpha + fcc "Dragon Alpha" + ELSE + IFNE atari + fcc "Atari XL/XE" + ELSE + IFNE mc09 + fcb $1B text in bright blue + fcc "[94mMulticomp09" + fcb $1B + fcc "[0m" + ELSE + IFNE coco3fpga + fcc "Gary Becker's Coco3FPGA" + ELSE + IFNE corsham + fcc "Corsham 6809" + ELSE + fcc "Unknown Machine" + ENDC match IFNE corsham + ENDC match IFNE coco3fpga + ENDC match IFNE mc09 + ENDC match IFNE atari + ENDC match IFNE dalpha + ENDC match IFNE d64 + ENDC match IFNE tano + ENDC match IFNE coco3 + ENDC match IFNE coco2b + ENDC match IFNE coco2 + ENDC match IFNE delux + ENDC match IFNE coco1 + fcb 0 null-terminate the name string + ELSE +* DragonAlpha +OSStr equ * +InstStr equ * + fcb 0 null-length string + ENDC match IFEQ dalpha + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/pdisk.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,124 @@ +********************************************* +* Rdisk +* A driver for a Ram disk! +* Modified for os9l1 emulator by Soren Roug 2001 +* + + nam Pdisk + ttl A Device Driver for a RAM Disk + + ifp1 + use defsfile + endc + +*********************** +* Edition History + +* # date Comments +* -- -------- ---------------------------------------------- + +Revision equ 1 +NumDrvs set 2 Number of drives + + org Drvbeg + rmb NumDrvs*DrvMem +RAMSTA equ . + + mod RAMEND,RAMNAM,Drivr+Objct,Reent+Revision,RAMENT,RAMSTA + fcb $FF mode byte + +RAMNAM fcs /PDisk/ + +RAMENT lbra INIT + lbra READ + lbra WRITE + lbra GETSTA + lbra PUTSTA + lbra TERM + +***************************** +* INIT +* Set up the v09 disk + +INIT ldb #NumDrvs Set no drives to 2 +* Setup drive tables + stb V.NDRV,u save it + lda #$FF + leax DRVBEG,u point to drive table start +L0111 sta DD.TOT+1,x + sta <V.TRAK,x + leax <DRVMEM,x + decb + bne L0111 + clrb +INITXIT rts + +SETUPDT lda <PD.DRV,y Get the drive number + ldu V.PORT,u + sta 1,u drive number + stb 2,u msb of lsn + tfr x,d + sta 3,u + stb 4,u + ldd PD.BUF,y + sta 5,u buffer address + stb 6,u + rts + +***************************** +* READ +* read a sector from disk +* Entry: U = Static Storage +* Y = Path Descriptor +* B = MSB of LSN +* X = LSB's of LSN +* Exit: 256 byte sector in PD.BUF buffer +* +READ bsr SETUPDT + lda #$81 + sta ,u // perform io + ldb ,u // return status + rts + +***************************** +* WRITE +* Write a sector to disk +* Entry: U = Static Storage +* Y = Path Descriptor +* B = MSB of LSN +* X = LSB's of LSN +* PD.Buf = Sector to write +* +WRITE bsr SETUPDT + lda #$55 + sta ,u // perform io + ldb ,u // return status +WRIT99 rts + +************************** +* GETSTA +* get device status +* +GETSTA +Unknown comb + clrb + rts + +************************** +* PUTSTA +* Set device Status +* +PUTSTA +PUTSTA90 clrb + rts + +***************************** +* TERM +* terminate Driver +* +TERM clrb + rts + + emod +RAMEND equ * +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/pty-dd.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,48 @@ +**************************************** +* PTY Descriptor module +* +* Source by Soren Roug 2001 +* + ifp1 + use defsfile + endc + + nam P1 + ttl PTY Device Descriptor + + mod PEND,PNAM,DEVIC+OBJCT,REENT+1,PMGR,PDRV + + fcb READ.+WRITE.+SHARE. + fcb $FF IOBlock (unused) + fdb $ff80 hardware address + fcb PNAM-*-1 option byte count + fcb $0 SCF device + fcb $0 Case (upper & lower) + fcb $1 Erase on backspace + fcb $0 delete (BSE over line) + fcb $1 echo on + fcb $1 lf on + fcb $0 eol null count + fcb $0 no pause + fcb 24 lines per page + fcb $8 backspace + fcb $18 delete line char + fcb $0D end of record + fcb $1b eof + fcb $04 reprint line char + fcb $01 duplicate last line char + fcb $17 pause char + fcb $03 interrupt char + fcb $05 quit char + fcb $08 backspace echo char + fcb $07 bell + fcb $00 n/a + fcb $00 n/a + fdb pnam offset to name + fdb $0000 offset to status routine +pnam fcs "TERM" +pmgr fcs "SCF" +pdrv fcs "PTY" + emod +pend equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/sysgo.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,333 @@ +******************************************************************** +* SysGo - Kickstart program module +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 5 1998/10/12 Boisy G. Pitre +* Taken from OS-9 L2 Tandy distribution and modified banner for V3. +* +* 5r2 2003/01/08 Boisy G. Pitre +* Fixed fork behavior so that if 'shell startup' fails, system doesn't +* jmp to Crash, but tries AutoEx instead. Also changed /DD back to /H0 +* for certain boot floppy cases. +* +* 2003/09/04 Boisy G. Pitre +* Back-ported to OS-9 Level One. +* +* 5r3 2003/12/14 Boisy G. Pitre +* Added SHIFT key check to prevent startup/autoex from starting if +* held down. Gene Heskett, this Bud's for you. + + nam SysGo + ttl Kickstart program module + + IFP1 + use defsfile + ENDC + +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $03 +edition set $05 + + mod eom,name,tylg,atrv,start,size + + + org 0 +InitAddr rmb 2 + rmb 250 +size equ . + +name fcs /SysGo/ + fcb edition + +* Default process priority +DefPrior set 128 + +Banner equ * + fcc /(C) 2014 The NitrOS-9 Project/ +CrRtn fcb C$CR,C$LF + + IFEQ ROM + IFNE NOS9DBG + fcc "** DEVELOPMENT BUILD **" + fcb C$CR,C$LF + fcc "** NOT FOR DISTRIBUTION! **" + fcb C$CR,C$LF + ENDC +* dts + fcb C$CR,C$LF + fcc !http://www.nitros9.org! + fcb C$CR,C$LF + ENDC + + fcb C$LF +BannLen equ *-Banner + + IFEQ ROM +DefDev equ * + fcc "/V0" +* IFNE DD +* fcc "/DD" +* ELSE +* fcc "/H0" +* ENDC + fcb C$CR +HDDev equ * + fcc "/V0" + fcb C$CR +* IFNE DD +* fcc "/DD/" +* ELSE +* fcc "/H0/" +* ENDC +ExecDir fcc "/V0/cmds" + fcb C$CR + ENDC + +Shell fcc "Shell" + fcb C$CR +AutoEx fcc "AutoEx" + fcb C$CR +AutoExPr fcc "" + fcb C$CR +AutoExPrL equ *-AutoExPr + + IFEQ ROM +Startup fcc "startup -p" + fcb C$CR +StartupL equ *-Startup + ENDC + +ShellPrm equ * + IFGT Level-1 + fcc "i=/1" + ENDC +CRtn fcb C$CR +ShellPL equ *-ShellPrm + +mdirprm fcc "-e" + fcb C$CR + +* Default time packet +DefTime + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 + fcb 0 +* dtb + + IFEQ atari+corsham + IFEQ Level-1 +* BASIC reset code (CoCo port only) +* BasicRst fcb $55 +* neg <$0074 +* nop +* clr >PIA0Base+3 +* nop +* nop +* sta >$FFDF turn off ROM mode +* jmp >Bt.Start+2 jump to boot +* BasicRL equ *-BasicRst + ENDC + ENDC + +Init fcs /Init/ + +* Entry: X = pointer to start of nul terminated string +* Exit: D = length of string +strlen pshs x + ldd #-1 +go@ addd #$0001 + tst ,x+ + bne go@ + puls x,pc + +* Display carriage-return/line-feed. +WriteCR pshs y + leax CrRtn,pcr + ldy #$0001 + os9 I$WritLn + puls y,pc + +********************************************************** +* SysGo Entry Point +********************************************************** +start leax >IcptRtn,pcr + os9 F$Icpt +* Set priority of this process + os9 F$ID + ldb #DefPrior + os9 F$SPrior + +* Write OS name and Machine name strings + leax Init,pcr + clra + pshs u + os9 F$Link + bcs SignOn + stx <InitAddr + ldd OSName,u point to OS name in INIT module + leax d,u point to install name in INIT module + bsr strlen + tfr d,y + lda #$01 + os9 I$Write + bsr WriteCR + ldd InstallName,u + leax d,u point to install name in INIT module + bsr strlen + tfr d,y + lda #$01 + os9 I$Write + bsr WriteCR + +* Show rest of banner +SignOn + puls u + leax >Banner,pcr + ldy #BannLen + lda #$01 standard output + os9 I$Write write out banner + +* Set default time + leax >DefTime,pcr + os9 F$STime set time to default + + IFEQ ROM +* Change EXEC and DATA dirs + leax >ExecDir,pcr + lda #EXEC. + os9 I$ChgDir change exec. dir + leax >DefDev,pcr +* Made READ. so that no write occurs at boot (Boisy on Feb 5, 2012) + lda #READ. + os9 I$ChgDir change data dir. + bcs L0125 +* leax >HDDev,pcr +* lda #EXEC. +* os9 I$ChgDir change exec. dir to HD + ENDC + +L0125 equ * + pshs u,y + IFEQ atari+corsham + IFEQ Level-1 +* Setup BASIC code (CoCo port only) +* leax >BasicRst,pcr +* ldu #D.CBStrt +* ldb #BasicRL +*CopyLoop lda ,x+ +* sta ,u+ +* decb +* bne CopyLoop + ELSE + os9 F$ID get process ID + lbcs L01A9 fail + leax ,u + os9 F$GPrDsc get process descriptor copy + lbcs L01A9 fail + leay ,u + ldx #$0000 + ldb #$01 + os9 F$MapBlk + bcs L01A9 + +* lda #$55 set flag for Color BASIC +* sta <D.CBStrt,u +* Copy our default I/O ptrs to the system process + ldd <D.SysPrc,u + leau d,u + leau <P$DIO,u + leay <P$DIO,y + ldb #DefIOSiz-1 +L0151 lda b,y + sta b,u + decb + bpl L0151 + ENDC + ENDC +* +* IFEQ ROM +* Fork shell startup here +* IFEQ atari+corsham +* Added 12/14/03: If SHIFT is held down, startup is not run (CoCo only) +* lda #$01 standard output +* ldb #SS.KySns +* os9 I$GetStt +* bcs DoStartup +* bita #SHIFTBIT SHIFT key down? +* bne L0186 Yes, don't to startup or autoex +* ENDC + +*DoStartup leax >Shell,pcr +* leau >Startup,pcr +* ldd #256 +* ldy #StartupL +* os9 F$Fork +* bcs DoAuto Startup failed.. +* os9 F$Wait +* ENDC + +* Fork AutoEx here +*DoAuto leax >AutoEx,pcr +* leau >CRtn,pcr +* ldd #$0100 +* ldy #$0001 +* os9 F$Fork +* bcs L0186 AutoEx failed.. +* os9 F$Wait + + IFEQ Level-1 + leax >MDIR,pcr + leau >mdirprm,pcr + ldd #$0100 + ldy #$0003 + os9 F$Fork + bcs L0186 AutoEx failed.. + os9 F$Wait + bra L0186 +MDIR fcs "mdir" + fcb $0d + ENDC +L0186 equ * + puls u,y +FrkShell leax >ShellPrm,pcr + leay ,u + ldb #ShellPL +L0190 lda ,x+ + sta ,y+ + decb + bne L0190 +* Fork final shell here + leax >Shell,pcr + lda #$01 D = 256 (B already 0 from above) + ldy #ShellPL + IFGT Level-1 + os9 F$Chain Level 2/3. Should not return.. + ldb #$06 it did! Fatal. Load error code + bra Crash + +L01A9 ldb #$04 error code +Crash clr >DPort+$08 turn off disk motor + jmp <D.Crash fatal error + ELSE + os9 F$Fork Level 1. + bcs DeadEnd Fatal. + os9 F$Wait + bcc FrkShell OK, go start shell. +DeadEnd bra DeadEnd + ENDC + +IcptRtn rti + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/v0.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,50 @@ +******************************************************************** +* progname - program module +* +* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* - Original Dragon Data distribution version +* +* $Log: d0.asm,v $ +* Revision 1.1 2002/06/14 12:35:43 roug +* Add work done on ideal devices +* +* + + nam V0 + ttl 40-track floppy disk device descriptor + + ifp1 + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $02 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $FF mode byte + fcb $00 extended controller address + fdb $ffc0 physical controller address + fcb initsize-*-1 initilization table size + fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $00 drive number + fcb $00 step rate + fcb $20 drive device type + fcb $01 media density:0=single,1=double + fdb $0100 number of cylinders (tracks) + fcb $01 number of sides + fcb $00 verify disk writes:0=on + fdb $0012 # of sectors per track + fdb $0012 # of sectors per track (track 0) + fcb $01 sector interleave factor + fcb $08 minimum size of sector allocation +initsize equ * +name equ * + fcs /V0/ +mgrnam equ * + fcs /VRBF/ +drvnam equ * + fcs /PDisk/ + emod +eom equ *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/vector.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,33 @@ + org $ffd0 +entry equ $f100 + +reset clra + tfr a,dp + ldx #$ff90 + sta 1,x use system mmu + sta $10,x set 0 page + lda #$3f + sta $17,x set IO/os9p1 page + ifndef bootdbg + lda #$39 + sta <$5E + else + ldd #$b7ff Bt.Bug hook + std <$5E sta $ff81 + ldd #$8139 rts + std <$5E+2 + endc + jmp [<vector,pcr] + + org $fff0 +vector + fdb $ff1f os9entry + fdb $ff03 SWI3 + fdb $ff06 SWI2 + fdb $ff09 FIRQ + fdb $ff0c IRQ + fdb $ff0f SWI + fdb $ff1f NMI +vreset + fdb reset +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/level2/vrbf.asm Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,379 @@ +*******************************************************************2 +* Virtual RBF - Random Block File Manager * + + nam VRBF + ttl VRandom Block File Manager + + ifp1 + use defsfile + endc + +rev set $00 +ty set FlMgr + IFNE H6309 +lg set Obj6309 + ELSE +lg set Objct + ENDC +tylg set ty+lg +atrv set ReEnt+rev +edition set 37 + + org $00 +size equ . + + mod eom,name,tylg,atrv,start,size + +name fcs /VRBF/ + fcb edition + +*L0012 fcb DRVMEM + + +**************************** +* +* Main entry point for RBF +* +* Entry: Y = Path descriptor pointer +* U = Register stack pointer + +start lbra Create + lbra Open + lbra MakDir + lbra ChgDir + lbra Delete + lbra Seek + lbra Read + lbra Write + lbra ReadLn + lbra WriteLn + lbra GetStat + lbra SetStat + lbra Close + +* +* +* + + +* +* I$Create Entry Point +* +* Entry: A = access mode desired (0 read, 1 write, 2 update, bit 4 for exex) +* B = file attributes +* X = address of the pathlist +* +* Exit: A = pathnum +* X = last byte of pathlist address +* +* Error: CC Carry set +* B = errcode +* +Create pshs y,u,cc Preserve path desc ptr + orcc #IntMasks + bsr setuppd + ldb #$d1 + stb ,x do IO b,x will be rewrited + ldb ,x + beq ok00 + bra er00 + +* +* I$Open Entry Point +* +* Entry: A = access mode desired +* X = address of the pathlist +* +* Exit: A = pathnum +* X = last byte of pathlist address +* +* Error: CC Carry set +* B = errcode +* +Open pshs y,u,cc + orcc #IntMasks + bsr setuppd + ldb #$d2 + stb ,x + ldb ,x + cmpb #0 + beq ok00 + bra er00 + +* u user stack +* y path descriptor +* PD.PD.y path number +* PD.PD.MOD.y mode +* PD.RGS,y caller's rega = u +* PD.DEV,y device table +* PD.DRV,y drive number + +setuppd ldx PD.DEV,y get device table + ldx 4,x get device module + ldx $f,x get port address + sty 7,x path descriptor + stu 5,x caller stack + lda <PD.DRV,y + sta 1,x + ldy <D.Proc get process pointer + lda R$A,u + bita #EXEC. + bne usechx + ldb P$DIO+3,y get curwdir #pdnumber + bra s1 +usechx ldb P$DIO+9,y get curxdir #pdnumber +s1 stb 4,x + rts + +er00 puls y,u,cc + ldb R$b,u + lda R$Cc,u + ora #Carry + sta R$Cc,u + orcc #Carry + rts +ok00 puls y,u,cc,pc + +* +* I$MakDir Entry Point +* +* Entry: X = address of the pathlist +* +* Exit: X = last byte of pathlist address +* +* Error: CC Carry set +* B = errcode +* +MakDir pshs y,u,cc + orcc #IntMasks + bsr setuppd + ldb #$d3 + stb ,x + ldb ,x + cmpb #0 + beq ok00 + bra er00 + +* +* I$Close Entry Point +* +* Entry: A = path number +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +Close pshs y,u,cc + orcc #IntMasks + bsr setuppd + ldb #$db + stb ,x + ldb ,x + cmpb #0 + beq ok00 + bra er00 + +* +* I$ChgDir Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +ChgDir pshs y,u,cc + orcc #IntMasks + bsr setuppd + ldb #$d4 + stb ,x + ldb ,x + ldy 1,s + ldx <D.Proc get process pointer + ldu PD.RGS,y + lda R$A,u + ldb PD.MOD,y get current file mode + bitb #UPDAT. read or write mode? + beq CD30D no, skip ahead +* Change current data dir + sta P$DIO+3,x +CD30D bitb #EXEC. is it execution dir? + beq ok01 no, skip ahead +* Change current execution directory + sta P$DIO+9,x + bra ok01 + +* +* I$Delete Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +* +Delete pshs y,u,cc + orcc #IntMasks + lbsr setuppd + ldb #$d5 + stb ,x + ldb ,x + cmpb #0 + beq ok01 + bra er01 + +* +* I$Seek Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +Seek pshs y,u,cc + orcc #IntMasks + lbsr setuppd + ldb #$d6 + stb ,x + ldb ,x + cmpb #0 + beq ok01 + bra er01 + +* +* I$ReadLn Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +ReadLn pshs y,u,cc + orcc #IntMasks + lbsr setuppd + ldb #$d7 + stb ,x + ldb ,x + beq ok01 + bra er01 + +* +* I$Read Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +Read pshs y,u,cc + orcc #IntMasks + lbsr setuppd + ldb #$d8 + stb ,x + ldb ,x + beq ok01 + bra er01 + + +* +* I$WritLn Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +WriteLn pshs y,u,cc + orcc #IntMasks + lbsr setuppd + ldb #$d9 + stb ,x + ldb ,x + beq ok01 + bra er01 + +* +* I$Write Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +Write pshs y,u,cc + orcc #IntMasks + lbsr setuppd + ldb #$da + stb ,x + ldb ,x + beq ok01 +er01 puls y,u,cc + ldb R$b,u + lda R$Cc,u + ora #Carry + sta R$Cc,u + orcc #Carry + rts +ok01 puls y,u,cc,pc + + +* +* I$GetStat Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +GetStat pshs y,u,cc + orcc #IntMasks + ldb R$B,u get function code + lbsr setuppd + ldb #$dc + stb ,x + ldb ,x + beq ok01 + bra er01 + + +* +* I$SetStat Entry Point +* +* Entry: +* +* Exit: +* +* Error: CC Carry set +* B = errcode +* +SetStat pshs y,u,cc + orcc #IntMasks + ldb R$B,u get function code + lbsr setuppd + ldb #$dd + stb ,x + ldb ,x + beq ok01 + bra er01 + + + emod +eom equ * + end +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/makerom.c Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,368 @@ +/* makerom.c + build ROM image file os9.rom from module list + + Shinji KONO Fri Jul 6 13:31:52 JST 2018 + +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <strings.h> +#include <sys/stat.h> + +// #define DEBUG 1 + +/* + * Level1 + * os9p1 should be 0xf800 + * it searches ram from the beginning + * rom modules are searched from just after the end of RAM + * + * Level2 + * Coco 512kb memory space + * last 8k is a ROM (can be switched?) ( block 0x3f ) + * os9p1 search module on 0x0d00~0x1e00 at block 0x3f + * + * 8k block ( offset 0xc000 ) + * + * 0xe000 - 0xccff 0xff + * 0xed00 - 0xfeff os9 modules, os9p1 should be the last + * MMU doesnot touch below + * 0xff80 - 0xffdf IO port ( ACIA, clock, pdisk, MMU ) + * 0xffd0 - 0xffef boot code + * 0xfff0 - 0xffff intr vector + * ... next few blocks as extended ROM + * lv2 6809 memory check routine destroys 0x200 on page 0x40 + * sta >-$6000,x + * avoid 0x200 + * + */ + +int level = 1; +int IOBASE = 0xe000; +int IOSIZE = 0x100; +char * outfile ; + +#define LV2START 0xffd0 // our own small boot for mmu +#define LV2ROMEND 0xff80 + +// #define DEBUG + +typedef struct os9module { + int size; + int entry; + int location; + int ioflag; + unsigned char *mod; + char *name; + struct os9module *next; +} *MPTR ; + +unsigned short vec[8]; + +struct os9module * +readOS9module(char *filename) +{ + FILE *fp = fopen(filename,"rb"); + if (fp==0) { + fprintf(stderr,"cannot read %s\n",filename); + exit(1); + } + struct stat st; + fstat(fileno(fp),&st); + int size = st.st_size; + struct os9module *m = malloc(size + sizeof(struct os9module)); + m->size = size; + m->next = 0; + m->ioflag = 0; + m->mod = (unsigned char*)m + sizeof(struct os9module); + fread(m->mod , size, 1, fp); + m->name = (char*) (m->mod + (m->mod[4]*256 + m->mod[5]) ); + m->entry = m->mod[9]*256 + m->mod[10] ; + fclose(fp); + return m; +} + +void +fputword(unsigned short x, FILE *fp) +{ + fputc((x>>8)&0xff,fp); + fputc(x&0xff,fp); +} + +void printOs9Str(char *p) +{ + char *q = p; + while((*p & 0x80)==0) { + putchar(*p); + p++; + } + putchar(*p & 0x7f); + while(p<q+8) { + putchar(' '); p++; + } +} + +unsigned short +getword(unsigned char *ptr) +{ + return (ptr[0]<<8)+ptr[1]; +} + +void rewrite_vector(MPTR m,int size, unsigned char *adr,int count) +{ + // vector is a offset from $F100 (possibly os9p1 module address) + int offset = -size-0xf100; + for(int i=0;i<count;i++) { + int vec = getword(adr); + vec += offset; + adr[0] = vec>>8; + adr[1] = vec&0xff; + adr += 2; + } +} + +int search_vector(MPTR m) { + unsigned char v[] = { 0x6E, 0x9F, 0x00, 0x2C, 0x6E}; + for( unsigned char *p = m->mod ; p < m->mod + m->size; p++ ) { + int i=0; + for(; i< sizeof(v); i++) { + if (p[i]!=v[i]) break; + } + if (i==sizeof(v)) + return p - m->mod; + } + return 0; +} + +// calcurate position from the botton +// avoid v09 IO map on 0xe000-0xe800 +// os9p1 have to be last and at 0xf800 +int findLocation(MPTR m, int loc) { + if (m==0) return loc; + int top = findLocation(m->next, loc) - m->size; + if (m->next==0) { + if (level == 1) + if (m->size > 0xff80-0xf800 ) { + top = 0x10000-(m->size+0x80); + } else { + top = 0xf800; // OS9p1 + } + else { +#if 0 + // old level2 kernel has vector at the bottom + top = 0x10000-(m->size+0x80); + rewrite_vector(m,m->size,m->mod+getword(m->mod+2),7); +#else + top = 0xf000; // level2 OS9p1 starts here + // and theses area are RAM /REGISTER STACK/ +#endif + } + } + if (level==1 && !(( top+m->size < IOBASE ) || ( IOBASE+IOSIZE < top)) ) { + top = IOBASE-m->size-1; + m->ioflag = 1; +#ifdef DEBUG + printf("*"); +#endif + } else if (level==2 && 0xed00 > top) { + m->ioflag = 1; + } + m->location = top; +#ifdef DEBUG + printf("mod "); + printOs9Str(m->name); + printf(" \t: 0x%x - 0x%x\n",top, top + m->size); +#endif + return top; +} + +int +main(int ac, char *av[]) +{ + int vectable = 0; + struct os9module *m = 0, root ; + root.size = 0; + root.mod = 0; + m = &root; + + for(int i = 1 ; i<ac ; i++ ) { + if (*av[i]=='-') { + if (av[i][1] =='2') { // for level 2 + level = 2; + IOBASE = LV2ROMEND; + } else if (av[i][1] =='o') { + outfile = av[i+1]; + i += 1; + } else { + return 1; + } + continue; + } + struct os9module *cur; + cur = readOS9module(av[i]); + m->next = cur; + m = cur; + } + + FILE *romfile; + unsigned pos; + if (outfile==0) return 1; + + romfile=fopen(outfile,"wb"); + if(!romfile) { + fprintf(stderr,"Cannot create file %s\n",av[1]); + exit(1); + } + + + int start = findLocation(root.next,0); + start = start&0xf800; + printf("\n\n"); + + if (level==2) { + for(int i=0; i<0xd00; i++) fputc(0xff,romfile); + pos = 0xed00; + } else { + pos = start; + } + int ofs = 0; + struct os9module *os9p1 = 0; + for(struct os9module *cur = root.next; cur ; cur = cur->next ) { + if ( level==2 && cur->ioflag ==1) continue; + // last module have to os9p1 + if ( cur->next == 0 ) { + os9p1 = cur; + if ( level==1 ) { + if (os9p1->size > 0x07f0) { + ofs = (os9p1->size+0xf)&0xfff0; + ofs -= 0x07f0; + } + for(; pos < 0xf800-ofs ; pos++) { // os9p1 begins at 0xf800 + fputc(0xff,romfile); + } + } else { +#if 0 + int pend = 0x10000-( cur->size +0x80); + for(; pos < pend ; pos++) { // os9p1 ends 0xff7f + fputc(0xff,romfile); + } +#endif + for(; pos < 0xf000 ; pos++) { // level2 os9p1 start from 0xf000 + fputc(0xff,romfile); + } + } + } + printf("mod "); + printOs9Str(cur->name); + cur->location = pos; + fwrite(cur->mod, cur->size, 1, romfile); + printf(" \t: 0x%x - 0x%x size 0x%04x entry 0x%x\n",pos, pos + cur->size-1,cur->size,cur->entry+cur->location); +#ifdef DEBUG + printf(" \t: 0x%x \n",cur->location); + printf(" \t: 0x%x - 0x%x : 0x%lx \n",pos, pos + cur->size, ftell(romfile)+start); +#endif + pos = pos+cur->size; + if (level==1 && cur->ioflag) { + if (level==1) { + for(; pos < IOBASE + IOSIZE; pos++) { + fputc(0xff,romfile); + } + printf("*"); + } + } + } + printf("os9 end %x\n",pos); + if (level==1) { + vectable = 0x10000 - 2*7; + for( ; pos<vectable; pos++) fputc(0xff,romfile); + printf("vectbl %x\n",pos); + if (1) { + int vecofs = search_vector(os9p1); + if (vecofs==0) { + printf("can't find vector\n"); + } + static int perm[] = {0,1,5,4,2,3}; + for(int i=0;i<6;i++) { + fputword(os9p1->location +vecofs+perm[i]*4,romfile); + } + int entry_ofs = (m->mod[9]<<8) + m->mod[10]; + fputword( os9p1->location + entry_ofs ,romfile); + // printf("os9p1 location ofs %0x\n", os9p1->location); + // printf("vector ofs %0x\n", vecofs); + // printf("reset ofs %0x\n", entry_ofs); + } else { + fputword(0xF82d-ofs,romfile); + fputword(0xF831-ofs,romfile); + fputword(0xF835-ofs,romfile); + fputword(0xF839-ofs,romfile); + fputword(0xF83d-ofs,romfile); + fputword(0xF841-ofs,romfile); + fputword(0xF876-ofs,romfile); + } + } else { + char vector[] = "level2/vector"; + FILE *fp = fopen(vector,"rb"); + if (fp==0) { + fprintf(stderr,"cannot read %s\n",vector); + exit(1); + } + for( ; pos<LV2START; pos++) fputc(0xff,romfile); + printf("vectbl %x\n",pos); + for( ; pos<0xfff0; pos++) fputc(fgetc(fp),romfile); +#ifdef DEBUG + printf("os9entry %x\n",os9p1->location); +#endif + printf("os9entry %x\n",os9p1->location+getword(os9p1->mod+9)); + + fputword(os9p1->location+getword(os9p1->mod+9),romfile); // os9p1 entry point + unsigned short vec = os9p1->location+os9p1->size - 18; + fputword(vec,romfile); + fputword(vec+3,romfile); + fputword(vec+6,romfile); + + fputword(vec+9,romfile); + fputword(vec+12,romfile); + fputword(vec+15,romfile); + fputword(LV2START,romfile); + + pos = 0x10000; + int bootsize = 2; + for(struct os9module *cur = root.next; cur ; cur = cur->next ) { + if ( cur->ioflag ==0) continue; + bootsize += cur->size; + } + bootsize += 0x300-2; // to avoid 0x200 bombing + fputc(bootsize>>8,romfile); + fputc(bootsize&0xff,romfile); + pos += 2; + for( int i = 0; i<0x300-2; i++) fputc(0xff,romfile); + for(struct os9module *cur = root.next; cur ; cur = cur->next ) { + if ( cur->ioflag ==0) continue; + cur->location = pos; + printf("mod "); + printOs9Str(cur->name); + fwrite(cur->mod, cur->size, 1, romfile); + printf(" \t: 0x%x - 0x%x size 0x%04x entry 0x%x\n",pos, pos + cur->size-1, cur->size, cur->entry+cur->location); +#ifdef DEBUG + printf(" \t: 0x%x \n",cur->location); + printf(" \t: 0x%x - 0x%x : 0x%lx \n",pos, pos + cur->size, ftell(romfile)+start); +#endif + pos += cur->size; + } + while(pos++ & 0xff) fputc(0xff,romfile); + } + if (level==1) + printf("boot rom from 0x%lx\n",0x10000-ftell(romfile)); + else { + long size; + printf("boot rom from 0xc000 size 0x%lx\n",(size=ftell(romfile))); + if (size > 0x4d00 + 0x2000) { + printf(" was too big. make it less than 0x6d00\n"); + } + } + fclose(romfile); + return 0; +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/os9.h Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,94 @@ +typedef unsigned char u_char; + +typedef struct os9_module_t { + u_char id[2]; + u_char size[2]; + u_char name[2]; + u_char tyla; + u_char atrv; + u_char parity; + union { + u_char data[1]; /* plain modules */ + struct { + u_char exec[2]; + u_char data[1]; + } system; + struct { + u_char exec[2]; + u_char mem[2]; + u_char data[1]; + } program; + struct { + u_char exec[2]; + u_char mem[2]; + u_char mode[1]; + u_char data[1]; + } driver; + struct { + u_char exec[2]; + u_char data[1]; + } file_mgr; + struct { + u_char fmgr[2]; + u_char driver[2]; + u_char mode; + u_char port[3]; + u_char opt; + u_char dtype; + u_char data[1]; + } descriptor; + } data; +} OS9_MODULE_t; + +#define OS9_HEADER_SIZE 9 + +#define TYPE_MASK 0xF0 +typedef enum os9_type_t { + NULL_TYPE = 0, + Prgrm, + Sbtrn, + Multi, + Data, + SSbtrn, + TYPE_6, + TYPE_7, + TYPE_8, + TYPE_9, + TYPE_A, + TYPE_B, + Systm, + FlMgr, + Drivr, + Devic +} OS9_TYPE_t; + +#define LANG_MASK 0x0F +typedef enum os9_lang_t { + NULL_LANG = 0, + Objct, + ICode, + PCode, + CCode, + CblCode, + FrtnCode, + Obj6309, +} OS9_LANG_t; + +#define ATTR_MASK 0xF0 +typedef enum os9_attr_t { + ReEnt = 0x80, + Modprot = 0x40, +} OS9_attr_t; + +#define REVS_MASK 0x0F + +#define OS9_ID0 0x87 +#define OS9_ID1 0xcd + +#define OS9_CRC0 0x80 +#define OS9_CRC1 0x0F +#define OS9_CRC2 0xE3 + +#define INT(foo) (foo[0] * 256 + foo[1]) +int os9_crc(OS9_MODULE_t *mod); +int os9_header(OS9_MODULE_t *mod);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os9/os9mod.c Tue Dec 25 15:57:05 2018 +0900 @@ -0,0 +1,187 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include "os9.h" + + +u_char *os9_string(u_char *string); +void ident(OS9_MODULE_t *mod); +void usage(void); +long pos; + +static char *types[16] = { + "???", "Prog", "Subr", "Multi", "Data", "USR 5", "USR 6", "USR 7", + "USR 8", "USR 9", "USR A", "USR B", "System", "File Manager", + "Device Driver", "Device Descriptor" +}; + +static char *langs[16] = { + "Data", "6809 Obj", "Basic09 I-Code", "Pascal P-Code", "C I-Code", + "Cobol I-Code", "Fortran I-Code", "6309 Obj", "???", "???", "???", + "???", "???", "???", "???", "???" +}; + +int offset = 0; + +int main(int argc, char **argv) +{ + char *filename = NULL; + FILE *fp; + u_char buffer[65536]; /* OS9 Module can't be larger than this */ + OS9_MODULE_t *mod = (OS9_MODULE_t *) buffer; + int i=0, j; + int flag = 0; + + argv++; /* skip my name */ + + if (argc == 1) + usage(); + + while ((argc >= 2) && (*argv[0] == '-')) { + if (*(argv[0] + 1) == 's') { + argc--; + flag = 1; + } else if (*(argv[0] + 1) == 'o') { + argc--; argc--; + argv++; + offset = strtol(argv[0],(char**)0,0); + } else + usage(); + argv++; + } + + + while (argc-- > 1) { + if (*argv==0) return 0; + filename = *(argv++); + + if ((fp = fopen(filename,"rb")) == NULL) { + fprintf(stderr, "Error opening file %s: %s\n", + filename, strerror(errno)); + return 1; + } + + while (!feof(fp)) { + + if (flag) { + int c; + while( !feof(fp) && (c = fgetc(fp)) != 0x87 ); + ungetc(c, fp); + } + + pos = ftell(fp); + if (fread(buffer, OS9_HEADER_SIZE, 1, fp) != 1) { + if (feof(fp)) + break; + else { + fprintf(stderr, "Error reading file %s: %s\n", + filename, strerror(errno)); + return 1; + } + } + + if ((mod->id[0] != OS9_ID0) && (mod->id[1] != OS9_ID1)) { + fprintf(stderr,"Not OS9 module, skipping.\n"); + return 1; + } + + if ((i = os9_header(mod))!=0xff) { + fprintf(stderr, "Bad header parity. Expected 0xFF, got 0x%02X\n", i); + return 1; + } + + i = INT(mod->size) - OS9_HEADER_SIZE; + if ((j = fread(buffer + OS9_HEADER_SIZE, 1, i, fp)) != i) { + fprintf(stderr,"Module short. Expected 0x%04X, got 0x%04X\n", + i + OS9_HEADER_SIZE, j + OS9_HEADER_SIZE); + return 1; + } + ident(mod); + } + fclose(fp); + } + return 0; + +} + +void ident(OS9_MODULE_t *mod) +{ + int i, j; + u_char *name, *ptr, tmp, *buffer = (u_char *) mod; + + i = INT(mod->name); + j = INT(mod->size); + name = os9_string(&buffer[i]); + printf("Offset : 0x%04lx\n", pos + offset); + printf("Header for : %s\n", name); + printf("Module size: $%X #%d\n", j, j); + ptr = &buffer[j - 3]; + printf("Module CRC : $%02X%02X%02X (%s)\n", ptr[0], ptr[1], ptr[2], + os9_crc(mod) ? "Good" : "Bad" ); + printf("Hdr parity : $%02X\n", mod->parity); + + switch ((mod->tyla & TYPE_MASK) >> 4) + { + + case Drivr: + case Prgrm: + i = INT(mod->data.program.exec); + printf("Exec. off : $%04X #%d\n", i, i); + i = INT(mod->data.program.mem); + printf("Data size : $%04X #%d\n", i, i); + break; + + case Devic: + printf("File Mgr : %s\n", + os9_string(&buffer[INT(mod->data.descriptor.fmgr)])); + printf("Driver : %s\n", + os9_string(&buffer[INT(mod->data.descriptor.driver)])); + break; + + case NULL_TYPE: + case TYPE_6: + case TYPE_7: + case TYPE_8: + case TYPE_9: + case TYPE_A: + case TYPE_B: + case Systm: + break; + } + + + + + tmp = buffer[i + strlen((const char *)name)]; + printf("Edition : $%02X #%d\n", tmp, tmp); + printf("Ty/La At/Rv: $%02X $%02x\n", mod->tyla, mod->atrv); + printf("%s mod, ", types[(mod->tyla & TYPE_MASK) >> 4]); + printf("%s, ", langs[mod->tyla & LANG_MASK]); + printf("%s, %s\n", (mod->atrv & ReEnt) ? "re-ent" : "non-share", + (mod->atrv & Modprot) ? "R/W" : "R/O" ); + printf("\n"); +} + +u_char *os9_string(u_char *string) +{ + static u_char cleaned[80]; /* strings shouldn't be longer than this */ + u_char *ptr = cleaned; + int i = 0; + + while (((*(ptr++) = *(string++)) < 0x7f) && + (i++ < sizeof(cleaned) - 1)) + ; + + *(ptr - 1) &= 0x7f; + *ptr = '\0'; + return cleaned; +} +void usage(void) +{ + printf("Usage: os9mod [-s] [-o offset] file [ file ... ]\n"); + printf("Performs an OS-9: 6809 'ident' on the specified files.\n"); + printf(" -s : skip to valid module\n"); + printf(" -o : offset \n\n"); + exit(0); +}
--- a/src/os9/Makefile Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -all: os9mod makerom os9d.rom os9lv2.rom os9v.rom - -CC=clang -CFLAGS = -g - -os9mod : crc.c os9.h os9mod.c os9.h - $(CC) $(CFLAGS) -o os9mod crc.c os9mod.c - -makerom : makerom.c - $(CC) $(CFLAGS) -o makerom makerom.c - -clean : - rm -rf makerom *.rom os9mod *.dSYM - -os9v1.rom : makerom level1/init - ./makerom -o os9v1.rom level1/shell level1/sysgo level1/ioman level1/term level1/pty level1/pdisk level1/d0 level1/d1 level1/vrbf level1/v0 level1/clock level1/scf level1/rbf level1/init level1/os9p2 level1/os9p1 - -os9v2.rom : makerom level2/init - ./makerom -o os9v2.rom -2 level2/Shell level2/dir level2/d1 level2/ioman level2/os9p3_perr level2/os9p4_regdump level2/pipe level2/piper level2/pipeman level2/v0 level2/vrbf level2/scf level2/rbf level2/os9p2 level2/sysgo level2/clock level2/pdisk level2/d0 level2/pty level2/term level2/init level2/boot level2/os9p1 - -level1/init : nitros9-code - cd level1 ; make - -level2/init : nitros9-code - cd level2 ; make - -nitros9-code : - hg clone http://hg.code.sf.net/p/nitros9/code nitros9-code -
--- a/src/os9/crc.c Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#include <stdio.h> - -#include "os9.h" - -int os9_crc(OS9_MODULE_t *mod) -{ - int i; - u_char crc[3] = {0xff, 0xff, 0xff}; - u_char *ptr = (u_char *) mod; - u_char a; - - for (i = 0; i < INT(mod->size); i++) - { - a = *(ptr++); - - a ^= crc[0]; - crc[0] = crc[1]; - crc[1] = crc[2]; - crc[1] ^= (a >> 7); - crc[2] = (a << 1); - crc[1] ^= (a >> 2); - crc[2] ^= (a << 6); - a ^= (a << 1); - a ^= (a << 2); - a ^= (a << 4); - if (a & 0x80) { - crc[0] ^= 0x80; - crc[2] ^= 0x21; - } - } - if ((crc[0] == OS9_CRC0) && - (crc[1] == OS9_CRC1) && - (crc[2] == OS9_CRC2)) - return 1; - - return 0; -} - -int os9_header(OS9_MODULE_t *mod) -{ - u_char tmp = 0x00; - u_char *ptr = (u_char *) mod; - int i; - - for (i = 0; i < OS9_HEADER_SIZE; i++) - tmp ^= *(ptr++); - - return tmp; -}
--- a/src/os9/level1/Makefile Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ - -OS9SRC = ../nitros9-code -SRCDIR = $(OS9SRC)/level1/modules -SRCCMD = $(OS9SRC)/level1/cmds -SRCDIR2 = $(OS9SRC)/level2/modules - -A09 = ../../a09 -I $(OS9SRC)/defs/ - -MOD = pdisk init os9p1 os9p2 ioman pipe piper rbf scf term pty d0 d1 vrbf v0 clock shell dir mdir sysgo shell - -all : ${MOD} - cd cmds; make - -clean : - cd cmds; make clean - rm -f $(MOD) *.lst krn.asm - -LST = -l $@.lst - -# our own module for sbc09 -# CoCoOS9's level1/os9p1.asm has wrong vector value, use our own - -pdisk : - $(A09) pdisk.asm -o pdisk $(LST) - -#boot : boot.asm -# $(A09) boot.asm -o boot $(LST) - -init : init.asm - $(A09) ${SRCDIR}/init.asm -o $@ $(LST) -# $(A09) init.asm -o init $(LST) - -pty : pty.asm - $(A09) pty.asm -o pty $(LST) - -term : pty-dd.asm - $(A09) pty-dd.asm -o term $(LST) - -d0 : d0.asm - $(A09) d0.asm -o d0 $(LST) - -d1 : d1.asm - $(A09) d1.asm -o d1 $(LST) - -clock : clock.asm - $(A09) clock.asm -o clock $(LST) - -vrbf : - $(A09) ../level2/vrbf.asm -o $@ $(LST) - -v0 : - $(A09) v0.asm -o $@ $(LST) - -# os9 level1 moduels - -shell : $(SRCCMD)/shell_21.asm - $(A09) $< -o $@ $(LST) - -mdir : ${SRCCMD}/mdir.asm - $(A09) $< -o $@ $(LST) - -dir : ${SRCCMD}/dir.asm - $(A09) ${SRCCMD}/dir.asm -o dir $(LST) - -os9p1 : - cat ${OS9SRC}//defs/coco.d ${SRCDIR}/kernel/krn.asm > krn.asm - $(A09) -I ../nitros9-code/level1/modules/kernel/ krn.asm -o os9p1 $(LST) - -os9p2 : - $(A09) ${SRCDIR}/kernel/krnp2.asm -o os9p2 $(LST) - -sysgo : - $(A09) sysgo.asm -o sysgo $(LST) - -ioman : - $(A09) ${SRCDIR}/ioman.asm -o ioman $(LST) - -pipe : - $(A09) ${SRCDIR}/pipe.asm -o pipe $(LST) - -piper : - $(A09) ${SRCDIR}/piper.asm -o piper $(LST) - -rbf : - $(A09) ${SRCDIR}/rbf.asm -o rbf $(LST) - -scf : - $(A09) ${SRCDIR}/scf.asm -o scf $(LST) -
--- a/src/os9/level1/clock.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -******************************************************************** -* Clock - OS-9 Level One V2 Clock module -* -* $Id: clock.asm,v 1.1.1.1 2001/02/21 23:30:52 boisy Exp $ -* -* NOTE: This clock is TOTALLY VALID for ALL DATES between 1900-2155 -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 5 Tandy/Microware original version -* 6 Modified to handle leap years properly for BGP 99/05/03 -* 1900 and 2100 A.D. - - nam Clock - ttl OS-9 Level One V2 Clock module - - ifp1 - use defsfile - endc - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set $01 -edition set $06 -TimerPort set $e030 -TkPerSec set 60 -TkPerTS equ TkPerSec/10 ticks per time slice - - - mod eom,name,tylg,atrv,ClkEnt,size - -size equ . - -name fcs /Clock/ - fcb edition - -SysTbl fcb F$Time - fdb FTime-*-2 - fcb $80 - - -ClockIRQ ldx #TimerPort - lda ,x - bita #$10 - bne L00B4 -L00AE jsr [>D.Poll] poll ISRs - bcc L00AE keep polling until carry set - jmp [>D.AltIRQ] jump into an alternate IRQ if available - -L00B4 - ldb #$8f start timer - stb ,x - - dec <D.Tick - bne L007F go around if not zero - ldb <D.Sec get minutes/seconds -* Seconds increment - incb increment seconds - cmpb #60 full minute? - blo L007F - ldb <D.TSec - stb <D.Tick - bsr FTime -L007F stb <D.Sec - - jmp [>D.Clock] - -ClkEnt equ * - ldd #59*256+$01 last second and last tick - std <D.Sec will prompt RTC read at next time slice - ldb #TkPerSec - stb <D.TSec set ticks per second - stb <D.Tick set ticks per second - ldb #TkPerTS get ticks per time slice - stb <D.TSlice set ticks per time slice - stb <D.Slice set first time slice - pshs cc - orcc #FIRQMask+IRQMask mask ints - leax <ClockIRQ,pcr - stx <D.IRQ -* install system calls - leay <SysTbl,pcr - os9 F$SSvc - ldx #TimerPort - ldb #$8f start timer - stb ,x - puls pc,cc - -* F$Time system call code -FTime ldx R$X,u - ldy #TimerPort - ldb #$04 - stb ,y - ldd 1,y - std ,x - std <D.Year - ldd 3,y - std 2,x - std <D.Day - ldd 5,y - std 4,x - std <D.Min - clrb - rts - - emod -eom equ * - end
--- a/src/os9/level1/cmds/Makefile Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -SRC2 = ../../nitros9-code/level2/cmds -SRC1 = ../../nitros9-code/level1/cmds - -OBJ2 = mdir mfree proc - -OBJ1 = asm attr calldbg cmp config copy cputype date debug del deldir devs dir dir_cb dirsort dump echo edit \ - error free help ident irqs link list load login makdir pxd pwd procs prompt shellplus sleep tee touch tsmon unlink game09 - -all : $(OBJ2) $(OBJ1) - -A09 = ../../../a09 - -clean : - rm -rf *.lst $(OBJ2) $(OBJ1) - -game09 : - $(A09) -l $@.lst -o $@ ../../../../game09/$@.asm - -mdir : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -mfree : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -proc : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -procs : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -reboot : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -smap : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm - -asm : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -attr : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -calldbg : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -cmp : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -config : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -copy : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -cputype : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -date : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -debug : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -del : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -deldir : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -devs : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dir : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dir_cb : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dirsort : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -disasm : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dump : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dw.as : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -echo : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -edit : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -error : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -free : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -help : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -ident : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -irqs : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -link : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -list : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -load : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -login : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -makdir : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -pxd : - $(A09) -D PXD -l $@.lst -o $@ $(SRC1)/pd.asm -pwd : - $(A09) -D PWD -l $@.lst -o $@ $(SRC1)/pd.asm -prompt : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -shellplus : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -sleep : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -tee : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -touch : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -tsmon : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -unlink : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm
--- a/src/os9/level1/d0.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -******************************************************************** -* progname - program module -* -* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* - Original Dragon Data distribution version -* -* $Log: d0.asm,v $ -* Revision 1.1 2002/06/14 12:35:43 roug -* Add work done on ideal devices -* -* - - nam D0 - ttl 40-track floppy disk device descriptor - - ifp1 - use defsfile - endc -tylg set Devic+Objct -atrv set ReEnt+rev -rev set $02 - mod eom,name,tylg,atrv,mgrnam,drvnam - fcb $FF mode byte - fcb $00 extended controller address - fdb $E040 physical controller address - fcb initsize-*-1 initilization table size - fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf - fcb $00 drive number - fcb $00 step rate - fcb $20 drive device type - fcb $01 media density:0=single,1=double - fdb $0100 number of cylinders (tracks) - fcb $01 number of sides - fcb $00 verify disk writes:0=on - fdb $0012 # of sectors per track - fdb $0012 # of sectors per track (track 0) - fcb $01 sector interleave factor - fcb $08 minimum size of sector allocation -initsize equ * -name equ * - fcs /D0/ -mgrnam equ * - fcs /RBF/ -drvnam equ * - fcs /PDisk/ - emod -eom equ *
--- a/src/os9/level1/d1.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -******************************************************************** -* progname - program module -* -* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* - Original Dragon Data distribution version -* -* $Log: d0.asm,v $ -* Revision 1.1 2002/06/14 12:35:43 roug -* Add work done on ideal devices -* -* - - nam D1 - ttl 40-track floppy disk device descriptor - - ifp1 - use defsfile - endc -tylg set Devic+Objct -atrv set ReEnt+rev -rev set $02 - mod eom,name,tylg,atrv,mgrnam,drvnam - fcb $FF mode byte - fcb $00 extended controller address - fdb $E040 physical controller address - fcb initsize-*-1 initilization table size - fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf - fcb $01 drive number - fcb $00 step rate - fcb $20 drive device type - fcb $01 media density:0=single,1=double - fdb $0100 number of cylinders (tracks) - fcb $01 number of sides - fcb $00 verify disk writes:0=on - fdb $0012 # of sectors per track - fdb $0012 # of sectors per track (track 0) - fcb $01 sector interleave factor - fcb $08 minimum size of sector allocation -initsize equ * -name equ * - fcs /D1/ -mgrnam equ * - fcs /RBF/ -drvnam equ * - fcs /PDisk/ - emod -eom equ *
--- a/src/os9/level1/init.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -* OS9 standard init modul. - nam Init - ttl os9 system module - - ifp1 - use defsfile - endc -null set $0000 -tylg set Systm+$00 -atrv set ReEnt+rev -rev set $01 - mod eom,initnam,tylg,atrv - fcb 0 - fdb $c000 - fcb $0C - fcb $0C - fdb sysgo - fdb sysdev system device (sysdev) (nitors9 requires this) - fdb systerm - fdb bootst bootstrap module (bootst) -initnam fcs "Init" -sysgo fcs "SysGo" -sysdev fcs "/D0" -systerm fcs "/Term" -bootst fcs "Boot" - emod -eom equ * -
--- a/src/os9/level1/pdisk.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -********************************************* -* Rdisk -* A driver for a Ram disk! -* Modified for os9l1 emulator by Soren Roug 2001 -* - - nam Pdisk - ttl A Device Driver for a RAM Disk - - ifp1 - use defsfile - endc - -*********************** -* Edition History - -* # date Comments -* -- -------- ---------------------------------------------- - -Revision equ 1 -NumDrvs set 2 Number of drives - - org Drvbeg - rmb NumDrvs*DrvMem -RAMSTA equ . - - mod RAMEND,RAMNAM,Drivr+Objct,Reent+Revision,RAMENT,RAMSTA - fcb $FF mode byte - -RAMNAM fcs /Pdisk/ - -RAMENT lbra INIT - lbra READ - lbra WRITE - lbra GETSTA - lbra PUTSTA - lbra TERM - -***************************** -* INIT -* Set up the v09 disk - -INIT ldb #NumDrvs Set no drives to 2 -* Setup drive tables - stb V.NDRV,u save it - lda #$FF - leax DRVBEG,u point to drive table start -L0111 sta DD.TOT+1,x - sta <V.TRAK,x - leax <DRVMEM,x - decb - bne L0111 - clrb -INITXIT rts - -SETUPDT lda <PD.DRV,y Get the drive number - ldu V.PORT,u - sta 1,u drive number - stb 2,u msb of lsn - tfr x,d - sta 3,u - stb 4,u - ldd PD.BUF,y - sta 5,u buffer address - stb 6,u - rts - -***************************** -* READ -* read a sector from disk -* Entry: U = Static Storage -* Y = Path Descriptor -* B = MSB of LSN -* X = LSB's of LSN -* Exit: 256 byte sector in PD.BUF buffer -* -READ bsr SETUPDT - lda #$81 - sta ,u // perform io - ldb ,u // return status - rts - -***************************** -* WRITE -* Write a sector to disk -* Entry: U = Static Storage -* Y = Path Descriptor -* B = MSB of LSN -* X = LSB's of LSN -* PD.Buf = Sector to write -* -WRITE bsr SETUPDT - lda #$55 - sta ,u // perform io - ldb ,u // return status -WRIT99 rts - -************************** -* GETSTA -* get device status -* -GETSTA -Unknown comb - clrb - rts - -************************** -* PUTSTA -* Set device Status -* -PUTSTA -PUTSTA90 clrb - rts - -***************************** -* TERM -* terminate Driver -* -TERM clrb - rts - - emod -RAMEND equ * -
--- a/src/os9/level1/pty-dd.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -**************************************** -* PTY Descriptor module -* -* Source by Soren Roug 2001 -* - ifp1 - use defsfile - endc - - nam P1 - ttl PTY Device Descriptor - - mod PEND,PNAM,DEVIC+OBJCT,REENT+1,PMGR,PDRV - - fcb READ.+WRITE.+SHARE. - fcb $FF IOBlock (unused) - fdb $E000 hardware address - fcb PNAM-*-1 option byte count - fcb $0 SCF device - fcb $0 Case (upper & lower) - fcb $1 Erase on backspace - fcb $0 delete (BSE over line) - fcb $1 echo on - fcb $1 lf on - fcb $0 eol null count - fcb $0 no pause - fcb 24 lines per page - fcb $8 backspace - fcb $18 delete line char - fcb $0D end of record - fcb $1b eof - fcb $04 reprint line char - fcb $01 duplicate last line char - fcb $17 pause char - fcb $03 interrupt char - fcb $05 quit char - fcb $08 backspace echo char - fcb $07 bell - fcb $00 n/a - fcb $00 n/a - fdb pnam offset to name - fdb $0000 offset to status routine -pnam fcs "TERM" -pmgr fcs "SCF" -pdrv fcs "PTY" - emod -pend equ * - end
--- a/src/os9/level1/pty.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -******************************************* -* PTY -* Device Driver for emulated terminal -* Emulates the 6850 UART seen in usim -* Protocol: -* V.port is the control port. -* V.port+1 is the data port. It is bidirectional. -* bit 1: 1=data ready to read/0=no data -* bit 2: 1=ready for output -* - - nam PTY - ttl Pseudo Terminal - - ifp1 - use defsfile - endc - -*********************** -* Edition History -* -* # date Comments -* - -------- ------------------------------- -* 1 16.11.01 Driver first written. SMR - -Revision equ 1 - - org V.SCF -PST equ . - - mod PEND,PNAM,Drivr+Objct,Reent+Revision,PENT,PST - fcb READ.+WRITE. -PNAM fcs /PTY/ - -PENT lbra INIT - lbra READ - lbra WRITE - lbra GETSTA - lbra PUTSTA - lbra TERM - -********************** -* INIT -* Entry: U = Static storage -* Setup the PIA -* -INIT clrb - rts - -********************** -* READ -* Entry: U = Static Storage -* Y = Path Descriptor -* Exit: A = Character read -* -* Read a byte from Port B -* -READ ldx V.PORT,u load port address -readlp ldb ,x - bitb #$01 - bne readbyte - pshs x sleep for a bit if not - ldx #1 - os9 f$sleep - puls x - bra readlp -readbyte lda 1,x read byte - clrb - rts -********************** -* WRITE -* Entry: U = Static storage -* Y = Path Descriptor -* A = Char to write -* -* Write a byte to Port B -* -WRITE ldx V.PORT,u load port address -write1 ldb ,x - bitb #$02 - bne wrt - pshs x - ldx #1 - os9 f$sleep - puls x - bra write1 -wrt sta 1,x write byte -ok clrb - rts - -********************** -* GETSTA -* U = Static Storage -* Y = Path Descriptor -* -GETSTA ldx PD.Rgs,y X=pointer to registers - lda R$B,x A=contents of B reg. - cmpa #SS.Ready check for ready code - bne gsta1 if not, check next - ldx V.Port,u use the PIA to determine - ldb ,x if data is available - bitb #$01 - bne ok - ldb #E$NotRdy - coma sets the carry flag - rts -gsta1 cmpa #SS.EOF check for eof code - beq ok which always returns ok - comb otherwise return - ldb #E$UnkSVC unknown code error - rts - -********************** -* PUTSTA -* Always return error -* -PUTSTA ldx PD.Rgs,y X=register stack - ldb R$B,x B=contents of reg B - comb otherwise return error. - ldb #E$UnkSVC - rts - -********************** -* TERM -* Terminate Driver -* -TERM clrb - rts - - emod -PEND equ * -
--- a/src/os9/level1/sysgo.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,335 +0,0 @@ -******************************************************************** -* SysGo - Kickstart program module -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 5 1998/10/12 Boisy G. Pitre -* Taken from OS-9 L2 Tandy distribution and modified banner for V3. -* -* 5r2 2003/01/08 Boisy G. Pitre -* Fixed fork behavior so that if 'shell startup' fails, system doesn't -* jmp to Crash, but tries AutoEx instead. Also changed /DD back to /H0 -* for certain boot floppy cases. -* -* 2003/09/04 Boisy G. Pitre -* Back-ported to OS-9 Level One. -* -* 5r3 2003/12/14 Boisy G. Pitre -* Added SHIFT key check to prevent startup/autoex from starting if -* held down. Gene Heskett, this Bud's for you. - - nam SysGo - ttl Kickstart program module - - IFP1 - use defsfile - ENDC - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $03 -edition set $05 - - mod eom,name,tylg,atrv,start,size - - - org 0 -InitAddr rmb 2 - rmb 250 -size equ . - -name fcs /SysGo/ - fcb edition - -* Default process priority -DefPrior set 128 - -Banner equ * - fcc /(C) 2014 The NitrOS-9 Project/ -CrRtn fcb C$CR,C$LF - - IFEQ ROM - IFNE NOS9DBG - fcc "** DEVELOPMENT BUILD **" - fcb C$CR,C$LF - fcc "** NOT FOR DISTRIBUTION! **" - fcb C$CR,C$LF - ENDC -* dts - fcb C$CR,C$LF - fcc !http://www.nitros9.org! - fcb C$CR,C$LF - ENDC - - fcb C$LF -BannLen equ *-Banner - - IFEQ ROM -DefDev equ * - fcc "/V0" -* IFNE DD -* fcc "/DD" -* ELSE -* fcc "/H0" -* ENDC - fcb C$CR -HDDev equ * - fcc "/V0" -* IFNE DD -* fcc "/DD/" -* ELSE -* fcc "/H0/" -* ENDC -ExecDir fcc "/V0/CMDS" - fcb C$CR - ENDC - -Shell fcc "Shell" - fcb C$CR -AutoEx fcc "AutoEx" - fcb C$CR -AutoExPr fcc "" - fcb C$CR -AutoExPrL equ *-AutoExPr - - IFEQ ROM -Startup fcc "startup -p" - fcb C$CR -StartupL equ *-Startup - ENDC - -ShellPrm equ * - IFGT Level-1 - fcc "i=/1" - ENDC -CRtn fcb C$CR -ShellPL equ *-ShellPrm - -* Default time packet -DefTime - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 -* dtb - - IFEQ atari+corsham - IFEQ Level-1 -* BASIC reset code (CoCo port only) -* BasicRst fcb $55 -* neg <$0074 -* nop -* clr >PIA0Base+3 -* nop -* nop -* sta >$FFDF turn off ROM mode -* jmp >Bt.Start+2 jump to boot -* BasicRL equ *-BasicRst - ENDC - ENDC - -Init fcs /Init/ - -* Entry: X = pointer to start of nul terminated string -* Exit: D = length of string -strlen pshs x - ldd #-1 -go@ addd #$0001 - tst ,x+ - bne go@ - puls x,pc - -* Display carriage-return/line-feed. -WriteCR pshs y - leax CrRtn,pcr - ldy #$0001 - os9 I$WritLn - puls y,pc - -********************************************************** -* SysGo Entry Point -********************************************************** -start leax >IcptRtn,pcr - os9 F$Icpt -* Set priority of this process - os9 F$ID - ldb #DefPrior - os9 F$SPrior - -* Write OS name and Machine name strings - leax Init,pcr - clra - pshs u - os9 F$Link - bcs SignOn - stx <InitAddr - ldd OSName,u point to OS name in INIT module - leax d,u point to install name in INIT module - bsr strlen - tfr d,y - lda #$01 - os9 I$Write - bsr WriteCR - ldd InstallName,u - leax d,u point to install name in INIT module - bsr strlen - tfr d,y - lda #$01 - os9 I$Write - bsr WriteCR - -* Show rest of banner -SignOn - ldu ,s - leax >Banner,pcr - ldy #BannLen - lda #$01 standard output - os9 I$Write write out banner - -* Set default time and start Clock module - leax >DefTime,pcr - os9 F$STime set time to default - - IFEQ 1 - leax >MDIR,pcr - leau >mdirprm,pcr - ldd #$0100 - ldy #$0003 - os9 F$Fork - bcs mdirend AutoEx failed.. - os9 F$Wait - ldu ,s - bra mdirend -MDIR fcc "mdir" - fcb $0d -mdirprm fcc "-e" - fcb C$CR -mdirend - ldu ,s - ENDC - -* IFEQ ROM -* Change EXEC and DATA dirs - leax >ExecDir,pcr - lda #EXEC. - os9 I$ChgDir change exec. dir - leax >DefDev,pcr -* Made READ. so that no write occurs at boot (Boisy on Feb 5, 2012) - lda #READ. - os9 I$ChgDir change data dir. - bcs L0125 -* leax >HDDev,pcr -* lda #EXEC. -* os9 I$ChgDir change exec. dir to HD -* ENDC - -L0125 equ * - IFEQ atari+corsham - IFEQ Level-1 -* Setup BASIC code (CoCo port only) -* leax >BasicRst,pcr -* ldu #D.CBStrt -* ldb #BasicRL -*CopyLoop lda ,x+ -* sta ,u+ -* decb -* bne CopyLoop - ELSE - os9 F$ID get process ID - lbcs L01A9 fail - leax ,u - os9 F$GPrDsc get process descriptor copy - lbcs L01A9 fail - leay ,u - ldx #$0000 - ldb #$01 - os9 F$MapBlk - bcs L01A9 - -* lda #$55 set flag for Color BASIC -* sta <D.CBStrt,u -* Copy our default I/O ptrs to the system process - ldd <D.SysPrc,u - leau d,u - leau <P$DIO,u - leay <P$DIO,y - ldb #DefIOSiz-1 -L0151 lda b,y - sta b,u - decb - bpl L0151 - ENDC - ENDC -* -* IFEQ ROM -* Fork shell startup here -* IFEQ atari+corsham -* Added 12/14/03: If SHIFT is held down, startup is not run (CoCo only) -* lda #$01 standard output -* ldb #SS.KySns -* os9 I$GetStt -* bcs DoStartup -* bita #SHIFTBIT SHIFT key down? -* bne L0186 Yes, don't to startup or autoex -* ENDC - -*DoStartup leax >Shell,pcr -* leau >Startup,pcr -* ldd #256 -* ldy #StartupL -* os9 F$Fork -* bcs DoAuto Startup failed.. -* os9 F$Wait -* ENDC - -* Fork AutoEx here -*DoAuto leax >AutoEx,pcr -* leau >CRtn,pcr -* ldd #$0100 -* ldy #$0001 -* os9 F$Fork -* bcs L0186 AutoEx failed.. -* os9 F$Wait - -L0186 equ * - ldu ,s -FrkShell leax >ShellPrm,pcr - leay ,u - ldb #ShellPL -L0190 lda ,x+ - sta ,y+ - decb - bne L0190 -* Fork final shell here - leax >Shell,pcr - lda #$01 D = 256 (B already 0 from above) - ldy #ShellPL - IFGT Level-1 - os9 F$Chain Level 2/3. Should not return.. - ldb #$06 it did! Fatal. Load error code - bra Crash - -L01A9 ldb #$04 error code -Crash clr >DPort+$08 turn off disk motor - jmp <D.Crash fatal error - ELSE - os9 F$Fork Level 1. - bcs DeadEnd Fatal. - os9 F$Wait - bcc FrkShell OK, go start shell. -DeadEnd bra DeadEnd - ENDC - -IcptRtn rti - - emod -eom equ * - end
--- a/src/os9/level1/v0.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -******************************************************************** -* progname - program module -* -* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* - Original Dragon Data distribution version -* -* $Log: d0.asm,v $ -* Revision 1.1 2002/06/14 12:35:43 roug -* Add work done on ideal devices -* -* - - nam V0 - ttl 40-track floppy disk device descriptor - - ifp1 - use defsfile - endc -tylg set Devic+Objct -atrv set ReEnt+rev -rev set $02 - mod eom,name,tylg,atrv,mgrnam,drvnam - fcb $FF mode byte - fcb $00 extended controller address - fdb $e040 physical controller address - fcb initsize-*-1 initilization table size - fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf - fcb $00 drive number - fcb $00 step rate - fcb $20 drive device type - fcb $01 media density:0=single,1=double - fdb $0100 number of cylinders (tracks) - fcb $01 number of sides - fcb $00 verify disk writes:0=on - fdb $0012 # of sectors per track - fdb $0012 # of sectors per track (track 0) - fcb $01 sector interleave factor - fcb $08 minimum size of sector allocation -initsize equ * -name equ * - fcs /V0/ -mgrnam equ * - fcs /VRBF/ -drvnam equ * - fcs /PDisk/ - emod -eom equ *
--- a/src/os9/level2/Makefile Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -OS9SRC=../nitros9-code -SRCDIR=$(OS9SRC)/level2/modules -SRCCMD=$(OS9SRC)/level1/cmds -SRCCMD2=$(OS9SRC)/level2/cmds - -A09 = ../../a09 -I $(OS9SRC)/defs/ - -ALL = ioman pdisk init os9p1 os9p2 os9p3_perr os9p4_regdump pipe pipeman pipeman_named piper rbf scf term pty d0 d1 clock vector boot shell dir mdir sysgo v0 vrbf - -all : $(ALL) - cd cmds ; make - -clean : - cd cmds ; make clean - rm -rf $(ALL) *.lst *.dSYM - -LST = -l $@.lst -pdisk : - $(A09) pdisk.asm -o pdisk $(LST) $(LST) - -boot : boot.asm - $(A09) boot.asm -o boot $(LST) - -sysgo : sysgo.asm - $(A09) sysgo.asm -o sysgo $(LST) - -init : init.asm - $(A09) init.asm -o $@ $(LST) - -vector : vector.asm - $(A09) vector.asm -o vector $(LST) - -term : pty-dd.asm - $(A09) pty-dd.asm -o term $(LST) - -d0 : d0.asm - $(A09) d0.asm -o d0 $(LST) - -d1 : d1.asm - $(A09) d1.asm -o d1 $(LST) - -v0 : v0.asm - $(A09) $@.asm -o $@ $(LST) - -clock : - $(A09) clock.asm -o clock $(LST) - -pty : - $(A09) ../level1/pty.asm -o pty $(LST) - -shell : - $(A09) ${SRCCMD}/shell_21.asm -o shell $(LST) - -mdir : - $(A09) ${SRCCMD2}/mdir.asm -o mdir $(LST) - -dir : - $(A09) ${SRCCMD}/dir.asm -o dir $(LST) - -os9p1 : - $(A09) -I $(OS9SRC)/level1/modules/kernel/ ${SRCDIR}/kernel/krn.asm -o os9p1 $(LST) - -os9p2 : - $(A09) ${SRCDIR}/kernel/krnp2.asm -o os9p2 $(LST) - -os9p3_perr : - $(A09) ${SRCDIR}/krnp3_perr.asm -o os9p3_perr $(LST) - -os9p4_regdump : - $(A09) ${SRCDIR}/krnp4_regdump.asm -o os9p4_regdump $(LST) - -ioman : - $(A09) ${SRCDIR}/ioman.asm -o ioman $(LST) - -pipe : - $(A09) $(OS9SRC)/level1/modules/pipe.asm -o $@ $(LST) - -pipeman : - $(A09) $(OS9SRC)/level1/modules/pipeman.asm -o $@ $(LST) - -pipeman_named : - $(A09) ${SRCDIR}/pipeman_named.asm -o pipeman_named $(LST) - -piper : - $(A09) $(OS9SRC)/level1/modules/piper.asm -o $@ $(LST) - -rbf : - $(A09) ${SRCDIR}/rbf.asm -o rbf $(LST) - -vrbf : vrbf.asm - $(A09) vrbf.asm -o vrbf $(LST) - -scf : - $(A09) $(OS9SRC)/level1/modules/scf.asm -o $@ $(LST) -
--- a/src/os9/level2/boot.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -******************************************************************** -* Boot - V09 Boot module -* -* $Id: boot_1773.asm,v 1.1.1.1 2001/02/21 23:30:54 boisy Exp $ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ - - nam Boot - ttl v09 Boot module - - ifp1 - use defsfile - endc - -* -* map extended rom on page 0x40- -* first two bytes are extra rom module size - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set $01 -edition set 1 - - mod eom,name,tylg,atrv,start,size - -size equ . - -name fcs /Boot/ - fcb edition - -start - lbra entry - lbra btdebug -entry - ldy #$40 extended rom page no. - clra - clrb - pshs d,x,y,u - tfr d,x - leay 4,s pointer to page no - ** read boot rom file size - os9 F$LDDDXY - bcs last - addb #$ff - adca #0 - clrb - std ,s size return as d - ** OS9 lv2 use $a000-$dfff as a temporary page - ** demand at least that size ( ROM start at $ed00 ) - cmpa #$ed-$a0 - bhi ok - lda #$ed-$a0 -ok - os9 F$BtMem - bcs last - ** u points the memory - stu 2,s return as x - ldd ,s - std 6,s - ldx #0 - ** copy to Bt BtRAM -pagel ldd #$2000 - cmpd 6,s - blo lo - ldd 6,s -lo tfr d,y - lda 5,s - sta $ffa0 - tfr y,d -loop ldy ,x++ - sty ,u++ - subd #2 - bne loop - clr $ffa0 back to system map - ldd 6,s - subd #$2000 - bmi last all transfered - std 6,s - ** 2k boundary - inc 5,s - ldx #0 - bra pagel -last clr $ffa0 - puls d,x,y,u,pc - - ** put lbsr btdebug on <$5e -btdebug anda #$7f - sta $ff81 - rts - - emod -eom equ * - end
--- a/src/os9/level2/clock.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -******************************************************************** -* Clock - OS-9 Level One V2 Clock module -* -* $Id: clock.asm,v 1.1.1.1 2001/02/21 23:30:52 boisy Exp $ -* -* NOTE: This clock is TOTALLY VALID for ALL DATES between 1900-2155 -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 5 Tandy/Microware original version -* 6 Modified to handle leap years properly for BGP 99/05/03 -* 1900 and 2100 A.D. - - nam Clock - ttl OS-9 Level One V2 Clock module - - ifp1 - use defsfile - endc - -usefirq equ 0 - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set $01 -edition set $06 -TimerPort set $ffb0 - - mod eom,name,tylg,atrv,ClkEnt,size - -size equ . - -name fcs /Clock/ - fcb edition - -SysTbl fcb F$Time - fdb FTime-*-2 - fcb F$STime - fdb FSTime-*-2 - fcb $80 - - - ifeq usefirq-1 -ClockFIRQ - leas -1,s - pshs d,dp,x,y - lda 8,s - ora #$80 Entire flag - pshs a - stu 8,s - jmp [$FFF8] - endc -ClockIRQ - ldx #TimerPort - lda ,x - bita #$10 - beq L00AE -L00AE leax ClockIRQ1,pcr - stx <D.SvcIRQ - jmp [D.XIRQ] Chain through Kernel to continue IRQ handling -ClockIRQ1 - inc <D.Sec go up one second - lda <D.Sec grab current second - cmpa #60 End of minute? - blo VIRQend No, skip time update and alarm check - clr <D.Sec Reset second count to zero -VIRQend - ldx #TimerPort - lda #$8f - sta >TimerPort - jmp [>D.Clock] - -TkPerTS equ 2 - -ClkEnt equ * - pshs cc - orcc #FIRQMask+IRQMask mask ints - leax >ClockIRQ,pcr - stx <D.IRQ - ifeq usefirq-1 - leax >ClockFIRQ,pcr - stx $FFF6 must be a RAM - endc -* install system calls - leay >SysTbl,pcr - os9 F$SSvc - ldd #59*256+TkPerTS last second and time slice in minute - std <D.Sec Will prompt RTC read at next time slice - stb <D.TSlice set ticks per time slice - stb <D.Slice set first time slice - lda #TkPerSec Reset to start of second - sta <D.Tick - - ldx #TimerPort - ldb #$8f start timer - stb ,x - puls pc,cc - -* F$Time system call code -FTime ldx #TimerPort - ldb #$04 - stb ,x - leax 1,x Address of system time packet -RetTime ldy <D.Proc Get pointer to current proc descriptor - ldb P$Task,y Process Task number - lda <D.SysTsk From System Task - ldu R$X,u -STime.Mv ldy #6 Move 6 bytes -FMove os9 F$Move - rts - -FSTime clrb - rts - - emod -eom equ * - end
--- a/src/os9/level2/cmds/Makefile Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -SRC2 = ../../nitros9-code/level2/cmds -SRC1 = ../../nitros9-code/level1/cmds - -OBJ2 = mdir mfree proc procs reboot dmem pmap smap mmap - -OBJ1 = asm attr calldbg cmp config copy cputype date debug del deldir devs dir dir_cb dirsort dump echo edit \ - error free help ident irqs link list load login makdir pxd pwd procs prompt shellplus sleep tee touch tsmon unlink \ - game09 sbc09 kernel09.s basic.s - - -all : $(OBJ2) $(OBJ1) - -A09 = ../../../a09 - -clean : - rm -rf *.lst $(OBJ2) $(OBJ1) - -game09 : - $(A09) -l $@.lst -o $@ ../../../../game09/$@.asm - -sbc09 : - $(A09) -l $@.lst -o $@ $@.asm - -# sbc09 cmds/kernel09.s -kernel09.s : ../../../../examples_forth/kernel09 - cp ../../../../examples_forth/kernel09 kernel09.s - -# sbc09 cmds/basic.s -basic.asm : ../../../../basic/basic.asm - perl fixbasic.pl ../../../../basic/basic.asm > basic.asm - -basic.s : basic.asm - $(A09) -l $@.lst -s $@ basic.asm - -mdir : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -mfree : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -proc : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -procs : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -reboot : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -smap : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -mmap : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -pmap : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm -dmem : - $(A09) -l $@.lst -o $@ $(SRC2)/$@.asm - -asm : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -attr : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -calldbg : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -cmp : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -config : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -copy : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -cputype : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -date : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -debug : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -del : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -deldir : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -devs : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dir : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dir_cb : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dirsort : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -disasm : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dump : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -dw.as : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -echo : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -edit : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -error : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -free : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -help : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -ident : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -irqs : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -link : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -list : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -load : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -login : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -makdir : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -pxd : - $(A09) -D PXD -l $@.lst -o $@ $(SRC1)/pd.asm -pwd : - $(A09) -D PWD -l $@.lst -o $@ $(SRC1)/pd.asm -prompt : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -shellplus : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -sleep : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -tee : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -touch : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -tsmon : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm -unlink : - $(A09) -l $@.lst -o $@ $(SRC1)/$@.asm
--- a/src/os9/level2/cmds/defsfile Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -* Main defsfile for OS-9 Level One V1 -* - use ../defsfile
--- a/src/os9/level2/cmds/fixbasic.pl Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#!/usr/bin/perl -# - -while(<>) { - next if (/^ACIA/ .. /^TDRE/) ; - next if (/^TSTBRK/ .. /^ END/) ; - if (/^CLEAR/) { -print <<"EOFEOF" - JSR \$24 ;; echo off (but it is not suuported on pty.asm ) -EOFEOF - } - if (/^GL02/) { - print "GL02\n"; # do not echo input - next; - } - print; -} - - -print <<"EOFEOF" -****************************** -****************************** -TSTBRK bsr BRKEEE - bcc GETC05 -GETCHR bsr INEEE - CMPA \#ETX ; 3 - BNE GETC05 - JMP BREAK -INTEEE -GETC05 RTS -PUTCHR INC ZONE - JMP OUTEEE -****************************** -****************************** -INEEE PSHS D - JSR 0 - STB ,S - PULS D,PC -OUTEEE PSHS D - TFR A,B - JSR 3 - PULS D,PC -BRKEEE PSHS D - JSR \$F - PULS D,PC -****************************** -****************************** - END -EOFEOF
--- a/src/os9/level2/cmds/loop.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -******************************************************************** -* loop dummy loader -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1 2018/07/30 S. Kono - - nam Loop - ttl Dummy loop - - ifp1 - use defsfile - endc - -* Module header definitions -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $00 -edition set 1 - - mod eom,name,tylg,atrv,start,size - - org 0 -count rmb 2 -size equ . - -name fcs /Loop/ - fcb edition - -start ldy #4000 -l1 ldx #0 -l0 leax -1,x - bne l0 - leay -1,y - bne l1 -Exit clrb - os9 F$Exit - - - emod -eom equ * - end
--- a/src/os9/level2/cmds/sbc09.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -******************************************************************** -* sbc09 emulator -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1 2018/08/20 S. Kono -* Emulatoe sbc09 on os9 lv2 - - nam Sbc09 - ttl Sbc09 emulator - - ifp1 - use defsfile - endc - -* Module header definitions -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $00 -edition set 1 - - mod eom,name,tylg,atrv,start,size - - org 0 -ioentry rmb $80 -filepath rmb 2 -parmptr rmb 2 -stdin rmb 1 -chksum rmb 1 -bcount rmb 1 -adr rmb 2 -work rmb 2 -readbuff rmb $100 - org $400 -emstart rmb $e000-. -size equ . - -name fcs /Sbc09/ - fcb edition - -start - clr <stdin - stx <parmptr save parameter pointer - stu <work save parameter pointer - lda #READ. read access mode - os9 I$Open open file - bcs L0049 branch if error - sta <filepath else save path to file - stx <parmptr and updated parm pointer -L001F lda <filepath get path - leax readbuff,u point X to read buffer - ldy #200 read up to 200 bytes - os9 I$ReadLn read it! - bcs L0035 branch if error - bsr srecords - bra L001F else exit -L0035 cmpb #E$EOF did we get an EOF error? -* bne L0049 exit if not - lda <filepath else get path - os9 I$Close and close it - bcs L0049 branch if error -* ldx <parmptr get param pointer -* lda ,x get char -* cmpa #C$CR end of command line? -* bne start branch if not - -copytbl - lda #$17 lbra - sta $e400 - leax Exit,pcr - leax -$e403,x - stx $e401 - leax iotbl,pcr - leay iotblend,pcr - pshs x,y - ldy #(iotblend-iotbl) -l1 ldb #$7e * JMP - stb ,u+ - ldd ,x++ - addb 1,s - adca ,s - std ,u++ - cmpx 2,s - ble l1 - puls x,y - jmp $400 - -Exit clrb - os9 F$Exit - -iotbl - fdb getchar-iotbl ; 0 - fdb putchar-iotbl ; 3 - fdb getline-iotbl ; 6 - fdb putline-iotbl ; 9 - fdb putcr-iotbl ; $C - fdb getpoll-iotbl ; $F - fdb xopenin-iotbl ; $12 - fdb xopenout-iotbl ; $15 - fdb xabortin-iotbl ; $18 - fdb xclosein-iotbl ; $1B - fdb xcloseout-iotbl ; $21 - fdb delay-iotbl ; $24 - fdb noecho-iotbl ; $27 -iotblend - -L0049 -err ldb #1 - bra Exit - -srecords - leax readbuff,u - clr <chksum -sline lda ,x+ - cmpa #'S' - bne slast - lda ,x+ - cmpa #'1' - bne slast - bsr gthex2 - subb #3 - stb <bcount - bsr gthex2 - stb <adr - bsr gthex2 - stb <adr+1 - lda <bcount - ldy <adr -sbyte bsr gthex2 - stb ,y+ - deca - bgt sbyte -slast - bsr gthex2 - lda <chksum - cmpa #$ff - bne err1 -err1 - rts - -gthex4 pshs d - bsr gthex2 - stb ,s - bsr gthex2 - stb 1,s - puls d,pc - -gthex2 pshs b - bsr gthex1 - aslb - aslb - aslb - aslb - stb ,s - bsr gthex1 - addb ,s - stb ,s - addb <chksum - stb <chksum - puls b,pc - -gthex1 ldb ,x+ - subb #'0' - blo rgethex1 - cmpb #9 - bls rgethex1 - subb #7 -rgethex1 - rts - -putchar * Output one character in B register. - PSHS X,Y - BRA OUTCH1 -getchar * Input one character into B register. - PSHS A,B,X,Y -GETCH0 - LDA #0 - LEAX 1,S - LDY #1 - OS9 I$Read - BCS GETCH0 - PULS A,B,X,Y,PC -putcr * Output a newline. - LDB #C$CR - bsr putchar - LDB #C$LF - PSHS X,Y -OUTCH1 PSHS A,B - LEAX 1,S - LDA #1 - LDY #1 - OS9 I$Write - PULS A,B,X,Y,PC -getpoll - PSHS X,Y,D - LDA #0 - LDB #SS.Ready - OS9 I$GetStt - CMPB #$F6 Not Ready - BNE RSENSE - CLRB - PULS X,Y,D,PC -RSENSE - ORCC #1 set carry to indicate ready -RNSENSE - PULS X,Y,D,PC - -getline * Input line at address in X, length in B. - PSHS A,B,X,Y -GETLN0 - CLRA - TFR D,Y - LDA <stdin - OS9 I$ReadLn - BCS GETLN0 - LEAY -1,Y - TFR Y,D -* LDA D,X -* CMPA #C$CR -* BNE GETLN1 -* LEAY -1,Y -GETLN1 STY ,S - PULS A,B,X,Y,PC -putline * Output string at address in X, length in B. - PSHS A,B,X,Y - CLRA - TFR D,Y - LDA <stdin - OS9 I$WritLn - PULS A,B,X,Y,PC -xopenin -xopenout -xabortin -xclosein -xcloseout - RTS - -noecho LDA <stdin - CLRB - LDX <work - leax readbuff,X - OS9 I$GetStt - bcs err2 - CLR IT.EKO,X - CLRB - OS9 I$SetStt -err2 - RTS - -delay PSHS D,X * address **$21** - * On input the D register contains the number of timer - * ticks to wait. Each timer tick is 20ms - TFR D,X - OS9 F$Sleep - PULS D,X,PC - - - - emod -eom equ * - end
--- a/src/os9/level2/d0.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -******************************************************************** -* progname - program module -* -* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* - Original Dragon Data distribution version -* -* $Log: d0.asm,v $ -* Revision 1.1 2002/06/14 12:35:43 roug -* Add work done on ideal devices -* -* - - nam D0 - ttl 40-track floppy disk device descriptor - - ifp1 - use defsfile - endc -tylg set Devic+Objct -atrv set ReEnt+rev -rev set $02 - mod eom,name,tylg,atrv,mgrnam,drvnam - fcb $FF mode byte - fcb $00 extended controller address - fdb $ffc0 physical controller address - fcb initsize-*-1 initilization table size - fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf - fcb $00 drive number - fcb $00 step rate - fcb $20 drive device type - fcb $01 media density:0=single,1=double - fdb $0100 number of cylinders (tracks) - fcb $01 number of sides - fcb $00 verify disk writes:0=on - fdb $0012 # of sectors per track - fdb $0012 # of sectors per track (track 0) - fcb $01 sector interleave factor - fcb $08 minimum size of sector allocation -initsize equ * -name equ * - fcs /D0/ -mgrnam equ * - fcs /RBF/ -drvnam equ * - fcs /PDisk/ - emod -eom equ *
--- a/src/os9/level2/d1.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -******************************************************************** -* progname - program module -* -* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* - Original Dragon Data distribution version -* -* $Log: d0.asm,v $ -* Revision 1.1 2002/06/14 12:35:43 roug -* Add work done on ideal devices -* -* - - nam D1 - ttl 40-track floppy disk device descriptor - - ifp1 - use defsfile - endc -tylg set Devic+Objct -atrv set ReEnt+rev -rev set $02 - mod eom,name,tylg,atrv,mgrnam,drvnam - fcb $FF mode byte - fcb $00 extended controller address - fdb $ffc0 physical controller address - fcb initsize-*-1 initilization table size - fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf - fcb $01 drive number - fcb $00 step rate - fcb $20 drive device type - fcb $01 media density:0=single,1=double - fdb $0100 number of cylinders (tracks) - fcb $01 number of sides - fcb $00 verify disk writes:0=on - fdb $0012 # of sectors per track - fdb $0012 # of sectors per track (track 0) - fcb $01 sector interleave factor - fcb $08 minimum size of sector allocation -initsize equ * -name equ * - fcs /D1/ -mgrnam equ * - fcs /RBF/ -drvnam equ * - fcs /PDisk/ - emod -eom equ *
--- a/src/os9/level2/defsfile Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -* Main defsfile for OS-9 Level One V2 -* -* -* OS-9 Level and Version equates -Level equ 2 -OS9Vrsn equ 1 -OS9Major equ 0 -OS9Minor equ 1 -NOS9VER equ OS9Vrsn -NOS9MAJ equ OS9Major -NOS9MIN equ OS9Minor - - use ../../nitros9-code/defs/coco.d - use ../../nitros9-code/defs/os9.d - use ../../nitros9-code/defs/scf.d - use ../../nitros9-code/defs/rbf.d -
--- a/src/os9/level2/init.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -******************************************************************** -* Init - NitrOS-9 Configuration module -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 204 1998/10/12 Boisy G. Pitre -* Original OS-9 L2 Tandy distribution. -* -* 205 1998/10/20 Boisy G. Pitre -* Added CC3IO and Clock sections. -* -* 205r2 1998/10/20 Boisy G. Pitre -* Removed clock information from here. -* -* 1 2003/01/08 Boisy G. Pitre -* Restarted edition number back to 1, removed CMDS/cc3go reference and -* just have cc3go so that in certain cases, cc3go can be in the bootfile, -* and so that ROMmed systems don't have to have a special init module. -* -* 2003/11/05 Robert Gault -* Corrected CC3IO info regards mouse. Changed from fcb to fdb low res/ right -* Corrected OS9Defs to match. -* -* 2006/07/06 P.Harvey-Smith. -* Conditionally excluded port messages on Dragon Alpha, due to insufficient -* space ! -* - - nam Init - ttl NitrOS-9 Configuration module - - ifp1 - use defsfile - IFGT Level-1 - use cocovtio.d - ENDC - endc - -tylg set Systm+$00 -atrv set ReEnt+rev -rev set $00 -edition set 1 - -* -* Usually, the last two words here would be the module entry -* address and the dynamic data size requirement. Neither value is -* needed for this module so they are pressed into service to show -* MaxMem and PollCnt. For example: -* $0FE0,$0015 means -* MaxMem = $0FE000 -* PollCnt = $0015 -* - mod eom,name,tylg,atrv,$0FE0,$0015 - -***** USER MODIFIABLE DEFINITIONS HERE ***** - -* -* refer to -* "Configuration Module Entry Offsets" -* in os9.d -* -start equ * - fcb $27 entries in device table - fdb DefProg offset to program to fork - fdb DefDev offset to default disk device - fdb DefCons offset to default console device - fdb DefBoot offset to boot module name - fcb $01 write protect flag (?) - fcb Level OS level - fcb NOS9VER OS version - fcb NOS9MAJ OS major revision - fcb NOS9MIN OS minor revision - IFNE H6309 - fcb Proc6309+CRCOff feature byte #1 - ELSE - fcb CRCOff feature byte #1 - ENDC - fcb $00 feature byte #2 - fdb OSStr - fdb InstStr - fcb 0,0,0,0 reserved - - IFGT Level-1 -* CC3IO section - fcb Monitor monitor type - fcb 0,1 mouse info, low res right mouse - fcb $1E key repeat start constant - fcb $03 key repeat delay constant - ENDC - -name fcs "Init" - fcb edition - -DefProg fcs "SysGo" -DefDev fcs "/V0" -DefCons fcs "/Term" -DefBoot fcs "Boot" - -* -* The DragonAlpha is so pushed for boot track space, that we have to exclude these -* messages ! -* - - IFEQ dalpha -OSStr equ * - fcc "NitrOS-9/" - IFNE H6309 - fcc /6309 / - ELSE - fcc /6809 / - ENDC - fcc /Level / - fcb '0+Level - fcc / V/ - fcb '0+NOS9VER - fcc /./ - fcb '0+NOS9MAJ - fcc /./ - fcb '0+NOS9MIN - fcb 0 - -InstStr equ * - IFNE coco1 - fcc "Radio Shack Color Computer" - ELSE - IFNE deluxe - fcc "Deluxe Color Computer" - ELSE - IFNE coco2 - fcc "Radio Shack Color Computer 2" - ELSE - IFNE coco2b - fcc "Tandy Color Computer 2" - ELSE - IFNE coco3 - fcc "Tandy Color Computer 3" - ELSE - IFNE tano - fcc "Tano Dragon (US)" - ELSE - IFNE d64 - fcc "Dragon 64 (UK)" - ELSE - IFNE dalpha - fcc "Dragon Alpha" - ELSE - IFNE atari - fcc "Atari XL/XE" - ELSE - IFNE mc09 - fcb $1B text in bright blue - fcc "[94mMulticomp09" - fcb $1B - fcc "[0m" - ELSE - IFNE coco3fpga - fcc "Gary Becker's Coco3FPGA" - ELSE - IFNE corsham - fcc "Corsham 6809" - ELSE - fcc "Unknown Machine" - ENDC match IFNE corsham - ENDC match IFNE coco3fpga - ENDC match IFNE mc09 - ENDC match IFNE atari - ENDC match IFNE dalpha - ENDC match IFNE d64 - ENDC match IFNE tano - ENDC match IFNE coco3 - ENDC match IFNE coco2b - ENDC match IFNE coco2 - ENDC match IFNE delux - ENDC match IFNE coco1 - fcb 0 null-terminate the name string - ELSE -* DragonAlpha -OSStr equ * -InstStr equ * - fcb 0 null-length string - ENDC match IFEQ dalpha - - emod -eom equ * - end
--- a/src/os9/level2/pdisk.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -********************************************* -* Rdisk -* A driver for a Ram disk! -* Modified for os9l1 emulator by Soren Roug 2001 -* - - nam Pdisk - ttl A Device Driver for a RAM Disk - - ifp1 - use defsfile - endc - -*********************** -* Edition History - -* # date Comments -* -- -------- ---------------------------------------------- - -Revision equ 1 -NumDrvs set 2 Number of drives - - org Drvbeg - rmb NumDrvs*DrvMem -RAMSTA equ . - - mod RAMEND,RAMNAM,Drivr+Objct,Reent+Revision,RAMENT,RAMSTA - fcb $FF mode byte - -RAMNAM fcs /PDisk/ - -RAMENT lbra INIT - lbra READ - lbra WRITE - lbra GETSTA - lbra PUTSTA - lbra TERM - -***************************** -* INIT -* Set up the v09 disk - -INIT ldb #NumDrvs Set no drives to 2 -* Setup drive tables - stb V.NDRV,u save it - lda #$FF - leax DRVBEG,u point to drive table start -L0111 sta DD.TOT+1,x - sta <V.TRAK,x - leax <DRVMEM,x - decb - bne L0111 - clrb -INITXIT rts - -SETUPDT lda <PD.DRV,y Get the drive number - ldu V.PORT,u - sta 1,u drive number - stb 2,u msb of lsn - tfr x,d - sta 3,u - stb 4,u - ldd PD.BUF,y - sta 5,u buffer address - stb 6,u - rts - -***************************** -* READ -* read a sector from disk -* Entry: U = Static Storage -* Y = Path Descriptor -* B = MSB of LSN -* X = LSB's of LSN -* Exit: 256 byte sector in PD.BUF buffer -* -READ bsr SETUPDT - lda #$81 - sta ,u // perform io - ldb ,u // return status - rts - -***************************** -* WRITE -* Write a sector to disk -* Entry: U = Static Storage -* Y = Path Descriptor -* B = MSB of LSN -* X = LSB's of LSN -* PD.Buf = Sector to write -* -WRITE bsr SETUPDT - lda #$55 - sta ,u // perform io - ldb ,u // return status -WRIT99 rts - -************************** -* GETSTA -* get device status -* -GETSTA -Unknown comb - clrb - rts - -************************** -* PUTSTA -* Set device Status -* -PUTSTA -PUTSTA90 clrb - rts - -***************************** -* TERM -* terminate Driver -* -TERM clrb - rts - - emod -RAMEND equ * -
--- a/src/os9/level2/pty-dd.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -**************************************** -* PTY Descriptor module -* -* Source by Soren Roug 2001 -* - ifp1 - use defsfile - endc - - nam P1 - ttl PTY Device Descriptor - - mod PEND,PNAM,DEVIC+OBJCT,REENT+1,PMGR,PDRV - - fcb READ.+WRITE.+SHARE. - fcb $FF IOBlock (unused) - fdb $ff80 hardware address - fcb PNAM-*-1 option byte count - fcb $0 SCF device - fcb $0 Case (upper & lower) - fcb $1 Erase on backspace - fcb $0 delete (BSE over line) - fcb $1 echo on - fcb $1 lf on - fcb $0 eol null count - fcb $0 no pause - fcb 24 lines per page - fcb $8 backspace - fcb $18 delete line char - fcb $0D end of record - fcb $1b eof - fcb $04 reprint line char - fcb $01 duplicate last line char - fcb $17 pause char - fcb $03 interrupt char - fcb $05 quit char - fcb $08 backspace echo char - fcb $07 bell - fcb $00 n/a - fcb $00 n/a - fdb pnam offset to name - fdb $0000 offset to status routine -pnam fcs "TERM" -pmgr fcs "SCF" -pdrv fcs "PTY" - emod -pend equ * - end
--- a/src/os9/level2/sysgo.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,333 +0,0 @@ -******************************************************************** -* SysGo - Kickstart program module -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 5 1998/10/12 Boisy G. Pitre -* Taken from OS-9 L2 Tandy distribution and modified banner for V3. -* -* 5r2 2003/01/08 Boisy G. Pitre -* Fixed fork behavior so that if 'shell startup' fails, system doesn't -* jmp to Crash, but tries AutoEx instead. Also changed /DD back to /H0 -* for certain boot floppy cases. -* -* 2003/09/04 Boisy G. Pitre -* Back-ported to OS-9 Level One. -* -* 5r3 2003/12/14 Boisy G. Pitre -* Added SHIFT key check to prevent startup/autoex from starting if -* held down. Gene Heskett, this Bud's for you. - - nam SysGo - ttl Kickstart program module - - IFP1 - use defsfile - ENDC - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $03 -edition set $05 - - mod eom,name,tylg,atrv,start,size - - - org 0 -InitAddr rmb 2 - rmb 250 -size equ . - -name fcs /SysGo/ - fcb edition - -* Default process priority -DefPrior set 128 - -Banner equ * - fcc /(C) 2014 The NitrOS-9 Project/ -CrRtn fcb C$CR,C$LF - - IFEQ ROM - IFNE NOS9DBG - fcc "** DEVELOPMENT BUILD **" - fcb C$CR,C$LF - fcc "** NOT FOR DISTRIBUTION! **" - fcb C$CR,C$LF - ENDC -* dts - fcb C$CR,C$LF - fcc !http://www.nitros9.org! - fcb C$CR,C$LF - ENDC - - fcb C$LF -BannLen equ *-Banner - - IFEQ ROM -DefDev equ * - fcc "/V0" -* IFNE DD -* fcc "/DD" -* ELSE -* fcc "/H0" -* ENDC - fcb C$CR -HDDev equ * - fcc "/V0" - fcb C$CR -* IFNE DD -* fcc "/DD/" -* ELSE -* fcc "/H0/" -* ENDC -ExecDir fcc "/V0/cmds" - fcb C$CR - ENDC - -Shell fcc "Shell" - fcb C$CR -AutoEx fcc "AutoEx" - fcb C$CR -AutoExPr fcc "" - fcb C$CR -AutoExPrL equ *-AutoExPr - - IFEQ ROM -Startup fcc "startup -p" - fcb C$CR -StartupL equ *-Startup - ENDC - -ShellPrm equ * - IFGT Level-1 - fcc "i=/1" - ENDC -CRtn fcb C$CR -ShellPL equ *-ShellPrm - -mdirprm fcc "-e" - fcb C$CR - -* Default time packet -DefTime - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 - fcb 0 -* dtb - - IFEQ atari+corsham - IFEQ Level-1 -* BASIC reset code (CoCo port only) -* BasicRst fcb $55 -* neg <$0074 -* nop -* clr >PIA0Base+3 -* nop -* nop -* sta >$FFDF turn off ROM mode -* jmp >Bt.Start+2 jump to boot -* BasicRL equ *-BasicRst - ENDC - ENDC - -Init fcs /Init/ - -* Entry: X = pointer to start of nul terminated string -* Exit: D = length of string -strlen pshs x - ldd #-1 -go@ addd #$0001 - tst ,x+ - bne go@ - puls x,pc - -* Display carriage-return/line-feed. -WriteCR pshs y - leax CrRtn,pcr - ldy #$0001 - os9 I$WritLn - puls y,pc - -********************************************************** -* SysGo Entry Point -********************************************************** -start leax >IcptRtn,pcr - os9 F$Icpt -* Set priority of this process - os9 F$ID - ldb #DefPrior - os9 F$SPrior - -* Write OS name and Machine name strings - leax Init,pcr - clra - pshs u - os9 F$Link - bcs SignOn - stx <InitAddr - ldd OSName,u point to OS name in INIT module - leax d,u point to install name in INIT module - bsr strlen - tfr d,y - lda #$01 - os9 I$Write - bsr WriteCR - ldd InstallName,u - leax d,u point to install name in INIT module - bsr strlen - tfr d,y - lda #$01 - os9 I$Write - bsr WriteCR - -* Show rest of banner -SignOn - puls u - leax >Banner,pcr - ldy #BannLen - lda #$01 standard output - os9 I$Write write out banner - -* Set default time - leax >DefTime,pcr - os9 F$STime set time to default - - IFEQ ROM -* Change EXEC and DATA dirs - leax >ExecDir,pcr - lda #EXEC. - os9 I$ChgDir change exec. dir - leax >DefDev,pcr -* Made READ. so that no write occurs at boot (Boisy on Feb 5, 2012) - lda #READ. - os9 I$ChgDir change data dir. - bcs L0125 -* leax >HDDev,pcr -* lda #EXEC. -* os9 I$ChgDir change exec. dir to HD - ENDC - -L0125 equ * - pshs u,y - IFEQ atari+corsham - IFEQ Level-1 -* Setup BASIC code (CoCo port only) -* leax >BasicRst,pcr -* ldu #D.CBStrt -* ldb #BasicRL -*CopyLoop lda ,x+ -* sta ,u+ -* decb -* bne CopyLoop - ELSE - os9 F$ID get process ID - lbcs L01A9 fail - leax ,u - os9 F$GPrDsc get process descriptor copy - lbcs L01A9 fail - leay ,u - ldx #$0000 - ldb #$01 - os9 F$MapBlk - bcs L01A9 - -* lda #$55 set flag for Color BASIC -* sta <D.CBStrt,u -* Copy our default I/O ptrs to the system process - ldd <D.SysPrc,u - leau d,u - leau <P$DIO,u - leay <P$DIO,y - ldb #DefIOSiz-1 -L0151 lda b,y - sta b,u - decb - bpl L0151 - ENDC - ENDC -* -* IFEQ ROM -* Fork shell startup here -* IFEQ atari+corsham -* Added 12/14/03: If SHIFT is held down, startup is not run (CoCo only) -* lda #$01 standard output -* ldb #SS.KySns -* os9 I$GetStt -* bcs DoStartup -* bita #SHIFTBIT SHIFT key down? -* bne L0186 Yes, don't to startup or autoex -* ENDC - -*DoStartup leax >Shell,pcr -* leau >Startup,pcr -* ldd #256 -* ldy #StartupL -* os9 F$Fork -* bcs DoAuto Startup failed.. -* os9 F$Wait -* ENDC - -* Fork AutoEx here -*DoAuto leax >AutoEx,pcr -* leau >CRtn,pcr -* ldd #$0100 -* ldy #$0001 -* os9 F$Fork -* bcs L0186 AutoEx failed.. -* os9 F$Wait - - IFEQ Level-1 - leax >MDIR,pcr - leau >mdirprm,pcr - ldd #$0100 - ldy #$0003 - os9 F$Fork - bcs L0186 AutoEx failed.. - os9 F$Wait - bra L0186 -MDIR fcs "mdir" - fcb $0d - ENDC -L0186 equ * - puls u,y -FrkShell leax >ShellPrm,pcr - leay ,u - ldb #ShellPL -L0190 lda ,x+ - sta ,y+ - decb - bne L0190 -* Fork final shell here - leax >Shell,pcr - lda #$01 D = 256 (B already 0 from above) - ldy #ShellPL - IFGT Level-1 - os9 F$Chain Level 2/3. Should not return.. - ldb #$06 it did! Fatal. Load error code - bra Crash - -L01A9 ldb #$04 error code -Crash clr >DPort+$08 turn off disk motor - jmp <D.Crash fatal error - ELSE - os9 F$Fork Level 1. - bcs DeadEnd Fatal. - os9 F$Wait - bcc FrkShell OK, go start shell. -DeadEnd bra DeadEnd - ENDC - -IcptRtn rti - - emod -eom equ * - end
--- a/src/os9/level2/v0.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -******************************************************************** -* progname - program module -* -* $Id: d0.asm,v 1.1 2002/06/14 12:35:43 roug Exp $ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* - Original Dragon Data distribution version -* -* $Log: d0.asm,v $ -* Revision 1.1 2002/06/14 12:35:43 roug -* Add work done on ideal devices -* -* - - nam V0 - ttl 40-track floppy disk device descriptor - - ifp1 - use defsfile - endc -tylg set Devic+Objct -atrv set ReEnt+rev -rev set $02 - mod eom,name,tylg,atrv,mgrnam,drvnam - fcb $FF mode byte - fcb $00 extended controller address - fdb $ffc0 physical controller address - fcb initsize-*-1 initilization table size - fcb $01 device type:0=scf,1=rbf,2=pipe,3=scf - fcb $00 drive number - fcb $00 step rate - fcb $20 drive device type - fcb $01 media density:0=single,1=double - fdb $0100 number of cylinders (tracks) - fcb $01 number of sides - fcb $00 verify disk writes:0=on - fdb $0012 # of sectors per track - fdb $0012 # of sectors per track (track 0) - fcb $01 sector interleave factor - fcb $08 minimum size of sector allocation -initsize equ * -name equ * - fcs /V0/ -mgrnam equ * - fcs /VRBF/ -drvnam equ * - fcs /PDisk/ - emod -eom equ *
--- a/src/os9/level2/vector.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - org $ffd0 -entry equ $f100 - -reset clra - tfr a,dp - ldx #$ff90 - sta 1,x use system mmu - sta $10,x set 0 page - lda #$3f - sta $17,x set IO/os9p1 page - ifndef bootdbg - lda #$39 - sta <$5E - else - ldd #$b7ff Bt.Bug hook - std <$5E sta $ff81 - ldd #$8139 rts - std <$5E+2 - endc - jmp [<vector,pcr] - - org $fff0 -vector - fdb $ff1f os9entry - fdb $ff03 SWI3 - fdb $ff06 SWI2 - fdb $ff09 FIRQ - fdb $ff0c IRQ - fdb $ff0f SWI - fdb $ff1f NMI -vreset - fdb reset -
--- a/src/os9/level2/vrbf.asm Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,379 +0,0 @@ -*******************************************************************2 -* Virtual RBF - Random Block File Manager * - - nam VRBF - ttl VRandom Block File Manager - - ifp1 - use defsfile - endc - -rev set $00 -ty set FlMgr - IFNE H6309 -lg set Obj6309 - ELSE -lg set Objct - ENDC -tylg set ty+lg -atrv set ReEnt+rev -edition set 37 - - org $00 -size equ . - - mod eom,name,tylg,atrv,start,size - -name fcs /VRBF/ - fcb edition - -*L0012 fcb DRVMEM - - -**************************** -* -* Main entry point for RBF -* -* Entry: Y = Path descriptor pointer -* U = Register stack pointer - -start lbra Create - lbra Open - lbra MakDir - lbra ChgDir - lbra Delete - lbra Seek - lbra Read - lbra Write - lbra ReadLn - lbra WriteLn - lbra GetStat - lbra SetStat - lbra Close - -* -* -* - - -* -* I$Create Entry Point -* -* Entry: A = access mode desired (0 read, 1 write, 2 update, bit 4 for exex) -* B = file attributes -* X = address of the pathlist -* -* Exit: A = pathnum -* X = last byte of pathlist address -* -* Error: CC Carry set -* B = errcode -* -Create pshs y,u,cc Preserve path desc ptr - orcc #IntMasks - bsr setuppd - ldb #$d1 - stb ,x do IO b,x will be rewrited - ldb ,x - beq ok00 - bra er00 - -* -* I$Open Entry Point -* -* Entry: A = access mode desired -* X = address of the pathlist -* -* Exit: A = pathnum -* X = last byte of pathlist address -* -* Error: CC Carry set -* B = errcode -* -Open pshs y,u,cc - orcc #IntMasks - bsr setuppd - ldb #$d2 - stb ,x - ldb ,x - cmpb #0 - beq ok00 - bra er00 - -* u user stack -* y path descriptor -* PD.PD.y path number -* PD.PD.MOD.y mode -* PD.RGS,y caller's rega = u -* PD.DEV,y device table -* PD.DRV,y drive number - -setuppd ldx PD.DEV,y get device table - ldx 4,x get device module - ldx $f,x get port address - sty 7,x path descriptor - stu 5,x caller stack - lda <PD.DRV,y - sta 1,x - ldy <D.Proc get process pointer - lda R$A,u - bita #EXEC. - bne usechx - ldb P$DIO+3,y get curwdir #pdnumber - bra s1 -usechx ldb P$DIO+9,y get curxdir #pdnumber -s1 stb 4,x - rts - -er00 puls y,u,cc - ldb R$b,u - lda R$Cc,u - ora #Carry - sta R$Cc,u - orcc #Carry - rts -ok00 puls y,u,cc,pc - -* -* I$MakDir Entry Point -* -* Entry: X = address of the pathlist -* -* Exit: X = last byte of pathlist address -* -* Error: CC Carry set -* B = errcode -* -MakDir pshs y,u,cc - orcc #IntMasks - bsr setuppd - ldb #$d3 - stb ,x - ldb ,x - cmpb #0 - beq ok00 - bra er00 - -* -* I$Close Entry Point -* -* Entry: A = path number -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -Close pshs y,u,cc - orcc #IntMasks - bsr setuppd - ldb #$db - stb ,x - ldb ,x - cmpb #0 - beq ok00 - bra er00 - -* -* I$ChgDir Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -ChgDir pshs y,u,cc - orcc #IntMasks - bsr setuppd - ldb #$d4 - stb ,x - ldb ,x - ldy 1,s - ldx <D.Proc get process pointer - ldu PD.RGS,y - lda R$A,u - ldb PD.MOD,y get current file mode - bitb #UPDAT. read or write mode? - beq CD30D no, skip ahead -* Change current data dir - sta P$DIO+3,x -CD30D bitb #EXEC. is it execution dir? - beq ok01 no, skip ahead -* Change current execution directory - sta P$DIO+9,x - bra ok01 - -* -* I$Delete Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -* -Delete pshs y,u,cc - orcc #IntMasks - lbsr setuppd - ldb #$d5 - stb ,x - ldb ,x - cmpb #0 - beq ok01 - bra er01 - -* -* I$Seek Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -Seek pshs y,u,cc - orcc #IntMasks - lbsr setuppd - ldb #$d6 - stb ,x - ldb ,x - cmpb #0 - beq ok01 - bra er01 - -* -* I$ReadLn Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -ReadLn pshs y,u,cc - orcc #IntMasks - lbsr setuppd - ldb #$d7 - stb ,x - ldb ,x - beq ok01 - bra er01 - -* -* I$Read Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -Read pshs y,u,cc - orcc #IntMasks - lbsr setuppd - ldb #$d8 - stb ,x - ldb ,x - beq ok01 - bra er01 - - -* -* I$WritLn Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -WriteLn pshs y,u,cc - orcc #IntMasks - lbsr setuppd - ldb #$d9 - stb ,x - ldb ,x - beq ok01 - bra er01 - -* -* I$Write Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -Write pshs y,u,cc - orcc #IntMasks - lbsr setuppd - ldb #$da - stb ,x - ldb ,x - beq ok01 -er01 puls y,u,cc - ldb R$b,u - lda R$Cc,u - ora #Carry - sta R$Cc,u - orcc #Carry - rts -ok01 puls y,u,cc,pc - - -* -* I$GetStat Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -GetStat pshs y,u,cc - orcc #IntMasks - ldb R$B,u get function code - lbsr setuppd - ldb #$dc - stb ,x - ldb ,x - beq ok01 - bra er01 - - -* -* I$SetStat Entry Point -* -* Entry: -* -* Exit: -* -* Error: CC Carry set -* B = errcode -* -SetStat pshs y,u,cc - orcc #IntMasks - ldb R$B,u get function code - lbsr setuppd - ldb #$dd - stb ,x - ldb ,x - beq ok01 - bra er01 - - - emod -eom equ * - end -
--- a/src/os9/makerom.c Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,368 +0,0 @@ -/* makerom.c - build ROM image file os9.rom from module list - - Shinji KONO Fri Jul 6 13:31:52 JST 2018 - -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <strings.h> -#include <sys/stat.h> - -// #define DEBUG 1 - -/* - * Level1 - * os9p1 should be 0xf800 - * it searches ram from the beginning - * rom modules are searched from just after the end of RAM - * - * Level2 - * Coco 512kb memory space - * last 8k is a ROM (can be switched?) ( block 0x3f ) - * os9p1 search module on 0x0d00~0x1e00 at block 0x3f - * - * 8k block ( offset 0xc000 ) - * - * 0xe000 - 0xccff 0xff - * 0xed00 - 0xfeff os9 modules, os9p1 should be the last - * MMU doesnot touch below - * 0xff80 - 0xffdf IO port ( ACIA, clock, pdisk, MMU ) - * 0xffd0 - 0xffef boot code - * 0xfff0 - 0xffff intr vector - * ... next few blocks as extended ROM - * lv2 6809 memory check routine destroys 0x200 on page 0x40 - * sta >-$6000,x - * avoid 0x200 - * - */ - -int level = 1; -int IOBASE = 0xe000; -int IOSIZE = 0x100; -char * outfile ; - -#define LV2START 0xffd0 // our own small boot for mmu -#define LV2ROMEND 0xff80 - -// #define DEBUG - -typedef struct os9module { - int size; - int entry; - int location; - int ioflag; - unsigned char *mod; - char *name; - struct os9module *next; -} *MPTR ; - -unsigned short vec[8]; - -struct os9module * -readOS9module(char *filename) -{ - FILE *fp = fopen(filename,"rb"); - if (fp==0) { - fprintf(stderr,"cannot read %s\n",filename); - exit(1); - } - struct stat st; - fstat(fileno(fp),&st); - int size = st.st_size; - struct os9module *m = malloc(size + sizeof(struct os9module)); - m->size = size; - m->next = 0; - m->ioflag = 0; - m->mod = (unsigned char*)m + sizeof(struct os9module); - fread(m->mod , size, 1, fp); - m->name = (char*) (m->mod + (m->mod[4]*256 + m->mod[5]) ); - m->entry = m->mod[9]*256 + m->mod[10] ; - fclose(fp); - return m; -} - -void -fputword(unsigned short x, FILE *fp) -{ - fputc((x>>8)&0xff,fp); - fputc(x&0xff,fp); -} - -void printOs9Str(char *p) -{ - char *q = p; - while((*p & 0x80)==0) { - putchar(*p); - p++; - } - putchar(*p & 0x7f); - while(p<q+8) { - putchar(' '); p++; - } -} - -unsigned short -getword(unsigned char *ptr) -{ - return (ptr[0]<<8)+ptr[1]; -} - -void rewrite_vector(MPTR m,int size, unsigned char *adr,int count) -{ - // vector is a offset from $F100 (possibly os9p1 module address) - int offset = -size-0xf100; - for(int i=0;i<count;i++) { - int vec = getword(adr); - vec += offset; - adr[0] = vec>>8; - adr[1] = vec&0xff; - adr += 2; - } -} - -int search_vector(MPTR m) { - unsigned char v[] = { 0x6E, 0x9F, 0x00, 0x2C, 0x6E}; - for( unsigned char *p = m->mod ; p < m->mod + m->size; p++ ) { - int i=0; - for(; i< sizeof(v); i++) { - if (p[i]!=v[i]) break; - } - if (i==sizeof(v)) - return p - m->mod; - } - return 0; -} - -// calcurate position from the botton -// avoid v09 IO map on 0xe000-0xe800 -// os9p1 have to be last and at 0xf800 -int findLocation(MPTR m, int loc) { - if (m==0) return loc; - int top = findLocation(m->next, loc) - m->size; - if (m->next==0) { - if (level == 1) - if (m->size > 0xff80-0xf800 ) { - top = 0x10000-(m->size+0x80); - } else { - top = 0xf800; // OS9p1 - } - else { -#if 0 - // old level2 kernel has vector at the bottom - top = 0x10000-(m->size+0x80); - rewrite_vector(m,m->size,m->mod+getword(m->mod+2),7); -#else - top = 0xf000; // level2 OS9p1 starts here - // and theses area are RAM /REGISTER STACK/ -#endif - } - } - if (level==1 && !(( top+m->size < IOBASE ) || ( IOBASE+IOSIZE < top)) ) { - top = IOBASE-m->size-1; - m->ioflag = 1; -#ifdef DEBUG - printf("*"); -#endif - } else if (level==2 && 0xed00 > top) { - m->ioflag = 1; - } - m->location = top; -#ifdef DEBUG - printf("mod "); - printOs9Str(m->name); - printf(" \t: 0x%x - 0x%x\n",top, top + m->size); -#endif - return top; -} - -int -main(int ac, char *av[]) -{ - int vectable = 0; - struct os9module *m = 0, root ; - root.size = 0; - root.mod = 0; - m = &root; - - for(int i = 1 ; i<ac ; i++ ) { - if (*av[i]=='-') { - if (av[i][1] =='2') { // for level 2 - level = 2; - IOBASE = LV2ROMEND; - } else if (av[i][1] =='o') { - outfile = av[i+1]; - i += 1; - } else { - return 1; - } - continue; - } - struct os9module *cur; - cur = readOS9module(av[i]); - m->next = cur; - m = cur; - } - - FILE *romfile; - unsigned pos; - if (outfile==0) return 1; - - romfile=fopen(outfile,"wb"); - if(!romfile) { - fprintf(stderr,"Cannot create file %s\n",av[1]); - exit(1); - } - - - int start = findLocation(root.next,0); - start = start&0xf800; - printf("\n\n"); - - if (level==2) { - for(int i=0; i<0xd00; i++) fputc(0xff,romfile); - pos = 0xed00; - } else { - pos = start; - } - int ofs = 0; - struct os9module *os9p1 = 0; - for(struct os9module *cur = root.next; cur ; cur = cur->next ) { - if ( level==2 && cur->ioflag ==1) continue; - // last module have to os9p1 - if ( cur->next == 0 ) { - os9p1 = cur; - if ( level==1 ) { - if (os9p1->size > 0x07f0) { - ofs = (os9p1->size+0xf)&0xfff0; - ofs -= 0x07f0; - } - for(; pos < 0xf800-ofs ; pos++) { // os9p1 begins at 0xf800 - fputc(0xff,romfile); - } - } else { -#if 0 - int pend = 0x10000-( cur->size +0x80); - for(; pos < pend ; pos++) { // os9p1 ends 0xff7f - fputc(0xff,romfile); - } -#endif - for(; pos < 0xf000 ; pos++) { // level2 os9p1 start from 0xf000 - fputc(0xff,romfile); - } - } - } - printf("mod "); - printOs9Str(cur->name); - cur->location = pos; - fwrite(cur->mod, cur->size, 1, romfile); - printf(" \t: 0x%x - 0x%x size 0x%04x entry 0x%x\n",pos, pos + cur->size-1,cur->size,cur->entry+cur->location); -#ifdef DEBUG - printf(" \t: 0x%x \n",cur->location); - printf(" \t: 0x%x - 0x%x : 0x%lx \n",pos, pos + cur->size, ftell(romfile)+start); -#endif - pos = pos+cur->size; - if (level==1 && cur->ioflag) { - if (level==1) { - for(; pos < IOBASE + IOSIZE; pos++) { - fputc(0xff,romfile); - } - printf("*"); - } - } - } - printf("os9 end %x\n",pos); - if (level==1) { - vectable = 0x10000 - 2*7; - for( ; pos<vectable; pos++) fputc(0xff,romfile); - printf("vectbl %x\n",pos); - if (1) { - int vecofs = search_vector(os9p1); - if (vecofs==0) { - printf("can't find vector\n"); - } - static int perm[] = {0,1,5,4,2,3}; - for(int i=0;i<6;i++) { - fputword(os9p1->location +vecofs+perm[i]*4,romfile); - } - int entry_ofs = (m->mod[9]<<8) + m->mod[10]; - fputword( os9p1->location + entry_ofs ,romfile); - // printf("os9p1 location ofs %0x\n", os9p1->location); - // printf("vector ofs %0x\n", vecofs); - // printf("reset ofs %0x\n", entry_ofs); - } else { - fputword(0xF82d-ofs,romfile); - fputword(0xF831-ofs,romfile); - fputword(0xF835-ofs,romfile); - fputword(0xF839-ofs,romfile); - fputword(0xF83d-ofs,romfile); - fputword(0xF841-ofs,romfile); - fputword(0xF876-ofs,romfile); - } - } else { - char vector[] = "level2/vector"; - FILE *fp = fopen(vector,"rb"); - if (fp==0) { - fprintf(stderr,"cannot read %s\n",vector); - exit(1); - } - for( ; pos<LV2START; pos++) fputc(0xff,romfile); - printf("vectbl %x\n",pos); - for( ; pos<0xfff0; pos++) fputc(fgetc(fp),romfile); -#ifdef DEBUG - printf("os9entry %x\n",os9p1->location); -#endif - printf("os9entry %x\n",os9p1->location+getword(os9p1->mod+9)); - - fputword(os9p1->location+getword(os9p1->mod+9),romfile); // os9p1 entry point - unsigned short vec = os9p1->location+os9p1->size - 18; - fputword(vec,romfile); - fputword(vec+3,romfile); - fputword(vec+6,romfile); - - fputword(vec+9,romfile); - fputword(vec+12,romfile); - fputword(vec+15,romfile); - fputword(LV2START,romfile); - - pos = 0x10000; - int bootsize = 2; - for(struct os9module *cur = root.next; cur ; cur = cur->next ) { - if ( cur->ioflag ==0) continue; - bootsize += cur->size; - } - bootsize += 0x300-2; // to avoid 0x200 bombing - fputc(bootsize>>8,romfile); - fputc(bootsize&0xff,romfile); - pos += 2; - for( int i = 0; i<0x300-2; i++) fputc(0xff,romfile); - for(struct os9module *cur = root.next; cur ; cur = cur->next ) { - if ( cur->ioflag ==0) continue; - cur->location = pos; - printf("mod "); - printOs9Str(cur->name); - fwrite(cur->mod, cur->size, 1, romfile); - printf(" \t: 0x%x - 0x%x size 0x%04x entry 0x%x\n",pos, pos + cur->size-1, cur->size, cur->entry+cur->location); -#ifdef DEBUG - printf(" \t: 0x%x \n",cur->location); - printf(" \t: 0x%x - 0x%x : 0x%lx \n",pos, pos + cur->size, ftell(romfile)+start); -#endif - pos += cur->size; - } - while(pos++ & 0xff) fputc(0xff,romfile); - } - if (level==1) - printf("boot rom from 0x%lx\n",0x10000-ftell(romfile)); - else { - long size; - printf("boot rom from 0xc000 size 0x%lx\n",(size=ftell(romfile))); - if (size > 0x4d00 + 0x2000) { - printf(" was too big. make it less than 0x6d00\n"); - } - } - fclose(romfile); - return 0; -} - -
--- a/src/os9/os9.h Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -typedef unsigned char u_char; - -typedef struct os9_module_t { - u_char id[2]; - u_char size[2]; - u_char name[2]; - u_char tyla; - u_char atrv; - u_char parity; - union { - u_char data[1]; /* plain modules */ - struct { - u_char exec[2]; - u_char data[1]; - } system; - struct { - u_char exec[2]; - u_char mem[2]; - u_char data[1]; - } program; - struct { - u_char exec[2]; - u_char mem[2]; - u_char mode[1]; - u_char data[1]; - } driver; - struct { - u_char exec[2]; - u_char data[1]; - } file_mgr; - struct { - u_char fmgr[2]; - u_char driver[2]; - u_char mode; - u_char port[3]; - u_char opt; - u_char dtype; - u_char data[1]; - } descriptor; - } data; -} OS9_MODULE_t; - -#define OS9_HEADER_SIZE 9 - -#define TYPE_MASK 0xF0 -typedef enum os9_type_t { - NULL_TYPE = 0, - Prgrm, - Sbtrn, - Multi, - Data, - SSbtrn, - TYPE_6, - TYPE_7, - TYPE_8, - TYPE_9, - TYPE_A, - TYPE_B, - Systm, - FlMgr, - Drivr, - Devic -} OS9_TYPE_t; - -#define LANG_MASK 0x0F -typedef enum os9_lang_t { - NULL_LANG = 0, - Objct, - ICode, - PCode, - CCode, - CblCode, - FrtnCode, - Obj6309, -} OS9_LANG_t; - -#define ATTR_MASK 0xF0 -typedef enum os9_attr_t { - ReEnt = 0x80, - Modprot = 0x40, -} OS9_attr_t; - -#define REVS_MASK 0x0F - -#define OS9_ID0 0x87 -#define OS9_ID1 0xcd - -#define OS9_CRC0 0x80 -#define OS9_CRC1 0x0F -#define OS9_CRC2 0xE3 - -#define INT(foo) (foo[0] * 256 + foo[1]) -int os9_crc(OS9_MODULE_t *mod); -int os9_header(OS9_MODULE_t *mod);
--- a/src/os9/os9mod.c Sun Sep 16 20:30:15 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include "os9.h" - - -u_char *os9_string(u_char *string); -void ident(OS9_MODULE_t *mod); -void usage(void); -long pos; - -static char *types[16] = { - "???", "Prog", "Subr", "Multi", "Data", "USR 5", "USR 6", "USR 7", - "USR 8", "USR 9", "USR A", "USR B", "System", "File Manager", - "Device Driver", "Device Descriptor" -}; - -static char *langs[16] = { - "Data", "6809 Obj", "Basic09 I-Code", "Pascal P-Code", "C I-Code", - "Cobol I-Code", "Fortran I-Code", "6309 Obj", "???", "???", "???", - "???", "???", "???", "???", "???" -}; - -int offset = 0; - -int main(int argc, char **argv) -{ - char *filename = NULL; - FILE *fp; - u_char buffer[65536]; /* OS9 Module can't be larger than this */ - OS9_MODULE_t *mod = (OS9_MODULE_t *) buffer; - int i=0, j; - int flag = 0; - - argv++; /* skip my name */ - - if (argc == 1) - usage(); - - while ((argc >= 2) && (*argv[0] == '-')) { - if (*(argv[0] + 1) == 's') { - argc--; - flag = 1; - } else if (*(argv[0] + 1) == 'o') { - argc--; argc--; - argv++; - offset = strtol(argv[0],(char**)0,0); - } else - usage(); - argv++; - } - - - while (argc-- > 1) { - if (*argv==0) return 0; - filename = *(argv++); - - if ((fp = fopen(filename,"rb")) == NULL) { - fprintf(stderr, "Error opening file %s: %s\n", - filename, strerror(errno)); - return 1; - } - - while (!feof(fp)) { - - if (flag) { - int c; - while( !feof(fp) && (c = fgetc(fp)) != 0x87 ); - ungetc(c, fp); - } - - pos = ftell(fp); - if (fread(buffer, OS9_HEADER_SIZE, 1, fp) != 1) { - if (feof(fp)) - break; - else { - fprintf(stderr, "Error reading file %s: %s\n", - filename, strerror(errno)); - return 1; - } - } - - if ((mod->id[0] != OS9_ID0) && (mod->id[1] != OS9_ID1)) { - fprintf(stderr,"Not OS9 module, skipping.\n"); - return 1; - } - - if ((i = os9_header(mod))!=0xff) { - fprintf(stderr, "Bad header parity. Expected 0xFF, got 0x%02X\n", i); - return 1; - } - - i = INT(mod->size) - OS9_HEADER_SIZE; - if ((j = fread(buffer + OS9_HEADER_SIZE, 1, i, fp)) != i) { - fprintf(stderr,"Module short. Expected 0x%04X, got 0x%04X\n", - i + OS9_HEADER_SIZE, j + OS9_HEADER_SIZE); - return 1; - } - ident(mod); - } - fclose(fp); - } - return 0; - -} - -void ident(OS9_MODULE_t *mod) -{ - int i, j; - u_char *name, *ptr, tmp, *buffer = (u_char *) mod; - - i = INT(mod->name); - j = INT(mod->size); - name = os9_string(&buffer[i]); - printf("Offset : 0x%04lx\n", pos + offset); - printf("Header for : %s\n", name); - printf("Module size: $%X #%d\n", j, j); - ptr = &buffer[j - 3]; - printf("Module CRC : $%02X%02X%02X (%s)\n", ptr[0], ptr[1], ptr[2], - os9_crc(mod) ? "Good" : "Bad" ); - printf("Hdr parity : $%02X\n", mod->parity); - - switch ((mod->tyla & TYPE_MASK) >> 4) - { - - case Drivr: - case Prgrm: - i = INT(mod->data.program.exec); - printf("Exec. off : $%04X #%d\n", i, i); - i = INT(mod->data.program.mem); - printf("Data size : $%04X #%d\n", i, i); - break; - - case Devic: - printf("File Mgr : %s\n", - os9_string(&buffer[INT(mod->data.descriptor.fmgr)])); - printf("Driver : %s\n", - os9_string(&buffer[INT(mod->data.descriptor.driver)])); - break; - - case NULL_TYPE: - case TYPE_6: - case TYPE_7: - case TYPE_8: - case TYPE_9: - case TYPE_A: - case TYPE_B: - case Systm: - break; - } - - - - - tmp = buffer[i + strlen((const char *)name)]; - printf("Edition : $%02X #%d\n", tmp, tmp); - printf("Ty/La At/Rv: $%02X $%02x\n", mod->tyla, mod->atrv); - printf("%s mod, ", types[(mod->tyla & TYPE_MASK) >> 4]); - printf("%s, ", langs[mod->tyla & LANG_MASK]); - printf("%s, %s\n", (mod->atrv & ReEnt) ? "re-ent" : "non-share", - (mod->atrv & Modprot) ? "R/W" : "R/O" ); - printf("\n"); -} - -u_char *os9_string(u_char *string) -{ - static u_char cleaned[80]; /* strings shouldn't be longer than this */ - u_char *ptr = cleaned; - int i = 0; - - while (((*(ptr++) = *(string++)) < 0x7f) && - (i++ < sizeof(cleaned) - 1)) - ; - - *(ptr - 1) &= 0x7f; - *ptr = '\0'; - return cleaned; -} -void usage(void) -{ - printf("Usage: os9mod [-s] [-o offset] file [ file ... ]\n"); - printf("Performs an OS-9: 6809 'ident' on the specified files.\n"); - printf(" -s : skip to valid module\n"); - printf(" -o : offset \n\n"); - exit(0); -}