aboutsummaryrefslogtreecommitdiff
path: root/f65/README
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-13 05:39:38 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-13 05:39:38 -0500
commite2da2bffe58a76c091d3496bd3ca2d2f18ea2eb6 (patch)
tree5195b221457842d781fadcb94331c93058046744 /f65/README
downloadunalf-e2da2bffe58a76c091d3496bd3ca2d2f18ea2eb6.tar.gz
initial commit
Diffstat (limited to 'f65/README')
-rw-r--r--f65/README32
1 files changed, 32 insertions, 0 deletions
diff --git a/f65/README b/f65/README
new file mode 100644
index 0000000..0f7d0a3
--- /dev/null
+++ b/f65/README
@@ -0,0 +1,32 @@
+f65 - "fake 6502" porting layer
+
+This is a set of C macros that implements most of the 6502 assembly
+language instructions, plus a perl script to convert 6502 assembly
+source to C code that calls the macros. You can use it to assist in
+porting 6502 assembly routines to C, using either the original asm
+source, or a disassembly created with da65.
+
+What's implemented: 64K of memory. The A/X/Y/S registers. The carry,
+zero, and negative flags. Most arithmetic and logic instructions. The
+stack. Conditional branches and absolute jumps are implemented as C
+goto's. JSR is implemented as a real C function call, and RTS is a
+real C return. Labels in the assembly source become C labels (aka goto
+targets). Equates in the asm source become C variables.
+
+What's not implemented: The D flag, and decimal mode in general. The
+V flag, and branches based on it. The I and B flags. Interrupts
+and the RTI instruction. The Program Counter (though branches, JMP,
+JSR, and RTS are implemented without it). ROM routines (including
+I/O). Indirect JMP. The "CPU bug" that causes e.g. 'LDA ($FF),y' to
+take its high byte from $00 rather than $100. (zeropage, x) addressing
+mode.
+
+I wrote this specifically to port the decompression algorithm from
+UnAlf 1.4. Instructions not used by UnAlf probably aren't implemented,
+or if they are, they're untested.
+
+The perl script doesn't magically convert a whole 6502 program to C
+source. You'll have to figure out which parts of the 6502 program are
+subroutines, and put them in their own C functions. Any data (.byte,
+.word, etc) won't be in the C program. Anything that does I/O must be
+rewritten in C.