2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; Maciej 'YTM/Elysium' Witkowiak
|
|
|
|
;
|
|
|
|
; 27.10.2001
|
2002-03-08 16:47:34 +00:00
|
|
|
; 06.03.2002
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
; void cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void cputc (char c);
|
|
|
|
|
|
|
|
.export _cputcxy, _cputc, update_cursor
|
|
|
|
|
2002-03-08 16:47:34 +00:00
|
|
|
.import _gotoxy, fixcursor
|
2001-10-27 17:13:22 +00:00
|
|
|
.import popa
|
2002-03-08 16:47:34 +00:00
|
|
|
.import xsize,ysize
|
2002-12-23 22:14:14 +00:00
|
|
|
.importzp cursor_x, cursor_y, cursor_c, cursor_r
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
.include "../inc/const.inc"
|
|
|
|
.include "../inc/geossym.inc"
|
|
|
|
.include "../inc/jumptab.inc"
|
|
|
|
|
|
|
|
_cputcxy:
|
|
|
|
pha ; Save C
|
|
|
|
jsr popa ; Get Y
|
|
|
|
jsr _gotoxy ; Set cursor, drop x
|
|
|
|
pla ; Restore C
|
|
|
|
|
|
|
|
; Plot a character - also used as internal function
|
|
|
|
|
|
|
|
_cputc:
|
|
|
|
tax ; save character
|
|
|
|
; some characters are not safe for PutChar
|
|
|
|
cmp #$20
|
|
|
|
bcs L1
|
2002-03-08 16:47:34 +00:00
|
|
|
cmp #CR
|
|
|
|
beq echo_crlf
|
|
|
|
cmp #LF
|
|
|
|
beq do_lf
|
2001-10-27 17:13:22 +00:00
|
|
|
cmp #$1d
|
|
|
|
bne L00
|
|
|
|
ldx #BACKSPACE
|
2002-03-08 16:47:34 +00:00
|
|
|
sec
|
|
|
|
bcs L2
|
2001-10-27 17:13:22 +00:00
|
|
|
L00: cmp #ESC_GRAPHICS
|
|
|
|
beq L0
|
|
|
|
cmp #ESC_RULER
|
|
|
|
beq L0
|
|
|
|
cmp #GOTOX
|
|
|
|
beq L0
|
|
|
|
cmp #GOTOY
|
|
|
|
beq L0
|
|
|
|
cmp #GOTOXY
|
|
|
|
beq L0
|
|
|
|
cmp #NEWCARDSET
|
|
|
|
beq L0
|
|
|
|
cmp #$1e
|
|
|
|
bne L1
|
|
|
|
L0: rts
|
|
|
|
|
2002-03-08 16:47:34 +00:00
|
|
|
L1: clc
|
|
|
|
L2: php
|
|
|
|
lda cursor_x
|
2001-10-27 17:13:22 +00:00
|
|
|
sta r11L
|
|
|
|
lda cursor_x+1
|
|
|
|
sta r11H
|
|
|
|
lda cursor_y
|
|
|
|
sta r1H
|
|
|
|
txa
|
|
|
|
jsr PutChar
|
2002-03-08 16:47:34 +00:00
|
|
|
plp
|
|
|
|
bcs update_cursor
|
|
|
|
|
|
|
|
inc cursor_c
|
|
|
|
lda cursor_c
|
|
|
|
cmp xsize
|
|
|
|
bne update_cursor
|
|
|
|
echo_crlf:
|
|
|
|
lda #0
|
|
|
|
sta cursor_c
|
|
|
|
do_lf: inc cursor_r
|
|
|
|
lda cursor_r
|
|
|
|
cmp ysize
|
|
|
|
bne update_cursor
|
|
|
|
dec cursor_r
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
update_cursor:
|
2002-03-08 16:47:34 +00:00
|
|
|
jsr fixcursor
|
|
|
|
lda cursor_x
|
2001-10-27 17:13:22 +00:00
|
|
|
sta r4L
|
2002-03-08 16:47:34 +00:00
|
|
|
lda cursor_x+1
|
2001-10-27 17:13:22 +00:00
|
|
|
sta r4H
|
2002-03-08 16:47:34 +00:00
|
|
|
lda cursor_y
|
2001-10-27 17:13:22 +00:00
|
|
|
sec
|
2002-03-08 16:47:34 +00:00
|
|
|
sbc curHeight
|
2001-10-27 17:13:22 +00:00
|
|
|
sta r5L
|
|
|
|
lda #1 ; update cursor prompt position
|
|
|
|
sta r3L
|
|
|
|
jmp PosSprite
|