More adventures days...
1. 80 nS RAMs will NOT work at 8 MHz clocking. I had the outboard RAM working beautifuly and then today, zip, zilch, nada. running too fast. So back to the 4 MHz fast clock.
2. The RS232 routines DO need the second crystal, so the board is now modified for a 32.768 kHz crystal. Cant find an oscillator of that speed. Sigh.
3. had some VERY wierd fun, had a Hello World program designed to output the phrase from the RS232 port. As an extra test, I also had the datat coming out of the output slots. Guess what? when I invoked ACI_Init from the mask ROM, the output slots would die! VERY freaky fun.
The Answer? My design. when ACI_Init is invoked, it sets up P60 and P61 for RS232. It ALSO sets up P40 as an input and P44-P47 for the SIB networking bus. I am using THOSE as outputs selectors, port enables.
so tomorrow, I am copying the ACI_init routines into my program rom but editing out the P4 extraneous festivities.
also, one gotcha to stupid code technoqies on my part was in not preserving A X and Y when I would do my delay routines. using Y adressed fun such as the RAM tests, it would simply cause hilarity to ensue..
and the 65C134 hacking express merilly rolls along...
;
; 65C134 QC Test Fixture Main Program
; Antonio Gonzalez jr. 2006
;
; SYSTEM
;
; CPU: 65C134 8 MHz
; ROM: 27C256 32K Eprom
; RAM: 6264 8K RAM
; I/O: 8 parallel ports, RS232 port
;
;
; * * * System memory Map & Hardware Equates * * *
;
; $0000-$002f internal registers
; $0040-$00ff internal RAM
; $4000-$5fff 8K RAM (external)
; $8000-$ffff 32K Eprom
; $2000 CS3B for the LED
;
; Ports are defined as follows:
; P4 = Port Enables. they are defined as follows:
; P40 = /Port7En
; P41 = /Port6En down to /Port0En
; active low.
;
; P5 = Port data Bus. P50 = d0, P57 = d7
;
; P6 = port control lines/RS232 as follows:
; P60 = RS232 Rxd
; P61 = RS232 Txd
; P62 = PortA0
; P63 = PortA1
; P64 = PortA2
; P65 = PortR//W
; P66 = PortClock
; P67 = Port/Irq
PD3 =$0003 ; CS Port Register
PCS3 =$0007 ; CS Bit Enable Register
BCR =$001B ; BCR Register
; think of these ports like the 65C22 and you should be ok
Port4Data =$001c
Port5Data =$001d
Port6Data =$0020
Port4PortDir =$001e
Port5DataDir =$001f
Port6DataDir =$0021
RedLightOFF =$0120
RedLightON =$0100
; Mask ROM Vector Equates
; RS232 port calls
AciaInit =$f003 ; Init serial ACIA
ReadChar =$f006 ; Read a character
ChkContC =$f009 ; Check for control C pressed
CrLf =$f012 ; Prince a carriage return & linefeed
PrintSpace =$f015 ; Print a space
GetChar =$f00c ; Get a character with wait
OutChar =$f00f ; write a character
ReadHexAddr =$f021 ; Read address in ascii hex
ReadHexByte =$f024 ; Read byte in ascii hex
WriteHexAddr =$f027 ; Write address in ascii hex
WriteHexByte =$f02a ; Write byte in ascii hex
MS19Out =$f042 ; Output S19 records
MS28In =$f045 ; Input S records
; Data manipulation fuctions
AscToBin =$f018 ; Ascii to binary conversion
BinToAsc =$f01b ; binary to ascii conversion
BinToDec =$f03f ; binary to decimal conversion
CalcChecksum =$f048 ; Calculate checksum
AscHexToBin =$f03c ; Ascii Hex to binary
CheckForAscLtr =$f030 ; Check for ascii
CheckForAscNum =$f02d ; Check for ascii decimal number
MoveDataBlock =$f036 ; Move data block
UpperCase =$4033 ; Convert character to uppercase ascii
;
; * * * Variable Equates * * *
; dont forget that variable space begins at 0040 since lower are registers. will figure out where to
; stick the stack later on...
; use the external RAM at 4 MHz MAXMIMUM, and no higher, thanks!
DelayCountLSB =$4000
DelayCountMSB =$4001
CountLSB =$4002
CountMSB =$4003
CountY =$4004
SlotEnableNum =$4005
DataFromSlot =$4006
DataToSlot =$4007
Temp1 =$4008
Temp2 =$4009
; * * * The ROM beings HERE * * *
.ORG $8000
; Program identifier table
; this is out until I can figure out how to do the bootstrapping correctly for this entire
; shebang...
*= $8000
; .byte "WDC" ;this is used to identify the eprom to the 65C134
; *=$8004 ; go ahead and start your program here.
; Please note that the WDC will NOT work with my code. will have to activate the library...manually...
; Setup Thy Chip Environment
Setup
LDA #$26
TSB PCS3 ; Enables CS5B, CS2B and CS1B. Use the TSB to not munge up the flags.
LDA #$80 ;turn on the mask ROM, please.
TRB BCR
; Setup thy Variables
LDA #$00
STA Port4Data ; Ports like the 65C22
STA Port5Data
STA Port6Data
STA RedLightOFF ; Reset the flip flop
STA RedLightON
STA RedLightOFF
LDA #$ff
STA Port4PortDir ; Write only outputs for now, the Port/Irq will become an input
STA Port5DataDir
STA Port6DataDir
STA DelayCountMSB
STA DelayCountLSB
LDA #$80
TSB SlotEnableNum; only slot 0 for now.
LDA #$07 ; 2400 baud
LDX #$08 ; 8 bits
LDY #$00 ; no parity
; JSR AciaInit
CMP #$ff
BEQ BadSerialInit ; hope it inited ok...
JMP Setup2
BadSerialInit
JSR TurnRedLightOFF
JSR BigDelay
JSR TurnRedLightON
JSR BigDelay
JSR TurnRedLightOFF
JSR BigDelay
JSR TurnRedLightON
JSR BigDelay
JSR TurnRedLightOFF
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JSR BigDelay
JMP BadSerialInit
Setup2
LDY #$00
Loop
LDA SerialString,y
JSR PushToSerial
INY
CPY #$0c
BEQ Setup2
JMP Loop
PushToSerial
; JSR OutChar
LDA SerialString,y
STA DataToSlot
JSR WriteToSlot
JSR TurnRedLightON
JSR BigDelay
JSR TurnRedLightOFF
JSR BigDelay
RTS
; Library Routines
TurnRedLightOFF
LDA #$00
STA RedLightOFF
RTS
TurnRedLightON
LDA #$00
STA RedLightON
RTS
WriteToSlot
LDA DataToSlot
EOR #$ff
STA Port5Data
LDA SlotEnableNum
STA Port4Data
JSR TinyDelay
LDA #$00
STA Port4Data
JSR TinyDelay
LDA SlotEnableNum
STA Port4Data
JSR TinyDelay
LDA #$00
STA Port4Data
JSR TinyDelay
RTS
ReadFromSlot
LDA SlotEnableNum
STA Port4Data
JSR TinyDelay
LDA #$00
STA Port4Data
JSR TinyDelay
LDA Port5Data
STA DataFromSlot
LDA SlotEnableNum
STA Port4Data
JSR TinyDelay
LDA #$00
STA Port4Data
JSR TinyDelay
RTS
TinyDelay
PHX
LDX #$ff
TinyDelay1
DEX
BNE TinyDelay1
PLX
RTS
BigDelay
PHX ; Save it, willya? Thanks
PHY
PHA
LDX DelayCountMSB
LDY DelayCountLSB
BigDelay1
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
DEY
BNE BigDelay1
LDY DelayCountLSB
DEX
BNE BigDelay1
PLX ; Bring 'em back alive!
PLY
PLA
RTS
*=$e000
SerialString:
.BYTE "H"
.BYTE "e"
.BYTE "l"
.BYTE "l"
.BYTE "o"
.BYTE " "
.BYTE "W"
.BYTE "o"
.BYTE "r"
.BYTE "l"
.BYTE "d"
; reset vector
; Just hang it over to 8000 for now, mate
*= $fffc
.BYTE $80,00
.BYTE $80,00
Anyhoo, the working Hello World code so far is as follows...