diff --git a/asminc/kim1.inc b/asminc/kim1.inc index 68f059490..2fb1117fa 100644 --- a/asminc/kim1.inc +++ b/asminc/kim1.inc @@ -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 diff --git a/libsrc/kim1/crt0.s b/libsrc/kim1/crt0.s index f1fee86c1..906b3b980 100644 --- a/libsrc/kim1/crt0.s +++ b/libsrc/kim1/crt0.s @@ -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 diff --git a/libsrc/kim1/read.s b/libsrc/kim1/read.s index 5566a9f27..dd178ee98 100644 --- a/libsrc/kim1/read.s +++ b/libsrc/kim1/read.s @@ -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 diff --git a/libsrc/kim1/write.s b/libsrc/kim1/write.s index 216f5031c..96bcc91d1 100644 --- a/libsrc/kim1/write.s +++ b/libsrc/kim1/write.s @@ -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