65C816 SW: printf() family functions

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
granati
Posts: 83
Joined: 24 Jun 2013
Location: Italy

65C816 SW: printf() family functions

Post by granati »

Hello,

i'm developing a "c-like" printf() family function, in assembler, for the 65c816 uP.
Six function are in develop here:

1) cprintf(lpFmt, ..., wCount) - format parameters basis the format string and print on console
2) tprintf(lpFmt, ..., wCount) - print on default text device (useful for monitor, to redirect console)
3) printf(lpFmt, ..., wCount) - print to standard out device
4) dprintf(bHandle, lpFmt, ..., wCount) - send output to an open file handle
5) fprintf(lpStream, lpFmt, ..., wCount) - send output to an open file stream
6) snprintf(lpBuf, wSize, lpFmt, ..., wCount) - format to an user buffer

For now just cprintf() and snprintf() are fully implemented: the Others functions requires the right system calls to write a buffer to a file handle or file stream, a section that is under develop.

All functions accept a variable number of parameters, passed on stack by the caller. For an explanation about format and the method to manage a variable number of parameters on stack look at source code PRINTF.ASM on my web site:

http://65xx.unet.bz/c16sw/index.php

where also i put a revisioned source code for float point unit and for strings.

Functions on printf.asm and strings.asm are intended to be a "static library" that be used both by assembler or by an high Language like c; all are declared in fact as "pascal": parameters on stack are pushed by the caller in left-to-right order and stack cleanup is managed by functions itselfs.

Marco
http://65xx.unet.bz/ - Hardware & Software 65XX family
User avatar
GaBuZoMeu
Posts: 660
Joined: 01 Mar 2017
Location: North-Germany

Re: 65C816 SW: printf() family functions

Post by GaBuZoMeu »

So much work...

Thank you for sharing!
Post Reply