- 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
                chline.o        \
                clrscr.o        \
                cputc.o         \
-               cursor.o        \
                cvline.o        \
                dummies.o       \
                gotoxy.o        \
 
        .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
 
        lda cursor_y            ; level
        sta r2L
        clc
-       adc #8
+       adc #7
        sta r2H
        txa                     ; right end
        clc
        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
 
 ; 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
 
        tax
        beq L0
        pha
+
+; from 'The Hitchhiker's Guide To GEOS'
+       php
+       sei
        jsr PromptOff
+       lda #0
+       sta alphaFlag
+       plp
+
        pla
        ldx #0
        rts
 
        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
 
            .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
        stx r3H
        stx r2L
        stx cursor_c
-       inx
        stx cursor_r
        jsr fixcursor           ; home cursor
 .ifdef __GEOS_CBM__
 
 ; 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
        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
 
+++ /dev/null
-;
-; 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
 
        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
        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
 
 
 _gotoy:
        sta cursor_r
-       inc cursor_r
        jmp fixcursor
 
 _gotoxy:
        sta cursor_r
-       inc cursor_r
        jsr popa
        sta cursor_c
 
        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
 
 ; 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
        .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)