Fixed several aspects of the GEOS CONIO implementation:

- cputc was drawing at the wrong position, therefore one line had to be removed as a workaround.
- chline, cvline were drawing one pixel to large lines.
- cclear was drawing an in both directions one pixel to big rect.
- the cursor was drawn at wrong times at wrong places in a wrong size.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5874 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc
2012-10-23 19:42:57 +00:00
parent 9930379665
commit 46f1085e2d
11 changed files with 59 additions and 80 deletions

View File

@@ -11,7 +11,6 @@ S_OBJS += _scrsize.o \
chline.o \ chline.o \
clrscr.o \ clrscr.o \
cputc.o \ cputc.o \
cursor.o \
cvline.o \ cvline.o \
dummies.o \ dummies.o \
gotoxy.o \ gotoxy.o \

View File

@@ -24,18 +24,16 @@ initscrsize:
.byte $2c .byte $2c
L1: lda #40 ; 40 columns (more or less) L1: lda #40 ; 40 columns (more or less)
sta xsize sta xsize
lda #24 ; something like that for Y size lda #25 ; something like that for Y size
.else .else
lda #70 ; 70 columns (more or less) lda #70 ; 70 columns (more or less)
sta xsize sta xsize
lda #23 ; something like that for Y size lda #24 ; something like that for Y size
.endif .endif
sta ysize sta ysize
ldx #1 lda #0
stx cursor_r sta cursor_c
dex sta cursor_r
stx cursor_c
txa
jmp _cursor ; home and update cursor jmp _cursor ; home and update cursor
.code .code

View File

@@ -30,7 +30,7 @@ _cclear:
lda cursor_y ; level lda cursor_y ; level
sta r2L sta r2L
clc clc
adc #8 adc #7
sta r2H sta r2H
txa ; right end txa ; right end
clc clc
@@ -40,6 +40,13 @@ _cclear:
ldx #r4 ldx #r4
ldy #3 ldy #3
jsr DShiftLeft jsr DShiftLeft
clc ; one pixel less
lda r4L
sbc #0
sta r4L
lda r4L+1
sbc #0
sta r4L+1
lda curPattern ; store current pattern lda curPattern ; store current pattern
pha pha
lda #0 ; set pattern to clear lda #0 ; set pattern to clear

View File

@@ -7,25 +7,25 @@
; unsigned char cgetc (void); ; unsigned char cgetc (void);
.export _cgetc .export _cgetc
.import update_cursor .import cursor
.importzp cursor_x, cursor_y, cursor_flag .importzp cursor_x, cursor_y
.include "jumptab.inc" .include "jumptab.inc"
.include "geossym.inc" .include "geossym.inc"
_cgetc: _cgetc:
; show cursor if needed ; show cursor if needed
lda cursor_flag lda cursor
beq L0 beq L0
jsr update_cursor ; prepare cursor
lda #7
jsr InitTextPrompt
lda cursor_x lda cursor_x
ldx cursor_x+1 ldx cursor_x+1
sta stringX sta stringX
stx stringX+1 stx stringX+1
lda cursor_y lda cursor_y
sec
sbc curHeight
sta stringY sta stringY
jsr PromptOn jsr PromptOn
@@ -33,7 +33,15 @@ L0: jsr GetNextChar
tax tax
beq L0 beq L0
pha pha
; from 'The Hitchhiker's Guide To GEOS'
php
sei
jsr PromptOff jsr PromptOff
lda #0
sta alphaFlag
plp
pla pla
ldx #0 ldx #0
rts rts

View File

@@ -28,17 +28,26 @@ _chline:
lda cursor_x+1 lda cursor_x+1
sta r3L+1 sta r3L+1
lda cursor_y ; level lda cursor_y ; level
sec clc
sbc #4 ; in the middle of a cell adc #4 ; in the middle of a cell
sta r11L sta r11L
txa ; right end txa ; right end
clc clc
adc cursor_c adc cursor_c
sta cursor_c sta cursor_c
sta r4L sta r4L
lda #0
sta r4L+1
ldx #r4 ldx #r4
ldy #3 ldy #3
jsr DShiftLeft jsr DShiftLeft
clc ; one pixel less
lda r4L
sbc #0
sta r4L
lda r4L+1
sbc #0
sta r4L+1
lda #%11111111 ; pattern lda #%11111111 ; pattern
jsr HorizontalLine jsr HorizontalLine
jsr fixcursor jsr fixcursor

View File

@@ -14,8 +14,6 @@
.include "const.inc" .include "const.inc"
_clrscr: _clrscr:
lda #ST_WR_FORE | ST_WR_BACK
sta dispBufferOn
lda curPattern ; save current pattern lda curPattern ; save current pattern
pha pha
lda #0 ; set pattern to clear lda #0 ; set pattern to clear
@@ -25,7 +23,6 @@ _clrscr:
stx r3H stx r3H
stx r2L stx r2L
stx cursor_c stx cursor_c
inx
stx cursor_r stx cursor_r
jsr fixcursor ; home cursor jsr fixcursor ; home cursor
.ifdef __GEOS_CBM__ .ifdef __GEOS_CBM__

View File

@@ -22,7 +22,7 @@
; HOME = KEY_ENTER, KEY_HOME = REV_ON, ; HOME = KEY_ENTER, KEY_HOME = REV_ON,
; UPLINE = ?, KEY_UPARROW = GOTOY, ... ; UPLINE = ?, KEY_UPARROW = GOTOY, ...
.export _cputcxy, _cputc, update_cursor .export _cputcxy, _cputc
.import _gotoxy, fixcursor .import _gotoxy, fixcursor
.import popa .import popa
.import xsize,ysize .import xsize,ysize
@@ -63,38 +63,29 @@ L2: php
lda cursor_x+1 lda cursor_x+1
sta r11H sta r11H
lda cursor_y lda cursor_y
clc
adc #6 ; 6 pixels down to the baseline
sta r1H sta r1H
txa txa
jsr PutChar jsr PutChar
plp plp
bcs update_cursor bcs fix_cursor
inc cursor_c inc cursor_c
lda cursor_c lda cursor_c
cmp xsize ; hit right margin? cmp xsize ; hit right margin?
bne update_cursor bne fix_cursor
lda #0 ; yes - do cr+lf lda #0 ; yes - do cr+lf
sta cursor_c sta cursor_c
do_lf: inc cursor_r do_lf: inc cursor_r
lda cursor_r lda cursor_r
cmp ysize ; hit bottom margin? cmp ysize ; hit bottom margin?
bne update_cursor bne fix_cursor
dec cursor_r ; yes - stay in the last line dec cursor_r ; yes - stay in the last line
update_cursor: fix_cursor:
jsr fixcursor jmp fixcursor
lda cursor_x
sta r4L
lda cursor_x+1
sta r4H
lda cursor_y
sec
sbc curHeight
sta r5L
lda #1 ; update cursor prompt position
sta r3L
jmp PosSprite
do_cr: lda #0 do_cr: lda #0
sta cursor_c sta cursor_c
beq update_cursor beq fix_cursor

View File

@@ -1,28 +0,0 @@
;
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001, 23.12.2002
; unsigned char cursor (unsigned char onoff);
.export _cursor
.import update_cursor
.importzp cursor_flag
.include "jumptab.inc"
.include "geossym.inc"
_cursor:
tay ; onoff into Y
ldx #0 ; High byte of result
lda cursor_flag ; Get old value
pha
sty cursor_flag ; Set new value
tya
beq L1
lda curHeight ; prepare cursor
jsr InitTextPrompt
jsr update_cursor ; place it on screen
L1: pla
rts

View File

@@ -25,7 +25,7 @@ _cvline:
tax tax
lda cursor_x ; x position lda cursor_x ; x position
clc clc
adc #4 ; in the middle of cell adc #3 ; in the middle of cell
sta r4L sta r4L
lda cursor_x+1 lda cursor_x+1
adc #0 adc #0
@@ -36,10 +36,12 @@ _cvline:
clc clc
adc cursor_r adc cursor_r
sta cursor_r sta cursor_r
asl a
asl a
asl a
clc ; one pixel less
sbc #0
sta r3H sta r3H
asl r3H
asl r3H
asl r3H
lda #%11111111 ; pattern lda #%11111111 ; pattern
jsr VerticalLine jsr VerticalLine
jsr fixcursor jsr fixcursor

View File

@@ -20,12 +20,10 @@ _gotox:
_gotoy: _gotoy:
sta cursor_r sta cursor_r
inc cursor_r
jmp fixcursor jmp fixcursor
_gotoxy: _gotoxy:
sta cursor_r sta cursor_r
inc cursor_r
jsr popa jsr popa
sta cursor_c sta cursor_c
@@ -35,12 +33,12 @@ fixcursor:
sta cursor_x sta cursor_x
lda #0 lda #0
sta cursor_x+1 sta cursor_x+1
lda cursor_r
sta cursor_y
ldx #cursor_x ldx #cursor_x
ldy #3 ldy #3
jsr DShiftLeft jsr DShiftLeft
asl cursor_y lda cursor_r
asl cursor_y asl a
asl cursor_y asl a
asl a
sta cursor_y
rts rts

View File

@@ -5,7 +5,7 @@
; zeropage locations for exclusive use by the library ; zeropage locations for exclusive use by the library
; ;
.exportzp cursor_x, cursor_y, cursor_flag .exportzp cursor_x, cursor_y
.exportzp cursor_c, cursor_r .exportzp cursor_c, cursor_r
.segment "EXTZP" : zeropage .segment "EXTZP" : zeropage
@@ -14,8 +14,6 @@ cursor_x:
.res 2 ; Cursor column (0-319/639) .res 2 ; Cursor column (0-319/639)
cursor_y: cursor_y:
.res 1 ; Cursor row (0-199) .res 1 ; Cursor row (0-199)
cursor_flag:
.res 1 ; Cursor on/off (0-off)
cursor_c: cursor_c:
.res 1 ; Cursor column (0-39/79) .res 1 ; Cursor column (0-39/79)