Created
May 17, 2021 00:41
-
-
Save ewalk153/5435bf41324533d6dd0582c09e7b53e9 to your computer and use it in GitHub Desktop.
Basic config for cc65 compiler
This file contains hidden or 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
MEMORY | |
{ | |
ROM: start=$8000, size=$8000, type=ro, define=yes, fill=yes, file=%O; | |
} | |
SEGMENTS | |
{ | |
CODE: load=ROM, type=ro; | |
VECTORS: load=ROM, type=ro, offset=$7ffa; | |
} |
This file contains hidden or 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
.setcpu "6502" | |
; 6551 ACIA | |
ACIA_DATA = $4000 | |
ACIA_STATUS = $4001 | |
ACIA_COMMAND = $4002 | |
ACIA_CONTROL = $4003 | |
ACIA_STATUS_IRQ = 1 << 7 | |
ACIA_STATUS_DSR = 1 << 6 | |
ACIA_STATUS_DCD = 1 << 5 | |
ACIA_STATUS_TX_EMPTY = 1 << 4 | |
ACIA_STATUS_RX_FULL = 1 << 3 | |
ACIA_STATUS_OVERRUN = 1 << 2 | |
ACIA_STATUS_FRAME_ERR = 1 << 1 | |
.code | |
reset: | |
; Set up 6551 ACIA | |
lda #%11001011 ; No parity, no echo, no interrupt | |
sta ACIA_COMMAND | |
lda #%00011111 ; 1 stop bit, 8 data bits, 19200 baud | |
sta ACIA_CONTROL | |
write: | |
LDX #0 | |
next_char: | |
LDY #$ff | |
wait_txd_empty: | |
; lda ACIA_STATUS | |
; and #$10 | |
DEY | |
BNE wait_txd_empty | |
LDA text,x | |
BEQ read | |
jsr write_acia | |
INX | |
JMP next_char | |
read: | |
LDA ACIA_STATUS | |
AND #ACIA_STATUS_RX_FULL | |
BEQ read | |
LDA ACIA_DATA | |
JSR write_acia | |
JMP read | |
write_acia: | |
STA ACIA_DATA | |
RTS | |
nmi: | |
RTI | |
irq: | |
RTI | |
text: ; CR LF Null | |
.byte "Hello Lugo!", $0d, $0a, $00 | |
.segment "VECTORS" | |
.word nmi | |
.word reset | |
.word irq |
This file contains hidden or 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
ca65 min-acia.s | |
ld65 -C be.cfg min-acia.o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment