]> git.sur5r.net Git - cc65/commitdiff
conio with fixed width and proportional font support
authorizydorst <izydorst@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 8 Mar 2002 16:47:34 +0000 (16:47 +0000)
committerizydorst <izydorst@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 8 Mar 2002 16:47:34 +0000 (16:47 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1178 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/geos/conio/Makefile
libsrc/geos/conio/cgetc.s
libsrc/geos/conio/cputc.s
libsrc/geos/conio/cputs.s
libsrc/geos/conio/cursor.s
libsrc/geos/conio/gotoxy.s
libsrc/geos/conio/revers.s
libsrc/geos/conio/screensize.s
libsrc/geos/conio/where.s
libsrc/geos/system/Makefile

index 6d3abd9aba80dcf4f93f58c151dff13de7b8850a..9dc6ff3874cf7333cac542e787820a81e5372c1c 100644 (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)
 
index 8212675bc572b74e5499ca3e368401d774761db8..974a37f56f5a83b8f111650a029ec548629789b5 100644 (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
index 4120abf70bfe72c44c349ce1deaf679ad9acdc75..aa0c92155674f64eaf2a8dc2adb4b9948de15b3b 100644 (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
index 2f5276ac6cb64afa928c85ddae5bae6022bcb395..a05f2bad7b6ce9eca45b6ab8ee9061d01ae1619a 100644 (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
index d2ec60579e903b3d3315e1ff8bb113d54fa22f4e..55f89c61b2aeb41b08024d7dcf8af801d828032e 100644 (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
index 58ba858d4987fef380f7c0beceafef07a63f3925..d3da47db9e658748e3458c7ea69f654d6354193e 100644 (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
index b2d208838059c4c47317eb23a06fa97fa827964b..cd5ea66bb997e29c9b8c98acf5f498bccbdde187 100644 (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"
index c04fc92ae1d115fc615d470044836d3af4201e75..00524c1b80b398719378286a65b48cd5b7dfb78b 100644 (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
index 8ba44e94efc71287a6dda094d5c1b93c410a72c5..14cd07981870d427be9f1ea448639c1e287a5904 100644 (file)
@@ -3,6 +3,7 @@
 ; Maciej 'YTM/Elysium' Witkowiak
 ;
 ; 27.10.2001
+; 06.03.2002
 
 ; unsigned char wherex (void);
 ; unsigned char wherey (void);
            .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
index 4b117ab665d09e9977f0c17245bdbc67bf7d82ac..e3508b4ded9edd9f0923cd062868ceaa58aaad45 100644 (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)