Jump to content
IGNORED

Quick "why is it" question


atari2600land

Recommended Posts

Why is this allowed:

if d=3 && pfread(a, b) then c=0

and this isn't?

if pfread(a, b) && d=3 then c=0

It isn't a question of being "allowed" or not. It seems there's a bug in the compiler that prevents the second version from compiling correctly.

 

Here's the compilation and assembly of the first version:

 

.L01    	;  if d = 3  &&  pfread ( a , b )  then c = 0
       	LDA d
       	CMP #3
       	BNE .skipL01
.condpart0
       	LDA a
       	LDY b
       	jsr pfread
       	BNE .skip0then
.condpart1
       	LDA #0
       	STA c
.skip0then
.skipL01

Here's the second version:

 

.L01    	;  if pfread ( a , b )   &&  d = 3 then c = 0
       	LDA a
       	LDY b
       	jsr pfread
       	BNE .skipL01
.condpart0
       	; complex statement detected
       	LDA #3
       	PHA
       	LDA then
       	PHA
       	LDA c
       	PHA
       	LDA =
       	PHA
       	LDA #0
       	STA d
.skipL01

The pfread compiles correctly either way, but for some reason the compiler thinks there's a complex statement after the &&, so it compiles that part incorrectly.

 

Michael

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...