1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-05 21:29:03 +00:00

conio with fixed width and proportional font support

git-svn-id: svn://svn.cc65.org/cc65/trunk@1178 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
izydorst 2002-03-08 16:47:34 +00:00
parent d537134626
commit ae74057353
10 changed files with 96 additions and 92 deletions

View File

@ -7,8 +7,9 @@
@$(AS) -o $@ $(AFLAGS) $<
S_OBJS = cchvline.o cgetc.o clrscr.o color.o cputc.o cputs.o cursor.o gotoxy.o kbhit.o\
revers.o screensize.o where.o
S_OBJS = cclear.o chline.o cvline.o cgetc.o clrscr.o color.o\
cputc.o cpputs.o cputs.o cursor.o gotoxy.o kbhit.o revers.o\
screensize.o where.o _scrsize.o
all: $(S_OBJS)

View File

@ -3,32 +3,28 @@
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001
; 06.03.2002
; unsigned char cgetc (void);
.export _cgetc
.import update_cursor
.include "../inc/jumptab.inc"
.include "../inc/geossym.inc"
.include "cursor.inc"
.include "../inc/cursor.inc"
_cgetc:
; show cursor if needed
lda cursor_flag
beq L0
lda #1
sta r3L
jsr update_cursor
lda cursor_x
ldx cursor_x+1
sta r4L
sta stringX
stx r4H
stx stringX+1
lda cursor_y
sec
sbc curHeight
sta r5L
lda cursor_y
sta stringY
jsr PosSprite
jsr PromptOn

View File

@ -3,19 +3,21 @@
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001
; 06.03.2002
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
.export _cputcxy, _cputc, update_cursor
.import _gotoxy
.import _gotoxy, fixcursor
.import popa
.import xsize,ysize
.include "../inc/const.inc"
.include "../inc/geossym.inc"
.include "../inc/jumptab.inc"
.include "cursor.inc"
.include "../inc/cursor.inc"
_cputcxy:
pha ; Save C
@ -30,10 +32,15 @@ _cputc:
; some characters are not safe for PutChar
cmp #$20
bcs L1
cmp #CR
beq echo_crlf
cmp #LF
beq do_lf
cmp #$1d
bne L00
ldx #BACKSPACE
bne L1
sec
bcs L2
L00: cmp #ESC_GRAPHICS
beq L0
cmp #ESC_RULER
@ -50,7 +57,9 @@ L00: cmp #ESC_GRAPHICS
bne L1
L0: rts
L1: lda cursor_x
L1: clc
L2: php
lda cursor_x
sta r11L
lda cursor_x+1
sta r11H
@ -58,18 +67,31 @@ L1: lda cursor_x
sta r1H
txa
jsr PutChar
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
update_cursor:
lda r11L
sta cursor_x
jsr fixcursor
lda cursor_x
sta r4L
lda r11H
sta cursor_x+1
lda cursor_x+1
sta r4H
lda r1H
sta cursor_y
lda cursor_y
sec
sbc curHeight
sbc curHeight
sta r5L
lda #1 ; update cursor prompt position
sta r3L

View File

@ -1,41 +1,36 @@
;
; Maciej 'YTM/Elysium' Witkowiak
; Ullrich von Bassewitz, 06.08.1998
;
; 27.10.2001
; void cputsxy (unsigned char x, unsigned char y, char* s);
; void cputs (char* s);
;
.export _cputsxy, _cputs
.import update_cursor, _gotoxy
.import popa
.include "../inc/const.inc"
.include "../inc/geossym.inc"
.include "../inc/jumptab.inc"
.include "cursor.inc"
.export _cputsxy, _cputs
.import popa, _gotoxy, _cputc
.importzp ptr1, tmp1
_cputsxy:
sta r0L ; Save s for later
stx r0H
sta ptr1 ; Save s for later
stx ptr1+1
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, pop x
jmp L0 ; Same as cputs...
_cputs: sta r0L ; Save s
stx r0H
_cputs: sta ptr1 ; Save s
stx ptr1+1
L0: ldy #0
lda (r0),y
bne L1 ; Jump if there's something
rts
L1: lda (ptr1),y
beq L9 ; Jump if done
iny
sty tmp1 ; Save offset
jsr _cputc ; Output char, advance cursor
ldy tmp1 ; Get offset
bne L1 ; Next char
inc ptr1+1 ; Bump high byte
bne L1
; Done
L9: rts
L1: lda cursor_x
sta r11L
lda cursor_x+1
sta r11H
lda cursor_y
sta r1H
jsr PutString
jmp update_cursor

View File

@ -7,29 +7,22 @@
; unsigned char cursor (unsigned char onoff);
.export _cursor
.import update_cursor
.include "../inc/jumptab.inc"
.include "../inc/geossym.inc"
.include "cursor.inc"
.include "../inc/cursor.inc"
_cursor:
tay ; onoff into Y
ldx #0 ; High byte of result
ldx cursor_flag ; Get old value
lda cursor_flag ; Get old value
pha
sty cursor_flag ; Set new value
tya
beq L1
lda curHeight ; prepare cursor
jsr InitTextPrompt
lda cursor_x ; position it on screen
sta r4L
lda cursor_x+1
sta r4H
lda cursor_y
sec
sbc curHeight
sta r5L
lda #1
sta r3L
jsr PosSprite
L1: rts
jsr update_cursor ; place it on screen
L1: pla
rts

View File

@ -3,29 +3,38 @@
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001
; 06.03.2002
; void gotox (unsigned char x);
; void gotoy (unsigned char y);
; void gotoxy (unsigned char x, unsigned char y);
.export _gotox, _gotoy, _gotoxy
.export _gotox, _gotoy, _gotoxy, fixcursor
.import popa
.include "../inc/jumptab.inc"
.include "cursor.inc"
.include "../inc/cursor.inc"
_gotox: sta cursor_x
_gotox: sta cursor_c
jmp fixcursor
_gotoy: sta cursor_y
_gotoy: sta cursor_r
inc cursor_r
jmp fixcursor
_gotoxy: sta cursor_y
_gotoxy: sta cursor_r
inc cursor_r
jsr popa
sta cursor_x
sta cursor_c
; convert 8x8 x/y coordinates to GEOS hires
fixcursor:
lda cursor_c
sta cursor_x
lda #0
sta cursor_x+1
lda cursor_r
sta cursor_y
ldx #cursor_x
ldy #3
jsr DShiftLeft

View File

@ -7,7 +7,7 @@
; unsigned char revers (unsigned char onoff);
.export _revers
.import tmp1
.importzp tmp1
.include "../inc/geossym.inc"
.include "../inc/const.inc"

View File

@ -3,6 +3,7 @@
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001
; 06.03.2002
; void screensize (unsigned char* x, unsigned char* y);
;
@ -11,6 +12,7 @@
.import popax
.importzp ptr1, ptr2
.import xsize, ysize
.include "../inc/geossym.inc"
@ -23,13 +25,8 @@ _screensize:
sta ptr2
stx ptr2+1
ldy #0
lda graphMode
bpl L1
lda #80 ; 80 columns (more or less)
.byte $2c
L1: lda #40 ; 40 columns (more or less)
lda xsize
sta (ptr2),y
lda #24 ; something like that for Y size
lda ysize
sta (ptr1),y
rts

View File

@ -3,6 +3,7 @@
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001
; 06.03.2002
; unsigned char wherex (void);
; unsigned char wherey (void);
@ -11,20 +12,10 @@
.importzp tmp1, tmp2
.include "../inc/jumptab.inc"
.include "cursor.inc"
.include "../inc/cursor.inc"
_wherex: lda cursor_x
sta tmp1
lda cursor_x+1
sta tmp2
ldx #tmp1
ldy #3
jsr DShiftRight
lda tmp1
_wherex: lda cursor_c
rts
_wherey: lda cursor_y
lsr
lsr
lsr
_wherey: lda cursor_r
rts

View File

@ -8,7 +8,7 @@
@$(AS) -o $@ $(AFLAGS) $<
S_OBJS = callroutine.o enterdesktop.o firstinit.o getrandom.o getserialnumber.o\
S_OBJS = ctype.o callroutine.o enterdesktop.o firstinit.o getrandom.o getserialnumber.o\
initdoneio.o mainloop.o panic.o tobasic.o setdevice.o get_ostype.o
all: $(S_OBJS)