]> git.sur5r.net Git - cc65/blobdiff - libsrc/c128/cgetc.s
poor man's _toascii routine, contributed by Fatih Aygun
[cc65] / libsrc / c128 / cgetc.s
index aea20f983e7bacf6a40a13a7310822ea4500d284..f3f62ff53db4146568940a54616c25fba1570edd 100644 (file)
@@ -21,6 +21,7 @@ _cgetc:       lda     KEY_COUNT       ; Get number of characters
 
        lda     cursor
                beq     L1
+        jsr     CURS_SET        ; Set cursor to current position
        jsr     CURS_ON
        jmp     L2
 L1:            lda     #$01
@@ -39,32 +40,31 @@ L2:         lda     KEY_COUNT       ; Check characters again
 .bss
 keyvec:        .res    2
 
-.code
+.segment        "INIT"
 initcgetc:
 
 ; Save the old vector
 
-       lda     KeyStoreVec
-       sta     keyvec
-       lda     KeyStoreVec+1
-       sta     keyvec+1
+       lda     KeyStoreVec
+       sta     keyvec
+       lda     KeyStoreVec+1
+       sta     keyvec+1
 
 ; Set the new vector. I can only hope that this works for other C128
 ; versions...
 
-       lda     #<$C6B7
-       ldx     #>$C6B7
-
-SetVec:        sei
-       sta     KeyStoreVec
-       stx     KeyStoreVec+1
-       cli
-       rts
+       lda     #<$C6B7
+       ldx     #>$C6B7
+        jmp     SetVec
 
+.code
 donecgetc:
-        lda     #$00
-        sta     SCROLL
        lda     keyvec
        ldx     keyvec+1
-       bne     SetVec
+SetVec:        sei
+       sta     KeyStoreVec
+       stx     KeyStoreVec+1
+       cli
+       rts
+