6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Sep 21, 2024 3:10 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jun 20, 2006 9:00 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
WHY.


Still doing the 65C134. The next trick towards getting it going is the Hello, world" thing to come out of the RS232 port.

the fun began the second I went for the interrupts.

Roy helped me out muchio by sending me a simplified code thaqt starts out printing hello to the RS232 on the developer board. VERY simple code.

It did the exact same thing to my cboard, crash and burn.

I went for resistor pullups on P40-P42 which can be reconfigured to IRQ1, IRQ2 and NMI. No difference.

I began wolftrapping the code to see where things were going.

IRQBRK was the first culprit, getting that pointed to START code got it going.

same with IRQAT. (transmit interrupt I guess)

I dont know WHAT posessed me but what I did to get things going was to CLI to begin the interrupts, and the next command was SEI, to disable them again!

I also changed the timer input to 2400 baud at 4 MHz.

that actually WORKED and the RS232 is outputting hello as per code. Occasionally adds an L, but I think that XPs fault.

anyhoo, code posted for the fun there.

but was going to ask, why would the interrupts go ape on me like that?> I have interrupt handling code but it would get stuck on them.

so anyhoo, RS232 outputting without the use of interrupts.

I am going to try and have it input stuph noow, 2 way madness to go with :)

; Hello, World.

.ORG $0000

PD3 =$0003 ; CS Port Data (output only so a Direction register is not needed)
PCS3 =$0007
TCR1 =$000A ;
BCR =$001B
ACSR =$0022 ;UART Async Control and Status Reg
ARTD =$0023 ;UART Async Transmit/Receive Reg
TALL =$0024 ;TIMER A LATCH LOW
TALH =$0025 ; Latch High
LEDOFF =$0100
LEDON =$0120
DelayCountMSB =$0040
DelayCountLSB =$0041


.org $8000
START
.db 'W'
.db 'D'
.db 'C'

SEI
CLD ; clear decimal mode
LDA #$26
STA PCS3 ; set up the CS port for the red led and so on
LDA #$01 ; external memory bus enable
TSB BCR

LDA #$08 ;SETUP SERIAL IRQS (Set Timer A running)
TSB TCR1 ; Clear Timer A IRQ for UART
LDA #$67 ;2400 BAUD
STA TALL
LDA #$00
STA TALH
; ACSR DEFINITIONS
;BIT 0-XMIT PORT ENABLE
;BIT 1-XMIT DISCHARGE IRQ
;BIT 2-7/8 BIT DATA
;BIT 3-PARITY ENABLE
;BIT 4-ODD/EVEN PARITY
;BIT 5-RECV ENABLE
;BIT 6-SOFTWARE SEMIPHORE
;BIT 7-RECV ERROR FLG

LDA #$25 ;Enable Receive - 8 Bit - $24
STA ACSR
LDA #$08 ;SETUP SERIAL IRQS (Set Timer A running)
TSB TCR1
STZ ARTD ;SET DATA TO NULL & Clear any Xmit IRQ
CLI ; Eable IRQs for 134 UART

SEI ; shut them down again!




Loop
LDA #$48 ;H
JSR PUTBYTE
LDA #$45 ;E
JSR PUTBYTE
LDA #$4C ;L
JSR PUTBYTE
LDA #$4C ;L
JSR PUTBYTE
LDA #$4F ;O
JSR PUTBYTE
LDA #$20 ; space
JSR PUTBYTE
JMP Loop


PUTBYTE:
STA ARTD
LDA #$40
TSB ACSR
JSR BigDelay
RTS


; Tony's cheap debuggers here....

NormalFlash
LDA #$FF
STA LEDON
JSR BigDelay
STA LEDOFF
JSR BigDelay
JMP NormalFlash

DeathFlash
LDA #$FF
STA LEDON ; the red light goes off and on
JSR BigDelay
STA LEDOFF
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JMP DeathFlash


BigDelay
PHA ; Save it, willya? Thanks
PHX
PHY
LDA #$FF
STA DelayCountMSB
STA DelayCountLSB
LDX DelayCountMSB
LDY DelayCountLSB
BigDelay1
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
DEY
BNE BigDelay1
LDY DelayCountLSB
DEX
BNE BigDelay1
PLY ; Bring 'em back alive!
PLX
PLA
RTS

badVec:
RTI

IRQAT:
LDA $40 ; cleat the software semaphore
TRB ACSR
RTI

; vectors SECTION OFFSET
.org $FFD0

;65C134 8 bit Interrupt Vectors

.dw badVec ; $FFD0 - PE44(134)
.dw badVec ; $FFD2 - PE45(134)
.dw badVec ; $FFD4 - NE46(134)
.dw badVec ; $FFD6 - NE47(134)
.dw badVec ; $FFD8 - PE50(134)
.dw badVec ; $FFDA - PE51(134)
.dw badVec ; $FFDC - NE52(134)
.dw badVec ; $FFDE - NE43(134)
.dw badVec ; $FFE0 - IRQRVD2(134)
.dw badVec ; $FFE2 - IRQRVD1(134)
.dw START ; $FFE4 - IRQAT(134)
.dw badVec ; $FFE6 - IRQAR(134)
.dw badVec ; $FFE8 - C134_SBI(134)
.dw badVec ; $FFEA - PE54(134)
.dw badVec ; $FFEC - PE55(134)
.dw badVec ; $FFEE - PE56(134)
.dw badVec ; $FFF0 - NE57(134)
.dw badVec ; $FFF2 - IRQT1(134)
.dw badVec ; $FFF4 - IRQT2(134)
.dw badVec ; $FFF6 - IRQ1(134)
.dw badVec ; $FFF8 - IRQ2(134)
; Common 8 bit Vectors for all CPUs
.dw badVec ; $FFFA - NMIRQ
.dw START ; $FFFC - RESET
.dw START ; $FFFE - IRQ BRK

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 20, 2006 9:01 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
sorry for the seperate topic, but the question I have for everyone, why would the interrupts go ape on me like this?

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: