On Tue, Mar 16, 2004 at 09:09:32AM +1030, Todd Elliott wrote: > The following code did not compile correctly under ca65? > > LoadW r0, epsLineBuf+14 ; point to start of coordinates. > > The LoadW is a macro, meaning that r0 ($02-$03) will contain the address > of epsLineBuf+14. > > Problem is, the high byte seems to be wrong; It appears that the +14 is > added to high byte, a no-no. ca65 is correct, the macro is not. As you can see from the operator precedence table in the ca65 docs, the '<' and '>' operators have a higher precedence than the '+' operator. This means that lda #<epsLineBuf+14 will *first* take the low byte of the label, and *then* add 14 to the result. When using the '<' and '>' operators, the operand must usually be put into parenthesis: lda #<(epsLineBuf+14) You can also use the new pseudo functions .lobyte and .hibyte. Since they are functions, braces are always needed, which means that you cannot forget them:-) lda #.lobyte(epsLineBuf+14) Maciej, can you have a look at the GEOS macros? Todd didn't tell where he got the LoadW macro from, but the one in libsrc/geos/geosmac.ca65.inc does definitely have this problem. Regards Uz -- Ullrich von Bassewitz uz@musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Tue Mar 16 00:40:11 2004
This archive was generated by hypermail 2.1.8 : 2004-03-16 00:40:17 CET