changeset 1736:fd288a57f6ab

CO51 additions by Phill
author boisy
date Fri, 03 Dec 2004 01:00:21 +0000
parents 11f38ece79ef
children fdb0dde809d2
files defs/cciodefs level1/makefile level1/makefile.dalpha level1/makefile.dragon level1/modules/ccio.asm level1/modules/clock.asm level1/modules/co32.asm level1/modules/co80.asm level1/modules/makefile level1/modules/makefile.dragon level1/modules/term32.asm level1/modules/term80.asm
diffstat 12 files changed, 160 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/defs/cciodefs	Sun Nov 28 20:16:37 2004 +0000
+++ b/defs/cciodefs	Fri Dec 03 01:00:21 2004 +0000
@@ -10,7 +10,13 @@
 * Edt/Rev  YYYY/MM/DD  Modified by
 * Comment
 * ------------------------------------------------------------------
-
+*
+* 2004/11/29, P.Harvey-Smith.
+* Added symbolic defines for bits in V.CoLoad.
+*
+* 2004/12/02, P.Harvey-Smith.
+* moved over all variables from co51.asm
+*
          nam    CCIODefs
          ttl    CoCo 1/2 I/O Definitions
 
@@ -95,10 +101,34 @@
 V.GRFOE  rmb   2  GRFO entry point
 V.CO32E  rmb   2  CO32 entry point
 V.CO80E  rmb   2  CO80 entry point
+V.CO51E	 rmb   2  CO51 entry point
+;Co51 vars
+V.51ScrnA		rmb	2	; Screen address.
+V.51XPos		rmb	1	; X co-ordinate
+V.51YPos		rmb	1	; Y co-ordinate
+V.51EscSeq		rmb	1	; In escape sequence
+V.51ReverseFlag		rmb	1	; Reverse video flag
+V.51UnderlineFlag	rmb	1	; Underline flag
+V.51CtrlDispatch	rmb	2	; Ctrl char dispatch address, currently processing
+
+; I'm not sure what these do (yet).
+
+V.5126    rmb   1
+V.5130    rmb   1
+V.5131    rmb   1
+V.5132    rmb   1
+V.5133    rmb   1
+V.5134    rmb   1
+V.5135    rmb   1
+V.5136    rmb   1
+; End of c051 vars
+; **** Note these have to come at the end of the defs, or the keyboard ****
+; **** code can clobber variables defined after these !                ****
 V.IBufH  rmb   1  input buffer head
 V.IBufT  rmb   1  input buffer tail
 V.InBuf  rmb   1  input buffer tail
-         rmb   250-.
+V.51End	rmb	1
+	rmb   250-.
 V.Last   equ   .
 
 
@@ -115,5 +145,13 @@
 *VD.Palet rmb   16 (16) current palette values
 *VD.PlFlg rmb   1  initialized to $08 by L00DB, and then unused!
 
+;
+; Defs for V.COLoad flags.
+; 
+
+ModCo32	equ	%00000010	; Co32, normal VDG 32x16.
+ModCo80	equ	%00000100	; Co80, wordpak rs, 80x25
+ModCo51 equ	%00001000	; Co51, pmode 4 51x25 text
+
          ENDC
 
--- a/level1/makefile	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/makefile	Fri Dec 03 01:00:21 2004 +0000
@@ -1,8 +1,10 @@
 include ../rules.mak
 
 RELEASE		= nos96809l1v030205
-BOOTFILE	= bootfiles/bootfile
-BOOTFILE_DS80	= bootfiles/bootfile_ds80
+BOOTFILE_CO32	= bootfiles/bootfile_co51
+BOOTFILE_CO51	= bootfiles/bootfile_co51
+BOOTFILE_CO80	= bootfiles/bootfile_co51
+BOOTFILE_CO32_DS80	= bootfiles/bootfile_co32_ds80
 KERNELFILE	= bootfiles/kernel_1773
 DIRS		= cmds modules defs sys bootfiles
 
@@ -60,7 +62,7 @@
 $(DSK360K_1):
 	$(RM) $@
 	$(OS9FORMAT_DS40) -q $@ -n"NitrOS-9/6809 Level 1 Disk 1"
-	$(OS9GEN) $@ -b=$(BOOTFILE) -t=$(KERNELFILE)
+	$(OS9GEN) $@ -b=$(BOOTFILE_CO32) -t=$(KERNELFILE)
 	$(MAKDIR) $@,CMDS
 	$(MAKDIR) $@,SYS
 	$(CD) cmds; $(CP) $(CMDS) ../$@,CMDS
@@ -113,7 +115,7 @@
 $(DSK720K):
 	$(RM) $@
 	$(OS9FORMAT_DS80) -q $@ -n"NitrOS-9/6809 Level 1"
-	$(OS9GEN) $@ -b=$(BOOTFILE_DS80) -t=$(KERNELFILE)
+	$(OS9GEN) $@ -b=$(BOOTFILE_CO32_DS80) -t=$(KERNELFILE)
 	$(MAKDIR) $@,CMDS
 	$(MAKDIR) $@,SYS
 	$(MAKDIR) $@,DEFS
--- a/level1/makefile.dalpha	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/makefile.dalpha	Fri Dec 03 01:00:21 2004 +0000
@@ -1,8 +1,10 @@
 include ../rules.mak
 
+# TERMWIDTH can be either 32 or 51
+TERMWIDTH	= 51
 RELEASE		= nos96809l1v030204_dalpha
-BOOTFILE	= bootfiles/bootfile_dalpha
-BOOTFILE_DS80	= bootfiles/bootfile_dalpha
+BOOTFILE	= bootfiles/bootfile_dalpha_$(TERMWIDTH)
+BOOTFILE_DS80	= bootfiles/bootfile_dalpha_$(TERMWIDTH)
 KERNELFILE	= bootfiles/kernel_dalpha
 DIRS		= cmds modules defs sys bootfiles
 DDIRS		= modules bootfiles
--- a/level1/makefile.dragon	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/makefile.dragon	Fri Dec 03 01:00:21 2004 +0000
@@ -1,8 +1,10 @@
 include ../rules.mak
 
+# TERMWIDTH can be either 32 or 51
+TERMWIDTH	= 51
 RELEASE		= nos96809l1v030204_dragon
-BOOTFILE	= bootfiles/bootfile_d64
-BOOTFILE_DS80	= bootfiles/bootfile_d64
+BOOTFILE	= bootfiles/bootfile_d64_$(TERMWIDTH)
+BOOTFILE_DS80	= bootfiles/bootfile_d64_$(TERMWIDTH)
 KERNELFILE	= bootfiles/kernel_d64
 DIRS		= cmds defs sys 
 #modules bootfiles
@@ -17,12 +19,12 @@
 KERNEL		= $(shell $(CD) modules; make -f makefile.dragon showkernel)
 SYSMODS		= $(shell $(CD) modules; make -f makefile.dragon showsysmods)
 CLOCKS		= $(shell $(CD) modules; make -f makefile.dragon showclocks)
-RBF			= $(shell $(CD) modules; make -f makefile.dragon showrbf)
-SCF			= $(shell $(CD) modules; make -f makefile.dragon showscf)
+RBF		= $(shell $(CD) modules; make -f makefile.dragon showrbf)
+SCF		= $(shell $(CD) modules; make -f makefile.dragon showscf)
 PIPE		= $(shell $(CD) modules; make -f makefile.dragon showpipe)
 MODULECMDS	= $(WHICHSHELL) del echo format makdir merge os9gen prompt tmode
 
-SYS			= $(shell $(CD) sys; make showobjs)
+SYS		= $(shell $(CD) sys; make showobjs)
 DEFS		= $(shell $(CD) defs; make showobjs)
 ROOTFILES	= 
 STARTUP		= startup.dragon
--- a/level1/modules/ccio.asm	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/ccio.asm	Fri Dec 03 01:00:21 2004 +0000
@@ -15,6 +15,12 @@
 * 2004/11/28, P.Harvey-Smith.
 * Added code to remap Dragon keyboard inputs to CoCo format.
 *
+* 2004/12/02, P.Harvey-Smith.
+* Changed the way that the entry points for the co?? drivers are
+* called, so that we can have up to 7 different drivers.
+* Integrated changes needed for the co51 driver from Dragon Data
+* OS-9.
+*
 
          nam   CCIO
          ttl   OS-9 Level One V2 CoCo I/O driver
@@ -56,10 +62,17 @@
 *    CC = carry set on error
 *    B  = error code
 *
-Init     stu   >D.KbdSta	store devmem ptr
+Init    pshs	y
+	ldy	#$aa55
+	ldy	#V.5136
+	ldy	#V.51End
+	puls	y
+	
+	stu   >D.KbdSta	store devmem ptr
          clra			clear A
          leax  <V.SCF,u		point to memory after V.SCF
-         ldb   #$5D		get counter
+;         ldb   #$5D		get counter
+	 ldb	#V.51End-V.SCF
 L002E    sta   ,x+		clear mem
          decb			decrement counter
          bne   L002E		continue if more
@@ -77,7 +90,7 @@
          leax  >XY2Addr,pcr	get address of XY2Addr
          stx   <V.CnvVct,u
          ldd   <IT.PAR,y	get parity and baud
-         lbra  L05CE		process them
+         lbra  SetupTerm		process them
 
 * Term
 *
@@ -105,15 +118,19 @@
 *    CC = carry set on error
 *    B  = error code
 *
-Read     leax  <V.InBuf,u	point X to input buffer
-         ldb   <V.IBufT,u	get tail pointer
+Read    pshs	y
+	ldy	#$aa57
+	puls	y
+
+	leax   V.InBuf,u		point X to input buffer
+         ldb   V.IBufT,u	get tail pointer
          orcc  #IRQMask		mask IRQ
-         cmpb  <V.IBufH,u	same as head pointer
+         cmpb  V.IBufH,u	same as head pointer
          beq   Put2Bed		if so, buffer is empty, branch to sleep
          abx			X now points to curr char
          lda   ,x		get char
          bsr   L009D		check for tail wrap
-         stb   <V.IBufT,u	store updated tail
+         stb   V.IBufT,u	store updated tail
          andcc #^(IRQMask+Carry)	unmask IRQ
          rts
 
@@ -199,13 +216,13 @@
          bne   L0105
          ldb   #60
 L011A    stb   <V.ClkCnt,u
-         ldb   <V.IBufH,u	get head pointer in B
-         leax  <V.InBuf,u	point X to input buffer
+         ldb   V.IBufH,u	get head pointer in B
+         leax  V.InBuf,u	point X to input buffer
          abx			X now holds address of head
          lbsr  L009D		check for tail wrap
-         cmpb  <V.IBufT,u	B at tail?
+         cmpb  V.IBufT,u	B at tail?
          beq   L012F		branch if so
-         stb   <V.IBufH,u
+         stb   V.IBufH,u
 L012F    sta   ,x		store our char at ,X
          beq   WakeIt		if nul, do wake-up
          cmpa  V.PCHR,u		pause character?
@@ -558,8 +575,12 @@
 * Here we call the CO-module to write the character
 GoCo     lda   <V.CurCo,u	get CO32/CO80 flag
 CoWrite  ldb   #$03		we want to write
+
 CallCO   leax  <V.GRFOE,u	get base pointer to CO-entries
-         ldx   a,x		get pointer to CO32/CO80
+	 pshs	a
+	 lbsr	GetModOffset	; Get offset
+	 ldx   a,x		get pointer to CO32/CO80
+	 puls	a
          beq   NoIOMod		branch if no module
          lda   <V.WrChr,u	get character to write
 L039D    jmp   b,x		call i/o subroutine
@@ -632,9 +653,10 @@
          clrb
          puls  pc,x
 
-GRFO     fcs   /GRFO/
-CO32     fcs   /CO32/
-CO80     fcs   /CO80/
+GRFO    fcs  	/GRFO/
+CO32    fcs   	/CO32/
+CO80    fcs   	/CO80/
+CO51	fcs	/CO51/
 
 * GetStat
 *
@@ -650,8 +672,8 @@
 GetStat  sta   <V.WrChr,u	save off stat code
          cmpa  #SS.Ready	ready call?
          bne   L0439		branch if not
-         lda   <V.IBufT,u	get buff tail ptr
-         suba  <V.IBufH,u	num of chars ready in A
+         lda   V.IBufT,u	get buff tail ptr
+         suba  V.IBufH,u	num of chars ready in A
          lbeq  NotReady		branch if empty
 SSEOF    clrb	
          rts
@@ -882,32 +904,47 @@
          rts
 
 SSCOMST  ldd   R$Y,x		Get caller's Y
-L05CE    bita  #$02		CO80?
-         bne   GoCO80		branch if so
+SetupTerm    
+	 bita  #ModCo32		CO80?
+         beq   GoCO80		branch if so
          ldb   #$10		assume true lower case TRUE
          bita  #$01		true lowercase bit set?
          bne   GoCO32		branch if so
          clrb			true lower case FALSE
+	 
 GoCO32   stb   <V.CFlag,u	save flag for later
-         lda   #$02		CO32 is loaded bit
+         lda   #ModCo32		CO32 is loaded bit
          ldx   #$2010		32x16
          pshs  u,y,x,a
          leax  >CO32,pcr
-         bra   L05F4
-GoCO80   lda   #$04		'CO80 is loaded' bit
-         ldx   #$5018		80x24
-         pshs  u,y,x,a
-         leax  >CO80,pcr
-L05F4    bsr   L0601		load CO-module if not already loaded
-         puls  u,y,x,a
-         bcs   L0600
-         stx   <V.Col,u	save screen size
-         sta   <V.CurCo,u	current module in use? ($02=CO32, $04=C080)
-L0600    rts
-L0601    bita  <V.COLoad,u	module loaded?
+         bra   SetupCoModule
+	 
+GoCO80  bita	#ModCo80	; Co80 needed ?
+	beq	GoCO51
+	lda   	#ModCO80	'CO80 is loaded' bit
+        ldx   	#$5018		80x24
+        pshs  	u,y,x,a
+        leax  	>CO80,pcr
+	 
+SetupCoModule    
+	bsr   	LoadCoModule	load CO-module if not already loaded
+        puls  	u,y,x,a
+        bcs   	L0600
+        stx   	<V.Col,u	save screen size
+        sta   	<V.CurCo,u	current module in use? ($02=CO32, $04=C080)
+L0600   rts
+
+GOCo51	ldx   	#$3318		51x24
+        pshs  	u,y,x,a
+        leax  	>CO51,pcr
+	bra	SetupCoModule
+
+LoadCoModule    
+	bita  <V.COLoad,u	module loaded?
          beq   L0608		branch if not
 L0606    clrb			else clear carry
          rts			and return
+	 
 L0608    pshs  y,x,a
          lbsr  LinkSub
          bcc   L061F		branch if link was successful
@@ -919,12 +956,33 @@
          puls  y,x,a
          lbra  NoIOMod
 L061F    leax  <V.GRFOE,u	get base pointer to CO-entries
-         lda   ,s		get A off stack
-         sty   a,x		save off CO32/CO80 entry point
+	lda	,s
+	bsr	GetModOffset	; Get offset in table
+	sty	a,x		; Save address
+
          puls  y,x,a
          ldb   #$00		CO-module init offset
          lbra  CallCO		call it
 
+;
+; Get module offset from V.GRFOE into A reg.
+; I had to do this because the previous system would only work
+; properly for 2 entries !
+;
+
+GetModOffset
+	pshs	b
+	clrb			; Calculate address offset 
+AddrFind
+	bita	#$01		; Done all shifts ?
+	bne	AddrDone
+	addb	#$2		; increment addr offset ptr
+	lsra
+	bra	AddrFind	; Test again
+AddrDone
+	tfr	b,a		; output in a
+	puls	b,pc
+
 * Link to subroutine
 LinkSub  pshs  u
          lda   #Systm+Objct
--- a/level1/modules/clock.asm	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/clock.asm	Fri Dec 03 01:00:21 2004 +0000
@@ -116,10 +116,6 @@
 Clock2	fcs	"Clock2"
 		
 Init
-	pshs	y
-	ldy	#$aa55
-	puls	y
-	
 	ifeq	Level-1
 	pshs	dp,cc		save DP and CC
 	clra	
--- a/level1/modules/co32.asm	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/co32.asm	Fri Dec 03 01:00:21 2004 +0000
@@ -48,7 +48,7 @@
          os9   F$SRtMem 	return to system
          puls  u		restore U
          ldb   <V.COLoad,u
-         andb  #$FD
+         andb  #~ModCo32
          bra   L0086
 * Init
 Init     pshs  y,x		save regs
@@ -82,7 +82,7 @@
          sta   <V.Chr1,u	only referenced here ??
          lbsr  ClrScrn		clear the screen
          ldb   <V.COLoad,u
-         orb   #$02		set to CO32 found (?)
+         orb   #ModCo32		set to CO32 found (?)
 L0086    stb   <V.COLoad,u
          clrb  
          puls  pc,y,x
--- a/level1/modules/co80.asm	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/co80.asm	Fri Dec 03 01:00:21 2004 +0000
@@ -59,11 +59,11 @@
          ldd   #$07D0
          lbsr  L0189
          ldb   <V.COLoad,u
-         orb   #$04
+         orb   #ModCo80
          bra   L004F
 * Term
 Term     ldb   <V.COLoad,u
-         andb  #$FB
+         andb  #~ModCo80
 L004F    stb   <V.COLoad,u
          clrb  
          rts   
--- a/level1/modules/makefile	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/makefile	Fri Dec 03 01:00:21 2004 +0000
@@ -32,10 +32,10 @@
 
 SCF		= scf.mn \
 		sc6551.dr vrn.dr printer.dr sio.dr sspak.dr ccio.dr \
-		co32.io co80.io \
+		co32.io co51.io co80.io \
 		nil.dd p.dd pipe.dd ssp.dd \
 		term_sio.dt term_sc6551.dt t1.dd t2_sc6551.dd t3_sc6551.dt \
-		term32.dt term80.dt
+		term32.dt term51.dt term80.dt
 
 PIPE		= pipeman.mn \
 		piper.dr \
--- a/level1/modules/makefile.dragon	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/makefile.dragon	Fri Dec 03 01:00:21 2004 +0000
@@ -33,7 +33,7 @@
 		
 SCF		= scf.mn \
 		sc6551.dr vrn.dr printer.dr sio.dr sspak.dr dgnio.dr \
-		co32.io co80.io \
+		co32.io co80.io co51.io\
 		nil.dd p.dd pipe.dd ssp.dd kbvdio.dr akbvdio.dr \
 		drvr51.dr adrvr51.dr \
 		term_sio.dt term_sc6551.dt t1.dd t2_sc6551.dd t3_sc6551.dt \
--- a/level1/modules/term32.asm	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/term32.asm	Fri Dec 03 01:00:21 2004 +0000
@@ -17,6 +17,7 @@
          ifp1
          use   defsfile
          use   scfdefs
+	 use   cciodefs
          endc
 
 tylg     set   Devic+Objct   
@@ -49,7 +50,7 @@
          fcb   C$QUIT         quit character
          fcb   C$BSP          backspace echo character
          fcb   C$BELL         line overflow character (bell)
-         fcb   $00            init value for dev ctl reg
+         fcb   ModCo32        init value for dev ctl reg
          fcb   $00            baud rate
          fdb   name           copy of descriptor name address
          fcb   $00            acia xon char
--- a/level1/modules/term80.asm	Sun Nov 28 20:16:37 2004 +0000
+++ b/level1/modules/term80.asm	Fri Dec 03 01:00:21 2004 +0000
@@ -17,6 +17,7 @@
          ifp1
          use   defsfile
          use   scfdefs
+	 use   cciodefs
          endc
 
 tylg     set   Devic+Objct   
@@ -49,7 +50,7 @@
          fcb   C$QUIT         quit character
          fcb   C$BSP          backspace echo character
          fcb   C$BELL         line overflow character (bell)
-         fcb   $02            init value for dev ctl reg
+         fcb   ModCo80        init value for dev ctl reg
          fcb   $00            baud rate
          fdb   name           copy of descriptor name address
          fcb   $00            acia xon char