ACIA interrupt handling
This commit is contained in:
1 parent
76dcbd712a
commit
1bc8eda38d
12 files changed
+244
-25
No files matched your search
+7
-3
@@ -6,18 +6,22 @@ Sample Programs
|
||||
When loaded at address $0300, this program will print "Hello, 6502 World!" in
|
||||
infinite loop.
|
||||
|
||||
2. echo.prg
|
||||
2. echo_poll.prg
|
||||
|
||||
When loaded at address $0300, this program will echo back to the console
|
||||
anything typed.
|
||||
|
||||
|
||||
Both hello.prg and echo.prg were assembled with the Ophis assembler:
|
||||
Both hello.prg and echo_poll.prg were assembled with the Ophis assembler:
|
||||
|
||||
https://hkn.eecs.berkeley.edu/~mcmartin/ophis/
|
||||
|
||||
3. echo_irq.rom
|
||||
|
||||
3. ehbasic.rom
|
||||
This is another echo program, and behaves identically to echo_poll.prg,
|
||||
except it is interrupt-driven.
|
||||
|
||||
4. ehbasic.rom
|
||||
|
||||
This is Lee Davison's Enhanced 6502 BASIC.
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
*.rom
|
||||
*.lst
|
||||
*.map
|
||||
*.o
|
||||
@@ -0,0 +1,13 @@
|
||||
CA=ca65
|
||||
LD=ld65
|
||||
|
||||
all: echo_irq
|
||||
|
||||
echo_irq: echo_irq.o
|
||||
$(LD) -C symon.config -vm -m echo_irq.map -o echo_irq.rom echo_irq.o
|
||||
|
||||
echo_irq.o:
|
||||
$(CA) --listing -o echo_irq.o echo_irq.asm
|
||||
|
||||
clean:
|
||||
rm -f *.o *.rom *.map *.lst
|
||||
@@ -0,0 +1,48 @@
|
||||
;;
|
||||
;; Read input from the keyboard, and echo to console.
|
||||
;;
|
||||
|
||||
|
||||
IOBASE = $8800
|
||||
IOSTATUS = IOBASE + 1
|
||||
IOCMD = IOBASE + 2
|
||||
IOCTRL = IOBASE + 3
|
||||
|
||||
.segment "CODE"
|
||||
.org $C000
|
||||
|
||||
START: CLI
|
||||
LDA #$09
|
||||
STA IOCMD ; Set command status
|
||||
LDA #$1A
|
||||
STA IOCTRL ; 0 stop bits, 8 bit word, 2400 baud
|
||||
|
||||
;;
|
||||
;; Infinite idle loop, waiting for interrupt.
|
||||
;;
|
||||
IDLE: LDA #$FF
|
||||
TAX
|
||||
IDLE1: DEX
|
||||
BNE IDLE1
|
||||
JMP IDLE
|
||||
|
||||
;;
|
||||
;; IRQ handler
|
||||
;;
|
||||
IRQ: LDA IOBASE ; Get the character in the ACIA.
|
||||
PHA ; Save accumulator
|
||||
ECHO1: LDA IOSTATUS ; Read the ACIA status
|
||||
AND #$10 ; Is the tx register empty?
|
||||
BEQ ECHO1 ; No, wait for it to empty
|
||||
PLA ; Otherwise, load saved accumulator,
|
||||
STA IOBASE ; write to output,
|
||||
RTI ; and return
|
||||
|
||||
; system vectors
|
||||
|
||||
.segment "VECTORS"
|
||||
.org $FFFA
|
||||
|
||||
.word IRQ ; NMI vector
|
||||
.word START ; RESET vector
|
||||
.word IRQ ; IRQ vector
|
||||
@@ -0,0 +1,16 @@
|
||||
MEMORY {
|
||||
RAM1: start = $0000, size = $8000;
|
||||
ROM1: start = $C000, size = $3FFA, fill = yes;
|
||||
ROMV: start = $FFFA, size = $6, file = %O, fill = yes;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
CODE: load = ROM1, type = ro;
|
||||
DATA: load = ROM1, type = ro;
|
||||
VECTORS: load = ROMV, type = ro;
|
||||
}
|
||||
|
||||
SYMBOLS {
|
||||
__STACKSIZE__ = $0300;
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user