Move the initialization code from conio.s as constructor/destructor code

into the cgetc and cputc modules.
Fix color routines using additional snippets from MagerValp.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1789 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-12-19 22:53:13 +00:00
parent 8775a9da8a
commit 181748bf03
5 changed files with 106 additions and 62 deletions

View File

@@ -5,10 +5,15 @@
;
.export _cgetc
.constructor initcgetc
.destructor donecgetc
.import cursor
.include "c128.inc"
;--------------------------------------------------------------------------
_cgetc: lda KEY_COUNT ; Get number of characters
bne L2 ; Jump if there are already chars waiting
@@ -28,4 +33,38 @@ L2: lda KEY_COUNT ; Check characters again
ldx #0
rts
;--------------------------------------------------------------------------
; Module constructor/destructor
.bss
keyvec: .res 2
.code
initcgetc:
; Save the old vector
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
donecgetc:
lda #$00
sta SCROLL
lda keyvec
ldx keyvec+1
bne SetVec