Re: [cc65] Inline-Assembler: sorry, i forgot that this is an english mailing list

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-12-01 00:38:56


On Mon, Dec 01, 2003 at 12:10:03AM +0100, Benjamin Bahnsen wrote:
> I have a short question: do i have to save and restore the registers, which
> i use in the inline-assembler ( ... i += 10; asm("pha"); asm("lda #$00");
> asm("sta $D020"); asm("pla"); i += 20; ... ), or may i change the values of
> a/x/y between two C-commands?

Because of the low register count of the 6502 CPU, all registers are scratch
registers and may be changed in every C statement. This means that the
compiler doesn't expect the registers to keep their values, which in turn
means that you must not save any of the registers when using inline assembly.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-12-01 00:39:11 CET