1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-12 12:29:32 +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:
Bob Andrews 2023-03-29 22:41:34 +02:00 committed by GitHub
commit d69117c0c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 15 deletions

View File

@ -15,7 +15,7 @@ OUTCHR := $1EA0 ; Output character
INTCHR := $1E5A ; Input character without case conversion
DUMPT := $1800 ; Dump memory to tape
LOADT := $1873 ; Load memory from tape
START := $1C4F ; Enter KIM-1 monitor
; ---------------------------------------------------------------------------
; System Memory

View File

@ -40,8 +40,6 @@ _init: cld ; Clear decimal mode
jsr _main
; Back from main (this is also the _exit entry). There may be a more elegant way to
; return to the monitor on the KIM-1, but I don't know it!
_exit: brk
; Back from main (this is also the _exit entry). Jumps to the KIM-1 monitor.
_exit: jmp START

View File

@ -27,15 +27,10 @@ begin: dec ptr2
beq done ; If buffer full, return
getch: jsr INTCHR ; Get character using Monitor ROM call
;jsr OUTCHR ; Echo it
and #$7F ; Clear top bit
cmp #$07 ; Check for '\a'
bne chkcr ; ...if BEL character
;jsr BEEP ; Make beep sound TODO
chkcr: cmp #$0D ; Check for '\r'
cmp #$0D ; Check for '\r'
bne putch ; ...if CR character
lda #$0A ; Replace with '\n'
jsr OUTCHR ; and echo it
putch: ldy #$00 ; Put char into return buffer
sta (ptr1),y

View File

@ -28,11 +28,10 @@ begin: dec ptr2
outch: ldy #0
lda (ptr1),y
pha ; Save A (changed by OUTCHR)
jsr OUTCHR ; Send character using Monitor call
cmp #$07 ; Check for '\a'
bne chklf ; ...if BEL character
;jsr BEEP ; Make beep sound
chklf: cmp #$0A ; Check for 'n'
pla ; Restore A
cmp #$0A ; Check for '\n'
bne next ; ...if LF character
lda #$0D ; Add a carriage return
jsr OUTCHR