65816: VIA1 Working

I was able to get VIA1 working today! I have it addressed at $108000 and have decode logic working for this part of the I/O range. I picked up the speed of the clock. I'll go to 1MHz+ next.


Current Schematic (minus the LCD)


Assembly Code

MyCode.65816.asm

;VIA Registers
VIA_PORTB = $00
VIA_PORTA = $01
VIA_DDRB  = $02
VIA_DDRA  = $03
VIA_T1C_L = $04
VIA_T1C_H = $05
VIA_T1L_L = $06
VIA_T1L_H = $07
VIA_T2C_L = $08
VIA_T2C_H = $09
VIA_SR    = $0A
VIA_ACR   = $0B
VIA_PCR   = $0C
VIA_IFR   = $0D
VIA_IER   = $0E

;VIA1 Address Line A15 - %00010000:10000000:00000000 - $10:8000
VIA1_ADDR  = $108000
VIA1_PORTB = VIA1_ADDR + VIA_PORTB
VIA1_PORTA = VIA1_ADDR + VIA_PORTA
VIA1_DDRB  = VIA1_ADDR + VIA_DDRB
VIA1_DDRA  = VIA1_ADDR + VIA_DDRA
VIA1_IFR   = VIA1_ADDR + VIA_IFR
VIA1_IER   = VIA1_ADDR + VIA_IER

;VIA2 Address Line A14 - %00010000:01000000:00000000 - $10:4000
;VIA2_ADDR  = $104000
;VIA3 Address Line A13 - %00010000:00100000:00000000 - $10:2000
;VIA3_ADDR  = $102000
;VIA4 Address Line A12 - %00010000:00010000:00000000 - $10:1000
;VIA4_ADDR  = $101000
;VIA5 Address Line A11 - %00010000:00001000:00000000 - $10:0800
;VIA5_ADDR  = $100800
;VIA6 Address Line A10 - %00010000:00000100:00000000 - $10:0400
;VIA6_ADDR  = $100400
;VIA7 Address Line A09 - %00010000:00000010:00000000 - $10:0200
;VIA7_ADDR  = $100200
;VIA8 Address Line A08 - %00010000:00000001:00000000 - $10:0100
;VIA8_ADDR  = $100100
;...

.org $0000
    .word $ABCD     ;write some junk to $0000
.org $8000

reset:
    clc
    ;rep #$30                ; Set 16-bit mode

    ;VIA config
    lda #%01111111          ; Disable all interrupts
    sta VIA1_IER

    lda #%11111111 
    sta VIA1_DDRB           ; Set all pins on port B to output
    sta VIA1_DDRA           ; Set all pins on port A to output

    lda #1

spin_label:
    sta VIA1_PORTA
    rol
    jmp spin_label

.org $FFFC
    .word reset



Addressing


Postscript

I tested some faster clock speeds. I was successful with a 6 MHz clock at the 65816. This is using a 12 MHz oscillator, which is halved when going through the 7474 flip-flop. The next step up I have for oscillators on-hand is a 20 MHz oscillator (10 MHz at the 65816); this failed.


PPS

I swapped out the following ICs...

  • SN74HC245N with 74AC245PC

  • SN74HC573N with CD74AC573E

  • SN74HC00N with SN74AHC00N

  • GAL22V10D-15LP with GAL22V10D-10LP

I left other previous AHC ICs in place. I also left the SN74F260N in place.


Behavior remains the same -- 6 MHz works. My goal wasn't to go faster, but to see if the above IC swaps would impact the output. Keep in mind, I am on a two-layer board without supplemental GND and VCC bodge wires.

118 views5 comments