New answers tagged

6

The code could look like this: 0000 06 0F LD b,$0f ; 0-31 X 0002 0E 08 LD c,$08 ; 0-191 Y 0004 CD 0A 00 CALL convert_xy 0007 36 FF LD (hl),$ff ; write the pixels 0009 76 HALT 000A convert_xy: ; convert (x,y) in BC to memory address in HL 000A ...


0

Nowadays, MSX Pen makes it far easier to test simple programs in Assembly or Basic for MSX.


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 ...


3

It appears the answer is no: ca65 is a single-pass assembler and unlike C and NASM, there is not a stand-alone preprocessing stage in the assembly process. Moreover, the design of some of the assembler’s features would make it pretty difficult to support: The implementation of local symbols has the assembler internally re-write the identifiers into forms ...


Top 50 recent answers are included