[cc65] Strange cc65 generation?

From: Carlos <shangri-la1teleline.es>
Date: 2009-10-15 22:16:39
Hi,

Trying to get a smooth sprite animation, i code a function to wait for a rasterline > 250. The behaviour of the animation wasn't the expected so i check the assembler generated code of cc65:

C code:

void __fastcall__ waitraster(void)
{
   if ((VIC.ctrl1 & 0x80) == 0x0)  // high bit of $d012
  {
     while (VIC.rasterline < 0xfb);
  } 
}


ASM generated code:

.segment "CODE"

.proc _waitraster

.segment "CODE"

 lda     $D011
 and     #$80
 cmp     #$00
L0039: bne     L0036
 lda     $D012
 cmp     #$FB
 jsr     boolult
 jmp     L0039
L0036: rts

.endproc


then i remove the $d011 (VIC.ctrl1) condition and check the result again:

C code:

void __fastcall__ waitraster(void)
{
 while (VIC.rasterline < 0xfb);
}


ASM generated code:

.segment "CODE"

.proc _waitraster

.segment "CODE"

L0030: lda     $D012
 cmp     #$FB
 bcc     L0030
 rts

.endproc


This second function seems to work fine, so i conclude there are something wrong in the first case. Any idea? What's exactly means the jsr boolult sentence?


Regards,


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Oct 15 22:16:47 2009

This archive was generated by hypermail 2.1.8 : 2009-10-15 22:16:49 CEST