changeset 2625:d1ea3dc90082

More progress... now booting with DriveWire
author Boisy Pitre <boisy.pitre@nuance.com>
date Sat, 25 Feb 2012 18:21:34 -0600
parents b8c7b7fbf3c9
children cff23b8fc512
files defs/atari.d defs/atarivtio.d level1/atari/bootroms/makefile level1/atari/modules/makefile level1/atari/modules/sysgo.asm level1/atari/modules/term.asm level1/atari/modules/vtio.asm level1/modules/kernel/krn.asm
diffstat 8 files changed, 154 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/defs/atari.d	Fri Feb 24 08:51:08 2012 -0600
+++ b/defs/atari.d	Sat Feb 25 18:21:34 2012 -0600
@@ -4,6 +4,49 @@
 ********************************************************************
 * AtariDefs - NitrOS-9 System Definitions for the Atari XE/XL
 *
+* This is a high level view of the Atari XE/XL memory map as setup by
+* NitrOS-9.
+*
+*     $0000----> ================================== 
+*               |                                  |
+*               |      NitrOS-9 Globals/Stack      |
+*               |                                  |
+*     $0500---->|==================================|
+*               |                                  |
+*               |               Atari              |
+*  $0500-$08BF  |           Screen Memory          |
+*               |              (40x24)             |
+*               |                                  |
+*               |----------------------------------|
+*  $08C0-$08FF  |         ANTIC Display List       |
+*     $9000---->|----------------------------------|
+*               |                                  |
+*                 . . . . . . . . . . . . . . . . .
+*               |                                  |
+*               |   RAM available for allocation   |
+*               |       by NitrOS-9 and Apps       |
+*               |                                  |
+*                 . . . . . . . . . . . . . . . . .
+*               |                                  |
+*     $C000---->|==================================|
+*               |                                  |
+*  $C000-$CFFF  |               ROM                |
+*               |                                  |
+*     $D000---->|==================================|
+*               |                                  |
+*               |   XEGS Memory Mapped I/O Region  |
+*               |(may differ in location on others)|
+*               |                                  |
+*     $D800---->|==================================|
+*               |                                  |
+*  $D800-$FFFF  |               ROM                |
+*               |                                  |
+*               |==================================|
+*
+*
+* Atari Hardware is documented here:
+*   http://user.xmission.com/~trevin/atari/pokey_regs.html
+*
 * $Id$
 *
 * Edt/Rev  YYYY/MM/DD  Modified by
--- a/defs/atarivtio.d	Fri Feb 24 08:51:08 2012 -0600
+++ b/defs/atarivtio.d	Sat Feb 25 18:21:34 2012 -0600
@@ -16,6 +16,8 @@
 V.CurCol  RMB       1
 V.CurChr  RMB       1                   character under the cursor
 V.KySns   RMB       1                   key sense flags
+V.EscCh1  RMB       2                   escape vector handler
+V.EscVect RMB       2                   escape vector handler
 V.IBufH   RMB       1                   input buffer head
 V.IBufT   RMB       1                   input buffer tail
 V.InBuf   RMB       KBufSz              input buffer
--- a/level1/atari/bootroms/makefile	Fri Feb 24 08:51:08 2012 -0600
+++ b/level1/atari/bootroms/makefile	Sat Feb 25 18:21:34 2012 -0600
@@ -1,5 +1,6 @@
 include $(NITROS9DIR)/rules.mak
 
+%.rom:
 # Module directory
 MD		= ../modules
 # Commands directory
@@ -13,22 +14,31 @@
 				$(MD)/clock_60hz $(MD)/clock2_soft \
 				$(MD)/krn
 
-BOOTFILE_ROM_P2	= $(CD)/shell_21 $(CD)/debug
+BOOTFILE_ROM_P2	= $(MD)/rbf.mn $(MD)/rbdw3.dr \
+                    $(MD)/x0.dd $(MD)/dw3.sb \
+                    $(MD)/scdwp.dr $(MD)/p_scdwp.dd \
+                    $(CD)/shell_21 $(CD)/dir \
+                    $(CD)/mdir $(CD)/dump
+                    
 
-BOOTROMS	= nos96809l1.rom
+BOOTROMS	= nos96809l1.rom dw3boot.rom
 
 ALLROMS		= $(BOOTROMS)
 
 all:	$(ALLROMS)
 
-# Bootfiles
+# Boot ROMs
+dw3boot.rom: dw3boot.asm
+	$(AS) $(AFLAGS) -mr -I../modules $< $(ASOUT)$@
+
 nos96809l1.rom: $(BOOTFILE_ROM) $(DEPENDS)
 	$(MERGE) $(BOOTFILE_ROM_P1)>$@_p1
 	$(MERGE) $(BOOTFILE_ROM_P2)>$@_p2
 	$(PADROM) -b 10240 $@_p1
 	$(PADROM) -b 12288 $@_p1
 	$(MERGE) $@_p2 $@_p1>$@
-	$(PADROM) -b 16384 $@
+	$(PADROM) -b 32768 $@
+	$(CP) $@ nos96809l1.dsk
 	$(RM) $@_p2 $@_p1
 	
 clean:
--- a/level1/atari/modules/makefile	Fri Feb 24 08:51:08 2012 -0600
+++ b/level1/atari/modules/makefile	Sat Feb 25 18:21:34 2012 -0600
@@ -15,7 +15,7 @@
 SYSMODS		= ioman init sysgo
 CLOCKS      = clock_60hz clock_50hz clock2_soft
 
-RBF		= rbf.mn
+RBF		= rbf.mn rbdw3.dr ddx0.dd x0.dd x1.dd x2.dd x3.dd
 
 SCF		= scf.mn \
 		vrn.dr vtio.dr \
@@ -26,7 +26,9 @@
 		piper.dr \
 		pipe.dd
 
-ALLOBJS		= $(KERNEL) $(SYSMODS) $(CLOCKS) $(RBF) $(SCF) $(PIPE)
+DW		= scdwp.dr p_scdwp.dd dw3.sb
+
+ALLOBJS		= $(KERNEL) $(SYSMODS) $(CLOCKS) $(RBF) $(SCF) $(PIPE) $(DW)
 
 all:	$(ALLOBJS)
 
@@ -39,6 +41,22 @@
 sysgo: sysgo.asm
 	$(AS) $(AFLAGS) $(ASOUT)$@ $< -aROM=1
 
+# DriveWire 3 RBF descriptors
+ddx0.dd: dwdesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aDD=1 -aDNum=0
+
+x0.dd: dwdesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=0
+
+x1.dd: dwdesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=1
+
+x2.dd: dwdesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=2
+
+x3.dd: dwdesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aDNum=3
+
 # Clocks
 clock_60hz: clock.asm
 	$(AS) $(AFLAGS) $(ASOUT)$@ $< -aPwrLnFrq=60
--- a/level1/atari/modules/sysgo.asm	Fri Feb 24 08:51:08 2012 -0600
+++ b/level1/atari/modules/sysgo.asm	Sat Feb 25 18:21:34 2012 -0600
@@ -26,7 +26,6 @@
 
          IFP1
          use   defsfile
-         use   scfdefs
          ENDC
 
 tylg     set   Prgrm+Objct
--- a/level1/atari/modules/term.asm	Fri Feb 24 08:51:08 2012 -0600
+++ b/level1/atari/modules/term.asm	Sat Feb 25 18:21:34 2012 -0600
@@ -16,8 +16,7 @@
 
          ifp1
          use   defsfile
-         use   scfdefs
-	 use   vtiodefs
+          use   atarivtio.d
          endc
 
 tylg     set   Devic+Objct   
--- a/level1/atari/modules/vtio.asm	Fri Feb 24 08:51:08 2012 -0600
+++ b/level1/atari/modules/vtio.asm	Sat Feb 25 18:21:34 2012 -0600
@@ -14,7 +14,6 @@
                          
          ifp1            
          use   defsfile  
-         use   scfdefs   
          use   atarivtio.d
          endc            
                          
@@ -69,6 +68,9 @@
 		stu		>D.KbdSta  store devmem ptr
 		pshs	u
 
+		leax	ChkSpc,pcr
+		stx	V.EscVect,u
+		
 * setup static vars
 		clra
 		clrb
@@ -112,9 +114,9 @@
 
 * set text color
 		lda	#$0F
- 		sta	COLPF0
+* 		sta	COLPF0
  		sta	COLPF1
- 		sta	COLPF3
+* 		sta	COLPF3
 		lda	#$94
  		sta	COLPF2
  		
@@ -134,6 +136,10 @@
 		os9	F$IRQ				install the ISR
 		bcs	initex
 		
+* set POKEY to active
+		lda	#3
+		sta	SKCTL
+
 * tell POKEY to enable keyboard scanning
 		lda	#%11000000
 		sta	IRQEN
@@ -218,8 +224,12 @@
 Write
 		bsr		hidecursor		
 
+		ldx		V.EscVect,u
+		jmp		,x
+
+ChkSpc
 		cmpa		#C$SPAC			space or greater?
-		bcs		ChDispatch		branch if not
+		bcs		ChkESC			branch if not
 		
 wchar	suba		#$20
 		pshs		a
@@ -292,7 +302,9 @@
 		sta		,x
 		puls		a,pc
 
-ChDispatch
+ChkESC
+		cmpa	#$1B			ESC?
+		lbeq	EscHandler
 		cmpa  #$0D		$0D?
 		bhi   drawcursor	branch if higher than
 		leax  <DCodeTbl,pcr	deal with screen codes
@@ -359,7 +371,7 @@
 		clr		1,x
 		
 leave	ldd		V.CurRow,u
-		bra		drawcursor
+		lbra		drawcursor
 
 CurDown
 		ldd		V.CurRow,u
@@ -378,6 +390,41 @@
 		clr		V.CurCol,u
 		lbra		drawcursor
 
+EscHandler
+		leax		EscHandler2,pcr
+eschandlerout
+		stx		V.EscVect,u
+		lbra		drawcursor
+
+EscHandler2
+		sta		V.EscCh1,u
+		leax		EscHandler3,pcr
+		bra		eschandlerout
+
+EscHandler3
+		ldb		V.EscCh1,u
+		cmpb		#$32
+		beq		DoFore
+		cmpb		#$33
+		beq		DoBack
+		cmpb		#$34
+		beq		DoBord
+eschandler3out
+		leax		ChkSpc,pcr
+		bra		eschandlerout
+
+DoFore
+*		sta		COLPF0
+		sta		COLPF1
+*		sta		COLPF3
+		bra		eschandler3out
+DoBack
+		sta		COLPF2
+		bra		eschandler3out
+DoBord
+		sta		COLBK
+		bra		eschandler3out
+		
 
 * GetStat
 *
@@ -477,12 +524,15 @@
 
 * Update the shadow register then the real register to disable and
 * re-enable the keyboard interrupt
+		pshs cc
+          orcc #IntMasks
 		lda	D.IRQENShdw
 		tfr	a,b
 		anda	#^%11000000
 		orb	#%11000000
 		sta	IRQEN
 		stb	D.IRQENShdw
+		puls cc
 		stb	IRQEN
 		rts
 		
--- a/level1/modules/kernel/krn.asm	Fri Feb 24 08:51:08 2012 -0600
+++ b/level1/modules/kernel/krn.asm	Sat Feb 25 18:21:34 2012 -0600
@@ -93,12 +93,14 @@
 OS9Cold  equ   *
 
          IFNE  atari
-* Currently NitrOS-9 is in ROM on the Atari.
+         IFNE	ROM
+* For when NitrOS-9 is in ROM on the Atari.
 * Since the Liber809 is coming here directly from reset,
 * we will be good and get the hardware initialized properly.
 		lds #$1000
 		lbsr	InitAtari
          ENDC
+         ENDC
          
 * clear out system globals from $0000-$0400
 *         ldx   #D.FMBM
@@ -152,8 +154,12 @@
          std   ,y                      else restore org contents
          leax  >$0100,y                check top of next 256 block
          IFNE  atari
+         IFNE  ROM
          cmpx  #$C000                  stop short of ROM starting at $C000
          ELSE
+         cmpx  #$8000                  stop short of ROM starting at $8000
+         ENDC
+         ELSE
          cmpx  #Bt.Start               stop short of boot track mem
          ENDC
          bcs   ChkRAM
@@ -184,8 +190,12 @@
 * for some reason, we need to increment X from $C000 to $C001.  If we do not
 * do this, then the screen background color goes to black at random resets??
 *         leax	1,x			
+		IFNE	ROM
          ldy   #$D000
          ELSE
+         ldy   #$D000
+         ENDC
+         ELSE
          ldy	#Bt.Start+Bt.Size
          ENDC
          
@@ -1030,6 +1040,7 @@
 hextable	fcb $30-$20,$31-$20,$32-$20,$33-$20,$34-$20,$35-$20,$36-$20,$37-$20
 		fcb $38-$20,$39-$20,$41-$20,$42-$20,$43-$20,$44-$20,$45-$20,$46-$20
 
+		IFNE	ROM
 ***********************************************************************
 * Atari initialization code goes here since we have to pad the area due
 * to 1K alignment of character set above
@@ -1048,10 +1059,8 @@
          clr   b,x
          decb
          bne   cleario         
-* set POKEY to active
-         lda   #3
-         sta   $D20F
 		rts
+		ENDC
 
 		ENDC
 		
@@ -1163,7 +1172,11 @@
           fcb  $39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39
           fcb  $39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39
           fcb  $39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39
-          fcb	$39
+          fcb	$39,$39,$39,$39,$39,$39
+          IFEQ	ROM
+          fcb  $39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39
+          fcb  $39,$39,$39,$39,$39,$39,$39,$39,$39,$39,$39
+          ENDC
 
 		ENDC