Debian Codegraph @

docs/65816.txt

raw
1
2
3 ACME
4
5 ...the ACME Crossassembler for Multiple Environments
6
7 --- 65816 support ---
8
9
10 This text contains information about the 65816-specific features of
11 ACME.
12
13
14 ----------------------------------------------------------------------
15 Section: Aliases for "long" JMPs and JSRs
16 ----------------------------------------------------------------------
17
18 In addition to the mnemonics JMP and JSR, the 65816 processor also
19 knows JML and JSL, which are JMP and JSR using new (long) addressing
20 modes. ACME also accepts the new addressing modes when using the old
21 mnemonics JMP and JSR, but the old addressing modes cannot be used
22 with the new mnemonics JML and JSL.
23
24
25 ----------------------------------------------------------------------
26 Section: Argument order of MVN/MVP
27 ----------------------------------------------------------------------
28
29 According to WDC's official syntax for 65816 assembly language, the
30 argument order of the MVN and MVP instructions differs between
31 assembly language and machine code.
32 To copy bytes from bank $ab to bank $cd, use the following statement:
33 mvn $ab, $cd ; source bank $ab, destination bank $cd
34 or
35 mvn #$ab, #$cd ; source bank $ab, destination bank $cd
36 ACME will then produce the following machine code:
37 $54 $cd $ab ; opcode mvn, destination bank $cd, source bank $ab
38
39 ACME 0.05 and earlier did it the wrong way.
40
41
42 ----------------------------------------------------------------------
43 Section: Register lengths
44 ----------------------------------------------------------------------
45
46 When assembling "lda #5" for example, ACME has to know whether to
47 create an 8-bit argument or a 16-bit argument. This depends on the
48 current register length.
49 On startup, ACME assumes all registers are 8 bits wide. You can change
50 this at any time using the following pseudo opcodes:
51
52 !al ; switch to long accumulator
53 !as ; switch to short accumulator
54 !rl ; switch to long index registers
55 !rs ; switch to short index registers
56
57 Please note that ACME, unlike some other assemblers, does *not* track
58 SEP/REP instructions: I don't like that method - it fails when
59 encountering PLPs, for example. So if it doesn't work reliably in the
60 first place, why use it? :)
61
62 If you don't like that you always have to use a pseudo opcode
63 alongside SEP/REP instructions, then have a look at the library file
64 <65816/std.a> which has some predefined macros you can use.
65
66
67 ----------------------------------------------------------------------
68 Section: Postfixing stuff
69 ----------------------------------------------------------------------
70
71 You can also use the postfix method (which is explained in the file
72 "AddrModes.txt") to specify the immediate argument's length:
73
74 ldx+2 #5
75
76 will always be assembled to a 16-bit argument, regardless of the
77 currently configured index register width. Use at your own risk - this
78 method obviously is not a good example on structured programming. :)
79
80
81 ----------------------------------------------------------------------
82 Section: Miscellaneous
83 ----------------------------------------------------------------------
84
85 The 65816 CPU has an address space of 16 MBytes, but that is still
86 split up into 256 "banks" of 64 KBytes each: A simple "JMP $1234"
87 instruction does not necessarily jump to $001234, it rather jumps to
88 address $1234 _in_the_bank_where_the_code_is_currently_running_.
89 Therefore, it does not make sense to use 24-bit values for most
90 labels. On the other hand, when jumping between banks, you need the
91 full 24-bit address.
92 One solution for this problem would be something like this:
93
94 ; this code is supposed to run at $1000 in bank 2:
95 * = $021000 ; we use the correct 24-bit address, but we
96 !pseudopc * & $ffff { ; restrict the pc to 16 bits
97 start lda some_var ; now "start" is $1000
98 beq some_label
99 ...
100 }
101 This way, referencing "start" will give you the 16-bit value ($1000),
102 but referencing "&start" will give the full 24-bit value ($021000).