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
|
2005-07-25 21:07:12 +00:00
|
|
|
; 25.07.2005
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
; void cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void cputc (char c);
|
|
|
|
|
2005-07-25 21:07:12 +00:00
|
|
|
; TODO:
|
|
|
|
; TAB (should be implemented)
|
|
|
|
; other special characters directly from keyboard are unsafe, though some might be
|
|
|
|
; implemented:
|
|
|
|
; HOME, UPLINE, ULINEON, ULINEOFF, REV_ON, REV_OFF, BOLDON, ITALICON, OUTLINEON, PLAINTEXT
|
|
|
|
; and cursor movement, maybe stuff like INSERT too
|
|
|
|
;
|
|
|
|
; these must be ignored:
|
|
|
|
; ESC_GRAPHICS, ESC_RULER, GOTOX, GOTOY, GOTOXY, NEWCARDSET, all 1..8
|
|
|
|
;
|
|
|
|
; note that there are conflicts between control characters and keyboard:
|
|
|
|
; HOME = KEY_ENTER, KEY_HOME = REV_ON,
|
|
|
|
; UPLINE = ?, KEY_UPARROW = GOTOY, ...
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _cputcxy, _cputc
|
2016-06-05 12:58:38 +00:00
|
|
|
.import gotoxy, fixcursor
|
2013-05-09 11:56:54 +00:00
|
|
|
.import xsize,ysize
|
|
|
|
.importzp cursor_x, cursor_y, cursor_c, cursor_r
|
2001-10-27 17:13:22 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "const.inc"
|
|
|
|
.include "geossym.inc"
|
|
|
|
.include "jumptab.inc"
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
_cputcxy:
|
2013-05-09 11:56:54 +00:00
|
|
|
pha ; Save C
|
2016-06-05 12:58:38 +00:00
|
|
|
jsr gotoxy ; Set cursor, drop x and y
|
2013-05-09 11:56:54 +00:00
|
|
|
pla ; Restore C
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
; Plot a character - also used as internal function
|
|
|
|
|
|
|
|
_cputc:
|
2013-05-09 11:56:54 +00:00
|
|
|
tax ; save character
|
2005-07-25 21:07:12 +00:00
|
|
|
; some characters 0-31 are not safe for PutChar
|
2013-05-09 11:56:54 +00:00
|
|
|
cmp #$20
|
|
|
|
bcs L1
|
|
|
|
cmp #CR
|
|
|
|
beq do_cr
|
|
|
|
cmp #LF
|
|
|
|
beq do_lf
|
|
|
|
cmp #KEY_DELETE
|
|
|
|
bne L0
|
|
|
|
ldx #BACKSPACE
|
|
|
|
sec
|
|
|
|
bcs L2
|
|
|
|
L0: rts
|
2001-10-27 17:13:22 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
L1: clc
|
|
|
|
L2: php
|
|
|
|
lda cursor_x
|
|
|
|
sta r11L
|
|
|
|
lda cursor_x+1
|
|
|
|
sta r11H
|
|
|
|
lda cursor_y
|
|
|
|
clc
|
|
|
|
adc #6 ; 6 pixels down to the baseline
|
|
|
|
sta r1H
|
|
|
|
txa
|
|
|
|
jsr PutChar
|
|
|
|
plp
|
|
|
|
bcs fix_cursor
|
2002-03-08 16:47:34 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
inc cursor_c
|
|
|
|
lda cursor_c
|
|
|
|
cmp xsize ; hit right margin?
|
|
|
|
bne fix_cursor
|
|
|
|
lda #0 ; yes - do cr+lf
|
|
|
|
sta cursor_c
|
|
|
|
do_lf: inc cursor_r
|
|
|
|
lda cursor_r
|
|
|
|
cmp ysize ; hit bottom margin?
|
|
|
|
bne fix_cursor
|
|
|
|
dec cursor_r ; yes - stay in the last line
|
2001-10-27 17:13:22 +00:00
|
|
|
|
2012-10-23 19:42:57 +00:00
|
|
|
fix_cursor:
|
2013-05-09 11:56:54 +00:00
|
|
|
jmp fixcursor
|
2003-03-07 00:31:51 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
do_cr: lda #0
|
|
|
|
sta cursor_c
|
|
|
|
beq fix_cursor
|