changeset 3117:47cd23dcf55e

Incorporate mc09 in build, add support in l1 init/rel/boot_sdc
author Neal Crook <foofoobedoo@gmail.com>
date Sat, 17 Oct 2015 21:19:39 +0100
parents 174eb9eda7b1
children ef66bdab9b45
files level1/makefile level1/modules/boot_sdc.asm level1/modules/init.asm level1/modules/rel.asm lib/makefile
diffstat 5 files changed, 112 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/level1/makefile	Sat Oct 17 21:21:11 2015 +0100
+++ b/level1/makefile	Sat Oct 17 21:19:39 2015 +0100
@@ -1,6 +1,6 @@
 include $(NITROS9DIR)/rules.mak
 
-dirs	= coco1 coco1_6309 deluxe coco2 coco2_6309 coco2b tano d64 dalpha atari
+dirs	= coco1 coco1_6309 deluxe coco2 coco2_6309 coco2b tano d64 dalpha atari mc09
 ifdef PORTS
 dirs	= $(PORTS)
 endif
--- a/level1/modules/boot_sdc.asm	Sat Oct 17 21:21:11 2015 +0100
+++ b/level1/modules/boot_sdc.asm	Sat Oct 17 21:19:39 2015 +0100
@@ -65,7 +65,12 @@
 *       Carry Clear = OK, Set = Error
 *       B  = error (Carry Set)
 *
-HWInit         orcc      #$50               mask interrupts
+HWInit
+         IFNE  mc09
+               clrb
+               rts
+         ELSE
+               orcc      #$50               mask interrupts
                lda       #$D0               stop any emulated FDC command
                sta       CMDREG,y
                pshs      d,x,y,u            delay
@@ -73,7 +78,7 @@
                lda       STATREG,y          clear INTRQ
 
                *** Fall Thru ***
-
+         ENDC
 *--------------------------------------------------------------------------
 * HWTerm - Terminate the device
 *
@@ -85,7 +90,10 @@
 *       B = error (Carry Set)
 *
 HWTerm         clrb                         no error
+         IFNE  mc09
+         ELSE
                stb       CONTROL,y          disable command mode
+         ENDC
                rts
 
 
@@ -104,8 +112,51 @@
 *
 *    Exit:
 *       X  = ptr to data (i.e. ptr in blockloc,u)
+*       Carry set => ERROR
 *
-HWRead         lda       #$43               start command mode
+* multicomp09:
+* for now, the image starts at SDcard block $02.8000
+* so simply need to add that offset to the incoming
+* LSN and load it into the hardware. Simples!
+HWRead
+         IFNE  mc09
+               bsr       LDSDADRS           set up address
+* WAIT FOR PREVIOUS COMMAND (IF ANY) TO COMPLETE
+RDBIZ          LDA SDCTL
+               CMPA #$80
+               BNE RDBIZ
+
+* ISSUE THE READ COMMAND TO THE SDCARD CONTROLLER
+               CLRA
+               STA  SDCTL
+
+* TRANSFER 512 BYTES, WAITING FOR EACH IN TURN. ONLY WANT 256
+* OF THEM - DISCARD THE REST
+
+               ldx   blockloc,u             get address of buffer to fill
+               pshs  x
+               CLRB             ZERO IS LIKE 256
+SDRBIZ         LDA SDCTL
+               CMPA #$E0
+               BNE SDRBIZ       BYTE NOT READY
+               LDA SDDATA       GET BYTE
+               STA ,X+          STORE IN SECTOR BUFFER
+               DECB
+               BNE SDRBIZ       NEXT
+
+SDRBIZ2        LDA SDCTL        B IS ALREADY ZERO (LIKE 256)
+               CMPA #$E0
+               BNE SDRBIZ2      BYTE NOT READY
+               LDA SDDATA       GET BYTE (BUT DO NOTHING WITH IT)
+               DECB
+               BNE SDRBIZ2      NEXT
+
+               puls x
+               clra             carry clear -> successful completion
+               RTS
+
+         ELSE
+               lda       #$43               start command mode
                sta       CONTROL,y
                stb       LSNREG,y           put LSN into registers
                stx       LSNREG+1,y
@@ -128,7 +179,30 @@
                puls      x,u                restore X and U
 rdExit         sta       CONTROL,y          end command mode
                rts
+         ENDC
 
+         IFNE  mc09
+*******************************************************************
+* SET SDLBA2 SDLBA1 SDLBA0 FOR NEXT SD OPERATION
+* add $02.8000 to {B,XH,XL} and load into the hardware
+* registers.
+* Can destroy A, B, X, CC
+* Assumption: the lowest byte of the adder ($02.8000 here) will
+* always be 0 and so never need fixup
+LDSDADRS       pshs b
+               tfr  x,d
+               stb  SDLBA0      ls byte is done.
+
+               ldb  #$02
+
+               adda #$80
+               sta  SDLBA1      middle byte is done
+
+               adcb #$00        add carry from middle byte
+               addb ,s+         add and drop stacked b
+               stb  SDLBA2
+               rts
+         ELSE
 
 *--------------------------------------------------------------------------
 * Wait for controller status to indicate either "Not Busy" or "Ready".
@@ -150,6 +224,7 @@
                bitb      #2                 test READY
                beq       waitLp             loop if not ready for transfer
 waitRet        rts                          return
+         ENDC
 
 
 *--------------------------------------------------------------------------
--- a/level1/modules/init.asm	Sat Oct 17 21:21:11 2015 +0100
+++ b/level1/modules/init.asm	Sat Oct 17 21:19:39 2015 +0100
@@ -150,7 +150,14 @@
          IFNE   atari
          fcc    "Atari XL/XE"
          ELSE
+         IFNE   mc09
+         fcb    $1B                       text in bright blue
+         fcc    "[94mMulticomp09"
+         fcb    $1B
+         fcc    "[0m"
+         ELSE
          fcc    "Unknown Machine"
+         ENDC                             match IFNE mc09
          ENDC                             match IFNE atari
          ENDC                             match IFNE dalpha
          ENDC                             match IFNE d64
--- a/level1/modules/rel.asm	Sat Oct 17 21:21:11 2015 +0100
+++ b/level1/modules/rel.asm	Sat Oct 17 21:19:39 2015 +0100
@@ -292,6 +292,21 @@
 *************************************************************************
 
 Start
+         IFNE  mc09
+* currently we have NO STACK
+
+         leax  <BootMsg,pcr
+outbsy   lda   VDUSTA
+         bita  #2
+         beq   outbsy
+         lda   ,x+
+         beq   done
+         sta   VDUDAT
+         bra   outbsy
+
+done
+         ELSE                          match IFNE mc09
+
          clr   PIA0Base+3
 
          IFNE  (tano+d64+dalpha)
@@ -346,6 +361,8 @@
 
          beq   L266E
 
+         ENDC              match IFNE mc09
+
 * Copy boot track from $2600 to $EE00 - not quite all of it though. The whole boot
 * track is $1200 bytes and would take us right up to $FFFF. We actually copy up to
 * $FE80.
@@ -367,12 +384,16 @@
          jmp   d,x
 
 BootMsg
+         IFNE  mc09
+         fcn   / Boot /
+         ELSE
          IFNDEF dalpha		save some bytes on Dragon Alpha
          fcc   /NITROSy/
          fcb   $60
          ENDC
          fcc   /BOOT/
 BootMLen equ   *-BootMsg
+         ENDC                   match IFNE mc09
 
          ENDC                   match IFGT Level-1
 
--- a/lib/makefile	Sat Oct 17 21:21:11 2015 +0100
+++ b/lib/makefile	Sat Oct 17 21:19:39 2015 +0100
@@ -1,7 +1,8 @@
 include $(NITROS9DIR)/rules.mak
 
 all: libnos96809l1.a libnos96809l2.a libnos96309l2.a libnet.a libalib.a \
-	libcoco.a libcoco3.a libcoco3_6309.a libdragon.a libatari.a
+	libcoco.a libcoco3.a libcoco3_6309.a libdragon.a libatari.a \
+	libmc09.a
 
 libnos96809l1.a: sys6809l1.o
 	$(LWAR) $@ $?
@@ -30,6 +31,9 @@
 libdragon.a: dragon.o
 	$(LWAR) $@ $?
 
+libmc09.a: mc09.o
+	$(LWAR) $@ $?
+
 libalib.a:
 	$(MAKE) -C alib