apple2_printm/README.md

55 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

2016-02-22 01:43:29 +00:00
#printm - a modular micro printf replacement for 65C02
2016-08-03 17:45:44 +00:00
![printm screenshot](printm.png?raw=true)
2016-08-03 17:45:09 +00:00
2016-02-22 01:43:29 +00:00
Here is a *modular* _micro_ replacement: printm()
* Literals have the high byte set (APPLE text)
* Meta characters have the high bit cleared (ASCII)
2016-02-22 01:44:46 +00:00
```
$ Hex - print 1 Byte (2 characters)
x Hex - print 2 Bytes (4 characters)
2016-02-22 01:43:29 +00:00
@ Ptr - print hex 1 Byte at 16-bit pointer
& Ptr - print hex 2 Bytes at 16-bit pointer
2016-02-22 01:43:29 +00:00
# Dec - Print 1 Byte in decimal (max 2 digits)
d Dec - Print 1 Byte in decimal (max 3 digits)
u Dec - Print 2 Bytes in decimal (max 5 digits)
b Dec - Print signed 1 Byte in decimal
2016-02-22 01:43:29 +00:00
% Bin - Print 8 bits
? Bin - Print 8 bits but 1's in inverse
o Oct - Print 1 Byte in octal (max 3 digits)
O Oct - Print 2 Byte in octal (max 6 digits)
a Str - APPLE text (high bit set), last char is ASCII
s Str - C string, zero terminated
p Str - Pascal string, first byte is string length
2016-02-22 01:44:46 +00:00
```
2016-02-22 01:43:29 +00:00
Each option can individually be enabled / disabled
to control the memory footprint since you probably
don't need "every" feature. Seriously, when was the last time
you _needed_ octal? :-)
printm() has manually been optimized for size. In gcc parlance, `-Os`.
With everything enabled printm() takes up less then 512 bytes.
See the latest code for the exact byte usage!
2016-02-22 01:46:24 +00:00
* By: Michael Pohoreski
* Copyleft {c} Feb, 2016
Special Thanks:
* Sheldon for his 65C02 printf() source
* qkumba optimizations
Join the discussion in comp.sys.apple2.programmer
* https://groups.google.com/forum/#!topic/comp.sys.apple2.programmer/cXqTp7YLYuo
2016-02-22 01:43:29 +00:00