From e150c76cb760d01938fd26e90d93b4bcd49ed102 Mon Sep 17 00:00:00 2001 From: lintbe Date: Wed, 19 Feb 2014 11:06:39 +0100 Subject: [PATCH 1/3] fix opcode for JML Absolute indirect long --- src/ca65/instr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ca65/instr.c b/src/ca65/instr.c index 73fd83a78..4e30b406c 100644 --- a/src/ca65/instr.c +++ b/src/ca65/instr.c @@ -806,7 +806,7 @@ static unsigned char EATab[10][AM65I_COUNT] = { 0x08, 0x08, 0x04, 0x0C, 0x00, 0x14, 0x1C, 0x00, 0x14, 0x1C, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x70 + 0x00, 0x00, 0x80 }, { /* Table 2 */ 0x00, 0x00, 0x24, 0x2C, 0x0F, 0x34, 0x3C, 0x00, From 284436229e41f0bf0f497c60385ad4f75e833469 Mon Sep 17 00:00:00 2001 From: lintbe Date: Wed, 19 Feb 2014 13:22:06 +0100 Subject: [PATCH 2/3] add jml($1234) for JML Absolute indirect long --- src/ca65/ea65.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ca65/ea65.c b/src/ca65/ea65.c index 21e9073ac..7db71a185 100644 --- a/src/ca65/ea65.c +++ b/src/ca65/ea65.c @@ -150,7 +150,7 @@ void GetEA (EffAddr* A) A->AddrModeSet = AM65_DIR_IND_Y; } else { /* (adr) */ - A->AddrModeSet = AM65_ABS_IND | AM65_DIR_IND; + A->AddrModeSet = AM65_ABS_IND | AM65_ABS_IND_LONG | AM65_DIR_IND; } } From d001a6f1a0ec23366ab435d7673908f9690a99bb Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 20 Feb 2014 21:03:52 +0100 Subject: [PATCH 3/3] Have _heapmaxavail() work as advertised. The cc65 doc explicitly states that the return value of _heapmaxavail() can be used as parameter of malloc(). To actually allow for that the size of HEAP_ADMIN_SPACE has to be substracted from the raw size of the largest free heap block. --- libsrc/common/_heapmaxavail.s | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libsrc/common/_heapmaxavail.s b/libsrc/common/_heapmaxavail.s index 16fc10dde..4d44fadc1 100644 --- a/libsrc/common/_heapmaxavail.s +++ b/libsrc/common/_heapmaxavail.s @@ -61,7 +61,7 @@ __heapmaxavail: ; F = F->next; -@L2: iny ; Points to F->next +@L2: iny ; Points to F->next lda (ptr1),y tax iny @@ -69,8 +69,17 @@ __heapmaxavail: stx ptr1 jmp @L1 -; return Size; +; if (Size < HEAP_ADMIN_SPACE) return 0; @L3: lda ptr2 + sub #HEAP_ADMIN_SPACE ldx ptr2+1 + bcs @L5 + bne @L4 + txa rts + +; return Size - HEAP_ADMIN_SPACE; + +@L4: dex +@L5: rts