New answers tagged

10

TL;DR: This macro will solve your issues: .feature string_escapes .macro PString Arg .byte :++ - :+ : .byte Arg : .endmacro When called with more than one argument the arguments have to be quoted in curly brackets. Due enabled string-escapes C like strings can be handled as well. 000800 1 03 41 42 43 PString "ABC&...


1

ca65 doesn't seem particularly retro to me but you could do it recursively: .macro StringHelper p0, p1, p2, p3, p4 .ifnblank p0 .byte p0 StringHelper p1, p2, p3, p4 .endif .endmacro .macro MultiPString p0, p1, p2, p3, p4 .local begin,end .byte end-begin begin: StringHelper p0, p1, p2, p3, p4 end: .endmacro or ...


4

Prohibiting interrupts around a decimal mode operation is a pattern to protect the interrupt service routine, not the decimal code sequences. As was already emphasized by others, an interrupt automatically pushes the status register upon the stack. This includes the decimal bit. When the interrupt routine finishes, the RTI instruction pulls back that value ...


4

There's absolutely no reason for an interrupt service routine to save and restore the decimal flag - On interrupt, the flag is being saved to the stack automatically, and restored on RTI, so any "normal" code is seeing no change whatsoever, regardless of what the ISR does (except if it would manipulate the value on the stack, which is probably a ...


22

TL;DR: Protecting 6502 decimal mode code from interrupts Decimal mode does not need to be protected from interrupts. Decimal mode is not cancelled/changed by interrupt routines(*1). Decimal mode is recorded in a status register flag (SED/CLD) When entering an interrupt, the status register is pushed on the stack When leaving an interrupt it is pulled back ...


7

Using this code as a starting point: extern "C" { void xputc(int); void xputs(const char *); } class ostream { public: ostream &operator<<(const char *); ostream &operator<<(char c); }; ostream &ostream::operator<<(const char *cp) { xputs(cp); return *this; } ostream &ostream::operator&...


Top 50 recent answers are included