Mercurial > hg > Members > kono > nitros9-code
changeset 3239:a47ee8f14eb8
Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
Added new option to the becker port routines so the base address can be changed
during build time from makefile. This should allow for setting building
a optional module for use with the ESP8266-01 WiFi module on Ed Snider's
analog board that is used with the CoCo3FPGA Project.
author | David Ladd <drencor-xeen@users.sourceforge.net> |
---|---|
date | Thu, 08 Mar 2018 21:36:34 -0600 |
parents | e68c1db27cbe |
children | 1d905c091f7b |
files | level1/modules/dwread.asm level1/modules/dwwrite.asm |
diffstat | 2 files changed, 78 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/modules/dwread.asm Thu Mar 08 21:30:49 2018 -0600 +++ b/level1/modules/dwread.asm Thu Mar 08 21:36:34 2018 -0600 @@ -36,6 +36,39 @@ ELSE + IFNE SY6551N + IFNDEF SY6551B +SY6551B EQU $FF68 ; Set base address for future use + ENDC +* NOTE: There is no timeout currently on here... +DWRead clra ; clear Carry (no framing error) + deca ; clear Z flag, A = timeout msb ($ff) + tfr cc,b + pshs u,x,dp,b,a ; preserve registers, push timeout msb + leau ,x + ldx #$0000 + IFEQ NOINTMASK + orcc #IntMasks + ENDC +loop@ ldb SY6551B+1 + andb #$08 + beq loop@ + ldb SY6551B + stb ,u+ + abx + leay ,-y + bne loop@ + + tfr x,y + ldb #0 + lda #3 + leas 1,s ; remove timeout msb from stack + inca ; A = status to be returned in C and Z + ora ,s ; place status information into the.. + sta ,s ; ..C and Z bits of the preserved CC + leay ,x ; return checksum in Y + puls cc,dp,x,u,pc ; restore registers and return + ELSE IFNE JMCPBCK * NOTE: There is no timeout currently on here... DWRead clra ; clear Carry (no framing error) @@ -65,6 +98,9 @@ puls cc,dp,x,u,pc ; restore registers and return ELSE IFNE BECKER + IFNDEF BECKBASE +BECKBASE EQU $FF41 ; Set base address for future use + ENDC * NOTE: There is no timeout currently on here... DWRead clra ; clear Carry (no framing error) deca ; clear Z flag, A = timeout msb ($ff) @@ -75,10 +111,10 @@ IFEQ NOINTMASK orcc #IntMasks ENDC -loop@ ldb $FF41 +loop@ ldb BECKBASE bitb #$02 beq loop@ - ldb $FF42 + ldb BECKBASE+1 stb ,u+ abx leay ,-y @@ -94,6 +130,9 @@ puls cc,dp,x,u,pc ; restore registers and return ELSE IFNE BECKERTO + IFNDEF BECKBASE +BECKBASE EQU $FF41 ; Set base address for future use + ENDC * NOTE: There is now timeout ... DWRead clra ; clear Carry, Set Z pshs cc,x,u ; save regs @@ -104,7 +143,7 @@ ENDC ini@ pshs x ; save X ldx #0x8000 ; X = timeout -loop@ ldb $FF41 ; test for data ready flag +loop@ ldb BECKBASE ; test for data ready flag bitb #$02 bne rdy@ ; byte is ready leax -1,x ; bump timout @@ -116,7 +155,7 @@ puls x,u,pc ; restore registers and return ;; a byte is ready rdy@ puls x ; restore X - ldb $FF42 ; get byte from port + ldb BECKBASE+1 ; get byte from port stb ,u+ ; store in data buffer abx ; add received byte to checksum leay ,-y ; decrement byte counter @@ -128,8 +167,9 @@ ENDC ENDC ENDC + ENDC - IFEQ BECKER+JMCPBCK+ARDUINO+BECKERTO + IFEQ BECKER+JMCPBCK+ARDUINO+BECKERTO+SY6551N IFNE BAUD38400 ******************************************************* * 38400 bps using 6809 code and timimg
--- a/level1/modules/dwwrite.asm Thu Mar 08 21:30:49 2018 -0600 +++ b/level1/modules/dwwrite.asm Thu Mar 08 21:36:34 2018 -0600 @@ -30,6 +30,28 @@ ELSE + IFNE SY6551N + IFNDEF SY6551B +SY6551B EQU $FF68 ; Set base address for future use + ENDC +DWWrite pshs d,cc ; preserve registers + IFEQ NOINTMASK + orcc #IntMasks ; mask interrupts + ENDC + lda #$10 ; Set baud to 115K + sta SY6551B+3 ; write the info to register + lda #$0B ; Set no parity, no irq + sta SY6551B+2 ; write the info to register +txByte + lda SY6551B+1 ; read status register to check + anda #$10 ; if transmit buffer is empty + beq txByte ; if not loop back and check again + lda ,x+ ; load byte from buffer + sta SY6551B ; and write it to data register + leay -1,y ; decrement byte counter + bne txByte ; loop if more to send + puls cc,d,pc ; restore registers and return + ELSE IFNE JMCPBCK DWWrite pshs d,cc ; preserve registers orcc #$50 ; mask interrupts @@ -43,22 +65,28 @@ ELSE IFNE BECKER + IFNDEF BECKBASE +BECKBASE EQU $FF41 ; Set base address for future use + ENDC DWWrite pshs d,cc ; preserve registers orcc #$50 ; mask interrupts txByte lda ,x+ - sta $FF42 + sta BECKBASE+1 leay -1,y ; decrement byte counter bne txByte ; loop if more to send puls cc,d,pc ; restore registers and return ELSE IFNE BECKERTO -DWWrite pshs d,cc ; preserve registers + IFNDEF BECKBASE +BECKBASE EQU $FF41 ; Set base address for future use + ENDC +DWWrite pshs d,cc ; preserve registers orcc #$50 ; mask interrupts txByte lda ,x+ - sta $FF42 + sta BECKBASE+1 leay -1,y ; decrement byte counter bne txByte ; loop if more to send @@ -66,8 +94,9 @@ ENDC ENDC ENDC + ENDC - IFEQ BECKER+JMCPBCK+ARDUINO+BECKERTO + IFEQ BECKER+JMCPBCK+ARDUINO+BECKERTO+SY6551N IFEQ BAUD38400+H6309 ******************************************************* * 57600 (115200) bps using 6809 code and timimg