[cc65] possible error, tertiary on cbm_save return value

From: Johan Kotlinski <kotlinski1gmail.com>
Date: 2009-08-23 20:27:25
Hi,
with revision 3987, the following code:

#include <cbm.h>

void foo() {
    char a = cbm_save("foo", 8, (void*)0x4000, 0x4000) ? 'a' : 'b';
}

...gives this output:

.proc   _foo: near
    lda     #<(L0001)
    ldx     #>(L0001)
    jsr     pushax
    lda     #$08
    jsr     pusha
    ldx     #$40
    lda     #$00
    jsr     pushax
    ldx     #$40
    lda     #$00
    jsr     pushax
    jsr     _cbm_save
    stx     tmp1  <--- problem?
    ora     tmp1  <--- problem?
    jeq     L0009
    ldx     #$00
    lda     #$41
    jmp     L000B
L0009:  ldx     #$00
    lda     #$42
    jmp     L000B
L000B:  jsr     pusha
    jsr     incsp1
    rts

It seems wrong to me, that it checks the return from cbm_save using x.
Isn't the return value in a?

Johan
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Aug 23 20:27:55 2009

This archive was generated by hypermail 2.1.8 : 2009-08-23 20:27:57 CEST