Mercurial > hg > Members > kono > nitros9-code
changeset 1727:78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
Dragon Computers.
author | boisy |
---|---|
date | Thu, 11 Nov 2004 22:08:01 +0000 |
parents | 043d330e2f0e |
children | 843c3687eabd |
files | defs/dgndefs level1/defsfile.dragon level1/makefile.dalpha level1/makefile.dragon level1/modules/boot_d64.asm level1/modules/clock_d64.asm level1/modules/ddisk.asm level1/modules/ddiskdesc.asm level1/modules/makefile.dragon level1/modules/p1_sc6551dragon.asm level1/modules/rel.asm level1/modules/t1_d64.asm level1/modules/term_d64.asm |
diffstat | 13 files changed, 2288 insertions(+), 484 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defs/dgndefs Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,95 @@ +* +* Deinitions for ports on Dragon 32/64/Alpha. +* + +IO equ $ff00 ; IO page on Dragon + +* +* Most of these symbols will be defined twice, as some +* of the Dragon code, sets DP=$FF, and uses direct page +* addressing to access the io ports, whilst some of it +* uses absolute addressing. +* The versions starting DP must be used with DP=$FF. +* + +*Pia 0 and 1 standard on all Dragons. + +DPPIA0DA EQU $00 ; Side A Data/DDR +DPPIA0CRA EQU $01 ; Side A Control. +DPPIA0DB EQU $02 ; Side B Data/DDR +DPPIA0CRB EQU $03 ; Side B Control. + +PIA0DA EQU DPPIADA+IO ; Side A Data/DDR +PIA0CRA EQU DPPIACRA+IO ; Side A Control. +PIA0DB EQU DPPIADB+IO ; Side A Data/DDR +PIA0CRB EQU DPPIACRB+IO ; Side A Control. + +DPPIA1DA EQU $20 ; Side A Data/DDR +DPPIA1CRA EQU $21 ; Side A Control. +DPPIA1DB EQU $22 ; Side B Data/DDR +DPPIA1CRB EQU $23 ; Side B Control. + +PIA1DA EQU DPPIADA+IO ; Side A Data/DDR +PIA1CRA EQU DPPIACRA+IO ; Side A Control. +PIA1DB EQU DPPIADB+IO ; Side A Data/DDR +PIA1CRB EQU DPPIACRB+IO ; Side A Control. + +* Dragon Alpha has a third PIA at FF24. + +DPPIA2DA EQU $24 ; Side A Data/DDR +DPPIA2CRA EQU $25 ; Side A Control. +DPPIA2DB EQU $26 ; Side B Data/DDR +DPPIA2CRB EQU $27 ; Side B Control. + +PIA2DA EQU DPPIADA+IO ; Side A Data/DDR +PIA2CRA EQU DPPIACRA+IO ; Side A Control. +PIA2DB EQU DPPIADB+IO ; Side A Data/DDR +PIA2CRB EQU DPPIACRB+IO ; Side A Control. + +;WD2797 Floppy disk controler, used in Alpha Note registers in reverse order ! +DPCmdRegA EQU $2F ; command/status +DPTrkRegA EQU $2E ; Track register +DPSecRegA EQU $2D ; Sector register +DPDataRegA EQU $2C ; Data register + +CmdRegA EQU DPCMDREG+IO ; command/status +TrkRegA EQU DPTRKREG+IO ; Track register +SecRegA EQU DPSECREG+IO ; Sector register +DataRegA EQU DPDATAREG+IO ; Data register + +; Constants for Alpha AY-8912 sound chip, which is used to control +; Drive select and motor on the Alpha + +AYIOREG EQU $0E ; AY-8912, IO Register number. +AYIdle EQU $00 ; Make AY Idle. +AYWriteReg EQU $01 ; Write AY Register +AYReadReg EQU $02 ; Read AY Register +AYREGLatch EQU $03 ; Latch register into AY + +DSMask EQU $03 ; Drive select mask. +MotorMask EQU $04 ; Motor enable mask +DDENMask EQU $08 ; DDEN Mask +ENPMask EQU $10 ; Enable Precomp mask +NMIMask EQU $20 ; NMI enable Mask + +; Dragon 64/Alpha Serial port. +DPAciaData EQU $04 ; Acia Rx/Tx Register +DPAciaStat EQU $05 ; Acia status register +DPAciaCmd EQU $06 ; Acia command register +DPAciaCtrl EQU $07 ; Acia control register + +;DragonDos Cartrage IO for WD2797 + +;WD2797 Floppy disk controler, used in DragonDos. +DPCmdRegD EQU $40 ; command/status +DPTrkRegD EQU $41 ; Track register +DPSecRegD EQU $42 ; Sector register +DPDataRegD EQU $43 ; Data register + +CmdRegD EQU DPCMDREG+IO ; command/status +TrkRegD EQU DPTRKREG+IO ; Track register +SecRegD EQU DPSECREG+IO ; Sector register +DataRegD EQU DPDATAREG+IO ; Data register + +DPDSKCTL EQU $48 ; Disk DS/motor control reg +DSKCTL EQU DPDSKCTL+IO
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/defsfile.dragon Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,9 @@ +Level equ 1 + + use os9defs + use scfdefs + use rbfdefs + use systype + use releasedefs + use dgndefs +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/makefile.dalpha Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,164 @@ +include ../rules.mak + +RELEASE = nos96809l1v030204 +BOOTFILE = bootfiles/bootfile_dalpha +BOOTFILE_DS80 = bootfiles/bootfile_dalpha +KERNELFILE = bootfiles/kernel_dalpha +DIRS = cmds modules defs sys bootfiles + +# Specify which shell should be used +#WHICHSHELL = shellplus +WHICHSHELL = shell_21 + +CMDS = $(shell $(CD) cmds; make showcocoobjs) +BOOTTRACK = $(shell $(CD) modules; make showboottrack) +KERNEL = $(shell $(CD) modules; make showkernel) +SYSMODS = $(shell $(CD) modules; make showsysmods) +CLOCKS = $(shell $(CD) modules; make showclocks) +RBF = $(shell $(CD) modules; make showrbf) +SCF = $(shell $(CD) modules; make showscf) +PIPE = $(shell $(CD) modules; make showpipe) +MODULECMDS = $(WHICHSHELL) del echo format makdir merge os9gen prompt tmode + +SYS = $(shell $(CD) sys; make showobjs) +DEFS = $(shell $(CD) defs; make showobjs) +ROOTFILES = startup + +PACKAGENAME = $(RELEASE).zip +DSK360K_1 = $(RELEASE)_ss80_1.dsk +DSK360K_2 = $(RELEASE)_ss80_2.dsk +DSK720K = $(RELEASE)_ds80.dsk + + +# Make all components +all: + @$(ECHO) "**************************************************" + @$(ECHO) "* *" + @$(ECHO) "* NitrOS-9/6809 Level 1 Distribution *" + @$(ECHO) "* *" + @$(ECHO) "**************************************************" + $(foreach dir, $(DIRS), ($(CD) $(dir); make);) + +# Clean all components +clean: dskclean + $(foreach dir, $(DIRS), ($(CD) $(dir); make clean);) + +dskclean: + -$(RM) $(PACKAGENAME) $(DSK360K_1) $(DSK360K_2) $(DSK720K) + +dsk: all $(PACKAGENAME) + +dskcopy: dsk + $(CP) $(DSK360K_1) $(DSK360K_2) $(DSK720K) $(PACKAGENAME) $(DSKDIR) + +scp: dsk + scp $(PACKAGENAME) boisy@cvs.nitros9.org:/home/nitros9/public_html + +$(PACKAGENAME): $(DSK360K_1) $(DSK360K_2) $(DSK720K) ReadMe ChangeLog + $(ARCHIVE) $@ $^ + +#Dragon Alpha internal drives are Single sided 80 track + +$(DSK360K_1): + $(RM) $@ + $(OS9FORMAT_SS80) -e -dr -q $@ -n"NitrOS-9/6809 Level 1 Disk 1" + $(OS9GEN) $@ -d -b=$(BOOTFILE) -t=$(KERNELFILE) + $(MAKDIR) $@,CMDS + $(MAKDIR) $@,SYS + $(CD) cmds; $(CP) $(CMDS) ../$@,CMDS + $(foreach file, $(CMDS), $(OS9ATTR_EXEC) $@,CMDS/$(file);) + $(OS9RENAME) $@,CMDS/$(WHICHSHELL) shell + $(CD) sys; $(CPL) $(SYS) ../$@,SYS + $(foreach file, $(SYS), $(OS9ATTR_TEXT) $@,SYS/$(file);) + $(MAKDIR) $@,DEFS + $(CD) defs; $(CPL) $(DEFS) ../$@,DEFS + $(foreach file, $(DEFS), $(OS9ATTR_TEXT) $@,DEFS/$(file);) + $(CPL) $(ROOTFILES) $@,. + $(foreach file, $(ROOTFILES), $(OS9ATTR_TEXT) $@,$(file);) + +$(DSK360K_2): + $(RM) $@ + $(OS9FORMAT_SS40) -e -dr -q $@ -n"NitrOS-9/6809 Level 1 Disk 2" + $(MAKDIR) $@,NITROS9 + $(MAKDIR) $@,NITROS9/6809L1 + $(MAKDIR) $@,NITROS9/6809L1/CMDS + $(CD) cmds; $(CP) $(MODULECMDS) ../$@,NITROS9/6809L1/CMDS + $(foreach file, $(MODULECMDS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/CMDS/$(file);) + $(OS9RENAME) $@,NITROS9/6809L1/CMDS//$(WHICHSHELL) shell + $(MAKDIR) $@,NITROS9/6809L1/MODULES + $(MAKDIR) $@,NITROS9/6809L1/MODULES/BOOTTRACK + $(CD) modules; $(CP) $(BOOTTRACK) ../$@,NITROS9/6809L1/MODULES/BOOTTRACK + $(foreach file, $(BOOTTRACK), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/BOOTTRACK/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/KERNEL + $(CD) modules; $(CP) $(KERNEL) ../$@,NITROS9/6809L1/MODULES/KERNEL + $(foreach file, $(KERNEL), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/KERNEL/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SYSMODS + $(CD) modules; $(CP) $(SYSMODS) ../$@,NITROS9/6809L1/MODULES/SYSMODS + $(foreach file, $(SYSMODS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SYSMODS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/CLOCKS + $(CD) modules; $(CP) $(CLOCKS) ../$@,NITROS9/6809L1/MODULES/CLOCKS + $(foreach file, $(CLOCKS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/CLOCKS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/RBF + $(CD) modules; $(CP) $(RBF) ../$@,NITROS9/6809L1/MODULES/RBF + $(foreach file, $(RBF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/RBF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SCF + $(CD) modules; $(CP) $(SCF) ../$@,NITROS9/6809L1/MODULES/SCF + $(foreach file, $(SCF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SCF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/PIPE + $(CD) modules; $(CP) $(PIPE) ../$@,NITROS9/6809L1/MODULES/PIPE + $(foreach file, $(PIPE), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/PIPE/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/BOOTLISTS + $(CD) bootlists; $(CPL) *.bl ../$@,NITROS9/6809L1/BOOTLISTS + $(MAKDIR) $@,NITROS9/6809L1/SCRIPTS + $(CD) scripts; $(CPL) mb* ../$@,NITROS9/6809L1/SCRIPTS + +$(DSK720K): + $(RM) $@ + $(OS9FORMAT_DS80) -e -dr -c2 -q $@ -n"NitrOS-9/6809 Level 1" + $(OS9GEN) $@ -d -b=$(BOOTFILE_DS80) -t=$(KERNELFILE) + $(MAKDIR) $@,CMDS + $(MAKDIR) $@,SYS + $(MAKDIR) $@,DEFS + $(CD) cmds; $(CP) $(CMDS) ../$@,CMDS + $(foreach file, $(CMDS), $(OS9ATTR_EXEC) $@,CMDS/$(file);) + $(OS9RENAME) $@,CMDS/$(WHICHSHELL) shell + $(CD) sys; $(CPL) $(SYS) ../$@,SYS + $(foreach file, $(SYS), $(OS9ATTR_TEXT) $@,SYS/$(file);) + $(CD) defs; $(CPL) $(DEFS) ../$@,DEFS + $(foreach file, $(DEFS), $(OS9ATTR_TEXT) $@,DEFS/$(file);) + $(CPL) $(ROOTFILES) $@,. + $(foreach file, $(ROOTFILES), $(OS9ATTR_TEXT) $@,$(file);) + $(MAKDIR) $@,NITROS9 + $(MAKDIR) $@,NITROS9/6809L1 + $(MAKDIR) $@,NITROS9/6809L1/CMDS + $(CD) cmds; $(CP) $(MODULECMDS) ../$@,NITROS9/6809L1/CMDS + $(foreach file, $(MODULECMDS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/CMDS/$(file);) + $(OS9RENAME) $@,NITROS9/6809L1/CMDS/$(WHICHSHELL) shell + $(MAKDIR) $@,NITROS9/6809L1/MODULES + $(MAKDIR) $@,NITROS9/6809L1/MODULES/BOOTTRACK + $(CD) modules; $(CP) $(BOOTTRACK) ../$@,NITROS9/6809L1/MODULES/BOOTTRACK + $(foreach file, $(BOOTTRACK), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/BOOTTRACK/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/KERNEL + $(CD) modules; $(CP) $(KERNEL) ../$@,NITROS9/6809L1/MODULES/KERNEL + $(foreach file, $(KERNEL), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/KERNEL/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SYSMODS + $(CD) modules; $(CP) $(SYSMODS) ../$@,NITROS9/6809L1/MODULES/SYSMODS + $(foreach file, $(SYSMODS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SYSMODS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/CLOCKS + $(CD) modules; $(CP) $(CLOCKS) ../$@,NITROS9/6809L1/MODULES/CLOCKS + $(foreach file, $(CLOCKS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/CLOCKS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/RBF + $(CD) modules; $(CP) $(RBF) ../$@,NITROS9/6809L1/MODULES/RBF + $(foreach file, $(RBF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/RBF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SCF + $(CD) modules; $(CP) $(SCF) ../$@,NITROS9/6809L1/MODULES/SCF + $(foreach file, $(SCF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SCF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/PIPE + $(CD) modules; $(CP) $(PIPE) ../$@,NITROS9/6809L1/MODULES/PIPE + $(foreach file, $(PIPE), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/PIPE/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/BOOTLISTS + $(CD) bootlists; $(CPL) *.bl ../$@,NITROS9/6809L1/BOOTLISTS + $(MAKDIR) $@,NITROS9/6809L1/SCRIPTS + $(CD) scripts; $(CPL) mb* ../$@,NITROS9/6809L1/SCRIPTS + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/makefile.dragon Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,162 @@ +include ../rules.mak + +RELEASE = nos96809l1v030204 +BOOTFILE = bootfiles/bootfile_d64 +BOOTFILE_DS80 = bootfiles/bootfile_d64 +KERNELFILE = bootfiles/kernel_d64 +DIRS = cmds modules defs sys bootfiles + +# Specify which shell should be used +#WHICHSHELL = shellplus +WHICHSHELL = shell_21 + +CMDS = $(shell $(CD) cmds; make showcocoobjs) +BOOTTRACK = $(shell $(CD) modules; make showboottrack) +KERNEL = $(shell $(CD) modules; make showkernel) +SYSMODS = $(shell $(CD) modules; make showsysmods) +CLOCKS = $(shell $(CD) modules; make showclocks) +RBF = $(shell $(CD) modules; make showrbf) +SCF = $(shell $(CD) modules; make showscf) +PIPE = $(shell $(CD) modules; make showpipe) +MODULECMDS = $(WHICHSHELL) del echo format makdir merge os9gen prompt tmode + +SYS = $(shell $(CD) sys; make showobjs) +DEFS = $(shell $(CD) defs; make showobjs) +ROOTFILES = startup + +PACKAGENAME = $(RELEASE).zip +DSK360K_1 = $(RELEASE)_ds40_1.dsk +DSK360K_2 = $(RELEASE)_ds40_2.dsk +DSK720K = $(RELEASE)_ds80.dsk + + +# Make all components +all: + @$(ECHO) "**************************************************" + @$(ECHO) "* *" + @$(ECHO) "* NitrOS-9/6809 Level 1 Distribution *" + @$(ECHO) "* *" + @$(ECHO) "**************************************************" + $(foreach dir, $(DIRS), ($(CD) $(dir); make);) + +# Clean all components +clean: dskclean + $(foreach dir, $(DIRS), ($(CD) $(dir); make clean);) + +dskclean: + -$(RM) $(PACKAGENAME) $(DSK360K_1) $(DSK360K_2) $(DSK720K) + +dsk: all $(PACKAGENAME) + +dskcopy: dsk + $(CP) $(DSK360K_1) $(DSK360K_2) $(DSK720K) $(PACKAGENAME) $(DSKDIR) + +scp: dsk + scp $(PACKAGENAME) boisy@cvs.nitros9.org:/home/nitros9/public_html + +$(PACKAGENAME): $(DSK360K_1) $(DSK360K_2) $(DSK720K) ReadMe ChangeLog + $(ARCHIVE) $@ $^ + +$(DSK360K_1): + $(RM) $@ + $(OS9FORMAT_SS80) -e -dr -q $@ -n"NitrOS-9/6809 Level 1 Disk 1" + $(OS9GEN) $@ -d -b=$(BOOTFILE) -t=$(KERNELFILE) + $(MAKDIR) $@,CMDS + $(MAKDIR) $@,SYS + $(CD) cmds; $(CP) $(CMDS) ../$@,CMDS + $(foreach file, $(CMDS), $(OS9ATTR_EXEC) $@,CMDS/$(file);) + $(OS9RENAME) $@,CMDS/$(WHICHSHELL) shell + $(CD) sys; $(CPL) $(SYS) ../$@,SYS + $(foreach file, $(SYS), $(OS9ATTR_TEXT) $@,SYS/$(file);) + $(MAKDIR) $@,DEFS + $(CD) defs; $(CPL) $(DEFS) ../$@,DEFS + $(foreach file, $(DEFS), $(OS9ATTR_TEXT) $@,DEFS/$(file);) + $(CPL) $(ROOTFILES) $@,. + $(foreach file, $(ROOTFILES), $(OS9ATTR_TEXT) $@,$(file);) + +$(DSK360K_2): + $(RM) $@ + $(OS9FORMAT_DS40) -e -dr -q $@ -n"NitrOS-9/6809 Level 1 Disk 2" + $(MAKDIR) $@,NITROS9 + $(MAKDIR) $@,NITROS9/6809L1 + $(MAKDIR) $@,NITROS9/6809L1/CMDS + $(CD) cmds; $(CP) $(MODULECMDS) ../$@,NITROS9/6809L1/CMDS + $(foreach file, $(MODULECMDS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/CMDS/$(file);) + $(OS9RENAME) $@,NITROS9/6809L1/CMDS//$(WHICHSHELL) shell + $(MAKDIR) $@,NITROS9/6809L1/MODULES + $(MAKDIR) $@,NITROS9/6809L1/MODULES/BOOTTRACK + $(CD) modules; $(CP) $(BOOTTRACK) ../$@,NITROS9/6809L1/MODULES/BOOTTRACK + $(foreach file, $(BOOTTRACK), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/BOOTTRACK/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/KERNEL + $(CD) modules; $(CP) $(KERNEL) ../$@,NITROS9/6809L1/MODULES/KERNEL + $(foreach file, $(KERNEL), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/KERNEL/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SYSMODS + $(CD) modules; $(CP) $(SYSMODS) ../$@,NITROS9/6809L1/MODULES/SYSMODS + $(foreach file, $(SYSMODS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SYSMODS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/CLOCKS + $(CD) modules; $(CP) $(CLOCKS) ../$@,NITROS9/6809L1/MODULES/CLOCKS + $(foreach file, $(CLOCKS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/CLOCKS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/RBF + $(CD) modules; $(CP) $(RBF) ../$@,NITROS9/6809L1/MODULES/RBF + $(foreach file, $(RBF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/RBF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SCF + $(CD) modules; $(CP) $(SCF) ../$@,NITROS9/6809L1/MODULES/SCF + $(foreach file, $(SCF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SCF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/PIPE + $(CD) modules; $(CP) $(PIPE) ../$@,NITROS9/6809L1/MODULES/PIPE + $(foreach file, $(PIPE), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/PIPE/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/BOOTLISTS + $(CD) bootlists; $(CPL) *.bl ../$@,NITROS9/6809L1/BOOTLISTS + $(MAKDIR) $@,NITROS9/6809L1/SCRIPTS + $(CD) scripts; $(CPL) mb* ../$@,NITROS9/6809L1/SCRIPTS + +$(DSK720K): + $(RM) $@ + $(OS9FORMAT_DS80) -e -dr -c2 -q $@ -n"NitrOS-9/6809 Level 1" + $(OS9GEN) $@ -d -b=$(BOOTFILE_DS80) -t=$(KERNELFILE) + $(MAKDIR) $@,CMDS + $(MAKDIR) $@,SYS + $(MAKDIR) $@,DEFS + $(CD) cmds; $(CP) $(CMDS) ../$@,CMDS + $(foreach file, $(CMDS), $(OS9ATTR_EXEC) $@,CMDS/$(file);) + $(OS9RENAME) $@,CMDS/$(WHICHSHELL) shell + $(CD) sys; $(CPL) $(SYS) ../$@,SYS + $(foreach file, $(SYS), $(OS9ATTR_TEXT) $@,SYS/$(file);) + $(CD) defs; $(CPL) $(DEFS) ../$@,DEFS + $(foreach file, $(DEFS), $(OS9ATTR_TEXT) $@,DEFS/$(file);) + $(CPL) $(ROOTFILES) $@,. + $(foreach file, $(ROOTFILES), $(OS9ATTR_TEXT) $@,$(file);) + $(MAKDIR) $@,NITROS9 + $(MAKDIR) $@,NITROS9/6809L1 + $(MAKDIR) $@,NITROS9/6809L1/CMDS + $(CD) cmds; $(CP) $(MODULECMDS) ../$@,NITROS9/6809L1/CMDS + $(foreach file, $(MODULECMDS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/CMDS/$(file);) + $(OS9RENAME) $@,NITROS9/6809L1/CMDS/$(WHICHSHELL) shell + $(MAKDIR) $@,NITROS9/6809L1/MODULES + $(MAKDIR) $@,NITROS9/6809L1/MODULES/BOOTTRACK + $(CD) modules; $(CP) $(BOOTTRACK) ../$@,NITROS9/6809L1/MODULES/BOOTTRACK + $(foreach file, $(BOOTTRACK), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/BOOTTRACK/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/KERNEL + $(CD) modules; $(CP) $(KERNEL) ../$@,NITROS9/6809L1/MODULES/KERNEL + $(foreach file, $(KERNEL), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/KERNEL/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SYSMODS + $(CD) modules; $(CP) $(SYSMODS) ../$@,NITROS9/6809L1/MODULES/SYSMODS + $(foreach file, $(SYSMODS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SYSMODS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/CLOCKS + $(CD) modules; $(CP) $(CLOCKS) ../$@,NITROS9/6809L1/MODULES/CLOCKS + $(foreach file, $(CLOCKS), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/CLOCKS/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/RBF + $(CD) modules; $(CP) $(RBF) ../$@,NITROS9/6809L1/MODULES/RBF + $(foreach file, $(RBF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/RBF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/SCF + $(CD) modules; $(CP) $(SCF) ../$@,NITROS9/6809L1/MODULES/SCF + $(foreach file, $(SCF), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/SCF/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/MODULES/PIPE + $(CD) modules; $(CP) $(PIPE) ../$@,NITROS9/6809L1/MODULES/PIPE + $(foreach file, $(PIPE), $(OS9ATTR_EXEC) $@,NITROS9/6809L1/MODULES/PIPE/$(file);) + $(MAKDIR) $@,NITROS9/6809L1/BOOTLISTS + $(CD) bootlists; $(CPL) *.bl ../$@,NITROS9/6809L1/BOOTLISTS + $(MAKDIR) $@,NITROS9/6809L1/SCRIPTS + $(CD) scripts; $(CPL) mb* ../$@,NITROS9/6809L1/SCRIPTS + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/boot_d64.asm Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,401 @@ +* +* Boot_d64, bootfile for Dragon 64, Dragon Alpha/Professional. +* +* First disasembly and porting 2004-11-07, P.Harvey-Smith. +* +* Dragon Alpha code, 2004-11-09, P.Harvey-Smith. +* I am not sure of how to disable NMI on the Alpha, it is +* simulated in software using the NMIFlag. +* +* See DDisk.asm for a fuller discription of how Dragon Alpha +* interface works. +* + nam Boot + ttl os9 system module + +* Disassembled 1900/00/00 00:05:56 by Disasm v1.5 (C) 1988 by RML + + ifp1 + use defsfile + endc + + IFNE DragonAlpha + +* Dragon Alpha has a third PIA at FF24, this is used for +* Drive select / motor control, and provides FIRQ from the +* disk controler. + +DPPIADA EQU DPPIA2DA +DPPIACRA EQU DPPIA2CRA +DPPIADB EQU DPPIA2DB +DPPIACRB EQU DPPIA2CRB + +PIADA EQU DPPIADA+IO ; Side A Data/DDR +PIACRA EQU DPPIACRA+IO ; Side A Control. +PIADB EQU DPPIADB+IO ; Side A Data/DDR +PIACRB EQU DPPIACRB+IO ; Side A Control. + +;WD2797 Floppy disk controler, used in Alpha Note registers in reverse order ! +DPCMDREG EQU DPCmdRegA ; command/status +DPTRKREG EQU DPTrkRegA ; Track register +DPSECREG EQU DPSecRegA ; Sector register +DPDATAREG EQU DPDataRegA ; Data register + +CMDREG EQU DPCMDREG+IO ; command/status +TRKREG EQU DPTRKREG+IO ; Track register +SECREG EQU DPSECREG+IO ; Sector register +DATAREG EQU DPDATAREG+IO ; Data register + + + ELSE + +DPPIADA EQU DPPIA1DA +DPPIACRA EQU DPPIA1CRA +DPPIADB EQU DPPIA1DB +DPPIACRB EQU DPPIA1CRB + +PIADA EQU DPPIADA+IO ; Side A Data/DDR +PIACRA EQU DPPIACRA+IO ; Side A Control. +PIADB EQU DPPIADB+IO ; Side A Data/DDR +PIACRB EQU DPPIACRB+IO ; Side A Control. + +;WD2797 Floppy disk controler, used in DragonDos. +DPCMDREG EQU DPCmdRegD ; command/status +DPTRKREG EQU DPTrkRegD ; Track register +DPSECREG EQU DPSecRegD ; Sector register +DPDATAREG EQU DPDataRegD ; Data register + +CMDREG EQU DPCMDREG+IO ; command/status +TRKREG EQU DPTRKREG+IO ; Track register +SECREG EQU DPSECREG+IO ; Sector register +DATAREG EQU DPDATAREG+IO ; Data register + + ENDC + +tylg set Systm+Objct +atrv set ReEnt+rev +rev set $01 + mod eom,name,tylg,atrv,start,size +u0000 rmb 2 +u0002 rmb 1 +u0003 rmb 1 +u0004 rmb 1 +NMIFlag rmb 1 +size equ . +name equ * + fcs /Boot/ + fcb $00 + + + +start equ * + ldx #CMdReg + clra + IFNE DragonAlpha + clr NMIFlag,u + ENDC + ldb #size +L0015 pshs a + decb + bne L0015 + + tfr s,u + ldx #CMDREG + lda #$D0 + sta ,x + lbsr L0175 + lda ,x + lda >piadb + lda #$FF + sta u0004,u + leax >NMIService,pcr + stx >$010A + lda #$7E + sta >$0109 + lda #$04 + + IFNE DragonAlpha + lbsr AlphaDskCtl + ELSE + sta >DSKCTL + ENDC + + ldd #$C350 +L0043 nop + nop + subd #$0001 + bne L0043 + pshs u,x,b,a + clra + clrb + ldy #$0001 + ldx <D.FMBM + ldu <D.FMBM+2 + os9 F$SchBit + bcs L009C + exg a,b + ldu $04,s + std u0002,u + clrb + ldx #$0000 + bsr L00BA + bcs L009C + ldd <$18,y + std ,s + os9 F$SRqMem + bcs L009C + stu $02,s + ldu $04,s + ldx $02,s + stx u0002,u + ldx <$16,y + ldd <$18,y + beq L0095 +L0083 pshs x,b,a + clrb + bsr L00BA + bcs L009A + puls x,b,a + inc u0002,u + leax $01,x + subd #$0100 + bhi L0083 +L0095 clrb + puls b,a + bra L009E +L009A leas $04,s +L009C leas $02,s +L009E puls u,x + leas Size,s + rts +L00A3 clr ,u + clr u0004,u + lda #$05 +L00A9 ldb #$43 + pshs a + lbsr L0160 + puls a + deca + bne L00A9 + ldb #$03 + lbra L0160 +L00BA lda #$91 + cmpx #$0000 + bne L00D2 + bsr L00D2 + bcs L00C9 + ldy u0002,u + clrb +L00C9 rts +L00CA bcc L00D2 + pshs x,b,a + bsr L00A3 + puls x,b,a +L00D2 pshs x,b,a + bsr L00DD + puls x,b,a + bcc L00C9 + lsra + bne L00CA +L00DD bsr L011E + bcs L00C9 + ldx u0002,u + orcc #$50 + pshs y,dp,cc + lda #$FF + tfr a,dp + lda #$34 + sta <u0003 + lda #$37 + sta <dppiacrb + lda <dppiadb + ldb #$88 + stb <dpcmdreg + ldb #$24 + + IFNE DragonAlpha + lbsr AlphaDskCtlB + ELSE + stb <dpdskctl + ENDIF + +L00FD sync + lda <dpdatareg + ldb <dppiadb + sta ,x+ + bra L00FD + +NMIService + IFNE DragonAlpha + pshs cc + tst NMIFlag,u + bne DoNMI + puls cc + RTI + +DoNMI puls cc + ENDC + +L0106 leas $0C,s + lda #$04 + + IFNE DragonAlpha + bsr AlphaDskCtl + ELSE + sta <dpdskctl + ENDIF + + lda #$34 + sta <dppiacrb + ldb <dpcmdreg + puls y,dp,cc + bitb #$04 + lbeq L015A +L011A comb + ldb #$F4 + rts +L011E clr ,u + tfr x,d + cmpd #$0000 + beq L0137 + clr ,-s + bra L012E +L012C inc ,s +L012E subd #$0012 + bcc L012C + addb #$12 + puls a +L0137 incb + stb >SECREG + ldb u0004,u + stb >TRKREG + cmpa u0004,u + beq L0158 + sta u0004,u + sta >DATAREG + ldb #$13 + bsr L0160 + pshs x + ldx #$222E +L0152 leax -$01,x + bne L0152 + puls x +L0158 clrb + rts +L015A bitb #$98 + bne L011A + clrb + rts +L0160 bsr L0173 +L0162 ldb >CMDREG + bitb #$01 + bne L0162 + rts +L016A lda #$04 + + IFNE DragonAlpha + bsr AlphaDskCtl + ELSE + sta >DSKCTL + ENDIF + + stb >CMDREG + rts +L0173 bsr L016A +L0175 lbsr L0178 +L0178 lbsr L017B +L017B rts + + IFNE DragonAlpha + +; Translate DragonDos Drive select mechinisim to work on Alpha +; Takes byte that would be output to $FF48, reformats it and +; outputs to Alpha AY-8912's IO port, which is connected to +; Drive selects, motor on and enable precomp. +; Also sets NMIFlag. + +AlphaDskCtlB + pshs A + tfr b,a + bsr AlphaDskCtl + puls A + rts + +AlphaDskCtl + PSHS A,B,CC + + anda #~DDenMask ; Dragon Alpha has DDen perminently enabled + + PSHS A + ANDA #NMIMask ; mak out nmi enable bit + sta NMIFlag,u ; Save it for later use + + lda ,s + anda #EnpMask ; Extract enp mask + pshs a ; save it + + lda 1,s + ANDA #DSMask ; Mask Out drive select bits + +; Shift a bit in B left, a times, to convert drive number +; to DS bit. + + ldb #$01 +ShiftNext + cmpa #$00 ; Done all shifts ? + beq ShiftDone + lslb + deca + bra ShiftNext + +ShiftDone + lda 1,s + anda #MotorMask ; Extract motor bit + cmpa #MotorMask ; Motor on ? + beq MotorOn ; Yes leave it on. + + clrb ; No zero out DS bits + +MotorOn + ora ,s ; Recombine with ENP bit. + leas 1,s ; drop off stack + lsla + lsla + pshs b + ora ,s + leas 1,s + + pshs a ; Save motor/drive select state + ldb PIADA ; get BDIR/BC1/Rom select + andb #$FC ; Mask out BCDIR/BC1, so we don't change other bits + pshs b ; save mask + + lda #AYIOREG ; AY-8912 IO register + sta PIADB ; Output to PIA + orb #AYREGLatch ; Latch register to modify + stb PIADA + + clrb + orb ,s ; Restore saved bits + stb PIADA ; Idle AY + + lda 1,s ; Fetch saved Drive Selects + sta PIADB ; output to PIA + ldb #AYWriteReg ; Write value to latched register + orb ,s ; Restore saved bits + stb PIADA ; Set register + + clrb + orb ,s ; Restore saved bits + stb PIADA ; Idle AY + + leas 3,s ; drop saved bytes + + PULS A,B,CC + RTS + + ENDC + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/clock_d64.asm Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,144 @@ + nam Clock + ttl os9 system module + +* Disassembled 1900/00/00 00:12:38 by Disasm v1.5 (C) 1988 by RML + + ifp1 +* use /dd/defs/os9defs + use defsfile + endc +tylg set Systm+Objct +atrv set ReEnt+rev +rev set $01 + mod eom,name,tylg,atrv,start,size +u0000 rmb 0 +size equ . +name equ * + fcs /Clock/ + fcb $02 +L0013 fcb $15 + fcb $00 + fcb $82 + fcb $80 + fcb $00 + fcb $1F + fcb $1C + fcb $1F + fcb $1E + fcb $1F + fcb $1E + fcb $1F + fcb $1F + fcb $1E + fcb $1F + fcb $1E + fcb $1F +L0024 fcb $4F O + fcb $1F + fcb $8B + fcb $0A + fcb $59 Y + fcb $26 & + fcb $46 F + fcb $DC \ + fcb $57 W + fcb $5C \ + fcb $C1 A + fcb $3C < + fcb $25 % + fcb $39 9 + fcb $4C L + fcb $81 + fcb $3C < + fcb $25 % + fcb $33 3 + fcb $DC \ + fcb $55 U + fcb $5C \ + fcb $C1 A + fcb $18 + fcb $25 % + fcb $29 ) + fcb $4C L + fcb $30 0 + fcb $8D + fcb $FF + fcb $D4 T + fcb $D6 V + fcb $54 T + fcb $C1 A + fcb $02 + fcb $26 & + fcb $09 + fcb $D6 V + fcb $53 S + fcb $27 ' + fcb $05 + fcb $C4 D + fcb $03 + fcb $26 & + fcb $01 + fcb $4A J + fcb $D6 V + fcb $54 T + fcb $A1 ! + fcb $85 + fcb $23 # + fcb $0E + fcb $DC \ + fcb $53 S + fcb $5C \ + fcb $C1 A + fcb $0D + fcb $25 % + fcb $03 + fcb $4C L + fcb $C6 F + fcb $01 + fcb $DD ] + fcb $53 S + fcb $86 + fcb $01 + fcb $5F _ + fcb $DD ] + fcb $55 U + fcb $4F O + fcb $5F _ + fcb $DD ] + fcb $57 W + fcb $96 + fcb $5A Z + fcb $97 + fcb $59 Y + fcb $6E n + fcb $9F + fcb $00 + fcb $81 +start equ * + pshs dp,cc + clra + tfr a,dp + lda #$32 + sta <$5A + sta <$59 + lda #$05 + sta <$5B + sta <$48 + orcc #$50 + leax >L0024,pcr + stx >$006B + leay >L0013,pcr + os9 F$SSvc + puls pc,dp,cc + ldx $04,u + ldd <$53 + std ,x + ldd <$55 + std $02,x + ldd <$57 + std $04,x + clrb + rts + emod +eom equ * + end
--- a/level1/modules/ddisk.asm Thu Nov 11 22:02:24 2004 +0000 +++ b/level1/modules/ddisk.asm Thu Nov 11 22:08:01 2004 +0000 @@ -1,484 +1,865 @@ -******************************************************************** -* DDisk - Dragon Floppy driver -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* - ????/??/?? -* Original Dragon Data distribution version - - nam DDisk - ttl Dragon Floppy driver - -* Disassembled 02/04/21 22:37:46 by Disasm v1.6 (C) 1988 by RML - - ifp1 - use defsfile - endc - -tylg set Drivr+Objct -atrv set ReEnt+rev -rev set $00 -edition set 3 - -MaxDrv set 4 - - mod eom,name,tylg,atrv,start,size -u0000 rmb 3 -u0003 rmb 2 -u0005 rmb 1 -u0006 rmb 2 -u0008 rmb 7 -u000F rmb 19 -u0022 rmb 1 -u0023 rmb 29 -u0040 rmb 3 -u0043 rmb 5 -u0048 rmb 95 -u00A7 rmb 2 -DrivSel rmb 1 -u00AA rmb 1 -u00AB rmb 1 -u00AC rmb 1 -u00AD rmb 2 -size equ . - fcb $FF -name equ * - fcs /DDisk/ - fcb edition - -start lbra Init - lbra Read - lbra Write - lbra GetStat - lbra SetStat - lbra Term - -* Init -* -* Entry: -* Y = address of device descriptor -* U = address of device memory area -* -* Exit: -* CC = carry set on error -* B = error code -* -Init clra - sta >$006F - sta >DPort+8 - ldx #DPort - lda #$D0 - sta ,x - lbsr L02AB - lda ,x - lda #$FF - ldb #MaxDrv - leax u000F,u -L003F sta ,x - sta <$15,x - leax <$26,x - decb - bne L003F - leax >L0172,pcr - stx >$010A - lda #$7E - sta >$0109 - ldd #$0100 - pshs u - os9 F$SRqMem - tfr u,x - puls u - bcs Return - stx >u00AD,u - clrb -Return rts - -* GetStat -* -* Entry: -* A = function code -* Y = address of path descriptor -* U = address of device memory area -* -* Exit: -* CC = carry set on error -* B = error code -* -GetStat - -* Term -* -* Entry: -* U = address of device memory area -* -* Exit: -* CC = carry set on error -* B = error code -* -Term clrb - rts - -* Read -* -* Entry: -* B = MSB of the disk's LSN -* X = LSB of the disk's LSN -* Y = address of path descriptor -* U = address of device memory area -* -* Exit: -* CC = carry set on error -* B = error code -* -Read lda #$91 - cmpx #$0000 - bne L0096 - bsr L0096 - bcs L008C - ldx $08,y - pshs y,x - ldy >u00A7,u - ldb #$14 -L0082 lda b,x - sta b,y - decb - bpl L0082 - clrb - puls pc,y,x -L008C rts -L008D bcc L0096 - pshs x,b,a - lbsr L02E9 - puls x,b,a - -L0096 pshs x,b,a - bsr L00A1 - puls x,b,a - bcc L008C - lsra - bne L008D -L00A1 lbsr L01BC - bcs L008C - ldx $08,y - pshs y,dp,cc - ldb #$88 - bsr L00C6 -L00AE lda <u0023 - bmi L00BE - leay -$01,y - bne L00AE - bsr L0107 - puls y,dp,cc - lbra L0288 -L00BD sync -L00BE lda <u0043 - ldb <u0022 - sta ,x+ - bra L00BD -L00C6 lda #$FF - tfr a,dp - lda <u0006 - sta >u00AC,u - anda #$FE - sta <u0006 - bita #$40 - beq L00DE -L00D8 lda <u0005 - bita #$10 - beq L00D8 -L00DE orcc #$50 - lda <u0003 - sta >u00AB,u - lda #$34 - sta <u0003 - lda <u0006 - anda #$FE - sta <u0006 - lda <u0023 - ora #$03 - sta <u0023 - lda <u0022 - ldy #$FFFF - lda #$24 - ora >DrivSel,u - stb <u0040 - sta <u0048 - rts -L0107 lda >DrivSel,u - ora #$04 - sta <u0048 - lda >u00AB,u - sta <u0003 - lda <u0023 - anda #$FC - sta <u0023 - lda >u00AC,u - sta <u0006 - rts - -* Write -* -* Entry: -* B = MSB of the disk's LSN -* X = LSB of the disk's LSN -* Y = address of path descriptor -* U = address of device memory area -* -* Exit: -* CC = carry set on error -* B = error code -* -Write lda #$91 -L0124 pshs x,b,a - bsr L0148 - puls x,b,a - bcs L0138 - tst <$28,y - bne L0136 - lbsr L0184 - bcs L0138 -L0136 clrb - rts -L0138 lsra - lbeq L027C - bcc L0124 - pshs x,b,a - lbsr L02E9 - puls x,b,a - bra L0124 -L0148 lbsr L01BC - lbcs L008C - ldx $08,y - pshs y,dp,cc - ldb #$A8 -L0155 lbsr L00C6 - lda ,x+ -L015A ldb <u0023 - bmi L016C - leay -$01,y - bne L015A - bsr L0107 - puls y,dp,cc - lbra L027C -L0169 lda ,x+ - sync -L016C sta <u0043 - ldb <u0022 - bra L0169 -L0172 leas $0C,s - bsr L0107 - puls y,dp,cc - ldb >DPort - bitb #$04 - lbne L0288 - lbra L025A -L0184 pshs x,b,a - ldx $08,y - pshs x - ldx >u00AD,u - stx $08,y - ldx $04,s - lbsr L00A1 - puls x - stx $08,y - bcs L01BA - lda #$20 - pshs u,y,a - ldy >u00AD,u - tfr x,u -L01A6 ldx ,u - cmpx ,y - bne L01B6 - leau u0008,u - leay $08,y - dec ,s - bne L01A6 - bra L01B8 -L01B6 orcc #$01 -L01B8 puls u,y,a -L01BA puls pc,x,b,a -L01BC clr >u00AA,u - bsr L022F - tstb - bne L01D6 - tfr x,d - ldx >u00A7,u - cmpd #$0000 - beq L01FB - cmpd $01,x - bcs L01DA -L01D6 comb - ldb #$F1 - rts -L01DA clr ,-s - bra L01E0 -L01DE inc ,s -L01E0 subd #$0012 - bcc L01DE - addb #$12 - puls a - cmpa #$10 - bls L01FB - pshs a - lda >DrivSel,u - ora #$10 - sta >DrivSel,u - puls a -L01FB incb -L01FC stb >DPort+2 - lbsr L02AB - cmpb >DPort+2 - bne L01FC -L0207 ldb <$15,x - stb >DPort+1 - tst >u00AA,u - bne L0218 - cmpa <$15,x - beq L022D -L0218 sta <$15,x - sta >DPort+3 - ldb #$12 - bsr L028C - pshs x - ldx #$222E -L0227 leax -$01,x - bne L0227 - puls x -L022D clrb - rts - -L022F lbsr L0305 - lda <$21,y - cmpa #MaxDrv - bcs L023D - comb - ldb #E$Unit - rts - -L023D pshs x,b,a - sta >DrivSel,u - leax u000F,u - ldb #$26 - mul - leax d,x - cmpx >u00A7,u - beq L0258 - stx >u00A7,u - com >u00AA,u -L0258 puls pc,x,b,a -L025A bitb #$F8 - beq L0272 - bitb #$80 - bne L0274 - bitb #$40 - bne L0278 - bitb #$20 - bne L027C - bitb #$10 - bne L0280 - bitb #$08 - bne L0284 -L0272 clrb - rts -L0274 comb - ldb #E$NotRdy - rts -L0278 comb - ldb #E$WP - rts -L027C comb - ldb #E$Write - rts -L0280 comb - ldb #E$Seek - rts -L0284 comb - ldb #E$CRC - rts -L0288 comb - ldb #E$Read - rts -L028C bsr L02A9 -L028E ldb >DPort - bitb #$01 - beq L02B1 - lda #$F0 - sta >$006F - bra L028E -L029C lda #$04 - ora >DrivSel,u - sta >DPort+8 - stb >DPort - rts -L02A9 bsr L029C -L02AB lbsr L02AE -L02AE lbsr L02B1 -L02B1 rts - -* SetStat -* -* Entry: -* A = function code -* Y = address of path descriptor -* U = address of device memory area -* -* Exit: -* CC = carry set on error -* B = error code -* -SetStat ldx $06,y - ldb $02,x - cmpb #$03 - beq L02E9 - cmpb #$04 - beq L02C2 - comb - ldb #$D0 -L02C1 rts -L02C2 lbsr L022F - lda $09,x - cmpa #$10 - bls L02D5 - ldb >DrivSel,u - orb #$10 - stb >DrivSel,u -L02D5 ldx >u00A7,u - lbsr L0207 - bcs L02C1 - ldx $06,y - ldx $04,x - ldb #$F0 - pshs y,dp,cc - lbra L0155 -L02E9 lbsr L022F - ldx >u00A7,u - clr <$15,x - lda #$05 -L02F5 ldb #$42 - pshs a - lbsr L028C - puls a - deca - bne L02F5 - ldb #$02 - bra L028C -L0305 pshs x,b,a - lda >$006F - bne L031A - lda #$04 - sta >DPort+8 - ldx #$A000 -L0314 nop - nop - leax -$01,x - bne L0314 -L031A lda #$F0 - sta >$006F - puls pc,x,b,a - - emod -eom equ * - end +******************************************************************** +* DDisk - Dragon Floppy driver +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* - ????/??/?? +* Original Dragon Data distribution version +* +* Added Defines for IO ports. +* 2004/11/09, P.Harvey-Smith +* +* Dragon Alpha code, 2004-11-09, P.Harvey-Smith. +* I am not sure of how to disable NMI on the Alpha, it is +* simulated in software using the NMIFlag. +* +* The Dragon Alpha/Professional uses the same FDC chip as +* DragonDos, however it is mapped between FF2C and FF2F, +* also the register order is REVERSED, so command/status is at +* FF2F. +* +* Drive Selects, motor and write precompensation is controled +* through the IO port of an AY-8912, which itself is connected +* to a 3rd PIA mapped at FF24 to FF27, this PIA also has it's +* inturrupt lines connected to the CPU's FIRQ. +* + nam DDisk + ttl Dragon Floppy driver + +* Disassembled 02/04/21 22:37:46 by Disasm v1.6 (C) 1988 by RML + + ifp1 + use defsfile + endc + + IFNE DragonAlpha + +* Dragon Alpha has a third PIA at FF24, this is used for +* Drive select / motor control, and provides FIRQ from the +* disk controler. + +DPPIADA EQU DPPIA2DA +DPPIACRA EQU DPPIA2CRA +DPPIADB EQU DPPIA2DB +DPPIACRB EQU DPPIA2CRB + +PIADA EQU DPPIADA+IO ; Side A Data/DDR +PIACRA EQU DPPIACRA+IO ; Side A Control. +PIADB EQU DPPIADB+IO ; Side A Data/DDR +PIACRB EQU DPPIACRB+IO ; Side A Control. + +;WD2797 Floppy disk controler, used in Alpha Note registers in reverse order ! +DPCMDREG EQU DPCmdRegA ; command/status +DPTRKREG EQU DPTrkRegA ; Track register +DPSECREG EQU DPSecRegA ; Sector register +DPDATAREG EQU DPDataRegA ; Data register + +CMDREG EQU DPCMDREG+IO ; command/status +TRKREG EQU DPTRKREG+IO ; Track register +SECREG EQU DPSECREG+IO ; Sector register +DATAREG EQU DPDATAREG+IO ; Data register + + ELSE + +DPPIADA EQU DPPIA1DA +DPPIACRA EQU DPPIA1CRA +DPPIADB EQU DPPIA1DB +DPPIACRB EQU DPPIA1CRB + +PIADA EQU DPPIADA+IO ; Side A Data/DDR +PIACRA EQU DPPIACRA+IO ; Side A Control. +PIADB EQU DPPIADB+IO ; Side A Data/DDR +PIACRB EQU DPPIACRB+IO ; Side A Control. + +;WD2797 Floppy disk controler, used in DragonDos. +DPCMDREG EQU DPCmdRegD ; command/status +DPTRKREG EQU DPTrkRegD ; Track register +DPSECREG EQU DPSecRegD ; Sector register +DPDATAREG EQU DPDataRegD ; Data register + +CMDREG EQU DPCMDREG+IO ; command/status +TRKREG EQU DPTRKREG+IO ; Track register +SECREG EQU DPSECREG+IO ; Sector register +DATAREG EQU DPDATAREG+IO ; Data register + + ENDC + +; DskCmd Masks +NMIEn EQU %00100000 +WPCEn EQU %00010000 +MotorOn EQU %00000100 +SDensEn EQU %00001000 + +* Disk Commands +FrcInt EQU %11010000 +ReadCmnd EQU %10001000 +RestCmnd EQU %00000000 +SeekCmnd EQU %00010000 +StpICmnd EQU %01000000 +WritCmnd EQU %10101000 +WtTkCmnd EQU %11110000 +Sid2Sel EQU %00000010 + +* Disk Status Bits +BusyMask EQU %00000001 +LostMask EQU %00000100 +ErrMask EQU %11111000 +CRCMask EQU %00001000 +RNFMask EQU %00010000 +RTypMask EQU %00100000 +WPMask EQU %01000000 +NotRMask EQU %10000000 + +DensMask EQU %00000001 +T80Mask EQU %00000010 + +tylg set Drivr+Objct +atrv set ReEnt+rev +rev set $00 +edition set 3 + +MaxDrv set 4 + + mod eom,name,tylg,atrv,start,size + + org DrvBeg + RMB MaxDrv*DrvMem +CDrvTab rmb 2 +DrivSel rmb 1 ; Saved drive mask +Settle rmb 1 ; Head settle time +SavePIA0CRB rmb 1 ; Saved copy of PIA0 control reg b +SaveACIACmd rmb 1 ; Saved copy of ACIA command reg +BuffPtr rmb 2 ; Buffer pointer +SideSel rmb 1 ; Side select. +NMIFlag rmb 1 ; Flag for Alpha, should this NMI do an RTI ? +size equ . + + fcb $FF +name equ * + fcs /DDisk/ + fcb edition + +start lbra Init ; Initialise Driver + lbra Read ; Read sector + lbra Write ; Write sector + lbra GetStat ; Get status + lbra SetStat ; Set status + lbra Term ; Terminate device + + +* Init +* +* Entry: +* Y = address of device descriptor +* U = address of device memory area +* +* Exit: +* CC = carry set on error +* B = error code +* +Init + pshs x + ldx #$55AA + puls x + + clra + sta >D.DskTmr ; Zero motor timer + + IFNE DragonAlpha ; Turn off all drives + lbsr AlphaDskCtl + ELSE + sta >DskCtl + ENDC + + ldx #CmdReg ; Reset controler + lda #FrcInt + sta ,x + lbsr Delay + lda ,x + lda #$FF + ldb #MaxDrv + leax DrvBeg,u + +InitDriveData + sta DD.Tot,x ; Set total sectors = $FF + sta <V.Trak,x ; Set current track = 0 + leax <DrvMem,x ; Skip to next drive + decb + bne InitDriveData + + leax >NMIService,pcr ; Setup NMI handler + stx >D.XNMI+1 + lda #$7E ; $7E = JMP + sta >D.XSWI + + ldd #$0100 ; Request a page of system ram + pshs u ; used to verify writes + os9 F$SRqMem + tfr u,x + puls u + bcs Return + stx >BuffPtr,u ; Save verify page pointer + clrb +Return rts + +* GetStat +* +* Entry: +* A = function code +* Y = address of path descriptor +* U = address of device memory area +* +* Exit: +* CC = carry set on error +* B = error code +* +GetStat + +* Term +* +* Entry: +* U = address of device memory area +* +* Exit: +* CC = carry set on error +* B = error code +* +Term clrb + rts + +* Read +* +* Entry: +* B = MSB of the disk's LSN +* X = LSB of the disk's LSN +* Y = address of path descriptor +* U = address of device memory area +* +* Exit: +* CC = carry set on error +* B = error code +* +Read lda #$91 ; Retry count + cmpx #$0000 ; LSN ? + bne L0096 ; No : Just do read, + bsr L0096 ; Yes : do read and copy disk params + bcs L008C + ldx PD.Buf,y + pshs y,x + ldy >CDrvTab,u + ldb #DD.Siz-1 +L0082 lda b,x + sta b,y + decb + bpl L0082 + clrb + puls pc,y,x +L008C rts + +; Read Retry + +ReadDataRetry + bcc L0096 ; Retry entry point + pshs x,b,a + lbsr ResetTrack0 ; Reset track 0 + puls x,b,a + +L0096 pshs x,b,a ; Normal entry point + bsr DoReadData + puls x,b,a + bcc L008C + lsra ; Check for retry + bne ReadDataRetry + +DoReadData + lbsr SeekTrack + bcs L008C + ldx PD.Buf,y ; Target address for data + pshs y,dp,cc + ldb #ReadCmnd ; Read command + bsr PrepDiskRW ; Prepare disk +DoReadDataLoop + lda <DPPIACRB ; Is data ready ? + bmi ReadDataReady ; Yes : read it + leay -1,y + bne DoReadDataLoop + bsr RestoreSavedIO + puls y,dp,cc + lbra RetReadError ; Return read error to caller + +ReadDataWait + sync ; Sync to inturrupts, wait for data + + +ReadDataReady + lda <DPDataReg ; Read data from FDC + ldb <DPPIADB ; Clear PIA inturrupt status + sta ,x+ ; save data in memory + bra ReadDataWait ; do next + +PrepDiskRW + lda #$FF ; Make DP=$FF, to make io easier + tfr a,dp + lda <DPAciaCmd ; Save ACIA Command reg + sta >SaveACIACmd,u + anda #$FE ; Disable ACIA inturrupt + sta <DPAciaCmd + bita #$40 ; Is Tx inturrupt enabled ? + beq L00DE +L00D8 lda <DPAciaStat ; Yes, wait for Tx to complete + bita #$10 + beq L00D8 + +L00DE orcc #$50 ; Mask inturrupts + lda <DPPia0CRB ; Save PIA0 IRQ Status + sta >SavePIA0CRB,u + lda #$34 ; Disable it. + sta <DPPia0CRB + lda <DPACIACmd ; Disable ACIA Inturrupt + anda #$FE + sta <DPACIACmd + lda <DPPIACRB ; Set PIA to generate FIRQ on FDC DRQ + ora #$03 + sta <DPPIACRB + lda <DPPIADB ; Clear any outstanding inturrupt + ldy #$FFFF + lda #NMIEn+MotorOn ; Enable NMI, and turn motor on + ora >DrivSel,u ; mask in drives + ORB >SideSel,U * Set up Side + stb <DPCmdReg ; issue command to controler + + IFNE DragonAlpha ; Turn on drives & NMI + lbsr AlphaDskCtl + ELSE + sta >DskCtl + ENDC + + rts + + +* Restore saved iO states of peripherals. +RestoreSavedIO + lda >DrivSel,u ; Deselect drives, but leave motor on + ora #MotorOn + + IFNE DragonAlpha ; Turn off drives & NMI + lbsr AlphaDskCtl + ELSE + sta >DskCtl + ENDC + + lda >SavePIA0CRB,u ; Recover PIA0 state + sta <DPPia0CRB + lda <DPPIACRB ; Recover ACIA state + anda #$FC + sta <DPPIACRB ; Disable Drive FIRQ source. + lda >SaveACIACmd,u + sta <DPAciaCmd + rts + +* Write +* +* Entry: +* B = MSB of the disk's LSN +* X = LSB of the disk's LSN +* Y = address of path descriptor +* U = address of device memory area +* +* Exit: +* CC = carry set on error +* B = error code +* +Write lda #$91 ; Retry byte +L0124 pshs x,b,a + bsr DoWrite ; Attempt to do write + puls x,b,a + bcs WriteDataRetry ; On error, retry + tst <PD.Vfy,y ; Written, should we verify ? + bne WriteDone ; no : return + lbsr WriteVerify ; yes : verify write + bcs WriteDataRetry ; verify error, retry write +WriteDone + clrb ; Return status ok + rts + +WriteDataRetry + lsra ; Retry data write + lbeq RetWriteError ; All retries exhausted ?, return error + bcc L0124 + pshs x,b,a ; Reset to track 0 + lbsr ResetTrack0 + puls x,b,a + bra L0124 + +DoWrite lbsr SeekTrack ; Seek to correct track & sector + lbcs L008C + ldx PD.Buf,y ; Get data buffer in X + pshs y,dp,cc + ldb #WritCmnd ; Write command +WriteTrackCmd + lbsr PrepDiskRW ; Prepare for disk r/w + lda ,x+ ; get byte to write +L015A ldb <DPPIACRB ; Ready to write ? + bmi WriteDataReady ; Yes, do it. + leay -1,y + bne L015A + bsr RestoreSavedIO ; Restore saved peripheral states + puls y,dp,cc + lbra RetWriteError ; Return write error + +WriteDataWait + lda ,x+ ; Get next byte to write + sync ; Wait for drive +WriteDataReady + sta <DPDataReg ; Write data to FDC + ldb <DPPIADB ; Clear pending FDC inturrupt + bra WriteDataWait + + +; The following block of code is needed for the Dragon Alpha, because +; we currently do not know how to disable it's NMI in hardware, +; So we check a flag here, and if set we simply return from inturrupt +; as if nothing happened ! + +NMIService + IFNE DragonAlpha + pshs cc ; Save flags + tst >NMIFlag,u ; Check NMI enable flag + bne DoNMI ; if enabled, continue with handler + puls cc ; else restore flags and return + RTI + +DoNMI puls cc ; restore flags + ENDC + +RealNMI + leas R$Size,s ; Drop regs from stack + bsr RestoreSavedIO ; Restore saved IO states + puls y,dp,cc + ldb >CmdReg + bitb #LostMask ; check for lost record + lbne RetReadError ; yes : return read error + lbra TestForError ; esle test for other errors + +; Verify a written sector. +WriteVerify pshs x,b,a + ldx PD.Buf,y ; Swap buffer pointers + pshs x + ldx >BuffPtr,u + stx PD.Buf,y + ldx 4,s + lbsr DoReadData ; Read data back in + puls x + stx PD.Buf,y ; Swab buffer pointers back + bcs VerifyEnd + lda #$20 + pshs u,y,a + ldy >BuffPtr,u + tfr x,u +VerifyLoop + ldx ,u ; Compare every 4th word + cmpx ,y + bne VerifyErrorEnd + leau 8,u + leay 8,y ; Increment pointers + dec ,s + bne VerifyLoop + bra VerifyEndOk ; Verify succeeded. +VerifyErrorEnd + orcc #Carry ; Flag error +VerifyEndOk + puls u,y,a +VerifyEnd + puls pc,x,b,a + +; Seek to a track +SeekTrack + CLR >Settle,U ; default no settle + LBSR SelectDrive ; select and start correct d + TSTB + BNE E.Sect + + clr >SideSel,u ; Make sure old sidesel cleared. + + TFR X,D + LDX >CDrvTab,U + CMPD #0 ; Skip calculation of track 0 + BEQ SeekT1 + CMPD 1,X ; Has an illegal LSN been + BLO SeekT2 +E.Sect COMB + LDB #E$Sect + RTS + +SeekT2 CLR ,-S ; Calculate track number + SUBD PD.T0S,Y ; subtract no. of sectors in track 0 + BHS SeekT4 + ADDB PD.T0S+1,Y ; if -ve we are on track 0, so add back on again + BRA SeekT3 +SeekT4 INC ,S + SUBD DD.Spt,X ; sectors per track for rest of disk + BHS SeekT4 ; repeat, until -ve, incrementing track count + ADDB DD.Spt+1,X ; re add sectors/track to get sector number on track + +; At this point the byte on the top of the stack contains the track +; number, and D contains the sector number on that track. + +SeekT3 PULS A ; retrieve track count + LBSR SetWPC ; set write precompensation + PSHS B + LDB DD.Fmt,X ; Is the media double sided ? + LSRB + BCC SeekT9 ; skip if not + LDB PD.Sid,Y ; Is the drive double sided ? + DECB + BNE SetupSideMask ; yes : deal with it. + PULS B ; No then its an error + COMB + LDB #E$BTyp + RTS + +;SeekT10 LSRA ; Media & drive are double sided +; BCC SeekT9 +; BSR SetSide +SetupSideMask + BSR SetSide ; we must always do this to ensure + BRA SeekT9 + +SingleSidedDisk + clr >SideSel,U ; Single sided, make sure sidesel set correctly + +SeekT1 PSHS B +SeekT9 LDB PD.Typ,Y ; Dragon and Coco disks + BITB #TYP.SBO ; count sectors from 1 no + BNE SeekT8 + PULS B + INCB ; so increment sector number + BRA SeekT11 +SeekT8 PULS B ; Count from 0 for other types + +SeekT11 STB >SecReg ; Write sector number to controler + LBSR Delay + CMPB >SecReg + BNE SeekT11 + +SeekTS LDB <V.Trak,X ; Entry point for SS.WTrk command + STB >TrkReg + TST >Settle,U ; If settle has been flagged then wait for settle + BNE SeekT5 + CMPA <V.Trak,X ; otherwise check if this is + BEQ SeekT6 ; track number to the last + +SeekT5 STA <V.Trak,X ; Do the seek + STA >DataReg ; Write track no to controler + LDB #SeekCmnd + ORB PD.Stp,Y ; Set Step Rate according to Parameter block + LBSR FDCCommand + PSHS X + LDX #$222E ; Wait for head to settle +SeekT7 LEAX -1,X + BNE SeekT7 + PULS X + +SeekT6 CLRB ; return no error to caller + RTS + +; Set Side2 Mask +; A contains the track number on entry +SetSide PSHS A + LSRA ; Get bit 0 into carry + BCC Side1 ; Side 1 if even track no. + LDA #Sid2Sel ; Odd track no. so side 2 + BRA Side +Side1 CLRA +Side STA >SideSel,U + PULS A,PC + +SelectDrive + lbsr StartMotor ; Start motor + lda <PD.Drv,y ; Check it's a valid drive + cmpa #MaxDrv + bcs SelectDriveValid ; yes : continue + +RetErrorBadUnit + comb ; Return bad unit error + ldb #E$Unit + rts + +SelectDriveValid + pshs x,b,a ; Unit valid so slect it + sta >DrivSel,u ; Get DD table address + leax DrvBeg,u ; Calculate offset into table + ldb #DrvMem + mul + leax d,x + cmpx >CDrvTab,u + beq SelectDriveEnd + stx >CDrvTab,u ; Force seek if different drive + com >Settle,u +SelectDriveEnd + puls pc,x,b,a + +; Analise device status return. +TestForError + bitb #ErrMask + beq TestErrorEnd + bitb #NotRMask ; not ready + bne RetErrorNotReady + bitb #WPMask ; Write protect + bne RetErrorWP + bitb #RTypMask ; Wrong type ? + bne RetWriteError + bitb #RNFMask ; Record Not found + bne RetErrorSeek + bitb #CRCMask + bne RetErrorCRC +TestErrorEnd + clrb + rts + +; Return error code +RetErrorNotReady + comb + ldb #E$NotRdy + rts +RetErrorWP + comb + ldb #E$WP + rts +RetWriteError + comb + ldb #E$Write + rts +RetErrorSeek + comb + ldb #E$Seek + rts +RetErrorCRC + comb + ldb #E$CRC + rts +RetReadError + comb + ldb #E$Read + rts + +; Issue a command to FDC and wait till it's ready +FDCCommand + bsr FDCCmd +FDCCmdWait + ldb >CmdReg ; Poll until not busy + bitb #$01 + beq Delay3 + lda #$F0 + sta >D.DskTmr ;>$006F + bra FDCCmdWait + +FDCCmdMotorOn + lda #MotorOn ; Turn on motor + ora >DrivSel,u + + IFNE DragonAlpha + lbsr AlphaDskCtl + ELSE + sta >DskCtl + ENDC + + stb >CmdReg ; Send Command to FDC + rts + +FDCCmd + bsr FDCCmdMotorOn + +; Delay routine ! +Delay lbsr Delay2 +Delay2 lbsr Delay3 +Delay3 rts + +* SetStat +* +* Entry: +* A = function code +* Y = address of path descriptor +* U = address of device memory area +* +* Exit: +* CC = carry set on error +* B = error code +* +SetStat ldx PD.Rgs,y ; Retrieve request + ldb R$B,x + cmpb #SS.Reset ; dispatch valid ones + beq ResetTrack0 + cmpb #SS.Wtrk + beq L02C2 + comb + ldb #E$UnkSvc +SetStatEnd + rts + +; Write track +L02C2 lbsr SelectDrive ; Select drive + lda R$Y+1,x + LSRA + LBSR SetSide ; Set Side 2 if appropriate + LDA R$U+1,X + BSR SetWPC ; Set WPC by disk type + +L02D5 ldx >CDrvTab,u + lbsr SeekTS ; Move to correct track + bcs SetStatEnd + ldx PD.Rgs,y + ldx R$X,x + ldb #WtTkCmnd + pshs y,dp,cc + lbra WriteTrackCmd + +; Reset track 0 +ResetTrack0 + lbsr SelectDrive ; Select drive + ldx >CDrvTab,u + clr <V.Trak,x ; Set current track as 0 + lda #$05 +ResetTrack0Loop + ldb #StpICmnd ; Step away from track 0 5 times + pshs a + lbsr FDCCommand + puls a + deca + bne ResetTrack0Loop + ldb #RestCmnd ; Now issue a restore + bra FDCCommand + +;Start drive motors +StartMotor + pshs x,b,a + lda >D.DskTmr ; if timer = 0 then wait for motors to + bne SpinUp ; spin up + lda #MotorOn + + IFNE DragonAlpha + bsr AlphaDskCtl + ELSE + sta >DskCtl + ENDC + + ldx #$A000 +StartMotorLoop + nop + nop + leax -1,x + bne StartMotorLoop +SpinUp lda #$F0 ; Start external motor timer + sta >D.DskTmr ; external to driver + puls pc,x,b,a + +; Set Write Precompensation according to media type +SetWPC PSHS A,B + LDB PD.DNS,Y + BITB #T80Mask ; Is it 96 tpi drive + BNE SetWP1 + ASLA ; no then double +SetWP1 CMPA #32 ; WPC needed ? + BLS SetWP2 + LDA >DrivSel,U + ORA #WPCEn + STA >DrivSel,U +SetWP2 PULS A,B,PC + + + IFNE DragonAlpha + +; Translate DragonDos Drive select mechinisim to work on Alpha +; Takes byte that would be output to $FF48, reformats it and +; outputs to Alpha AY-8912's IO port, which is connected to +; Drive selects, motor on and enable precomp. +; Also sets NMIFlag. + +AlphaDskCtlB + pshs A + tfr b,a + bsr AlphaDskCtl + puls A + rts + +AlphaDskCtl + PSHS A,B,CC + + anda #~DDenMask ; Dragon Alpha has DDen perminently enabled + + PSHS A + ANDA #NMIMask ; mak out nmi enable bit + sta >NMIFlag,u ; Save it for later use + + lda ,s + anda #EnpMask ; Extract enp mask + pshs a ; save it + + lda 1,s + ANDA #DSMask ; Mask Out drive select bits + +; Shift a bit in B left, a times, to convert drive number +; to DS bit. + + ldb #$01 +ShiftNext + cmpa #$00 ; Done all shifts ? + beq ShiftDone + lslb + deca + bra ShiftNext + +ShiftDone + lda 1,s + anda #MotorMask ; Extract motor bit + cmpa #MotorMask ; Motor on ? + beq MotorIsOn ; Yes leave it on. + + clrb ; No zero out DS bits + +MotorIsOn + ora ,s ; Recombine with ENP bit. + leas 1,s ; drop off stack + lsla + lsla + pshs b + ora ,s + leas 1,s + + pshs a ; Save motor/drive select state + ldb PIADA ; get BDIR/BC1/Rom select + andb #$FC ; Mask out BCDIR/BC1, so we don't change other bits + pshs b ; save mask + + lda #AYIOREG ; AY-8912 IO register + sta PIADB ; Output to PIA + orb #AYREGLatch ; Latch register to modify + stb PIADA + + clrb + orb ,s ; Restore saved bits + stb PIADA ; Idle AY + + lda 1,s ; Fetch saved Drive Selects + sta PIADB ; output to PIA + ldb #AYWriteReg ; Write value to latched register + orb ,s ; Restore saved bits + stb PIADA ; Set register + + clrb + orb ,s ; Restore saved bits + stb PIADA ; Idle AY + + leas 3,s ; drop saved bytes + + PULS A,B,CC + RTS + + ENDC + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/ddiskdesc.asm Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,71 @@ +******************************************************************** +* ddiskdesc - ddisk Device Descriptor Template +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* Converted rb1773 to ddisk for Dragon disks. +* ------------------------------------------------------------------ + + nam ddiskdesc + ttl ddisk Device Descriptor Template + +* Disassembled 98/08/23 17:09:41 by Disasm v1.6 (C) 1988 by RML + + ifp1 + use defsfile + endc + +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $00 + +DNum set 0 + IFNE D35 +Type set TYP.CCF+TYP.3 + ELSE +Type set TYP.CCF+TYP.5 + ENDC +Density set DNS.MFM +Step set STP.6ms +Cyls set 35 +Sides set 1 +Verify set 1 +SectTrk set 18 +SectTrk0 set 18 +Interlv set 2 +SAS set 8 + + mod eom,name,tylg,atrv,mgrnam,drvnam + + fcb DIR.!SHARE.!PEXEC.!PWRIT.!PREAD.!EXEC.!UPDAT. mode byte + fcb HW.Page extended controller address + fdb $FF40 physical controller address + fcb initsize-*-1 initalization table size + fcb DT.RBF device type:0=scf,1=rbf,2=pipe,3=scf + fcb DNum drive number + fcb Step step rate + fcb Type drive device type + fcb Density media density:0=single,1=double + fdb Cyls number of cylinders (tracks) + fcb Sides number of sides + fcb Verify verify disk writes:0=on + fdb SectTrk # of sectors per track + fdb SectTrk0 # of sectors per track (track 0) + fcb Interlv sector interleave factor + fcb SAS minimum size of sector allocation +initsize equ * + + IFNE DD +name fcs /DD/ + ELSE +name fcb 'D,'0+DNum+$80 + ENDC +mgrnam fcs /RBF/ +drvnam fcs /DDisk/ + + emod +eom equ * + end +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/makefile.dragon Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,207 @@ +include ../../rules.mak + +CLOCKELIM = -aRTCElim=1 +CLOCKDISTO2 = -aRTCDsto2=1 +CLOCKDISTO4 = -aRTCDsto4=1 +CLOCKBNB = -aRTCBB=1 +CLOCKSMART = -aRTCSmart=1 -aMPIFlag=1 +CLOCKHARRIS = -aRTCHarrs=1 +CLOCKCLOUD9 = -aRTCCloud9=1 +CLOCKSOFT = -aRTCSoft=1 +CLOCKMESSEMU = -aRTCMessEmu=1 +CLOCKJVEMU = -aRTCJVEmu=1 + +DEPENDS = ./makefile +TPB = $(3RDPARTY)/booters + +BOOTERS = boot_1773_6ms boot_1773_30ms \ + boot_burke boot_rampak boot_wd1002 boot_d64 boot_dalpha +BOOTTRACK = rel $(BOOTERS) rel_dalpha +KERNEL = krn krnp2 +SYSMODS = ioman init sysgo_dd sysgo_h0 +CLOCKS = clock_60hz clock_50hz \ + clock2_elim clock2_disto2 clock2_disto4 clock2_bnb \ + clock2_smart clock2_harris clock2_cloud9 clock2_soft \ + clock2_messemu clock2_jvemu clock_d64 + +RBF = rbf.mn \ + rb1773.dr rb1773_scii_ff74.dr rb1773_scii_ff58.dr \ + ddisk.dr adisk.dr \ + ddd0_35s.dd d0_35s.dd d1_35s.dd d2_35s.dd d3_35s.dd \ + ddd0_40d.dd d0_40d.dd d1_40d.dd d2_40d.dd \ + ddd0_80d.dd d0_80d.dd d1_80d.dd d2_80d.dd \ + ddd0_d64.dd d0_d64.dd d1_d64.dd d2_d64.dd d3_d64.dd + +SCF = scf.mn \ + sc6551.dr vrn.dr printer.dr sio.dr sspak.dr ccio.dr \ + co32.io co80.io \ + nil.dd p.dd pipe.dd ssp.dd kbvdio.dr \ + term_sio.dt term_sc6551.dt t1.dd t2_sc6551.dd t3_sc6551.dt \ + term32.dt term80.dt term_d64.dt t1_d64.dd p1_d64.dd + +PIPE = pipeman.mn \ + piper.dr \ + pipe.dd + +ALLOBJS = $(BOOTTRACK) $(KERNEL) $(SYSMODS) $(CLOCKS) $(RBF) $(SCF) $(PIPE) + +all: $(ALLOBJS) + +# Special cases + +# Kernel +krn krnp2: + $(CD) kernel; make $@ + $(CP) kernel/$@ . + +boot_1773_6ms: boot_1773.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=0 -aSTEP=0 + +boot_1773_30ms: boot_1773.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=0 -aSTEP=3 + +rb1773_scii_ff74.dr: rb1773.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aSCII=1 + +rb1773_scii_ff58.dr: rb1773.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aSCII=1 -aSCIIALT=1 + +boot_d64: boot_d64.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=0 -aSTEP=0 + +boot_dalpha: boot_d64.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=0 -aSTEP=0 -aDragonAlpha=1 + +# Clocks +clock_60hz: clock.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< -aPwrLnFrq=60 + +clock_50hz: clock.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< -aPwrLnFrq=50 + +clock2_bnb: clock2_ds1315.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< -aBNB=1 + +clock2_cloud9: clock2_ds1315.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< -aCLOUD9=1 + +# Floppy descriptors +SSDD35 = -aCyls=35 -aSides=1 -aSectTrk=18 -aSectTrk0=18 \ + -aInterlv=3 -aSAS=8 -aDensity=1 +SSDD40 = -aCyls=40 -aSides=1 -aSectTrk=18 -aSectTrk0=18 \ + -aInterlv=3 -aSAS=8 -aDensity=1 +DSDD40 = -aCyls=40 -aSides=2 -aSectTrk=18 -aSectTrk0=18 \ + -aInterlv=3 -aSAS=8 -aDensity=1 +DSDD80 = -aCyls=80 -aSides=2 -aSectTrk=18 -aSectTrk0=18 \ + -aInterlv=3 -aSAS=8 -aDensity=1 -aD35 + +ddd0_35s.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD35) -aDNum=0 -aDD=1 + +d0_35s.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD35) -aDNum=0 + +d1_35s.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD35) -aDNum=1 + +d2_35s.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD35) -aDNum=2 + +d3_35s.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD35) -aDNum=3 + +ddd0_40d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD40) -aDNum=0 -aDD=1 + +d0_40d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD40) -aDNum=0 + +d0_40s.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD40) -aDNum=0 + +d1_40d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD40) -aDNum=1 + +d2_40d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD40) -aDNum=2 + +ddd0_80d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD80) -aDNum=0 -aDD=1 + +d0_80d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD80) -aDNum=0 + +d1_80d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD80) -aDNum=1 + +d2_80d.dd: rb1773desc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD80) -aDNum=2 + +#Dragon 64 + +ddd0_d64.dd: ddiskdesc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD80) -aDNum=0 -aDD=1 + +d0_d64.dd: ddiskdesc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD80) -aDNum=0 + +d1_d64.dd: ddiskdesc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD80) -aDNum=1 + +d2_d64.dd: ddiskdesc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD80) -aDNum=2 + +d3_d64.dd: ddiskdesc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) $(SSDD80) -aDNum=3 + +adisk.dr: ddisk.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aDragonAlpha=1 + +rel: rel.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< -aDragon64=0 + +rel_dalpha: rel.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< -aDragon64=0 -aDragonAlpha=1 + + +sysgo_dd: sysgo.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< -aDD=1 + +sysgo_h0: sysgo.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< + +sysgo_d64: sysgo_d64.asm + $(AS) $(AFLAGS) $(ASOUT)$@ $< + +clean: + $(CD) kernel; make $@ + $(RM) $(ALLOBJS) + +showobjs: + @$(ECHO) $(ALLOBJS) + +showboottrack: + @$(ECHO) $(BOOTTRACK) + +showkernel: + @$(ECHO) $(KERNEL) + +showsysmods: + @$(ECHO) $(SYSMODS) + +showclocks: + @$(ECHO) $(CLOCKS) + +showrbf: + @$(ECHO) $(RBF) + +showscf: + @$(ECHO) $(SCF) + +showpipe: + @$(ECHO) $(PIPE) + +identify: + $(IDENT_SHORT) $(ALLOBJS) + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/p1_sc6551dragon.asm Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,52 @@ + nam P1 + ttl os9 device descriptor + +* Disassembled 1900/00/00 00:26:38 by Disasm v1.5 (C) 1988 by RML + + ifp1 +* use /dd/defs/os9defs + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $01 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $03 mode byte + fcb $FF extended controller address + fdb $FF04 physical controller address + fcb initsize-*-1 initilization table size + fcb $00 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $00 case:0=up&lower,1=upper only + fcb $00 backspace:0=bsp,1=bsp then sp & bsp + fcb $00 delete:0=bsp over line,1=return + fcb $00 echo:0=no echo + fcb $01 auto line feed:0=off + fcb $00 end of line null count + fcb $00 pause:0=no end of page pause + fcb $42 lines per page + fcb $00 backspace character + fcb $00 delete line character + fcb $00 end of record character + fcb $00 end of file character + fcb $00 reprint line character + fcb $00 duplicate last line character + fcb $00 pause character + fcb $00 interrupt character + fcb $00 quit character + fcb $00 backspace echo character + fcb $00 line overflow character (bell) + fcb $00 init value for dev ctl reg + fcb $03 baud rate + fdb name copy of descriptor name address + fcb $11 acia xon char + fcb $13 acia xoff char +initsize equ * +name equ * + fcs /P1/ +mgrnam equ * + fcs /scf/ +drvnam equ * + fcs /acia51/ + emod +eom equ * + end
--- a/level1/modules/rel.asm Thu Nov 11 22:02:24 2004 +0000 +++ b/level1/modules/rel.asm Thu Nov 11 22:08:01 2004 +0000 @@ -8,6 +8,9 @@ * ------------------------------------------------------------------ * 5r5 2003/07/31 Boisy G. Pitre * Back ported NitrOS-9 REL to OS-9 Level Two. +* 2004/11/09 P.Harvey-Smith +* Added code to flip Dragon Alpha into text mode on boot. +* nam REL ttl Relocation routine @@ -287,6 +290,16 @@ bne L262B sta 1,x + IFNE DragonAlpha + clr $ffc0 * Reset to text mode if Dragon Alpha + clr $ffc2 + clr $ffc4 + + lda $ff22 + anda #$07 + sta $ff22 + ENDC + * Clear VDG screen ldx #ScStart ldy #512
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/t1_d64.asm Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,52 @@ + nam T1 + ttl os9 device descriptor + +* Disassembled 1900/00/00 00:23:30 by Disasm v1.5 (C) 1988 by RML + + ifp1 +* use /dd/defs/os9defs + use defsfile + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $01 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $03 mode byte + fcb $FF extended controller address + fdb $FF04 physical controller address + fcb initsize-*-1 initilization table size + fcb $00 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $00 case:0=up&lower,1=upper only + fcb $01 backspace:0=bsp,1=bsp then sp & bsp + fcb $00 delete:0=bsp over line,1=return + fcb $01 echo:0=no echo + fcb $01 auto line feed:0=off + fcb $00 end of line null count + fcb $01 pause:0=no end of page pause + fcb $18 lines per page + fcb $08 backspace character + fcb $18 delete line character + fcb $0D end of record character + fcb $1B end of file character + fcb $04 reprint line character + fcb $01 duplicate last line character + fcb $17 pause character + fcb $03 interrupt character + fcb $05 quit character + fcb $08 backspace echo character + fcb $07 line overflow character (bell) + fcb $00 init value for dev ctl reg + fcb $03 baud rate + fdb name copy of descriptor name address + fcb $11 acia xon char + fcb $13 acia xoff char +initsize equ * +name equ * + fcs /T1/ +mgrnam equ * + fcs /scf/ +drvnam equ * + fcs /acia51/ + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/term_d64.asm Thu Nov 11 22:08:01 2004 +0000 @@ -0,0 +1,53 @@ + nam TERM + ttl os9 device descriptor + +* Disassembled 1900/00/00 00:18:24 by Disasm v1.5 (C) 1988 by RML + + ifp1 +* use /dd/defs/os9defs + use defsfile + use scfdefs + endc +tylg set Devic+Objct +atrv set ReEnt+rev +rev set $01 + mod eom,name,tylg,atrv,mgrnam,drvnam + fcb $03 mode byte + fcb $FF extended controller address + fdb $C000 physical controller address + fcb initsize-*-1 initilization table size + fcb $00 device type:0=scf,1=rbf,2=pipe,3=scf + fcb $01 case:0=up&lower,1=upper only + fcb $01 backspace:0=bsp,1=bsp then sp & bsp + fcb $00 delete:0=bsp over line,1=return + fcb $01 echo:0=no echo + fcb $01 auto line feed:0=off + fcb $00 end of line null count + fcb $01 pause:0=no end of page pause + fcb $10 lines per page + fcb $08 backspace character + fcb $18 delete line character + fcb $0D end of record character + fcb $1B end of file character + fcb $04 reprint line character + fcb $01 duplicate last line character + fcb $17 pause character + fcb $03 interrupt character + fcb $05 quit character + fcb $08 backspace echo character + fcb $07 line overflow character (bell) + fcb $00 init value for dev ctl reg + fcb $00 baud rate + fdb name copy of descriptor name address + fcb $00 acia xon char + fcb $00 acia xoff char +initsize equ * +name equ * + fcs /TERM/ +mgrnam equ * + fcs /SCF/ +drvnam equ * + fcs /KBVDIO/ + emod +eom equ * + end