Last active
November 19, 2022 18:53
-
-
Save ryu10/0f95e8a263fd6b5e7178b2bc16fc8049 to your computer and use it in GitHub Desktop.
MC6821 PIA test programs for Lambda-2022 computer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** | |
* PIA - Blink All ports | |
* | |
* RyuStudio Nov. 2022 | |
*** | |
* | |
* Lambda-2022 PIA Adrs | |
p0da equ $f008 ; PIA0 DA | |
p0ca equ p0da+1 ; PIA0 CA | |
p0db equ p0da+2 ; PIA0 DB | |
p0cb equ p0da+3 ; PIA0 CB | |
p1da equ $f010 ; PIA1 DA | |
p1ca equ p1da+1 ; PIA1 CA | |
p1db equ p1da+2 ; PIA1 DB | |
p1cb equ p1da+3 ; PIA1 CB | |
* | |
org $8000 | |
* | |
initpia jsr initpia0 ; set all ports on PA and PB to outputs | |
ldaa #20 | |
ldab #$ff | |
loop stab p0da | |
stab p0db | |
jsr wait500ms | |
clr p0da | |
clr p0db | |
jsr wait500ms | |
deca | |
bne loop | |
swi ; return to MikBug | |
* | |
* | |
* | |
initpia0 ldx #p0da | |
jsr initport | |
ldx #p0db | |
initport clra | |
ldab #$ff | |
staa 1,X ; reset Cx, select DDRx | |
stab 0,X ; set DDRx ; all output | |
ldaa #4 | |
staa 1,X ; select PRx | |
rts | |
initpia1 ldx #p1da | |
jsr initport | |
ldx #p1db | |
bra initport | |
* | |
wait500ms psha | |
ldaa #250 | |
w5loop jsr wait2ms | |
deca | |
bne w5loop ; 2ms * 250 = 500ms | |
pula | |
rts | |
* | |
wait2ms psha | |
clra | |
w2loop nop | |
deca | |
bne w2loop ; 8us * 256 = 2ms | |
pula | |
rts | |
* | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment