]> git.sur5r.net Git - cc65/commitdiff
Moved conio related files from common/ to conio/
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 1 Feb 2003 21:49:55 +0000 (21:49 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 1 Feb 2003 21:49:55 +0000 (21:49 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1916 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/Makefile
libsrc/common/cprintf.s [deleted file]
libsrc/common/vcprintf.s [deleted file]
libsrc/conio/Makefile
libsrc/conio/cprintf.s [new file with mode: 0644]
libsrc/conio/vcprintf.s [new file with mode: 0644]

index 781019579205d43b34465ba89995200146b070cb..dbaeb971e91f775e3a97d90cfd92e78f04b87d84 100644 (file)
@@ -57,15 +57,14 @@ S_OBJS =    _fdesc.o        \
                 _heapmaxavail.o \
                 _heapmemavail.o \
                _oserror.o      \
-               _printf.o       \
-               _swap.o         \
-               _sys.o          \
-               abs.o           \
-               atexit.o        \
-               atoi.o          \
-               calloc.o        \
+               _printf.o       \
+               _swap.o         \
+               _sys.o          \
+               abs.o           \
+               atexit.o        \
+               atoi.o          \
+               calloc.o        \
                copydata.o      \
-               cprintf.o       \
                 ctime.o         \
                 divt.o          \
                errno.o         \
@@ -128,7 +127,6 @@ S_OBJS =    _fdesc.o        \
                 time.o          \
                tolower.o       \
                toupper.o       \
-               vcprintf.o      \
                vfprintf.o      \
                vsprintf.o      \
                zerobss.o
diff --git a/libsrc/common/cprintf.s b/libsrc/common/cprintf.s
deleted file mode 100644 (file)
index d5e5691..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-;
-; int cprintf (const char* Format, ...);
-;
-; Ullrich von Bassewitz, 1.12.2000
-;
-
-               .export         _cprintf
-               .import         pushax, addysp, _vcprintf
-       .importzp       sp, ptr1
-
-       .macpack        generic
-
-; ----------------------------------------------------------------------------
-; Data
-
-.bss
-
-ParamSize:     .res    1               ; Number of parameter bytes
-
-; ----------------------------------------------------------------------------
-; Code
-
-.code
-
-
-_cprintf:
-       sty     ParamSize               ; Number of param bytes passed in Y
-
-; Calculate a pointer that points to Format
-
-       dey
-       dey                             ; Sub size of Format
-       tya
-       add     sp
-       sta     ptr1
-       ldx     sp+1
-       bcc     @L1
-       inx
-@L1:   stx     ptr1+1
-
-; Push Format
-
-       ldy     #1
-       lda     (ptr1),y
-       tax
-       dey
-       lda     (ptr1),y
-       jsr     pushax
-
-; Load va_list (last and __fastcall__ parameter to vfprintf)
-
-       lda     ptr1
-       ldx     ptr1+1
-
-; Call vcprintf
-
-       jsr     _vcprintf
-
-; Cleanup the stack. We will return what we got from vcprintf
-
-       ldy     ParamSize
-       jmp     addysp
-
-
diff --git a/libsrc/common/vcprintf.s b/libsrc/common/vcprintf.s
deleted file mode 100644 (file)
index f994ad2..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-;
-; int vcprintf (const char* Format, va_list ap);
-;
-; Ullrich von Bassewitz, 2.12.2000
-;
-
-       .export         _vcprintf
-       .import         pushax, popax
-       .import         __printf, _cputc
-       .importzp       sp, ptr1, ptr2, ptr3, tmp1
-
-       .macpack        generic
-
-
-.data
-
-; ----------------------------------------------------------------------------
-;
-; Static data for the _vsprintf routine
-;
-
-outdesc:                       ; Static outdesc structure
-       .word   0               ; ccount
-       .word   out             ; Output function pointer
-       .word   0               ; ptr
-               .word   0               ; uns
-
-.code
-
-; ----------------------------------------------------------------------------
-; Callback routine used for the actual output.
-;
-; static void out (struct outdesc* d, const char* buf, unsigned count)
-; /* Routine used for writing */
-; {
-;     /* Fast screen output */
-;     d->ccount += count;
-;     while (count) {
-;        cputc (*buf);
-;        ++buf;
-;        --count;
-;     }
-; }
-;
-; We're using ptr1 and tmp1, since we know that the cputc routine will not use
-; them (they're also used in cputs, so they must be safe).
-
-out:   jsr     popax           ; count
-       sta     ptr2
-       eor     #$FF
-       sta     outdesc+6
-       txa
-       sta     ptr2+1
-       eor     #$FF
-               sta     outdesc+7
-
-       jsr     popax           ; buf
-               sta     ptr1
-       stx     ptr1+1
-
-       jsr     popax           ; d
-       sta     ptr3
-       stx     ptr3+1
-
-; Sum up the total count of characters
-
-       ldy     #0              ; ccount in struct outdesc
-       sty     tmp1            ; Initialize tmp1 while we have zero available
-       lda     (ptr3),y
-       add     ptr2
-       sta     (ptr3),y
-       iny
-       lda     (ptr3),y
-       adc     ptr2+1
-       sta     (ptr3),y
-
-; Loop outputting characters
-
-@L1:   inc     outdesc+6
-       beq     @L4
-@L2:   ldy     tmp1
-       lda     (ptr1),y
-       iny
-       bne     @L3
-               inc     ptr1+1
-@L3:   sty     tmp1
-       jsr     _cputc
-       jmp     @L1
-
-@L4:   inc     outdesc+7
-       bne     @L2
-       rts
-
-; ----------------------------------------------------------------------------
-; vcprintf - formatted console i/o
-;
-; int vcprintf (const char* format, va_list ap)
-; {
-;     struct outdesc d;
-;
-;     /* Setup descriptor */
-;     d.fout = out;
-;
-;     /* Do formatting and output */
-;     _printf (&d, format, ap);
-;
-;     /* Return bytes written */
-;     return d.ccount;
-; }
-;
-; It is intentional that this function does not have __fastcall__ calling
-; conventions - we need the space on the stack anyway, so there's nothing
-; gained by using __fastcall__.
-
-_vcprintf:
-       sta     ptr1            ; Save ap
-       stx     ptr1+1
-
-; Setup the outdesc structure
-
-       lda     #0
-       sta     outdesc
-       sta     outdesc+1       ; Clear ccount
-
-; Get the format parameter and push it again
-
-       ldy     #1
-       lda     (sp),y
-       tax
-       dey
-       lda     (sp),y
-       jsr     pushax
-
-; Replace the passed format parameter on the stack by &d - this creates
-; exactly the stack frame _printf expects. Parameters will get dropped
-; by _printf.
-
-       ldy     #2              ; Low byte of d
-       lda     #<outdesc
-       sta     (sp),y
-       iny
-       lda     #>outdesc
-       sta     (sp),y
-
-; Restore ap and call _printf
-
-       lda     ptr1
-       ldx     ptr1+1
-       jsr     __printf
-
-; Return the number of bytes written.
-
-       lda     outdesc         ; ccount
-       ldx     outdesc+1
-       rts
-
-                     
-
index 6b2262371523b4244c1ea6759c9838c404716f0b..54a0ab75a81b0921861462426f07c1e53a627567 100644 (file)
        @$(AS) -g -o $@ $(AFLAGS) $<
 
 OBJS = _cursor.o       \
+        cprintf.o      \
        cputhex.o       \
        cputs.o         \
        cursor.o        \
-       scrsize.o
+       scrsize.o       \
+        vcprintf.o
 
 all:   $(OBJS)
 
diff --git a/libsrc/conio/cprintf.s b/libsrc/conio/cprintf.s
new file mode 100644 (file)
index 0000000..d5e5691
--- /dev/null
@@ -0,0 +1,64 @@
+;
+; int cprintf (const char* Format, ...);
+;
+; Ullrich von Bassewitz, 1.12.2000
+;
+
+               .export         _cprintf
+               .import         pushax, addysp, _vcprintf
+       .importzp       sp, ptr1
+
+       .macpack        generic
+
+; ----------------------------------------------------------------------------
+; Data
+
+.bss
+
+ParamSize:     .res    1               ; Number of parameter bytes
+
+; ----------------------------------------------------------------------------
+; Code
+
+.code
+
+
+_cprintf:
+       sty     ParamSize               ; Number of param bytes passed in Y
+
+; Calculate a pointer that points to Format
+
+       dey
+       dey                             ; Sub size of Format
+       tya
+       add     sp
+       sta     ptr1
+       ldx     sp+1
+       bcc     @L1
+       inx
+@L1:   stx     ptr1+1
+
+; Push Format
+
+       ldy     #1
+       lda     (ptr1),y
+       tax
+       dey
+       lda     (ptr1),y
+       jsr     pushax
+
+; Load va_list (last and __fastcall__ parameter to vfprintf)
+
+       lda     ptr1
+       ldx     ptr1+1
+
+; Call vcprintf
+
+       jsr     _vcprintf
+
+; Cleanup the stack. We will return what we got from vcprintf
+
+       ldy     ParamSize
+       jmp     addysp
+
+
diff --git a/libsrc/conio/vcprintf.s b/libsrc/conio/vcprintf.s
new file mode 100644 (file)
index 0000000..f994ad2
--- /dev/null
@@ -0,0 +1,158 @@
+;
+; int vcprintf (const char* Format, va_list ap);
+;
+; Ullrich von Bassewitz, 2.12.2000
+;
+
+       .export         _vcprintf
+       .import         pushax, popax
+       .import         __printf, _cputc
+       .importzp       sp, ptr1, ptr2, ptr3, tmp1
+
+       .macpack        generic
+
+
+.data
+
+; ----------------------------------------------------------------------------
+;
+; Static data for the _vsprintf routine
+;
+
+outdesc:                       ; Static outdesc structure
+       .word   0               ; ccount
+       .word   out             ; Output function pointer
+       .word   0               ; ptr
+               .word   0               ; uns
+
+.code
+
+; ----------------------------------------------------------------------------
+; Callback routine used for the actual output.
+;
+; static void out (struct outdesc* d, const char* buf, unsigned count)
+; /* Routine used for writing */
+; {
+;     /* Fast screen output */
+;     d->ccount += count;
+;     while (count) {
+;        cputc (*buf);
+;        ++buf;
+;        --count;
+;     }
+; }
+;
+; We're using ptr1 and tmp1, since we know that the cputc routine will not use
+; them (they're also used in cputs, so they must be safe).
+
+out:   jsr     popax           ; count
+       sta     ptr2
+       eor     #$FF
+       sta     outdesc+6
+       txa
+       sta     ptr2+1
+       eor     #$FF
+               sta     outdesc+7
+
+       jsr     popax           ; buf
+               sta     ptr1
+       stx     ptr1+1
+
+       jsr     popax           ; d
+       sta     ptr3
+       stx     ptr3+1
+
+; Sum up the total count of characters
+
+       ldy     #0              ; ccount in struct outdesc
+       sty     tmp1            ; Initialize tmp1 while we have zero available
+       lda     (ptr3),y
+       add     ptr2
+       sta     (ptr3),y
+       iny
+       lda     (ptr3),y
+       adc     ptr2+1
+       sta     (ptr3),y
+
+; Loop outputting characters
+
+@L1:   inc     outdesc+6
+       beq     @L4
+@L2:   ldy     tmp1
+       lda     (ptr1),y
+       iny
+       bne     @L3
+               inc     ptr1+1
+@L3:   sty     tmp1
+       jsr     _cputc
+       jmp     @L1
+
+@L4:   inc     outdesc+7
+       bne     @L2
+       rts
+
+; ----------------------------------------------------------------------------
+; vcprintf - formatted console i/o
+;
+; int vcprintf (const char* format, va_list ap)
+; {
+;     struct outdesc d;
+;
+;     /* Setup descriptor */
+;     d.fout = out;
+;
+;     /* Do formatting and output */
+;     _printf (&d, format, ap);
+;
+;     /* Return bytes written */
+;     return d.ccount;
+; }
+;
+; It is intentional that this function does not have __fastcall__ calling
+; conventions - we need the space on the stack anyway, so there's nothing
+; gained by using __fastcall__.
+
+_vcprintf:
+       sta     ptr1            ; Save ap
+       stx     ptr1+1
+
+; Setup the outdesc structure
+
+       lda     #0
+       sta     outdesc
+       sta     outdesc+1       ; Clear ccount
+
+; Get the format parameter and push it again
+
+       ldy     #1
+       lda     (sp),y
+       tax
+       dey
+       lda     (sp),y
+       jsr     pushax
+
+; Replace the passed format parameter on the stack by &d - this creates
+; exactly the stack frame _printf expects. Parameters will get dropped
+; by _printf.
+
+       ldy     #2              ; Low byte of d
+       lda     #<outdesc
+       sta     (sp),y
+       iny
+       lda     #>outdesc
+       sta     (sp),y
+
+; Restore ap and call _printf
+
+       lda     ptr1
+       ldx     ptr1+1
+       jsr     __printf
+
+; Return the number of bytes written.
+
+       lda     outdesc         ; ccount
+       ldx     outdesc+1
+       rts
+
+                     
+