1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 06:30:16 +00:00

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 \
clrscr.o \
cputc.o \
cursor.o \
cvline.o \
dummies.o \
gotoxy.o \

View File

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

View File

@ -30,7 +30,7 @@ _cclear:
lda cursor_y ; level
sta r2L
clc
adc #8
adc #7
sta r2H
txa ; right end
clc
@ -40,6 +40,13 @@ _cclear:
ldx #r4
ldy #3
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
pha
lda #0 ; set pattern to clear

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
; HOME = KEY_ENTER, KEY_HOME = REV_ON,
; UPLINE = ?, KEY_UPARROW = GOTOY, ...
.export _cputcxy, _cputc, update_cursor
.export _cputcxy, _cputc
.import _gotoxy, fixcursor
.import popa
.import xsize,ysize
@ -63,38 +63,29 @@ L2: php
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 update_cursor
bcs fix_cursor
inc cursor_c
lda cursor_c
cmp xsize ; hit right margin?
bne update_cursor
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 update_cursor
bne fix_cursor
dec cursor_r ; yes - stay in the last line
update_cursor:
jsr 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
fix_cursor:
jmp fixcursor
do_cr: lda #0
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
lda cursor_x ; x position
clc
adc #4 ; in the middle of cell
adc #3 ; in the middle of cell
sta r4L
lda cursor_x+1
adc #0
@ -36,10 +36,12 @@ _cvline:
clc
adc cursor_r
sta cursor_r
asl a
asl a
asl a
clc ; one pixel less
sbc #0
sta r3H
asl r3H
asl r3H
asl r3H
lda #%11111111 ; pattern
jsr VerticalLine
jsr fixcursor

View File

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

View File

@ -5,7 +5,7 @@
; 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
.segment "EXTZP" : zeropage
@ -14,8 +14,6 @@ cursor_x:
.res 2 ; Cursor column (0-319/639)
cursor_y:
.res 1 ; Cursor row (0-199)
cursor_flag:
.res 1 ; Cursor on/off (0-off)
cursor_c:
.res 1 ; Cursor column (0-39/79)