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, ...
|
|
|
|
|
2012-10-23 19:42:57 +00:00
|
|
|
.export _cputcxy, _cputc
|
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
|
|
|
|
2012-01-31 20:49:58 +00:00
|
|
|
.include "const.inc"
|
|
|
|
.include "geossym.inc"
|
|
|
|
.include "jumptab.inc"
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
_cputcxy:
|
2012-02-08 15:23:45 +00:00
|
|
|
pha ; Save C
|
|
|
|
jsr popa ; Get Y
|
|
|
|
jsr _gotoxy ; Set cursor, drop x
|
2001-10-27 17:13:22 +00:00
|
|
|
pla ; Restore C
|
|
|
|
|
|
|
|
; Plot a character - also used as internal function
|
|
|
|
|
|
|
|
_cputc:
|
|
|
|
tax ; save character
|
2005-07-25 21:07:12 +00:00
|
|
|
; some characters 0-31 are not safe for PutChar
|
2012-02-08 15:23:45 +00:00
|
|
|
cmp #$20
|
|
|
|
bcs L1
|
|
|
|
cmp #CR
|
|
|
|
beq do_cr
|
|
|
|
cmp #LF
|
|
|
|
beq do_lf
|
|
|
|
cmp #KEY_DELETE
|
|
|
|
bne L0
|
|
|
|
ldx #BACKSPACE
|
2002-03-08 16:47:34 +00:00
|
|
|
sec
|
2012-02-08 15:23:45 +00:00
|
|
|
bcs L2
|
2001-10-27 17:13:22 +00:00
|
|
|
L0: rts
|
|
|
|
|
2002-03-08 16:47:34 +00:00
|
|
|
L1: clc
|
|
|
|
L2: php
|
2012-02-08 15:23:45 +00:00
|
|
|
lda cursor_x
|
|
|
|
sta r11L
|
|
|
|
lda cursor_x+1
|
|
|
|
sta r11H
|
|
|
|
lda cursor_y
|
2012-10-23 19:42:57 +00:00
|
|
|
clc
|
|
|
|
adc #6 ; 6 pixels down to the baseline
|
2012-02-08 15:23:45 +00:00
|
|
|
sta r1H
|
2001-10-27 17:13:22 +00:00
|
|
|
txa
|
2012-02-08 15:23:45 +00:00
|
|
|
jsr PutChar
|
2002-03-08 16:47:34 +00:00
|
|
|
plp
|
2012-10-23 19:42:57 +00:00
|
|
|
bcs fix_cursor
|
2002-03-08 16:47:34 +00:00
|
|
|
|
2012-02-08 15:23:45 +00:00
|
|
|
inc cursor_c
|
|
|
|
lda cursor_c
|
|
|
|
cmp xsize ; hit right margin?
|
2012-10-23 19:42:57 +00:00
|
|
|
bne fix_cursor
|
2012-02-08 15:23:45 +00:00
|
|
|
lda #0 ; yes - do cr+lf
|
|
|
|
sta cursor_c
|
|
|
|
do_lf: inc cursor_r
|
|
|
|
lda cursor_r
|
|
|
|
cmp ysize ; hit bottom margin?
|
2012-10-23 19:42:57 +00:00
|
|
|
bne fix_cursor
|
2012-02-08 15:23:45 +00:00
|
|
|
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:
|
|
|
|
jmp fixcursor
|
2003-03-07 00:31:51 +00:00
|
|
|
|
2012-02-08 15:23:45 +00:00
|
|
|
do_cr: lda #0
|
|
|
|
sta cursor_c
|
2012-10-23 19:42:57 +00:00
|
|
|
beq fix_cursor
|