From 855fdbfcb0f01477b7cd6d518bad2572929fd3f6 Mon Sep 17 00:00:00 2001 From: cuz Date: Sat, 6 Dec 2003 14:46:12 +0000 Subject: [PATCH] More .sizeof explanations git-svn-id: svn://svn.cc65.org/cc65/trunk@2721 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/ca65.sgml | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 70bb5d177..67c7d9f66 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -2625,7 +2625,7 @@ Here's a list of all control commands and a description, what they do: of a name represents both, a scope and a symbol, the scope is choosen over the symbol. - Usage examples: + After the following code: .struct Point ; Struct size = 4 @@ -2634,26 +2634,55 @@ Here's a list of all control commands and a description, what they do: .endstruct P: .tag Point ; Declare a point + @P: .tag Point ; Declare another point .code - .proc Code ; 3 bytes - nop + .proc Code nop + .proc Inner + nop + .endproc nop .endproc - .proc Data ; 4 bytes + .proc Data .data ; Segment switch!!! .res 4 .endproc - - lda #.sizeof(Point) ; Loads 4 - lda #.sizeof(Point::xcoord) ; Loads 2 - lda #.sizeof(P) ; Loads 4 - lda #.sizeof(Code) ; Loads 3 - lda #.sizeof(Data) ; Loads 0 + + + will have the value 4, because this is the size of struct + will have the value 2, because this is the size of the member + will have the value 4, this is the size of the data declared on the same + source line as the label + will have the value 4, see above. The example demonstrates that + will have the value 3, since this is amount of data emitted into the code + segment, the segment that was active when + will have the value 1 as expected. + + + will have the value 0. Data is emitted within the scope + .SMART