2015-09-27 16:12:25 +00:00
|
|
|
;
|
2015-10-11 15:13:28 +00:00
|
|
|
; Groepaz/Hitmen, 11.10.2015
|
|
|
|
;
|
2015-10-19 00:47:40 +00:00
|
|
|
; high level implementation for the soft80 implementation
|
|
|
|
;
|
2015-09-27 16:12:25 +00:00
|
|
|
; char cgetc (void);
|
|
|
|
;
|
|
|
|
|
|
|
|
.export soft80_cgetc
|
2015-10-14 15:24:16 +00:00
|
|
|
.import soft80_internal_cellcolor, soft80_internal_cursorxlsb
|
2015-09-28 14:10:11 +00:00
|
|
|
.import cursor
|
2015-10-09 21:39:37 +00:00
|
|
|
.importzp tmp1
|
2015-09-27 16:12:25 +00:00
|
|
|
|
|
|
|
.include "c64.inc"
|
|
|
|
.include "soft80.inc"
|
|
|
|
|
|
|
|
soft80_cgetc:
|
|
|
|
lda KEY_COUNT ; Get number of characters
|
2015-10-12 18:38:06 +00:00
|
|
|
bne @L3 ; Jump if there are already chars waiting
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-10-12 15:12:44 +00:00
|
|
|
sec
|
2015-10-08 18:43:25 +00:00
|
|
|
jsr invertcursor ; set cursor on or off accordingly
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-10-12 18:38:06 +00:00
|
|
|
@L1: lda KEY_COUNT ; wait for key
|
|
|
|
beq @L1
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-10-12 15:12:44 +00:00
|
|
|
clc
|
2015-10-08 18:43:25 +00:00
|
|
|
jsr invertcursor ; set cursor on or off accordingly
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-10-12 18:38:06 +00:00
|
|
|
@L3: jsr KBDREAD ; Read char and return in A
|
2015-09-27 16:12:25 +00:00
|
|
|
ldx #0
|
|
|
|
rts
|
|
|
|
|
2015-10-08 18:43:25 +00:00
|
|
|
; Switch the cursor on or off (invert)
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-10-08 18:43:25 +00:00
|
|
|
invertcursor:
|
|
|
|
lda cursor
|
|
|
|
bne @invert
|
2015-09-27 16:12:25 +00:00
|
|
|
rts
|
2015-10-08 18:43:25 +00:00
|
|
|
@invert:
|
2015-09-27 16:12:25 +00:00
|
|
|
|
|
|
|
sei
|
2015-10-09 21:39:37 +00:00
|
|
|
lda $01 ; enable RAM under I/O
|
2015-09-27 16:12:25 +00:00
|
|
|
pha
|
2015-10-09 21:39:37 +00:00
|
|
|
lda #$34
|
2015-09-27 16:12:25 +00:00
|
|
|
sta $01
|
|
|
|
|
|
|
|
ldy #$00
|
2015-10-09 21:39:37 +00:00
|
|
|
jsr setcolor
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-10-12 13:44:41 +00:00
|
|
|
ldx soft80_internal_cursorxlsb
|
2015-10-08 18:43:25 +00:00
|
|
|
@lp1:
|
2015-09-27 16:12:25 +00:00
|
|
|
lda (SCREEN_PTR),y
|
2015-10-08 18:43:25 +00:00
|
|
|
eor nibble,x
|
2015-09-27 16:12:25 +00:00
|
|
|
sta (SCREEN_PTR),y
|
|
|
|
iny
|
2015-10-08 18:43:25 +00:00
|
|
|
cpy #8
|
|
|
|
bne @lp1
|
2015-09-27 16:12:25 +00:00
|
|
|
|
|
|
|
pla
|
2015-10-12 15:12:44 +00:00
|
|
|
sta $01 ; enable I/O
|
2015-09-27 16:12:25 +00:00
|
|
|
cli
|
|
|
|
rts
|
|
|
|
|
2015-10-09 21:39:37 +00:00
|
|
|
; do not use soft80_putcolor here to make sure the cursor is always
|
|
|
|
; shown using the current textcolor without disturbing the "color voodoo"
|
|
|
|
; in soft80_cputc
|
|
|
|
setcolor:
|
|
|
|
;ldy #0 ; is 0
|
2015-10-12 15:12:44 +00:00
|
|
|
bcs @set
|
2015-10-09 21:39:37 +00:00
|
|
|
; restore old value
|
|
|
|
lda tmp1
|
|
|
|
sta (CRAM_PTR),y ; vram
|
|
|
|
rts
|
|
|
|
@set:
|
2015-10-12 16:09:50 +00:00
|
|
|
; save old value
|
2015-10-09 21:39:37 +00:00
|
|
|
lda (CRAM_PTR),y ; vram
|
|
|
|
sta tmp1
|
2015-10-14 15:24:16 +00:00
|
|
|
lda soft80_internal_cellcolor
|
2015-10-09 21:39:37 +00:00
|
|
|
sta (CRAM_PTR),y ; vram
|
|
|
|
rts
|
|
|
|
|
2015-10-08 18:43:25 +00:00
|
|
|
.rodata
|
|
|
|
nibble: .byte $f0, $0f
|
2015-10-09 11:34:23 +00:00
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
; force the init constructor to be imported
|
|
|
|
|
|
|
|
.import soft80_init
|
|
|
|
conio_init = soft80_init
|