Fragments system in Pas 6502
I've added in a new fragments system into Pas 6502.
When compiling code, you might see messages such as:
1. fragment "6502\m1u8=m2u16_==_c1u8.asm" doesn't exist, you need to define it...
2. fragment "6502\m1u16=m2u16_or_m3u8.asm" doesn't exist, you need to define it...
3. fragment "6502\p1u16[c1u8]=c2u8.asm" doesn't exist, you need to define it...
4. fragment "6502\xxu8=m1u16_add_c1u8.asm" doesn't exist, you need to define it...
This means that the compiler hasn’t got code for those types of expressions yet and needs the assembly code added.
The beauty of the fragments system is that the user can just add the missing code without updating the compiler itself (if your assembly skills are up to the task), and try recompiling the current program to see the changes!
You can find the fragments for the active CPU type being used in the compiler in the relevant folder, such as
<path>pas6502\fragments\6502
Fragments use naming conventions for separate values like so:
m = memory location
c = constant
p = pointer
aa = a register value
xx = x register value
yy = y register value
ax = ax register value (a = msb)
ay = ay register value (a = msb)
yx = yx register value (y = msb)
xy = xy register value (x = msb)
ya = ya register value (y = msb)
xa = xa register value (x = msb)
These can be signed (s) or unsigned (u).
Each type also shows the bit size like 8/16.
In the examples shown above:
1. Compare {m2} (unsigned, 16-bit) with {c1} (unsigned, 8-bit) and store $00 in {m1} if false or $ff in {m1} if true.
2. Bit-wise or {m2} with {m3} and store in {m1}
3. Store the constant {c2} in the pointer at {p1} using {c1} as the index offset.
4. Add memory {m1} and constant {c1}, and store in x register.
A few full fragment examples now ( use {} enclosing the m, c, and p names in the code):
fragment “aau8=m1u8.asm” // store m1 in a-register
lda {m1}
//------------------------------------------------------------------------------------
fragment “aau8=m1u8[m2u8].asm” // copy m1 at index m2 into a-register
ldx {m2}; lda {m1},x
//------------------------------------------------------------------------------------
fragment “m1s16=aau8_add_m2s16.asm” // add a-register with m2 and store in m1
clc
adc {m2} + 0
sta {m1} + 0
lda #0
adc {m2} + 1
sta {m1} + 1
Files
Get Pas 6502
Pas 6502
Pascal cross-compiler for 6502 machines.
Status | In development |
Category | Tool |
Author | syntaxerrorsoftware |
Tags | atari, bbc-micro, Commodore 64, compiler, cross-compiler, pascal, utility |
More posts
- Commodore PET support added!69 days ago
- Apple II support added!! (and some fixes)69 days ago
- Bug fixes, IDE updates, improvements...75 days ago
- Find/replace dialog, goto code definitions and other improvements.86 days ago
- Improvements and bug fixes madeJun 16, 2024
- New download file (fragments.zip) and include.zip updateJun 07, 2024
- Art change for NES example...May 11, 2024
- Small changes and NES support!May 09, 2024
- New machine support and some fixes...Apr 19, 2024
- Updates, fixes, and C128 support addedMar 31, 2024
Leave a comment
Log in with itch.io to leave a comment.