mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
Merge pull request #2037 from jefftranter/kim1-io-fixes
Fixes and improvements to KIM-1 i/o routines.
This commit is contained in:
commit
d69117c0c1
@ -15,7 +15,7 @@ OUTCHR := $1EA0 ; Output character
|
|||||||
INTCHR := $1E5A ; Input character without case conversion
|
INTCHR := $1E5A ; Input character without case conversion
|
||||||
DUMPT := $1800 ; Dump memory to tape
|
DUMPT := $1800 ; Dump memory to tape
|
||||||
LOADT := $1873 ; Load memory from tape
|
LOADT := $1873 ; Load memory from tape
|
||||||
|
START := $1C4F ; Enter KIM-1 monitor
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; System Memory
|
; System Memory
|
||||||
|
@ -40,8 +40,6 @@ _init: cld ; Clear decimal mode
|
|||||||
|
|
||||||
jsr _main
|
jsr _main
|
||||||
|
|
||||||
; Back from main (this is also the _exit entry). There may be a more elegant way to
|
; Back from main (this is also the _exit entry). Jumps to the KIM-1 monitor.
|
||||||
; return to the monitor on the KIM-1, but I don't know it!
|
|
||||||
|
|
||||||
_exit: brk
|
|
||||||
|
|
||||||
|
_exit: jmp START
|
||||||
|
@ -27,15 +27,10 @@ begin: dec ptr2
|
|||||||
beq done ; If buffer full, return
|
beq done ; If buffer full, return
|
||||||
|
|
||||||
getch: jsr INTCHR ; Get character using Monitor ROM call
|
getch: jsr INTCHR ; Get character using Monitor ROM call
|
||||||
;jsr OUTCHR ; Echo it
|
|
||||||
and #$7F ; Clear top bit
|
and #$7F ; Clear top bit
|
||||||
cmp #$07 ; Check for '\a'
|
cmp #$0D ; Check for '\r'
|
||||||
bne chkcr ; ...if BEL character
|
|
||||||
;jsr BEEP ; Make beep sound TODO
|
|
||||||
chkcr: cmp #$0D ; Check for '\r'
|
|
||||||
bne putch ; ...if CR character
|
bne putch ; ...if CR character
|
||||||
lda #$0A ; Replace with '\n'
|
lda #$0A ; Replace with '\n'
|
||||||
jsr OUTCHR ; and echo it
|
|
||||||
|
|
||||||
putch: ldy #$00 ; Put char into return buffer
|
putch: ldy #$00 ; Put char into return buffer
|
||||||
sta (ptr1),y
|
sta (ptr1),y
|
||||||
|
@ -28,11 +28,10 @@ begin: dec ptr2
|
|||||||
|
|
||||||
outch: ldy #0
|
outch: ldy #0
|
||||||
lda (ptr1),y
|
lda (ptr1),y
|
||||||
|
pha ; Save A (changed by OUTCHR)
|
||||||
jsr OUTCHR ; Send character using Monitor call
|
jsr OUTCHR ; Send character using Monitor call
|
||||||
cmp #$07 ; Check for '\a'
|
pla ; Restore A
|
||||||
bne chklf ; ...if BEL character
|
cmp #$0A ; Check for '\n'
|
||||||
;jsr BEEP ; Make beep sound
|
|
||||||
chklf: cmp #$0A ; Check for 'n'
|
|
||||||
bne next ; ...if LF character
|
bne next ; ...if LF character
|
||||||
lda #$0D ; Add a carriage return
|
lda #$0D ; Add a carriage return
|
||||||
jsr OUTCHR
|
jsr OUTCHR
|
||||||
|
Loading…
Reference in New Issue
Block a user