From: ol.sc Date: Tue, 7 Feb 2012 13:53:14 +0000 (+0000) Subject: Moved the 'conio' files from 'geos-cbm' to 'geos-common' which are believed to work... X-Git-Tag: V2.13.3~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b944a6acdfc03cd3e699213aeff7eaa18f0b440e;p=cc65 Moved the 'conio' files from 'geos-cbm' to 'geos-common' which are believed to work as-is on Apple GEOS too. git-svn-id: svn://svn.cc65.org/cc65/trunk@5486 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/geos-cbm/Makefile b/libsrc/geos-cbm/Makefile index 628990591..8c1a056be 100644 --- a/libsrc/geos-cbm/Makefile +++ b/libsrc/geos-cbm/Makefile @@ -44,8 +44,7 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include #-------------------------------------------------------------------------- # Directories -DIRS = conio \ - devel \ +DIRS = devel \ disk \ file \ memory \ diff --git a/libsrc/geos-cbm/conio/Makefile b/libsrc/geos-cbm/conio/Makefile deleted file mode 100644 index ce71b0bef..000000000 --- a/libsrc/geos-cbm/conio/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# -# makefile for CC65 runtime library -# - -#-------------------------------------------------------------------------- -# Object files - -S_OBJS += _scrsize.o \ - cclear.o \ - chline.o \ - cvline.o \ - cgetc.o \ - clrscr.o \ - color.o \ - cputc.o \ - cpputs.o \ - cursor.o \ - gotoxy.o \ - kbhit.o \ - revers.o \ - where.o diff --git a/libsrc/geos-cbm/conio/_scrsize.s b/libsrc/geos-cbm/conio/_scrsize.s deleted file mode 100644 index fb4399f79..000000000 --- a/libsrc/geos-cbm/conio/_scrsize.s +++ /dev/null @@ -1,50 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; Screen size variables -; -; 6.3.2001, 17.4.2003 - - - .include "geossym.inc" - - .export xsize, ysize - .export screensize - .importzp cursor_r, cursor_c - .import _cursor - .constructor initscrsize - -.segment "INIT" - -initscrsize: -.ifdef __GEOS_CBM__ - lda graphMode - bpl L1 - lda #80 ; 80 columns (more or less) - .byte $2c -L1: lda #40 ; 40 columns (more or less) - sta xsize - lda #24 ; something like that for Y size -.else - lda #70 ; 70 columns (more or less) - sta xsize - lda #23 ; something like that for Y size -.endif - sta ysize - ldx #1 - stx cursor_r - dex - stx cursor_c - txa - jmp _cursor ; home and update cursor - -screensize: - ldx xsize - ldy ysize - rts - -.bss - -xsize: .res 1 -ysize: .res 1 diff --git a/libsrc/geos-cbm/conio/cclear.s b/libsrc/geos-cbm/conio/cclear.s deleted file mode 100644 index a346366f8..000000000 --- a/libsrc/geos-cbm/conio/cclear.s +++ /dev/null @@ -1,51 +0,0 @@ -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 06.03.2002 - -; void cclearxy (unsigned char x, unsigned char y, unsigned char length); -; void cclear (unsigned char length); - - .include "jumptab.inc" - .include "geossym.inc" - - .export _cclearxy, _cclear - .import popa, _gotoxy, fixcursor - .importzp cursor_x, cursor_y, cursor_c - -_cclearxy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length - -_cclear: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - tax - lda cursor_x ; left start - sta r3L - lda cursor_x+1 - sta r3L+1 - lda cursor_y ; level - sta r2L - clc - adc #8 - sta r2H - txa ; right end - clc - adc cursor_c - sta cursor_c - sta r4L - ldx #r4 - ldy #3 - jsr DShiftLeft - lda curPattern ; store current pattern - pha - lda #0 ; set pattern to clear - jsr SetPattern - jsr Rectangle - pla - jsr SetPattern ; restore pattern - jsr fixcursor -L9: rts diff --git a/libsrc/geos-cbm/conio/cgetc.s b/libsrc/geos-cbm/conio/cgetc.s deleted file mode 100644 index 9523cf4d8..000000000 --- a/libsrc/geos-cbm/conio/cgetc.s +++ /dev/null @@ -1,40 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 -; 06.03.2002 - -; unsigned char cgetc (void); - - .export _cgetc - .import update_cursor - .importzp cursor_x, cursor_y, cursor_flag - - .include "jumptab.inc" - .include "geossym.inc" - -_cgetc: -; show cursor if needed - lda cursor_flag - beq L0 - - jsr update_cursor - lda cursor_x - ldx cursor_x+1 - sta stringX - stx stringX+1 - lda cursor_y - sec - sbc curHeight - sta stringY - jsr PromptOn - -L0: jsr GetNextChar - tax - beq L0 - pha - jsr PromptOff - pla - ldx #0 - rts diff --git a/libsrc/geos-cbm/conio/chline.s b/libsrc/geos-cbm/conio/chline.s deleted file mode 100644 index aedc646ab..000000000 --- a/libsrc/geos-cbm/conio/chline.s +++ /dev/null @@ -1,45 +0,0 @@ -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 06.03.2002 - -; void chlinexy (unsigned char x, unsigned char y, unsigned char length); -; void chline (unsigned char length); - - .include "jumptab.inc" - .include "geossym.inc" - - .export _chlinexy, _chline - .import popa, _gotoxy, fixcursor - .importzp cursor_x, cursor_y, cursor_c - -_chlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length - -_chline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - tax - lda cursor_x ; left start - sta r3L - lda cursor_x+1 - sta r3L+1 - lda cursor_y ; level - sec - sbc #4 ; in the middle of a cell - sta r11L - txa ; right end - clc - adc cursor_c - sta cursor_c - sta r4L - ldx #r4 - ldy #3 - jsr DShiftLeft - lda #%11111111 ; pattern - jsr HorizontalLine - jsr fixcursor -L9: rts diff --git a/libsrc/geos-cbm/conio/clrscr.s b/libsrc/geos-cbm/conio/clrscr.s deleted file mode 100644 index 50be5b094..000000000 --- a/libsrc/geos-cbm/conio/clrscr.s +++ /dev/null @@ -1,54 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001, 23.12.2002 - -; void clrscr (void); - - .export _clrscr - - .include "jumptab.inc" - .include "geossym.inc" - .include "const.inc" - - .import fixcursor - .importzp cursor_c, cursor_r - -_clrscr: - lda #ST_WR_FORE | ST_WR_BACK - sta dispBufferOn - lda curPattern ; save current pattern - pha - lda #0 ; set pattern to clear - jsr SetPattern - ldx #0 - stx r3L - stx r3H - stx r2L - stx cursor_c - inx - stx cursor_r - jsr fixcursor ; home cursor -.ifdef __GEOS_CBM__ - lda #199 - sta r2H - lda graphMode - bpl L40 - lda #>639 ; 80 columns - ldx #<639 - bne L99 -L40: lda #>319 ; 40 columns - ldx #<319 -L99: -.else - lda #191 - sta r2H - lda #>559 - ldx #<559 -.endif - sta r4H - stx r4L - jsr Rectangle - pla - jmp SetPattern ; restore pattern diff --git a/libsrc/geos-cbm/conio/color.s b/libsrc/geos-cbm/conio/color.s deleted file mode 100644 index e5498041e..000000000 --- a/libsrc/geos-cbm/conio/color.s +++ /dev/null @@ -1,20 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 - -; unsigned char __fastcall__ textcolor (unsigned char color); -; unsigned char __fastcall__ bgcolor (unsigned char color); -; unsigned char __fastcall__ bordercolor (unsigned char color); -; - - - .export _textcolor, _bgcolor, _bordercolor - -; for GEOS 2.0 there is no color support, perhaps Wheels has it - -_textcolor: -_bgcolor: -_bordercolor: - rts diff --git a/libsrc/geos-cbm/conio/cpputs.s b/libsrc/geos-cbm/conio/cpputs.s deleted file mode 100644 index 99d4e16d9..000000000 --- a/libsrc/geos-cbm/conio/cpputs.s +++ /dev/null @@ -1,45 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 -; 05.03.2002 - -; void cpputsxy (unsigned char x, unsigned char y, char* s); -; void cpputs (char* s); - -; same as cputsxy and cputs but faster and use proportional font spacing -; does not update cursor position - - .export _cpputsxy, _cpputs - - .import _gotoxy - .import popa - .importzp cursor_x, cursor_y - - .include "const.inc" - .include "geossym.inc" - .include "jumptab.inc" - -_cpputsxy: - sta r0L ; Save s for later - stx r0H - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, pop x - jmp L0 ; Same as cputs... - -_cpputs: - sta r0L ; Save s - stx r0H -L0: ldy #0 - lda (r0),y - bne L1 ; Jump if there's something - rts - -L1: lda cursor_x - sta r11L - lda cursor_x+1 - sta r11H - lda cursor_y - sta r1H - jmp PutString diff --git a/libsrc/geos-cbm/conio/cputc.s b/libsrc/geos-cbm/conio/cputc.s deleted file mode 100644 index f36689f7d..000000000 --- a/libsrc/geos-cbm/conio/cputc.s +++ /dev/null @@ -1,102 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 -; 06.03.2002 -; 25.07.2005 - -; void cputcxy (unsigned char x, unsigned char y, char c); -; void cputc (char c); - -; TODO: -; TAB (should be implemented) -; other special characters directly from keyboard are unsafe, though some might be -; implemented: -; HOME, UPLINE, ULINEON, ULINEOFF, REV_ON, REV_OFF, BOLDON, ITALICON, OUTLINEON, PLAINTEXT -; and cursor movement, maybe stuff like INSERT too -; -; these must be ignored: -; ESC_GRAPHICS, ESC_RULER, GOTOX, GOTOY, GOTOXY, NEWCARDSET, all 1..8 -; -; note that there are conflicts between control characters and keyboard: -; HOME = KEY_ENTER, KEY_HOME = REV_ON, -; UPLINE = ?, KEY_UPARROW = GOTOY, ... - - .export _cputcxy, _cputc, update_cursor - - .import _gotoxy, fixcursor - .import popa - .import xsize,ysize - .importzp cursor_x, cursor_y, cursor_c, cursor_r - - .include "const.inc" - .include "geossym.inc" - .include "jumptab.inc" - -_cputcxy: - pha ; Save C - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, drop x - pla ; Restore C - -; Plot a character - also used as internal function - -_cputc: - tax ; save character -; some characters 0-31 are not safe for PutChar - cmp #$20 - bcs L1 - cmp #CR - beq do_cr - cmp #LF - beq do_lf - cmp #KEY_DELETE - bne L0 - ldx #BACKSPACE - sec - bcs L2 -L0: rts - -L1: clc -L2: php - lda cursor_x - sta r11L - lda cursor_x+1 - sta r11H - lda cursor_y - sta r1H - txa - jsr PutChar - plp - bcs update_cursor - - inc cursor_c - lda cursor_c - cmp xsize ; hit right margin? - bne update_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 - 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 - -do_cr: lda #0 - sta cursor_c - beq update_cursor diff --git a/libsrc/geos-cbm/conio/cursor.s b/libsrc/geos-cbm/conio/cursor.s deleted file mode 100644 index 0693c82ee..000000000 --- a/libsrc/geos-cbm/conio/cursor.s +++ /dev/null @@ -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 diff --git a/libsrc/geos-cbm/conio/cvline.s b/libsrc/geos-cbm/conio/cvline.s deleted file mode 100644 index 08d93870e..000000000 --- a/libsrc/geos-cbm/conio/cvline.s +++ /dev/null @@ -1,46 +0,0 @@ -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 06.03.2002 - -; void cvlinexy (unsigned char x, unsigned char y, unsigned char length); -; void cvline (unsigned char length); - - .include "jumptab.inc" - .include "geossym.inc" - - .export _cvlinexy, _cvline - .import popa, _gotoxy, fixcursor - .importzp cursor_x, cursor_y, cursor_r - -_cvlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length - -_cvline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - tax - lda cursor_x ; x position - clc - adc #4 ; in the middle of cell - sta r4L - lda cursor_x+1 - adc #0 - sta r4L+1 - lda cursor_y ; top start - sta r3L - txa ; bottom end - clc - adc cursor_r - sta cursor_r - sta r3H - asl r3H - asl r3H - asl r3H - lda #%11111111 ; pattern - jsr VerticalLine - jsr fixcursor -L9: rts diff --git a/libsrc/geos-cbm/conio/gotoxy.s b/libsrc/geos-cbm/conio/gotoxy.s deleted file mode 100644 index 6f0a5058a..000000000 --- a/libsrc/geos-cbm/conio/gotoxy.s +++ /dev/null @@ -1,44 +0,0 @@ - -; -; 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, fixcursor - .import popa - .importzp cursor_x, cursor_y, cursor_c, cursor_r - - .include "jumptab.inc" - -_gotox: sta cursor_c - jmp fixcursor - -_gotoy: sta cursor_r - inc cursor_r - jmp fixcursor - -_gotoxy: sta cursor_r - inc cursor_r - jsr popa - 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 - asl cursor_y - asl cursor_y - asl cursor_y - rts diff --git a/libsrc/geos-cbm/conio/kbhit.s b/libsrc/geos-cbm/conio/kbhit.s deleted file mode 100644 index 8f938fd27..000000000 --- a/libsrc/geos-cbm/conio/kbhit.s +++ /dev/null @@ -1,22 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 - -; unsigned char kbhit (void); - - .export _kbhit - - .include "geossym.inc" - -.proc _kbhit - - ldx #0 ; High byte of result - lda pressFlag - rol ; Bit 7 is new key flag - txa ; A = 0 - rol - rts - -.endproc diff --git a/libsrc/geos-cbm/conio/revers.s b/libsrc/geos-cbm/conio/revers.s deleted file mode 100644 index 32046006e..000000000 --- a/libsrc/geos-cbm/conio/revers.s +++ /dev/null @@ -1,36 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 - -; unsigned char revers (unsigned char onoff); - - .export _revers - .importzp tmp1 - - .include "geossym.inc" - .include "const.inc" - -_revers: - tax - bne L0 ; turn on - lda #0 - .byte $2c -L0: lda #SET_REVERSE - sta tmp1 - - lda currentMode - tax - and #SET_REVERSE - tay ; store old value - txa - and #%11011111 ; mask out - ora tmp1 ; set new value - sta currentMode - - ldx #0 - tya - beq L1 - lda #1 -L1: rts diff --git a/libsrc/geos-cbm/conio/where.s b/libsrc/geos-cbm/conio/where.s deleted file mode 100644 index 5690fa6d2..000000000 --- a/libsrc/geos-cbm/conio/where.s +++ /dev/null @@ -1,21 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 -; 06.03.2002 -; 02.01.2003 - -; unsigned char wherex (void); -; unsigned char wherey (void); - - .export _wherex, _wherey - .importzp cursor_c, cursor_r - -_wherex: lda cursor_c - ldx #0 - rts - -_wherey: lda cursor_r - ldx #0 - rts diff --git a/libsrc/geos-common/Makefile b/libsrc/geos-common/Makefile index 3a2bfbd60..695ba5fde 100644 --- a/libsrc/geos-common/Makefile +++ b/libsrc/geos-common/Makefile @@ -30,6 +30,7 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include # Directories DIRS = common \ + conio \ dlgbox \ disk \ file \ diff --git a/libsrc/geos-common/conio/Makefile b/libsrc/geos-common/conio/Makefile new file mode 100644 index 000000000..ce71b0bef --- /dev/null +++ b/libsrc/geos-common/conio/Makefile @@ -0,0 +1,21 @@ +# +# makefile for CC65 runtime library +# + +#-------------------------------------------------------------------------- +# Object files + +S_OBJS += _scrsize.o \ + cclear.o \ + chline.o \ + cvline.o \ + cgetc.o \ + clrscr.o \ + color.o \ + cputc.o \ + cpputs.o \ + cursor.o \ + gotoxy.o \ + kbhit.o \ + revers.o \ + where.o diff --git a/libsrc/geos-common/conio/_scrsize.s b/libsrc/geos-common/conio/_scrsize.s new file mode 100644 index 000000000..fb4399f79 --- /dev/null +++ b/libsrc/geos-common/conio/_scrsize.s @@ -0,0 +1,50 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; Screen size variables +; +; 6.3.2001, 17.4.2003 + + + .include "geossym.inc" + + .export xsize, ysize + .export screensize + .importzp cursor_r, cursor_c + .import _cursor + .constructor initscrsize + +.segment "INIT" + +initscrsize: +.ifdef __GEOS_CBM__ + lda graphMode + bpl L1 + lda #80 ; 80 columns (more or less) + .byte $2c +L1: lda #40 ; 40 columns (more or less) + sta xsize + lda #24 ; something like that for Y size +.else + lda #70 ; 70 columns (more or less) + sta xsize + lda #23 ; something like that for Y size +.endif + sta ysize + ldx #1 + stx cursor_r + dex + stx cursor_c + txa + jmp _cursor ; home and update cursor + +screensize: + ldx xsize + ldy ysize + rts + +.bss + +xsize: .res 1 +ysize: .res 1 diff --git a/libsrc/geos-common/conio/cclear.s b/libsrc/geos-common/conio/cclear.s new file mode 100644 index 000000000..a346366f8 --- /dev/null +++ b/libsrc/geos-common/conio/cclear.s @@ -0,0 +1,51 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 06.03.2002 + +; void cclearxy (unsigned char x, unsigned char y, unsigned char length); +; void cclear (unsigned char length); + + .include "jumptab.inc" + .include "geossym.inc" + + .export _cclearxy, _cclear + .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_c + +_cclearxy: + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length + +_cclear: + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + tax + lda cursor_x ; left start + sta r3L + lda cursor_x+1 + sta r3L+1 + lda cursor_y ; level + sta r2L + clc + adc #8 + sta r2H + txa ; right end + clc + adc cursor_c + sta cursor_c + sta r4L + ldx #r4 + ldy #3 + jsr DShiftLeft + lda curPattern ; store current pattern + pha + lda #0 ; set pattern to clear + jsr SetPattern + jsr Rectangle + pla + jsr SetPattern ; restore pattern + jsr fixcursor +L9: rts diff --git a/libsrc/geos-common/conio/cgetc.s b/libsrc/geos-common/conio/cgetc.s new file mode 100644 index 000000000..9523cf4d8 --- /dev/null +++ b/libsrc/geos-common/conio/cgetc.s @@ -0,0 +1,40 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001 +; 06.03.2002 + +; unsigned char cgetc (void); + + .export _cgetc + .import update_cursor + .importzp cursor_x, cursor_y, cursor_flag + + .include "jumptab.inc" + .include "geossym.inc" + +_cgetc: +; show cursor if needed + lda cursor_flag + beq L0 + + jsr update_cursor + lda cursor_x + ldx cursor_x+1 + sta stringX + stx stringX+1 + lda cursor_y + sec + sbc curHeight + sta stringY + jsr PromptOn + +L0: jsr GetNextChar + tax + beq L0 + pha + jsr PromptOff + pla + ldx #0 + rts diff --git a/libsrc/geos-common/conio/chline.s b/libsrc/geos-common/conio/chline.s new file mode 100644 index 000000000..aedc646ab --- /dev/null +++ b/libsrc/geos-common/conio/chline.s @@ -0,0 +1,45 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 06.03.2002 + +; void chlinexy (unsigned char x, unsigned char y, unsigned char length); +; void chline (unsigned char length); + + .include "jumptab.inc" + .include "geossym.inc" + + .export _chlinexy, _chline + .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_c + +_chlinexy: + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length + +_chline: + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + tax + lda cursor_x ; left start + sta r3L + lda cursor_x+1 + sta r3L+1 + lda cursor_y ; level + sec + sbc #4 ; in the middle of a cell + sta r11L + txa ; right end + clc + adc cursor_c + sta cursor_c + sta r4L + ldx #r4 + ldy #3 + jsr DShiftLeft + lda #%11111111 ; pattern + jsr HorizontalLine + jsr fixcursor +L9: rts diff --git a/libsrc/geos-common/conio/clrscr.s b/libsrc/geos-common/conio/clrscr.s new file mode 100644 index 000000000..50be5b094 --- /dev/null +++ b/libsrc/geos-common/conio/clrscr.s @@ -0,0 +1,54 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001, 23.12.2002 + +; void clrscr (void); + + .export _clrscr + + .include "jumptab.inc" + .include "geossym.inc" + .include "const.inc" + + .import fixcursor + .importzp cursor_c, cursor_r + +_clrscr: + lda #ST_WR_FORE | ST_WR_BACK + sta dispBufferOn + lda curPattern ; save current pattern + pha + lda #0 ; set pattern to clear + jsr SetPattern + ldx #0 + stx r3L + stx r3H + stx r2L + stx cursor_c + inx + stx cursor_r + jsr fixcursor ; home cursor +.ifdef __GEOS_CBM__ + lda #199 + sta r2H + lda graphMode + bpl L40 + lda #>639 ; 80 columns + ldx #<639 + bne L99 +L40: lda #>319 ; 40 columns + ldx #<319 +L99: +.else + lda #191 + sta r2H + lda #>559 + ldx #<559 +.endif + sta r4H + stx r4L + jsr Rectangle + pla + jmp SetPattern ; restore pattern diff --git a/libsrc/geos-common/conio/color.s b/libsrc/geos-common/conio/color.s new file mode 100644 index 000000000..e5498041e --- /dev/null +++ b/libsrc/geos-common/conio/color.s @@ -0,0 +1,20 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001 + +; unsigned char __fastcall__ textcolor (unsigned char color); +; unsigned char __fastcall__ bgcolor (unsigned char color); +; unsigned char __fastcall__ bordercolor (unsigned char color); +; + + + .export _textcolor, _bgcolor, _bordercolor + +; for GEOS 2.0 there is no color support, perhaps Wheels has it + +_textcolor: +_bgcolor: +_bordercolor: + rts diff --git a/libsrc/geos-common/conio/cpputs.s b/libsrc/geos-common/conio/cpputs.s new file mode 100644 index 000000000..99d4e16d9 --- /dev/null +++ b/libsrc/geos-common/conio/cpputs.s @@ -0,0 +1,45 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001 +; 05.03.2002 + +; void cpputsxy (unsigned char x, unsigned char y, char* s); +; void cpputs (char* s); + +; same as cputsxy and cputs but faster and use proportional font spacing +; does not update cursor position + + .export _cpputsxy, _cpputs + + .import _gotoxy + .import popa + .importzp cursor_x, cursor_y + + .include "const.inc" + .include "geossym.inc" + .include "jumptab.inc" + +_cpputsxy: + sta r0L ; Save s for later + stx r0H + jsr popa ; Get Y + jsr _gotoxy ; Set cursor, pop x + jmp L0 ; Same as cputs... + +_cpputs: + sta r0L ; Save s + stx r0H +L0: ldy #0 + lda (r0),y + bne L1 ; Jump if there's something + rts + +L1: lda cursor_x + sta r11L + lda cursor_x+1 + sta r11H + lda cursor_y + sta r1H + jmp PutString diff --git a/libsrc/geos-common/conio/cputc.s b/libsrc/geos-common/conio/cputc.s new file mode 100644 index 000000000..f36689f7d --- /dev/null +++ b/libsrc/geos-common/conio/cputc.s @@ -0,0 +1,102 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001 +; 06.03.2002 +; 25.07.2005 + +; void cputcxy (unsigned char x, unsigned char y, char c); +; void cputc (char c); + +; TODO: +; TAB (should be implemented) +; other special characters directly from keyboard are unsafe, though some might be +; implemented: +; HOME, UPLINE, ULINEON, ULINEOFF, REV_ON, REV_OFF, BOLDON, ITALICON, OUTLINEON, PLAINTEXT +; and cursor movement, maybe stuff like INSERT too +; +; these must be ignored: +; ESC_GRAPHICS, ESC_RULER, GOTOX, GOTOY, GOTOXY, NEWCARDSET, all 1..8 +; +; note that there are conflicts between control characters and keyboard: +; HOME = KEY_ENTER, KEY_HOME = REV_ON, +; UPLINE = ?, KEY_UPARROW = GOTOY, ... + + .export _cputcxy, _cputc, update_cursor + + .import _gotoxy, fixcursor + .import popa + .import xsize,ysize + .importzp cursor_x, cursor_y, cursor_c, cursor_r + + .include "const.inc" + .include "geossym.inc" + .include "jumptab.inc" + +_cputcxy: + pha ; Save C + jsr popa ; Get Y + jsr _gotoxy ; Set cursor, drop x + pla ; Restore C + +; Plot a character - also used as internal function + +_cputc: + tax ; save character +; some characters 0-31 are not safe for PutChar + cmp #$20 + bcs L1 + cmp #CR + beq do_cr + cmp #LF + beq do_lf + cmp #KEY_DELETE + bne L0 + ldx #BACKSPACE + sec + bcs L2 +L0: rts + +L1: clc +L2: php + lda cursor_x + sta r11L + lda cursor_x+1 + sta r11H + lda cursor_y + sta r1H + txa + jsr PutChar + plp + bcs update_cursor + + inc cursor_c + lda cursor_c + cmp xsize ; hit right margin? + bne update_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 + 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 + +do_cr: lda #0 + sta cursor_c + beq update_cursor diff --git a/libsrc/geos-common/conio/cursor.s b/libsrc/geos-common/conio/cursor.s new file mode 100644 index 000000000..0693c82ee --- /dev/null +++ b/libsrc/geos-common/conio/cursor.s @@ -0,0 +1,28 @@ + +; +; 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 diff --git a/libsrc/geos-common/conio/cvline.s b/libsrc/geos-common/conio/cvline.s new file mode 100644 index 000000000..08d93870e --- /dev/null +++ b/libsrc/geos-common/conio/cvline.s @@ -0,0 +1,46 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 06.03.2002 + +; void cvlinexy (unsigned char x, unsigned char y, unsigned char length); +; void cvline (unsigned char length); + + .include "jumptab.inc" + .include "geossym.inc" + + .export _cvlinexy, _cvline + .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_r + +_cvlinexy: + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length + +_cvline: + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + tax + lda cursor_x ; x position + clc + adc #4 ; in the middle of cell + sta r4L + lda cursor_x+1 + adc #0 + sta r4L+1 + lda cursor_y ; top start + sta r3L + txa ; bottom end + clc + adc cursor_r + sta cursor_r + sta r3H + asl r3H + asl r3H + asl r3H + lda #%11111111 ; pattern + jsr VerticalLine + jsr fixcursor +L9: rts diff --git a/libsrc/geos-common/conio/gotoxy.s b/libsrc/geos-common/conio/gotoxy.s new file mode 100644 index 000000000..6f0a5058a --- /dev/null +++ b/libsrc/geos-common/conio/gotoxy.s @@ -0,0 +1,44 @@ + +; +; 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, fixcursor + .import popa + .importzp cursor_x, cursor_y, cursor_c, cursor_r + + .include "jumptab.inc" + +_gotox: sta cursor_c + jmp fixcursor + +_gotoy: sta cursor_r + inc cursor_r + jmp fixcursor + +_gotoxy: sta cursor_r + inc cursor_r + jsr popa + 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 + asl cursor_y + asl cursor_y + asl cursor_y + rts diff --git a/libsrc/geos-common/conio/kbhit.s b/libsrc/geos-common/conio/kbhit.s new file mode 100644 index 000000000..8f938fd27 --- /dev/null +++ b/libsrc/geos-common/conio/kbhit.s @@ -0,0 +1,22 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001 + +; unsigned char kbhit (void); + + .export _kbhit + + .include "geossym.inc" + +.proc _kbhit + + ldx #0 ; High byte of result + lda pressFlag + rol ; Bit 7 is new key flag + txa ; A = 0 + rol + rts + +.endproc diff --git a/libsrc/geos-common/conio/revers.s b/libsrc/geos-common/conio/revers.s new file mode 100644 index 000000000..32046006e --- /dev/null +++ b/libsrc/geos-common/conio/revers.s @@ -0,0 +1,36 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001 + +; unsigned char revers (unsigned char onoff); + + .export _revers + .importzp tmp1 + + .include "geossym.inc" + .include "const.inc" + +_revers: + tax + bne L0 ; turn on + lda #0 + .byte $2c +L0: lda #SET_REVERSE + sta tmp1 + + lda currentMode + tax + and #SET_REVERSE + tay ; store old value + txa + and #%11011111 ; mask out + ora tmp1 ; set new value + sta currentMode + + ldx #0 + tya + beq L1 + lda #1 +L1: rts diff --git a/libsrc/geos-common/conio/where.s b/libsrc/geos-common/conio/where.s new file mode 100644 index 000000000..5690fa6d2 --- /dev/null +++ b/libsrc/geos-common/conio/where.s @@ -0,0 +1,21 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 27.10.2001 +; 06.03.2002 +; 02.01.2003 + +; unsigned char wherex (void); +; unsigned char wherey (void); + + .export _wherex, _wherey + .importzp cursor_c, cursor_r + +_wherex: lda cursor_c + ldx #0 + rts + +_wherey: lda cursor_r + ldx #0 + rts