Today we finally got the stage 2 to work properly, we got a led blinking!
We started with a small code that should cycle thru the colors of the rgb led we got connected to a register.

When we tried the code the led only blinked once and was dark after that. When we looked in to the schematics we found that we were generating a active low enable signal from our address-logic and the 373 chip needed active high logic.
Easy fix, we just change a line in the GAL code:
PIN 14 = !EXP_EN ; /* Enable Expansion Port */
PIN 15 = !VDC_EN ; /* Enable Video Port */
PIN 16 = !SNDR_EN ; /* Enable Sound Port Right */
PIN 17 = !SNDL_EN ; /* Enable Sound Port Left */
PIN 18 = !CF_EN ; /* Enable Compact Flash */
PIN 19 = !PAR_EN ; /* Enable Parallel Port */
PIN 20 = !SER_EN ; /* Enable Serial Port */
PIN 21 = PWR_EN ; /* Enable PowerLed Port */ <--- HERE!
PIN 22 = !IRQ_EN ; /* Enable IRQ Handler */
PIN 23 = !MEM_EN ; /* Enable MMU */
After we fixed that we got it to light up, but not change color... Hmmm... After some looking at the code we realized that if the stack was not properly set up the jump instructions used in the delay would not work. Said and done, we updated the code and added initialization of the bank register for good measure :
org $FE00
PWR_LED EQU $F405
BANK_REG_0 EQU $F400
BANK_REG_1 EQU $F401
BANK_REG_2 EQU $F402
BANK_REG_3 EQU $F403
_START:
clrb
LOOP:
stb PWR_LED
ldx #$03E8
jsr DELAY_MS
cmpb #$07
beq _START
incb
bra LOOP
DELAY_MS:
lda #$7C ; 2 cycles
DELAY_MS_LOOP:
nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
deca ; 1 cycles
cmpa #$00 ; 4 cycles
bne DELAY_MS_LOOP ; 3 cycles
nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
leax ,-x ; 5 cycles
cmpx #$0000 ; 4 cycles
bne DELAY_MS ; 3 cycles
rts ; 4 cycles
STACK EQU $1000
org $FF00
HOOK_RESTART:
; Initialize the 6309 CPU in native mode
ldmd #$01
; Initialize the bank registers
clra
sta BANK_REG_0
sta BANK_REG_1
sta BANK_REG_2
sta BANK_REG_3
; Set up the stack
lds #STACK
lbra _START
HANG:
bra HANG
org $FFF0
vrestart: fdb HOOK_RESTART With this fixes the power led started cycling as expected! IT WORKS!

This means that following works:
- Signal logic
- Address logic
- Memory logic
- Bank registers
- PWR_LED register with led
- Low RAM and ROM
Next up is to get the serial port working, my son is working on a SREC parser so we will be able to upload code to execute and run.
Eric Lind
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.