From d7ff0daac34f377de05d5f0d98cdc01cb6b8f128 Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 2 Jul 2009 14:20:38 +0000 Subject: [PATCH] Fixed a small error. git-svn-id: svn://svn.cc65.org/cc65/trunk@3969 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/coding.sgml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/coding.sgml b/doc/coding.sgml index fb4957430..48ba1d128 100644 --- a/doc/coding.sgml +++ b/doc/coding.sgml @@ -110,9 +110,9 @@ if you don't help. Look at this example: The expression is parsed from left to right, that means, the compiler sees 'i', -and puts it contents into the secondary register. Next is OFFS, which is +and puts it contents into the secondary register. Next is OFFS, which is constant. The compiler emits code to add a constant to the secondary register. -Same thing again for the constant 3. So the code produced contains a fetch +Same thing again for the constant 3. So the code produced contains a fetch of 'i', two additions of constants, and a store (into 'i'). Unfortunately, the compiler does not see, that "OFFS + 3" is a constant for itself, since it does it's evaluation from left to right. There are some ways to help the compiler @@ -163,7 +163,7 @@ The compiler produces optimized code, if the value of a pointer is a constant. So, to access direct memory locations, use - #define VDC_DATA 0xD601 + #define VDC_STATUS 0xD601 *(char*)VDC_STATUS = 0x01; @@ -171,7 +171,7 @@ That will be translated to lda #$01 - sta $D600 + sta $D601 The constant value detection works also for struct pointers and arrays, if the -- 2.39.5