aboutsummaryrefslogtreecommitdiff
path: root/conio
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-17 23:47:59 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-17 23:47:59 -0500
commit3abf7993ce2d2deb1c0596f3404b2bfa27324564 (patch)
tree67b4cb01fb3b303a14edf41f6ffa56243d33af3a /conio
parentb2f7604ac51db075201ea0aa40d002d3d5e7e071 (diff)
downloadtaipan-3abf7993ce2d2deb1c0596f3404b2bfa27324564.tar.gz
make the cursor behave *much* better, via custom conio function
Diffstat (limited to 'conio')
-rw-r--r--conio/Makefile12
-rw-r--r--conio/README1
-rw-r--r--conio/cgetc.s31
-rw-r--r--conio/chline.s32
-rw-r--r--conio/clrscr.s35
-rw-r--r--conio/cputc.s95
-rw-r--r--conio/cputs.s36
-rw-r--r--conio/cvline.s38
-rw-r--r--conio/gotox.s14
-rw-r--r--conio/gotoxy.s18
-rw-r--r--conio/gotoy.s12
-rw-r--r--conio/revers.s28
-rw-r--r--conio/wherex.s13
-rw-r--r--conio/wherey.s13
14 files changed, 378 insertions, 0 deletions
diff --git a/conio/Makefile b/conio/Makefile
new file mode 100644
index 0000000..4679d31
--- /dev/null
+++ b/conio/Makefile
@@ -0,0 +1,12 @@
+all: conio.lib
+
+OBJS=cgetc.o chline.o clrscr.o cputc.o cputs.o cvline.o gotox.o gotoxy.o gotoy.o revers.o wherex.o wherey.o
+
+conio.lib: $(OBJS)
+ ar65 a conio.lib *.o
+
+%.o: %.s
+ cl65 -O -t atari -c $<
+
+clean:
+ rm -f *.o
diff --git a/conio/README b/conio/README
new file mode 100644
index 0000000..d2ba1c7
--- /dev/null
+++ b/conio/README
@@ -0,0 +1 @@
+This is a modified conio. It doesn't draw a cursor at all.
diff --git a/conio/cgetc.s b/conio/cgetc.s
new file mode 100644
index 0000000..d1ae705
--- /dev/null
+++ b/conio/cgetc.s
@@ -0,0 +1,31 @@
+;
+; Christian Groessler, November-2002
+;
+; get a char from the keyboard
+; char cgetc(void)
+;
+
+ .include "atari.inc"
+ .export _cgetc
+ .import KEYBDV_handler
+ .import cursor,mul40
+
+_cgetc:
+ lda #12
+ sta ICAX1Z ; fix problems with direct call to KEYBDV
+.ifdef __ATARIXL__
+ jsr KEYBDV_handler
+.else
+ jsr @1
+.endif
+ ldx #0
+ rts
+
+.ifndef __ATARIXL__
+@1: lda KEYBDV+5
+ pha
+ lda KEYBDV+4
+ pha
+ rts
+.endif
+
diff --git a/conio/chline.s b/conio/chline.s
new file mode 100644
index 0000000..2ad7fed
--- /dev/null
+++ b/conio/chline.s
@@ -0,0 +1,32 @@
+;
+; Ullrich von Bassewitz, 08.08.1998
+;
+; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
+; void chline (unsigned char length);
+;
+
+ .export _chlinexy, _chline
+ .import popa, _gotoxy, cputdirect
+ .importzp tmp1
+
+.ifdef __ATARI5200__
+CHRCODE = 14
+.else
+CHRCODE = $12+64
+.endif
+
+_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
+ sta tmp1
+L1: lda #CHRCODE ; Horizontal line, screen code
+ jsr cputdirect ; Direct output
+ dec tmp1
+ bne L1
+L9: rts
diff --git a/conio/clrscr.s b/conio/clrscr.s
new file mode 100644
index 0000000..5881aea
--- /dev/null
+++ b/conio/clrscr.s
@@ -0,0 +1,35 @@
+;
+; Christian Groessler, Apr-2000
+;
+; void clrscr (void);
+;
+
+ .export _clrscr
+ .include "atari.inc"
+ .importzp ptr1
+
+SCRSIZE = 960 ; 40x24: size of default atari screen
+
+_clrscr:lda SAVMSC ; screen memory
+ sta ptr1
+ lda SAVMSC+1
+ clc
+ adc #>(SCRSIZE-1)
+ sta ptr1+1
+ lda #0 ; screen code of space char
+ sta OLDCHR
+ ldy #<(SCRSIZE-1)
+ ldx #>(SCRSIZE-1)
+_clr1: sta (ptr1),y
+ dey
+ bne _clr1
+ sta (ptr1),y
+ dex
+ bmi done
+ dec ptr1+1
+ dey
+ jmp _clr1
+
+done: sta COLCRS
+ sta ROWCRS
+ rts
diff --git a/conio/cputc.s b/conio/cputc.s
new file mode 100644
index 0000000..5955b42
--- /dev/null
+++ b/conio/cputc.s
@@ -0,0 +1,95 @@
+;
+; Mark Keates, Christian Groessler
+;
+; void cputcxy (unsigned char x, unsigned char y, char c);
+; void cputc (char c);
+;
+
+ .export _cputcxy, _cputc
+ .export plot, cputdirect, putchar
+ .import popa, _gotoxy, mul40
+ .importzp tmp4,ptr4
+ .import _revflag
+
+ .include "atari.inc"
+
+_cputcxy:
+ pha ; Save C
+ jsr popa ; Get Y
+ jsr _gotoxy ; Set cursor, drop x
+ pla ; Restore C
+
+_cputc:
+ cmp #$0D ; CR
+ bne L4
+ lda #0
+ sta COLCRS
+ beq plot ; return
+
+L4: cmp #$0A ; LF
+ beq newline
+ cmp #ATEOL ; Atari-EOL?
+ beq newline
+
+ tay
+ rol a
+ rol a
+ rol a
+ rol a
+ and #3
+ tax
+ tya
+ and #$9f
+ ora ataint,x
+
+cputdirect: ; accepts screen code
+ jsr putchar
+
+; advance cursor
+ inc COLCRS
+ lda COLCRS
+ cmp #40
+ bcc plot
+ lda #0
+ sta COLCRS
+
+ .export newline
+newline:
+ inc ROWCRS
+ lda ROWCRS
+ cmp #24
+ bne plot
+ lda #0
+ sta ROWCRS
+plot:
+ ldy COLCRS
+ ldx ROWCRS
+ rts
+
+; update screen
+; if called directly, putchar prints the screen code in A
+; without updating the cursor position.
+putchar:
+ pha ; save char
+
+ ldy #0
+
+ lda ROWCRS
+ jsr mul40 ; destroys tmp4
+ clc
+ adc SAVMSC ; add start of screen memory
+ sta ptr4
+ txa
+ adc SAVMSC+1
+ sta ptr4+1
+ pla ; get char again
+
+ ora _revflag
+ sta OLDCHR
+
+ ldy COLCRS
+ sta (ptr4),y
+ rts
+
+ .rodata
+ataint: .byte 64,0,32,96
diff --git a/conio/cputs.s b/conio/cputs.s
new file mode 100644
index 0000000..13cf847
--- /dev/null
+++ b/conio/cputs.s
@@ -0,0 +1,36 @@
+;
+; Ullrich von Bassewitz, 06.08.1998
+;
+; void cputsxy (unsigned char x, unsigned char y, char* s);
+; void cputs (char* s);
+;
+
+ .export _cputsxy, _cputs
+ .import popa, _gotoxy, _cputc
+ .importzp ptr1, tmp1
+
+_cputsxy:
+ 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 ptr1 ; Save s
+ stx ptr1+1
+L0: ldy #0
+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
+
+
diff --git a/conio/cvline.s b/conio/cvline.s
new file mode 100644
index 0000000..7ff56c3
--- /dev/null
+++ b/conio/cvline.s
@@ -0,0 +1,38 @@
+;
+; Ullrich von Bassewitz, 08.08.1998
+;
+; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
+; void cvline (unsigned char length);
+;
+ .include "atari.inc"
+
+ .export _cvlinexy, _cvline
+ .import popa, _gotoxy, putchar
+ .importzp tmp1
+
+.ifdef __ATARI5200__
+CHRCODE = 1 ; exclamation mark
+.else
+CHRCODE = $7C ; Vertical bar
+.endif
+
+_cvlinexy:
+ pha ; Save the length
+ jsr popa ; Get y
+ jsr _gotoxy ; Call this one, will pop params
+ pla ; Restore the length and run into _cvline
+
+_cvline:
+ cmp #0 ; Is the length zero?
+ beq L9 ; Jump if done
+ sta tmp1
+L1: lda COLCRS
+ pha
+ lda #CHRCODE ; Vertical bar
+ jsr putchar ; Write, no cursor advance
+ pla
+ sta COLCRS
+ inc ROWCRS
+ dec tmp1
+ bne L1
+L9: rts
diff --git a/conio/gotox.s b/conio/gotox.s
new file mode 100644
index 0000000..f7c78b4
--- /dev/null
+++ b/conio/gotox.s
@@ -0,0 +1,14 @@
+;
+; Christian Groessler, 19-Feb-2000
+;
+; void gotox (unsigned char x);
+;
+
+ .include "atari.inc"
+ .export _gotox
+
+_gotox:
+ sta COLCRS ; Set X
+ lda #0
+ sta COLCRS+1
+ rts
diff --git a/conio/gotoxy.s b/conio/gotoxy.s
new file mode 100644
index 0000000..ca91b07
--- /dev/null
+++ b/conio/gotoxy.s
@@ -0,0 +1,18 @@
+;
+; Ullrich von Bassewitz, 06.08.1998
+;
+; void gotoxy (unsigned char x, unsigned char y);
+;
+
+ .include "atari.inc"
+
+ .export _gotoxy
+ .import popa
+
+_gotoxy: ; Set the cursor position
+ sta ROWCRS ; Set Y
+ jsr popa ; Get X
+ sta COLCRS ; Set X
+ lda #0
+ sta COLCRS+1 ;
+ rts
diff --git a/conio/gotoy.s b/conio/gotoy.s
new file mode 100644
index 0000000..1e2479a
--- /dev/null
+++ b/conio/gotoy.s
@@ -0,0 +1,12 @@
+;
+; Christian Groessler, 19-Feb-2000
+;
+; void gotoy (unsigned char y);
+;
+
+ .include "atari.inc"
+ .export _gotoy
+
+_gotoy:
+ sta ROWCRS ; Set Y
+ rts
diff --git a/conio/revers.s b/conio/revers.s
new file mode 100644
index 0000000..7195039
--- /dev/null
+++ b/conio/revers.s
@@ -0,0 +1,28 @@
+;
+; Ullrich von Bassewitz, 07.08.1998
+;
+; unsigned char revers (unsigned char onoff);
+;
+ .include "atari.inc"
+
+ .export _revers
+ .export _revflag
+
+_revers:
+ ldx #$00 ; Assume revers off
+ tay ; Test onoff
+ beq L1 ; Jump if off
+ ldx #$80 ; Load on value
+L1: ldy #$00 ; Assume old value is zero
+ lda _revflag ; Load old value
+ stx _revflag ; Set new value
+ beq L2 ; Jump if old value zero
+ iny ; Make old value = 1
+L2: ldx #$00 ; Load high byte of result
+ tya ; Load low byte, set CC
+ rts
+
+ .bss
+
+_revflag:
+ .res 1
diff --git a/conio/wherex.s b/conio/wherex.s
new file mode 100644
index 0000000..1b72199
--- /dev/null
+++ b/conio/wherex.s
@@ -0,0 +1,13 @@
+;
+; Carsten Strotmann, 30.12.2002
+;
+; unsigned char wherex (void);
+;
+
+ .export _wherex
+ .include "atari.inc"
+
+_wherex:
+ lda COLCRS
+ ldx #0
+ rts
diff --git a/conio/wherey.s b/conio/wherey.s
new file mode 100644
index 0000000..f391eec
--- /dev/null
+++ b/conio/wherey.s
@@ -0,0 +1,13 @@
+;
+; Carsten Strotmann, 30.12.2002
+;
+; unsigned char wherey (void);
+;
+
+ .export _wherey
+ .include "atari.inc"
+
+_wherey:
+ lda ROWCRS
+ ldx #0
+ rts