From: cuz Date: Sat, 27 Sep 2003 14:42:24 +0000 (+0000) Subject: New section about porting X-Git-Tag: V2.12.0~1319 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b069a6ae7082dfd438615295855aba864679abc1;p=cc65 New section about porting git-svn-id: svn://svn.cc65.org/cc65/trunk@2452 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 534269461..cc937c534 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -561,8 +561,8 @@ names like "Loop". Here is an example: dey bne @Loop ; Ok rts - Sub: ... ; New global label - bne @Loop ; ERROR: Unknown identifier! + Sub: ... ; New global label + bne @Loop ; ERROR: Unknown identifier! Unnamed labels

@@ -2934,7 +2934,90 @@ specify an additional type. Predefined types are 0 (constructor) and 1 +Porting sources from other assemblers

+Sometimes it is necessary to port code written for older assemblers to ca65. +In some cases, this can be done without any changes to the source code by +using the emulation features of ca65 (see ). In other cases, it is necessary to make changes to the +source code. + +Probably the biggest difference is the handling of the directive. ca65 generates relocatable code, and placement is +done by the linker. Most other assemblers generate absolute code, placement is +done within the assembler and there is no external linker. + +In general it is not a good idea to write new code using the emulation +features of the assembler, but there may be situations where even this rule is +not valid. + +TASS

+ +You need to use some of the ca65 emulation features to simulate the behaviour +of such simple assemblers. + + +Prepare your sourcecode like this: + + + ; 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] + + +notice that the two emulation features are mostly useful for porting +sources originally written in/for TASS, they are not needed for the +actual "simple assembler operation" and are not recommended if you are +writing new code from scratch. + +Replace all program counter assignments (which are not possible in ca65 +by default, and the respective emulation feature works different from what +you'd expect) by another way to skip to another memory location, for example +the directive. + + + ; *=$2000 + .res $2000-* ; reserve memory up to $2000 + + +notice that other than the original TASS, ca65 can never move the +programmcounter backwards - think of it as if you are assembling to disc with +TASS. + +Conditional assembly (. + +To assemble code to a different address than it is executed at, use the + directive instead of + + .org $1800 + + [floppy code here] + + .reloc ; back to normal + + +Then assemble like this: + + + cl65 --start-addr 0x0ffe -t none myprog.s -o myprog.prg + + +notice that you need to use the actual start address minus two, since two +bytes are used for the cbm load address. + + Bugs/Feedback