mirror of
https://github.com/cc65/cc65.git
synced 2024-12-25 02:29:52 +00:00
Fixed wrong code generation in g_leasp.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4118 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
fa2064ae3b
commit
38ff6818fc
@ -929,13 +929,15 @@ void g_getind (unsigned Flags, unsigned Offs)
|
||||
void g_leasp (int Offs)
|
||||
/* Fetch the address of the specified symbol into the primary register */
|
||||
{
|
||||
/* Get low and high byte */
|
||||
unsigned char Lo = (unsigned char) Offs;
|
||||
unsigned char Hi = (unsigned char) (Offs >> 8);
|
||||
unsigned char Lo, Hi;
|
||||
|
||||
/* Calculate the offset relative to sp */
|
||||
Offs -= StackPtr;
|
||||
|
||||
/* Get low and high byte */
|
||||
Lo = (unsigned char) Offs;
|
||||
Hi = (unsigned char) (Offs >> 8);
|
||||
|
||||
/* Generate code */
|
||||
if (Lo == 0) {
|
||||
if (Hi <= 3) {
|
||||
@ -977,10 +979,10 @@ void g_leasp (int Offs)
|
||||
/* Full 16 bit offset inlined */
|
||||
AddCodeLine ("lda sp");
|
||||
AddCodeLine ("clc");
|
||||
AddCodeLine ("adc #$%02X", (unsigned char) Offs);
|
||||
AddCodeLine ("adc #$%02X", Lo);
|
||||
AddCodeLine ("pha");
|
||||
AddCodeLine ("lda sp+1");
|
||||
AddCodeLine ("adc #$%02X", (unsigned char) (Offs >> 8));
|
||||
AddCodeLine ("adc #$%02X", Hi);
|
||||
AddCodeLine ("tax");
|
||||
AddCodeLine ("pla");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user