@$(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)
; 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
; 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
; 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
bne L1
L0: rts
-L1: lda cursor_x
+L1: clc
+L2: php
+ lda cursor_x
sta r11L
lda cursor_x+1
sta r11H
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
-
;
-; 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
; 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
; 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
; unsigned char revers (unsigned char onoff);
.export _revers
- .import tmp1
+ .importzp tmp1
.include "../inc/geossym.inc"
.include "../inc/const.inc"
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001
+; 06.03.2002
; void screensize (unsigned char* x, unsigned char* y);
;
.import popax
.importzp ptr1, ptr2
+ .import xsize, ysize
.include "../inc/geossym.inc"
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
; 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
@$(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)