Mercurial > hg > Members > kono > nitros9-code
changeset 2182:b1b374ada668
Added 38.4kbps routines from Darren Atkinson
author | boisy |
---|---|
date | Sun, 08 Mar 2009 14:11:52 +0000 |
parents | c34956608086 |
children | d29be35a48bb |
files | level1/coco/modules/makefile level1/modules/boot_dw3.asm level1/modules/dwread.asm level1/modules/dwwrite.asm |
diffstat | 4 files changed, 155 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/coco/modules/makefile Sat Mar 07 23:53:36 2009 +0000 +++ b/level1/coco/modules/makefile Sun Mar 08 14:11:52 2009 +0000 @@ -20,7 +20,7 @@ TPB = $(3RDPARTY)/booters BOOTERS = boot_1773_6ms boot_1773_30ms \ - boot_burke boot_rampak boot_wd1002 boot_dw3 + boot_burke boot_rampak boot_wd1002 boot_dw3 boot_dw3_coco1 BOOTTRACK = rel $(BOOTERS) KERNEL = krn krnp2 SYSMODS = ioman init sysgo_dd sysgo_h0 @@ -30,7 +30,7 @@ clock2_messemu clock2_jvemu clock2_dw3 RBF = rbf.mn \ - rbdw3.dr dw3.sb \ + rbdw3.dr dw3.sb dw3_coco1.sb \ rb1773.dr rb1773_scii_ff74.dr rb1773_scii_ff58.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 \ @@ -54,6 +54,13 @@ # Special cases +# DriveWire 3 +boot_dw3_coco1: boot_dw3.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aBAUD38400=1 + +dw3_coco1.sb: dw3.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aBAUD38400=1 + # Kernel krn krnp2: $(CD) kernel; make $@
--- a/level1/modules/boot_dw3.asm Sat Mar 07 23:53:36 2009 +0000 +++ b/level1/modules/boot_dw3.asm Sun Mar 08 14:11:52 2009 +0000 @@ -94,11 +94,11 @@ std ,s leax ,s ldy #5 - lbsr XMT56K send it to server + lbsr DWWrite send it to server * Get 256 bytes of sector data ldx blockloc,u lda #255 - bsr RCV56K read bytes from server + bsr DWRead read bytes from server bcs ReadEr branch if framing error cmpd #256 bne ReadEr2 @@ -107,9 +107,9 @@ pshs y leax ,s ldy #2 - lbsr XMT56K + lbsr DWWrite lda #255 - bsr RCV56K + bsr DWRead leas 2,s bcs ReadEx cmpd #1
--- a/level1/modules/dwread.asm Sat Mar 07 23:53:36 2009 +0000 +++ b/level1/modules/dwread.asm Sun Mar 08 14:11:52 2009 +0000 @@ -1,4 +1,77 @@ - IFNE H6309-1 + IFNE BAUD38400 + +****************************************************************************** +* COCO 38400 BAUD BIT-BANGER RECEIVER +****************************************************************************** +* +* WAITS FOR A SPECIFIED TIMEOUT PERIOD UNTIL A START-BIT APPEARS ON THE +* BIT-BANGER INPUT. DATA RECEPTION IS INITIATED IF A START-BIT APPEARS +* BEFORE THE TIMEOUT PERIOD EXPIRES. THE SERIAL DATA FORMAT MUST BE: +* 1 START BIT, 8 DATA BITS, NO PARITY, 1..2 STOP BITS. +* +* DATA RECPEPTION TERMINATES WHEN: +* - A PERIOD OF 4 MS ELLAPSES WITHOUT A NEW START BIT +* - A FRAMING ERROR IS DETECTED. +* +* ON ENTRY: +* X = ADDRESS FOR DATA STORAGE +* A = TIMEOUT VALUE (125 = APPROX ONE SECOND) +* +* ON EXIT: +* Y = DATA CHECKSUM +* D = NUMBER OF BYTES RECEIVED +* X AND U ARE PRESERVED +* CC.CARRY IS SET ONLY IF A FRAMING ERROR WAS DETECTED +* +****************************************************************************** +BBIN EQU $FF22 ; BIT-BANGER INPUT ADDRESS +BUFBAS EQU 1 ; OFFSET TO STORAGE ADDRESS ON STACK + +DWRead +RCV38K CLRB ; CLEAR CARRY FLAG (NO FRAMING ERROR) + PSHS U,X,CC ; PRESERVE REGISTERS + ORCC #$50 ; MASK INTERRUPTS + TFR D,Y ; SET Y TO INITIAL TIMEOUT COUNTER + LEAU ,X ; POINT U TO STORAGE BUFFER + LDX #0 ; INITIALIZE CHECKSUM + LDA #1 ; A = SERIAL INPUT MASK + +WAIT1 LEAY ,Y ; TEST TIMEOUT COUNTER + BEQ FINISH ; BRANCH IF TIMEOUT HAS EXPIRED +WAIT2 BITA BBIN ; CHECK FOR START BIT + BEQ BSTART ; BRANCH IF START BIT DETECTED + LEAY -1,Y ; DECREMENT TIMEOUT COUNTER + BITA BBIN ; CHECK FOR START BIT + BNE WAIT1 ; LOOP IF STILL NO START BIT + +BSTART LDY #BBIN ; POINT Y TO BIT BANGER INPUT REGISTER + LEAU ,U ; 4 CYCLE DELAY + LDB #$7F ; INITIALIZE B FOR SHIFT COUNTER +RDLOOP TST ,Y++ ; 9 CYCLE DELAY + LDA ,--Y ; READ DATA BIT + LSRA ; SHIFT DATA INTO CARRY + RORB ; ROTATE INTO BYTE ACCUMULATOR + BCS RDLOOP ; LOOP UNTIL 8 DATA BITS HAVE BEEN READ + + STB ,U+ ; STORE RECEIVED BYTE + ABX ; ACCUMULATE CHECKSUM + CLRA ; DO THE EQUIVALENT OF.. + INCA ; ..LDA #1 USING 4 CYCLES + ANDA ,Y ; CHECK FOR THE STOP BIT + LDY #128 ; SET TIMEOUT COUNTER TO 4MS + TSTA ; IF STOP BIT IS GOOD THEN.. + BNE WAIT2 ; ..GO WAIT FOR NEXT BYTE + +FINISH INCA ; A=1 IF FRAMING ERROR, 2 OTHERWISE + ORA ,S ; SETS CARRY BIT IN CC VALUE ON.. + STA ,S ; ..STACK IF FRAMING ERROR DETECTED + LEAY ,X ; RETURN CHECKSUM IN Y + TFR U,D ; CALCULATE NUMBER.. + SUBD BUFBAS,S ; ..OF BYTES RECEIVED + PULS CC,X,U,PC ; RESTORE REGISTERS AND RETURN + + ELSE + IFNE H6309-1 ** ** Rev 3 Notes: ** @@ -115,16 +188,7 @@ PULS CC,DP,X,U,PC ; RESTORE REGISTERS AND RETURN SETDP $00 - - - - - - - - ELSE - - + ELSE ** Rev 4 Notes: ** @@ -224,6 +288,6 @@ LEAY ,X ; RETURN CHECKSUM IN Y PULS CC,X,U,PC ; RESTORE REGISTERS AND RETURN - ENDC + ENDC + ENDC -
--- a/level1/modules/dwwrite.asm Sat Mar 07 23:53:36 2009 +0000 +++ b/level1/modules/dwwrite.asm Sun Mar 08 14:11:52 2009 +0000 @@ -1,4 +1,65 @@ - IFNE H6309-1 + IFNE BAUD38400 +** +** Rev Notes: +** +** For CoCo 1 +** 38400 bps +** 6809 Timing @ 0.89 MHz +** + +****************************************************************************** +* COCO 38400 BAUD BIT-BANGER TRANSMITTER +****************************************************************************** +* +* TRNSMITS A SPECIFIED NUMBER OF DATA BYTES THROUGH THE BIT-BANGER PORT +* AT HIGH SPEED. ALL OF THE DATA IS SENT IN A SINGLE BURST, NO HANDSHAKING +* IS PROVIDED. THE TRANSMISSION FORMAT IS: +* 1 START BIT, 8 DATA BITS, NO PARITY, 1 STOP BIT. +* +* ON ENTRY: +* X = ADDRESS OF DATA TO TRANSMIT +* Y = NUMBER OF BYTES TO TRANSMIT +* +* ON EXIT: +* X = ADDRESS OF LAST BYTE TRANSMITTED + 1 +* Y = 0 +* A, B AND U ARE PRESERVED +* +****************************************************************************** +BBOUT EQU $FF20 ; BIT-BANGER OUTPUT ADDRESS + +DWWrite +XMT38K PSHS U,D,CC ; PRESERVE REGISTERS + ORCC #$50 ; MASK INTERRUPTS + LDU #BBOUT ; POINT U TO BIT BANGER OUTPUT REGISTER + FCB $8C ; SKIP NEXT INSTRUCTION + +OUTBYT STB ,--U ; TRANSMIT STOP BIT (RESTORES BUMPED U) + LEAU ,U+ ; 6 CYCLE DELAY (U UNCHANGED) + LDA #8 ; INITIALIZE LOOP COUNTER + LDB ,X+ ; GET BYTE TO TRANSMIT + LSLB ; BIT 7->CARRY .. BIT 0->B.1 .. '0'->B.0 + ROLB ; BIT 7 -> B.0 .. BIT 0->B.2 .. '0'->B.1 + +WRLOOP STB ,U++ ; TRANSMIT A BIT (BUMPING U) + TST ,--U ; 9 CYCLE DELAY (RESTORES BUMPED U) + RORB ; MOVE NEXT BIT INTO POSITION + DECA ; DECREMENT LOOP COUNTER + BNE WRLOOP ; LOOP UNTIL BIT 6 HAS BEEN TRANSMITTED + + LEAU ,U ; 4 CYCLE DELAY + STB ,U ; TRANSMIT BIT 7 + LDA ,U++ ; 7 CYCLE DELAY (BUMPING U) + LDB #$02 ; PREPARE VALUE FOR STOP BIT + LEAY -1,Y ; DECREMENT BYTES REMAINING COUNTER + BNE OUTBYT ; LOOP IF MORE TO TRANSMIT + + STB ,--U ; TRANSMIT STOP BIT + PULS CC,D,U,PC ; RESTORE REGISTERS AND RETURN + + ELSE + IFNE H6309-1 + ** ** Rev 3 Notes: ** @@ -63,13 +124,7 @@ PULS CC,D,DP,U,PC ; RESTORE REGISTERS AND RETURN SETDP $00 - - - - ELSE - - - + ELSE ** Rev 4 Notes: ** @@ -133,6 +188,5 @@ STB ,U ; FINAL STOP BIT PULS CC,D,U,PC ; RESTORE REGISTERS AND RETURN - ENDC - - + ENDC + ENDC