2 ; Ullrich von Bassewitz, 06.08.1998
10 .include "cbm_kernal.inc"
13 ; --------------------------------------------------------------------------
15 .segment "LOWCODE" ; Accesses the ROM - must go into low mem
17 _cgetc: lda KEY_COUNT ; Get number of characters
18 ora FKEY_COUNT ; Or with number of function key chars
19 bne L2 ; Jump if there are already chars waiting
21 ; Switch on the cursor if needed
24 lda (CRAM_PTR),y ; Get current char
30 beq L1 ; Jump if no cursor
37 sbc #$0B ; + carry = $C00 (screen address)
46 sta TED_CURSLO ; Cursor off
49 L2: sta ENABLE_ROM ; Bank in the ROM
50 jsr KBDREAD ; Read char and return in A (ROM routine)
51 sta ENABLE_RAM ; Reenable the RAM
55 ; --------------------------------------------------------------------------
56 ; Make the function keys return function key codes instead of the current
57 ; strings so the program will see and may handle them.
58 ; Undo this change when the program ends
63 .segment "ONCE" ; Special init code segment may get overwritten
70 lda #$01 ; Lower 8 places are all $01
78 fnkeys: .byte 133, 137, 134, 138, 135, 139, 136, 140
81 .segment "LOWCODE" ; Accesses the ROM - must go into low mem
85 ldx #$39 ; Copy the original function keys
86 sta ENABLE_ROM ; Bank in the ROM
91 sta ENABLE_RAM ; Bank out the ROM