From 3741e48e97aae2802d6eacc89fa9916143d45300 Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 10 Oct 2003 18:26:12 +0000 Subject: [PATCH] Documented changes to .CPU and new .MACPACK cpu git-svn-id: svn://svn.cc65.org/cc65/trunk@2510 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/ca65.sgml | 102 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 80 insertions(+), 22 deletions(-) diff --git a/doc/ca65.sgml b/doc/ca65.sgml index cc937c534..51e25fef7 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -413,7 +413,7 @@ already known, after evaluating the left hand side, the right hand side is not evaluated. -Available operators

+Available operators

Available operators sorted by precedence: @@ -950,15 +950,10 @@ Here's a list of all control commands and a description, what they do: .CPU

Reading this pseudo variable will give a constant integer value that - tells which instruction set is currently enabled. Possible values are: - - - 0 --> 6502 - 1 --> 65SC02 - 2 --> 65C02 - 3 --> 65SC816 - 4 --> SunPlus SPC - + tells which CPU is currently enabled. It can also tell which instruction + set the CPU is able to translate. The value read from the pseudo variable + should be further examined by using one of the constants defined by the + "cpu" macro package (see /). It may be used to replace the .IFPxx pseudo instructions or to construct even more complex expressions. @@ -966,15 +961,16 @@ Here's a list of all control commands and a description, what they do: Example: - .if (.cpu = 0) .or (.cpu = 1) .or (.cpu = 2) - txa - pha - tya - pha - .else - phx - phy - .endif + .macpack cpu + .if (.cpu .bitand CPU_ISET_65816) + phx + phy + .else + txa + pha + tya + pha + .endif @@ -1744,6 +1740,8 @@ Here's a list of all control commands and a description, what they do: generic Defines generic macros like add and sub. longbranch Defines conditional long jump macros. + cbm Defines the scrcode macro + cpu Defines constants for the .CPU variable Including a macro package twice, or including a macro package that @@ -2826,6 +2824,66 @@ The package defines the following macros: +.MACPACK cbm

+ +The cbm macro package will define a macro named .MACPACK cpu

+ +This macro package does not define any macros but constants used to examine +the value read from the / pseudo variable. For +each supported CPU a constant similar to + + + CPU_6502 + CPU_65SC02 + CPU_65C02 + CPU_65816 + CPU_SUNPLUS + + +is defined. These constants may be used to determine the exact type of the +currently enabled CPU. In addition to that, for each CPU instruction set, +another constant is defined: + + + CPU_ISET_6502 + CPU_ISET_65SC02 + CPU_ISET_65C02 + CPU_ISET_65816 + CPU_ISET_SUNPLUS + + +The value read from the / pseudo variable may +be checked with / to determine if the +currently enabled CPU supports a specific instruction set. For example the +65C02 supports all instructions of the 65SC02 CPU, so it has the + + .if (.cpu .bitand CPU_ISET_65SC02) + lda (sp) + .else + ldy #$00 + lda (sp),y + .endif + + +it is possible to determine if the + + + lda (sp) + + +instruction is supported, which is the case for the 65SC02, 65C02 and 65816 +CPUs (the latter two are upwards compatible to the 65SC02). + + + Module constructors/destructors

Note: This section applies mostly to C programs, so the explanation @@ -2962,13 +3020,13 @@ of such simple assemblers. ; if you want TASS style labels without colons .feature labels_without_colons - + ; if you want TASS style character constants ; ("a" instead of the default 'a') .feature loose_char_term - + .word *+2 ; the cbm load address - + [yourcode here]