Re: 65VM02
Posted: Mon Jun 05, 2017 5:35 am
Hugh Aguilar wrote:
Okay, my math was screwed up badly. Your calculation seems to be correct.
And, re: BRK and re: (direct,X) address mode, I echo Garth's responses: never, and all the time.
Code: Select all
;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—
;
;vQUART RECEIVER IRQ PROCESSING
;
iirq0200 lda #n_nxpchn-1 ;starting channel
;
;
; channel processing loop...
;
.0000010 pha ;save channel index
asl ;channel pointer offset
tax
lda (tiaisr,x) ;get IRQ status **********
bit nxprqtab,x ;RxD interrupting?
beq .0000030 ;no, skip this channel
;
lda #nxpcresr ;clear any...
sta (tiacr,x) ;RxD overrun error **********
;
;
; FIFO processing loop...
;
.0000020 lda (tiasr,x) ;get channel status **********
bit #nxprxdr ;RxD FIFO empty?
beq .0000030 ;yes, done with channel
;
lda (tiafif,x) ;get datum **********
xba ;protect it
lda tiaputrx,x ;get CFIFO 'put' pointer
ina ;bump it &...
and #m_fifwrp ;wrap to CFIFO boundary
cmp tiagetrx,x ;any room in CFIFO?
beq .0000020 ;no, discard datum
;
xba ;expose & store...
sta (tiaputrx,x) ;datum in CFIFO **********
xba ;expose & save...
sta tiaputrx,x ;'put' pointer
bra .0000020 ;loop
;
; ...end of FIFO processing loop
;
.0000030 pla ;get channel index
dea ;all channels serviced?
bpl .0000010 ;no
;
; ...end of channel processing loop
;
;—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—-—
;
;vQUART TRANSMITTER IRQ PROCESSING
;
iirq0300 lda #n_nxpchn-1 ;starting channel
;
;
; channel processing loop...
;
.0000010 pha ;save channel index
asl ;channel pointer offset
tax
lda (tiaisr,x) ;get IRQ status **********
bit nxptqtab,x ;TxD interrupting?
beq .0000040 ;no, skip this channel
;
lda tiagettx,x ;yes, load 'get' pointer
;
;
; FIFO processing loop...
;
.0000020 cmp tiaputtx,x ;any data in CFIFO?
beq .0000030 ;no, kill transmitter
;
tay ;protect 'get' pointer
lda (tiasr,x) ;get channel status **********
bit #nxptxdr ;TxD FIFO full?
beq .0000040 ;yes, done for now
;
lda (tiagettx,x) ;read CFIFO &... **********
sta (tiafif,x) ;write to TxD FIFO **********
tya ;recover 'get' pointer
ina ;bump it &...
and #m_fifwrp ;wrap to CFIFO boundary
sta tiagettx,x ;update 'get' pointer
bra .0000020 ;loop
;
; ...end of FIFO processing loop
;
.0000030 lda #nxpcrtxd ;disable...
sta (tiacr,x) ;transmitter **********
lda tiatstab,x ;tell foreground...
tsb tiatxst ;about it
;
.0000040 pla ;get channel index
dea ;all channels serviced?
bpl .0000010 ;no
;
; ...end of channel processing loopCode: Select all
ENTER:
LDY lf
PHY ; push parent's LF to the return-stack under our locals
LLY
STY lf ; set LF to our local frame
NEXT
LEAVE: ; this is used instead of EXIT if ENTER was done (if the function had local variables)
PLY
STY lf ; restore the parent's LF that was pushed in ENTER
OPA ; the operand is the size of our local variables (not counting the pointer to the parent's local frame)
AAS ; discard our local variables
; falls through
WEXIT: ; this exits a function (a "word" in Forth terminology)
PLY
PLA
EXIP ; restore the old IP that was pushed in CALL or EXECUTE
NEXT
Code: Select all
ENTER:
PHM lf ; push parent's LF to the return-stack under our locals
LLY
STY lf ; set LF to our local frame
NEXT
LEAVE: ; this is used instead of EXIT if ENTER was done (if the function had local variables)
PLM lf ; restore the parent's LF that was pushed in ENTER
OPA ; the operand is the size of our local variables (not counting the pointer to the parent's local frame)
AAS ; discard our local variables
; falls through
WEXIT: ; this exits a function (a "word" in Forth terminology)
PLY
PLA
EXIP ; restore the old IP that was pushed in CALL or EXECUTE
NEXT
Code: Select all
DINX add 2 to X effectively the same as: INX INX
DDEX subtract 2 from X effectively the same as: DEX DEX
LDYA direct load YA from the direct-page variable
LDYA (direct,X) load YA indirectly from an array of direct-page pointers indexed by X
STYA direct store YA to the direct-page variable
STYA (direct,X) store YA indirectly to an array of direct-page pointers indexed by X
Code: Select all
LDY toslo,X
LDA toshi,X
Code: Select all
M = maximum revolutions per minute
C = cylinders
T = time in microseconds between ignitions
T= 1E6 / (M/60)*(C/2)
Code: Select all
DINX add 2 to X effectively the same as: INX INX
DDEX subtract 2 from X effectively the same as: DEX DEX