Re: POC VERSION TWO
Posted: Tue Jan 03, 2017 9:50 pm
EugeneNine wrote:
I still have a stack of 5&1/4" disk write protect tabs because they worked so well to cover eprom windows 
Code: Select all
; 28L91 UART: 1 block, 1 channel
; |
; +———> BLOCK A: $00-$0F
; |
; +———> channel A registers: $00-$03
; +———> block registers: $04-$07
; *———> block registers: $0C-$0F
; —-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-
; 26C92 DUART: 1 block, 2 channels
; 28L92 DUART: 1 block, 2 channels
; |
; +———> BLOCK A: $00-$0F
; |
; +———> channel A registers: $00-$03
; +———> block registers: $04-$07
; +———> channel B registers: $08-$0B
; *———> block registers: $0C-$0F
; —-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-
; 28C94 QUART: 2 blocks, 4 channels
; |
; +———> BLOCK A: $00-$0F
; | |
; | +———> channel A registers: $00-$03
; | +———> block registers: $04-$07
; | +———> channel B registers: $08-$0B
; | *———> block registers: $0C-$0F
; |
; +———> BLOCK B: $10-$1F
; | |
; | +———> channel A registers: $10-$13
; | +———> block registers: $14-$17
; | +———> channel B registers: $18-$1B
; | *———> block registers: $1C-$1F
; |
; +———> DEVICE CONTROL: $20-$3FCode: Select all
nxc94bsu .byte nx4opra, 0 ;A: clear OPR bits
.byte nx4oprb, 0 ;B: clear OPR bits
.byte nx4iopca,0 ;A: OPR as all inputs
.byte nx4iopcb,0 ;B: OPR as all inputs
.byte nx4iopca,nxpopdef ;A: CTS as input, RTS as output
.byte nx4iopcb,nxpopdef ;B: CTS as input, RTS as output
.byte nx4acra, nxparbrt ;A: baud rate table #1 & C/T mode
.byte nx4acrb, nxparbrt ;B: baud rate table #1
.byte nx4crlra,nxpctdlo ;A: C/T jiffy count LSB
.byte nx4crura,nxpctdhi ;A: C/T jiffy count MSB
.byte nx4crlrb,0 ;B: C/T not used
.byte nx4crurb,0 ;B: C/T not used
.byte nx4imra, nxpirqma ;A: enable IRQ sources
.byte nx4imrb, nxpirqmb ;B: enable IRQ sources
.word _eotsen_Code: Select all
; ——————————————————————
; Process RxD Interrupts
; ——————————————————————
;
iirq0100 shortr
lda #n_nxpblk-1 ;starting block number
;
;
; block processing loop...
;
.iirq010 pha ;save current block number
asl ;generate &...
sta tiablkix ;save block index
ldy #n_nxpcpb-1 ;starting channel number
;
;
; channel processing loop...
;
.iirq020 sty tiachnum ;save current channel number
ldx tiablkix ;get block index
lda nxprqtab,y ;RxD ISR mask
and (tiaisr,x) ;RxD interrupting? <———
beq .iirq050 ;no, skip this channel
;
clc
txa ;block index (0 or 2)
adc tiachnum ;channel number (0-1)
sta tiachix ;channel index (0-3)
tax ;copy channel index
asl ;make channel offset
sta tiachoff ;save it
tay
longa
lda nxprbtab,y ;set...
sta tiaabuf ;target FIFO
shorta
ldy tiaputrx,x ;get FIFO "put" index
;
;
; RxD FIFO processing loop...
;
.iirq030 ldx tiachoff ;channel offset
lda (tiasr,x) ;get channel status <———
bit #nxprxdr ;FIFO empty?
beq .iirq040 ;yes, done with channel
;
lda (tiafif,x) ;get datum from RxD &... <———
xba ;hold it
ldx tiachix ;get channel index
tya ;copy FIFO "put" index,...
ina ;bump it & wrap to...
and #tiaxmask ;FIFO boundary
cmp tiagetrx,x ;check FIFO status
beq .iirq040 ;no room for datum
;
xba ;expose &...
sta (tiaabuf),y ;buffer datum
xba
tay ;new "put" index
bra .iirq030 ;get more data if availableCode: Select all
;UART RECEIVER IRQ PROCESSING
;
iirq01 shortr
lda #n_nxpblk-1 ;start block number
;
;
; block processing loop...
;
.iirq100 pha ;save block number (0,1,2...)
asl
sta tiaiblk ;set block offset (0,2,4...)
lda #n_nxpch-1 ;start channel number
;
;
; channel processing loop...
;
.iirq110 pha ;save channel number (0 or 1)
clc
adc tiaiblk ;generate channel...
tay ;index (0,1,2,3...)
ldx tiaiblk ;get block offset
lda (tiaisr,x) ;read block IRQ status
and nxprqtab,y ;this channel's RxD interrupting?
beq .iirq130 ;no, skip this channel
;
tya ;copy channel index (0,1,2,3...)
asl ;now channel offset (0,2,4,6...)
tax ;X marks the spot!
;
;
; FIFO processing loop...
;
.iirq120 lda (tiasr,x) ;get channel status
bit #nxprxdr ;RxD FIFO empty?
beq .iirq130 ;yes, done with channel
;
lda (tiafif,x) ;load datum from...
tay ;channel & hold it
lda tiaputrx,x ;circular FIFO 'put' pointer
ina ;bump
cmp tiagetrx,x ;circular FIFO 'get' pointer
beq .iirq120 ;no room, discard datum
;
tya ;recover datum &...
sta (tiaputrx,x) ;store in circular FIFO
inc tiaputrx,x ;new circular FIFO 'put' pointer
bra .iirq120 ;get data more if available
;
; ...end of RxD FIFO processing loop
;
.iirq130 pla ;get current channel
dea ;all channels serviced?
bpl .iirq110 ;no, do next channel
;
; ...end of channel processing loop
;
pla ;get current block
dea ;all blocks serviced?
bpl .iirq100 ;no, do next block
;
; ...end of block processing loopCode: Select all
;UART TRANSMITTER IRQ PROCESSING
;
lda #n_nxpblk-1 ;start block number
;
;
; block processing loop...
;
.iirq200 pha ;save block number
asl ;generate & save...
sta tiaiblk ;block index
lda #n_nxpch-1 ;start channel number
;
;
; channel processing loop...
;
.iirq210 pha ;save current channel number
clc
adc tiaiblk ;compute...
tay ;channel index
ldx tiaiblk ;get block index
lda (tiaisr,x) ;get block IRQ status
and nxptqtab,y ;TxD interrupting?
beq .iirq240 ;no, skip this channel
;
tya ;copy channel index
asl ;now a channel offset
tax ;0,2
;
;
; TxD FIFO processing loop...
;
.iirq220 lda tiagettx,x ;circular FIFO 'get' pointer
cmp tiaputtx,x ;circular FIFO 'put' pointer
beq .iirq230 ;circular FIFO is empty
;
lda (tiasr,x) ;get channel status
bit #nxptxdr ;TxD FIFO full?
beq .iirq240 ;yes, done for now
;
lda (tiagettx,x) ;read circular FIFO &...
sta (tiafif,x) ;write TxD FIFO
inc tiagettx,x ;new 'get' pointer
bra .iirq220
;
.iirq230 lda #nxpcrtxd ;tell UART to...
sta (tiacr,x) ;disable transmitter
lda tiatstab,y ;set a flag saying the...
tsb tiatxst ;transmitter is disabled
;
; ...end of TxD FIFO processing loop
;
.iirq240 pla ;get current channel
dea ;all channels serviced?
bpl .iirq210 ;no, do next channel
;
; ...end of channel processing loop
;
pla ;get current block
dea ;all blocks serviced?
bpl .iirq200 ;no, do next block
;
; ...end of block processing loop