changeset 3207:8f5a6fe2d09e covga

Changes to accomodate CoVGA
author boisy@toughmac.com
date Tue, 17 Oct 2017 07:36:59 -0500
parents a938d0f26711
children fd4a2cfcf36b
files defs/cocovtio.d level1/coco1/bootfiles/makefile level1/coco1/makefile level1/coco1/modules/makefile level1/modules/covdg.asm level1/modules/term_vdg.asm level1/modules/vtio.asm
diffstat 7 files changed, 254 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/defs/cocovtio.d	Sat Oct 03 14:51:30 2015 -0500
+++ b/defs/cocovtio.d	Tue Oct 17 07:36:59 2017 -0500
@@ -108,8 +108,10 @@
 V.CoVDGE       RMB       2                   CoVDG entry point
 V.CoWPE        RMB       2                   CoWP entry point
 V.CoHRE        RMB       2                   CoHR entry point
+V.CoVGAE       RMB       2                   CoVGA entry point
 
 V.Flash        RMB       2                   Cursor flash routine address.
+v.FlashTime    RMB       1                   Cursor flash time
 v.FlashCount   RMB       1                   Cursor flash count
 V.NoFlash      RMB       1                   When this is non-zero do not flash cursor
 
@@ -161,6 +163,7 @@
 ModCoVDG       EQU       %00000010           CoVDG, Built-in VDG 32x16.
 ModCoWP        EQU       %00000100           CoWP, WordPak, 80x25
 ModCoHR        EQU       %00001000           CoHR, PMODE 4 51x25 text
+ModCoVGA       EQU       %00010000           CoVGA, 64x32 text
 
 *
 * Defs for cursor flash counter
--- a/level1/coco1/bootfiles/makefile	Sat Oct 03 14:51:30 2015 -0500
+++ b/level1/coco1/bootfiles/makefile	Tue Oct 17 07:36:59 2017 -0500
@@ -37,6 +37,7 @@
 VTIO_COVDG	= $(MD)/vtio.dr $(MD)/covdg.io $(MD)/term_vdg.dt
 VTIO_COHR	= $(MD)/vtio.dr $(MD)/cohr.io $(MD)/term_hr.dt
 VTIO_CO80	= $(MD)/vtio.dr $(MD)/co80.io $(MD)/term_80.dt
+VTIO_COVGA	= $(MD)/vtio.dr $(MD)/covga.io $(MD)/term_vga.dt
 PIPE		= $(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd
 CLOCK60HZ	= $(MD)/clock_60hz $(MD)/clock2_soft
 CLOCK60HZDW	= $(MD)/clock_60hz $(MD)/clock2_dw
@@ -102,6 +103,18 @@
 		$(CLOCK60HZ) \
 		$(MD)/sysgo_dd
 
+BOOTFILE_COVGA	= $(MD)/ioman \
+		$(MD)/rbf.mn \
+		$(FLOPPY_40D) \
+		$(MD)/ddd0_40d.dd \
+		$(MD)/scf.mn \
+		$(VTIO_COVGA) \
+		$(MD)/scbbp.dr $(MD)/p_scbbp.dd \
+		$(MD)/scbbt.dr $(MD)/t1_scbbt.dd \
+		$(PIPE) \
+		$(CLOCK60HZ) \
+		$(MD)/sysgo_dd
+
 BOOTFILE_DW_HEADLESS	= $(MD)/ioman \
 		$(MD)/rbf.mn \
 		$(RBDW) \
@@ -156,6 +169,21 @@
 		$(CLOCK60HZDW) \
 		$(MD)/sysgo_dd
 
+BOOTFILE_COVGA_DW	= $(MD)/ioman \
+		$(MD)/rbf.mn \
+		$(FLOPPY_40D) \
+		$(RBDW) \
+		$(MD)/ddx0.dd \
+		$(MD)/scf.mn \
+		$(VTIO_COVGA) \
+		$(MD)/scdwv.dr \
+		$(SCDWV_NET) \
+		$(SCDWV_WIN) \
+		$(SCDWP) \
+		$(PIPE) \
+		$(CLOCK60HZDW) \
+		$(MD)/sysgo_dd
+
 BOOTFILE_COVDG_DW_GAME	= $(MD)/ioman \
 		$(MD)/rbf.mn \
 		$(RBDW) \
@@ -310,6 +338,7 @@
 		$(MD)/sysgo_dd
 
 BOOTFILES	= bootfile_covdg bootfile_cohr bootfile_covdg_dw \
+		bootfile_covga_dw \
 		bootfile_dw_headless bootfile_covdg_becker \
 		bootfile_covdg_becker_game bootfile_covdg_dw_game \
 		bootfile_covdg_cocosdc bootfile_covdg_cocosdc_game \
@@ -348,6 +377,9 @@
 bootfile_covdg_dw: $(BOOTFILE_COVDG_DW) $(DEPENDS)
 	$(MERGE) $(BOOTFILE_COVDG_DW)>$@
 
+bootfile_covga_dw: $(BOOTFILE_COVGA_DW) $(DEPENDS)
+	$(MERGE) $(BOOTFILE_COVGA_DW)>$@
+
 bootfile_covdg_dw_game: $(BOOTFILE_COVDG_DW_GAME) $(DEPENDS)
 	$(MERGE) $(BOOTFILE_COVDG_DW_GAME)>$@
 
--- a/level1/coco1/makefile	Sat Oct 03 14:51:30 2015 -0500
+++ b/level1/coco1/makefile	Tue Oct 17 07:36:59 2017 -0500
@@ -8,12 +8,14 @@
 DISTRONAME	= nos9$(CPU)l$(LEVEL)
 DISTROVER	= $(DISTRONAME)$(NITROS9VER)$(PORT)
 BOOTFILE_COVDG	= bootfiles/bootfile_covdg
+BOOTFILE_COVGA	= bootfiles/bootfile_covga
 BOOTFILE_COHR	= bootfiles/bootfile_cohr
 BOOTFILE_COVDG_DS80	= bootfiles/bootfile_covdg_ds80
 BOOTFILE_DW_HEADLESS	= bootfiles/bootfile_dw_headless
 BOOTFILE_BECKER_HEADLESS	= bootfiles/bootfile_becker_headless
 BOOTFILE_ARDUINO_HEADLESS	= bootfiles/bootfile_arduino_headless
 BOOTFILE_COVDG_DW	= bootfiles/bootfile_covdg_dw
+BOOTFILE_COVGA_DW	= bootfiles/bootfile_covga_dw
 BOOTFILE_COVDG_BECKER	= bootfiles/bootfile_covdg_becker
 BOOTFILE_COVDG_ARDUINO	= bootfiles/bootfile_covdg_arduino
 BOOTFILE_COVDG_COCOSDC	= bootfiles/bootfile_covdg_cocosdc
@@ -49,6 +51,7 @@
 
 PACKAGENAME	 = $(DISTROVER).zip
 DSKDW           = $(DISTROVER)_dw.dsk
+DSKDW_VGA       = $(DISTROVER)_vga_dw.dsk
 LDSKDW          = $(DISTRONAME)$(PORT)_dw.dsk
 DSKDWHEADLESS   = $(DISTROVER)_dw_headless.dsk
 LDSKDWHEADLESS  = $(DISTRONAME)$(PORT)_dw_headless.dsk
@@ -69,7 +72,7 @@
 DSKCOCOSDC	= $(DISTROVER)_cocosdc.dsk
 LDSKCOCOSDC	= $(DISTRONAME)$(PORT)_cocosdc.dsk
 
-DSKS		= $(DSKDW) $(DSKDWHEADLESS) $(DSKBECKER) $(DSKBECKERHEADLESS) \
+DSKS		= $(DSKDW) $(DSKDW_VGA) $(DSKDWHEADLESS) $(DSKBECKER) $(DSKBECKERHEADLESS) \
 		$(DSKARDUINO) $(DSKARDUINOHEADLESS) $(DSK360K_1) $(DSK360K_2) \
 		$(DSK720K) $(DSKCOCOSDC)
 LDSKS		= $(LDSKDW) $(LDSKDWHEADLESS) $(LDSKBECKER) $(LDSKBECKERHEADLESS) \
@@ -157,6 +160,60 @@
 	$(RM) $(LDSKDW)
 	$(SOFTLINK) $@ $(LDSKDW)
 
+$(DSKDW_VGA):
+	$(RM) $@
+	$(OS9FORMAT_DW) -q $@ -n"NitrOS-9/$(CPU) Level $(LEVEL)"
+	$(OS9GEN) $@ -b=$(BOOTFILE_COVGA_DW) -t=$(KERNELFILE_DW)
+	$(MAKDIR) $@,CMDS
+	$(MAKDIR) $@,SYS
+	$(MAKDIR) $@,DEFS
+	$(MAKDIR) $@,WWWROOT
+	$(CD) cmds; $(OS9COPY) $(sort $(CMDS_DW) $(CMDS_D2)) ../$@,CMDS
+	$(OS9ATTR_EXEC) $(foreach file,$(sort $(CMDS_DW) $(CMDS_D2)),$@,CMDS/$(file))
+	$(OS9RENAME) $@,CMDS/$(WHICHSHELL) shell
+	$(CD) sys; $(CPL) $(SYS) ../$@,SYS
+	$(OS9ATTR_TEXT) $(foreach file,$(SYS),$@,SYS/$(file))
+	$(CD) wwwroot; $(OS9COPY) $(WWWROOT) ../$@,WWWROOT
+	$(OS9ATTR_TEXT) $(foreach file,$(WWWROOT),$@,WWWROOT/$(file))
+	$(CD) defs; $(CPL) $(DEFS) ../$@,DEFS
+	$(OS9ATTR_TEXT) $(foreach file,$(DEFS),$@,DEFS/$(file))
+	$(CPL) $(STARTUP_DW) $@,startup
+	$(OS9ATTR_TEXT) $@,startup
+	$(MAKDIR) $@,NITROS9
+	$(MAKDIR) $@,NITROS9/$(DISTRO)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/CMDS
+	$(CD) cmds; $(OS9COPY) $(MODULECMDS) ../$@,NITROS9/$(DISTRO)/CMDS
+	$(OS9ATTR_EXEC) $(foreach file,$(MODULECMDS),$@,NITROS9/$(DISTRO)/CMDS/$(file))
+	$(OS9RENAME) $@,NITROS9/$(DISTRO)/CMDS/$(WHICHSHELL) shell
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/BOOTTRACK
+	$(CD) modules; $(OS9COPY) $(BOOTTRACK) ../$@,NITROS9/$(DISTRO)/MODULES/BOOTTRACK
+	$(OS9ATTR_EXEC) $(foreach file,$(BOOTTRACK),$@,NITROS9/$(DISTRO)/MODULES/BOOTTRACK/$(file))
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/KERNEL
+	$(CD) modules; $(OS9COPY) $(KERNEL) ../$@,NITROS9/$(DISTRO)/MODULES/KERNEL
+	$(OS9ATTR_EXEC) $(foreach file,$(KERNEL),$@,NITROS9/$(DISTRO)/MODULES/KERNEL/$(file))
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/SYSMODS
+	$(CD) modules; $(OS9COPY) $(SYSMODS) ../$@,NITROS9/$(DISTRO)/MODULES/SYSMODS
+	$(OS9ATTR_EXEC) $(foreach file,$(SYSMODS),$@,NITROS9/$(DISTRO)/MODULES/SYSMODS/$(file))
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/CLOCKS
+	$(CD) modules; $(OS9COPY) $(CLOCKS) ../$@,NITROS9/$(DISTRO)/MODULES/CLOCKS
+	$(OS9ATTR_EXEC) $(foreach file,$(CLOCKS),$@,NITROS9/$(DISTRO)/MODULES/CLOCKS/$(file))
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/RBF
+	$(CD) modules; $(OS9COPY) $(RBF) ../$@,NITROS9/$(DISTRO)/MODULES/RBF
+	$(OS9ATTR_EXEC) $(foreach file,$(RBF),$@,NITROS9/$(DISTRO)/MODULES/RBF/$(file))
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/SCF
+	$(CD) modules; $(OS9COPY) $(SCF) ../$@,NITROS9/$(DISTRO)/MODULES/SCF
+	$(OS9ATTR_EXEC) $(foreach file,$(SCF),$@,NITROS9/$(DISTRO)/MODULES/SCF/$(file))
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/PIPE
+	$(CD) modules; $(OS9COPY) $(PIPE) ../$@,NITROS9/$(DISTRO)/MODULES/PIPE
+	$(OS9ATTR_EXEC) $(foreach file,$(PIPE),$@,NITROS9/$(DISTRO)/MODULES/PIPE/$(file))
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/BOOTLISTS
+	$(CD) bootlists; $(CPL) *.bl ../$@,NITROS9/$(DISTRO)/BOOTLISTS
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/SCRIPTS
+	$(CD) scripts; $(CPL) mb* ../$@,NITROS9/$(DISTRO)/SCRIPTS
+	$(RM) $(LDSKDW)
+	$(SOFTLINK) $@ $(LDSKDW)
+
 $(DSKBECKER):
 	$(RM) $@
 	$(OS9FORMAT_DW) -q $@ -n"NitrOS-9/$(CPU) Level $(LEVEL)"
--- a/level1/coco1/modules/makefile	Sat Oct 03 14:51:30 2015 -0500
+++ b/level1/coco1/modules/makefile	Tue Oct 17 07:36:59 2017 -0500
@@ -48,10 +48,10 @@
 
 SCF		= scf.mn \
 		sc6551.dr vrn.dr scbbp.dr scbbt.dr scdwp.dr sspak.dr vtio.dr \
-		covdg.io cohr.io co80.io \
+		covdg.io cohr.io co80.io covga.io \
 		nil.dd p_scbbp.dd p_scdwp.dd pipe.dd ssp.dd \
 		term_scbbt.dt term_sc6551.dt t1_scbbt.dd t2_sc6551.dd t3_sc6551.dd \
-		term_vdg.dt term_hr.dt term_80.dt \
+		term_vdg.dt term_hr.dt term_80.dt term_vga.dt \
 		scdwv.dr term_scdwv.dt n_scdwv.dd n1_scdwv.dd n2_scdwv.dd \
 		n3_scdwv.dd n4_scdwv.dd n5_scdwv.dd n6_scdwv.dd n7_scdwv.dd \
 		n8_scdwv.dd n9_scdwv.dd n10_scdwv.dd n11_scdwv.dd n12_scdwv.dd \
@@ -76,6 +76,9 @@
 
 # Special cases
 
+covga.io: covdg.asm
+	$(AS) $(ASOUT)$@ $< $(AFLAGS) -DCoCoVGA=1
+
 rominfo_pak: rominfo.asm
 	$(AS) $(ASOUT)$@ $< $(AFLAGS) -DROMPak=1
 
@@ -186,6 +189,10 @@
 d2_80d.dd: rb1773desc.asm
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD80) -DDNum=2
 
+# CoCoVGA descriptors
+term_vga.dt: term_vdg.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -DCoCoVGA=1
+
 # DriveWire 3 SCF descriptors
 term_scdwv.dt: scdwvdesc.asm
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) -DAddr=0
--- a/level1/modules/covdg.asm	Sat Oct 03 14:51:30 2015 -0500
+++ b/level1/modules/covdg.asm	Tue Oct 17 07:36:59 2017 -0500
@@ -6,17 +6,10 @@
 * Edt/Rev  YYYY/MM/DD  Modified by
 * Comment
 * ------------------------------------------------------------------
-*   1      ????/??/??
-* From Tandy OS-9 Level One VR 02.00.00
-*
-*          2003/09/22  Rodney Hamilton
-* recoded dispatch table fcbs, fixed cursor color bug
 
          nam   CoVDG
          ttl   VDG Console Output Subroutine for VTIO
 
-* Disassembled 98/08/23 17:47:40 by Disasm v1.6 (C) 1988 by RML
-
          ifp1
          use   defsfile
          use   cocovtio.d
@@ -29,11 +22,26 @@
 
          mod   eom,name,tylg,atrv,start,size
 
+		 IFNE  COCOVGA
+COLSIZE  equ   64
+ROWSIZE  equ   32
+MODFLAG  equ   ModCoVGA
+		 ELSE
+COLSIZE  equ   32
+ROWSIZE  equ   16
+MODFLAG  equ   ModCoVDG
+		 ENDC
+
 u0000    rmb   0
 size     equ   .
          fcb   $07 
 
-name     fcs   /CoVDG/
+name     equ   *
+		 IFNE  COCOVGA
+	     fcs   /CoVGA/
+	     ELSE
+	     fcs   /CoVDG/
+	     ENDC
          fcb   edition
 
 start    equ   *
@@ -43,28 +51,28 @@
          lbra  SetStat
 Term     pshs  y,x
          pshs  u		save U
-         ldd   #512		32x16 VDG memory size
+         ldd   #COLSIZE*ROWSIZE		VDG memory size
          ldu   <V.ScrnA,u 	get pointer to memory
          os9   F$SRtMem 	return to system
          puls  u		restore U
          ldb   <V.COLoad,u
-         andb  #~ModCoVDG
-         bra   L0086
+         andb  #~MODFLAG
+         lbra   L0086
 * Init
 Init     pshs  y,x		save regs
          lda   #$AF
          sta   <V.CColr,u	save default color cursor
          pshs  u		save static ptr
-         ldd   #768		allocate 768 bytes for now
+         ldd   #COLSIZE*ROWSIZE+256		allocate screen + 256 bytes for now
          os9   F$SRqMem 	get it
          tfr   u,d		put ptr in D
          tfr   u,x		and X
          bita  #$01		odd page?
          beq   L0052		branch if not
-         leax  >256,x		else move X up 256 bytes
+         leax  >256,x		else move X down 256 bytes
          bra   L0056		and return first 256 bytes
-L0052    leau  >512,u		else move X up 512 bytes
-L0056    ldd   #256		and return last 256 bytes
+L0052    leau  >COLSIZE*ROWSIZE,u		else move X to last 256 byte page
+L0056    ldd   #256
          os9   F$SRtMem 	free it!
          puls  u		restore static ptr
          stx   <V.ScrnA,u 	save VDG screen memory
@@ -75,18 +83,92 @@
          jsr   [<V.DspVct,u]	display screen (routine in VTIO)
          puls  y
          stx   <V.CrsrA,u 	save start cursor position
-         leax  >512,x		point to end of screen
+         leax  >COLSIZE*ROWSIZE,x		point to end of screen
          stx   <V.ScrnE,u 	save it
          lda   #$60		get default character
          sta   <V.CChar,u 	put character under the cursor
          sta   <V.Chr1,u	only referenced here ??
+         
+         IFNE	COCOVGA
+***** START OF COCOVGA 64x32 MODE         
+         clr   <V.Caps,u    lowercase mode
+         pshs  cc,u
+         orcc  #IntMasks
+         leax  VGASetup,pcr
+         ldu   <V.CrsrA,u
+         ldb   #VGASetupLen
+x@       lda   ,x+
+         sta   ,u+
+         decb
+         bne   x@
+         
+         lda   $FF02 clear any pending vsync
+tlp@     lda   $FF03 wait for flag to indicate
+         bpl   tlp@ falling edge of FS
+         lda   $FF02 clear vsync interrupt flag
+         
+         
+* PROGRAM THE COCOVGA COMBO LOCK
+BT13	lda		$FF22	GET CURRENT PIA VALUE
+		tfr		A,B		COPY TO B REG TOO
+		anda	#$07	MASK OFF BITS WE'LL CHANGE
+		ora		#$90	SET COMBO LOCK 1 BITS
+		sta		$FF22	WRITE TO PIA FOR COCOVGA
+		anda	#$07	CLEAR UPPER BITS
+		ora		#$48	SET COMBO LOCK 2 BITS
+		sta		$FF22	WRITE TO PIA
+		anda	#$07	CLEAR UPPER BITS
+		ora		#$A0	SET COMBO LOCK 3 BITS
+		sta		$FF22	WRITE TO PIA
+		anda	#$07	CLEAR UPPER BITS
+		ora		#$F8	SET COMBO LOCK 4 BITS
+		sta		$FF22	WRITE TO PIA
+		anda	#$07	CLEAR UPPER BITS
+		ora		#$00	SET REGISTER BANK 0 FOR COCOVGA
+		sta		$FF22	WRITE TO PIA
+
+* Wait for next VSYNC so CoCoVGA can process data from the current video page
+tlp@	lda		$FF03
+		bpl		tlp@
+
+* Restore PIA state and return to text mode - restore original video mode, SAM page
+* VDG -> CG2:
+		lda		$FF22
+		anda	#$8F
+		ora		#$A0
+		sta		$FF22
+		
+* SAM -> CG2:
+		sta		$FFC0	clear GM0
+		sta		$FFC3	set GM1
+		sta		$FFC4	clear GM2
+
+         puls  u,cc
+***** END OF COCOVGA 64x32 MODE         
+		 ENDC
+		 
          lbsr  ClrScrn		clear the screen
+
+* Setup page to 
          ldb   <V.COLoad,u
-         orb   #ModCoVDG	set to CoVDG found (?)
+         orb   #MODFLAG		set co-module flag found
 L0086    stb   <V.COLoad,u
          clrb  
          puls  pc,y,x
 
+***** START OF COCOVGA 64x32 MODE         
+VGASetup fcb   $00              Reset register
+         fcb   $81              Edit mask
+         fcb   $00              Reserved
+         fcb   $03              Font
+         fcb   $00              Artifact
+         fcb   $00              Extras
+         fcb   $00              Reserved
+         fcb   $00              Reserved
+         fcb   $02              Enhanced Modes
+VGASetupLen equ *-VGASetup
+***** END OF COCOVGA 64x32 MODE         
+
 * Write
 * Entry: A = char to write
 *        Y = path desc ptr
@@ -138,14 +220,14 @@
 
 * Screen Scroll Routine
 SScrl    ldx   <V.ScrnA,u	get address of screen
-         leax  <32,x		move to 2nd line
+         leax  <COLSIZE,x		move to 2nd line
 L00E9    ldd   ,x++		copy from this line
-         std   <-34,x		to prevous
+         std   <-COLSIZE-2,x		to prevous
          cmpx  <V.ScrnE,u	at end of screen yet?
          bcs   L00E9		branch if not
-         leax  <-32,x		else back up one line
+         leax  <-COLSIZE,x		else back up one line
          stx   <V.CrsrA,u	save address of cursor (first col of last row)
-         lda   #32		clear out row...
+         lda   #COLSIZE		clear out row...
          ldb   #$60		...width spaces
 L00FD    stb   ,x+		do it...
          deca  			end of rope?
@@ -184,7 +266,7 @@
 * $0D - move cursor to start of line (carriage return)
 Retrn    bsr   HideCrsr		hide cursor
          tfr   x,d		put cursor address in D
-         andb  #$E0		place at start of line
+         andb  #~(COLSIZE-1)		place at start of line
          stb   <V.CrsAL,u	and save low cursor address
 ShowCrsr ldx   <V.CrsrA,u 	get cursor address
          lda   ,x		get char at cursor position
@@ -197,10 +279,10 @@
 
 * $0A - cursor down (line feed)
 CurDown  bsr   HideCrsr		hide cursor
-         leax  <32,x		move X down one line
+         leax  <COLSIZE,x		move X down one line
          cmpx  <V.ScrnE,u 	at end of screen?
          bcs   L0162		branch if not
-         leax  <-32,x		else go back up one line
+         leax  <-COLSIZE,x		else go back up one line
          pshs  x		save X
          bsr   SScrl		and scroll the screen
          puls  x		restore pointer
@@ -280,7 +362,7 @@
          ldx   <V.CrsrA,u 	get cursor address
          lbra  L014B		branch to save cursor in X
 
-* $02 XX YY - move cursor to col XX-32, row YY-32
+* $02 XX YY - move cursor to col XX-COLSIZE, row YY-COLSIZE
 CurXY    ldb   #$02		we want to claim next two chars
          leax  <DoCurXY,pcr	point to processing routine
 L01E5    stx   <V.RTAdd,u	store routine to return to
@@ -291,7 +373,7 @@
 DoCurXY  bsr   HideCrsr		hide cursor
          ldb   <V.NChr2,u 	get ASCII Y-pos
          subb  #C$SPAC		take out ASCII space
-         lda   #32		go down
+         lda   #COLSIZE		go down
          mul   			multiply it
          addb  <V.NChar,u 	add in X-pos
          adca  #$00
@@ -305,15 +387,15 @@
 * $04 - erase to end of line
 ErEOLine bsr   HideCrsr		hide cursor
          tfr   x,d		move current cursor position in D
-         andb  #$1F		number of characters put on this line
+         andb  #COLSIZE-1		number of characters put on this line
          pshs  b
-         ldb   #32
+         ldb   #COLSIZE
          subb  ,s+
          bra   L0223		and clear one line
 
 * $03 - erase line
 DelLine  lbsr  Retrn		do a CR
-         ldb   #32		line length
+         ldb   #COLSIZE		line length
 L0223    lda   #$60		get default character
          ldx   <V.CrsrA,u 	get cursor address
 L0228    sta   ,x+		fill screen line with 'space'
@@ -323,7 +405,7 @@
 
 * $09 - cursor up
 CurUp    lbsr  HideCrsr		hide cursor
-         leax  <-32,x		move X up one line
+         leax  <-COLSIZE,x		move X up one line
          cmpx  <V.ScrnA,u 	compare against start of screen
          bcs   L023E		branch if we went beyond
          stx   <V.CrsrA,u 	else store updated X
@@ -359,18 +441,21 @@
          subd  <V.ScrnA,u	subtract screen address
          pshs  b,a		D now holds cursor position relative to screen
          clra  
-         andb  #$1F
-         addb  #$20		compute column position
+         andb  #COLSIZE-1
+         addb  #COLSIZE		compute column position
          std   R$X,x		save column position to caller's X
-         puls  b,a		then divide by 32
+         puls  b,a		then divide by COLSIZE
          lsra  
          rolb  
          rolb  
          rolb  
          rolb  
+         IFNE  COCOVGA
+         rolb  
+         ENDC
          clra  
-         andb  #$0F		only 16 line to a screen
-         addb  #$20
+         andb  #ROWSIZE-1		lines on the screen
+         addb  #COLSIZE
          std   R$Y,x		and save column to caller's Y
          ldb   <V.CFlag,u
          lda   <V.CChar,u	get character under cursor
--- a/level1/modules/term_vdg.asm	Sat Oct 03 14:51:30 2015 -0500
+++ b/level1/modules/term_vdg.asm	Tue Oct 17 07:36:59 2017 -0500
@@ -20,8 +20,14 @@
 rev      set   $00
 
 * Window descriptor definitions
+         IFNE  COCOVGA
+szx      set   64         number of columns for display
+szy      set   32         number for rows for display
+         ELSE
 szx      set   32         number of columns for display
 szy      set   16         number for rows for display
+         ENDC
+         
          IFGT  Level-1
 wnum     set   0          window number
 sty      set   1          window type
@@ -61,12 +67,16 @@
          IFGT  Level-1
          fcb   $01        init value for dev ctl reg
          ELSE
+         IFNE  COCOVGA
+         fcb   ModCoVGA   init value for dev ctl reg
+         ELSE
          IFEQ  coco2b+deluxe-1
          fcb   ModCoVDG+1 init value for dev ctl reg
          ELSE
          fcb   ModCoVDG   init value for dev ctl reg
          ENDC
          ENDC
+         ENDC
          fcb   $00        baud rate
          fdb   name       copy of descriptor name address
          fcb   $00        acia xon char
--- a/level1/modules/vtio.asm	Sat Oct 03 14:51:30 2015 -0500
+++ b/level1/modules/vtio.asm	Tue Oct 17 07:36:59 2017 -0500
@@ -87,7 +87,13 @@
 L002E    sta   ,x+        clear mem
          decb             decrement counter
          bne   L002E      continue if more
-                         
+              
+         IFEQ  PwrLnFreq-Hz60
+         lda   #CFlash60hz initialize           
+         ELSE
+         lda   #CFlash50hz initialize           
+         ENDC
+         sta   <V.FlashTime,u                
          leax  FlashCursor,pcr * Point to dummy cursor flash
          stx   V.Flash,u  * Setup cursor flash
                          
@@ -220,7 +226,7 @@
                          
 FlashTime                 
          jsr   [V.Flash,u] Call flash routine
-         lda   #CFlash50hz Re-init count
+         lda   <V.FlashTime,u Re-init count
          sta   V.FlashCount,u
                          
 AltIRQEnd                 
@@ -700,6 +706,7 @@
 CoVDG    fcs   /CoVDG/    
 CoWP     fcs   /CoWP/    
 CoHR     fcs   /CoHR/    
+CoVGA    fcs   /CoVGA/    
                          
 * GetStat
 *
@@ -948,8 +955,8 @@
                          
 SSCOMST  ldd   R$Y,x      Get caller's Y
 SetupTerm                 
-         bita  #ModCoVDG   CoWP?
-         beq   GoCoWP     branch if so
+         bita  #ModCoVDG   VDG?
+         beq   GoCoWP     branch if not
          ldb   #$10       assume true lower case TRUE
          bita  #$01       true lowercase bit set?
          bne   GoCoVDG     branch if so
@@ -962,8 +969,8 @@
          leax  >CoVDG,pcr 
          bra   SetupCoModule
                          
-GoCoWP   bita  #ModCoWP   ; CoWP needed ?
-         beq   GoCoHR    
+GoCoWP   bita  #ModCoWP   CoWP?
+         beq   GoCoVGA	  branch if not
          lda   #ModCoWP   'CoWP is loaded' bit
          ldx   #$5018     80x24
          pshs  u,y,x,a   
@@ -974,10 +981,17 @@
          puls  u,y,x,a   
          bcs   L0600     
          stx   <V.Col,u   save screen size
-         sta   <V.CurCo,u current module in use? ($02=CoVDG, $04=C080)
+         sta   <V.CurCo,u store current module in use
 L0600    rts             
                          
-GOCoHR   ldx   #$3318     51x24
+GoCoVGA  bita  #ModCoVGA
+         beq   GoCoHR
+         ldx   #$4020     64x32
+         pshs  u,y,x,a   
+         leax  >CoVGA,pcr 
+         bra   SetupCoModule
+                         
+GoCoHR   ldx   #$3318     51x24
          pshs  u,y,x,a   
          leax  >CoHR,pcr 
          bra   SetupCoModule