This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
26
libsrc/conio/Makefile
Normal file
26
libsrc/conio/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# makefile for CC65 runtime library
|
||||
#
|
||||
|
||||
.SUFFIXES: .o .s .c
|
||||
|
||||
%.o: %.c
|
||||
@echo $<
|
||||
@$(CC) $(CFLAGS) $<
|
||||
@$(AS) -o $@ $(AFLAGS) $(*).s
|
||||
|
||||
%.o: %.s
|
||||
@echo $<
|
||||
@$(AS) -g -o $@ $(AFLAGS) $<
|
||||
|
||||
C_OBJS =
|
||||
|
||||
S_OBJS = cputs.o cursor.o cputhex.o scrsize.o
|
||||
|
||||
all: $(C_OBJS) $(S_OBJS)
|
||||
|
||||
clean:
|
||||
@rm -f *~
|
||||
@rm -f $(C_OBJS:.o=.s)
|
||||
@rm -f $(C_OBJS)
|
||||
@rm -f $(S_OBJS)
|
||||
39
libsrc/conio/cputhex.s
Normal file
39
libsrc/conio/cputhex.s
Normal file
@@ -0,0 +1,39 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
;
|
||||
; void cputhex8 (unsigned char val);
|
||||
; void cputhex16 (unsigned val);
|
||||
;
|
||||
|
||||
.export _cputhex8, _cputhex16
|
||||
.import _cputc
|
||||
.import __hextab
|
||||
|
||||
|
||||
_cputhex16:
|
||||
pha ; Save low byte
|
||||
txa ; Get high byte into A
|
||||
jsr _cputhex8 ; Output high byte
|
||||
pla ; Restore low byte and run into _cputhex8
|
||||
|
||||
_cputhex8:
|
||||
pha ; Save the value
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
tay
|
||||
lda __hextab,y
|
||||
jsr _cputc
|
||||
pla
|
||||
and #$0F
|
||||
tay
|
||||
lda __hextab,y
|
||||
jmp _cputc
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
36
libsrc/conio/cputs.s
Normal file
36
libsrc/conio/cputs.s
Normal file
@@ -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
|
||||
|
||||
|
||||
26
libsrc/conio/cursor.s
Normal file
26
libsrc/conio/cursor.s
Normal file
@@ -0,0 +1,26 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 17.06.1998
|
||||
;
|
||||
; unsigned char cursor (unsigned char onoff);
|
||||
;
|
||||
|
||||
.export _cursor
|
||||
.export cursor
|
||||
|
||||
|
||||
.proc _cursor
|
||||
|
||||
tay ; onoff into Y
|
||||
ldx #0 ; High byte of result
|
||||
lda cursor ; Get old value
|
||||
sty cursor ; Set new value
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.bss
|
||||
|
||||
cursor: .res 1
|
||||
|
||||
|
||||
38
libsrc/conio/scrsize.s
Normal file
38
libsrc/conio/scrsize.s
Normal file
@@ -0,0 +1,38 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
;
|
||||
; void screensize (unsigned char* x, unsigned char* y);
|
||||
;
|
||||
|
||||
.export _screensize
|
||||
.export xsize, ysize
|
||||
|
||||
.import popax
|
||||
.importzp ptr1, ptr2
|
||||
|
||||
.proc _screensize
|
||||
|
||||
sta ptr1 ; Store the y pointer
|
||||
stx ptr1+1
|
||||
|
||||
jsr popax ; get the x pointer
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
|
||||
ldy #0
|
||||
lda xsize
|
||||
sta (ptr2),y
|
||||
lda ysize
|
||||
sta (ptr1),y
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.bss
|
||||
|
||||
xsize: .res 1
|
||||
ysize: .res 1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user