Home » Archimedes archive » Acorn User » AU 1997-Xmas A.adf » StrongHelp » !Manuals/Assembly2

!Manuals/Assembly2

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-Xmas A.adf » StrongHelp
Filename: !Manuals/Assembly2
Read OK:
File size: AB38 bytes
Load address: 0000
Exec address: 0000
File contents
HELP(�`�,���D$DIR$LLxF���p-��!!Root�
F���3�,��condtF���=�y�Op2XF������y�Rd�F���[ũy�Rn�F���'�y�S\F���ͩy�Shift F���!�vYADC|F����vADD�F����!vRSB�F����lv�SBC�F����(v�SUB� F����$v�RSC@#F����vNMOV�%F����v�MVN8(F����Iv�CMP�+F����vCMN/F���@vAND 1F����vDEORd3F���vrORR�5F���cv�BICd9F����voTST�<F�����vTEQ�?F�����vkMLADCF����v�MULFF�����v�SWI�HF���QY�vGBKF������y�BL�OF������y�LDR�QF�����ySTR�SF���@V�y6Byte�TF���0?�y�PC_rel�WF���d��ycPost [F����b�y!PreD^F���	�yRwb�bF���4H�y�LDMhF���OC�y�STM�mF���X/�y�M_opts�sF���ɣ�y�M_wbtxF�����y�stacks��F����v�yxstacks2t�F���Q��y�EQU\�F����x�yL%x�F���#��yOPT|�F���T�yWP%ԐF���C	�y0Reserve�F����)<z�ADR�F����b;z_ALIGNd�F���(�<zPassB_M��F����=z�usrH�F����N[z�P��G����LfqR14��G���]lf>R15��F���,�u}XCALL�F���v#��zCreditsDATA!Assembly
#background wimp 1
#wrap off
#align centre
*ARM Instructions*
#align
#tab
<ADC>	Add with Carry		<MUL>	Multiply
<ADD>	Add			<MVN>	Move Negative
<AND>	And			<ORR>	Inclusive OR
<B>	Branch			<RSB>	Reverse Subtract
<BIC>	Bit Clear		<RSC>	Reverse Subtract with Carry
<BL>	Branch with Link	<SBC>	Subtract with Carry
<CMN>	Compare Negative	<STM>	Store Multiple
<CMP>	Compare			<STR>	Store Register
<EOR>	Exclusive OR		<SUB>	Subtract
<LDM>	Load Multiple		<SWI>	Software Interrupt
<LDR>	Load Register		<TEQ>	Test for Equality
<MLA>	Multiply with Accumulate	<TST>	Test Masked	
<MOV>	Move			
#tab
#line
#align centre
*Registers*, *Integer Variables and Suffixes*
<Condition codes=>cond>    < Rd >    < Rn >    < Op2 >    <R14>    <R15>
<P%>    <L%>    < S >    < B =>Byte>    < P >
#line
*Pseudo opcodes*, *Assembler directives and CALL*
<OPT>    <EQU>    <ALIGN>    <ADR>    <CALL>
#line
*Miscellaneous*
<Reserving memory=>Reserve>
<Passing data to machine code routines=>PassB_M>
<Returning data to BASIC=>usr>
#line
<Credits and Copyright=>Credits>
DATA�Condition codes
#background wimp 1
All instructions are conditionally executed. If the condition in the top four bits of the instruction is not met, then even illegal instructions will have no effect...

#wrap off; tab
Condition field	 	 	Execute IF
#Line
  0000	EQ	:	 Z		(equal)
  0001	NE	:	~Z		(not equal)
  0010	CS	:	 C		(unsigned higher or same)
  0011	CC	:	~C		(unsigned lower)
  0100	MI	:	 N		(negative)
  0101	PL	:	~N		(positive or zero)
  0110	VS	:	 V		(overflow)
  0111	VC	:	~V		(no overflow)
  1000	HI	:	 C and ~Z	(unsigned higher)
  1001	LS	:	~C or Z		(unsigned lower or same)
  1010	GE	:	 N = V		(signed higher or same)
  1011	LT	:	 N \<\> V	(signed lower)
  1100	GT	:	~Z and (N = V)	(signed higher)
  1101	LE	:	 Z or (N \<\> V)	(signed lower or same)
  1110	AL	:	 1		(always)
  1111	NV	:	 0		(never)
#tab; wrap nojoin

( 1 is true, 0 is false, ~ is NOT )

Note: The NV code shouldn't be used anymore. If you want a no-op, you should use something like MOV R0,R0DATA�Op2
#background wimp 1
#wrap off
This can take several forms :
   -	Reg
   -	Reg <shift> #constant
   -	Reg <shift> Reg
	(Note: This takes an extra clock cycle)
   -	#constant
	( of the form Byte ROR n*2, n is 0..15 )DATA�Rd
#background wimp 1
Rd can be any of the registers from R0 to R15. If Rd = R15 then only the PC bits will be set, not the flags.DATA�Rn
#background wimp 1
Rn can be any of the registers from R0 to R15. If Rn = R15 then only the PC bits are used. The flag bits will appear cleared.DATA�The Status flag
#background wimp 1
Flags will only be updated if this is present. The S flag is implicit in CMP, CMN, TEQ and TST
#wrap off

  SUBS R1,R1,R2		;
  ADD  R1,R1,R3		; 
  Beq  xxx		; jump if R1-R2 = 0DATA�Shift
#background wimp 1
The shift types are :
  LSL	Logical Shift Left (*2)
  LSR	Logical Shift Right (/2)
  ASR	Arithmetic Shift Right (/2)
  ROR	ROtate Right
  RRX	Rotate Right eXtended

In all cases, the bit lost from the end is shifted into the carry flag. In ASR, the arithmetic sign of the number is preserved (+ve/-ve). In ROR, the bit lost is also copied back to bit 31. RRX is similar, but this time the carry flag acts as 'bit 32'.DATAYADC: Add with Carry
#background wimp 1
#wrap off
Syntax: ADC \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one + operand two + carry
Flags: N,Z,C,V
#wrap on
#line
This operation performs the arithmetic addition of its two operands, also adding the carry flag. If set, the carry flag it is treated as one in the addition. (Otherwise, as zero). The result is stored in the destination register.
#line
ADC allows us to add together numbers which require more than a single word to represent them. e.g.
#tab
#indent 2
ADDS result_low, low1, low2	Add low words
ADCS result_high, high1, high2	Add high words + carry
#indent
#tab
*Note*: It is vital that the S suffix is used with these instructions, otherwise the carry flag setting will not be affected and will not be carried forward into the next addition.DATAADD: Add
#background wimp 1
#wrap off
Syntax: ADD \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one + operand two
Flags: N,Z,C,V
#wrap on
#line
This instruction performs the arithmetic addition of its two operands, and stores the result in the destination register.
#line
Examples:
#Indent 2
ADD	R0,R3,R4	R0 = R3 + R4
ADDS	R0,R3,#2	R0 = R3 + 2 (Setting status flags)
ADDMI	R0,R0,#1	If minus flag set increment R0 by 1
ADD	R0,R0,R0,LSL#1	R0 = R0 + 2*R0  (R0 = 3*R0)
#IndentDATARSB: Reverse Subtract
#background wimp 1
#wrap off
Syntax: RSB \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand two - operand one
Flags: N,Z,C,V
#wrap on
#line
This instruction performs the arithmetic subtraction of its first operand from its second operand, and stores the result in the destination register. It is very similar to <SUB>.
#line
This is not a waste of an instruction! Operand two can be specified in several different formats, and it is thus much more flexible than operand one. The RSB instruction thus ensures that either of the operands used can be specified using the flexible format allowed by operand two.
#line
Examples:
#Indent 2
RSB	R0,R0,#0	R0 = 0 - R0 (R0 = -R0)
RSB	R6,R3,R7,LSL#2	R6 = (R7*4) - R3
#IndentDATA�SBC: Subtract with Carry
#background wimp 1
#wrap off
Syntax: SBC \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one - operand two - not (carry)
Flags: N,Z,C,V
#wrap on
#line
This operation allows multi-word subtraction to be performed in the same way that <ADC> allows multi-word addition. This time the carry flag is used to indicate that a "borrow" occured when subtracting two words.
#line
SBC can be used for multi-word subtractions as follows:
#tab
#indent 2
SUBS result_low, low1, low2	Subtract low words
SBCS result_high, high1, high2	Subtract high words + carry
#indent
#tab
*Note*: It is vital that the S suffix is used to allow the subtract instructions to affect the carry flag.DATA�SUB: Subtract
#background wimp 1
#wrap off
Syntax: SUB \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one - operand two
Flags: N,Z,C,V
#wrap on
#line
This instruction performs the arithmetic subtraction of its second operand from its first operand, and stores the result in the destination register.
#line
Examples:
#Indent 2
SUB	R10,R2,R4	R10 = R2 - R4
SUBMI	R1,R3,#1024	If neg flag set R1 = R3 - 1024
SUB	R0,R0,R0,LSL#1	R0 = R0 - 2*R0 (R0 = -R0)
#IndentDATA�RSC: Reverse Subtract with Carry
#background wimp 1
#wrap off
Syntax: RSC \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand two - operand one - not (carry)
Flags: N,Z,C,V
#wrap on
#line
This operation performs a reverse subtract operation while taking account of a previous borrow in the carry flag.
#line
This operand allows reversed subtraction to be performed on multi-word operands. It corresponds to the <SBC> instruction in the same way that <RSB> corresponds to <SUB>.
#line
Examples:
#wrap off
#Indent 2
RSBS	result_low, low1, low2		Reverse subtract low words
RSCS	result_high, high1, high2	Reverse subtract high words + carry
#Indent
#wrap onDATANMOV: Move Data
#background wimp 1
#wrap off
Syntax: MOV \{\<suffix\>\} \<destination\>, \<operand2\>
Operation: destination = operand two
Flags: N,Z,(C)
#wrap on
#line
This instruction moves data into the destination register. Operand two, as expected, can be specified as a register, an immediate operand or as a shifted register.
#line
Examples:
#wrap off
#Indent 2
MOV	R12,R0		Move the contents of R0 into R12
MOV	R6,R6,ASL#2	R6 = R6*4
MOV	R0,R2,ASL R5	R0 = R2 * (2^R5)
MOVEQS	R0,R4		If Z flag set Then R0 = R4 (setting flags)
MOV	R15,R14		Return from subroutine
#Indent
#wrap onDATA�MVN: Move Inverted Data
#background wimp 1
#wrap off
Syntax: MVN \{\<suffix\>\} \<destination\>, \<operand2\>
Operation: destination = not (operand two)
Flags: N,Z,(C)
#wrap on
#line
This instruction has exactly th same effect as <MOV>, except that all the bits moved from the source register are automatically inverted. This allows negative immediate numbers to be moved into registers
#line
Under the two's complement scheme, the number 'n' is represented as:
#Indent 4
NOT (n) + 1
#Indent
#line
Examples:
#wrap off
#Indent 2
MVN	R0,#0		Move -1 into register R0
MVN	R1,#9		Move -10 into R1
MVN	R3,R5		R3 = not (R5)
MVN	R6,R7,LSR #1	R6 = not (R7 div 2)
#Indent
#wrap onDATA�CMP: Compare
#background wimp 1
#wrap off
Syntax: CMP \{\<suffix\>\} \<operand1\>, \<operand2\>
Operation: Reflect result of operand one - operand two
Flags: N,Z,C,V
#wrap on
#line
This is a very important instruction connected with conditional instruction execution. The instruction compares two operands, and alters the status flags depending on the result.
#line
The result of the operation is not stored anywhere, which explains why there is no need for a destination field. The only thing to remember is that the various subsequent condition codes refer to operand one compared with operand two. Thus, the LT (less than) suffix will execute if operand one is less than operand two.
#line
Example:
#wrap off
#indent 2
CMP	R0,R1		Compare R0 with R1
SWIEQ	"OS_NewLine"	If (R0 - R1 = 0) execute SWI command
#indent
#wrap on
*Note*: Since the purpose of the CMP instruction is to affect the status flags, the S suffix does not have to be used.
DATACMN: Compare Negative
#background wimp 1
#wrap off
Syntax: CMN \{\<suffix\>\} \<operand1\>, \<operand2\>
Operation: Reflect result of operand one - (- operand two)
Flags: N,Z,C,V
#wrap on
#line
CMN is exactly the same as <CMP>, except that it compares operand one with the negative of operand two.
#line
This instruction allows comparisons to be made with small immediate constants which could not be represented otherwise. The ARM will automatically form the negative of operand two and then make the comparison.
#line
Examples
#wrap off
#indent 2
CMN	R5,R7		Compare R5 with -R7
CMN	R6,#1		Compare R6 with -1
CMN	R3,R0,LSL#1	Compare R3 with -R0*2
#indent
#wrap on
*Note*: Since the purpose of the CMP instruction is to affect the status flags, the S suffix does not have to be used.
DATAAND: Logical AND
#background wimp 1
#wrap off
Syntax: AND \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one AND operand two
Flags: N,Z,(C)
#wrap on
#line
This operation performs a logical bitwise AND operation between its two operands, with the result being placed in the destination register.
#line
Examples:
#wrap off
#Indent 2
AND 	R0,R1,R2	R0 = R1 AND R2
AND	R5,R5,#%1111	R5 = R5 AND %1111 (clear all but low 4 bits)
ANDS	R4,R4,#1	R4 = R4 AND 1 (setting flags)
#Indent
#wrap onDATADEOR: Logical Exclusive OR
#background wimp 1
#wrap off
Syntax: EOR \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one EOR operand two
Flags: N,Z,(C)
#wrap on
#line
This operation performs a logical bitwise EOR operation between its two operands, with the result being placed in the destination register.
#line
*Note*: EOR is very useful in 'toggling' data between two pre-defined values. For example, the register R0 can be toggled between 65 and 90 by EORing its contents with 27:
#Indent 4
.loop
EOR R0,R0,#27
B loop
#Indent
DATArORR: Logical OR
#background wimp 1
#wrap off
Syntax: ORR \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one OR operand two
Flags: N,Z,(C)
#wrap on
#line
This instruction performs a logical bitwise OR operation between its two operands, with the result being placed in the destination register.
#line
*Note*: This operation is particularly useful for forcing certain bits to be set in a data word.
#line
Examples:
#wrap off
#Indent 2
ORR	R0,R11,R2	R0 = R11 OR R2
ORR	R7,R7,#%1100	R7 = R7 OR %1100 (set bits 2 & 3)
ORRS	R5,R5,#2	R5 = R5 OR #2 (setting flags)
#Indent
#wrap onDATA�BIC: Bit Clear
#background wimp 1
#wrap off
Syntax: BIC \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one AND (NOT (operand two))
Flags: N,Z,(C)
#wrap on
#line
This instruction provides a useful way of clearing certain bits within a data word, while leaving others unchanged. Operand one is the data field to be modified, with the result being placed in the destination register.
#line
Operand two is a 32-bit word called the data mask. A set bit in the bit mask will force the corresponding bit in the data word to be reset when the instruction is executed. A zero bit in the mask will leave the corresponding bit in the data word in its original state.
#line
Examples:
#wrap off
#Indent 2
BIC	R0,R0,#%1111	Clear low 4 bits of R0
BIC	R1,R1,R2	Clear bits in R1 which were set in R2
BIC	R6,R6,R6	Clear bits which were set in R6 (R6 = 0)
#Indent
#wrap onDATAoTST: Test Bits
#background wimp 1
#wrap off
Syntax: TST \{\<suffix\>\} \<operand1\>, \<operand2\>
Operation: Reflect result of operand one AND operand two
Flags: N,Z,(C)
#wrap on
#line
This instruction performs the logical bitwise ANDing of operands one and two, but does not store the result anywhere - instead the status flags are altered to reflect the result.
#line
TST can be used to see if a particular bit in a data word is set or clear. The data word forms one operand. A bit mask, in which the appropriate bit is et, forms the other operand. After the TST operation the Z flag will be set if the bit is set in the data word, clear if it is not.
#line
Examples:
#wrap off
#Indent 2
TST	R1,#%1000	Test to see if bit 3 is set in R1
TST	R3,R4		Test if any bits set in both R3 and R4
#Indent
#wrap on
*Note*: This is another instruction where the S suffix is implied.DATATEQ: Test Equivalence
#background wimp 1
#wrap off
Syntax: TEQ \{\<suffix\>\} \<operand1\>, \<operand2\>
Operation: Reflect result of operand one EOR operand two
Flags: N,Z,(C)
#wrap on
#line
This instruction is very similar to <TST>. The only difference is that it performs a notional EOR operation between its operands, instead of an AND. The TEQ instruction can be used to see if the bits in two data words are the same or not.
#line
This comparison would normally be performed using <CMP>. However TEQ does not affect the carry flag, which may sometimes be useful.
#line
Examples:
#wrap off
#Indent 2
TEQ	R1,#5		Test to see if R1 contains 5
TEQ	R3,R4		Test to see if R3 = R4
#Indent
#wrap on
*Note*: This is another instruction where the S suffix is implied.DATAkMLA: Multiplication with Accumulate
#background wimp 1
#wrap off
Syntax: MLA \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>, \<sum\>
Operation: destination = (operand one * operand two) + sum
Flags: N,Z [V - unchanged; C - undefined]
#wrap on
#line
This instruction is similar to <MUL>, the difference being that the contents of the register given in the sum field are added into the result of the multiplication before storing it in the destination register. The restrictions which apply to <MUL> also apply to MLA.
#line
MLA is used to keep a running total of a series of multiplications. If the sum register is specified as being the same as the destination, then the result of each multiplication will be accumulated in the destination register.
#line
Examples:
#Indent 2
MLA	R0,R1,R2,R3	R0 = (R1 * R2) + R3
MLA	R0,R1,R2,R0	R0 = (R1 * R2) + R0
#IndentDATA�MUL: Multiplication
#background wimp 1
#wrap off
Syntax: MUL \{\<suffix\>\} \<destination\>, \<operand1\>, \<operand2\>
Operation: destination = operand one * operand two
Flags: N,Z [V - unchanged; C - undefined]
#wrap on
#line
This instruction performs 32-bit multiplication of the two operands, with the result being stored in the destination register.
#line
There are certain restrictions associated with the use of this instruction:
#wrap off
#Indent 2
- The 3 data fields specified must be simple registers
- The destination and operand1 must be different registers
- R15 may not be used as the destination register
#Indent
#wrap on
#line
Example:
#Indent 2
MUL	R0,R1,R3	R0 = R1 * R3
#IndentDATA�SWI: Software Interrupt
#background wimp 1
#wrap off
Syntax: SWI \<argument\> 
#wrap on
#line
When executed, this instruction causes the processor to break off from the current program. The ARM switches into supervisor mode and jumps to a pre-defined address in the OS. The argument field is then examined to determine which of the many OS facilities has been requested. When the appropriate routine has been completed, the ARM resumes the execution of the user program where it left off.
#line
Examples:
#Indent 2
SWI	"OS_Mouse"
SWI	"Wimp_CreateWindow"
#Indent
*Note*: The name of the routine must match up with that recognised by the assembler including the case of each character.DATAGB: Simple Branch
#background wimp 1
#wrap off
Syntax: B \<address\>
Operation: Jump to specified address
#wrap on
#line
This instruction is analogous to the BASIC GOTO statement - it makes the processor break off from its normal sequential execution of instructions and jump to a new instruction at a designated location.
#line
When used in conjunction with the normal condition codes, this instruction becomes the basis of conditional branching.
#line
Example:
#Indent 2
.loop
SUB	R0,R0,#1	R0 = R0 - 1
CMP	R0,#0		is R0 = 0?
BNE	loop		if not, go back to start of loop
#IndentDATA�BL: Branch with Link
#background wimp 1
#wrap off
Syntax: BL \<address\>
Operation: [MOV R14,PC] + Jump to specified address
#wrap on
#line
This instruction is analogous to the BASIC GOSUB statement - it makes the processor break off from its normal sequential execution of instructions and jump to a new instruction at a designated location. By moving the contents of R14 back into PC, we can return to the original Branch instruction.
#line
When used in conjunction with the normal condition codes, this instruction becomes the basis of conditional branching.
#line
Example:
#Indent 2
.loop
SUB	R0,R0,#1	R0 = R0 - 1
CMP	R0,#0		is R0 = 0?
BNE	loop		if not, go back to start of loop
BL	subroutine	otherwise, go to subroutine
...
.subroutine
MOV PC,R14		return to main code
#Indent
#line; wrap nojoin
*Note*: It is important that the contents of R14 are stored elsewhere prior to using this instruction. This can be done using a <stack=>stacks>.
The command 'MOV PC,R14' will mean that the original status flag settings will not be restored once the subroutine has returned. Should the user want the flags to be unaffected by the subroutine, the command should be modified to 'MOVS PC,R14'.
#wrap onDATA�LDR: Load to Register
#background wimp 1
#wrap off
Operation: Data transfer from memory to the registers
#wrap on
#line
This instruction is used to transfer data from memory into the registers. A system of indirect addressing is used to specify the source location address - the address to be looked up is held in a register.
There are two forms of indirect addressing: <Pre-indexed=>Pre> and <Post-indexed=>Post>. In addition to these two forms, a <PC relative=>PC_rel> address can also be specified.DATASTR: Store from Register
#background wimp 1
#wrap off
Operation: Data transfer from the registers to memory
#wrap on
#line
This instruction is used to transfer data from the registers into memory. A system of indirect addressing is used to specify the destination location address - the address to be looked up is held in a register.
There are two forms of indirect addressing: <Pre-indexed=>Pre> and <Post-indexed=>Post>. In addition to these two forms, a <PC relative=>PC_rel> address can also be specified.DATA6Byte addressing
#background wimp 1
By default, <LDR> and <STR> access complete words of memory (four bytes). However, they can be made to access single bytes using the 'B' suffix.
#line
Examples:
#wrap off
#indent 2
LDRB	R0,[R2,R4]
STRB	R0,[R5,#4]
LDRB	R0,[R6,R5,LSR#6]!
LDRNEB	R0,[R1],R3
LDRB	R0,tableDATA�PC relative addressing
#background wimp 1
#wrap off
Syntax: LDR (or STR) \<destination\>,address
#wrap nojoin
#line
PC relative addressing is a pseudo-addressing mode as it is not a distinct addressing mode supported by the ARM. Instead, such instructions are converted into an appropriate pre-indexed instruction by the assembler.
The address is simply an absolute number, or an assembler label.
#line
Examples:
#wrap off
#indent 2
LDR R0,&1000	Load word of memory from location &1000 into R0
STR R0,table	Store R0 to word of memory specified by 'table'
#indent
#wrap on
#line
It is important to remember that the range of the offset, as in <pre-indexed addressing=>Pre>, is between -4096 and 4096.DATAcPost-indexed addressing
#background wimp 1
#wrap off
Syntax: LDR (or STR) \<destination\>, [\<base\>],\<offset\>
#wrap on
#line
This form of addressing is very similar to <pre-indexed addressing=>Pre>. In this case, however, the offset field is *not* optional.
#line
Examples:
#wrap off
#indent 2
LDR R1,[R0],R7		Load R1 from address R0	: R0=R0+R7
STR R6,[R7],#4		Store R6 at address R7	: R7=R7+4
LDR R8,[R2],R5,LSL#4	Load R8 from address R2	: R2=R2+R5*16
STR R0,[R0],#20		Store R0 at address R0	: R0=R0+20
#indent
#wrap on
#line
When post-indexed addressing is used, the contents of the base register alone are taken as the address of the memory word to be accessed. Only after this word has been accessed are the contents of the offset field added to the base register. Obviously, this implies that write back always occurs, so we do not need to specify it.DATA!Pre-indexed addressing
#background wimp 1
#wrap off
Syntax: LDR (or STR) \<destination\>, [\<base\>\{,\<offset\>\}]
#wrap on
#line
The destination field is the register into which the data will be transferred. The contents of the base and offset fields together specify the memory word to be accessed. The offset field is optional - if present, it will be added to the base field to give the required address. The offset field is specified in the same way as operand two in the data processing instructions.
#line
Examples:
#wrap off
#indent 2
LDR R0,[R1]		Load R0 from address R1
STR R0,[R1,R2]		Store R0 at address R1 + R2
LDR R0,[R1,#-4]		Load R0 from address R1 - 4
STR R0,[R1,R2,LSL#2]	Store R0 at address R1 + R2*4
#indent
#line
A further level of complexity is that of <write back=>wb>
DATARWrite Back
#background wimp 1
#wrap on
In calculating which word of memory is to be accessed, the ARM adds together the contents of the base and offset registers. It is sometimes useful to retain this newly calculated address for future use. In pre-indexed addressing, this is done by using the ARM's 'write back' facility.
#line
Write back is specified with the '!' suffix.
#wrap off
Examples:
#indent 2
LDR R0,[R1,R2]!		Load R0 from address R1+R2	: R1=R1+R2
STR R3,[R5,#10]!	Store R3 at address R5+R10	: R5=R5+10
LDR R7,[R3,R8,LSL#2]!	Load R7 from address R3+R8*4	: R3=R3+R8*4
#indent
#wrap nojoin
#line
When the ARM executes the instruction, it will perform the usual addition of the base and offset fields. It will then access the data at the newly calculated address. Finally, as write back is selected, it will store the newly calculated address back into the base register.
Write back is particularly useful when accessing a sequence of memory locations, e.g., to access consecutive memory words we can use 'LDR R0,[base,#4]!'. Write back hence allows the easy creation and access of arrays.DATA�LDM: Load Multiple Registers
#background wimp 1
#wrap off
Syntax: LDM \<options\> \<base\> \{!\}, \<register\_list\>
Operation: Multiple transfer of data from the registers to memory
#wrap nojoin
#line
The register_list is the series of register names, separated by commas, the contents of which we want to load from memory. The order of the registers in the list is of no significance, and any number of registers can be loaded. The assembler will allow a range of registers to be specified by using a '-' character.
The base field must be given as a simple register. The contents of this are taken to be the start address in memory from which the registers are to be loaded.
The <options=>M_opts> field is a two-character code which defines how the instruction should be executed.
#line
As the ARM executes the instruction, it will load consecutive memory words into each of the registers named in register_list. A copy of the address in the base register is used and modified by the ARM as each register is stored. The actual contents of the base are not changed, unless we request this using the <write back=>M_wb> option.
#line
Taken at its simplest level, LDM can be used to restore the contents of a register group previously stored with an <STM> instruction, containing the same memory address and register_list. However, a major use of <STM> and LDM is in the creation and access of <stacks>.DATA�STM: Store Multiple Registers
#background wimp 1
#wrap off
Syntax: STM \<options\> \<base\> \{!\}, \<register\_list\>
Operation: Multiple transfer of data from the registers to memory
#wrap nojoin
#line
The register_list is the series of register names, separated by commas, the contents of which we want to store in memory. The order of the registers in the list is of no significance, and any number of registers can be stored. The assembler will allow a range of registers to be specified by using a '-' character.
The base field must be given as a simple register. The contents of this are taken to be the start address in memory from which the registers are to be saved.
The <options=>M_opts> field is a two-character code which defines how the instruction should be executed.
#line
As the ARM executes the instruction, it will store the contents of each of the registers named in register_list in consecutive memory words. A copy of the address in the base register is used and modified by the ARM as each register is stored. The actual contents of the base are not changed, unless we request this using the <write back=>M_wb> option.
#line
Taken at its simplest level, STM can be used to preserve the contents of a register group in an arbitrary block of memory. The original contents can then be restored at a later time using <LDM> with the same memory address and register_list. However, a major use of STM and <LDM> is in the creation and access of <stacks>.DATA�STM & LDM options
#background wimp 1
#wrap on
*Direction of Storage*
The storage / loading direction used by the instruction is controlled by the first character in the option field. This may be either of the following:
#wrap off
#indent 2
I	Increment address after storing / loading each register
D	Decrement address after storing / loading each register
#indent
#wrap on
If an incrementing address is specified, then registers will be stored in / loaded from locations: 'base', 'base+4', 'base+8', etc. The reverse will occur with a decrementing address.
#line
*Pre or Post Address Modification*
The second letter in the option field specifies whether the address is to be modified before or after each register is stored / loaded. The following options can be used:
#wrap off
#indent 2
A	Modify address after storing / loading each register
B	Modify address before storing / loading each register
#indent
#wrap nojoin
If the address is modified after storing / loading each register, then the first register will be stored / loaded at the address in base, and the second at (base+4) or (base-4), depending on the increment / decrement option.
If the address is modified before storing / loading each register, then the first address will be stored / loaded at the address in (base+4) or (base-4), again depending on the increment / decrement option. The second register will be stored / loaded at (base+8) or (base-8), etc.DATA�Write back with STM & LDM
#background wimp 1
As the ARM stores or loads registers, it modifies the address being used. This ensures that the next register processed is stored or loaded in a consecutive word of memory, so that one word is not used twice. If we specify that we want write back, then the final address, obtained after storing or loading all the registers in the list, will be written back into the base register.
#line
Write back is selected, as with <STR> and <LDR>, by including a '!' character. Thus, the following instructions all have write back selected:
#wrap off
#indent 2
STMIA	R0!,\{R1,R2\}
STMDA	(base)!,\{R4,R5-R9\}
LDMIB	R6!,\{R12,R11,R10\}
#indent
#wrap on
*NB*: Note the use of round brackets when the variable 'base' is used to refer to a register. This prevents the assembler interpreting the '!' as an indirection operator and causing an error.
#line
After each instruction, the ARM performs one of the following depending on the direction of storage used:
#wrap off
#indent 2
base = base + 4*n	(increment)
base = base - 4*n	(decrement)
#indent
#wrap on
Where 'n' is the number of registers stored by the instruction. Write back is provided so as to provide support the creation of <stacks> using the LDM / STM instructions.
DATA�Stacks
#background wimp 1
A stack is a data structure used to store the contents of registers for later use. A series of contiguous memory locations are set aside to hold the data. A pointer is used to record where the top of the stack is. When an item is added to the stack, we store it in the memory word pointed to by the stack pointer. We then increment the pointer to point to the next word.
When we remove an item from the stack, we first decrement the stack pointer and then access the memory word which it points to. The stack is therefore a 'last in, first out' (LIFO) structure.
#line
#wrap off
There are four possible stack structures, which are made of combinations of two variants.
#wrap nojoin
The first of these variants determines which direction the stack grows in. We can create stacks that grow upwards in memory as extra items are pushed on, and contract downwards as items are pulled off (ascending stack), or the opposite, where the stack grows downwards in memory as items are added, and contracts back up again as they are pulled off (descending stack).
When a stack is implemented, you must decide exactly what the stack pointer should point to. It could point to the top entry on the stack, i.e., the one most recently pushed on the stack ('full'), or alernatively, it may point to the next available space in the stack's memory area, i.e., the address a which a new item would be stored if it were pushed onto the stack ('empty').
Hence the four stack structures are:
#wrap off
#indent 2
(1)	Full, ascending stack
(2)	Full, descending stack
(3)	Empty, ascending stack	    *Most useful*
(4)	Empty, descending stack
#indent
#wrap nojoin
#line
The <LDM> and <STM> instructions provide the facilities to implement stacks in machine code. The elements pushed to, and pulled from, the stack are the register contents specified in the instruction's register list.
The stack pointer is implemented using the instruction's base register. This always points to the address in memory where the instruction will store or load data. R13 is used most often for this purpose although any register could be used.
#line
#align centre
<Implementing stacks=>stacks2>DATAxImplementing stacks
#background wimp 1
#wrap nojoin
Initially, the stack pointer will be set to contain the base address of the stack's memory area. Write back can then be used with the <LDM> and <STM> instructions to make the ARM automaticallt update the stack pointer each time registers are pushed to the stack or pulled off it.
For an empty ascending stack, the following instructions are used:
#indent 2
Push registers
#indent 4
STMIA R13!,\{register_list\}
#indent
Pull registers
#indent 4
LDMDB R13!,\{register_list\}
#indent
#indent
*NB*: The use of write back is vital - without it the stack pointer will never be updated, and the stack will be corrupted.
#line
The options for the STM instruction are always reversed in the case of the LDM instruction. It can be confusing to have to translate the stack type used into the appropriate options, so the assembler provides an easier way.
We can simply specify the type of stack being used, which will be the same for both instructions:
#indent 2
FA	Full, ascending stack
FD	Full, descending stack
EA	Empty, ascending stack
ED	Empty, descending stack
#indent
The assembler will then choose appropriate options for the instruction.
The empty ascending stack could thus be implemented as follows:
#indent 2
Push registers
#indent 4
STMEA R13!,\{register_list\}
#indent
Pull registers
#indent 4
LDMEA R13!,\{register_list\}
#indent
#indentDATA�EQU: Storing Data
#background wimp 1
#wrap on
This pseudo opcode allows us to reserve given amounts of memory for storing text strings, data tables, variables, etc. It also allows us to define the contents of the memory reserved.
#line
The EQU opcodes provided are described below:
#wrap off
#tab
#indent 9
*Name*	*Function*
EQUB	Reserve one byte
EQUW	Reserve two bytes (one 'word')
EQUD	Reserve four bytes (double 'word')
EQUS	Reserve string (zero to 255 characters)
#indent
#wrap nojoin
When one of these directives is assembled, the argument following it is evaluated and the result is stored in memory. The value of <P%> is then incremented by the appropriate amount.
All strings stored with EQUS should terminate with a zero byte.DATAL%: Upper Limit for Range Check
#background wimp 1
#wrap on
The contents of this integer variable tell the assembler where the upper memory limit for the object code is. If range checking is specified in the <OPT> code, an error message will be sent if this limit is reached.DATAOPT
#background wimp 1
#wrap on
This pseudo opcode does not produce any machine code, but directs the assembler to perform a number of functions, which are described in the following table:
#wrap off
#align centre
#indent 17
#tab
	*Range*	*Offset*	*Errors*	*Listing*
	*Check*	*Assembly*	*Reported*	*Produced*
OPT 0	No	No	No	No
OPT 1	No	No	No	Yes
OPT 2	No	No	Yes	No
OPT 3	No	No	Yes	Yes
OPT 4	No	Yes	No	No
OPT 5	No	Yes	No	Yes
OPT 6	No	Yes	Yes	No
OPT 7	No	Yes	Yes	Yes
OPT 8	Yes	No	No	No
OPT 9	Yes	No	No	Yes
OPT 10	Yes	No	Yes	No
OPT 11	Yes	No	Yes	Yes
OPT 12	Yes	Yes	No	No
OPT 13	Yes	Yes	No	Yes
OPT 14	Yes	Yes	Yes	No
OPT 15	Yes	Yes	Yes	Yes
#tab
#indent
#align centre
(The default value is 3)
#align
#line
#wrap on
When a program written in assembly language is assembled, it should be done twice - once with OPT 0 (or OPT 8), then again with OPT 3 (or OPT 11). This allows the assembler to 'see' all the labels before it actually assembles the program. The two-pass system can easily be implemented with a FOR...NEXT loop.
#line
Range checking allows the user to inform the assembler of the upper boundary of the memory reserved for its object code. It will then issue a warning and abort if this limit is reached. The integer variable <L%> should contain the upper memory limit.DATAWP%: Assembler Location Counter
#background wimp 1
#wrap on
The contents of this integer variable tell the assembler the address at which we want the machine code program to start. At any given time, P% will always hold the address in memory where the next instruction will be written to.
#line
#align centre
<Reserving memory=>Reserve>DATA0Reserving memory for assembly programs
#background wimp 1
#wrap on
The BASIC assembler makes no checks on the value of <P%> to determine whether or not the memory which it points to is 'safe' to use. The simplest way to reserve a safe area of memory is to use a special form of the DIM statement:
#wrap off
#indent 2
DIM \<variable\> \<number\>
#indent
#wrap nojoin
'Variable' is any numeric variable, and 'number' is the number of bytes of memory to be reserved. For example, 'DIM code 1024' will reserve 1024 bytes of memory, and will set the variable 'code' to point to the first of these bytes. The address returned is also guaranteed to be word-aligned.
We can now tell the assembler to use the reserved area of memory, for storing machine code in, by the simple instruction:
#indent 2
P% = code
#indentDATA�ADR
#background wimp 1
#wrap on
It is often very useful to be able to get the actual address associated with a label into one of the processor registers. For example, the label could mark the beginning of a data table in a program. For this we would need to have this address in a register to access entries in the table. ADR can be used for this purpose.
#line
#wrap off
Syntax: ADR \<register\>, \<label\>
#wrap on
'Register' is the name of the register which is to contain the address of the label.DATA_ALIGN
#background wimp 1
#wrap on
This pseudo opcode does not produce any machine code, but directs the assembler to check the value of <P%> to check whether the address it contains is word-aligned. If not, P% is rounded up to the next word boundary.
#line
P% is often not word-aligned after <EQUB=>EQU>, <EQUW=>EQU> or <EQUS=>EQU> directives.DATAPassing data from BASIC to the assembler
#background wimp 1
#wrap nojoin
It is often necessary to pass data from a BASIC program to amachine code routine. The <CALL> statement has some advanced extensions for this purpose - however, this is complicated. Up to eight 32-bit integers can be passed to the assembler very easily, simply by placing them into the integer variables A% to H%.
Just before transferring control to a machine code routine, BASIC copies the values of the integer variables into the processor registers R0 to R7.DATA�Returning data to BASIC
#background wimp 1
#wrap nojoin
If we want to pass an integer variable back from a machine code routine to BASIC, then we can use the USR statement:
#wrap off
#indent 2
\<variable\> = USR( \<address\> )
#indent
#line
#wrap on
This is similar to <CALL> because it causes BASIC to execute a machine code routine at a specified address. However, when BASIC is returned to, USR returns the contents of R0 into 'variable'.DATA�Pipeline suspend
#background wimp 1
#wrap on
The 'P' suffix disables pipelining to allow writing to R15. The result of the operand (usually TEQ) is written back *directly* to the status bits (26-31) of R15.FREE@���� The Link Register
#background wimp 1
#wrap nojoin
TFREE0�� Program Counter & Status Register
#background wimp 1
#wrap on
Register R15 is a special purpose register dedicated to maintaining the ARM's program counter, status flags and mode flags.

#Fcode; wrap off
Bit: 31 30 29 28 27 26 25		  2  1  0
R15:  N  Z  C  V  I  F ...Program Counter... S1 S0FREE � Program Counter & Status Register
#background wimp 1
#wrap on
Register R15 is a special purpose register dedicated to maintaining the ARM's program counter, status flags and mode flags.
Bit: 31 30 29 28 27 26 25		  2  1  0
R15:  N  Z  C  V  I  F ...Program Counter... S1 S0DATAXCALL
#background wimp 1
#wrap off
Syntax: CALL \<address\> \{,\<parameters\>\}
Operation: Initiates machine code routine at given address
#wrap on
#line
The optional parameters are a list a comma-separated BASIC variables, the values of which are to be made available to the machine code routine. So, in addition to setting up registers R0 to R8 from the integer variables, CALL also sets up the following two registers:
#wrap off
#indent 2
R9:	Pointer to parameters descriptor block
R10:	Number of parameters passed using CALL
#indent
#wrap nojoin
Register R9 points to the memory block where a parameter list has been created. This list has a two-word entry in it for each variable in the parameter list. An important point to note is that the entries in the parameter block are set up in reverse order.
The first word of each entry is a pointer to the address where the variable itself is stored. The second word contains a number which represents the type of variable passed. The table below lists the different type numbers:
#wrap off
#indent 12
#tab
*Type*	*Object address*	*Examples of possible*
*number*	*points to*	*BASIC variables*
0	Single byte number	?var
4	Four-byte integer	!var, var%, var%(n)
5	Real number (5 bytes)	var, var(n)
128	String information block	var$, var$(n)
129	Terminated character string	$var
256+4	Integer array block	var%()
256+5	Real array block	var()
256+128	String array block	var$()
#tab
#indent
#wrap nojoin
*NB*: The values of variables are not guaranteed to be stored at word-aligned addresses.
In the case of parameter types 4, 5, and 129 their address points to the variable value. In other cases the address points to another information block about the corresponding variable.
For BASIC string variables (type 128) the address in the parameter block points to a string information block. This block is guaranteed to exist at a word-aligned address and has the following format:
#indent 2
Bytes 0-3	Pointer to the characters contained in the string
Byte 4		Current number of characters in the string
#indent
Variables of type 256+ refer to arrays and require a more complicated system.DATAzCredits and Copyright
#background wimp 1
#wrap nojoin
This manual is an updated version of the 'Assembly' manual, previously supplied with !StrongHelp, by Guttorm Vik. The information was obtained from 'Archimedes Assembly Language' (2nd ed.) by Mike Ginns.
#line
#align centre
*Updated by Jasper the Apricot*
m.d.field@warwick.ac.uk
http://www.csv.warwick.ac.uk/~lsuqf
DATAqR14: The Link Register
#background wimp 1
#wrap nojoin
The link register is used to provide a degree of support for implementing subroutines in machine code. R14 is used to store the address the program returns to once a subroutine has finished.

R14 is used each time the <BL> instruction is carried out. At other times it is unused and is free for normal use.DATA>R15: Program Counter & Status Register
#background wimp 1
#wrap on
Register R15 is a special purpose register dedicated to maintaining the ARM's program counter, status flags and mode flags.

#Fcode; wrap off
Bit: 31 30 29 28 27 26         .....          1  0
R15:  N  Z  C  V  I  F ...Program Counter... S1 S0
00000000  48 45 4c 50 28 00 00 00  c9 00 00 00 60 9c 00 00  |HELP(.......`...|
00000010  2c 00 00 00 00 fd ff ff  00 00 00 00 44 06 00 00  |,...........D...|
00000020  00 01 00 00 00 00 00 00  24 00 00 00 44 49 52 24  |........$...DIR$|
00000030  4c 06 00 00 4c 06 00 00  78 06 00 00 46 ff ff ff  |L...L...x...F...|
00000040  70 2d 9f d0 21 04 00 00  13 00 00 00 00 00 00 00  |p-..!...........|
00000050  21 52 6f 6f 74 00 00 00  9c 0a 00 00 46 ff ff ff  |!Root.......F...|
00000060  33 da 2c 82 d6 03 00 00  13 00 00 00 00 00 00 00  |3.,.............|
00000070  63 6f 6e 64 00 00 00 00  74 0e 00 00 46 ff ff ff  |cond....t...F...|
00000080  3d ec a9 79 e1 00 00 00  13 00 00 00 00 00 00 00  |=..y............|
00000090  4f 70 32 00 58 0f 00 00  46 ff ff ff ba c1 a9 79  |Op2.X...F......y|
000000a0  8a 00 00 00 13 00 00 00  00 00 00 00 52 64 00 00  |............Rd..|
000000b0  e4 0f 00 00 46 ff ff ff  5b c5 a9 79 9b 00 00 00  |....F...[..y....|
000000c0  13 00 00 00 00 00 00 00  52 6e 00 00 80 10 00 00  |........Rn......|
000000d0  46 ff ff ff 27 03 aa 79  db 00 00 00 13 00 00 00  |F...'..y........|
000000e0  00 00 00 00 53 00 00 00  5c 11 00 00 46 ff ff ff  |....S...\...F...|
000000f0  0f cd a9 79 c2 01 00 00  13 00 00 00 00 00 00 00  |...y............|
00000100  53 68 69 66 74 00 00 00  20 13 00 00 46 ff ff ff  |Shift... ...F...|
00000110  21 fe 1a 76 59 03 00 00  13 00 00 00 00 00 00 00  |!..vY...........|
00000120  41 44 43 00 7c 16 00 00  46 ff ff ff df 01 1b 76  |ADC.|...F......v|
00000130  0e 02 00 00 13 00 00 00  00 00 00 00 41 44 44 00  |............ADD.|
00000140  8c 18 00 00 46 ff ff ff  c4 21 1b 76 10 03 00 00  |....F....!.v....|
00000150  13 00 00 00 00 00 00 00  52 53 42 00 9c 1b 00 00  |........RSB.....|
00000160  46 ff ff ff af 6c 19 76  e7 02 00 00 13 00 00 00  |F....l.v........|
00000170  00 00 00 00 53 42 43 00  84 1e 00 00 46 ff ff ff  |....SBC.....F...|
00000180  9a 28 1b 76 fc 01 00 00  13 00 00 00 00 00 00 00  |.(.v............|
00000190  53 55 42 00 80 20 00 00  46 ff ff ff a0 24 1b 76  |SUB.. ..F....$.v|
000001a0  bd 02 00 00 13 00 00 00  00 00 00 00 52 53 43 00  |............RSC.|
000001b0  40 23 00 00 46 ff ff ff  bd 17 1b 76 4e 02 00 00  |@#..F......vN...|
000001c0  13 00 00 00 00 00 00 00  4d 4f 56 00 90 25 00 00  |........MOV..%..|
000001d0  46 ff ff ff ba 1a 1b 76  a6 02 00 00 13 00 00 00  |F......v........|
000001e0  00 00 00 00 4d 56 4e 00  38 28 00 00 46 ff ff ff  |....MVN.8(..F...|
000001f0  c6 49 19 76 b8 03 00 00  13 00 00 00 00 00 00 00  |.I.v............|
00000200  43 4d 50 00 f0 2b 00 00  46 ff ff ff cc 0e 1b 76  |CMP..+..F......v|
00000210  18 03 00 00 13 00 00 00  00 00 00 00 43 4d 4e 00  |............CMN.|
00000220  08 2f 00 00 46 ff ff ff  40 05 1b 76 17 02 00 00  |./..F...@..v....|
00000230  13 00 00 00 00 00 00 00  41 4e 44 00 20 31 00 00  |........AND. 1..|
00000240  46 ff ff ff 80 14 1b 76  44 02 00 00 13 00 00 00  |F......vD.......|
00000250  00 00 00 00 45 4f 52 00  64 33 00 00 46 ff ff ff  |....EOR.d3..F...|
00000260  1f 1e 1b 76 72 02 00 00  13 00 00 00 00 00 00 00  |...vr...........|
00000270  4f 52 52 00 d8 35 00 00  46 ff ff ff 63 0b 1b 76  |ORR..5..F...c..v|
00000280  8a 03 00 00 13 00 00 00  00 00 00 00 42 49 43 00  |............BIC.|
00000290  64 39 00 00 46 ff ff ff  d2 f9 1a 76 6f 03 00 00  |d9..F......vo...|
000002a0  13 00 00 00 00 00 00 00  54 53 54 00 d4 3c 00 00  |........TST..<..|
000002b0  46 ff ff ff d4 c3 1b 76  02 03 00 00 13 00 00 00  |F......v........|
000002c0  00 00 00 00 54 45 51 00  d8 3f 00 00 46 ff ff ff  |....TEQ..?..F...|
000002d0  85 e0 1c 76 6b 03 00 00  13 00 00 00 00 00 00 00  |...vk...........|
000002e0  4d 4c 41 00 44 43 00 00  46 ff ff ff df 04 1d 76  |MLA.DC..F......v|
000002f0  c0 02 00 00 13 00 00 00  00 00 00 00 4d 55 4c 00  |............MUL.|
00000300  04 46 00 00 46 ff ff ff  be b9 1d 76 b3 02 00 00  |.F..F......v....|
00000310  13 00 00 00 00 00 00 00  53 57 49 00 b8 48 00 00  |........SWI..H..|
00000320  46 ff ff ff 51 59 93 76  47 02 00 00 13 00 00 00  |F...QY.vG.......|
00000330  00 00 00 00 42 00 00 00  00 4b 00 00 46 ff ff ff  |....B....K..F...|
00000340  b8 87 c2 79 b6 04 00 00  13 00 00 00 00 00 00 00  |...y............|
00000350  42 4c 00 00 b8 4f 00 00  46 ff ff ff aa 8c b0 79  |BL...O..F......y|
00000360  fd 01 00 00 13 00 00 00  00 00 00 00 4c 44 52 00  |............LDR.|
00000370  b8 51 00 00 46 ff ff ff  1d 9a b0 79 05 02 00 00  |.Q..F......y....|
00000380  13 00 00 00 00 00 00 00  53 54 52 00 c0 53 00 00  |........STR..S..|
00000390  46 ff ff ff 40 56 b0 79  36 01 00 00 13 00 00 00  |F...@V.y6.......|
000003a0  00 00 00 00 42 79 74 65  00 00 00 00 f8 54 00 00  |....Byte.....T..|
000003b0  46 ff ff ff 30 3f b1 79  c3 02 00 00 13 00 00 00  |F...0?.y........|
000003c0  00 00 00 00 50 43 5f 72  65 6c 00 00 bc 57 00 00  |....PC_rel...W..|
000003d0  46 ff ff ff 64 bf af 79  63 03 00 00 13 00 00 00  |F...d..yc.......|
000003e0  00 00 00 00 50 6f 73 74  00 00 00 00 20 5b 00 00  |....Post.... [..|
000003f0  46 ff ff ff f6 62 ab 79  21 03 00 00 13 00 00 00  |F....b.y!.......|
00000400  00 00 00 00 50 72 65 00  44 5e 00 00 46 ff ff ff  |....Pre.D^..F...|
00000410  09 1c af 79 52 04 00 00  13 00 00 00 00 00 00 00  |...yR...........|
00000420  77 62 00 00 98 62 00 00  46 ff ff ff 34 48 bc 79  |wb...b..F...4H.y|
00000430  81 05 00 00 13 00 00 00  00 00 00 00 4c 44 4d 00  |............LDM.|
00000440  1c 68 00 00 46 ff ff ff  4f 43 bc 79 c5 05 00 00  |.h..F...OC.y....|
00000450  13 00 00 00 00 00 00 00  53 54 4d 00 e4 6d 00 00  |........STM..m..|
00000460  46 ff ff ff 58 2f bc 79  9a 05 00 00 13 00 00 00  |F...X/.y........|
00000470  00 00 00 00 4d 5f 6f 70  74 73 00 00 80 73 00 00  |....M_opts...s..|
00000480  46 ff ff ff c9 a3 bd 79  f1 04 00 00 13 00 00 00  |F......y........|
00000490  00 00 00 00 4d 5f 77 62  00 00 00 00 74 78 00 00  |....M_wb....tx..|
000004a0  46 ff ff ff 88 1c c0 79  86 08 00 00 13 00 00 00  |F......y........|
000004b0  00 00 00 00 73 74 61 63  6b 73 00 00 fc 80 00 00  |....stacks......|
000004c0  46 ff ff ff a7 76 c1 79  78 05 00 00 13 00 00 00  |F....v.yx.......|
000004d0  00 00 00 00 73 74 61 63  6b 73 32 00 74 86 00 00  |....stacks2.t...|
000004e0  46 ff ff ff 51 96 e4 79  e7 02 00 00 13 00 00 00  |F...Q..y........|
000004f0  00 00 00 00 45 51 55 00  5c 89 00 00 46 ff ff ff  |....EQU.\...F...|
00000500  fa 78 e5 79 1b 01 00 00  13 00 00 00 00 00 00 00  |.x.y............|
00000510  4c 25 00 00 78 8a 00 00  46 ff ff ff 23 f4 e4 79  |L%..x...F...#..y|
00000520  02 05 00 00 13 00 00 00  00 00 00 00 4f 50 54 00  |............OPT.|
00000530  7c 8f 00 00 46 ff ff ff  03 54 e5 79 57 01 00 00  ||...F....T.yW...|
00000540  13 00 00 00 00 00 00 00  50 25 00 00 d4 90 00 00  |........P%......|
00000550  46 ff ff ff 43 09 e6 79  30 03 00 00 13 00 00 00  |F...C..y0.......|
00000560  00 00 00 00 52 65 73 65  72 76 65 00 04 94 00 00  |....Reserve.....|
00000570  46 ff ff ff 80 29 3c 7a  fd 01 00 00 13 00 00 00  |F....)<z........|
00000580  00 00 00 00 41 44 52 00  04 96 00 00 46 ff ff ff  |....ADR.....F...|
00000590  e4 62 3b 7a 5f 01 00 00  13 00 00 00 00 00 00 00  |.b;z_...........|
000005a0  41 4c 49 47 4e 00 00 00  64 97 00 00 46 ff ff ff  |ALIGN...d...F...|
000005b0  28 b6 3c 7a 1d 02 00 00  13 00 00 00 00 00 00 00  |(.<z............|
000005c0  50 61 73 73 42 5f 4d 00  84 99 00 00 46 ff ff ff  |PassB_M.....F...|
000005d0  c4 1b 3d 7a c1 01 00 00  13 00 00 00 00 00 00 00  |..=z............|
000005e0  75 73 72 00 48 9b 00 00  46 ff ff ff dd 4e 5b 7a  |usr.H...F....N[z|
000005f0  d6 00 00 00 13 00 00 00  00 00 00 00 50 00 00 00  |............P...|
00000600  84 a8 00 00 47 ff ff ff  a7 4c 66 03 71 01 00 00  |....G....Lf.q...|
00000610  13 00 00 00 00 00 00 00  52 31 34 00 f8 a9 00 00  |........R14.....|
00000620  47 ff ff ff 5d 6c 66 03  3e 01 00 00 13 00 00 00  |G...]lf.>.......|
00000630  00 00 00 00 52 31 35 00  b0 9e 00 00 46 ff ff ff  |....R15.....F...|
00000640  2c ed 75 7d 58 08 00 00  13 00 00 00 00 00 00 00  |,.u}X...........|
00000650  43 41 4c 4c 00 00 00 00  08 a7 00 00 46 ff ff ff  |CALL........F...|
00000660  76 23 a0 d0 7a 01 00 00  13 00 00 00 00 00 00 00  |v#..z...........|
00000670  43 72 65 64 69 74 73 00  44 41 54 41 21 04 00 00  |Credits.DATA!...|
00000680  41 73 73 65 6d 62 6c 79  0a 23 62 61 63 6b 67 72  |Assembly.#backgr|
00000690  6f 75 6e 64 20 77 69 6d  70 20 31 0a 23 77 72 61  |ound wimp 1.#wra|
000006a0  70 20 6f 66 66 0a 23 61  6c 69 67 6e 20 63 65 6e  |p off.#align cen|
000006b0  74 72 65 0a 2a 41 52 4d  20 49 6e 73 74 72 75 63  |tre.*ARM Instruc|
000006c0  74 69 6f 6e 73 2a 0a 23  61 6c 69 67 6e 0a 23 74  |tions*.#align.#t|
000006d0  61 62 0a 3c 41 44 43 3e  09 41 64 64 20 77 69 74  |ab.<ADC>.Add wit|
000006e0  68 20 43 61 72 72 79 09  09 3c 4d 55 4c 3e 09 4d  |h Carry..<MUL>.M|
000006f0  75 6c 74 69 70 6c 79 0a  3c 41 44 44 3e 09 41 64  |ultiply.<ADD>.Ad|
00000700  64 09 09 09 3c 4d 56 4e  3e 09 4d 6f 76 65 20 4e  |d...<MVN>.Move N|
00000710  65 67 61 74 69 76 65 0a  3c 41 4e 44 3e 09 41 6e  |egative.<AND>.An|
00000720  64 09 09 09 3c 4f 52 52  3e 09 49 6e 63 6c 75 73  |d...<ORR>.Inclus|
00000730  69 76 65 20 4f 52 0a 3c  42 3e 09 42 72 61 6e 63  |ive OR.<B>.Branc|
00000740  68 09 09 09 3c 52 53 42  3e 09 52 65 76 65 72 73  |h...<RSB>.Revers|
00000750  65 20 53 75 62 74 72 61  63 74 0a 3c 42 49 43 3e  |e Subtract.<BIC>|
00000760  09 42 69 74 20 43 6c 65  61 72 09 09 3c 52 53 43  |.Bit Clear..<RSC|
00000770  3e 09 52 65 76 65 72 73  65 20 53 75 62 74 72 61  |>.Reverse Subtra|
00000780  63 74 20 77 69 74 68 20  43 61 72 72 79 0a 3c 42  |ct with Carry.<B|
00000790  4c 3e 09 42 72 61 6e 63  68 20 77 69 74 68 20 4c  |L>.Branch with L|
000007a0  69 6e 6b 09 3c 53 42 43  3e 09 53 75 62 74 72 61  |ink.<SBC>.Subtra|
000007b0  63 74 20 77 69 74 68 20  43 61 72 72 79 0a 3c 43  |ct with Carry.<C|
000007c0  4d 4e 3e 09 43 6f 6d 70  61 72 65 20 4e 65 67 61  |MN>.Compare Nega|
000007d0  74 69 76 65 09 3c 53 54  4d 3e 09 53 74 6f 72 65  |tive.<STM>.Store|
000007e0  20 4d 75 6c 74 69 70 6c  65 0a 3c 43 4d 50 3e 09  | Multiple.<CMP>.|
000007f0  43 6f 6d 70 61 72 65 09  09 09 3c 53 54 52 3e 09  |Compare...<STR>.|
00000800  53 74 6f 72 65 20 52 65  67 69 73 74 65 72 0a 3c  |Store Register.<|
00000810  45 4f 52 3e 09 45 78 63  6c 75 73 69 76 65 20 4f  |EOR>.Exclusive O|
00000820  52 09 09 3c 53 55 42 3e  09 53 75 62 74 72 61 63  |R..<SUB>.Subtrac|
00000830  74 0a 3c 4c 44 4d 3e 09  4c 6f 61 64 20 4d 75 6c  |t.<LDM>.Load Mul|
00000840  74 69 70 6c 65 09 09 3c  53 57 49 3e 09 53 6f 66  |tiple..<SWI>.Sof|
00000850  74 77 61 72 65 20 49 6e  74 65 72 72 75 70 74 0a  |tware Interrupt.|
00000860  3c 4c 44 52 3e 09 4c 6f  61 64 20 52 65 67 69 73  |<LDR>.Load Regis|
00000870  74 65 72 09 09 3c 54 45  51 3e 09 54 65 73 74 20  |ter..<TEQ>.Test |
00000880  66 6f 72 20 45 71 75 61  6c 69 74 79 0a 3c 4d 4c  |for Equality.<ML|
00000890  41 3e 09 4d 75 6c 74 69  70 6c 79 20 77 69 74 68  |A>.Multiply with|
000008a0  20 41 63 63 75 6d 75 6c  61 74 65 09 3c 54 53 54  | Accumulate.<TST|
000008b0  3e 09 54 65 73 74 20 4d  61 73 6b 65 64 09 0a 3c  |>.Test Masked..<|
000008c0  4d 4f 56 3e 09 4d 6f 76  65 09 09 09 0a 23 74 61  |MOV>.Move....#ta|
000008d0  62 0a 23 6c 69 6e 65 0a  23 61 6c 69 67 6e 20 63  |b.#line.#align c|
000008e0  65 6e 74 72 65 0a 2a 52  65 67 69 73 74 65 72 73  |entre.*Registers|
000008f0  2a 2c 20 2a 49 6e 74 65  67 65 72 20 56 61 72 69  |*, *Integer Vari|
00000900  61 62 6c 65 73 20 61 6e  64 20 53 75 66 66 69 78  |ables and Suffix|
00000910  65 73 2a 0a 3c 43 6f 6e  64 69 74 69 6f 6e 20 63  |es*.<Condition c|
00000920  6f 64 65 73 3d 3e 63 6f  6e 64 3e 20 20 20 20 3c  |odes=>cond>    <|
00000930  20 52 64 20 3e 20 20 20  20 3c 20 52 6e 20 3e 20  | Rd >    < Rn > |
00000940  20 20 20 3c 20 4f 70 32  20 3e 20 20 20 20 3c 52  |   < Op2 >    <R|
00000950  31 34 3e 20 20 20 20 3c  52 31 35 3e 0a 3c 50 25  |14>    <R15>.<P%|
00000960  3e 20 20 20 20 3c 4c 25  3e 20 20 20 20 3c 20 53  |>    <L%>    < S|
00000970  20 3e 20 20 20 20 3c 20  42 20 3d 3e 42 79 74 65  | >    < B =>Byte|
00000980  3e 20 20 20 20 3c 20 50  20 3e 0a 23 6c 69 6e 65  |>    < P >.#line|
00000990  0a 2a 50 73 65 75 64 6f  20 6f 70 63 6f 64 65 73  |.*Pseudo opcodes|
000009a0  2a 2c 20 2a 41 73 73 65  6d 62 6c 65 72 20 64 69  |*, *Assembler di|
000009b0  72 65 63 74 69 76 65 73  20 61 6e 64 20 43 41 4c  |rectives and CAL|
000009c0  4c 2a 0a 3c 4f 50 54 3e  20 20 20 20 3c 45 51 55  |L*.<OPT>    <EQU|
000009d0  3e 20 20 20 20 3c 41 4c  49 47 4e 3e 20 20 20 20  |>    <ALIGN>    |
000009e0  3c 41 44 52 3e 20 20 20  20 3c 43 41 4c 4c 3e 0a  |<ADR>    <CALL>.|
000009f0  23 6c 69 6e 65 0a 2a 4d  69 73 63 65 6c 6c 61 6e  |#line.*Miscellan|
00000a00  65 6f 75 73 2a 0a 3c 52  65 73 65 72 76 69 6e 67  |eous*.<Reserving|
00000a10  20 6d 65 6d 6f 72 79 3d  3e 52 65 73 65 72 76 65  | memory=>Reserve|
00000a20  3e 0a 3c 50 61 73 73 69  6e 67 20 64 61 74 61 20  |>.<Passing data |
00000a30  74 6f 20 6d 61 63 68 69  6e 65 20 63 6f 64 65 20  |to machine code |
00000a40  72 6f 75 74 69 6e 65 73  3d 3e 50 61 73 73 42 5f  |routines=>PassB_|
00000a50  4d 3e 0a 3c 52 65 74 75  72 6e 69 6e 67 20 64 61  |M>.<Returning da|
00000a60  74 61 20 74 6f 20 42 41  53 49 43 3d 3e 75 73 72  |ta to BASIC=>usr|
00000a70  3e 0a 23 6c 69 6e 65 0a  3c 43 72 65 64 69 74 73  |>.#line.<Credits|
00000a80  20 61 6e 64 20 43 6f 70  79 72 69 67 68 74 3d 3e  | and Copyright=>|
00000a90  43 72 65 64 69 74 73 3e  0a 00 00 00 44 41 54 41  |Credits>....DATA|
00000aa0  d6 03 00 00 43 6f 6e 64  69 74 69 6f 6e 20 63 6f  |....Condition co|
00000ab0  64 65 73 0a 23 62 61 63  6b 67 72 6f 75 6e 64 20  |des.#background |
00000ac0  77 69 6d 70 20 31 0a 41  6c 6c 20 69 6e 73 74 72  |wimp 1.All instr|
00000ad0  75 63 74 69 6f 6e 73 20  61 72 65 20 63 6f 6e 64  |uctions are cond|
00000ae0  69 74 69 6f 6e 61 6c 6c  79 20 65 78 65 63 75 74  |itionally execut|
00000af0  65 64 2e 20 49 66 20 74  68 65 20 63 6f 6e 64 69  |ed. If the condi|
00000b00  74 69 6f 6e 20 69 6e 20  74 68 65 20 74 6f 70 20  |tion in the top |
00000b10  66 6f 75 72 20 62 69 74  73 20 6f 66 20 74 68 65  |four bits of the|
00000b20  20 69 6e 73 74 72 75 63  74 69 6f 6e 20 69 73 20  | instruction is |
00000b30  6e 6f 74 20 6d 65 74 2c  20 74 68 65 6e 20 65 76  |not met, then ev|
00000b40  65 6e 20 69 6c 6c 65 67  61 6c 20 69 6e 73 74 72  |en illegal instr|
00000b50  75 63 74 69 6f 6e 73 20  77 69 6c 6c 20 68 61 76  |uctions will hav|
00000b60  65 20 6e 6f 20 65 66 66  65 63 74 2e 2e 2e 0a 0a  |e no effect.....|
00000b70  23 77 72 61 70 20 6f 66  66 3b 20 74 61 62 0a 43  |#wrap off; tab.C|
00000b80  6f 6e 64 69 74 69 6f 6e  20 66 69 65 6c 64 09 20  |ondition field. |
00000b90  09 20 09 45 78 65 63 75  74 65 20 49 46 0a 23 4c  |. .Execute IF.#L|
00000ba0  69 6e 65 0a 20 20 30 30  30 30 09 45 51 09 3a 09  |ine.  0000.EQ.:.|
00000bb0  20 5a 09 09 28 65 71 75  61 6c 29 0a 20 20 30 30  | Z..(equal).  00|
00000bc0  30 31 09 4e 45 09 3a 09  7e 5a 09 09 28 6e 6f 74  |01.NE.:.~Z..(not|
00000bd0  20 65 71 75 61 6c 29 0a  20 20 30 30 31 30 09 43  | equal).  0010.C|
00000be0  53 09 3a 09 20 43 09 09  28 75 6e 73 69 67 6e 65  |S.:. C..(unsigne|
00000bf0  64 20 68 69 67 68 65 72  20 6f 72 20 73 61 6d 65  |d higher or same|
00000c00  29 0a 20 20 30 30 31 31  09 43 43 09 3a 09 7e 43  |).  0011.CC.:.~C|
00000c10  09 09 28 75 6e 73 69 67  6e 65 64 20 6c 6f 77 65  |..(unsigned lowe|
00000c20  72 29 0a 20 20 30 31 30  30 09 4d 49 09 3a 09 20  |r).  0100.MI.:. |
00000c30  4e 09 09 28 6e 65 67 61  74 69 76 65 29 0a 20 20  |N..(negative).  |
00000c40  30 31 30 31 09 50 4c 09  3a 09 7e 4e 09 09 28 70  |0101.PL.:.~N..(p|
00000c50  6f 73 69 74 69 76 65 20  6f 72 20 7a 65 72 6f 29  |ositive or zero)|
00000c60  0a 20 20 30 31 31 30 09  56 53 09 3a 09 20 56 09  |.  0110.VS.:. V.|
00000c70  09 28 6f 76 65 72 66 6c  6f 77 29 0a 20 20 30 31  |.(overflow).  01|
00000c80  31 31 09 56 43 09 3a 09  7e 56 09 09 28 6e 6f 20  |11.VC.:.~V..(no |
00000c90  6f 76 65 72 66 6c 6f 77  29 0a 20 20 31 30 30 30  |overflow).  1000|
00000ca0  09 48 49 09 3a 09 20 43  20 61 6e 64 20 7e 5a 09  |.HI.:. C and ~Z.|
00000cb0  28 75 6e 73 69 67 6e 65  64 20 68 69 67 68 65 72  |(unsigned higher|
00000cc0  29 0a 20 20 31 30 30 31  09 4c 53 09 3a 09 7e 43  |).  1001.LS.:.~C|
00000cd0  20 6f 72 20 5a 09 09 28  75 6e 73 69 67 6e 65 64  | or Z..(unsigned|
00000ce0  20 6c 6f 77 65 72 20 6f  72 20 73 61 6d 65 29 0a  | lower or same).|
00000cf0  20 20 31 30 31 30 09 47  45 09 3a 09 20 4e 20 3d  |  1010.GE.:. N =|
00000d00  20 56 09 09 28 73 69 67  6e 65 64 20 68 69 67 68  | V..(signed high|
00000d10  65 72 20 6f 72 20 73 61  6d 65 29 0a 20 20 31 30  |er or same).  10|
00000d20  31 31 09 4c 54 09 3a 09  20 4e 20 5c 3c 5c 3e 20  |11.LT.:. N \<\> |
00000d30  56 09 28 73 69 67 6e 65  64 20 6c 6f 77 65 72 29  |V.(signed lower)|
00000d40  0a 20 20 31 31 30 30 09  47 54 09 3a 09 7e 5a 20  |.  1100.GT.:.~Z |
00000d50  61 6e 64 20 28 4e 20 3d  20 56 29 09 28 73 69 67  |and (N = V).(sig|
00000d60  6e 65 64 20 68 69 67 68  65 72 29 0a 20 20 31 31  |ned higher).  11|
00000d70  30 31 09 4c 45 09 3a 09  20 5a 20 6f 72 20 28 4e  |01.LE.:. Z or (N|
00000d80  20 5c 3c 5c 3e 20 56 29  09 28 73 69 67 6e 65 64  | \<\> V).(signed|
00000d90  20 6c 6f 77 65 72 20 6f  72 20 73 61 6d 65 29 0a  | lower or same).|
00000da0  20 20 31 31 31 30 09 41  4c 09 3a 09 20 31 09 09  |  1110.AL.:. 1..|
00000db0  28 61 6c 77 61 79 73 29  0a 20 20 31 31 31 31 09  |(always).  1111.|
00000dc0  4e 56 09 3a 09 20 30 09  09 28 6e 65 76 65 72 29  |NV.:. 0..(never)|
00000dd0  0a 23 74 61 62 3b 20 77  72 61 70 20 6e 6f 6a 6f  |.#tab; wrap nojo|
00000de0  69 6e 0a 0a 28 20 31 20  69 73 20 74 72 75 65 2c  |in..( 1 is true,|
00000df0  20 30 20 69 73 20 66 61  6c 73 65 2c 20 7e 20 69  | 0 is false, ~ i|
00000e00  73 20 4e 4f 54 20 29 0a  0a 4e 6f 74 65 3a 20 54  |s NOT )..Note: T|
00000e10  68 65 20 4e 56 20 63 6f  64 65 20 73 68 6f 75 6c  |he NV code shoul|
00000e20  64 6e 27 74 20 62 65 20  75 73 65 64 20 61 6e 79  |dn't be used any|
00000e30  6d 6f 72 65 2e 20 49 66  20 79 6f 75 20 77 61 6e  |more. If you wan|
00000e40  74 20 61 20 6e 6f 2d 6f  70 2c 20 79 6f 75 20 73  |t a no-op, you s|
00000e50  68 6f 75 6c 64 20 75 73  65 20 73 6f 6d 65 74 68  |hould use someth|
00000e60  69 6e 67 20 6c 69 6b 65  20 4d 4f 56 20 52 30 2c  |ing like MOV R0,|
00000e70  52 30 00 00 44 41 54 41  e1 00 00 00 4f 70 32 0a  |R0..DATA....Op2.|
00000e80  23 62 61 63 6b 67 72 6f  75 6e 64 20 77 69 6d 70  |#background wimp|
00000e90  20 31 0a 23 77 72 61 70  20 6f 66 66 0a 54 68 69  | 1.#wrap off.Thi|
00000ea0  73 20 63 61 6e 20 74 61  6b 65 20 73 65 76 65 72  |s can take sever|
00000eb0  61 6c 20 66 6f 72 6d 73  20 3a 0a 20 20 20 2d 09  |al forms :.   -.|
00000ec0  52 65 67 0a 20 20 20 2d  09 52 65 67 20 3c 73 68  |Reg.   -.Reg <sh|
00000ed0  69 66 74 3e 20 23 63 6f  6e 73 74 61 6e 74 0a 20  |ift> #constant. |
00000ee0  20 20 2d 09 52 65 67 20  3c 73 68 69 66 74 3e 20  |  -.Reg <shift> |
00000ef0  52 65 67 0a 09 28 4e 6f  74 65 3a 20 54 68 69 73  |Reg..(Note: This|
00000f00  20 74 61 6b 65 73 20 61  6e 20 65 78 74 72 61 20  | takes an extra |
00000f10  63 6c 6f 63 6b 20 63 79  63 6c 65 29 0a 20 20 20  |clock cycle).   |
00000f20  2d 09 23 63 6f 6e 73 74  61 6e 74 0a 09 28 20 6f  |-.#constant..( o|
00000f30  66 20 74 68 65 20 66 6f  72 6d 20 42 79 74 65 20  |f the form Byte |
00000f40  52 4f 52 20 6e 2a 32 2c  20 6e 20 69 73 20 30 2e  |ROR n*2, n is 0.|
00000f50  2e 31 35 20 29 00 00 00  44 41 54 41 8a 00 00 00  |.15 )...DATA....|
00000f60  52 64 0a 23 62 61 63 6b  67 72 6f 75 6e 64 20 77  |Rd.#background w|
00000f70  69 6d 70 20 31 0a 52 64  20 63 61 6e 20 62 65 20  |imp 1.Rd can be |
00000f80  61 6e 79 20 6f 66 20 74  68 65 20 72 65 67 69 73  |any of the regis|
00000f90  74 65 72 73 20 66 72 6f  6d 20 52 30 20 74 6f 20  |ters from R0 to |
00000fa0  52 31 35 2e 20 49 66 20  52 64 20 3d 20 52 31 35  |R15. If Rd = R15|
00000fb0  20 74 68 65 6e 20 6f 6e  6c 79 20 74 68 65 20 50  | then only the P|
00000fc0  43 20 62 69 74 73 20 77  69 6c 6c 20 62 65 20 73  |C bits will be s|
00000fd0  65 74 2c 20 6e 6f 74 20  74 68 65 20 66 6c 61 67  |et, not the flag|
00000fe0  73 2e 00 00 44 41 54 41  9b 00 00 00 52 6e 0a 23  |s...DATA....Rn.#|
00000ff0  62 61 63 6b 67 72 6f 75  6e 64 20 77 69 6d 70 20  |background wimp |
00001000  31 0a 52 6e 20 63 61 6e  20 62 65 20 61 6e 79 20  |1.Rn can be any |
00001010  6f 66 20 74 68 65 20 72  65 67 69 73 74 65 72 73  |of the registers|
00001020  20 66 72 6f 6d 20 52 30  20 74 6f 20 52 31 35 2e  | from R0 to R15.|
00001030  20 49 66 20 52 6e 20 3d  20 52 31 35 20 74 68 65  | If Rn = R15 the|
00001040  6e 20 6f 6e 6c 79 20 74  68 65 20 50 43 20 62 69  |n only the PC bi|
00001050  74 73 20 61 72 65 20 75  73 65 64 2e 20 54 68 65  |ts are used. The|
00001060  20 66 6c 61 67 20 62 69  74 73 20 77 69 6c 6c 20  | flag bits will |
00001070  61 70 70 65 61 72 20 63  6c 65 61 72 65 64 2e 00  |appear cleared..|
00001080  44 41 54 41 db 00 00 00  54 68 65 20 53 74 61 74  |DATA....The Stat|
00001090  75 73 20 66 6c 61 67 0a  23 62 61 63 6b 67 72 6f  |us flag.#backgro|
000010a0  75 6e 64 20 77 69 6d 70  20 31 0a 46 6c 61 67 73  |und wimp 1.Flags|
000010b0  20 77 69 6c 6c 20 6f 6e  6c 79 20 62 65 20 75 70  | will only be up|
000010c0  64 61 74 65 64 20 69 66  20 74 68 69 73 20 69 73  |dated if this is|
000010d0  20 70 72 65 73 65 6e 74  2e 20 54 68 65 20 53 20  | present. The S |
000010e0  66 6c 61 67 20 69 73 20  69 6d 70 6c 69 63 69 74  |flag is implicit|
000010f0  20 69 6e 20 43 4d 50 2c  20 43 4d 4e 2c 20 54 45  | in CMP, CMN, TE|
00001100  51 20 61 6e 64 20 54 53  54 0a 23 77 72 61 70 20  |Q and TST.#wrap |
00001110  6f 66 66 0a 0a 20 20 53  55 42 53 20 52 31 2c 52  |off..  SUBS R1,R|
00001120  31 2c 52 32 09 09 3b 0a  20 20 41 44 44 20 20 52  |1,R2..;.  ADD  R|
00001130  31 2c 52 31 2c 52 33 09  09 3b 20 0a 20 20 42 65  |1,R1,R3..; .  Be|
00001140  71 20 20 78 78 78 09 09  3b 20 6a 75 6d 70 20 69  |q  xxx..; jump i|
00001150  66 20 52 31 2d 52 32 20  3d 20 30 00 44 41 54 41  |f R1-R2 = 0.DATA|
00001160  c2 01 00 00 53 68 69 66  74 0a 23 62 61 63 6b 67  |....Shift.#backg|
00001170  72 6f 75 6e 64 20 77 69  6d 70 20 31 0a 54 68 65  |round wimp 1.The|
00001180  20 73 68 69 66 74 20 74  79 70 65 73 20 61 72 65  | shift types are|
00001190  20 3a 0a 20 20 4c 53 4c  09 4c 6f 67 69 63 61 6c  | :.  LSL.Logical|
000011a0  20 53 68 69 66 74 20 4c  65 66 74 20 28 2a 32 29  | Shift Left (*2)|
000011b0  0a 20 20 4c 53 52 09 4c  6f 67 69 63 61 6c 20 53  |.  LSR.Logical S|
000011c0  68 69 66 74 20 52 69 67  68 74 20 28 2f 32 29 0a  |hift Right (/2).|
000011d0  20 20 41 53 52 09 41 72  69 74 68 6d 65 74 69 63  |  ASR.Arithmetic|
000011e0  20 53 68 69 66 74 20 52  69 67 68 74 20 28 2f 32  | Shift Right (/2|
000011f0  29 0a 20 20 52 4f 52 09  52 4f 74 61 74 65 20 52  |).  ROR.ROtate R|
00001200  69 67 68 74 0a 20 20 52  52 58 09 52 6f 74 61 74  |ight.  RRX.Rotat|
00001210  65 20 52 69 67 68 74 20  65 58 74 65 6e 64 65 64  |e Right eXtended|
00001220  0a 0a 49 6e 20 61 6c 6c  20 63 61 73 65 73 2c 20  |..In all cases, |
00001230  74 68 65 20 62 69 74 20  6c 6f 73 74 20 66 72 6f  |the bit lost fro|
00001240  6d 20 74 68 65 20 65 6e  64 20 69 73 20 73 68 69  |m the end is shi|
00001250  66 74 65 64 20 69 6e 74  6f 20 74 68 65 20 63 61  |fted into the ca|
00001260  72 72 79 20 66 6c 61 67  2e 20 49 6e 20 41 53 52  |rry flag. In ASR|
00001270  2c 20 74 68 65 20 61 72  69 74 68 6d 65 74 69 63  |, the arithmetic|
00001280  20 73 69 67 6e 20 6f 66  20 74 68 65 20 6e 75 6d  | sign of the num|
00001290  62 65 72 20 69 73 20 70  72 65 73 65 72 76 65 64  |ber is preserved|
000012a0  20 28 2b 76 65 2f 2d 76  65 29 2e 20 49 6e 20 52  | (+ve/-ve). In R|
000012b0  4f 52 2c 20 74 68 65 20  62 69 74 20 6c 6f 73 74  |OR, the bit lost|
000012c0  20 69 73 20 61 6c 73 6f  20 63 6f 70 69 65 64 20  | is also copied |
000012d0  62 61 63 6b 20 74 6f 20  62 69 74 20 33 31 2e 20  |back to bit 31. |
000012e0  52 52 58 20 69 73 20 73  69 6d 69 6c 61 72 2c 20  |RRX is similar, |
000012f0  62 75 74 20 74 68 69 73  20 74 69 6d 65 20 74 68  |but this time th|
00001300  65 20 63 61 72 72 79 20  66 6c 61 67 20 61 63 74  |e carry flag act|
00001310  73 20 61 73 20 27 62 69  74 20 33 32 27 2e 00 00  |s as 'bit 32'...|
00001320  44 41 54 41 59 03 00 00  41 44 43 3a 20 41 64 64  |DATAY...ADC: Add|
00001330  20 77 69 74 68 20 43 61  72 72 79 0a 23 62 61 63  | with Carry.#bac|
00001340  6b 67 72 6f 75 6e 64 20  77 69 6d 70 20 31 0a 23  |kground wimp 1.#|
00001350  77 72 61 70 20 6f 66 66  0a 53 79 6e 74 61 78 3a  |wrap off.Syntax:|
00001360  20 41 44 43 20 5c 7b 5c  3c 73 75 66 66 69 78 5c  | ADC \{\<suffix\|
00001370  3e 5c 7d 20 5c 3c 64 65  73 74 69 6e 61 74 69 6f  |>\} \<destinatio|
00001380  6e 5c 3e 2c 20 5c 3c 6f  70 65 72 61 6e 64 31 5c  |n\>, \<operand1\|
00001390  3e 2c 20 5c 3c 6f 70 65  72 61 6e 64 32 5c 3e 0a  |>, \<operand2\>.|
000013a0  4f 70 65 72 61 74 69 6f  6e 3a 20 64 65 73 74 69  |Operation: desti|
000013b0  6e 61 74 69 6f 6e 20 3d  20 6f 70 65 72 61 6e 64  |nation = operand|
000013c0  20 6f 6e 65 20 2b 20 6f  70 65 72 61 6e 64 20 74  | one + operand t|
000013d0  77 6f 20 2b 20 63 61 72  72 79 0a 46 6c 61 67 73  |wo + carry.Flags|
000013e0  3a 20 4e 2c 5a 2c 43 2c  56 0a 23 77 72 61 70 20  |: N,Z,C,V.#wrap |
000013f0  6f 6e 0a 23 6c 69 6e 65  0a 54 68 69 73 20 6f 70  |on.#line.This op|
00001400  65 72 61 74 69 6f 6e 20  70 65 72 66 6f 72 6d 73  |eration performs|
00001410  20 74 68 65 20 61 72 69  74 68 6d 65 74 69 63 20  | the arithmetic |
00001420  61 64 64 69 74 69 6f 6e  20 6f 66 20 69 74 73 20  |addition of its |
00001430  74 77 6f 20 6f 70 65 72  61 6e 64 73 2c 20 61 6c  |two operands, al|
00001440  73 6f 20 61 64 64 69 6e  67 20 74 68 65 20 63 61  |so adding the ca|
00001450  72 72 79 20 66 6c 61 67  2e 20 49 66 20 73 65 74  |rry flag. If set|
00001460  2c 20 74 68 65 20 63 61  72 72 79 20 66 6c 61 67  |, the carry flag|
00001470  20 69 74 20 69 73 20 74  72 65 61 74 65 64 20 61  | it is treated a|
00001480  73 20 6f 6e 65 20 69 6e  20 74 68 65 20 61 64 64  |s one in the add|
00001490  69 74 69 6f 6e 2e 20 28  4f 74 68 65 72 77 69 73  |ition. (Otherwis|
000014a0  65 2c 20 61 73 20 7a 65  72 6f 29 2e 20 54 68 65  |e, as zero). The|
000014b0  20 72 65 73 75 6c 74 20  69 73 20 73 74 6f 72 65  | result is store|
000014c0  64 20 69 6e 20 74 68 65  20 64 65 73 74 69 6e 61  |d in the destina|
000014d0  74 69 6f 6e 20 72 65 67  69 73 74 65 72 2e 0a 23  |tion register..#|
000014e0  6c 69 6e 65 0a 41 44 43  20 61 6c 6c 6f 77 73 20  |line.ADC allows |
000014f0  75 73 20 74 6f 20 61 64  64 20 74 6f 67 65 74 68  |us to add togeth|
00001500  65 72 20 6e 75 6d 62 65  72 73 20 77 68 69 63 68  |er numbers which|
00001510  20 72 65 71 75 69 72 65  20 6d 6f 72 65 20 74 68  | require more th|
00001520  61 6e 20 61 20 73 69 6e  67 6c 65 20 77 6f 72 64  |an a single word|
00001530  20 74 6f 20 72 65 70 72  65 73 65 6e 74 20 74 68  | to represent th|
00001540  65 6d 2e 20 65 2e 67 2e  0a 23 74 61 62 0a 23 69  |em. e.g..#tab.#i|
00001550  6e 64 65 6e 74 20 32 0a  41 44 44 53 20 72 65 73  |ndent 2.ADDS res|
00001560  75 6c 74 5f 6c 6f 77 2c  20 6c 6f 77 31 2c 20 6c  |ult_low, low1, l|
00001570  6f 77 32 09 41 64 64 20  6c 6f 77 20 77 6f 72 64  |ow2.Add low word|
00001580  73 0a 41 44 43 53 20 72  65 73 75 6c 74 5f 68 69  |s.ADCS result_hi|
00001590  67 68 2c 20 68 69 67 68  31 2c 20 68 69 67 68 32  |gh, high1, high2|
000015a0  09 41 64 64 20 68 69 67  68 20 77 6f 72 64 73 20  |.Add high words |
000015b0  2b 20 63 61 72 72 79 0a  23 69 6e 64 65 6e 74 0a  |+ carry.#indent.|
000015c0  23 74 61 62 0a 2a 4e 6f  74 65 2a 3a 20 49 74 20  |#tab.*Note*: It |
000015d0  69 73 20 76 69 74 61 6c  20 74 68 61 74 20 74 68  |is vital that th|
000015e0  65 20 53 20 73 75 66 66  69 78 20 69 73 20 75 73  |e S suffix is us|
000015f0  65 64 20 77 69 74 68 20  74 68 65 73 65 20 69 6e  |ed with these in|
00001600  73 74 72 75 63 74 69 6f  6e 73 2c 20 6f 74 68 65  |structions, othe|
00001610  72 77 69 73 65 20 74 68  65 20 63 61 72 72 79 20  |rwise the carry |
00001620  66 6c 61 67 20 73 65 74  74 69 6e 67 20 77 69 6c  |flag setting wil|
00001630  6c 20 6e 6f 74 20 62 65  20 61 66 66 65 63 74 65  |l not be affecte|
00001640  64 20 61 6e 64 20 77 69  6c 6c 20 6e 6f 74 20 62  |d and will not b|
00001650  65 20 63 61 72 72 69 65  64 20 66 6f 72 77 61 72  |e carried forwar|
00001660  64 20 69 6e 74 6f 20 74  68 65 20 6e 65 78 74 20  |d into the next |
00001670  61 64 64 69 74 69 6f 6e  2e 00 00 00 44 41 54 41  |addition....DATA|
00001680  0e 02 00 00 41 44 44 3a  20 41 64 64 0a 23 62 61  |....ADD: Add.#ba|
00001690  63 6b 67 72 6f 75 6e 64  20 77 69 6d 70 20 31 0a  |ckground wimp 1.|
000016a0  23 77 72 61 70 20 6f 66  66 0a 53 79 6e 74 61 78  |#wrap off.Syntax|
000016b0  3a 20 41 44 44 20 5c 7b  5c 3c 73 75 66 66 69 78  |: ADD \{\<suffix|
000016c0  5c 3e 5c 7d 20 5c 3c 64  65 73 74 69 6e 61 74 69  |\>\} \<destinati|
000016d0  6f 6e 5c 3e 2c 20 5c 3c  6f 70 65 72 61 6e 64 31  |on\>, \<operand1|
000016e0  5c 3e 2c 20 5c 3c 6f 70  65 72 61 6e 64 32 5c 3e  |\>, \<operand2\>|
000016f0  0a 4f 70 65 72 61 74 69  6f 6e 3a 20 64 65 73 74  |.Operation: dest|
00001700  69 6e 61 74 69 6f 6e 20  3d 20 6f 70 65 72 61 6e  |ination = operan|
00001710  64 20 6f 6e 65 20 2b 20  6f 70 65 72 61 6e 64 20  |d one + operand |
00001720  74 77 6f 0a 46 6c 61 67  73 3a 20 4e 2c 5a 2c 43  |two.Flags: N,Z,C|
00001730  2c 56 0a 23 77 72 61 70  20 6f 6e 0a 23 6c 69 6e  |,V.#wrap on.#lin|
00001740  65 0a 54 68 69 73 20 69  6e 73 74 72 75 63 74 69  |e.This instructi|
00001750  6f 6e 20 70 65 72 66 6f  72 6d 73 20 74 68 65 20  |on performs the |
00001760  61 72 69 74 68 6d 65 74  69 63 20 61 64 64 69 74  |arithmetic addit|
00001770  69 6f 6e 20 6f 66 20 69  74 73 20 74 77 6f 20 6f  |ion of its two o|
00001780  70 65 72 61 6e 64 73 2c  20 61 6e 64 20 73 74 6f  |perands, and sto|
00001790  72 65 73 20 74 68 65 20  72 65 73 75 6c 74 20 69  |res the result i|
000017a0  6e 20 74 68 65 20 64 65  73 74 69 6e 61 74 69 6f  |n the destinatio|
000017b0  6e 20 72 65 67 69 73 74  65 72 2e 0a 23 6c 69 6e  |n register..#lin|
000017c0  65 0a 45 78 61 6d 70 6c  65 73 3a 0a 23 49 6e 64  |e.Examples:.#Ind|
000017d0  65 6e 74 20 32 0a 41 44  44 09 52 30 2c 52 33 2c  |ent 2.ADD.R0,R3,|
000017e0  52 34 09 52 30 20 3d 20  52 33 20 2b 20 52 34 0a  |R4.R0 = R3 + R4.|
000017f0  41 44 44 53 09 52 30 2c  52 33 2c 23 32 09 52 30  |ADDS.R0,R3,#2.R0|
00001800  20 3d 20 52 33 20 2b 20  32 20 28 53 65 74 74 69  | = R3 + 2 (Setti|
00001810  6e 67 20 73 74 61 74 75  73 20 66 6c 61 67 73 29  |ng status flags)|
00001820  0a 41 44 44 4d 49 09 52  30 2c 52 30 2c 23 31 09  |.ADDMI.R0,R0,#1.|
00001830  49 66 20 6d 69 6e 75 73  20 66 6c 61 67 20 73 65  |If minus flag se|
00001840  74 20 69 6e 63 72 65 6d  65 6e 74 20 52 30 20 62  |t increment R0 b|
00001850  79 20 31 0a 41 44 44 09  52 30 2c 52 30 2c 52 30  |y 1.ADD.R0,R0,R0|
00001860  2c 4c 53 4c 23 31 09 52  30 20 3d 20 52 30 20 2b  |,LSL#1.R0 = R0 +|
00001870  20 32 2a 52 30 20 20 28  52 30 20 3d 20 33 2a 52  | 2*R0  (R0 = 3*R|
00001880  30 29 0a 23 49 6e 64 65  6e 74 00 00 44 41 54 41  |0).#Indent..DATA|
00001890  10 03 00 00 52 53 42 3a  20 52 65 76 65 72 73 65  |....RSB: Reverse|
000018a0  20 53 75 62 74 72 61 63  74 0a 23 62 61 63 6b 67  | Subtract.#backg|
000018b0  72 6f 75 6e 64 20 77 69  6d 70 20 31 0a 23 77 72  |round wimp 1.#wr|
000018c0  61 70 20 6f 66 66 0a 53  79 6e 74 61 78 3a 20 52  |ap off.Syntax: R|
000018d0  53 42 20 5c 7b 5c 3c 73  75 66 66 69 78 5c 3e 5c  |SB \{\<suffix\>\|
000018e0  7d 20 5c 3c 64 65 73 74  69 6e 61 74 69 6f 6e 5c  |} \<destination\|
000018f0  3e 2c 20 5c 3c 6f 70 65  72 61 6e 64 31 5c 3e 2c  |>, \<operand1\>,|
00001900  20 5c 3c 6f 70 65 72 61  6e 64 32 5c 3e 0a 4f 70  | \<operand2\>.Op|
00001910  65 72 61 74 69 6f 6e 3a  20 64 65 73 74 69 6e 61  |eration: destina|
00001920  74 69 6f 6e 20 3d 20 6f  70 65 72 61 6e 64 20 74  |tion = operand t|
00001930  77 6f 20 2d 20 6f 70 65  72 61 6e 64 20 6f 6e 65  |wo - operand one|
00001940  0a 46 6c 61 67 73 3a 20  4e 2c 5a 2c 43 2c 56 0a  |.Flags: N,Z,C,V.|
00001950  23 77 72 61 70 20 6f 6e  0a 23 6c 69 6e 65 0a 54  |#wrap on.#line.T|
00001960  68 69 73 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |his instruction |
00001970  70 65 72 66 6f 72 6d 73  20 74 68 65 20 61 72 69  |performs the ari|
00001980  74 68 6d 65 74 69 63 20  73 75 62 74 72 61 63 74  |thmetic subtract|
00001990  69 6f 6e 20 6f 66 20 69  74 73 20 66 69 72 73 74  |ion of its first|
000019a0  20 6f 70 65 72 61 6e 64  20 66 72 6f 6d 20 69 74  | operand from it|
000019b0  73 20 73 65 63 6f 6e 64  20 6f 70 65 72 61 6e 64  |s second operand|
000019c0  2c 20 61 6e 64 20 73 74  6f 72 65 73 20 74 68 65  |, and stores the|
000019d0  20 72 65 73 75 6c 74 20  69 6e 20 74 68 65 20 64  | result in the d|
000019e0  65 73 74 69 6e 61 74 69  6f 6e 20 72 65 67 69 73  |estination regis|
000019f0  74 65 72 2e 20 49 74 20  69 73 20 76 65 72 79 20  |ter. It is very |
00001a00  73 69 6d 69 6c 61 72 20  74 6f 20 3c 53 55 42 3e  |similar to <SUB>|
00001a10  2e 0a 23 6c 69 6e 65 0a  54 68 69 73 20 69 73 20  |..#line.This is |
00001a20  6e 6f 74 20 61 20 77 61  73 74 65 20 6f 66 20 61  |not a waste of a|
00001a30  6e 20 69 6e 73 74 72 75  63 74 69 6f 6e 21 20 4f  |n instruction! O|
00001a40  70 65 72 61 6e 64 20 74  77 6f 20 63 61 6e 20 62  |perand two can b|
00001a50  65 20 73 70 65 63 69 66  69 65 64 20 69 6e 20 73  |e specified in s|
00001a60  65 76 65 72 61 6c 20 64  69 66 66 65 72 65 6e 74  |everal different|
00001a70  20 66 6f 72 6d 61 74 73  2c 20 61 6e 64 20 69 74  | formats, and it|
00001a80  20 69 73 20 74 68 75 73  20 6d 75 63 68 20 6d 6f  | is thus much mo|
00001a90  72 65 20 66 6c 65 78 69  62 6c 65 20 74 68 61 6e  |re flexible than|
00001aa0  20 6f 70 65 72 61 6e 64  20 6f 6e 65 2e 20 54 68  | operand one. Th|
00001ab0  65 20 52 53 42 20 69 6e  73 74 72 75 63 74 69 6f  |e RSB instructio|
00001ac0  6e 20 74 68 75 73 20 65  6e 73 75 72 65 73 20 74  |n thus ensures t|
00001ad0  68 61 74 20 65 69 74 68  65 72 20 6f 66 20 74 68  |hat either of th|
00001ae0  65 20 6f 70 65 72 61 6e  64 73 20 75 73 65 64 20  |e operands used |
00001af0  63 61 6e 20 62 65 20 73  70 65 63 69 66 69 65 64  |can be specified|
00001b00  20 75 73 69 6e 67 20 74  68 65 20 66 6c 65 78 69  | using the flexi|
00001b10  62 6c 65 20 66 6f 72 6d  61 74 20 61 6c 6c 6f 77  |ble format allow|
00001b20  65 64 20 62 79 20 6f 70  65 72 61 6e 64 20 74 77  |ed by operand tw|
00001b30  6f 2e 0a 23 6c 69 6e 65  0a 45 78 61 6d 70 6c 65  |o..#line.Example|
00001b40  73 3a 0a 23 49 6e 64 65  6e 74 20 32 0a 52 53 42  |s:.#Indent 2.RSB|
00001b50  09 52 30 2c 52 30 2c 23  30 09 52 30 20 3d 20 30  |.R0,R0,#0.R0 = 0|
00001b60  20 2d 20 52 30 20 28 52  30 20 3d 20 2d 52 30 29  | - R0 (R0 = -R0)|
00001b70  0a 52 53 42 09 52 36 2c  52 33 2c 52 37 2c 4c 53  |.RSB.R6,R3,R7,LS|
00001b80  4c 23 32 09 52 36 20 3d  20 28 52 37 2a 34 29 20  |L#2.R6 = (R7*4) |
00001b90  2d 20 52 33 0a 23 49 6e  64 65 6e 74 44 41 54 41  |- R3.#IndentDATA|
00001ba0  e7 02 00 00 53 42 43 3a  20 53 75 62 74 72 61 63  |....SBC: Subtrac|
00001bb0  74 20 77 69 74 68 20 43  61 72 72 79 0a 23 62 61  |t with Carry.#ba|
00001bc0  63 6b 67 72 6f 75 6e 64  20 77 69 6d 70 20 31 0a  |ckground wimp 1.|
00001bd0  23 77 72 61 70 20 6f 66  66 0a 53 79 6e 74 61 78  |#wrap off.Syntax|
00001be0  3a 20 53 42 43 20 5c 7b  5c 3c 73 75 66 66 69 78  |: SBC \{\<suffix|
00001bf0  5c 3e 5c 7d 20 5c 3c 64  65 73 74 69 6e 61 74 69  |\>\} \<destinati|
00001c00  6f 6e 5c 3e 2c 20 5c 3c  6f 70 65 72 61 6e 64 31  |on\>, \<operand1|
00001c10  5c 3e 2c 20 5c 3c 6f 70  65 72 61 6e 64 32 5c 3e  |\>, \<operand2\>|
00001c20  0a 4f 70 65 72 61 74 69  6f 6e 3a 20 64 65 73 74  |.Operation: dest|
00001c30  69 6e 61 74 69 6f 6e 20  3d 20 6f 70 65 72 61 6e  |ination = operan|
00001c40  64 20 6f 6e 65 20 2d 20  6f 70 65 72 61 6e 64 20  |d one - operand |
00001c50  74 77 6f 20 2d 20 6e 6f  74 20 28 63 61 72 72 79  |two - not (carry|
00001c60  29 0a 46 6c 61 67 73 3a  20 4e 2c 5a 2c 43 2c 56  |).Flags: N,Z,C,V|
00001c70  0a 23 77 72 61 70 20 6f  6e 0a 23 6c 69 6e 65 0a  |.#wrap on.#line.|
00001c80  54 68 69 73 20 6f 70 65  72 61 74 69 6f 6e 20 61  |This operation a|
00001c90  6c 6c 6f 77 73 20 6d 75  6c 74 69 2d 77 6f 72 64  |llows multi-word|
00001ca0  20 73 75 62 74 72 61 63  74 69 6f 6e 20 74 6f 20  | subtraction to |
00001cb0  62 65 20 70 65 72 66 6f  72 6d 65 64 20 69 6e 20  |be performed in |
00001cc0  74 68 65 20 73 61 6d 65  20 77 61 79 20 74 68 61  |the same way tha|
00001cd0  74 20 3c 41 44 43 3e 20  61 6c 6c 6f 77 73 20 6d  |t <ADC> allows m|
00001ce0  75 6c 74 69 2d 77 6f 72  64 20 61 64 64 69 74 69  |ulti-word additi|
00001cf0  6f 6e 2e 20 54 68 69 73  20 74 69 6d 65 20 74 68  |on. This time th|
00001d00  65 20 63 61 72 72 79 20  66 6c 61 67 20 69 73 20  |e carry flag is |
00001d10  75 73 65 64 20 74 6f 20  69 6e 64 69 63 61 74 65  |used to indicate|
00001d20  20 74 68 61 74 20 61 20  22 62 6f 72 72 6f 77 22  | that a "borrow"|
00001d30  20 6f 63 63 75 72 65 64  20 77 68 65 6e 20 73 75  | occured when su|
00001d40  62 74 72 61 63 74 69 6e  67 20 74 77 6f 20 77 6f  |btracting two wo|
00001d50  72 64 73 2e 0a 23 6c 69  6e 65 0a 53 42 43 20 63  |rds..#line.SBC c|
00001d60  61 6e 20 62 65 20 75 73  65 64 20 66 6f 72 20 6d  |an be used for m|
00001d70  75 6c 74 69 2d 77 6f 72  64 20 73 75 62 74 72 61  |ulti-word subtra|
00001d80  63 74 69 6f 6e 73 20 61  73 20 66 6f 6c 6c 6f 77  |ctions as follow|
00001d90  73 3a 0a 23 74 61 62 0a  23 69 6e 64 65 6e 74 20  |s:.#tab.#indent |
00001da0  32 0a 53 55 42 53 20 72  65 73 75 6c 74 5f 6c 6f  |2.SUBS result_lo|
00001db0  77 2c 20 6c 6f 77 31 2c  20 6c 6f 77 32 09 53 75  |w, low1, low2.Su|
00001dc0  62 74 72 61 63 74 20 6c  6f 77 20 77 6f 72 64 73  |btract low words|
00001dd0  0a 53 42 43 53 20 72 65  73 75 6c 74 5f 68 69 67  |.SBCS result_hig|
00001de0  68 2c 20 68 69 67 68 31  2c 20 68 69 67 68 32 09  |h, high1, high2.|
00001df0  53 75 62 74 72 61 63 74  20 68 69 67 68 20 77 6f  |Subtract high wo|
00001e00  72 64 73 20 2b 20 63 61  72 72 79 0a 23 69 6e 64  |rds + carry.#ind|
00001e10  65 6e 74 0a 23 74 61 62  0a 2a 4e 6f 74 65 2a 3a  |ent.#tab.*Note*:|
00001e20  20 49 74 20 69 73 20 76  69 74 61 6c 20 74 68 61  | It is vital tha|
00001e30  74 20 74 68 65 20 53 20  73 75 66 66 69 78 20 69  |t the S suffix i|
00001e40  73 20 75 73 65 64 20 74  6f 20 61 6c 6c 6f 77 20  |s used to allow |
00001e50  74 68 65 20 73 75 62 74  72 61 63 74 20 69 6e 73  |the subtract ins|
00001e60  74 72 75 63 74 69 6f 6e  73 20 74 6f 20 61 66 66  |tructions to aff|
00001e70  65 63 74 20 74 68 65 20  63 61 72 72 79 20 66 6c  |ect the carry fl|
00001e80  61 67 2e 00 44 41 54 41  fc 01 00 00 53 55 42 3a  |ag..DATA....SUB:|
00001e90  20 53 75 62 74 72 61 63  74 0a 23 62 61 63 6b 67  | Subtract.#backg|
00001ea0  72 6f 75 6e 64 20 77 69  6d 70 20 31 0a 23 77 72  |round wimp 1.#wr|
00001eb0  61 70 20 6f 66 66 0a 53  79 6e 74 61 78 3a 20 53  |ap off.Syntax: S|
00001ec0  55 42 20 5c 7b 5c 3c 73  75 66 66 69 78 5c 3e 5c  |UB \{\<suffix\>\|
00001ed0  7d 20 5c 3c 64 65 73 74  69 6e 61 74 69 6f 6e 5c  |} \<destination\|
00001ee0  3e 2c 20 5c 3c 6f 70 65  72 61 6e 64 31 5c 3e 2c  |>, \<operand1\>,|
00001ef0  20 5c 3c 6f 70 65 72 61  6e 64 32 5c 3e 0a 4f 70  | \<operand2\>.Op|
00001f00  65 72 61 74 69 6f 6e 3a  20 64 65 73 74 69 6e 61  |eration: destina|
00001f10  74 69 6f 6e 20 3d 20 6f  70 65 72 61 6e 64 20 6f  |tion = operand o|
00001f20  6e 65 20 2d 20 6f 70 65  72 61 6e 64 20 74 77 6f  |ne - operand two|
00001f30  0a 46 6c 61 67 73 3a 20  4e 2c 5a 2c 43 2c 56 0a  |.Flags: N,Z,C,V.|
00001f40  23 77 72 61 70 20 6f 6e  0a 23 6c 69 6e 65 0a 54  |#wrap on.#line.T|
00001f50  68 69 73 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |his instruction |
00001f60  70 65 72 66 6f 72 6d 73  20 74 68 65 20 61 72 69  |performs the ari|
00001f70  74 68 6d 65 74 69 63 20  73 75 62 74 72 61 63 74  |thmetic subtract|
00001f80  69 6f 6e 20 6f 66 20 69  74 73 20 73 65 63 6f 6e  |ion of its secon|
00001f90  64 20 6f 70 65 72 61 6e  64 20 66 72 6f 6d 20 69  |d operand from i|
00001fa0  74 73 20 66 69 72 73 74  20 6f 70 65 72 61 6e 64  |ts first operand|
00001fb0  2c 20 61 6e 64 20 73 74  6f 72 65 73 20 74 68 65  |, and stores the|
00001fc0  20 72 65 73 75 6c 74 20  69 6e 20 74 68 65 20 64  | result in the d|
00001fd0  65 73 74 69 6e 61 74 69  6f 6e 20 72 65 67 69 73  |estination regis|
00001fe0  74 65 72 2e 0a 23 6c 69  6e 65 0a 45 78 61 6d 70  |ter..#line.Examp|
00001ff0  6c 65 73 3a 0a 23 49 6e  64 65 6e 74 20 32 0a 53  |les:.#Indent 2.S|
00002000  55 42 09 52 31 30 2c 52  32 2c 52 34 09 52 31 30  |UB.R10,R2,R4.R10|
00002010  20 3d 20 52 32 20 2d 20  52 34 0a 53 55 42 4d 49  | = R2 - R4.SUBMI|
00002020  09 52 31 2c 52 33 2c 23  31 30 32 34 09 49 66 20  |.R1,R3,#1024.If |
00002030  6e 65 67 20 66 6c 61 67  20 73 65 74 20 52 31 20  |neg flag set R1 |
00002040  3d 20 52 33 20 2d 20 31  30 32 34 0a 53 55 42 09  |= R3 - 1024.SUB.|
00002050  52 30 2c 52 30 2c 52 30  2c 4c 53 4c 23 31 09 52  |R0,R0,R0,LSL#1.R|
00002060  30 20 3d 20 52 30 20 2d  20 32 2a 52 30 20 28 52  |0 = R0 - 2*R0 (R|
00002070  30 20 3d 20 2d 52 30 29  0a 23 49 6e 64 65 6e 74  |0 = -R0).#Indent|
00002080  44 41 54 41 bd 02 00 00  52 53 43 3a 20 52 65 76  |DATA....RSC: Rev|
00002090  65 72 73 65 20 53 75 62  74 72 61 63 74 20 77 69  |erse Subtract wi|
000020a0  74 68 20 43 61 72 72 79  0a 23 62 61 63 6b 67 72  |th Carry.#backgr|
000020b0  6f 75 6e 64 20 77 69 6d  70 20 31 0a 23 77 72 61  |ound wimp 1.#wra|
000020c0  70 20 6f 66 66 0a 53 79  6e 74 61 78 3a 20 52 53  |p off.Syntax: RS|
000020d0  43 20 5c 7b 5c 3c 73 75  66 66 69 78 5c 3e 5c 7d  |C \{\<suffix\>\}|
000020e0  20 5c 3c 64 65 73 74 69  6e 61 74 69 6f 6e 5c 3e  | \<destination\>|
000020f0  2c 20 5c 3c 6f 70 65 72  61 6e 64 31 5c 3e 2c 20  |, \<operand1\>, |
00002100  5c 3c 6f 70 65 72 61 6e  64 32 5c 3e 0a 4f 70 65  |\<operand2\>.Ope|
00002110  72 61 74 69 6f 6e 3a 20  64 65 73 74 69 6e 61 74  |ration: destinat|
00002120  69 6f 6e 20 3d 20 6f 70  65 72 61 6e 64 20 74 77  |ion = operand tw|
00002130  6f 20 2d 20 6f 70 65 72  61 6e 64 20 6f 6e 65 20  |o - operand one |
00002140  2d 20 6e 6f 74 20 28 63  61 72 72 79 29 0a 46 6c  |- not (carry).Fl|
00002150  61 67 73 3a 20 4e 2c 5a  2c 43 2c 56 0a 23 77 72  |ags: N,Z,C,V.#wr|
00002160  61 70 20 6f 6e 0a 23 6c  69 6e 65 0a 54 68 69 73  |ap on.#line.This|
00002170  20 6f 70 65 72 61 74 69  6f 6e 20 70 65 72 66 6f  | operation perfo|
00002180  72 6d 73 20 61 20 72 65  76 65 72 73 65 20 73 75  |rms a reverse su|
00002190  62 74 72 61 63 74 20 6f  70 65 72 61 74 69 6f 6e  |btract operation|
000021a0  20 77 68 69 6c 65 20 74  61 6b 69 6e 67 20 61 63  | while taking ac|
000021b0  63 6f 75 6e 74 20 6f 66  20 61 20 70 72 65 76 69  |count of a previ|
000021c0  6f 75 73 20 62 6f 72 72  6f 77 20 69 6e 20 74 68  |ous borrow in th|
000021d0  65 20 63 61 72 72 79 20  66 6c 61 67 2e 0a 23 6c  |e carry flag..#l|
000021e0  69 6e 65 0a 54 68 69 73  20 6f 70 65 72 61 6e 64  |ine.This operand|
000021f0  20 61 6c 6c 6f 77 73 20  72 65 76 65 72 73 65 64  | allows reversed|
00002200  20 73 75 62 74 72 61 63  74 69 6f 6e 20 74 6f 20  | subtraction to |
00002210  62 65 20 70 65 72 66 6f  72 6d 65 64 20 6f 6e 20  |be performed on |
00002220  6d 75 6c 74 69 2d 77 6f  72 64 20 6f 70 65 72 61  |multi-word opera|
00002230  6e 64 73 2e 20 49 74 20  63 6f 72 72 65 73 70 6f  |nds. It correspo|
00002240  6e 64 73 20 74 6f 20 74  68 65 20 3c 53 42 43 3e  |nds to the <SBC>|
00002250  20 69 6e 73 74 72 75 63  74 69 6f 6e 20 69 6e 20  | instruction in |
00002260  74 68 65 20 73 61 6d 65  20 77 61 79 20 74 68 61  |the same way tha|
00002270  74 20 3c 52 53 42 3e 20  63 6f 72 72 65 73 70 6f  |t <RSB> correspo|
00002280  6e 64 73 20 74 6f 20 3c  53 55 42 3e 2e 0a 23 6c  |nds to <SUB>..#l|
00002290  69 6e 65 0a 45 78 61 6d  70 6c 65 73 3a 0a 23 77  |ine.Examples:.#w|
000022a0  72 61 70 20 6f 66 66 0a  23 49 6e 64 65 6e 74 20  |rap off.#Indent |
000022b0  32 0a 52 53 42 53 09 72  65 73 75 6c 74 5f 6c 6f  |2.RSBS.result_lo|
000022c0  77 2c 20 6c 6f 77 31 2c  20 6c 6f 77 32 09 09 52  |w, low1, low2..R|
000022d0  65 76 65 72 73 65 20 73  75 62 74 72 61 63 74 20  |everse subtract |
000022e0  6c 6f 77 20 77 6f 72 64  73 0a 52 53 43 53 09 72  |low words.RSCS.r|
000022f0  65 73 75 6c 74 5f 68 69  67 68 2c 20 68 69 67 68  |esult_high, high|
00002300  31 2c 20 68 69 67 68 32  09 52 65 76 65 72 73 65  |1, high2.Reverse|
00002310  20 73 75 62 74 72 61 63  74 20 68 69 67 68 20 77  | subtract high w|
00002320  6f 72 64 73 20 2b 20 63  61 72 72 79 0a 23 49 6e  |ords + carry.#In|
00002330  64 65 6e 74 0a 23 77 72  61 70 20 6f 6e 00 00 00  |dent.#wrap on...|
00002340  44 41 54 41 4e 02 00 00  4d 4f 56 3a 20 4d 6f 76  |DATAN...MOV: Mov|
00002350  65 20 44 61 74 61 0a 23  62 61 63 6b 67 72 6f 75  |e Data.#backgrou|
00002360  6e 64 20 77 69 6d 70 20  31 0a 23 77 72 61 70 20  |nd wimp 1.#wrap |
00002370  6f 66 66 0a 53 79 6e 74  61 78 3a 20 4d 4f 56 20  |off.Syntax: MOV |
00002380  5c 7b 5c 3c 73 75 66 66  69 78 5c 3e 5c 7d 20 5c  |\{\<suffix\>\} \|
00002390  3c 64 65 73 74 69 6e 61  74 69 6f 6e 5c 3e 2c 20  |<destination\>, |
000023a0  5c 3c 6f 70 65 72 61 6e  64 32 5c 3e 0a 4f 70 65  |\<operand2\>.Ope|
000023b0  72 61 74 69 6f 6e 3a 20  64 65 73 74 69 6e 61 74  |ration: destinat|
000023c0  69 6f 6e 20 3d 20 6f 70  65 72 61 6e 64 20 74 77  |ion = operand tw|
000023d0  6f 0a 46 6c 61 67 73 3a  20 4e 2c 5a 2c 28 43 29  |o.Flags: N,Z,(C)|
000023e0  0a 23 77 72 61 70 20 6f  6e 0a 23 6c 69 6e 65 0a  |.#wrap on.#line.|
000023f0  54 68 69 73 20 69 6e 73  74 72 75 63 74 69 6f 6e  |This instruction|
00002400  20 6d 6f 76 65 73 20 64  61 74 61 20 69 6e 74 6f  | moves data into|
00002410  20 74 68 65 20 64 65 73  74 69 6e 61 74 69 6f 6e  | the destination|
00002420  20 72 65 67 69 73 74 65  72 2e 20 4f 70 65 72 61  | register. Opera|
00002430  6e 64 20 74 77 6f 2c 20  61 73 20 65 78 70 65 63  |nd two, as expec|
00002440  74 65 64 2c 20 63 61 6e  20 62 65 20 73 70 65 63  |ted, can be spec|
00002450  69 66 69 65 64 20 61 73  20 61 20 72 65 67 69 73  |ified as a regis|
00002460  74 65 72 2c 20 61 6e 20  69 6d 6d 65 64 69 61 74  |ter, an immediat|
00002470  65 20 6f 70 65 72 61 6e  64 20 6f 72 20 61 73 20  |e operand or as |
00002480  61 20 73 68 69 66 74 65  64 20 72 65 67 69 73 74  |a shifted regist|
00002490  65 72 2e 0a 23 6c 69 6e  65 0a 45 78 61 6d 70 6c  |er..#line.Exampl|
000024a0  65 73 3a 0a 23 77 72 61  70 20 6f 66 66 0a 23 49  |es:.#wrap off.#I|
000024b0  6e 64 65 6e 74 20 32 0a  4d 4f 56 09 52 31 32 2c  |ndent 2.MOV.R12,|
000024c0  52 30 09 09 4d 6f 76 65  20 74 68 65 20 63 6f 6e  |R0..Move the con|
000024d0  74 65 6e 74 73 20 6f 66  20 52 30 20 69 6e 74 6f  |tents of R0 into|
000024e0  20 52 31 32 0a 4d 4f 56  09 52 36 2c 52 36 2c 41  | R12.MOV.R6,R6,A|
000024f0  53 4c 23 32 09 52 36 20  3d 20 52 36 2a 34 0a 4d  |SL#2.R6 = R6*4.M|
00002500  4f 56 09 52 30 2c 52 32  2c 41 53 4c 20 52 35 09  |OV.R0,R2,ASL R5.|
00002510  52 30 20 3d 20 52 32 20  2a 20 28 32 5e 52 35 29  |R0 = R2 * (2^R5)|
00002520  0a 4d 4f 56 45 51 53 09  52 30 2c 52 34 09 09 49  |.MOVEQS.R0,R4..I|
00002530  66 20 5a 20 66 6c 61 67  20 73 65 74 20 54 68 65  |f Z flag set The|
00002540  6e 20 52 30 20 3d 20 52  34 20 28 73 65 74 74 69  |n R0 = R4 (setti|
00002550  6e 67 20 66 6c 61 67 73  29 0a 4d 4f 56 09 52 31  |ng flags).MOV.R1|
00002560  35 2c 52 31 34 09 09 52  65 74 75 72 6e 20 66 72  |5,R14..Return fr|
00002570  6f 6d 20 73 75 62 72 6f  75 74 69 6e 65 0a 23 49  |om subroutine.#I|
00002580  6e 64 65 6e 74 0a 23 77  72 61 70 20 6f 6e 00 00  |ndent.#wrap on..|
00002590  44 41 54 41 a6 02 00 00  4d 56 4e 3a 20 4d 6f 76  |DATA....MVN: Mov|
000025a0  65 20 49 6e 76 65 72 74  65 64 20 44 61 74 61 0a  |e Inverted Data.|
000025b0  23 62 61 63 6b 67 72 6f  75 6e 64 20 77 69 6d 70  |#background wimp|
000025c0  20 31 0a 23 77 72 61 70  20 6f 66 66 0a 53 79 6e  | 1.#wrap off.Syn|
000025d0  74 61 78 3a 20 4d 56 4e  20 5c 7b 5c 3c 73 75 66  |tax: MVN \{\<suf|
000025e0  66 69 78 5c 3e 5c 7d 20  5c 3c 64 65 73 74 69 6e  |fix\>\} \<destin|
000025f0  61 74 69 6f 6e 5c 3e 2c  20 5c 3c 6f 70 65 72 61  |ation\>, \<opera|
00002600  6e 64 32 5c 3e 0a 4f 70  65 72 61 74 69 6f 6e 3a  |nd2\>.Operation:|
00002610  20 64 65 73 74 69 6e 61  74 69 6f 6e 20 3d 20 6e  | destination = n|
00002620  6f 74 20 28 6f 70 65 72  61 6e 64 20 74 77 6f 29  |ot (operand two)|
00002630  0a 46 6c 61 67 73 3a 20  4e 2c 5a 2c 28 43 29 0a  |.Flags: N,Z,(C).|
00002640  23 77 72 61 70 20 6f 6e  0a 23 6c 69 6e 65 0a 54  |#wrap on.#line.T|
00002650  68 69 73 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |his instruction |
00002660  68 61 73 20 65 78 61 63  74 6c 79 20 74 68 20 73  |has exactly th s|
00002670  61 6d 65 20 65 66 66 65  63 74 20 61 73 20 3c 4d  |ame effect as <M|
00002680  4f 56 3e 2c 20 65 78 63  65 70 74 20 74 68 61 74  |OV>, except that|
00002690  20 61 6c 6c 20 74 68 65  20 62 69 74 73 20 6d 6f  | all the bits mo|
000026a0  76 65 64 20 66 72 6f 6d  20 74 68 65 20 73 6f 75  |ved from the sou|
000026b0  72 63 65 20 72 65 67 69  73 74 65 72 20 61 72 65  |rce register are|
000026c0  20 61 75 74 6f 6d 61 74  69 63 61 6c 6c 79 20 69  | automatically i|
000026d0  6e 76 65 72 74 65 64 2e  20 54 68 69 73 20 61 6c  |nverted. This al|
000026e0  6c 6f 77 73 20 6e 65 67  61 74 69 76 65 20 69 6d  |lows negative im|
000026f0  6d 65 64 69 61 74 65 20  6e 75 6d 62 65 72 73 20  |mediate numbers |
00002700  74 6f 20 62 65 20 6d 6f  76 65 64 20 69 6e 74 6f  |to be moved into|
00002710  20 72 65 67 69 73 74 65  72 73 0a 23 6c 69 6e 65  | registers.#line|
00002720  0a 55 6e 64 65 72 20 74  68 65 20 74 77 6f 27 73  |.Under the two's|
00002730  20 63 6f 6d 70 6c 65 6d  65 6e 74 20 73 63 68 65  | complement sche|
00002740  6d 65 2c 20 74 68 65 20  6e 75 6d 62 65 72 20 27  |me, the number '|
00002750  6e 27 20 69 73 20 72 65  70 72 65 73 65 6e 74 65  |n' is represente|
00002760  64 20 61 73 3a 0a 23 49  6e 64 65 6e 74 20 34 0a  |d as:.#Indent 4.|
00002770  4e 4f 54 20 28 6e 29 20  2b 20 31 0a 23 49 6e 64  |NOT (n) + 1.#Ind|
00002780  65 6e 74 0a 23 6c 69 6e  65 0a 45 78 61 6d 70 6c  |ent.#line.Exampl|
00002790  65 73 3a 0a 23 77 72 61  70 20 6f 66 66 0a 23 49  |es:.#wrap off.#I|
000027a0  6e 64 65 6e 74 20 32 0a  4d 56 4e 09 52 30 2c 23  |ndent 2.MVN.R0,#|
000027b0  30 09 09 4d 6f 76 65 20  2d 31 20 69 6e 74 6f 20  |0..Move -1 into |
000027c0  72 65 67 69 73 74 65 72  20 52 30 0a 4d 56 4e 09  |register R0.MVN.|
000027d0  52 31 2c 23 39 09 09 4d  6f 76 65 20 2d 31 30 20  |R1,#9..Move -10 |
000027e0  69 6e 74 6f 20 52 31 0a  4d 56 4e 09 52 33 2c 52  |into R1.MVN.R3,R|
000027f0  35 09 09 52 33 20 3d 20  6e 6f 74 20 28 52 35 29  |5..R3 = not (R5)|
00002800  0a 4d 56 4e 09 52 36 2c  52 37 2c 4c 53 52 20 23  |.MVN.R6,R7,LSR #|
00002810  31 09 52 36 20 3d 20 6e  6f 74 20 28 52 37 20 64  |1.R6 = not (R7 d|
00002820  69 76 20 32 29 0a 23 49  6e 64 65 6e 74 0a 23 77  |iv 2).#Indent.#w|
00002830  72 61 70 20 6f 6e 00 00  44 41 54 41 b8 03 00 00  |rap on..DATA....|
00002840  43 4d 50 3a 20 43 6f 6d  70 61 72 65 0a 23 62 61  |CMP: Compare.#ba|
00002850  63 6b 67 72 6f 75 6e 64  20 77 69 6d 70 20 31 0a  |ckground wimp 1.|
00002860  23 77 72 61 70 20 6f 66  66 0a 53 79 6e 74 61 78  |#wrap off.Syntax|
00002870  3a 20 43 4d 50 20 5c 7b  5c 3c 73 75 66 66 69 78  |: CMP \{\<suffix|
00002880  5c 3e 5c 7d 20 5c 3c 6f  70 65 72 61 6e 64 31 5c  |\>\} \<operand1\|
00002890  3e 2c 20 5c 3c 6f 70 65  72 61 6e 64 32 5c 3e 0a  |>, \<operand2\>.|
000028a0  4f 70 65 72 61 74 69 6f  6e 3a 20 52 65 66 6c 65  |Operation: Refle|
000028b0  63 74 20 72 65 73 75 6c  74 20 6f 66 20 6f 70 65  |ct result of ope|
000028c0  72 61 6e 64 20 6f 6e 65  20 2d 20 6f 70 65 72 61  |rand one - opera|
000028d0  6e 64 20 74 77 6f 0a 46  6c 61 67 73 3a 20 4e 2c  |nd two.Flags: N,|
000028e0  5a 2c 43 2c 56 0a 23 77  72 61 70 20 6f 6e 0a 23  |Z,C,V.#wrap on.#|
000028f0  6c 69 6e 65 0a 54 68 69  73 20 69 73 20 61 20 76  |line.This is a v|
00002900  65 72 79 20 69 6d 70 6f  72 74 61 6e 74 20 69 6e  |ery important in|
00002910  73 74 72 75 63 74 69 6f  6e 20 63 6f 6e 6e 65 63  |struction connec|
00002920  74 65 64 20 77 69 74 68  20 63 6f 6e 64 69 74 69  |ted with conditi|
00002930  6f 6e 61 6c 20 69 6e 73  74 72 75 63 74 69 6f 6e  |onal instruction|
00002940  20 65 78 65 63 75 74 69  6f 6e 2e 20 54 68 65 20  | execution. The |
00002950  69 6e 73 74 72 75 63 74  69 6f 6e 20 63 6f 6d 70  |instruction comp|
00002960  61 72 65 73 20 74 77 6f  20 6f 70 65 72 61 6e 64  |ares two operand|
00002970  73 2c 20 61 6e 64 20 61  6c 74 65 72 73 20 74 68  |s, and alters th|
00002980  65 20 73 74 61 74 75 73  20 66 6c 61 67 73 20 64  |e status flags d|
00002990  65 70 65 6e 64 69 6e 67  20 6f 6e 20 74 68 65 20  |epending on the |
000029a0  72 65 73 75 6c 74 2e 0a  23 6c 69 6e 65 0a 54 68  |result..#line.Th|
000029b0  65 20 72 65 73 75 6c 74  20 6f 66 20 74 68 65 20  |e result of the |
000029c0  6f 70 65 72 61 74 69 6f  6e 20 69 73 20 6e 6f 74  |operation is not|
000029d0  20 73 74 6f 72 65 64 20  61 6e 79 77 68 65 72 65  | stored anywhere|
000029e0  2c 20 77 68 69 63 68 20  65 78 70 6c 61 69 6e 73  |, which explains|
000029f0  20 77 68 79 20 74 68 65  72 65 20 69 73 20 6e 6f  | why there is no|
00002a00  20 6e 65 65 64 20 66 6f  72 20 61 20 64 65 73 74  | need for a dest|
00002a10  69 6e 61 74 69 6f 6e 20  66 69 65 6c 64 2e 20 54  |ination field. T|
00002a20  68 65 20 6f 6e 6c 79 20  74 68 69 6e 67 20 74 6f  |he only thing to|
00002a30  20 72 65 6d 65 6d 62 65  72 20 69 73 20 74 68 61  | remember is tha|
00002a40  74 20 74 68 65 20 76 61  72 69 6f 75 73 20 73 75  |t the various su|
00002a50  62 73 65 71 75 65 6e 74  20 63 6f 6e 64 69 74 69  |bsequent conditi|
00002a60  6f 6e 20 63 6f 64 65 73  20 72 65 66 65 72 20 74  |on codes refer t|
00002a70  6f 20 6f 70 65 72 61 6e  64 20 6f 6e 65 20 63 6f  |o operand one co|
00002a80  6d 70 61 72 65 64 20 77  69 74 68 20 6f 70 65 72  |mpared with oper|
00002a90  61 6e 64 20 74 77 6f 2e  20 54 68 75 73 2c 20 74  |and two. Thus, t|
00002aa0  68 65 20 4c 54 20 28 6c  65 73 73 20 74 68 61 6e  |he LT (less than|
00002ab0  29 20 73 75 66 66 69 78  20 77 69 6c 6c 20 65 78  |) suffix will ex|
00002ac0  65 63 75 74 65 20 69 66  20 6f 70 65 72 61 6e 64  |ecute if operand|
00002ad0  20 6f 6e 65 20 69 73 20  6c 65 73 73 20 74 68 61  | one is less tha|
00002ae0  6e 20 6f 70 65 72 61 6e  64 20 74 77 6f 2e 0a 23  |n operand two..#|
00002af0  6c 69 6e 65 0a 45 78 61  6d 70 6c 65 3a 0a 23 77  |line.Example:.#w|
00002b00  72 61 70 20 6f 66 66 0a  23 69 6e 64 65 6e 74 20  |rap off.#indent |
00002b10  32 0a 43 4d 50 09 52 30  2c 52 31 09 09 43 6f 6d  |2.CMP.R0,R1..Com|
00002b20  70 61 72 65 20 52 30 20  77 69 74 68 20 52 31 0a  |pare R0 with R1.|
00002b30  53 57 49 45 51 09 22 4f  53 5f 4e 65 77 4c 69 6e  |SWIEQ."OS_NewLin|
00002b40  65 22 09 49 66 20 28 52  30 20 2d 20 52 31 20 3d  |e".If (R0 - R1 =|
00002b50  20 30 29 20 65 78 65 63  75 74 65 20 53 57 49 20  | 0) execute SWI |
00002b60  63 6f 6d 6d 61 6e 64 0a  23 69 6e 64 65 6e 74 0a  |command.#indent.|
00002b70  23 77 72 61 70 20 6f 6e  0a 2a 4e 6f 74 65 2a 3a  |#wrap on.*Note*:|
00002b80  20 53 69 6e 63 65 20 74  68 65 20 70 75 72 70 6f  | Since the purpo|
00002b90  73 65 20 6f 66 20 74 68  65 20 43 4d 50 20 69 6e  |se of the CMP in|
00002ba0  73 74 72 75 63 74 69 6f  6e 20 69 73 20 74 6f 20  |struction is to |
00002bb0  61 66 66 65 63 74 20 74  68 65 20 73 74 61 74 75  |affect the statu|
00002bc0  73 20 66 6c 61 67 73 2c  20 74 68 65 20 53 20 73  |s flags, the S s|
00002bd0  75 66 66 69 78 20 64 6f  65 73 20 6e 6f 74 20 68  |uffix does not h|
00002be0  61 76 65 20 74 6f 20 62  65 20 75 73 65 64 2e 0a  |ave to be used..|
00002bf0  44 41 54 41 18 03 00 00  43 4d 4e 3a 20 43 6f 6d  |DATA....CMN: Com|
00002c00  70 61 72 65 20 4e 65 67  61 74 69 76 65 0a 23 62  |pare Negative.#b|
00002c10  61 63 6b 67 72 6f 75 6e  64 20 77 69 6d 70 20 31  |ackground wimp 1|
00002c20  0a 23 77 72 61 70 20 6f  66 66 0a 53 79 6e 74 61  |.#wrap off.Synta|
00002c30  78 3a 20 43 4d 4e 20 5c  7b 5c 3c 73 75 66 66 69  |x: CMN \{\<suffi|
00002c40  78 5c 3e 5c 7d 20 5c 3c  6f 70 65 72 61 6e 64 31  |x\>\} \<operand1|
00002c50  5c 3e 2c 20 5c 3c 6f 70  65 72 61 6e 64 32 5c 3e  |\>, \<operand2\>|
00002c60  0a 4f 70 65 72 61 74 69  6f 6e 3a 20 52 65 66 6c  |.Operation: Refl|
00002c70  65 63 74 20 72 65 73 75  6c 74 20 6f 66 20 6f 70  |ect result of op|
00002c80  65 72 61 6e 64 20 6f 6e  65 20 2d 20 28 2d 20 6f  |erand one - (- o|
00002c90  70 65 72 61 6e 64 20 74  77 6f 29 0a 46 6c 61 67  |perand two).Flag|
00002ca0  73 3a 20 4e 2c 5a 2c 43  2c 56 0a 23 77 72 61 70  |s: N,Z,C,V.#wrap|
00002cb0  20 6f 6e 0a 23 6c 69 6e  65 0a 43 4d 4e 20 69 73  | on.#line.CMN is|
00002cc0  20 65 78 61 63 74 6c 79  20 74 68 65 20 73 61 6d  | exactly the sam|
00002cd0  65 20 61 73 20 3c 43 4d  50 3e 2c 20 65 78 63 65  |e as <CMP>, exce|
00002ce0  70 74 20 74 68 61 74 20  69 74 20 63 6f 6d 70 61  |pt that it compa|
00002cf0  72 65 73 20 6f 70 65 72  61 6e 64 20 6f 6e 65 20  |res operand one |
00002d00  77 69 74 68 20 74 68 65  20 6e 65 67 61 74 69 76  |with the negativ|
00002d10  65 20 6f 66 20 6f 70 65  72 61 6e 64 20 74 77 6f  |e of operand two|
00002d20  2e 0a 23 6c 69 6e 65 0a  54 68 69 73 20 69 6e 73  |..#line.This ins|
00002d30  74 72 75 63 74 69 6f 6e  20 61 6c 6c 6f 77 73 20  |truction allows |
00002d40  63 6f 6d 70 61 72 69 73  6f 6e 73 20 74 6f 20 62  |comparisons to b|
00002d50  65 20 6d 61 64 65 20 77  69 74 68 20 73 6d 61 6c  |e made with smal|
00002d60  6c 20 69 6d 6d 65 64 69  61 74 65 20 63 6f 6e 73  |l immediate cons|
00002d70  74 61 6e 74 73 20 77 68  69 63 68 20 63 6f 75 6c  |tants which coul|
00002d80  64 20 6e 6f 74 20 62 65  20 72 65 70 72 65 73 65  |d not be represe|
00002d90  6e 74 65 64 20 6f 74 68  65 72 77 69 73 65 2e 20  |nted otherwise. |
00002da0  54 68 65 20 41 52 4d 20  77 69 6c 6c 20 61 75 74  |The ARM will aut|
00002db0  6f 6d 61 74 69 63 61 6c  6c 79 20 66 6f 72 6d 20  |omatically form |
00002dc0  74 68 65 20 6e 65 67 61  74 69 76 65 20 6f 66 20  |the negative of |
00002dd0  6f 70 65 72 61 6e 64 20  74 77 6f 20 61 6e 64 20  |operand two and |
00002de0  74 68 65 6e 20 6d 61 6b  65 20 74 68 65 20 63 6f  |then make the co|
00002df0  6d 70 61 72 69 73 6f 6e  2e 0a 23 6c 69 6e 65 0a  |mparison..#line.|
00002e00  45 78 61 6d 70 6c 65 73  0a 23 77 72 61 70 20 6f  |Examples.#wrap o|
00002e10  66 66 0a 23 69 6e 64 65  6e 74 20 32 0a 43 4d 4e  |ff.#indent 2.CMN|
00002e20  09 52 35 2c 52 37 09 09  43 6f 6d 70 61 72 65 20  |.R5,R7..Compare |
00002e30  52 35 20 77 69 74 68 20  2d 52 37 0a 43 4d 4e 09  |R5 with -R7.CMN.|
00002e40  52 36 2c 23 31 09 09 43  6f 6d 70 61 72 65 20 52  |R6,#1..Compare R|
00002e50  36 20 77 69 74 68 20 2d  31 0a 43 4d 4e 09 52 33  |6 with -1.CMN.R3|
00002e60  2c 52 30 2c 4c 53 4c 23  31 09 43 6f 6d 70 61 72  |,R0,LSL#1.Compar|
00002e70  65 20 52 33 20 77 69 74  68 20 2d 52 30 2a 32 0a  |e R3 with -R0*2.|
00002e80  23 69 6e 64 65 6e 74 0a  23 77 72 61 70 20 6f 6e  |#indent.#wrap on|
00002e90  0a 2a 4e 6f 74 65 2a 3a  20 53 69 6e 63 65 20 74  |.*Note*: Since t|
00002ea0  68 65 20 70 75 72 70 6f  73 65 20 6f 66 20 74 68  |he purpose of th|
00002eb0  65 20 43 4d 50 20 69 6e  73 74 72 75 63 74 69 6f  |e CMP instructio|
00002ec0  6e 20 69 73 20 74 6f 20  61 66 66 65 63 74 20 74  |n is to affect t|
00002ed0  68 65 20 73 74 61 74 75  73 20 66 6c 61 67 73 2c  |he status flags,|
00002ee0  20 74 68 65 20 53 20 73  75 66 66 69 78 20 64 6f  | the S suffix do|
00002ef0  65 73 20 6e 6f 74 20 68  61 76 65 20 74 6f 20 62  |es not have to b|
00002f00  65 20 75 73 65 64 2e 0a  44 41 54 41 17 02 00 00  |e used..DATA....|
00002f10  41 4e 44 3a 20 4c 6f 67  69 63 61 6c 20 41 4e 44  |AND: Logical AND|
00002f20  0a 23 62 61 63 6b 67 72  6f 75 6e 64 20 77 69 6d  |.#background wim|
00002f30  70 20 31 0a 23 77 72 61  70 20 6f 66 66 0a 53 79  |p 1.#wrap off.Sy|
00002f40  6e 74 61 78 3a 20 41 4e  44 20 5c 7b 5c 3c 73 75  |ntax: AND \{\<su|
00002f50  66 66 69 78 5c 3e 5c 7d  20 5c 3c 64 65 73 74 69  |ffix\>\} \<desti|
00002f60  6e 61 74 69 6f 6e 5c 3e  2c 20 5c 3c 6f 70 65 72  |nation\>, \<oper|
00002f70  61 6e 64 31 5c 3e 2c 20  5c 3c 6f 70 65 72 61 6e  |and1\>, \<operan|
00002f80  64 32 5c 3e 0a 4f 70 65  72 61 74 69 6f 6e 3a 20  |d2\>.Operation: |
00002f90  64 65 73 74 69 6e 61 74  69 6f 6e 20 3d 20 6f 70  |destination = op|
00002fa0  65 72 61 6e 64 20 6f 6e  65 20 41 4e 44 20 6f 70  |erand one AND op|
00002fb0  65 72 61 6e 64 20 74 77  6f 0a 46 6c 61 67 73 3a  |erand two.Flags:|
00002fc0  20 4e 2c 5a 2c 28 43 29  0a 23 77 72 61 70 20 6f  | N,Z,(C).#wrap o|
00002fd0  6e 0a 23 6c 69 6e 65 0a  54 68 69 73 20 6f 70 65  |n.#line.This ope|
00002fe0  72 61 74 69 6f 6e 20 70  65 72 66 6f 72 6d 73 20  |ration performs |
00002ff0  61 20 6c 6f 67 69 63 61  6c 20 62 69 74 77 69 73  |a logical bitwis|
00003000  65 20 41 4e 44 20 6f 70  65 72 61 74 69 6f 6e 20  |e AND operation |
00003010  62 65 74 77 65 65 6e 20  69 74 73 20 74 77 6f 20  |between its two |
00003020  6f 70 65 72 61 6e 64 73  2c 20 77 69 74 68 20 74  |operands, with t|
00003030  68 65 20 72 65 73 75 6c  74 20 62 65 69 6e 67 20  |he result being |
00003040  70 6c 61 63 65 64 20 69  6e 20 74 68 65 20 64 65  |placed in the de|
00003050  73 74 69 6e 61 74 69 6f  6e 20 72 65 67 69 73 74  |stination regist|
00003060  65 72 2e 0a 23 6c 69 6e  65 0a 45 78 61 6d 70 6c  |er..#line.Exampl|
00003070  65 73 3a 0a 23 77 72 61  70 20 6f 66 66 0a 23 49  |es:.#wrap off.#I|
00003080  6e 64 65 6e 74 20 32 0a  41 4e 44 20 09 52 30 2c  |ndent 2.AND .R0,|
00003090  52 31 2c 52 32 09 52 30  20 3d 20 52 31 20 41 4e  |R1,R2.R0 = R1 AN|
000030a0  44 20 52 32 0a 41 4e 44  09 52 35 2c 52 35 2c 23  |D R2.AND.R5,R5,#|
000030b0  25 31 31 31 31 09 52 35  20 3d 20 52 35 20 41 4e  |%1111.R5 = R5 AN|
000030c0  44 20 25 31 31 31 31 20  28 63 6c 65 61 72 20 61  |D %1111 (clear a|
000030d0  6c 6c 20 62 75 74 20 6c  6f 77 20 34 20 62 69 74  |ll but low 4 bit|
000030e0  73 29 0a 41 4e 44 53 09  52 34 2c 52 34 2c 23 31  |s).ANDS.R4,R4,#1|
000030f0  09 52 34 20 3d 20 52 34  20 41 4e 44 20 31 20 28  |.R4 = R4 AND 1 (|
00003100  73 65 74 74 69 6e 67 20  66 6c 61 67 73 29 0a 23  |setting flags).#|
00003110  49 6e 64 65 6e 74 0a 23  77 72 61 70 20 6f 6e 00  |Indent.#wrap on.|
00003120  44 41 54 41 44 02 00 00  45 4f 52 3a 20 4c 6f 67  |DATAD...EOR: Log|
00003130  69 63 61 6c 20 45 78 63  6c 75 73 69 76 65 20 4f  |ical Exclusive O|
00003140  52 0a 23 62 61 63 6b 67  72 6f 75 6e 64 20 77 69  |R.#background wi|
00003150  6d 70 20 31 0a 23 77 72  61 70 20 6f 66 66 0a 53  |mp 1.#wrap off.S|
00003160  79 6e 74 61 78 3a 20 45  4f 52 20 5c 7b 5c 3c 73  |yntax: EOR \{\<s|
00003170  75 66 66 69 78 5c 3e 5c  7d 20 5c 3c 64 65 73 74  |uffix\>\} \<dest|
00003180  69 6e 61 74 69 6f 6e 5c  3e 2c 20 5c 3c 6f 70 65  |ination\>, \<ope|
00003190  72 61 6e 64 31 5c 3e 2c  20 5c 3c 6f 70 65 72 61  |rand1\>, \<opera|
000031a0  6e 64 32 5c 3e 0a 4f 70  65 72 61 74 69 6f 6e 3a  |nd2\>.Operation:|
000031b0  20 64 65 73 74 69 6e 61  74 69 6f 6e 20 3d 20 6f  | destination = o|
000031c0  70 65 72 61 6e 64 20 6f  6e 65 20 45 4f 52 20 6f  |perand one EOR o|
000031d0  70 65 72 61 6e 64 20 74  77 6f 0a 46 6c 61 67 73  |perand two.Flags|
000031e0  3a 20 4e 2c 5a 2c 28 43  29 0a 23 77 72 61 70 20  |: N,Z,(C).#wrap |
000031f0  6f 6e 0a 23 6c 69 6e 65  0a 54 68 69 73 20 6f 70  |on.#line.This op|
00003200  65 72 61 74 69 6f 6e 20  70 65 72 66 6f 72 6d 73  |eration performs|
00003210  20 61 20 6c 6f 67 69 63  61 6c 20 62 69 74 77 69  | a logical bitwi|
00003220  73 65 20 45 4f 52 20 6f  70 65 72 61 74 69 6f 6e  |se EOR operation|
00003230  20 62 65 74 77 65 65 6e  20 69 74 73 20 74 77 6f  | between its two|
00003240  20 6f 70 65 72 61 6e 64  73 2c 20 77 69 74 68 20  | operands, with |
00003250  74 68 65 20 72 65 73 75  6c 74 20 62 65 69 6e 67  |the result being|
00003260  20 70 6c 61 63 65 64 20  69 6e 20 74 68 65 20 64  | placed in the d|
00003270  65 73 74 69 6e 61 74 69  6f 6e 20 72 65 67 69 73  |estination regis|
00003280  74 65 72 2e 0a 23 6c 69  6e 65 0a 2a 4e 6f 74 65  |ter..#line.*Note|
00003290  2a 3a 20 45 4f 52 20 69  73 20 76 65 72 79 20 75  |*: EOR is very u|
000032a0  73 65 66 75 6c 20 69 6e  20 27 74 6f 67 67 6c 69  |seful in 'toggli|
000032b0  6e 67 27 20 64 61 74 61  20 62 65 74 77 65 65 6e  |ng' data between|
000032c0  20 74 77 6f 20 70 72 65  2d 64 65 66 69 6e 65 64  | two pre-defined|
000032d0  20 76 61 6c 75 65 73 2e  20 46 6f 72 20 65 78 61  | values. For exa|
000032e0  6d 70 6c 65 2c 20 74 68  65 20 72 65 67 69 73 74  |mple, the regist|
000032f0  65 72 20 52 30 20 63 61  6e 20 62 65 20 74 6f 67  |er R0 can be tog|
00003300  67 6c 65 64 20 62 65 74  77 65 65 6e 20 36 35 20  |gled between 65 |
00003310  61 6e 64 20 39 30 20 62  79 20 45 4f 52 69 6e 67  |and 90 by EORing|
00003320  20 69 74 73 20 63 6f 6e  74 65 6e 74 73 20 77 69  | its contents wi|
00003330  74 68 20 32 37 3a 0a 23  49 6e 64 65 6e 74 20 34  |th 27:.#Indent 4|
00003340  0a 2e 6c 6f 6f 70 0a 45  4f 52 20 52 30 2c 52 30  |..loop.EOR R0,R0|
00003350  2c 23 32 37 0a 42 20 6c  6f 6f 70 0a 23 49 6e 64  |,#27.B loop.#Ind|
00003360  65 6e 74 0a 44 41 54 41  72 02 00 00 4f 52 52 3a  |ent.DATAr...ORR:|
00003370  20 4c 6f 67 69 63 61 6c  20 4f 52 0a 23 62 61 63  | Logical OR.#bac|
00003380  6b 67 72 6f 75 6e 64 20  77 69 6d 70 20 31 0a 23  |kground wimp 1.#|
00003390  77 72 61 70 20 6f 66 66  0a 53 79 6e 74 61 78 3a  |wrap off.Syntax:|
000033a0  20 4f 52 52 20 5c 7b 5c  3c 73 75 66 66 69 78 5c  | ORR \{\<suffix\|
000033b0  3e 5c 7d 20 5c 3c 64 65  73 74 69 6e 61 74 69 6f  |>\} \<destinatio|
000033c0  6e 5c 3e 2c 20 5c 3c 6f  70 65 72 61 6e 64 31 5c  |n\>, \<operand1\|
000033d0  3e 2c 20 5c 3c 6f 70 65  72 61 6e 64 32 5c 3e 0a  |>, \<operand2\>.|
000033e0  4f 70 65 72 61 74 69 6f  6e 3a 20 64 65 73 74 69  |Operation: desti|
000033f0  6e 61 74 69 6f 6e 20 3d  20 6f 70 65 72 61 6e 64  |nation = operand|
00003400  20 6f 6e 65 20 4f 52 20  6f 70 65 72 61 6e 64 20  | one OR operand |
00003410  74 77 6f 0a 46 6c 61 67  73 3a 20 4e 2c 5a 2c 28  |two.Flags: N,Z,(|
00003420  43 29 0a 23 77 72 61 70  20 6f 6e 0a 23 6c 69 6e  |C).#wrap on.#lin|
00003430  65 0a 54 68 69 73 20 69  6e 73 74 72 75 63 74 69  |e.This instructi|
00003440  6f 6e 20 70 65 72 66 6f  72 6d 73 20 61 20 6c 6f  |on performs a lo|
00003450  67 69 63 61 6c 20 62 69  74 77 69 73 65 20 4f 52  |gical bitwise OR|
00003460  20 6f 70 65 72 61 74 69  6f 6e 20 62 65 74 77 65  | operation betwe|
00003470  65 6e 20 69 74 73 20 74  77 6f 20 6f 70 65 72 61  |en its two opera|
00003480  6e 64 73 2c 20 77 69 74  68 20 74 68 65 20 72 65  |nds, with the re|
00003490  73 75 6c 74 20 62 65 69  6e 67 20 70 6c 61 63 65  |sult being place|
000034a0  64 20 69 6e 20 74 68 65  20 64 65 73 74 69 6e 61  |d in the destina|
000034b0  74 69 6f 6e 20 72 65 67  69 73 74 65 72 2e 0a 23  |tion register..#|
000034c0  6c 69 6e 65 0a 2a 4e 6f  74 65 2a 3a 20 54 68 69  |line.*Note*: Thi|
000034d0  73 20 6f 70 65 72 61 74  69 6f 6e 20 69 73 20 70  |s operation is p|
000034e0  61 72 74 69 63 75 6c 61  72 6c 79 20 75 73 65 66  |articularly usef|
000034f0  75 6c 20 66 6f 72 20 66  6f 72 63 69 6e 67 20 63  |ul for forcing c|
00003500  65 72 74 61 69 6e 20 62  69 74 73 20 74 6f 20 62  |ertain bits to b|
00003510  65 20 73 65 74 20 69 6e  20 61 20 64 61 74 61 20  |e set in a data |
00003520  77 6f 72 64 2e 0a 23 6c  69 6e 65 0a 45 78 61 6d  |word..#line.Exam|
00003530  70 6c 65 73 3a 0a 23 77  72 61 70 20 6f 66 66 0a  |ples:.#wrap off.|
00003540  23 49 6e 64 65 6e 74 20  32 0a 4f 52 52 09 52 30  |#Indent 2.ORR.R0|
00003550  2c 52 31 31 2c 52 32 09  52 30 20 3d 20 52 31 31  |,R11,R2.R0 = R11|
00003560  20 4f 52 20 52 32 0a 4f  52 52 09 52 37 2c 52 37  | OR R2.ORR.R7,R7|
00003570  2c 23 25 31 31 30 30 09  52 37 20 3d 20 52 37 20  |,#%1100.R7 = R7 |
00003580  4f 52 20 25 31 31 30 30  20 28 73 65 74 20 62 69  |OR %1100 (set bi|
00003590  74 73 20 32 20 26 20 33  29 0a 4f 52 52 53 09 52  |ts 2 & 3).ORRS.R|
000035a0  35 2c 52 35 2c 23 32 09  52 35 20 3d 20 52 35 20  |5,R5,#2.R5 = R5 |
000035b0  4f 52 20 23 32 20 28 73  65 74 74 69 6e 67 20 66  |OR #2 (setting f|
000035c0  6c 61 67 73 29 0a 23 49  6e 64 65 6e 74 0a 23 77  |lags).#Indent.#w|
000035d0  72 61 70 20 6f 6e 00 00  44 41 54 41 8a 03 00 00  |rap on..DATA....|
000035e0  42 49 43 3a 20 42 69 74  20 43 6c 65 61 72 0a 23  |BIC: Bit Clear.#|
000035f0  62 61 63 6b 67 72 6f 75  6e 64 20 77 69 6d 70 20  |background wimp |
00003600  31 0a 23 77 72 61 70 20  6f 66 66 0a 53 79 6e 74  |1.#wrap off.Synt|
00003610  61 78 3a 20 42 49 43 20  5c 7b 5c 3c 73 75 66 66  |ax: BIC \{\<suff|
00003620  69 78 5c 3e 5c 7d 20 5c  3c 64 65 73 74 69 6e 61  |ix\>\} \<destina|
00003630  74 69 6f 6e 5c 3e 2c 20  5c 3c 6f 70 65 72 61 6e  |tion\>, \<operan|
00003640  64 31 5c 3e 2c 20 5c 3c  6f 70 65 72 61 6e 64 32  |d1\>, \<operand2|
00003650  5c 3e 0a 4f 70 65 72 61  74 69 6f 6e 3a 20 64 65  |\>.Operation: de|
00003660  73 74 69 6e 61 74 69 6f  6e 20 3d 20 6f 70 65 72  |stination = oper|
00003670  61 6e 64 20 6f 6e 65 20  41 4e 44 20 28 4e 4f 54  |and one AND (NOT|
00003680  20 28 6f 70 65 72 61 6e  64 20 74 77 6f 29 29 0a  | (operand two)).|
00003690  46 6c 61 67 73 3a 20 4e  2c 5a 2c 28 43 29 0a 23  |Flags: N,Z,(C).#|
000036a0  77 72 61 70 20 6f 6e 0a  23 6c 69 6e 65 0a 54 68  |wrap on.#line.Th|
000036b0  69 73 20 69 6e 73 74 72  75 63 74 69 6f 6e 20 70  |is instruction p|
000036c0  72 6f 76 69 64 65 73 20  61 20 75 73 65 66 75 6c  |rovides a useful|
000036d0  20 77 61 79 20 6f 66 20  63 6c 65 61 72 69 6e 67  | way of clearing|
000036e0  20 63 65 72 74 61 69 6e  20 62 69 74 73 20 77 69  | certain bits wi|
000036f0  74 68 69 6e 20 61 20 64  61 74 61 20 77 6f 72 64  |thin a data word|
00003700  2c 20 77 68 69 6c 65 20  6c 65 61 76 69 6e 67 20  |, while leaving |
00003710  6f 74 68 65 72 73 20 75  6e 63 68 61 6e 67 65 64  |others unchanged|
00003720  2e 20 4f 70 65 72 61 6e  64 20 6f 6e 65 20 69 73  |. Operand one is|
00003730  20 74 68 65 20 64 61 74  61 20 66 69 65 6c 64 20  | the data field |
00003740  74 6f 20 62 65 20 6d 6f  64 69 66 69 65 64 2c 20  |to be modified, |
00003750  77 69 74 68 20 74 68 65  20 72 65 73 75 6c 74 20  |with the result |
00003760  62 65 69 6e 67 20 70 6c  61 63 65 64 20 69 6e 20  |being placed in |
00003770  74 68 65 20 64 65 73 74  69 6e 61 74 69 6f 6e 20  |the destination |
00003780  72 65 67 69 73 74 65 72  2e 0a 23 6c 69 6e 65 0a  |register..#line.|
00003790  4f 70 65 72 61 6e 64 20  74 77 6f 20 69 73 20 61  |Operand two is a|
000037a0  20 33 32 2d 62 69 74 20  77 6f 72 64 20 63 61 6c  | 32-bit word cal|
000037b0  6c 65 64 20 74 68 65 20  64 61 74 61 20 6d 61 73  |led the data mas|
000037c0  6b 2e 20 41 20 73 65 74  20 62 69 74 20 69 6e 20  |k. A set bit in |
000037d0  74 68 65 20 62 69 74 20  6d 61 73 6b 20 77 69 6c  |the bit mask wil|
000037e0  6c 20 66 6f 72 63 65 20  74 68 65 20 63 6f 72 72  |l force the corr|
000037f0  65 73 70 6f 6e 64 69 6e  67 20 62 69 74 20 69 6e  |esponding bit in|
00003800  20 74 68 65 20 64 61 74  61 20 77 6f 72 64 20 74  | the data word t|
00003810  6f 20 62 65 20 72 65 73  65 74 20 77 68 65 6e 20  |o be reset when |
00003820  74 68 65 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |the instruction |
00003830  69 73 20 65 78 65 63 75  74 65 64 2e 20 41 20 7a  |is executed. A z|
00003840  65 72 6f 20 62 69 74 20  69 6e 20 74 68 65 20 6d  |ero bit in the m|
00003850  61 73 6b 20 77 69 6c 6c  20 6c 65 61 76 65 20 74  |ask will leave t|
00003860  68 65 20 63 6f 72 72 65  73 70 6f 6e 64 69 6e 67  |he corresponding|
00003870  20 62 69 74 20 69 6e 20  74 68 65 20 64 61 74 61  | bit in the data|
00003880  20 77 6f 72 64 20 69 6e  20 69 74 73 20 6f 72 69  | word in its ori|
00003890  67 69 6e 61 6c 20 73 74  61 74 65 2e 0a 23 6c 69  |ginal state..#li|
000038a0  6e 65 0a 45 78 61 6d 70  6c 65 73 3a 0a 23 77 72  |ne.Examples:.#wr|
000038b0  61 70 20 6f 66 66 0a 23  49 6e 64 65 6e 74 20 32  |ap off.#Indent 2|
000038c0  0a 42 49 43 09 52 30 2c  52 30 2c 23 25 31 31 31  |.BIC.R0,R0,#%111|
000038d0  31 09 43 6c 65 61 72 20  6c 6f 77 20 34 20 62 69  |1.Clear low 4 bi|
000038e0  74 73 20 6f 66 20 52 30  0a 42 49 43 09 52 31 2c  |ts of R0.BIC.R1,|
000038f0  52 31 2c 52 32 09 43 6c  65 61 72 20 62 69 74 73  |R1,R2.Clear bits|
00003900  20 69 6e 20 52 31 20 77  68 69 63 68 20 77 65 72  | in R1 which wer|
00003910  65 20 73 65 74 20 69 6e  20 52 32 0a 42 49 43 09  |e set in R2.BIC.|
00003920  52 36 2c 52 36 2c 52 36  09 43 6c 65 61 72 20 62  |R6,R6,R6.Clear b|
00003930  69 74 73 20 77 68 69 63  68 20 77 65 72 65 20 73  |its which were s|
00003940  65 74 20 69 6e 20 52 36  20 28 52 36 20 3d 20 30  |et in R6 (R6 = 0|
00003950  29 0a 23 49 6e 64 65 6e  74 0a 23 77 72 61 70 20  |).#Indent.#wrap |
00003960  6f 6e 00 00 44 41 54 41  6f 03 00 00 54 53 54 3a  |on..DATAo...TST:|
00003970  20 54 65 73 74 20 42 69  74 73 0a 23 62 61 63 6b  | Test Bits.#back|
00003980  67 72 6f 75 6e 64 20 77  69 6d 70 20 31 0a 23 77  |ground wimp 1.#w|
00003990  72 61 70 20 6f 66 66 0a  53 79 6e 74 61 78 3a 20  |rap off.Syntax: |
000039a0  54 53 54 20 5c 7b 5c 3c  73 75 66 66 69 78 5c 3e  |TST \{\<suffix\>|
000039b0  5c 7d 20 5c 3c 6f 70 65  72 61 6e 64 31 5c 3e 2c  |\} \<operand1\>,|
000039c0  20 5c 3c 6f 70 65 72 61  6e 64 32 5c 3e 0a 4f 70  | \<operand2\>.Op|
000039d0  65 72 61 74 69 6f 6e 3a  20 52 65 66 6c 65 63 74  |eration: Reflect|
000039e0  20 72 65 73 75 6c 74 20  6f 66 20 6f 70 65 72 61  | result of opera|
000039f0  6e 64 20 6f 6e 65 20 41  4e 44 20 6f 70 65 72 61  |nd one AND opera|
00003a00  6e 64 20 74 77 6f 0a 46  6c 61 67 73 3a 20 4e 2c  |nd two.Flags: N,|
00003a10  5a 2c 28 43 29 0a 23 77  72 61 70 20 6f 6e 0a 23  |Z,(C).#wrap on.#|
00003a20  6c 69 6e 65 0a 54 68 69  73 20 69 6e 73 74 72 75  |line.This instru|
00003a30  63 74 69 6f 6e 20 70 65  72 66 6f 72 6d 73 20 74  |ction performs t|
00003a40  68 65 20 6c 6f 67 69 63  61 6c 20 62 69 74 77 69  |he logical bitwi|
00003a50  73 65 20 41 4e 44 69 6e  67 20 6f 66 20 6f 70 65  |se ANDing of ope|
00003a60  72 61 6e 64 73 20 6f 6e  65 20 61 6e 64 20 74 77  |rands one and tw|
00003a70  6f 2c 20 62 75 74 20 64  6f 65 73 20 6e 6f 74 20  |o, but does not |
00003a80  73 74 6f 72 65 20 74 68  65 20 72 65 73 75 6c 74  |store the result|
00003a90  20 61 6e 79 77 68 65 72  65 20 2d 20 69 6e 73 74  | anywhere - inst|
00003aa0  65 61 64 20 74 68 65 20  73 74 61 74 75 73 20 66  |ead the status f|
00003ab0  6c 61 67 73 20 61 72 65  20 61 6c 74 65 72 65 64  |lags are altered|
00003ac0  20 74 6f 20 72 65 66 6c  65 63 74 20 74 68 65 20  | to reflect the |
00003ad0  72 65 73 75 6c 74 2e 0a  23 6c 69 6e 65 0a 54 53  |result..#line.TS|
00003ae0  54 20 63 61 6e 20 62 65  20 75 73 65 64 20 74 6f  |T can be used to|
00003af0  20 73 65 65 20 69 66 20  61 20 70 61 72 74 69 63  | see if a partic|
00003b00  75 6c 61 72 20 62 69 74  20 69 6e 20 61 20 64 61  |ular bit in a da|
00003b10  74 61 20 77 6f 72 64 20  69 73 20 73 65 74 20 6f  |ta word is set o|
00003b20  72 20 63 6c 65 61 72 2e  20 54 68 65 20 64 61 74  |r clear. The dat|
00003b30  61 20 77 6f 72 64 20 66  6f 72 6d 73 20 6f 6e 65  |a word forms one|
00003b40  20 6f 70 65 72 61 6e 64  2e 20 41 20 62 69 74 20  | operand. A bit |
00003b50  6d 61 73 6b 2c 20 69 6e  20 77 68 69 63 68 20 74  |mask, in which t|
00003b60  68 65 20 61 70 70 72 6f  70 72 69 61 74 65 20 62  |he appropriate b|
00003b70  69 74 20 69 73 20 65 74  2c 20 66 6f 72 6d 73 20  |it is et, forms |
00003b80  74 68 65 20 6f 74 68 65  72 20 6f 70 65 72 61 6e  |the other operan|
00003b90  64 2e 20 41 66 74 65 72  20 74 68 65 20 54 53 54  |d. After the TST|
00003ba0  20 6f 70 65 72 61 74 69  6f 6e 20 74 68 65 20 5a  | operation the Z|
00003bb0  20 66 6c 61 67 20 77 69  6c 6c 20 62 65 20 73 65  | flag will be se|
00003bc0  74 20 69 66 20 74 68 65  20 62 69 74 20 69 73 20  |t if the bit is |
00003bd0  73 65 74 20 69 6e 20 74  68 65 20 64 61 74 61 20  |set in the data |
00003be0  77 6f 72 64 2c 20 63 6c  65 61 72 20 69 66 20 69  |word, clear if i|
00003bf0  74 20 69 73 20 6e 6f 74  2e 0a 23 6c 69 6e 65 0a  |t is not..#line.|
00003c00  45 78 61 6d 70 6c 65 73  3a 0a 23 77 72 61 70 20  |Examples:.#wrap |
00003c10  6f 66 66 0a 23 49 6e 64  65 6e 74 20 32 0a 54 53  |off.#Indent 2.TS|
00003c20  54 09 52 31 2c 23 25 31  30 30 30 09 54 65 73 74  |T.R1,#%1000.Test|
00003c30  20 74 6f 20 73 65 65 20  69 66 20 62 69 74 20 33  | to see if bit 3|
00003c40  20 69 73 20 73 65 74 20  69 6e 20 52 31 0a 54 53  | is set in R1.TS|
00003c50  54 09 52 33 2c 52 34 09  09 54 65 73 74 20 69 66  |T.R3,R4..Test if|
00003c60  20 61 6e 79 20 62 69 74  73 20 73 65 74 20 69 6e  | any bits set in|
00003c70  20 62 6f 74 68 20 52 33  20 61 6e 64 20 52 34 0a  | both R3 and R4.|
00003c80  23 49 6e 64 65 6e 74 0a  23 77 72 61 70 20 6f 6e  |#Indent.#wrap on|
00003c90  0a 2a 4e 6f 74 65 2a 3a  20 54 68 69 73 20 69 73  |.*Note*: This is|
00003ca0  20 61 6e 6f 74 68 65 72  20 69 6e 73 74 72 75 63  | another instruc|
00003cb0  74 69 6f 6e 20 77 68 65  72 65 20 74 68 65 20 53  |tion where the S|
00003cc0  20 73 75 66 66 69 78 20  69 73 20 69 6d 70 6c 69  | suffix is impli|
00003cd0  65 64 2e 00 44 41 54 41  02 03 00 00 54 45 51 3a  |ed..DATA....TEQ:|
00003ce0  20 54 65 73 74 20 45 71  75 69 76 61 6c 65 6e 63  | Test Equivalenc|
00003cf0  65 0a 23 62 61 63 6b 67  72 6f 75 6e 64 20 77 69  |e.#background wi|
00003d00  6d 70 20 31 0a 23 77 72  61 70 20 6f 66 66 0a 53  |mp 1.#wrap off.S|
00003d10  79 6e 74 61 78 3a 20 54  45 51 20 5c 7b 5c 3c 73  |yntax: TEQ \{\<s|
00003d20  75 66 66 69 78 5c 3e 5c  7d 20 5c 3c 6f 70 65 72  |uffix\>\} \<oper|
00003d30  61 6e 64 31 5c 3e 2c 20  5c 3c 6f 70 65 72 61 6e  |and1\>, \<operan|
00003d40  64 32 5c 3e 0a 4f 70 65  72 61 74 69 6f 6e 3a 20  |d2\>.Operation: |
00003d50  52 65 66 6c 65 63 74 20  72 65 73 75 6c 74 20 6f  |Reflect result o|
00003d60  66 20 6f 70 65 72 61 6e  64 20 6f 6e 65 20 45 4f  |f operand one EO|
00003d70  52 20 6f 70 65 72 61 6e  64 20 74 77 6f 0a 46 6c  |R operand two.Fl|
00003d80  61 67 73 3a 20 4e 2c 5a  2c 28 43 29 0a 23 77 72  |ags: N,Z,(C).#wr|
00003d90  61 70 20 6f 6e 0a 23 6c  69 6e 65 0a 54 68 69 73  |ap on.#line.This|
00003da0  20 69 6e 73 74 72 75 63  74 69 6f 6e 20 69 73 20  | instruction is |
00003db0  76 65 72 79 20 73 69 6d  69 6c 61 72 20 74 6f 20  |very similar to |
00003dc0  3c 54 53 54 3e 2e 20 54  68 65 20 6f 6e 6c 79 20  |<TST>. The only |
00003dd0  64 69 66 66 65 72 65 6e  63 65 20 69 73 20 74 68  |difference is th|
00003de0  61 74 20 69 74 20 70 65  72 66 6f 72 6d 73 20 61  |at it performs a|
00003df0  20 6e 6f 74 69 6f 6e 61  6c 20 45 4f 52 20 6f 70  | notional EOR op|
00003e00  65 72 61 74 69 6f 6e 20  62 65 74 77 65 65 6e 20  |eration between |
00003e10  69 74 73 20 6f 70 65 72  61 6e 64 73 2c 20 69 6e  |its operands, in|
00003e20  73 74 65 61 64 20 6f 66  20 61 6e 20 41 4e 44 2e  |stead of an AND.|
00003e30  20 54 68 65 20 54 45 51  20 69 6e 73 74 72 75 63  | The TEQ instruc|
00003e40  74 69 6f 6e 20 63 61 6e  20 62 65 20 75 73 65 64  |tion can be used|
00003e50  20 74 6f 20 73 65 65 20  69 66 20 74 68 65 20 62  | to see if the b|
00003e60  69 74 73 20 69 6e 20 74  77 6f 20 64 61 74 61 20  |its in two data |
00003e70  77 6f 72 64 73 20 61 72  65 20 74 68 65 20 73 61  |words are the sa|
00003e80  6d 65 20 6f 72 20 6e 6f  74 2e 0a 23 6c 69 6e 65  |me or not..#line|
00003e90  0a 54 68 69 73 20 63 6f  6d 70 61 72 69 73 6f 6e  |.This comparison|
00003ea0  20 77 6f 75 6c 64 20 6e  6f 72 6d 61 6c 6c 79 20  | would normally |
00003eb0  62 65 20 70 65 72 66 6f  72 6d 65 64 20 75 73 69  |be performed usi|
00003ec0  6e 67 20 3c 43 4d 50 3e  2e 20 48 6f 77 65 76 65  |ng <CMP>. Howeve|
00003ed0  72 20 54 45 51 20 64 6f  65 73 20 6e 6f 74 20 61  |r TEQ does not a|
00003ee0  66 66 65 63 74 20 74 68  65 20 63 61 72 72 79 20  |ffect the carry |
00003ef0  66 6c 61 67 2c 20 77 68  69 63 68 20 6d 61 79 20  |flag, which may |
00003f00  73 6f 6d 65 74 69 6d 65  73 20 62 65 20 75 73 65  |sometimes be use|
00003f10  66 75 6c 2e 0a 23 6c 69  6e 65 0a 45 78 61 6d 70  |ful..#line.Examp|
00003f20  6c 65 73 3a 0a 23 77 72  61 70 20 6f 66 66 0a 23  |les:.#wrap off.#|
00003f30  49 6e 64 65 6e 74 20 32  0a 54 45 51 09 52 31 2c  |Indent 2.TEQ.R1,|
00003f40  23 35 09 09 54 65 73 74  20 74 6f 20 73 65 65 20  |#5..Test to see |
00003f50  69 66 20 52 31 20 63 6f  6e 74 61 69 6e 73 20 35  |if R1 contains 5|
00003f60  0a 54 45 51 09 52 33 2c  52 34 09 09 54 65 73 74  |.TEQ.R3,R4..Test|
00003f70  20 74 6f 20 73 65 65 20  69 66 20 52 33 20 3d 20  | to see if R3 = |
00003f80  52 34 0a 23 49 6e 64 65  6e 74 0a 23 77 72 61 70  |R4.#Indent.#wrap|
00003f90  20 6f 6e 0a 2a 4e 6f 74  65 2a 3a 20 54 68 69 73  | on.*Note*: This|
00003fa0  20 69 73 20 61 6e 6f 74  68 65 72 20 69 6e 73 74  | is another inst|
00003fb0  72 75 63 74 69 6f 6e 20  77 68 65 72 65 20 74 68  |ruction where th|
00003fc0  65 20 53 20 73 75 66 66  69 78 20 69 73 20 69 6d  |e S suffix is im|
00003fd0  70 6c 69 65 64 2e 00 00  44 41 54 41 6b 03 00 00  |plied...DATAk...|
00003fe0  4d 4c 41 3a 20 4d 75 6c  74 69 70 6c 69 63 61 74  |MLA: Multiplicat|
00003ff0  69 6f 6e 20 77 69 74 68  20 41 63 63 75 6d 75 6c  |ion with Accumul|
00004000  61 74 65 0a 23 62 61 63  6b 67 72 6f 75 6e 64 20  |ate.#background |
00004010  77 69 6d 70 20 31 0a 23  77 72 61 70 20 6f 66 66  |wimp 1.#wrap off|
00004020  0a 53 79 6e 74 61 78 3a  20 4d 4c 41 20 5c 7b 5c  |.Syntax: MLA \{\|
00004030  3c 73 75 66 66 69 78 5c  3e 5c 7d 20 5c 3c 64 65  |<suffix\>\} \<de|
00004040  73 74 69 6e 61 74 69 6f  6e 5c 3e 2c 20 5c 3c 6f  |stination\>, \<o|
00004050  70 65 72 61 6e 64 31 5c  3e 2c 20 5c 3c 6f 70 65  |perand1\>, \<ope|
00004060  72 61 6e 64 32 5c 3e 2c  20 5c 3c 73 75 6d 5c 3e  |rand2\>, \<sum\>|
00004070  0a 4f 70 65 72 61 74 69  6f 6e 3a 20 64 65 73 74  |.Operation: dest|
00004080  69 6e 61 74 69 6f 6e 20  3d 20 28 6f 70 65 72 61  |ination = (opera|
00004090  6e 64 20 6f 6e 65 20 2a  20 6f 70 65 72 61 6e 64  |nd one * operand|
000040a0  20 74 77 6f 29 20 2b 20  73 75 6d 0a 46 6c 61 67  | two) + sum.Flag|
000040b0  73 3a 20 4e 2c 5a 20 5b  56 20 2d 20 75 6e 63 68  |s: N,Z [V - unch|
000040c0  61 6e 67 65 64 3b 20 43  20 2d 20 75 6e 64 65 66  |anged; C - undef|
000040d0  69 6e 65 64 5d 0a 23 77  72 61 70 20 6f 6e 0a 23  |ined].#wrap on.#|
000040e0  6c 69 6e 65 0a 54 68 69  73 20 69 6e 73 74 72 75  |line.This instru|
000040f0  63 74 69 6f 6e 20 69 73  20 73 69 6d 69 6c 61 72  |ction is similar|
00004100  20 74 6f 20 3c 4d 55 4c  3e 2c 20 74 68 65 20 64  | to <MUL>, the d|
00004110  69 66 66 65 72 65 6e 63  65 20 62 65 69 6e 67 20  |ifference being |
00004120  74 68 61 74 20 74 68 65  20 63 6f 6e 74 65 6e 74  |that the content|
00004130  73 20 6f 66 20 74 68 65  20 72 65 67 69 73 74 65  |s of the registe|
00004140  72 20 67 69 76 65 6e 20  69 6e 20 74 68 65 20 73  |r given in the s|
00004150  75 6d 20 66 69 65 6c 64  20 61 72 65 20 61 64 64  |um field are add|
00004160  65 64 20 69 6e 74 6f 20  74 68 65 20 72 65 73 75  |ed into the resu|
00004170  6c 74 20 6f 66 20 74 68  65 20 6d 75 6c 74 69 70  |lt of the multip|
00004180  6c 69 63 61 74 69 6f 6e  20 62 65 66 6f 72 65 20  |lication before |
00004190  73 74 6f 72 69 6e 67 20  69 74 20 69 6e 20 74 68  |storing it in th|
000041a0  65 20 64 65 73 74 69 6e  61 74 69 6f 6e 20 72 65  |e destination re|
000041b0  67 69 73 74 65 72 2e 20  54 68 65 20 72 65 73 74  |gister. The rest|
000041c0  72 69 63 74 69 6f 6e 73  20 77 68 69 63 68 20 61  |rictions which a|
000041d0  70 70 6c 79 20 74 6f 20  3c 4d 55 4c 3e 20 61 6c  |pply to <MUL> al|
000041e0  73 6f 20 61 70 70 6c 79  20 74 6f 20 4d 4c 41 2e  |so apply to MLA.|
000041f0  0a 23 6c 69 6e 65 0a 4d  4c 41 20 69 73 20 75 73  |.#line.MLA is us|
00004200  65 64 20 74 6f 20 6b 65  65 70 20 61 20 72 75 6e  |ed to keep a run|
00004210  6e 69 6e 67 20 74 6f 74  61 6c 20 6f 66 20 61 20  |ning total of a |
00004220  73 65 72 69 65 73 20 6f  66 20 6d 75 6c 74 69 70  |series of multip|
00004230  6c 69 63 61 74 69 6f 6e  73 2e 20 49 66 20 74 68  |lications. If th|
00004240  65 20 73 75 6d 20 72 65  67 69 73 74 65 72 20 69  |e sum register i|
00004250  73 20 73 70 65 63 69 66  69 65 64 20 61 73 20 62  |s specified as b|
00004260  65 69 6e 67 20 74 68 65  20 73 61 6d 65 20 61 73  |eing the same as|
00004270  20 74 68 65 20 64 65 73  74 69 6e 61 74 69 6f 6e  | the destination|
00004280  2c 20 74 68 65 6e 20 74  68 65 20 72 65 73 75 6c  |, then the resul|
00004290  74 20 6f 66 20 65 61 63  68 20 6d 75 6c 74 69 70  |t of each multip|
000042a0  6c 69 63 61 74 69 6f 6e  20 77 69 6c 6c 20 62 65  |lication will be|
000042b0  20 61 63 63 75 6d 75 6c  61 74 65 64 20 69 6e 20  | accumulated in |
000042c0  74 68 65 20 64 65 73 74  69 6e 61 74 69 6f 6e 20  |the destination |
000042d0  72 65 67 69 73 74 65 72  2e 0a 23 6c 69 6e 65 0a  |register..#line.|
000042e0  45 78 61 6d 70 6c 65 73  3a 0a 23 49 6e 64 65 6e  |Examples:.#Inden|
000042f0  74 20 32 0a 4d 4c 41 09  52 30 2c 52 31 2c 52 32  |t 2.MLA.R0,R1,R2|
00004300  2c 52 33 09 52 30 20 3d  20 28 52 31 20 2a 20 52  |,R3.R0 = (R1 * R|
00004310  32 29 20 2b 20 52 33 0a  4d 4c 41 09 52 30 2c 52  |2) + R3.MLA.R0,R|
00004320  31 2c 52 32 2c 52 30 09  52 30 20 3d 20 28 52 31  |1,R2,R0.R0 = (R1|
00004330  20 2a 20 52 32 29 20 2b  20 52 30 0a 23 49 6e 64  | * R2) + R0.#Ind|
00004340  65 6e 74 00 44 41 54 41  c0 02 00 00 4d 55 4c 3a  |ent.DATA....MUL:|
00004350  20 4d 75 6c 74 69 70 6c  69 63 61 74 69 6f 6e 0a  | Multiplication.|
00004360  23 62 61 63 6b 67 72 6f  75 6e 64 20 77 69 6d 70  |#background wimp|
00004370  20 31 0a 23 77 72 61 70  20 6f 66 66 0a 53 79 6e  | 1.#wrap off.Syn|
00004380  74 61 78 3a 20 4d 55 4c  20 5c 7b 5c 3c 73 75 66  |tax: MUL \{\<suf|
00004390  66 69 78 5c 3e 5c 7d 20  5c 3c 64 65 73 74 69 6e  |fix\>\} \<destin|
000043a0  61 74 69 6f 6e 5c 3e 2c  20 5c 3c 6f 70 65 72 61  |ation\>, \<opera|
000043b0  6e 64 31 5c 3e 2c 20 5c  3c 6f 70 65 72 61 6e 64  |nd1\>, \<operand|
000043c0  32 5c 3e 0a 4f 70 65 72  61 74 69 6f 6e 3a 20 64  |2\>.Operation: d|
000043d0  65 73 74 69 6e 61 74 69  6f 6e 20 3d 20 6f 70 65  |estination = ope|
000043e0  72 61 6e 64 20 6f 6e 65  20 2a 20 6f 70 65 72 61  |rand one * opera|
000043f0  6e 64 20 74 77 6f 0a 46  6c 61 67 73 3a 20 4e 2c  |nd two.Flags: N,|
00004400  5a 20 5b 56 20 2d 20 75  6e 63 68 61 6e 67 65 64  |Z [V - unchanged|
00004410  3b 20 43 20 2d 20 75 6e  64 65 66 69 6e 65 64 5d  |; C - undefined]|
00004420  0a 23 77 72 61 70 20 6f  6e 0a 23 6c 69 6e 65 0a  |.#wrap on.#line.|
00004430  54 68 69 73 20 69 6e 73  74 72 75 63 74 69 6f 6e  |This instruction|
00004440  20 70 65 72 66 6f 72 6d  73 20 33 32 2d 62 69 74  | performs 32-bit|
00004450  20 6d 75 6c 74 69 70 6c  69 63 61 74 69 6f 6e 20  | multiplication |
00004460  6f 66 20 74 68 65 20 74  77 6f 20 6f 70 65 72 61  |of the two opera|
00004470  6e 64 73 2c 20 77 69 74  68 20 74 68 65 20 72 65  |nds, with the re|
00004480  73 75 6c 74 20 62 65 69  6e 67 20 73 74 6f 72 65  |sult being store|
00004490  64 20 69 6e 20 74 68 65  20 64 65 73 74 69 6e 61  |d in the destina|
000044a0  74 69 6f 6e 20 72 65 67  69 73 74 65 72 2e 0a 23  |tion register..#|
000044b0  6c 69 6e 65 0a 54 68 65  72 65 20 61 72 65 20 63  |line.There are c|
000044c0  65 72 74 61 69 6e 20 72  65 73 74 72 69 63 74 69  |ertain restricti|
000044d0  6f 6e 73 20 61 73 73 6f  63 69 61 74 65 64 20 77  |ons associated w|
000044e0  69 74 68 20 74 68 65 20  75 73 65 20 6f 66 20 74  |ith the use of t|
000044f0  68 69 73 20 69 6e 73 74  72 75 63 74 69 6f 6e 3a  |his instruction:|
00004500  0a 23 77 72 61 70 20 6f  66 66 0a 23 49 6e 64 65  |.#wrap off.#Inde|
00004510  6e 74 20 32 0a 2d 20 54  68 65 20 33 20 64 61 74  |nt 2.- The 3 dat|
00004520  61 20 66 69 65 6c 64 73  20 73 70 65 63 69 66 69  |a fields specifi|
00004530  65 64 20 6d 75 73 74 20  62 65 20 73 69 6d 70 6c  |ed must be simpl|
00004540  65 20 72 65 67 69 73 74  65 72 73 0a 2d 20 54 68  |e registers.- Th|
00004550  65 20 64 65 73 74 69 6e  61 74 69 6f 6e 20 61 6e  |e destination an|
00004560  64 20 6f 70 65 72 61 6e  64 31 20 6d 75 73 74 20  |d operand1 must |
00004570  62 65 20 64 69 66 66 65  72 65 6e 74 20 72 65 67  |be different reg|
00004580  69 73 74 65 72 73 0a 2d  20 52 31 35 20 6d 61 79  |isters.- R15 may|
00004590  20 6e 6f 74 20 62 65 20  75 73 65 64 20 61 73 20  | not be used as |
000045a0  74 68 65 20 64 65 73 74  69 6e 61 74 69 6f 6e 20  |the destination |
000045b0  72 65 67 69 73 74 65 72  0a 23 49 6e 64 65 6e 74  |register.#Indent|
000045c0  0a 23 77 72 61 70 20 6f  6e 0a 23 6c 69 6e 65 0a  |.#wrap on.#line.|
000045d0  45 78 61 6d 70 6c 65 3a  0a 23 49 6e 64 65 6e 74  |Example:.#Indent|
000045e0  20 32 0a 4d 55 4c 09 52  30 2c 52 31 2c 52 33 09  | 2.MUL.R0,R1,R3.|
000045f0  52 30 20 3d 20 52 31 20  2a 20 52 33 0a 23 49 6e  |R0 = R1 * R3.#In|
00004600  64 65 6e 74 44 41 54 41  b3 02 00 00 53 57 49 3a  |dentDATA....SWI:|
00004610  20 53 6f 66 74 77 61 72  65 20 49 6e 74 65 72 72  | Software Interr|
00004620  75 70 74 0a 23 62 61 63  6b 67 72 6f 75 6e 64 20  |upt.#background |
00004630  77 69 6d 70 20 31 0a 23  77 72 61 70 20 6f 66 66  |wimp 1.#wrap off|
00004640  0a 53 79 6e 74 61 78 3a  20 53 57 49 20 5c 3c 61  |.Syntax: SWI \<a|
00004650  72 67 75 6d 65 6e 74 5c  3e 20 0a 23 77 72 61 70  |rgument\> .#wrap|
00004660  20 6f 6e 0a 23 6c 69 6e  65 0a 57 68 65 6e 20 65  | on.#line.When e|
00004670  78 65 63 75 74 65 64 2c  20 74 68 69 73 20 69 6e  |xecuted, this in|
00004680  73 74 72 75 63 74 69 6f  6e 20 63 61 75 73 65 73  |struction causes|
00004690  20 74 68 65 20 70 72 6f  63 65 73 73 6f 72 20 74  | the processor t|
000046a0  6f 20 62 72 65 61 6b 20  6f 66 66 20 66 72 6f 6d  |o break off from|
000046b0  20 74 68 65 20 63 75 72  72 65 6e 74 20 70 72 6f  | the current pro|
000046c0  67 72 61 6d 2e 20 54 68  65 20 41 52 4d 20 73 77  |gram. The ARM sw|
000046d0  69 74 63 68 65 73 20 69  6e 74 6f 20 73 75 70 65  |itches into supe|
000046e0  72 76 69 73 6f 72 20 6d  6f 64 65 20 61 6e 64 20  |rvisor mode and |
000046f0  6a 75 6d 70 73 20 74 6f  20 61 20 70 72 65 2d 64  |jumps to a pre-d|
00004700  65 66 69 6e 65 64 20 61  64 64 72 65 73 73 20 69  |efined address i|
00004710  6e 20 74 68 65 20 4f 53  2e 20 54 68 65 20 61 72  |n the OS. The ar|
00004720  67 75 6d 65 6e 74 20 66  69 65 6c 64 20 69 73 20  |gument field is |
00004730  74 68 65 6e 20 65 78 61  6d 69 6e 65 64 20 74 6f  |then examined to|
00004740  20 64 65 74 65 72 6d 69  6e 65 20 77 68 69 63 68  | determine which|
00004750  20 6f 66 20 74 68 65 20  6d 61 6e 79 20 4f 53 20  | of the many OS |
00004760  66 61 63 69 6c 69 74 69  65 73 20 68 61 73 20 62  |facilities has b|
00004770  65 65 6e 20 72 65 71 75  65 73 74 65 64 2e 20 57  |een requested. W|
00004780  68 65 6e 20 74 68 65 20  61 70 70 72 6f 70 72 69  |hen the appropri|
00004790  61 74 65 20 72 6f 75 74  69 6e 65 20 68 61 73 20  |ate routine has |
000047a0  62 65 65 6e 20 63 6f 6d  70 6c 65 74 65 64 2c 20  |been completed, |
000047b0  74 68 65 20 41 52 4d 20  72 65 73 75 6d 65 73 20  |the ARM resumes |
000047c0  74 68 65 20 65 78 65 63  75 74 69 6f 6e 20 6f 66  |the execution of|
000047d0  20 74 68 65 20 75 73 65  72 20 70 72 6f 67 72 61  | the user progra|
000047e0  6d 20 77 68 65 72 65 20  69 74 20 6c 65 66 74 20  |m where it left |
000047f0  6f 66 66 2e 0a 23 6c 69  6e 65 0a 45 78 61 6d 70  |off..#line.Examp|
00004800  6c 65 73 3a 0a 23 49 6e  64 65 6e 74 20 32 0a 53  |les:.#Indent 2.S|
00004810  57 49 09 22 4f 53 5f 4d  6f 75 73 65 22 0a 53 57  |WI."OS_Mouse".SW|
00004820  49 09 22 57 69 6d 70 5f  43 72 65 61 74 65 57 69  |I."Wimp_CreateWi|
00004830  6e 64 6f 77 22 0a 23 49  6e 64 65 6e 74 0a 2a 4e  |ndow".#Indent.*N|
00004840  6f 74 65 2a 3a 20 54 68  65 20 6e 61 6d 65 20 6f  |ote*: The name o|
00004850  66 20 74 68 65 20 72 6f  75 74 69 6e 65 20 6d 75  |f the routine mu|
00004860  73 74 20 6d 61 74 63 68  20 75 70 20 77 69 74 68  |st match up with|
00004870  20 74 68 61 74 20 72 65  63 6f 67 6e 69 73 65 64  | that recognised|
00004880  20 62 79 20 74 68 65 20  61 73 73 65 6d 62 6c 65  | by the assemble|
00004890  72 20 69 6e 63 6c 75 64  69 6e 67 20 74 68 65 20  |r including the |
000048a0  63 61 73 65 20 6f 66 20  65 61 63 68 20 63 68 61  |case of each cha|
000048b0  72 61 63 74 65 72 2e 00  44 41 54 41 47 02 00 00  |racter..DATAG...|
000048c0  42 3a 20 53 69 6d 70 6c  65 20 42 72 61 6e 63 68  |B: Simple Branch|
000048d0  0a 23 62 61 63 6b 67 72  6f 75 6e 64 20 77 69 6d  |.#background wim|
000048e0  70 20 31 0a 23 77 72 61  70 20 6f 66 66 0a 53 79  |p 1.#wrap off.Sy|
000048f0  6e 74 61 78 3a 20 42 20  5c 3c 61 64 64 72 65 73  |ntax: B \<addres|
00004900  73 5c 3e 0a 4f 70 65 72  61 74 69 6f 6e 3a 20 4a  |s\>.Operation: J|
00004910  75 6d 70 20 74 6f 20 73  70 65 63 69 66 69 65 64  |ump to specified|
00004920  20 61 64 64 72 65 73 73  0a 23 77 72 61 70 20 6f  | address.#wrap o|
00004930  6e 0a 23 6c 69 6e 65 0a  54 68 69 73 20 69 6e 73  |n.#line.This ins|
00004940  74 72 75 63 74 69 6f 6e  20 69 73 20 61 6e 61 6c  |truction is anal|
00004950  6f 67 6f 75 73 20 74 6f  20 74 68 65 20 42 41 53  |ogous to the BAS|
00004960  49 43 20 47 4f 54 4f 20  73 74 61 74 65 6d 65 6e  |IC GOTO statemen|
00004970  74 20 2d 20 69 74 20 6d  61 6b 65 73 20 74 68 65  |t - it makes the|
00004980  20 70 72 6f 63 65 73 73  6f 72 20 62 72 65 61 6b  | processor break|
00004990  20 6f 66 66 20 66 72 6f  6d 20 69 74 73 20 6e 6f  | off from its no|
000049a0  72 6d 61 6c 20 73 65 71  75 65 6e 74 69 61 6c 20  |rmal sequential |
000049b0  65 78 65 63 75 74 69 6f  6e 20 6f 66 20 69 6e 73  |execution of ins|
000049c0  74 72 75 63 74 69 6f 6e  73 20 61 6e 64 20 6a 75  |tructions and ju|
000049d0  6d 70 20 74 6f 20 61 20  6e 65 77 20 69 6e 73 74  |mp to a new inst|
000049e0  72 75 63 74 69 6f 6e 20  61 74 20 61 20 64 65 73  |ruction at a des|
000049f0  69 67 6e 61 74 65 64 20  6c 6f 63 61 74 69 6f 6e  |ignated location|
00004a00  2e 0a 23 6c 69 6e 65 0a  57 68 65 6e 20 75 73 65  |..#line.When use|
00004a10  64 20 69 6e 20 63 6f 6e  6a 75 6e 63 74 69 6f 6e  |d in conjunction|
00004a20  20 77 69 74 68 20 74 68  65 20 6e 6f 72 6d 61 6c  | with the normal|
00004a30  20 63 6f 6e 64 69 74 69  6f 6e 20 63 6f 64 65 73  | condition codes|
00004a40  2c 20 74 68 69 73 20 69  6e 73 74 72 75 63 74 69  |, this instructi|
00004a50  6f 6e 20 62 65 63 6f 6d  65 73 20 74 68 65 20 62  |on becomes the b|
00004a60  61 73 69 73 20 6f 66 20  63 6f 6e 64 69 74 69 6f  |asis of conditio|
00004a70  6e 61 6c 20 62 72 61 6e  63 68 69 6e 67 2e 0a 23  |nal branching..#|
00004a80  6c 69 6e 65 0a 45 78 61  6d 70 6c 65 3a 0a 23 49  |line.Example:.#I|
00004a90  6e 64 65 6e 74 20 32 0a  2e 6c 6f 6f 70 0a 53 55  |ndent 2..loop.SU|
00004aa0  42 09 52 30 2c 52 30 2c  23 31 09 52 30 20 3d 20  |B.R0,R0,#1.R0 = |
00004ab0  52 30 20 2d 20 31 0a 43  4d 50 09 52 30 2c 23 30  |R0 - 1.CMP.R0,#0|
00004ac0  09 09 69 73 20 52 30 20  3d 20 30 3f 0a 42 4e 45  |..is R0 = 0?.BNE|
00004ad0  09 6c 6f 6f 70 09 09 69  66 20 6e 6f 74 2c 20 67  |.loop..if not, g|
00004ae0  6f 20 62 61 63 6b 20 74  6f 20 73 74 61 72 74 20  |o back to start |
00004af0  6f 66 20 6c 6f 6f 70 0a  23 49 6e 64 65 6e 74 00  |of loop.#Indent.|
00004b00  44 41 54 41 b6 04 00 00  42 4c 3a 20 42 72 61 6e  |DATA....BL: Bran|
00004b10  63 68 20 77 69 74 68 20  4c 69 6e 6b 0a 23 62 61  |ch with Link.#ba|
00004b20  63 6b 67 72 6f 75 6e 64  20 77 69 6d 70 20 31 0a  |ckground wimp 1.|
00004b30  23 77 72 61 70 20 6f 66  66 0a 53 79 6e 74 61 78  |#wrap off.Syntax|
00004b40  3a 20 42 4c 20 5c 3c 61  64 64 72 65 73 73 5c 3e  |: BL \<address\>|
00004b50  0a 4f 70 65 72 61 74 69  6f 6e 3a 20 5b 4d 4f 56  |.Operation: [MOV|
00004b60  20 52 31 34 2c 50 43 5d  20 2b 20 4a 75 6d 70 20  | R14,PC] + Jump |
00004b70  74 6f 20 73 70 65 63 69  66 69 65 64 20 61 64 64  |to specified add|
00004b80  72 65 73 73 0a 23 77 72  61 70 20 6f 6e 0a 23 6c  |ress.#wrap on.#l|
00004b90  69 6e 65 0a 54 68 69 73  20 69 6e 73 74 72 75 63  |ine.This instruc|
00004ba0  74 69 6f 6e 20 69 73 20  61 6e 61 6c 6f 67 6f 75  |tion is analogou|
00004bb0  73 20 74 6f 20 74 68 65  20 42 41 53 49 43 20 47  |s to the BASIC G|
00004bc0  4f 53 55 42 20 73 74 61  74 65 6d 65 6e 74 20 2d  |OSUB statement -|
00004bd0  20 69 74 20 6d 61 6b 65  73 20 74 68 65 20 70 72  | it makes the pr|
00004be0  6f 63 65 73 73 6f 72 20  62 72 65 61 6b 20 6f 66  |ocessor break of|
00004bf0  66 20 66 72 6f 6d 20 69  74 73 20 6e 6f 72 6d 61  |f from its norma|
00004c00  6c 20 73 65 71 75 65 6e  74 69 61 6c 20 65 78 65  |l sequential exe|
00004c10  63 75 74 69 6f 6e 20 6f  66 20 69 6e 73 74 72 75  |cution of instru|
00004c20  63 74 69 6f 6e 73 20 61  6e 64 20 6a 75 6d 70 20  |ctions and jump |
00004c30  74 6f 20 61 20 6e 65 77  20 69 6e 73 74 72 75 63  |to a new instruc|
00004c40  74 69 6f 6e 20 61 74 20  61 20 64 65 73 69 67 6e  |tion at a design|
00004c50  61 74 65 64 20 6c 6f 63  61 74 69 6f 6e 2e 20 42  |ated location. B|
00004c60  79 20 6d 6f 76 69 6e 67  20 74 68 65 20 63 6f 6e  |y moving the con|
00004c70  74 65 6e 74 73 20 6f 66  20 52 31 34 20 62 61 63  |tents of R14 bac|
00004c80  6b 20 69 6e 74 6f 20 50  43 2c 20 77 65 20 63 61  |k into PC, we ca|
00004c90  6e 20 72 65 74 75 72 6e  20 74 6f 20 74 68 65 20  |n return to the |
00004ca0  6f 72 69 67 69 6e 61 6c  20 42 72 61 6e 63 68 20  |original Branch |
00004cb0  69 6e 73 74 72 75 63 74  69 6f 6e 2e 0a 23 6c 69  |instruction..#li|
00004cc0  6e 65 0a 57 68 65 6e 20  75 73 65 64 20 69 6e 20  |ne.When used in |
00004cd0  63 6f 6e 6a 75 6e 63 74  69 6f 6e 20 77 69 74 68  |conjunction with|
00004ce0  20 74 68 65 20 6e 6f 72  6d 61 6c 20 63 6f 6e 64  | the normal cond|
00004cf0  69 74 69 6f 6e 20 63 6f  64 65 73 2c 20 74 68 69  |ition codes, thi|
00004d00  73 20 69 6e 73 74 72 75  63 74 69 6f 6e 20 62 65  |s instruction be|
00004d10  63 6f 6d 65 73 20 74 68  65 20 62 61 73 69 73 20  |comes the basis |
00004d20  6f 66 20 63 6f 6e 64 69  74 69 6f 6e 61 6c 20 62  |of conditional b|
00004d30  72 61 6e 63 68 69 6e 67  2e 0a 23 6c 69 6e 65 0a  |ranching..#line.|
00004d40  45 78 61 6d 70 6c 65 3a  0a 23 49 6e 64 65 6e 74  |Example:.#Indent|
00004d50  20 32 0a 2e 6c 6f 6f 70  0a 53 55 42 09 52 30 2c  | 2..loop.SUB.R0,|
00004d60  52 30 2c 23 31 09 52 30  20 3d 20 52 30 20 2d 20  |R0,#1.R0 = R0 - |
00004d70  31 0a 43 4d 50 09 52 30  2c 23 30 09 09 69 73 20  |1.CMP.R0,#0..is |
00004d80  52 30 20 3d 20 30 3f 0a  42 4e 45 09 6c 6f 6f 70  |R0 = 0?.BNE.loop|
00004d90  09 09 69 66 20 6e 6f 74  2c 20 67 6f 20 62 61 63  |..if not, go bac|
00004da0  6b 20 74 6f 20 73 74 61  72 74 20 6f 66 20 6c 6f  |k to start of lo|
00004db0  6f 70 0a 42 4c 09 73 75  62 72 6f 75 74 69 6e 65  |op.BL.subroutine|
00004dc0  09 6f 74 68 65 72 77 69  73 65 2c 20 67 6f 20 74  |.otherwise, go t|
00004dd0  6f 20 73 75 62 72 6f 75  74 69 6e 65 0a 2e 2e 2e  |o subroutine....|
00004de0  0a 2e 73 75 62 72 6f 75  74 69 6e 65 0a 4d 4f 56  |..subroutine.MOV|
00004df0  20 50 43 2c 52 31 34 09  09 72 65 74 75 72 6e 20  | PC,R14..return |
00004e00  74 6f 20 6d 61 69 6e 20  63 6f 64 65 0a 23 49 6e  |to main code.#In|
00004e10  64 65 6e 74 0a 23 6c 69  6e 65 3b 20 77 72 61 70  |dent.#line; wrap|
00004e20  20 6e 6f 6a 6f 69 6e 0a  2a 4e 6f 74 65 2a 3a 20  | nojoin.*Note*: |
00004e30  49 74 20 69 73 20 69 6d  70 6f 72 74 61 6e 74 20  |It is important |
00004e40  74 68 61 74 20 74 68 65  20 63 6f 6e 74 65 6e 74  |that the content|
00004e50  73 20 6f 66 20 52 31 34  20 61 72 65 20 73 74 6f  |s of R14 are sto|
00004e60  72 65 64 20 65 6c 73 65  77 68 65 72 65 20 70 72  |red elsewhere pr|
00004e70  69 6f 72 20 74 6f 20 75  73 69 6e 67 20 74 68 69  |ior to using thi|
00004e80  73 20 69 6e 73 74 72 75  63 74 69 6f 6e 2e 20 54  |s instruction. T|
00004e90  68 69 73 20 63 61 6e 20  62 65 20 64 6f 6e 65 20  |his can be done |
00004ea0  75 73 69 6e 67 20 61 20  3c 73 74 61 63 6b 3d 3e  |using a <stack=>|
00004eb0  73 74 61 63 6b 73 3e 2e  0a 54 68 65 20 63 6f 6d  |stacks>..The com|
00004ec0  6d 61 6e 64 20 27 4d 4f  56 20 50 43 2c 52 31 34  |mand 'MOV PC,R14|
00004ed0  27 20 77 69 6c 6c 20 6d  65 61 6e 20 74 68 61 74  |' will mean that|
00004ee0  20 74 68 65 20 6f 72 69  67 69 6e 61 6c 20 73 74  | the original st|
00004ef0  61 74 75 73 20 66 6c 61  67 20 73 65 74 74 69 6e  |atus flag settin|
00004f00  67 73 20 77 69 6c 6c 20  6e 6f 74 20 62 65 20 72  |gs will not be r|
00004f10  65 73 74 6f 72 65 64 20  6f 6e 63 65 20 74 68 65  |estored once the|
00004f20  20 73 75 62 72 6f 75 74  69 6e 65 20 68 61 73 20  | subroutine has |
00004f30  72 65 74 75 72 6e 65 64  2e 20 53 68 6f 75 6c 64  |returned. Should|
00004f40  20 74 68 65 20 75 73 65  72 20 77 61 6e 74 20 74  | the user want t|
00004f50  68 65 20 66 6c 61 67 73  20 74 6f 20 62 65 20 75  |he flags to be u|
00004f60  6e 61 66 66 65 63 74 65  64 20 62 79 20 74 68 65  |naffected by the|
00004f70  20 73 75 62 72 6f 75 74  69 6e 65 2c 20 74 68 65  | subroutine, the|
00004f80  20 63 6f 6d 6d 61 6e 64  20 73 68 6f 75 6c 64 20  | command should |
00004f90  62 65 20 6d 6f 64 69 66  69 65 64 20 74 6f 20 27  |be modified to '|
00004fa0  4d 4f 56 53 20 50 43 2c  52 31 34 27 2e 0a 23 77  |MOVS PC,R14'..#w|
00004fb0  72 61 70 20 6f 6e 00 00  44 41 54 41 fd 01 00 00  |rap on..DATA....|
00004fc0  4c 44 52 3a 20 4c 6f 61  64 20 74 6f 20 52 65 67  |LDR: Load to Reg|
00004fd0  69 73 74 65 72 0a 23 62  61 63 6b 67 72 6f 75 6e  |ister.#backgroun|
00004fe0  64 20 77 69 6d 70 20 31  0a 23 77 72 61 70 20 6f  |d wimp 1.#wrap o|
00004ff0  66 66 0a 4f 70 65 72 61  74 69 6f 6e 3a 20 44 61  |ff.Operation: Da|
00005000  74 61 20 74 72 61 6e 73  66 65 72 20 66 72 6f 6d  |ta transfer from|
00005010  20 6d 65 6d 6f 72 79 20  74 6f 20 74 68 65 20 72  | memory to the r|
00005020  65 67 69 73 74 65 72 73  0a 23 77 72 61 70 20 6f  |egisters.#wrap o|
00005030  6e 0a 23 6c 69 6e 65 0a  54 68 69 73 20 69 6e 73  |n.#line.This ins|
00005040  74 72 75 63 74 69 6f 6e  20 69 73 20 75 73 65 64  |truction is used|
00005050  20 74 6f 20 74 72 61 6e  73 66 65 72 20 64 61 74  | to transfer dat|
00005060  61 20 66 72 6f 6d 20 6d  65 6d 6f 72 79 20 69 6e  |a from memory in|
00005070  74 6f 20 74 68 65 20 72  65 67 69 73 74 65 72 73  |to the registers|
00005080  2e 20 41 20 73 79 73 74  65 6d 20 6f 66 20 69 6e  |. A system of in|
00005090  64 69 72 65 63 74 20 61  64 64 72 65 73 73 69 6e  |direct addressin|
000050a0  67 20 69 73 20 75 73 65  64 20 74 6f 20 73 70 65  |g is used to spe|
000050b0  63 69 66 79 20 74 68 65  20 73 6f 75 72 63 65 20  |cify the source |
000050c0  6c 6f 63 61 74 69 6f 6e  20 61 64 64 72 65 73 73  |location address|
000050d0  20 2d 20 74 68 65 20 61  64 64 72 65 73 73 20 74  | - the address t|
000050e0  6f 20 62 65 20 6c 6f 6f  6b 65 64 20 75 70 20 69  |o be looked up i|
000050f0  73 20 68 65 6c 64 20 69  6e 20 61 20 72 65 67 69  |s held in a regi|
00005100  73 74 65 72 2e 0a 54 68  65 72 65 20 61 72 65 20  |ster..There are |
00005110  74 77 6f 20 66 6f 72 6d  73 20 6f 66 20 69 6e 64  |two forms of ind|
00005120  69 72 65 63 74 20 61 64  64 72 65 73 73 69 6e 67  |irect addressing|
00005130  3a 20 3c 50 72 65 2d 69  6e 64 65 78 65 64 3d 3e  |: <Pre-indexed=>|
00005140  50 72 65 3e 20 61 6e 64  20 3c 50 6f 73 74 2d 69  |Pre> and <Post-i|
00005150  6e 64 65 78 65 64 3d 3e  50 6f 73 74 3e 2e 20 49  |ndexed=>Post>. I|
00005160  6e 20 61 64 64 69 74 69  6f 6e 20 74 6f 20 74 68  |n addition to th|
00005170  65 73 65 20 74 77 6f 20  66 6f 72 6d 73 2c 20 61  |ese two forms, a|
00005180  20 3c 50 43 20 72 65 6c  61 74 69 76 65 3d 3e 50  | <PC relative=>P|
00005190  43 5f 72 65 6c 3e 20 61  64 64 72 65 73 73 20 63  |C_rel> address c|
000051a0  61 6e 20 61 6c 73 6f 20  62 65 20 73 70 65 63 69  |an also be speci|
000051b0  66 69 65 64 2e 00 00 00  44 41 54 41 05 02 00 00  |fied....DATA....|
000051c0  53 54 52 3a 20 53 74 6f  72 65 20 66 72 6f 6d 20  |STR: Store from |
000051d0  52 65 67 69 73 74 65 72  0a 23 62 61 63 6b 67 72  |Register.#backgr|
000051e0  6f 75 6e 64 20 77 69 6d  70 20 31 0a 23 77 72 61  |ound wimp 1.#wra|
000051f0  70 20 6f 66 66 0a 4f 70  65 72 61 74 69 6f 6e 3a  |p off.Operation:|
00005200  20 44 61 74 61 20 74 72  61 6e 73 66 65 72 20 66  | Data transfer f|
00005210  72 6f 6d 20 74 68 65 20  72 65 67 69 73 74 65 72  |rom the register|
00005220  73 20 74 6f 20 6d 65 6d  6f 72 79 0a 23 77 72 61  |s to memory.#wra|
00005230  70 20 6f 6e 0a 23 6c 69  6e 65 0a 54 68 69 73 20  |p on.#line.This |
00005240  69 6e 73 74 72 75 63 74  69 6f 6e 20 69 73 20 75  |instruction is u|
00005250  73 65 64 20 74 6f 20 74  72 61 6e 73 66 65 72 20  |sed to transfer |
00005260  64 61 74 61 20 66 72 6f  6d 20 74 68 65 20 72 65  |data from the re|
00005270  67 69 73 74 65 72 73 20  69 6e 74 6f 20 6d 65 6d  |gisters into mem|
00005280  6f 72 79 2e 20 41 20 73  79 73 74 65 6d 20 6f 66  |ory. A system of|
00005290  20 69 6e 64 69 72 65 63  74 20 61 64 64 72 65 73  | indirect addres|
000052a0  73 69 6e 67 20 69 73 20  75 73 65 64 20 74 6f 20  |sing is used to |
000052b0  73 70 65 63 69 66 79 20  74 68 65 20 64 65 73 74  |specify the dest|
000052c0  69 6e 61 74 69 6f 6e 20  6c 6f 63 61 74 69 6f 6e  |ination location|
000052d0  20 61 64 64 72 65 73 73  20 2d 20 74 68 65 20 61  | address - the a|
000052e0  64 64 72 65 73 73 20 74  6f 20 62 65 20 6c 6f 6f  |ddress to be loo|
000052f0  6b 65 64 20 75 70 20 69  73 20 68 65 6c 64 20 69  |ked up is held i|
00005300  6e 20 61 20 72 65 67 69  73 74 65 72 2e 0a 54 68  |n a register..Th|
00005310  65 72 65 20 61 72 65 20  74 77 6f 20 66 6f 72 6d  |ere are two form|
00005320  73 20 6f 66 20 69 6e 64  69 72 65 63 74 20 61 64  |s of indirect ad|
00005330  64 72 65 73 73 69 6e 67  3a 20 3c 50 72 65 2d 69  |dressing: <Pre-i|
00005340  6e 64 65 78 65 64 3d 3e  50 72 65 3e 20 61 6e 64  |ndexed=>Pre> and|
00005350  20 3c 50 6f 73 74 2d 69  6e 64 65 78 65 64 3d 3e  | <Post-indexed=>|
00005360  50 6f 73 74 3e 2e 20 49  6e 20 61 64 64 69 74 69  |Post>. In additi|
00005370  6f 6e 20 74 6f 20 74 68  65 73 65 20 74 77 6f 20  |on to these two |
00005380  66 6f 72 6d 73 2c 20 61  20 3c 50 43 20 72 65 6c  |forms, a <PC rel|
00005390  61 74 69 76 65 3d 3e 50  43 5f 72 65 6c 3e 20 61  |ative=>PC_rel> a|
000053a0  64 64 72 65 73 73 20 63  61 6e 20 61 6c 73 6f 20  |ddress can also |
000053b0  62 65 20 73 70 65 63 69  66 69 65 64 2e 00 00 00  |be specified....|
000053c0  44 41 54 41 36 01 00 00  42 79 74 65 20 61 64 64  |DATA6...Byte add|
000053d0  72 65 73 73 69 6e 67 0a  23 62 61 63 6b 67 72 6f  |ressing.#backgro|
000053e0  75 6e 64 20 77 69 6d 70  20 31 0a 42 79 20 64 65  |und wimp 1.By de|
000053f0  66 61 75 6c 74 2c 20 3c  4c 44 52 3e 20 61 6e 64  |fault, <LDR> and|
00005400  20 3c 53 54 52 3e 20 61  63 63 65 73 73 20 63 6f  | <STR> access co|
00005410  6d 70 6c 65 74 65 20 77  6f 72 64 73 20 6f 66 20  |mplete words of |
00005420  6d 65 6d 6f 72 79 20 28  66 6f 75 72 20 62 79 74  |memory (four byt|
00005430  65 73 29 2e 20 48 6f 77  65 76 65 72 2c 20 74 68  |es). However, th|
00005440  65 79 20 63 61 6e 20 62  65 20 6d 61 64 65 20 74  |ey can be made t|
00005450  6f 20 61 63 63 65 73 73  20 73 69 6e 67 6c 65 20  |o access single |
00005460  62 79 74 65 73 20 75 73  69 6e 67 20 74 68 65 20  |bytes using the |
00005470  27 42 27 20 73 75 66 66  69 78 2e 0a 23 6c 69 6e  |'B' suffix..#lin|
00005480  65 0a 45 78 61 6d 70 6c  65 73 3a 0a 23 77 72 61  |e.Examples:.#wra|
00005490  70 20 6f 66 66 0a 23 69  6e 64 65 6e 74 20 32 0a  |p off.#indent 2.|
000054a0  4c 44 52 42 09 52 30 2c  5b 52 32 2c 52 34 5d 0a  |LDRB.R0,[R2,R4].|
000054b0  53 54 52 42 09 52 30 2c  5b 52 35 2c 23 34 5d 0a  |STRB.R0,[R5,#4].|
000054c0  4c 44 52 42 09 52 30 2c  5b 52 36 2c 52 35 2c 4c  |LDRB.R0,[R6,R5,L|
000054d0  53 52 23 36 5d 21 0a 4c  44 52 4e 45 42 09 52 30  |SR#6]!.LDRNEB.R0|
000054e0  2c 5b 52 31 5d 2c 52 33  0a 4c 44 52 42 09 52 30  |,[R1],R3.LDRB.R0|
000054f0  2c 74 61 62 6c 65 00 00  44 41 54 41 c3 02 00 00  |,table..DATA....|
00005500  50 43 20 72 65 6c 61 74  69 76 65 20 61 64 64 72  |PC relative addr|
00005510  65 73 73 69 6e 67 0a 23  62 61 63 6b 67 72 6f 75  |essing.#backgrou|
00005520  6e 64 20 77 69 6d 70 20  31 0a 23 77 72 61 70 20  |nd wimp 1.#wrap |
00005530  6f 66 66 0a 53 79 6e 74  61 78 3a 20 4c 44 52 20  |off.Syntax: LDR |
00005540  28 6f 72 20 53 54 52 29  20 5c 3c 64 65 73 74 69  |(or STR) \<desti|
00005550  6e 61 74 69 6f 6e 5c 3e  2c 61 64 64 72 65 73 73  |nation\>,address|
00005560  0a 23 77 72 61 70 20 6e  6f 6a 6f 69 6e 0a 23 6c  |.#wrap nojoin.#l|
00005570  69 6e 65 0a 50 43 20 72  65 6c 61 74 69 76 65 20  |ine.PC relative |
00005580  61 64 64 72 65 73 73 69  6e 67 20 69 73 20 61 20  |addressing is a |
00005590  70 73 65 75 64 6f 2d 61  64 64 72 65 73 73 69 6e  |pseudo-addressin|
000055a0  67 20 6d 6f 64 65 20 61  73 20 69 74 20 69 73 20  |g mode as it is |
000055b0  6e 6f 74 20 61 20 64 69  73 74 69 6e 63 74 20 61  |not a distinct a|
000055c0  64 64 72 65 73 73 69 6e  67 20 6d 6f 64 65 20 73  |ddressing mode s|
000055d0  75 70 70 6f 72 74 65 64  20 62 79 20 74 68 65 20  |upported by the |
000055e0  41 52 4d 2e 20 49 6e 73  74 65 61 64 2c 20 73 75  |ARM. Instead, su|
000055f0  63 68 20 69 6e 73 74 72  75 63 74 69 6f 6e 73 20  |ch instructions |
00005600  61 72 65 20 63 6f 6e 76  65 72 74 65 64 20 69 6e  |are converted in|
00005610  74 6f 20 61 6e 20 61 70  70 72 6f 70 72 69 61 74  |to an appropriat|
00005620  65 20 70 72 65 2d 69 6e  64 65 78 65 64 20 69 6e  |e pre-indexed in|
00005630  73 74 72 75 63 74 69 6f  6e 20 62 79 20 74 68 65  |struction by the|
00005640  20 61 73 73 65 6d 62 6c  65 72 2e 0a 54 68 65 20  | assembler..The |
00005650  61 64 64 72 65 73 73 20  69 73 20 73 69 6d 70 6c  |address is simpl|
00005660  79 20 61 6e 20 61 62 73  6f 6c 75 74 65 20 6e 75  |y an absolute nu|
00005670  6d 62 65 72 2c 20 6f 72  20 61 6e 20 61 73 73 65  |mber, or an asse|
00005680  6d 62 6c 65 72 20 6c 61  62 65 6c 2e 0a 23 6c 69  |mbler label..#li|
00005690  6e 65 0a 45 78 61 6d 70  6c 65 73 3a 0a 23 77 72  |ne.Examples:.#wr|
000056a0  61 70 20 6f 66 66 0a 23  69 6e 64 65 6e 74 20 32  |ap off.#indent 2|
000056b0  0a 4c 44 52 20 52 30 2c  26 31 30 30 30 09 4c 6f  |.LDR R0,&1000.Lo|
000056c0  61 64 20 77 6f 72 64 20  6f 66 20 6d 65 6d 6f 72  |ad word of memor|
000056d0  79 20 66 72 6f 6d 20 6c  6f 63 61 74 69 6f 6e 20  |y from location |
000056e0  26 31 30 30 30 20 69 6e  74 6f 20 52 30 0a 53 54  |&1000 into R0.ST|
000056f0  52 20 52 30 2c 74 61 62  6c 65 09 53 74 6f 72 65  |R R0,table.Store|
00005700  20 52 30 20 74 6f 20 77  6f 72 64 20 6f 66 20 6d  | R0 to word of m|
00005710  65 6d 6f 72 79 20 73 70  65 63 69 66 69 65 64 20  |emory specified |
00005720  62 79 20 27 74 61 62 6c  65 27 0a 23 69 6e 64 65  |by 'table'.#inde|
00005730  6e 74 0a 23 77 72 61 70  20 6f 6e 0a 23 6c 69 6e  |nt.#wrap on.#lin|
00005740  65 0a 49 74 20 69 73 20  69 6d 70 6f 72 74 61 6e  |e.It is importan|
00005750  74 20 74 6f 20 72 65 6d  65 6d 62 65 72 20 74 68  |t to remember th|
00005760  61 74 20 74 68 65 20 72  61 6e 67 65 20 6f 66 20  |at the range of |
00005770  74 68 65 20 6f 66 66 73  65 74 2c 20 61 73 20 69  |the offset, as i|
00005780  6e 20 3c 70 72 65 2d 69  6e 64 65 78 65 64 20 61  |n <pre-indexed a|
00005790  64 64 72 65 73 73 69 6e  67 3d 3e 50 72 65 3e 2c  |ddressing=>Pre>,|
000057a0  20 69 73 20 62 65 74 77  65 65 6e 20 2d 34 30 39  | is between -409|
000057b0  36 20 61 6e 64 20 34 30  39 36 2e 00 44 41 54 41  |6 and 4096..DATA|
000057c0  63 03 00 00 50 6f 73 74  2d 69 6e 64 65 78 65 64  |c...Post-indexed|
000057d0  20 61 64 64 72 65 73 73  69 6e 67 0a 23 62 61 63  | addressing.#bac|
000057e0  6b 67 72 6f 75 6e 64 20  77 69 6d 70 20 31 0a 23  |kground wimp 1.#|
000057f0  77 72 61 70 20 6f 66 66  0a 53 79 6e 74 61 78 3a  |wrap off.Syntax:|
00005800  20 4c 44 52 20 28 6f 72  20 53 54 52 29 20 5c 3c  | LDR (or STR) \<|
00005810  64 65 73 74 69 6e 61 74  69 6f 6e 5c 3e 2c 20 5b  |destination\>, [|
00005820  5c 3c 62 61 73 65 5c 3e  5d 2c 5c 3c 6f 66 66 73  |\<base\>],\<offs|
00005830  65 74 5c 3e 0a 23 77 72  61 70 20 6f 6e 0a 23 6c  |et\>.#wrap on.#l|
00005840  69 6e 65 0a 54 68 69 73  20 66 6f 72 6d 20 6f 66  |ine.This form of|
00005850  20 61 64 64 72 65 73 73  69 6e 67 20 69 73 20 76  | addressing is v|
00005860  65 72 79 20 73 69 6d 69  6c 61 72 20 74 6f 20 3c  |ery similar to <|
00005870  70 72 65 2d 69 6e 64 65  78 65 64 20 61 64 64 72  |pre-indexed addr|
00005880  65 73 73 69 6e 67 3d 3e  50 72 65 3e 2e 20 49 6e  |essing=>Pre>. In|
00005890  20 74 68 69 73 20 63 61  73 65 2c 20 68 6f 77 65  | this case, howe|
000058a0  76 65 72 2c 20 74 68 65  20 6f 66 66 73 65 74 20  |ver, the offset |
000058b0  66 69 65 6c 64 20 69 73  20 2a 6e 6f 74 2a 20 6f  |field is *not* o|
000058c0  70 74 69 6f 6e 61 6c 2e  0a 23 6c 69 6e 65 0a 45  |ptional..#line.E|
000058d0  78 61 6d 70 6c 65 73 3a  0a 23 77 72 61 70 20 6f  |xamples:.#wrap o|
000058e0  66 66 0a 23 69 6e 64 65  6e 74 20 32 0a 4c 44 52  |ff.#indent 2.LDR|
000058f0  20 52 31 2c 5b 52 30 5d  2c 52 37 09 09 4c 6f 61  | R1,[R0],R7..Loa|
00005900  64 20 52 31 20 66 72 6f  6d 20 61 64 64 72 65 73  |d R1 from addres|
00005910  73 20 52 30 09 3a 20 52  30 3d 52 30 2b 52 37 0a  |s R0.: R0=R0+R7.|
00005920  53 54 52 20 52 36 2c 5b  52 37 5d 2c 23 34 09 09  |STR R6,[R7],#4..|
00005930  53 74 6f 72 65 20 52 36  20 61 74 20 61 64 64 72  |Store R6 at addr|
00005940  65 73 73 20 52 37 09 3a  20 52 37 3d 52 37 2b 34  |ess R7.: R7=R7+4|
00005950  0a 4c 44 52 20 52 38 2c  5b 52 32 5d 2c 52 35 2c  |.LDR R8,[R2],R5,|
00005960  4c 53 4c 23 34 09 4c 6f  61 64 20 52 38 20 66 72  |LSL#4.Load R8 fr|
00005970  6f 6d 20 61 64 64 72 65  73 73 20 52 32 09 3a 20  |om address R2.: |
00005980  52 32 3d 52 32 2b 52 35  2a 31 36 0a 53 54 52 20  |R2=R2+R5*16.STR |
00005990  52 30 2c 5b 52 30 5d 2c  23 32 30 09 09 53 74 6f  |R0,[R0],#20..Sto|
000059a0  72 65 20 52 30 20 61 74  20 61 64 64 72 65 73 73  |re R0 at address|
000059b0  20 52 30 09 3a 20 52 30  3d 52 30 2b 32 30 0a 23  | R0.: R0=R0+20.#|
000059c0  69 6e 64 65 6e 74 0a 23  77 72 61 70 20 6f 6e 0a  |indent.#wrap on.|
000059d0  23 6c 69 6e 65 0a 57 68  65 6e 20 70 6f 73 74 2d  |#line.When post-|
000059e0  69 6e 64 65 78 65 64 20  61 64 64 72 65 73 73 69  |indexed addressi|
000059f0  6e 67 20 69 73 20 75 73  65 64 2c 20 74 68 65 20  |ng is used, the |
00005a00  63 6f 6e 74 65 6e 74 73  20 6f 66 20 74 68 65 20  |contents of the |
00005a10  62 61 73 65 20 72 65 67  69 73 74 65 72 20 61 6c  |base register al|
00005a20  6f 6e 65 20 61 72 65 20  74 61 6b 65 6e 20 61 73  |one are taken as|
00005a30  20 74 68 65 20 61 64 64  72 65 73 73 20 6f 66 20  | the address of |
00005a40  74 68 65 20 6d 65 6d 6f  72 79 20 77 6f 72 64 20  |the memory word |
00005a50  74 6f 20 62 65 20 61 63  63 65 73 73 65 64 2e 20  |to be accessed. |
00005a60  4f 6e 6c 79 20 61 66 74  65 72 20 74 68 69 73 20  |Only after this |
00005a70  77 6f 72 64 20 68 61 73  20 62 65 65 6e 20 61 63  |word has been ac|
00005a80  63 65 73 73 65 64 20 61  72 65 20 74 68 65 20 63  |cessed are the c|
00005a90  6f 6e 74 65 6e 74 73 20  6f 66 20 74 68 65 20 6f  |ontents of the o|
00005aa0  66 66 73 65 74 20 66 69  65 6c 64 20 61 64 64 65  |ffset field adde|
00005ab0  64 20 74 6f 20 74 68 65  20 62 61 73 65 20 72 65  |d to the base re|
00005ac0  67 69 73 74 65 72 2e 20  4f 62 76 69 6f 75 73 6c  |gister. Obviousl|
00005ad0  79 2c 20 74 68 69 73 20  69 6d 70 6c 69 65 73 20  |y, this implies |
00005ae0  74 68 61 74 20 77 72 69  74 65 20 62 61 63 6b 20  |that write back |
00005af0  61 6c 77 61 79 73 20 6f  63 63 75 72 73 2c 20 73  |always occurs, s|
00005b00  6f 20 77 65 20 64 6f 20  6e 6f 74 20 6e 65 65 64  |o we do not need|
00005b10  20 74 6f 20 73 70 65 63  69 66 79 20 69 74 2e 00  | to specify it..|
00005b20  44 41 54 41 21 03 00 00  50 72 65 2d 69 6e 64 65  |DATA!...Pre-inde|
00005b30  78 65 64 20 61 64 64 72  65 73 73 69 6e 67 0a 23  |xed addressing.#|
00005b40  62 61 63 6b 67 72 6f 75  6e 64 20 77 69 6d 70 20  |background wimp |
00005b50  31 0a 23 77 72 61 70 20  6f 66 66 0a 53 79 6e 74  |1.#wrap off.Synt|
00005b60  61 78 3a 20 4c 44 52 20  28 6f 72 20 53 54 52 29  |ax: LDR (or STR)|
00005b70  20 5c 3c 64 65 73 74 69  6e 61 74 69 6f 6e 5c 3e  | \<destination\>|
00005b80  2c 20 5b 5c 3c 62 61 73  65 5c 3e 5c 7b 2c 5c 3c  |, [\<base\>\{,\<|
00005b90  6f 66 66 73 65 74 5c 3e  5c 7d 5d 0a 23 77 72 61  |offset\>\}].#wra|
00005ba0  70 20 6f 6e 0a 23 6c 69  6e 65 0a 54 68 65 20 64  |p on.#line.The d|
00005bb0  65 73 74 69 6e 61 74 69  6f 6e 20 66 69 65 6c 64  |estination field|
00005bc0  20 69 73 20 74 68 65 20  72 65 67 69 73 74 65 72  | is the register|
00005bd0  20 69 6e 74 6f 20 77 68  69 63 68 20 74 68 65 20  | into which the |
00005be0  64 61 74 61 20 77 69 6c  6c 20 62 65 20 74 72 61  |data will be tra|
00005bf0  6e 73 66 65 72 72 65 64  2e 20 54 68 65 20 63 6f  |nsferred. The co|
00005c00  6e 74 65 6e 74 73 20 6f  66 20 74 68 65 20 62 61  |ntents of the ba|
00005c10  73 65 20 61 6e 64 20 6f  66 66 73 65 74 20 66 69  |se and offset fi|
00005c20  65 6c 64 73 20 74 6f 67  65 74 68 65 72 20 73 70  |elds together sp|
00005c30  65 63 69 66 79 20 74 68  65 20 6d 65 6d 6f 72 79  |ecify the memory|
00005c40  20 77 6f 72 64 20 74 6f  20 62 65 20 61 63 63 65  | word to be acce|
00005c50  73 73 65 64 2e 20 54 68  65 20 6f 66 66 73 65 74  |ssed. The offset|
00005c60  20 66 69 65 6c 64 20 69  73 20 6f 70 74 69 6f 6e  | field is option|
00005c70  61 6c 20 2d 20 69 66 20  70 72 65 73 65 6e 74 2c  |al - if present,|
00005c80  20 69 74 20 77 69 6c 6c  20 62 65 20 61 64 64 65  | it will be adde|
00005c90  64 20 74 6f 20 74 68 65  20 62 61 73 65 20 66 69  |d to the base fi|
00005ca0  65 6c 64 20 74 6f 20 67  69 76 65 20 74 68 65 20  |eld to give the |
00005cb0  72 65 71 75 69 72 65 64  20 61 64 64 72 65 73 73  |required address|
00005cc0  2e 20 54 68 65 20 6f 66  66 73 65 74 20 66 69 65  |. The offset fie|
00005cd0  6c 64 20 69 73 20 73 70  65 63 69 66 69 65 64 20  |ld is specified |
00005ce0  69 6e 20 74 68 65 20 73  61 6d 65 20 77 61 79 20  |in the same way |
00005cf0  61 73 20 6f 70 65 72 61  6e 64 20 74 77 6f 20 69  |as operand two i|
00005d00  6e 20 74 68 65 20 64 61  74 61 20 70 72 6f 63 65  |n the data proce|
00005d10  73 73 69 6e 67 20 69 6e  73 74 72 75 63 74 69 6f  |ssing instructio|
00005d20  6e 73 2e 0a 23 6c 69 6e  65 0a 45 78 61 6d 70 6c  |ns..#line.Exampl|
00005d30  65 73 3a 0a 23 77 72 61  70 20 6f 66 66 0a 23 69  |es:.#wrap off.#i|
00005d40  6e 64 65 6e 74 20 32 0a  4c 44 52 20 52 30 2c 5b  |ndent 2.LDR R0,[|
00005d50  52 31 5d 09 09 4c 6f 61  64 20 52 30 20 66 72 6f  |R1]..Load R0 fro|
00005d60  6d 20 61 64 64 72 65 73  73 20 52 31 0a 53 54 52  |m address R1.STR|
00005d70  20 52 30 2c 5b 52 31 2c  52 32 5d 09 09 53 74 6f  | R0,[R1,R2]..Sto|
00005d80  72 65 20 52 30 20 61 74  20 61 64 64 72 65 73 73  |re R0 at address|
00005d90  20 52 31 20 2b 20 52 32  0a 4c 44 52 20 52 30 2c  | R1 + R2.LDR R0,|
00005da0  5b 52 31 2c 23 2d 34 5d  09 09 4c 6f 61 64 20 52  |[R1,#-4]..Load R|
00005db0  30 20 66 72 6f 6d 20 61  64 64 72 65 73 73 20 52  |0 from address R|
00005dc0  31 20 2d 20 34 0a 53 54  52 20 52 30 2c 5b 52 31  |1 - 4.STR R0,[R1|
00005dd0  2c 52 32 2c 4c 53 4c 23  32 5d 09 53 74 6f 72 65  |,R2,LSL#2].Store|
00005de0  20 52 30 20 61 74 20 61  64 64 72 65 73 73 20 52  | R0 at address R|
00005df0  31 20 2b 20 52 32 2a 34  0a 23 69 6e 64 65 6e 74  |1 + R2*4.#indent|
00005e00  0a 23 6c 69 6e 65 0a 41  20 66 75 72 74 68 65 72  |.#line.A further|
00005e10  20 6c 65 76 65 6c 20 6f  66 20 63 6f 6d 70 6c 65  | level of comple|
00005e20  78 69 74 79 20 69 73 20  74 68 61 74 20 6f 66 20  |xity is that of |
00005e30  3c 77 72 69 74 65 20 62  61 63 6b 3d 3e 77 62 3e  |<write back=>wb>|
00005e40  0a 00 00 00 44 41 54 41  52 04 00 00 57 72 69 74  |....DATAR...Writ|
00005e50  65 20 42 61 63 6b 0a 23  62 61 63 6b 67 72 6f 75  |e Back.#backgrou|
00005e60  6e 64 20 77 69 6d 70 20  31 0a 23 77 72 61 70 20  |nd wimp 1.#wrap |
00005e70  6f 6e 0a 49 6e 20 63 61  6c 63 75 6c 61 74 69 6e  |on.In calculatin|
00005e80  67 20 77 68 69 63 68 20  77 6f 72 64 20 6f 66 20  |g which word of |
00005e90  6d 65 6d 6f 72 79 20 69  73 20 74 6f 20 62 65 20  |memory is to be |
00005ea0  61 63 63 65 73 73 65 64  2c 20 74 68 65 20 41 52  |accessed, the AR|
00005eb0  4d 20 61 64 64 73 20 74  6f 67 65 74 68 65 72 20  |M adds together |
00005ec0  74 68 65 20 63 6f 6e 74  65 6e 74 73 20 6f 66 20  |the contents of |
00005ed0  74 68 65 20 62 61 73 65  20 61 6e 64 20 6f 66 66  |the base and off|
00005ee0  73 65 74 20 72 65 67 69  73 74 65 72 73 2e 20 49  |set registers. I|
00005ef0  74 20 69 73 20 73 6f 6d  65 74 69 6d 65 73 20 75  |t is sometimes u|
00005f00  73 65 66 75 6c 20 74 6f  20 72 65 74 61 69 6e 20  |seful to retain |
00005f10  74 68 69 73 20 6e 65 77  6c 79 20 63 61 6c 63 75  |this newly calcu|
00005f20  6c 61 74 65 64 20 61 64  64 72 65 73 73 20 66 6f  |lated address fo|
00005f30  72 20 66 75 74 75 72 65  20 75 73 65 2e 20 49 6e  |r future use. In|
00005f40  20 70 72 65 2d 69 6e 64  65 78 65 64 20 61 64 64  | pre-indexed add|
00005f50  72 65 73 73 69 6e 67 2c  20 74 68 69 73 20 69 73  |ressing, this is|
00005f60  20 64 6f 6e 65 20 62 79  20 75 73 69 6e 67 20 74  | done by using t|
00005f70  68 65 20 41 52 4d 27 73  20 27 77 72 69 74 65 20  |he ARM's 'write |
00005f80  62 61 63 6b 27 20 66 61  63 69 6c 69 74 79 2e 0a  |back' facility..|
00005f90  23 6c 69 6e 65 0a 57 72  69 74 65 20 62 61 63 6b  |#line.Write back|
00005fa0  20 69 73 20 73 70 65 63  69 66 69 65 64 20 77 69  | is specified wi|
00005fb0  74 68 20 74 68 65 20 27  21 27 20 73 75 66 66 69  |th the '!' suffi|
00005fc0  78 2e 0a 23 77 72 61 70  20 6f 66 66 0a 45 78 61  |x..#wrap off.Exa|
00005fd0  6d 70 6c 65 73 3a 0a 23  69 6e 64 65 6e 74 20 32  |mples:.#indent 2|
00005fe0  0a 4c 44 52 20 52 30 2c  5b 52 31 2c 52 32 5d 21  |.LDR R0,[R1,R2]!|
00005ff0  09 09 4c 6f 61 64 20 52  30 20 66 72 6f 6d 20 61  |..Load R0 from a|
00006000  64 64 72 65 73 73 20 52  31 2b 52 32 09 3a 20 52  |ddress R1+R2.: R|
00006010  31 3d 52 31 2b 52 32 0a  53 54 52 20 52 33 2c 5b  |1=R1+R2.STR R3,[|
00006020  52 35 2c 23 31 30 5d 21  09 53 74 6f 72 65 20 52  |R5,#10]!.Store R|
00006030  33 20 61 74 20 61 64 64  72 65 73 73 20 52 35 2b  |3 at address R5+|
00006040  52 31 30 09 3a 20 52 35  3d 52 35 2b 31 30 0a 4c  |R10.: R5=R5+10.L|
00006050  44 52 20 52 37 2c 5b 52  33 2c 52 38 2c 4c 53 4c  |DR R7,[R3,R8,LSL|
00006060  23 32 5d 21 09 4c 6f 61  64 20 52 37 20 66 72 6f  |#2]!.Load R7 fro|
00006070  6d 20 61 64 64 72 65 73  73 20 52 33 2b 52 38 2a  |m address R3+R8*|
00006080  34 09 3a 20 52 33 3d 52  33 2b 52 38 2a 34 0a 23  |4.: R3=R3+R8*4.#|
00006090  69 6e 64 65 6e 74 0a 23  77 72 61 70 20 6e 6f 6a  |indent.#wrap noj|
000060a0  6f 69 6e 0a 23 6c 69 6e  65 0a 57 68 65 6e 20 74  |oin.#line.When t|
000060b0  68 65 20 41 52 4d 20 65  78 65 63 75 74 65 73 20  |he ARM executes |
000060c0  74 68 65 20 69 6e 73 74  72 75 63 74 69 6f 6e 2c  |the instruction,|
000060d0  20 69 74 20 77 69 6c 6c  20 70 65 72 66 6f 72 6d  | it will perform|
000060e0  20 74 68 65 20 75 73 75  61 6c 20 61 64 64 69 74  | the usual addit|
000060f0  69 6f 6e 20 6f 66 20 74  68 65 20 62 61 73 65 20  |ion of the base |
00006100  61 6e 64 20 6f 66 66 73  65 74 20 66 69 65 6c 64  |and offset field|
00006110  73 2e 20 49 74 20 77 69  6c 6c 20 74 68 65 6e 20  |s. It will then |
00006120  61 63 63 65 73 73 20 74  68 65 20 64 61 74 61 20  |access the data |
00006130  61 74 20 74 68 65 20 6e  65 77 6c 79 20 63 61 6c  |at the newly cal|
00006140  63 75 6c 61 74 65 64 20  61 64 64 72 65 73 73 2e  |culated address.|
00006150  20 46 69 6e 61 6c 6c 79  2c 20 61 73 20 77 72 69  | Finally, as wri|
00006160  74 65 20 62 61 63 6b 20  69 73 20 73 65 6c 65 63  |te back is selec|
00006170  74 65 64 2c 20 69 74 20  77 69 6c 6c 20 73 74 6f  |ted, it will sto|
00006180  72 65 20 74 68 65 20 6e  65 77 6c 79 20 63 61 6c  |re the newly cal|
00006190  63 75 6c 61 74 65 64 20  61 64 64 72 65 73 73 20  |culated address |
000061a0  62 61 63 6b 20 69 6e 74  6f 20 74 68 65 20 62 61  |back into the ba|
000061b0  73 65 20 72 65 67 69 73  74 65 72 2e 0a 57 72 69  |se register..Wri|
000061c0  74 65 20 62 61 63 6b 20  69 73 20 70 61 72 74 69  |te back is parti|
000061d0  63 75 6c 61 72 6c 79 20  75 73 65 66 75 6c 20 77  |cularly useful w|
000061e0  68 65 6e 20 61 63 63 65  73 73 69 6e 67 20 61 20  |hen accessing a |
000061f0  73 65 71 75 65 6e 63 65  20 6f 66 20 6d 65 6d 6f  |sequence of memo|
00006200  72 79 20 6c 6f 63 61 74  69 6f 6e 73 2c 20 65 2e  |ry locations, e.|
00006210  67 2e 2c 20 74 6f 20 61  63 63 65 73 73 20 63 6f  |g., to access co|
00006220  6e 73 65 63 75 74 69 76  65 20 6d 65 6d 6f 72 79  |nsecutive memory|
00006230  20 77 6f 72 64 73 20 77  65 20 63 61 6e 20 75 73  | words we can us|
00006240  65 20 27 4c 44 52 20 52  30 2c 5b 62 61 73 65 2c  |e 'LDR R0,[base,|
00006250  23 34 5d 21 27 2e 20 57  72 69 74 65 20 62 61 63  |#4]!'. Write bac|
00006260  6b 20 68 65 6e 63 65 20  61 6c 6c 6f 77 73 20 74  |k hence allows t|
00006270  68 65 20 65 61 73 79 20  63 72 65 61 74 69 6f 6e  |he easy creation|
00006280  20 61 6e 64 20 61 63 63  65 73 73 20 6f 66 20 61  | and access of a|
00006290  72 72 61 79 73 2e 00 00  44 41 54 41 81 05 00 00  |rrays...DATA....|
000062a0  4c 44 4d 3a 20 4c 6f 61  64 20 4d 75 6c 74 69 70  |LDM: Load Multip|
000062b0  6c 65 20 52 65 67 69 73  74 65 72 73 0a 23 62 61  |le Registers.#ba|
000062c0  63 6b 67 72 6f 75 6e 64  20 77 69 6d 70 20 31 0a  |ckground wimp 1.|
000062d0  23 77 72 61 70 20 6f 66  66 0a 53 79 6e 74 61 78  |#wrap off.Syntax|
000062e0  3a 20 4c 44 4d 20 5c 3c  6f 70 74 69 6f 6e 73 5c  |: LDM \<options\|
000062f0  3e 20 5c 3c 62 61 73 65  5c 3e 20 5c 7b 21 5c 7d  |> \<base\> \{!\}|
00006300  2c 20 5c 3c 72 65 67 69  73 74 65 72 5c 5f 6c 69  |, \<register\_li|
00006310  73 74 5c 3e 0a 4f 70 65  72 61 74 69 6f 6e 3a 20  |st\>.Operation: |
00006320  4d 75 6c 74 69 70 6c 65  20 74 72 61 6e 73 66 65  |Multiple transfe|
00006330  72 20 6f 66 20 64 61 74  61 20 66 72 6f 6d 20 74  |r of data from t|
00006340  68 65 20 72 65 67 69 73  74 65 72 73 20 74 6f 20  |he registers to |
00006350  6d 65 6d 6f 72 79 0a 23  77 72 61 70 20 6e 6f 6a  |memory.#wrap noj|
00006360  6f 69 6e 0a 23 6c 69 6e  65 0a 54 68 65 20 72 65  |oin.#line.The re|
00006370  67 69 73 74 65 72 5f 6c  69 73 74 20 69 73 20 74  |gister_list is t|
00006380  68 65 20 73 65 72 69 65  73 20 6f 66 20 72 65 67  |he series of reg|
00006390  69 73 74 65 72 20 6e 61  6d 65 73 2c 20 73 65 70  |ister names, sep|
000063a0  61 72 61 74 65 64 20 62  79 20 63 6f 6d 6d 61 73  |arated by commas|
000063b0  2c 20 74 68 65 20 63 6f  6e 74 65 6e 74 73 20 6f  |, the contents o|
000063c0  66 20 77 68 69 63 68 20  77 65 20 77 61 6e 74 20  |f which we want |
000063d0  74 6f 20 6c 6f 61 64 20  66 72 6f 6d 20 6d 65 6d  |to load from mem|
000063e0  6f 72 79 2e 20 54 68 65  20 6f 72 64 65 72 20 6f  |ory. The order o|
000063f0  66 20 74 68 65 20 72 65  67 69 73 74 65 72 73 20  |f the registers |
00006400  69 6e 20 74 68 65 20 6c  69 73 74 20 69 73 20 6f  |in the list is o|
00006410  66 20 6e 6f 20 73 69 67  6e 69 66 69 63 61 6e 63  |f no significanc|
00006420  65 2c 20 61 6e 64 20 61  6e 79 20 6e 75 6d 62 65  |e, and any numbe|
00006430  72 20 6f 66 20 72 65 67  69 73 74 65 72 73 20 63  |r of registers c|
00006440  61 6e 20 62 65 20 6c 6f  61 64 65 64 2e 20 54 68  |an be loaded. Th|
00006450  65 20 61 73 73 65 6d 62  6c 65 72 20 77 69 6c 6c  |e assembler will|
00006460  20 61 6c 6c 6f 77 20 61  20 72 61 6e 67 65 20 6f  | allow a range o|
00006470  66 20 72 65 67 69 73 74  65 72 73 20 74 6f 20 62  |f registers to b|
00006480  65 20 73 70 65 63 69 66  69 65 64 20 62 79 20 75  |e specified by u|
00006490  73 69 6e 67 20 61 20 27  2d 27 20 63 68 61 72 61  |sing a '-' chara|
000064a0  63 74 65 72 2e 0a 54 68  65 20 62 61 73 65 20 66  |cter..The base f|
000064b0  69 65 6c 64 20 6d 75 73  74 20 62 65 20 67 69 76  |ield must be giv|
000064c0  65 6e 20 61 73 20 61 20  73 69 6d 70 6c 65 20 72  |en as a simple r|
000064d0  65 67 69 73 74 65 72 2e  20 54 68 65 20 63 6f 6e  |egister. The con|
000064e0  74 65 6e 74 73 20 6f 66  20 74 68 69 73 20 61 72  |tents of this ar|
000064f0  65 20 74 61 6b 65 6e 20  74 6f 20 62 65 20 74 68  |e taken to be th|
00006500  65 20 73 74 61 72 74 20  61 64 64 72 65 73 73 20  |e start address |
00006510  69 6e 20 6d 65 6d 6f 72  79 20 66 72 6f 6d 20 77  |in memory from w|
00006520  68 69 63 68 20 74 68 65  20 72 65 67 69 73 74 65  |hich the registe|
00006530  72 73 20 61 72 65 20 74  6f 20 62 65 20 6c 6f 61  |rs are to be loa|
00006540  64 65 64 2e 0a 54 68 65  20 3c 6f 70 74 69 6f 6e  |ded..The <option|
00006550  73 3d 3e 4d 5f 6f 70 74  73 3e 20 66 69 65 6c 64  |s=>M_opts> field|
00006560  20 69 73 20 61 20 74 77  6f 2d 63 68 61 72 61 63  | is a two-charac|
00006570  74 65 72 20 63 6f 64 65  20 77 68 69 63 68 20 64  |ter code which d|
00006580  65 66 69 6e 65 73 20 68  6f 77 20 74 68 65 20 69  |efines how the i|
00006590  6e 73 74 72 75 63 74 69  6f 6e 20 73 68 6f 75 6c  |nstruction shoul|
000065a0  64 20 62 65 20 65 78 65  63 75 74 65 64 2e 0a 23  |d be executed..#|
000065b0  6c 69 6e 65 0a 41 73 20  74 68 65 20 41 52 4d 20  |line.As the ARM |
000065c0  65 78 65 63 75 74 65 73  20 74 68 65 20 69 6e 73  |executes the ins|
000065d0  74 72 75 63 74 69 6f 6e  2c 20 69 74 20 77 69 6c  |truction, it wil|
000065e0  6c 20 6c 6f 61 64 20 63  6f 6e 73 65 63 75 74 69  |l load consecuti|
000065f0  76 65 20 6d 65 6d 6f 72  79 20 77 6f 72 64 73 20  |ve memory words |
00006600  69 6e 74 6f 20 65 61 63  68 20 6f 66 20 74 68 65  |into each of the|
00006610  20 72 65 67 69 73 74 65  72 73 20 6e 61 6d 65 64  | registers named|
00006620  20 69 6e 20 72 65 67 69  73 74 65 72 5f 6c 69 73  | in register_lis|
00006630  74 2e 20 41 20 63 6f 70  79 20 6f 66 20 74 68 65  |t. A copy of the|
00006640  20 61 64 64 72 65 73 73  20 69 6e 20 74 68 65 20  | address in the |
00006650  62 61 73 65 20 72 65 67  69 73 74 65 72 20 69 73  |base register is|
00006660  20 75 73 65 64 20 61 6e  64 20 6d 6f 64 69 66 69  | used and modifi|
00006670  65 64 20 62 79 20 74 68  65 20 41 52 4d 20 61 73  |ed by the ARM as|
00006680  20 65 61 63 68 20 72 65  67 69 73 74 65 72 20 69  | each register i|
00006690  73 20 73 74 6f 72 65 64  2e 20 54 68 65 20 61 63  |s stored. The ac|
000066a0  74 75 61 6c 20 63 6f 6e  74 65 6e 74 73 20 6f 66  |tual contents of|
000066b0  20 74 68 65 20 62 61 73  65 20 61 72 65 20 6e 6f  | the base are no|
000066c0  74 20 63 68 61 6e 67 65  64 2c 20 75 6e 6c 65 73  |t changed, unles|
000066d0  73 20 77 65 20 72 65 71  75 65 73 74 20 74 68 69  |s we request thi|
000066e0  73 20 75 73 69 6e 67 20  74 68 65 20 3c 77 72 69  |s using the <wri|
000066f0  74 65 20 62 61 63 6b 3d  3e 4d 5f 77 62 3e 20 6f  |te back=>M_wb> o|
00006700  70 74 69 6f 6e 2e 0a 23  6c 69 6e 65 0a 54 61 6b  |ption..#line.Tak|
00006710  65 6e 20 61 74 20 69 74  73 20 73 69 6d 70 6c 65  |en at its simple|
00006720  73 74 20 6c 65 76 65 6c  2c 20 4c 44 4d 20 63 61  |st level, LDM ca|
00006730  6e 20 62 65 20 75 73 65  64 20 74 6f 20 72 65 73  |n be used to res|
00006740  74 6f 72 65 20 74 68 65  20 63 6f 6e 74 65 6e 74  |tore the content|
00006750  73 20 6f 66 20 61 20 72  65 67 69 73 74 65 72 20  |s of a register |
00006760  67 72 6f 75 70 20 70 72  65 76 69 6f 75 73 6c 79  |group previously|
00006770  20 73 74 6f 72 65 64 20  77 69 74 68 20 61 6e 20  | stored with an |
00006780  3c 53 54 4d 3e 20 69 6e  73 74 72 75 63 74 69 6f  |<STM> instructio|
00006790  6e 2c 20 63 6f 6e 74 61  69 6e 69 6e 67 20 74 68  |n, containing th|
000067a0  65 20 73 61 6d 65 20 6d  65 6d 6f 72 79 20 61 64  |e same memory ad|
000067b0  64 72 65 73 73 20 61 6e  64 20 72 65 67 69 73 74  |dress and regist|
000067c0  65 72 5f 6c 69 73 74 2e  20 48 6f 77 65 76 65 72  |er_list. However|
000067d0  2c 20 61 20 6d 61 6a 6f  72 20 75 73 65 20 6f 66  |, a major use of|
000067e0  20 3c 53 54 4d 3e 20 61  6e 64 20 4c 44 4d 20 69  | <STM> and LDM i|
000067f0  73 20 69 6e 20 74 68 65  20 63 72 65 61 74 69 6f  |s in the creatio|
00006800  6e 20 61 6e 64 20 61 63  63 65 73 73 20 6f 66 20  |n and access of |
00006810  3c 73 74 61 63 6b 73 3e  2e 00 00 00 44 41 54 41  |<stacks>....DATA|
00006820  c5 05 00 00 53 54 4d 3a  20 53 74 6f 72 65 20 4d  |....STM: Store M|
00006830  75 6c 74 69 70 6c 65 20  52 65 67 69 73 74 65 72  |ultiple Register|
00006840  73 0a 23 62 61 63 6b 67  72 6f 75 6e 64 20 77 69  |s.#background wi|
00006850  6d 70 20 31 0a 23 77 72  61 70 20 6f 66 66 0a 53  |mp 1.#wrap off.S|
00006860  79 6e 74 61 78 3a 20 53  54 4d 20 5c 3c 6f 70 74  |yntax: STM \<opt|
00006870  69 6f 6e 73 5c 3e 20 5c  3c 62 61 73 65 5c 3e 20  |ions\> \<base\> |
00006880  5c 7b 21 5c 7d 2c 20 5c  3c 72 65 67 69 73 74 65  |\{!\}, \<registe|
00006890  72 5c 5f 6c 69 73 74 5c  3e 0a 4f 70 65 72 61 74  |r\_list\>.Operat|
000068a0  69 6f 6e 3a 20 4d 75 6c  74 69 70 6c 65 20 74 72  |ion: Multiple tr|
000068b0  61 6e 73 66 65 72 20 6f  66 20 64 61 74 61 20 66  |ansfer of data f|
000068c0  72 6f 6d 20 74 68 65 20  72 65 67 69 73 74 65 72  |rom the register|
000068d0  73 20 74 6f 20 6d 65 6d  6f 72 79 0a 23 77 72 61  |s to memory.#wra|
000068e0  70 20 6e 6f 6a 6f 69 6e  0a 23 6c 69 6e 65 0a 54  |p nojoin.#line.T|
000068f0  68 65 20 72 65 67 69 73  74 65 72 5f 6c 69 73 74  |he register_list|
00006900  20 69 73 20 74 68 65 20  73 65 72 69 65 73 20 6f  | is the series o|
00006910  66 20 72 65 67 69 73 74  65 72 20 6e 61 6d 65 73  |f register names|
00006920  2c 20 73 65 70 61 72 61  74 65 64 20 62 79 20 63  |, separated by c|
00006930  6f 6d 6d 61 73 2c 20 74  68 65 20 63 6f 6e 74 65  |ommas, the conte|
00006940  6e 74 73 20 6f 66 20 77  68 69 63 68 20 77 65 20  |nts of which we |
00006950  77 61 6e 74 20 74 6f 20  73 74 6f 72 65 20 69 6e  |want to store in|
00006960  20 6d 65 6d 6f 72 79 2e  20 54 68 65 20 6f 72 64  | memory. The ord|
00006970  65 72 20 6f 66 20 74 68  65 20 72 65 67 69 73 74  |er of the regist|
00006980  65 72 73 20 69 6e 20 74  68 65 20 6c 69 73 74 20  |ers in the list |
00006990  69 73 20 6f 66 20 6e 6f  20 73 69 67 6e 69 66 69  |is of no signifi|
000069a0  63 61 6e 63 65 2c 20 61  6e 64 20 61 6e 79 20 6e  |cance, and any n|
000069b0  75 6d 62 65 72 20 6f 66  20 72 65 67 69 73 74 65  |umber of registe|
000069c0  72 73 20 63 61 6e 20 62  65 20 73 74 6f 72 65 64  |rs can be stored|
000069d0  2e 20 54 68 65 20 61 73  73 65 6d 62 6c 65 72 20  |. The assembler |
000069e0  77 69 6c 6c 20 61 6c 6c  6f 77 20 61 20 72 61 6e  |will allow a ran|
000069f0  67 65 20 6f 66 20 72 65  67 69 73 74 65 72 73 20  |ge of registers |
00006a00  74 6f 20 62 65 20 73 70  65 63 69 66 69 65 64 20  |to be specified |
00006a10  62 79 20 75 73 69 6e 67  20 61 20 27 2d 27 20 63  |by using a '-' c|
00006a20  68 61 72 61 63 74 65 72  2e 0a 54 68 65 20 62 61  |haracter..The ba|
00006a30  73 65 20 66 69 65 6c 64  20 6d 75 73 74 20 62 65  |se field must be|
00006a40  20 67 69 76 65 6e 20 61  73 20 61 20 73 69 6d 70  | given as a simp|
00006a50  6c 65 20 72 65 67 69 73  74 65 72 2e 20 54 68 65  |le register. The|
00006a60  20 63 6f 6e 74 65 6e 74  73 20 6f 66 20 74 68 69  | contents of thi|
00006a70  73 20 61 72 65 20 74 61  6b 65 6e 20 74 6f 20 62  |s are taken to b|
00006a80  65 20 74 68 65 20 73 74  61 72 74 20 61 64 64 72  |e the start addr|
00006a90  65 73 73 20 69 6e 20 6d  65 6d 6f 72 79 20 66 72  |ess in memory fr|
00006aa0  6f 6d 20 77 68 69 63 68  20 74 68 65 20 72 65 67  |om which the reg|
00006ab0  69 73 74 65 72 73 20 61  72 65 20 74 6f 20 62 65  |isters are to be|
00006ac0  20 73 61 76 65 64 2e 0a  54 68 65 20 3c 6f 70 74  | saved..The <opt|
00006ad0  69 6f 6e 73 3d 3e 4d 5f  6f 70 74 73 3e 20 66 69  |ions=>M_opts> fi|
00006ae0  65 6c 64 20 69 73 20 61  20 74 77 6f 2d 63 68 61  |eld is a two-cha|
00006af0  72 61 63 74 65 72 20 63  6f 64 65 20 77 68 69 63  |racter code whic|
00006b00  68 20 64 65 66 69 6e 65  73 20 68 6f 77 20 74 68  |h defines how th|
00006b10  65 20 69 6e 73 74 72 75  63 74 69 6f 6e 20 73 68  |e instruction sh|
00006b20  6f 75 6c 64 20 62 65 20  65 78 65 63 75 74 65 64  |ould be executed|
00006b30  2e 0a 23 6c 69 6e 65 0a  41 73 20 74 68 65 20 41  |..#line.As the A|
00006b40  52 4d 20 65 78 65 63 75  74 65 73 20 74 68 65 20  |RM executes the |
00006b50  69 6e 73 74 72 75 63 74  69 6f 6e 2c 20 69 74 20  |instruction, it |
00006b60  77 69 6c 6c 20 73 74 6f  72 65 20 74 68 65 20 63  |will store the c|
00006b70  6f 6e 74 65 6e 74 73 20  6f 66 20 65 61 63 68 20  |ontents of each |
00006b80  6f 66 20 74 68 65 20 72  65 67 69 73 74 65 72 73  |of the registers|
00006b90  20 6e 61 6d 65 64 20 69  6e 20 72 65 67 69 73 74  | named in regist|
00006ba0  65 72 5f 6c 69 73 74 20  69 6e 20 63 6f 6e 73 65  |er_list in conse|
00006bb0  63 75 74 69 76 65 20 6d  65 6d 6f 72 79 20 77 6f  |cutive memory wo|
00006bc0  72 64 73 2e 20 41 20 63  6f 70 79 20 6f 66 20 74  |rds. A copy of t|
00006bd0  68 65 20 61 64 64 72 65  73 73 20 69 6e 20 74 68  |he address in th|
00006be0  65 20 62 61 73 65 20 72  65 67 69 73 74 65 72 20  |e base register |
00006bf0  69 73 20 75 73 65 64 20  61 6e 64 20 6d 6f 64 69  |is used and modi|
00006c00  66 69 65 64 20 62 79 20  74 68 65 20 41 52 4d 20  |fied by the ARM |
00006c10  61 73 20 65 61 63 68 20  72 65 67 69 73 74 65 72  |as each register|
00006c20  20 69 73 20 73 74 6f 72  65 64 2e 20 54 68 65 20  | is stored. The |
00006c30  61 63 74 75 61 6c 20 63  6f 6e 74 65 6e 74 73 20  |actual contents |
00006c40  6f 66 20 74 68 65 20 62  61 73 65 20 61 72 65 20  |of the base are |
00006c50  6e 6f 74 20 63 68 61 6e  67 65 64 2c 20 75 6e 6c  |not changed, unl|
00006c60  65 73 73 20 77 65 20 72  65 71 75 65 73 74 20 74  |ess we request t|
00006c70  68 69 73 20 75 73 69 6e  67 20 74 68 65 20 3c 77  |his using the <w|
00006c80  72 69 74 65 20 62 61 63  6b 3d 3e 4d 5f 77 62 3e  |rite back=>M_wb>|
00006c90  20 6f 70 74 69 6f 6e 2e  0a 23 6c 69 6e 65 0a 54  | option..#line.T|
00006ca0  61 6b 65 6e 20 61 74 20  69 74 73 20 73 69 6d 70  |aken at its simp|
00006cb0  6c 65 73 74 20 6c 65 76  65 6c 2c 20 53 54 4d 20  |lest level, STM |
00006cc0  63 61 6e 20 62 65 20 75  73 65 64 20 74 6f 20 70  |can be used to p|
00006cd0  72 65 73 65 72 76 65 20  74 68 65 20 63 6f 6e 74  |reserve the cont|
00006ce0  65 6e 74 73 20 6f 66 20  61 20 72 65 67 69 73 74  |ents of a regist|
00006cf0  65 72 20 67 72 6f 75 70  20 69 6e 20 61 6e 20 61  |er group in an a|
00006d00  72 62 69 74 72 61 72 79  20 62 6c 6f 63 6b 20 6f  |rbitrary block o|
00006d10  66 20 6d 65 6d 6f 72 79  2e 20 54 68 65 20 6f 72  |f memory. The or|
00006d20  69 67 69 6e 61 6c 20 63  6f 6e 74 65 6e 74 73 20  |iginal contents |
00006d30  63 61 6e 20 74 68 65 6e  20 62 65 20 72 65 73 74  |can then be rest|
00006d40  6f 72 65 64 20 61 74 20  61 20 6c 61 74 65 72 20  |ored at a later |
00006d50  74 69 6d 65 20 75 73 69  6e 67 20 3c 4c 44 4d 3e  |time using <LDM>|
00006d60  20 77 69 74 68 20 74 68  65 20 73 61 6d 65 20 6d  | with the same m|
00006d70  65 6d 6f 72 79 20 61 64  64 72 65 73 73 20 61 6e  |emory address an|
00006d80  64 20 72 65 67 69 73 74  65 72 5f 6c 69 73 74 2e  |d register_list.|
00006d90  20 48 6f 77 65 76 65 72  2c 20 61 20 6d 61 6a 6f  | However, a majo|
00006da0  72 20 75 73 65 20 6f 66  20 53 54 4d 20 61 6e 64  |r use of STM and|
00006db0  20 3c 4c 44 4d 3e 20 69  73 20 69 6e 20 74 68 65  | <LDM> is in the|
00006dc0  20 63 72 65 61 74 69 6f  6e 20 61 6e 64 20 61 63  | creation and ac|
00006dd0  63 65 73 73 20 6f 66 20  3c 73 74 61 63 6b 73 3e  |cess of <stacks>|
00006de0  2e 00 00 00 44 41 54 41  9a 05 00 00 53 54 4d 20  |....DATA....STM |
00006df0  26 20 4c 44 4d 20 6f 70  74 69 6f 6e 73 0a 23 62  |& LDM options.#b|
00006e00  61 63 6b 67 72 6f 75 6e  64 20 77 69 6d 70 20 31  |ackground wimp 1|
00006e10  0a 23 77 72 61 70 20 6f  6e 0a 2a 44 69 72 65 63  |.#wrap on.*Direc|
00006e20  74 69 6f 6e 20 6f 66 20  53 74 6f 72 61 67 65 2a  |tion of Storage*|
00006e30  0a 54 68 65 20 73 74 6f  72 61 67 65 20 2f 20 6c  |.The storage / l|
00006e40  6f 61 64 69 6e 67 20 64  69 72 65 63 74 69 6f 6e  |oading direction|
00006e50  20 75 73 65 64 20 62 79  20 74 68 65 20 69 6e 73  | used by the ins|
00006e60  74 72 75 63 74 69 6f 6e  20 69 73 20 63 6f 6e 74  |truction is cont|
00006e70  72 6f 6c 6c 65 64 20 62  79 20 74 68 65 20 66 69  |rolled by the fi|
00006e80  72 73 74 20 63 68 61 72  61 63 74 65 72 20 69 6e  |rst character in|
00006e90  20 74 68 65 20 6f 70 74  69 6f 6e 20 66 69 65 6c  | the option fiel|
00006ea0  64 2e 20 54 68 69 73 20  6d 61 79 20 62 65 20 65  |d. This may be e|
00006eb0  69 74 68 65 72 20 6f 66  20 74 68 65 20 66 6f 6c  |ither of the fol|
00006ec0  6c 6f 77 69 6e 67 3a 0a  23 77 72 61 70 20 6f 66  |lowing:.#wrap of|
00006ed0  66 0a 23 69 6e 64 65 6e  74 20 32 0a 49 09 49 6e  |f.#indent 2.I.In|
00006ee0  63 72 65 6d 65 6e 74 20  61 64 64 72 65 73 73 20  |crement address |
00006ef0  61 66 74 65 72 20 73 74  6f 72 69 6e 67 20 2f 20  |after storing / |
00006f00  6c 6f 61 64 69 6e 67 20  65 61 63 68 20 72 65 67  |loading each reg|
00006f10  69 73 74 65 72 0a 44 09  44 65 63 72 65 6d 65 6e  |ister.D.Decremen|
00006f20  74 20 61 64 64 72 65 73  73 20 61 66 74 65 72 20  |t address after |
00006f30  73 74 6f 72 69 6e 67 20  2f 20 6c 6f 61 64 69 6e  |storing / loadin|
00006f40  67 20 65 61 63 68 20 72  65 67 69 73 74 65 72 0a  |g each register.|
00006f50  23 69 6e 64 65 6e 74 0a  23 77 72 61 70 20 6f 6e  |#indent.#wrap on|
00006f60  0a 49 66 20 61 6e 20 69  6e 63 72 65 6d 65 6e 74  |.If an increment|
00006f70  69 6e 67 20 61 64 64 72  65 73 73 20 69 73 20 73  |ing address is s|
00006f80  70 65 63 69 66 69 65 64  2c 20 74 68 65 6e 20 72  |pecified, then r|
00006f90  65 67 69 73 74 65 72 73  20 77 69 6c 6c 20 62 65  |egisters will be|
00006fa0  20 73 74 6f 72 65 64 20  69 6e 20 2f 20 6c 6f 61  | stored in / loa|
00006fb0  64 65 64 20 66 72 6f 6d  20 6c 6f 63 61 74 69 6f  |ded from locatio|
00006fc0  6e 73 3a 20 27 62 61 73  65 27 2c 20 27 62 61 73  |ns: 'base', 'bas|
00006fd0  65 2b 34 27 2c 20 27 62  61 73 65 2b 38 27 2c 20  |e+4', 'base+8', |
00006fe0  65 74 63 2e 20 54 68 65  20 72 65 76 65 72 73 65  |etc. The reverse|
00006ff0  20 77 69 6c 6c 20 6f 63  63 75 72 20 77 69 74 68  | will occur with|
00007000  20 61 20 64 65 63 72 65  6d 65 6e 74 69 6e 67 20  | a decrementing |
00007010  61 64 64 72 65 73 73 2e  0a 23 6c 69 6e 65 0a 2a  |address..#line.*|
00007020  50 72 65 20 6f 72 20 50  6f 73 74 20 41 64 64 72  |Pre or Post Addr|
00007030  65 73 73 20 4d 6f 64 69  66 69 63 61 74 69 6f 6e  |ess Modification|
00007040  2a 0a 54 68 65 20 73 65  63 6f 6e 64 20 6c 65 74  |*.The second let|
00007050  74 65 72 20 69 6e 20 74  68 65 20 6f 70 74 69 6f  |ter in the optio|
00007060  6e 20 66 69 65 6c 64 20  73 70 65 63 69 66 69 65  |n field specifie|
00007070  73 20 77 68 65 74 68 65  72 20 74 68 65 20 61 64  |s whether the ad|
00007080  64 72 65 73 73 20 69 73  20 74 6f 20 62 65 20 6d  |dress is to be m|
00007090  6f 64 69 66 69 65 64 20  62 65 66 6f 72 65 20 6f  |odified before o|
000070a0  72 20 61 66 74 65 72 20  65 61 63 68 20 72 65 67  |r after each reg|
000070b0  69 73 74 65 72 20 69 73  20 73 74 6f 72 65 64 20  |ister is stored |
000070c0  2f 20 6c 6f 61 64 65 64  2e 20 54 68 65 20 66 6f  |/ loaded. The fo|
000070d0  6c 6c 6f 77 69 6e 67 20  6f 70 74 69 6f 6e 73 20  |llowing options |
000070e0  63 61 6e 20 62 65 20 75  73 65 64 3a 0a 23 77 72  |can be used:.#wr|
000070f0  61 70 20 6f 66 66 0a 23  69 6e 64 65 6e 74 20 32  |ap off.#indent 2|
00007100  0a 41 09 4d 6f 64 69 66  79 20 61 64 64 72 65 73  |.A.Modify addres|
00007110  73 20 61 66 74 65 72 20  73 74 6f 72 69 6e 67 20  |s after storing |
00007120  2f 20 6c 6f 61 64 69 6e  67 20 65 61 63 68 20 72  |/ loading each r|
00007130  65 67 69 73 74 65 72 0a  42 09 4d 6f 64 69 66 79  |egister.B.Modify|
00007140  20 61 64 64 72 65 73 73  20 62 65 66 6f 72 65 20  | address before |
00007150  73 74 6f 72 69 6e 67 20  2f 20 6c 6f 61 64 69 6e  |storing / loadin|
00007160  67 20 65 61 63 68 20 72  65 67 69 73 74 65 72 0a  |g each register.|
00007170  23 69 6e 64 65 6e 74 0a  23 77 72 61 70 20 6e 6f  |#indent.#wrap no|
00007180  6a 6f 69 6e 0a 49 66 20  74 68 65 20 61 64 64 72  |join.If the addr|
00007190  65 73 73 20 69 73 20 6d  6f 64 69 66 69 65 64 20  |ess is modified |
000071a0  61 66 74 65 72 20 73 74  6f 72 69 6e 67 20 2f 20  |after storing / |
000071b0  6c 6f 61 64 69 6e 67 20  65 61 63 68 20 72 65 67  |loading each reg|
000071c0  69 73 74 65 72 2c 20 74  68 65 6e 20 74 68 65 20  |ister, then the |
000071d0  66 69 72 73 74 20 72 65  67 69 73 74 65 72 20 77  |first register w|
000071e0  69 6c 6c 20 62 65 20 73  74 6f 72 65 64 20 2f 20  |ill be stored / |
000071f0  6c 6f 61 64 65 64 20 61  74 20 74 68 65 20 61 64  |loaded at the ad|
00007200  64 72 65 73 73 20 69 6e  20 62 61 73 65 2c 20 61  |dress in base, a|
00007210  6e 64 20 74 68 65 20 73  65 63 6f 6e 64 20 61 74  |nd the second at|
00007220  20 28 62 61 73 65 2b 34  29 20 6f 72 20 28 62 61  | (base+4) or (ba|
00007230  73 65 2d 34 29 2c 20 64  65 70 65 6e 64 69 6e 67  |se-4), depending|
00007240  20 6f 6e 20 74 68 65 20  69 6e 63 72 65 6d 65 6e  | on the incremen|
00007250  74 20 2f 20 64 65 63 72  65 6d 65 6e 74 20 6f 70  |t / decrement op|
00007260  74 69 6f 6e 2e 0a 49 66  20 74 68 65 20 61 64 64  |tion..If the add|
00007270  72 65 73 73 20 69 73 20  6d 6f 64 69 66 69 65 64  |ress is modified|
00007280  20 62 65 66 6f 72 65 20  73 74 6f 72 69 6e 67 20  | before storing |
00007290  2f 20 6c 6f 61 64 69 6e  67 20 65 61 63 68 20 72  |/ loading each r|
000072a0  65 67 69 73 74 65 72 2c  20 74 68 65 6e 20 74 68  |egister, then th|
000072b0  65 20 66 69 72 73 74 20  61 64 64 72 65 73 73 20  |e first address |
000072c0  77 69 6c 6c 20 62 65 20  73 74 6f 72 65 64 20 2f  |will be stored /|
000072d0  20 6c 6f 61 64 65 64 20  61 74 20 74 68 65 20 61  | loaded at the a|
000072e0  64 64 72 65 73 73 20 69  6e 20 28 62 61 73 65 2b  |ddress in (base+|
000072f0  34 29 20 6f 72 20 28 62  61 73 65 2d 34 29 2c 20  |4) or (base-4), |
00007300  61 67 61 69 6e 20 64 65  70 65 6e 64 69 6e 67 20  |again depending |
00007310  6f 6e 20 74 68 65 20 69  6e 63 72 65 6d 65 6e 74  |on the increment|
00007320  20 2f 20 64 65 63 72 65  6d 65 6e 74 20 6f 70 74  | / decrement opt|
00007330  69 6f 6e 2e 20 54 68 65  20 73 65 63 6f 6e 64 20  |ion. The second |
00007340  72 65 67 69 73 74 65 72  20 77 69 6c 6c 20 62 65  |register will be|
00007350  20 73 74 6f 72 65 64 20  2f 20 6c 6f 61 64 65 64  | stored / loaded|
00007360  20 61 74 20 28 62 61 73  65 2b 38 29 20 6f 72 20  | at (base+8) or |
00007370  28 62 61 73 65 2d 38 29  2c 20 65 74 63 2e 00 00  |(base-8), etc...|
00007380  44 41 54 41 f1 04 00 00  57 72 69 74 65 20 62 61  |DATA....Write ba|
00007390  63 6b 20 77 69 74 68 20  53 54 4d 20 26 20 4c 44  |ck with STM & LD|
000073a0  4d 0a 23 62 61 63 6b 67  72 6f 75 6e 64 20 77 69  |M.#background wi|
000073b0  6d 70 20 31 0a 41 73 20  74 68 65 20 41 52 4d 20  |mp 1.As the ARM |
000073c0  73 74 6f 72 65 73 20 6f  72 20 6c 6f 61 64 73 20  |stores or loads |
000073d0  72 65 67 69 73 74 65 72  73 2c 20 69 74 20 6d 6f  |registers, it mo|
000073e0  64 69 66 69 65 73 20 74  68 65 20 61 64 64 72 65  |difies the addre|
000073f0  73 73 20 62 65 69 6e 67  20 75 73 65 64 2e 20 54  |ss being used. T|
00007400  68 69 73 20 65 6e 73 75  72 65 73 20 74 68 61 74  |his ensures that|
00007410  20 74 68 65 20 6e 65 78  74 20 72 65 67 69 73 74  | the next regist|
00007420  65 72 20 70 72 6f 63 65  73 73 65 64 20 69 73 20  |er processed is |
00007430  73 74 6f 72 65 64 20 6f  72 20 6c 6f 61 64 65 64  |stored or loaded|
00007440  20 69 6e 20 61 20 63 6f  6e 73 65 63 75 74 69 76  | in a consecutiv|
00007450  65 20 77 6f 72 64 20 6f  66 20 6d 65 6d 6f 72 79  |e word of memory|
00007460  2c 20 73 6f 20 74 68 61  74 20 6f 6e 65 20 77 6f  |, so that one wo|
00007470  72 64 20 69 73 20 6e 6f  74 20 75 73 65 64 20 74  |rd is not used t|
00007480  77 69 63 65 2e 20 49 66  20 77 65 20 73 70 65 63  |wice. If we spec|
00007490  69 66 79 20 74 68 61 74  20 77 65 20 77 61 6e 74  |ify that we want|
000074a0  20 77 72 69 74 65 20 62  61 63 6b 2c 20 74 68 65  | write back, the|
000074b0  6e 20 74 68 65 20 66 69  6e 61 6c 20 61 64 64 72  |n the final addr|
000074c0  65 73 73 2c 20 6f 62 74  61 69 6e 65 64 20 61 66  |ess, obtained af|
000074d0  74 65 72 20 73 74 6f 72  69 6e 67 20 6f 72 20 6c  |ter storing or l|
000074e0  6f 61 64 69 6e 67 20 61  6c 6c 20 74 68 65 20 72  |oading all the r|
000074f0  65 67 69 73 74 65 72 73  20 69 6e 20 74 68 65 20  |egisters in the |
00007500  6c 69 73 74 2c 20 77 69  6c 6c 20 62 65 20 77 72  |list, will be wr|
00007510  69 74 74 65 6e 20 62 61  63 6b 20 69 6e 74 6f 20  |itten back into |
00007520  74 68 65 20 62 61 73 65  20 72 65 67 69 73 74 65  |the base registe|
00007530  72 2e 0a 23 6c 69 6e 65  0a 57 72 69 74 65 20 62  |r..#line.Write b|
00007540  61 63 6b 20 69 73 20 73  65 6c 65 63 74 65 64 2c  |ack is selected,|
00007550  20 61 73 20 77 69 74 68  20 3c 53 54 52 3e 20 61  | as with <STR> a|
00007560  6e 64 20 3c 4c 44 52 3e  2c 20 62 79 20 69 6e 63  |nd <LDR>, by inc|
00007570  6c 75 64 69 6e 67 20 61  20 27 21 27 20 63 68 61  |luding a '!' cha|
00007580  72 61 63 74 65 72 2e 20  54 68 75 73 2c 20 74 68  |racter. Thus, th|
00007590  65 20 66 6f 6c 6c 6f 77  69 6e 67 20 69 6e 73 74  |e following inst|
000075a0  72 75 63 74 69 6f 6e 73  20 61 6c 6c 20 68 61 76  |ructions all hav|
000075b0  65 20 77 72 69 74 65 20  62 61 63 6b 20 73 65 6c  |e write back sel|
000075c0  65 63 74 65 64 3a 0a 23  77 72 61 70 20 6f 66 66  |ected:.#wrap off|
000075d0  0a 23 69 6e 64 65 6e 74  20 32 0a 53 54 4d 49 41  |.#indent 2.STMIA|
000075e0  09 52 30 21 2c 5c 7b 52  31 2c 52 32 5c 7d 0a 53  |.R0!,\{R1,R2\}.S|
000075f0  54 4d 44 41 09 28 62 61  73 65 29 21 2c 5c 7b 52  |TMDA.(base)!,\{R|
00007600  34 2c 52 35 2d 52 39 5c  7d 0a 4c 44 4d 49 42 09  |4,R5-R9\}.LDMIB.|
00007610  52 36 21 2c 5c 7b 52 31  32 2c 52 31 31 2c 52 31  |R6!,\{R12,R11,R1|
00007620  30 5c 7d 0a 23 69 6e 64  65 6e 74 0a 23 77 72 61  |0\}.#indent.#wra|
00007630  70 20 6f 6e 0a 2a 4e 42  2a 3a 20 4e 6f 74 65 20  |p on.*NB*: Note |
00007640  74 68 65 20 75 73 65 20  6f 66 20 72 6f 75 6e 64  |the use of round|
00007650  20 62 72 61 63 6b 65 74  73 20 77 68 65 6e 20 74  | brackets when t|
00007660  68 65 20 76 61 72 69 61  62 6c 65 20 27 62 61 73  |he variable 'bas|
00007670  65 27 20 69 73 20 75 73  65 64 20 74 6f 20 72 65  |e' is used to re|
00007680  66 65 72 20 74 6f 20 61  20 72 65 67 69 73 74 65  |fer to a registe|
00007690  72 2e 20 54 68 69 73 20  70 72 65 76 65 6e 74 73  |r. This prevents|
000076a0  20 74 68 65 20 61 73 73  65 6d 62 6c 65 72 20 69  | the assembler i|
000076b0  6e 74 65 72 70 72 65 74  69 6e 67 20 74 68 65 20  |nterpreting the |
000076c0  27 21 27 20 61 73 20 61  6e 20 69 6e 64 69 72 65  |'!' as an indire|
000076d0  63 74 69 6f 6e 20 6f 70  65 72 61 74 6f 72 20 61  |ction operator a|
000076e0  6e 64 20 63 61 75 73 69  6e 67 20 61 6e 20 65 72  |nd causing an er|
000076f0  72 6f 72 2e 0a 23 6c 69  6e 65 0a 41 66 74 65 72  |ror..#line.After|
00007700  20 65 61 63 68 20 69 6e  73 74 72 75 63 74 69 6f  | each instructio|
00007710  6e 2c 20 74 68 65 20 41  52 4d 20 70 65 72 66 6f  |n, the ARM perfo|
00007720  72 6d 73 20 6f 6e 65 20  6f 66 20 74 68 65 20 66  |rms one of the f|
00007730  6f 6c 6c 6f 77 69 6e 67  20 64 65 70 65 6e 64 69  |ollowing dependi|
00007740  6e 67 20 6f 6e 20 74 68  65 20 64 69 72 65 63 74  |ng on the direct|
00007750  69 6f 6e 20 6f 66 20 73  74 6f 72 61 67 65 20 75  |ion of storage u|
00007760  73 65 64 3a 0a 23 77 72  61 70 20 6f 66 66 0a 23  |sed:.#wrap off.#|
00007770  69 6e 64 65 6e 74 20 32  0a 62 61 73 65 20 3d 20  |indent 2.base = |
00007780  62 61 73 65 20 2b 20 34  2a 6e 09 28 69 6e 63 72  |base + 4*n.(incr|
00007790  65 6d 65 6e 74 29 0a 62  61 73 65 20 3d 20 62 61  |ement).base = ba|
000077a0  73 65 20 2d 20 34 2a 6e  09 28 64 65 63 72 65 6d  |se - 4*n.(decrem|
000077b0  65 6e 74 29 0a 23 69 6e  64 65 6e 74 0a 23 77 72  |ent).#indent.#wr|
000077c0  61 70 20 6f 6e 0a 57 68  65 72 65 20 27 6e 27 20  |ap on.Where 'n' |
000077d0  69 73 20 74 68 65 20 6e  75 6d 62 65 72 20 6f 66  |is the number of|
000077e0  20 72 65 67 69 73 74 65  72 73 20 73 74 6f 72 65  | registers store|
000077f0  64 20 62 79 20 74 68 65  20 69 6e 73 74 72 75 63  |d by the instruc|
00007800  74 69 6f 6e 2e 20 57 72  69 74 65 20 62 61 63 6b  |tion. Write back|
00007810  20 69 73 20 70 72 6f 76  69 64 65 64 20 73 6f 20  | is provided so |
00007820  61 73 20 74 6f 20 70 72  6f 76 69 64 65 20 73 75  |as to provide su|
00007830  70 70 6f 72 74 20 74 68  65 20 63 72 65 61 74 69  |pport the creati|
00007840  6f 6e 20 6f 66 20 3c 73  74 61 63 6b 73 3e 20 75  |on of <stacks> u|
00007850  73 69 6e 67 20 74 68 65  20 4c 44 4d 20 2f 20 53  |sing the LDM / S|
00007860  54 4d 20 69 6e 73 74 72  75 63 74 69 6f 6e 73 2e  |TM instructions.|
00007870  0a 00 00 00 44 41 54 41  86 08 00 00 53 74 61 63  |....DATA....Stac|
00007880  6b 73 0a 23 62 61 63 6b  67 72 6f 75 6e 64 20 77  |ks.#background w|
00007890  69 6d 70 20 31 0a 41 20  73 74 61 63 6b 20 69 73  |imp 1.A stack is|
000078a0  20 61 20 64 61 74 61 20  73 74 72 75 63 74 75 72  | a data structur|
000078b0  65 20 75 73 65 64 20 74  6f 20 73 74 6f 72 65 20  |e used to store |
000078c0  74 68 65 20 63 6f 6e 74  65 6e 74 73 20 6f 66 20  |the contents of |
000078d0  72 65 67 69 73 74 65 72  73 20 66 6f 72 20 6c 61  |registers for la|
000078e0  74 65 72 20 75 73 65 2e  20 41 20 73 65 72 69 65  |ter use. A serie|
000078f0  73 20 6f 66 20 63 6f 6e  74 69 67 75 6f 75 73 20  |s of contiguous |
00007900  6d 65 6d 6f 72 79 20 6c  6f 63 61 74 69 6f 6e 73  |memory locations|
00007910  20 61 72 65 20 73 65 74  20 61 73 69 64 65 20 74  | are set aside t|
00007920  6f 20 68 6f 6c 64 20 74  68 65 20 64 61 74 61 2e  |o hold the data.|
00007930  20 41 20 70 6f 69 6e 74  65 72 20 69 73 20 75 73  | A pointer is us|
00007940  65 64 20 74 6f 20 72 65  63 6f 72 64 20 77 68 65  |ed to record whe|
00007950  72 65 20 74 68 65 20 74  6f 70 20 6f 66 20 74 68  |re the top of th|
00007960  65 20 73 74 61 63 6b 20  69 73 2e 20 57 68 65 6e  |e stack is. When|
00007970  20 61 6e 20 69 74 65 6d  20 69 73 20 61 64 64 65  | an item is adde|
00007980  64 20 74 6f 20 74 68 65  20 73 74 61 63 6b 2c 20  |d to the stack, |
00007990  77 65 20 73 74 6f 72 65  20 69 74 20 69 6e 20 74  |we store it in t|
000079a0  68 65 20 6d 65 6d 6f 72  79 20 77 6f 72 64 20 70  |he memory word p|
000079b0  6f 69 6e 74 65 64 20 74  6f 20 62 79 20 74 68 65  |ointed to by the|
000079c0  20 73 74 61 63 6b 20 70  6f 69 6e 74 65 72 2e 20  | stack pointer. |
000079d0  57 65 20 74 68 65 6e 20  69 6e 63 72 65 6d 65 6e  |We then incremen|
000079e0  74 20 74 68 65 20 70 6f  69 6e 74 65 72 20 74 6f  |t the pointer to|
000079f0  20 70 6f 69 6e 74 20 74  6f 20 74 68 65 20 6e 65  | point to the ne|
00007a00  78 74 20 77 6f 72 64 2e  0a 57 68 65 6e 20 77 65  |xt word..When we|
00007a10  20 72 65 6d 6f 76 65 20  61 6e 20 69 74 65 6d 20  | remove an item |
00007a20  66 72 6f 6d 20 74 68 65  20 73 74 61 63 6b 2c 20  |from the stack, |
00007a30  77 65 20 66 69 72 73 74  20 64 65 63 72 65 6d 65  |we first decreme|
00007a40  6e 74 20 74 68 65 20 73  74 61 63 6b 20 70 6f 69  |nt the stack poi|
00007a50  6e 74 65 72 20 61 6e 64  20 74 68 65 6e 20 61 63  |nter and then ac|
00007a60  63 65 73 73 20 74 68 65  20 6d 65 6d 6f 72 79 20  |cess the memory |
00007a70  77 6f 72 64 20 77 68 69  63 68 20 69 74 20 70 6f  |word which it po|
00007a80  69 6e 74 73 20 74 6f 2e  20 54 68 65 20 73 74 61  |ints to. The sta|
00007a90  63 6b 20 69 73 20 74 68  65 72 65 66 6f 72 65 20  |ck is therefore |
00007aa0  61 20 27 6c 61 73 74 20  69 6e 2c 20 66 69 72 73  |a 'last in, firs|
00007ab0  74 20 6f 75 74 27 20 28  4c 49 46 4f 29 20 73 74  |t out' (LIFO) st|
00007ac0  72 75 63 74 75 72 65 2e  0a 23 6c 69 6e 65 0a 23  |ructure..#line.#|
00007ad0  77 72 61 70 20 6f 66 66  0a 54 68 65 72 65 20 61  |wrap off.There a|
00007ae0  72 65 20 66 6f 75 72 20  70 6f 73 73 69 62 6c 65  |re four possible|
00007af0  20 73 74 61 63 6b 20 73  74 72 75 63 74 75 72 65  | stack structure|
00007b00  73 2c 20 77 68 69 63 68  20 61 72 65 20 6d 61 64  |s, which are mad|
00007b10  65 20 6f 66 20 63 6f 6d  62 69 6e 61 74 69 6f 6e  |e of combination|
00007b20  73 20 6f 66 20 74 77 6f  20 76 61 72 69 61 6e 74  |s of two variant|
00007b30  73 2e 0a 23 77 72 61 70  20 6e 6f 6a 6f 69 6e 0a  |s..#wrap nojoin.|
00007b40  54 68 65 20 66 69 72 73  74 20 6f 66 20 74 68 65  |The first of the|
00007b50  73 65 20 76 61 72 69 61  6e 74 73 20 64 65 74 65  |se variants dete|
00007b60  72 6d 69 6e 65 73 20 77  68 69 63 68 20 64 69 72  |rmines which dir|
00007b70  65 63 74 69 6f 6e 20 74  68 65 20 73 74 61 63 6b  |ection the stack|
00007b80  20 67 72 6f 77 73 20 69  6e 2e 20 57 65 20 63 61  | grows in. We ca|
00007b90  6e 20 63 72 65 61 74 65  20 73 74 61 63 6b 73 20  |n create stacks |
00007ba0  74 68 61 74 20 67 72 6f  77 20 75 70 77 61 72 64  |that grow upward|
00007bb0  73 20 69 6e 20 6d 65 6d  6f 72 79 20 61 73 20 65  |s in memory as e|
00007bc0  78 74 72 61 20 69 74 65  6d 73 20 61 72 65 20 70  |xtra items are p|
00007bd0  75 73 68 65 64 20 6f 6e  2c 20 61 6e 64 20 63 6f  |ushed on, and co|
00007be0  6e 74 72 61 63 74 20 64  6f 77 6e 77 61 72 64 73  |ntract downwards|
00007bf0  20 61 73 20 69 74 65 6d  73 20 61 72 65 20 70 75  | as items are pu|
00007c00  6c 6c 65 64 20 6f 66 66  20 28 61 73 63 65 6e 64  |lled off (ascend|
00007c10  69 6e 67 20 73 74 61 63  6b 29 2c 20 6f 72 20 74  |ing stack), or t|
00007c20  68 65 20 6f 70 70 6f 73  69 74 65 2c 20 77 68 65  |he opposite, whe|
00007c30  72 65 20 74 68 65 20 73  74 61 63 6b 20 67 72 6f  |re the stack gro|
00007c40  77 73 20 64 6f 77 6e 77  61 72 64 73 20 69 6e 20  |ws downwards in |
00007c50  6d 65 6d 6f 72 79 20 61  73 20 69 74 65 6d 73 20  |memory as items |
00007c60  61 72 65 20 61 64 64 65  64 2c 20 61 6e 64 20 63  |are added, and c|
00007c70  6f 6e 74 72 61 63 74 73  20 62 61 63 6b 20 75 70  |ontracts back up|
00007c80  20 61 67 61 69 6e 20 61  73 20 74 68 65 79 20 61  | again as they a|
00007c90  72 65 20 70 75 6c 6c 65  64 20 6f 66 66 20 28 64  |re pulled off (d|
00007ca0  65 73 63 65 6e 64 69 6e  67 20 73 74 61 63 6b 29  |escending stack)|
00007cb0  2e 0a 57 68 65 6e 20 61  20 73 74 61 63 6b 20 69  |..When a stack i|
00007cc0  73 20 69 6d 70 6c 65 6d  65 6e 74 65 64 2c 20 79  |s implemented, y|
00007cd0  6f 75 20 6d 75 73 74 20  64 65 63 69 64 65 20 65  |ou must decide e|
00007ce0  78 61 63 74 6c 79 20 77  68 61 74 20 74 68 65 20  |xactly what the |
00007cf0  73 74 61 63 6b 20 70 6f  69 6e 74 65 72 20 73 68  |stack pointer sh|
00007d00  6f 75 6c 64 20 70 6f 69  6e 74 20 74 6f 2e 20 49  |ould point to. I|
00007d10  74 20 63 6f 75 6c 64 20  70 6f 69 6e 74 20 74 6f  |t could point to|
00007d20  20 74 68 65 20 74 6f 70  20 65 6e 74 72 79 20 6f  | the top entry o|
00007d30  6e 20 74 68 65 20 73 74  61 63 6b 2c 20 69 2e 65  |n the stack, i.e|
00007d40  2e 2c 20 74 68 65 20 6f  6e 65 20 6d 6f 73 74 20  |., the one most |
00007d50  72 65 63 65 6e 74 6c 79  20 70 75 73 68 65 64 20  |recently pushed |
00007d60  6f 6e 20 74 68 65 20 73  74 61 63 6b 20 28 27 66  |on the stack ('f|
00007d70  75 6c 6c 27 29 2c 20 6f  72 20 61 6c 65 72 6e 61  |ull'), or alerna|
00007d80  74 69 76 65 6c 79 2c 20  69 74 20 6d 61 79 20 70  |tively, it may p|
00007d90  6f 69 6e 74 20 74 6f 20  74 68 65 20 6e 65 78 74  |oint to the next|
00007da0  20 61 76 61 69 6c 61 62  6c 65 20 73 70 61 63 65  | available space|
00007db0  20 69 6e 20 74 68 65 20  73 74 61 63 6b 27 73 20  | in the stack's |
00007dc0  6d 65 6d 6f 72 79 20 61  72 65 61 2c 20 69 2e 65  |memory area, i.e|
00007dd0  2e 2c 20 74 68 65 20 61  64 64 72 65 73 73 20 61  |., the address a|
00007de0  20 77 68 69 63 68 20 61  20 6e 65 77 20 69 74 65  | which a new ite|
00007df0  6d 20 77 6f 75 6c 64 20  62 65 20 73 74 6f 72 65  |m would be store|
00007e00  64 20 69 66 20 69 74 20  77 65 72 65 20 70 75 73  |d if it were pus|
00007e10  68 65 64 20 6f 6e 74 6f  20 74 68 65 20 73 74 61  |hed onto the sta|
00007e20  63 6b 20 28 27 65 6d 70  74 79 27 29 2e 0a 48 65  |ck ('empty')..He|
00007e30  6e 63 65 20 74 68 65 20  66 6f 75 72 20 73 74 61  |nce the four sta|
00007e40  63 6b 20 73 74 72 75 63  74 75 72 65 73 20 61 72  |ck structures ar|
00007e50  65 3a 0a 23 77 72 61 70  20 6f 66 66 0a 23 69 6e  |e:.#wrap off.#in|
00007e60  64 65 6e 74 20 32 0a 28  31 29 09 46 75 6c 6c 2c  |dent 2.(1).Full,|
00007e70  20 61 73 63 65 6e 64 69  6e 67 20 73 74 61 63 6b  | ascending stack|
00007e80  0a 28 32 29 09 46 75 6c  6c 2c 20 64 65 73 63 65  |.(2).Full, desce|
00007e90  6e 64 69 6e 67 20 73 74  61 63 6b 0a 28 33 29 09  |nding stack.(3).|
00007ea0  45 6d 70 74 79 2c 20 61  73 63 65 6e 64 69 6e 67  |Empty, ascending|
00007eb0  20 73 74 61 63 6b 09 20  20 20 20 2a 4d 6f 73 74  | stack.    *Most|
00007ec0  20 75 73 65 66 75 6c 2a  0a 28 34 29 09 45 6d 70  | useful*.(4).Emp|
00007ed0  74 79 2c 20 64 65 73 63  65 6e 64 69 6e 67 20 73  |ty, descending s|
00007ee0  74 61 63 6b 0a 23 69 6e  64 65 6e 74 0a 23 77 72  |tack.#indent.#wr|
00007ef0  61 70 20 6e 6f 6a 6f 69  6e 0a 23 6c 69 6e 65 0a  |ap nojoin.#line.|
00007f00  54 68 65 20 3c 4c 44 4d  3e 20 61 6e 64 20 3c 53  |The <LDM> and <S|
00007f10  54 4d 3e 20 69 6e 73 74  72 75 63 74 69 6f 6e 73  |TM> instructions|
00007f20  20 70 72 6f 76 69 64 65  20 74 68 65 20 66 61 63  | provide the fac|
00007f30  69 6c 69 74 69 65 73 20  74 6f 20 69 6d 70 6c 65  |ilities to imple|
00007f40  6d 65 6e 74 20 73 74 61  63 6b 73 20 69 6e 20 6d  |ment stacks in m|
00007f50  61 63 68 69 6e 65 20 63  6f 64 65 2e 20 54 68 65  |achine code. The|
00007f60  20 65 6c 65 6d 65 6e 74  73 20 70 75 73 68 65 64  | elements pushed|
00007f70  20 74 6f 2c 20 61 6e 64  20 70 75 6c 6c 65 64 20  | to, and pulled |
00007f80  66 72 6f 6d 2c 20 74 68  65 20 73 74 61 63 6b 20  |from, the stack |
00007f90  61 72 65 20 74 68 65 20  72 65 67 69 73 74 65 72  |are the register|
00007fa0  20 63 6f 6e 74 65 6e 74  73 20 73 70 65 63 69 66  | contents specif|
00007fb0  69 65 64 20 69 6e 20 74  68 65 20 69 6e 73 74 72  |ied in the instr|
00007fc0  75 63 74 69 6f 6e 27 73  20 72 65 67 69 73 74 65  |uction's registe|
00007fd0  72 20 6c 69 73 74 2e 0a  54 68 65 20 73 74 61 63  |r list..The stac|
00007fe0  6b 20 70 6f 69 6e 74 65  72 20 69 73 20 69 6d 70  |k pointer is imp|
00007ff0  6c 65 6d 65 6e 74 65 64  20 75 73 69 6e 67 20 74  |lemented using t|
00008000  68 65 20 69 6e 73 74 72  75 63 74 69 6f 6e 27 73  |he instruction's|
00008010  20 62 61 73 65 20 72 65  67 69 73 74 65 72 2e 20  | base register. |
00008020  54 68 69 73 20 61 6c 77  61 79 73 20 70 6f 69 6e  |This always poin|
00008030  74 73 20 74 6f 20 74 68  65 20 61 64 64 72 65 73  |ts to the addres|
00008040  73 20 69 6e 20 6d 65 6d  6f 72 79 20 77 68 65 72  |s in memory wher|
00008050  65 20 74 68 65 20 69 6e  73 74 72 75 63 74 69 6f  |e the instructio|
00008060  6e 20 77 69 6c 6c 20 73  74 6f 72 65 20 6f 72 20  |n will store or |
00008070  6c 6f 61 64 20 64 61 74  61 2e 20 52 31 33 20 69  |load data. R13 i|
00008080  73 20 75 73 65 64 20 6d  6f 73 74 20 6f 66 74 65  |s used most ofte|
00008090  6e 20 66 6f 72 20 74 68  69 73 20 70 75 72 70 6f  |n for this purpo|
000080a0  73 65 20 61 6c 74 68 6f  75 67 68 20 61 6e 79 20  |se although any |
000080b0  72 65 67 69 73 74 65 72  20 63 6f 75 6c 64 20 62  |register could b|
000080c0  65 20 75 73 65 64 2e 0a  23 6c 69 6e 65 0a 23 61  |e used..#line.#a|
000080d0  6c 69 67 6e 20 63 65 6e  74 72 65 0a 3c 49 6d 70  |lign centre.<Imp|
000080e0  6c 65 6d 65 6e 74 69 6e  67 20 73 74 61 63 6b 73  |lementing stacks|
000080f0  3d 3e 73 74 61 63 6b 73  32 3e 00 00 44 41 54 41  |=>stacks2>..DATA|
00008100  78 05 00 00 49 6d 70 6c  65 6d 65 6e 74 69 6e 67  |x...Implementing|
00008110  20 73 74 61 63 6b 73 0a  23 62 61 63 6b 67 72 6f  | stacks.#backgro|
00008120  75 6e 64 20 77 69 6d 70  20 31 0a 23 77 72 61 70  |und wimp 1.#wrap|
00008130  20 6e 6f 6a 6f 69 6e 0a  49 6e 69 74 69 61 6c 6c  | nojoin.Initiall|
00008140  79 2c 20 74 68 65 20 73  74 61 63 6b 20 70 6f 69  |y, the stack poi|
00008150  6e 74 65 72 20 77 69 6c  6c 20 62 65 20 73 65 74  |nter will be set|
00008160  20 74 6f 20 63 6f 6e 74  61 69 6e 20 74 68 65 20  | to contain the |
00008170  62 61 73 65 20 61 64 64  72 65 73 73 20 6f 66 20  |base address of |
00008180  74 68 65 20 73 74 61 63  6b 27 73 20 6d 65 6d 6f  |the stack's memo|
00008190  72 79 20 61 72 65 61 2e  20 57 72 69 74 65 20 62  |ry area. Write b|
000081a0  61 63 6b 20 63 61 6e 20  74 68 65 6e 20 62 65 20  |ack can then be |
000081b0  75 73 65 64 20 77 69 74  68 20 74 68 65 20 3c 4c  |used with the <L|
000081c0  44 4d 3e 20 61 6e 64 20  3c 53 54 4d 3e 20 69 6e  |DM> and <STM> in|
000081d0  73 74 72 75 63 74 69 6f  6e 73 20 74 6f 20 6d 61  |structions to ma|
000081e0  6b 65 20 74 68 65 20 41  52 4d 20 61 75 74 6f 6d  |ke the ARM autom|
000081f0  61 74 69 63 61 6c 6c 74  20 75 70 64 61 74 65 20  |aticallt update |
00008200  74 68 65 20 73 74 61 63  6b 20 70 6f 69 6e 74 65  |the stack pointe|
00008210  72 20 65 61 63 68 20 74  69 6d 65 20 72 65 67 69  |r each time regi|
00008220  73 74 65 72 73 20 61 72  65 20 70 75 73 68 65 64  |sters are pushed|
00008230  20 74 6f 20 74 68 65 20  73 74 61 63 6b 20 6f 72  | to the stack or|
00008240  20 70 75 6c 6c 65 64 20  6f 66 66 20 69 74 2e 0a  | pulled off it..|
00008250  46 6f 72 20 61 6e 20 65  6d 70 74 79 20 61 73 63  |For an empty asc|
00008260  65 6e 64 69 6e 67 20 73  74 61 63 6b 2c 20 74 68  |ending stack, th|
00008270  65 20 66 6f 6c 6c 6f 77  69 6e 67 20 69 6e 73 74  |e following inst|
00008280  72 75 63 74 69 6f 6e 73  20 61 72 65 20 75 73 65  |ructions are use|
00008290  64 3a 0a 23 69 6e 64 65  6e 74 20 32 0a 50 75 73  |d:.#indent 2.Pus|
000082a0  68 20 72 65 67 69 73 74  65 72 73 0a 23 69 6e 64  |h registers.#ind|
000082b0  65 6e 74 20 34 0a 53 54  4d 49 41 20 52 31 33 21  |ent 4.STMIA R13!|
000082c0  2c 5c 7b 72 65 67 69 73  74 65 72 5f 6c 69 73 74  |,\{register_list|
000082d0  5c 7d 0a 23 69 6e 64 65  6e 74 0a 50 75 6c 6c 20  |\}.#indent.Pull |
000082e0  72 65 67 69 73 74 65 72  73 0a 23 69 6e 64 65 6e  |registers.#inden|
000082f0  74 20 34 0a 4c 44 4d 44  42 20 52 31 33 21 2c 5c  |t 4.LDMDB R13!,\|
00008300  7b 72 65 67 69 73 74 65  72 5f 6c 69 73 74 5c 7d  |{register_list\}|
00008310  0a 23 69 6e 64 65 6e 74  0a 23 69 6e 64 65 6e 74  |.#indent.#indent|
00008320  0a 2a 4e 42 2a 3a 20 54  68 65 20 75 73 65 20 6f  |.*NB*: The use o|
00008330  66 20 77 72 69 74 65 20  62 61 63 6b 20 69 73 20  |f write back is |
00008340  76 69 74 61 6c 20 2d 20  77 69 74 68 6f 75 74 20  |vital - without |
00008350  69 74 20 74 68 65 20 73  74 61 63 6b 20 70 6f 69  |it the stack poi|
00008360  6e 74 65 72 20 77 69 6c  6c 20 6e 65 76 65 72 20  |nter will never |
00008370  62 65 20 75 70 64 61 74  65 64 2c 20 61 6e 64 20  |be updated, and |
00008380  74 68 65 20 73 74 61 63  6b 20 77 69 6c 6c 20 62  |the stack will b|
00008390  65 20 63 6f 72 72 75 70  74 65 64 2e 0a 23 6c 69  |e corrupted..#li|
000083a0  6e 65 0a 54 68 65 20 6f  70 74 69 6f 6e 73 20 66  |ne.The options f|
000083b0  6f 72 20 74 68 65 20 53  54 4d 20 69 6e 73 74 72  |or the STM instr|
000083c0  75 63 74 69 6f 6e 20 61  72 65 20 61 6c 77 61 79  |uction are alway|
000083d0  73 20 72 65 76 65 72 73  65 64 20 69 6e 20 74 68  |s reversed in th|
000083e0  65 20 63 61 73 65 20 6f  66 20 74 68 65 20 4c 44  |e case of the LD|
000083f0  4d 20 69 6e 73 74 72 75  63 74 69 6f 6e 2e 20 49  |M instruction. I|
00008400  74 20 63 61 6e 20 62 65  20 63 6f 6e 66 75 73 69  |t can be confusi|
00008410  6e 67 20 74 6f 20 68 61  76 65 20 74 6f 20 74 72  |ng to have to tr|
00008420  61 6e 73 6c 61 74 65 20  74 68 65 20 73 74 61 63  |anslate the stac|
00008430  6b 20 74 79 70 65 20 75  73 65 64 20 69 6e 74 6f  |k type used into|
00008440  20 74 68 65 20 61 70 70  72 6f 70 72 69 61 74 65  | the appropriate|
00008450  20 6f 70 74 69 6f 6e 73  2c 20 73 6f 20 74 68 65  | options, so the|
00008460  20 61 73 73 65 6d 62 6c  65 72 20 70 72 6f 76 69  | assembler provi|
00008470  64 65 73 20 61 6e 20 65  61 73 69 65 72 20 77 61  |des an easier wa|
00008480  79 2e 0a 57 65 20 63 61  6e 20 73 69 6d 70 6c 79  |y..We can simply|
00008490  20 73 70 65 63 69 66 79  20 74 68 65 20 74 79 70  | specify the typ|
000084a0  65 20 6f 66 20 73 74 61  63 6b 20 62 65 69 6e 67  |e of stack being|
000084b0  20 75 73 65 64 2c 20 77  68 69 63 68 20 77 69 6c  | used, which wil|
000084c0  6c 20 62 65 20 74 68 65  20 73 61 6d 65 20 66 6f  |l be the same fo|
000084d0  72 20 62 6f 74 68 20 69  6e 73 74 72 75 63 74 69  |r both instructi|
000084e0  6f 6e 73 3a 0a 23 69 6e  64 65 6e 74 20 32 0a 46  |ons:.#indent 2.F|
000084f0  41 09 46 75 6c 6c 2c 20  61 73 63 65 6e 64 69 6e  |A.Full, ascendin|
00008500  67 20 73 74 61 63 6b 0a  46 44 09 46 75 6c 6c 2c  |g stack.FD.Full,|
00008510  20 64 65 73 63 65 6e 64  69 6e 67 20 73 74 61 63  | descending stac|
00008520  6b 0a 45 41 09 45 6d 70  74 79 2c 20 61 73 63 65  |k.EA.Empty, asce|
00008530  6e 64 69 6e 67 20 73 74  61 63 6b 0a 45 44 09 45  |nding stack.ED.E|
00008540  6d 70 74 79 2c 20 64 65  73 63 65 6e 64 69 6e 67  |mpty, descending|
00008550  20 73 74 61 63 6b 0a 23  69 6e 64 65 6e 74 0a 54  | stack.#indent.T|
00008560  68 65 20 61 73 73 65 6d  62 6c 65 72 20 77 69 6c  |he assembler wil|
00008570  6c 20 74 68 65 6e 20 63  68 6f 6f 73 65 20 61 70  |l then choose ap|
00008580  70 72 6f 70 72 69 61 74  65 20 6f 70 74 69 6f 6e  |propriate option|
00008590  73 20 66 6f 72 20 74 68  65 20 69 6e 73 74 72 75  |s for the instru|
000085a0  63 74 69 6f 6e 2e 0a 54  68 65 20 65 6d 70 74 79  |ction..The empty|
000085b0  20 61 73 63 65 6e 64 69  6e 67 20 73 74 61 63 6b  | ascending stack|
000085c0  20 63 6f 75 6c 64 20 74  68 75 73 20 62 65 20 69  | could thus be i|
000085d0  6d 70 6c 65 6d 65 6e 74  65 64 20 61 73 20 66 6f  |mplemented as fo|
000085e0  6c 6c 6f 77 73 3a 0a 23  69 6e 64 65 6e 74 20 32  |llows:.#indent 2|
000085f0  0a 50 75 73 68 20 72 65  67 69 73 74 65 72 73 0a  |.Push registers.|
00008600  23 69 6e 64 65 6e 74 20  34 0a 53 54 4d 45 41 20  |#indent 4.STMEA |
00008610  52 31 33 21 2c 5c 7b 72  65 67 69 73 74 65 72 5f  |R13!,\{register_|
00008620  6c 69 73 74 5c 7d 0a 23  69 6e 64 65 6e 74 0a 50  |list\}.#indent.P|
00008630  75 6c 6c 20 72 65 67 69  73 74 65 72 73 0a 23 69  |ull registers.#i|
00008640  6e 64 65 6e 74 20 34 0a  4c 44 4d 45 41 20 52 31  |ndent 4.LDMEA R1|
00008650  33 21 2c 5c 7b 72 65 67  69 73 74 65 72 5f 6c 69  |3!,\{register_li|
00008660  73 74 5c 7d 0a 23 69 6e  64 65 6e 74 0a 23 69 6e  |st\}.#indent.#in|
00008670  64 65 6e 74 44 41 54 41  e7 02 00 00 45 51 55 3a  |dentDATA....EQU:|
00008680  20 53 74 6f 72 69 6e 67  20 44 61 74 61 0a 23 62  | Storing Data.#b|
00008690  61 63 6b 67 72 6f 75 6e  64 20 77 69 6d 70 20 31  |ackground wimp 1|
000086a0  0a 23 77 72 61 70 20 6f  6e 0a 54 68 69 73 20 70  |.#wrap on.This p|
000086b0  73 65 75 64 6f 20 6f 70  63 6f 64 65 20 61 6c 6c  |seudo opcode all|
000086c0  6f 77 73 20 75 73 20 74  6f 20 72 65 73 65 72 76  |ows us to reserv|
000086d0  65 20 67 69 76 65 6e 20  61 6d 6f 75 6e 74 73 20  |e given amounts |
000086e0  6f 66 20 6d 65 6d 6f 72  79 20 66 6f 72 20 73 74  |of memory for st|
000086f0  6f 72 69 6e 67 20 74 65  78 74 20 73 74 72 69 6e  |oring text strin|
00008700  67 73 2c 20 64 61 74 61  20 74 61 62 6c 65 73 2c  |gs, data tables,|
00008710  20 76 61 72 69 61 62 6c  65 73 2c 20 65 74 63 2e  | variables, etc.|
00008720  20 49 74 20 61 6c 73 6f  20 61 6c 6c 6f 77 73 20  | It also allows |
00008730  75 73 20 74 6f 20 64 65  66 69 6e 65 20 74 68 65  |us to define the|
00008740  20 63 6f 6e 74 65 6e 74  73 20 6f 66 20 74 68 65  | contents of the|
00008750  20 6d 65 6d 6f 72 79 20  72 65 73 65 72 76 65 64  | memory reserved|
00008760  2e 0a 23 6c 69 6e 65 0a  54 68 65 20 45 51 55 20  |..#line.The EQU |
00008770  6f 70 63 6f 64 65 73 20  70 72 6f 76 69 64 65 64  |opcodes provided|
00008780  20 61 72 65 20 64 65 73  63 72 69 62 65 64 20 62  | are described b|
00008790  65 6c 6f 77 3a 0a 23 77  72 61 70 20 6f 66 66 0a  |elow:.#wrap off.|
000087a0  23 74 61 62 0a 23 69 6e  64 65 6e 74 20 39 0a 2a  |#tab.#indent 9.*|
000087b0  4e 61 6d 65 2a 09 2a 46  75 6e 63 74 69 6f 6e 2a  |Name*.*Function*|
000087c0  0a 45 51 55 42 09 52 65  73 65 72 76 65 20 6f 6e  |.EQUB.Reserve on|
000087d0  65 20 62 79 74 65 0a 45  51 55 57 09 52 65 73 65  |e byte.EQUW.Rese|
000087e0  72 76 65 20 74 77 6f 20  62 79 74 65 73 20 28 6f  |rve two bytes (o|
000087f0  6e 65 20 27 77 6f 72 64  27 29 0a 45 51 55 44 09  |ne 'word').EQUD.|
00008800  52 65 73 65 72 76 65 20  66 6f 75 72 20 62 79 74  |Reserve four byt|
00008810  65 73 20 28 64 6f 75 62  6c 65 20 27 77 6f 72 64  |es (double 'word|
00008820  27 29 0a 45 51 55 53 09  52 65 73 65 72 76 65 20  |').EQUS.Reserve |
00008830  73 74 72 69 6e 67 20 28  7a 65 72 6f 20 74 6f 20  |string (zero to |
00008840  32 35 35 20 63 68 61 72  61 63 74 65 72 73 29 0a  |255 characters).|
00008850  23 69 6e 64 65 6e 74 0a  23 77 72 61 70 20 6e 6f  |#indent.#wrap no|
00008860  6a 6f 69 6e 0a 57 68 65  6e 20 6f 6e 65 20 6f 66  |join.When one of|
00008870  20 74 68 65 73 65 20 64  69 72 65 63 74 69 76 65  | these directive|
00008880  73 20 69 73 20 61 73 73  65 6d 62 6c 65 64 2c 20  |s is assembled, |
00008890  74 68 65 20 61 72 67 75  6d 65 6e 74 20 66 6f 6c  |the argument fol|
000088a0  6c 6f 77 69 6e 67 20 69  74 20 69 73 20 65 76 61  |lowing it is eva|
000088b0  6c 75 61 74 65 64 20 61  6e 64 20 74 68 65 20 72  |luated and the r|
000088c0  65 73 75 6c 74 20 69 73  20 73 74 6f 72 65 64 20  |esult is stored |
000088d0  69 6e 20 6d 65 6d 6f 72  79 2e 20 54 68 65 20 76  |in memory. The v|
000088e0  61 6c 75 65 20 6f 66 20  3c 50 25 3e 20 69 73 20  |alue of <P%> is |
000088f0  74 68 65 6e 20 69 6e 63  72 65 6d 65 6e 74 65 64  |then incremented|
00008900  20 62 79 20 74 68 65 20  61 70 70 72 6f 70 72 69  | by the appropri|
00008910  61 74 65 20 61 6d 6f 75  6e 74 2e 0a 41 6c 6c 20  |ate amount..All |
00008920  73 74 72 69 6e 67 73 20  73 74 6f 72 65 64 20 77  |strings stored w|
00008930  69 74 68 20 45 51 55 53  20 73 68 6f 75 6c 64 20  |ith EQUS should |
00008940  74 65 72 6d 69 6e 61 74  65 20 77 69 74 68 20 61  |terminate with a|
00008950  20 7a 65 72 6f 20 62 79  74 65 2e 00 44 41 54 41  | zero byte..DATA|
00008960  1b 01 00 00 4c 25 3a 20  55 70 70 65 72 20 4c 69  |....L%: Upper Li|
00008970  6d 69 74 20 66 6f 72 20  52 61 6e 67 65 20 43 68  |mit for Range Ch|
00008980  65 63 6b 0a 23 62 61 63  6b 67 72 6f 75 6e 64 20  |eck.#background |
00008990  77 69 6d 70 20 31 0a 23  77 72 61 70 20 6f 6e 0a  |wimp 1.#wrap on.|
000089a0  54 68 65 20 63 6f 6e 74  65 6e 74 73 20 6f 66 20  |The contents of |
000089b0  74 68 69 73 20 69 6e 74  65 67 65 72 20 76 61 72  |this integer var|
000089c0  69 61 62 6c 65 20 74 65  6c 6c 20 74 68 65 20 61  |iable tell the a|
000089d0  73 73 65 6d 62 6c 65 72  20 77 68 65 72 65 20 74  |ssembler where t|
000089e0  68 65 20 75 70 70 65 72  20 6d 65 6d 6f 72 79 20  |he upper memory |
000089f0  6c 69 6d 69 74 20 66 6f  72 20 74 68 65 20 6f 62  |limit for the ob|
00008a00  6a 65 63 74 20 63 6f 64  65 20 69 73 2e 20 49 66  |ject code is. If|
00008a10  20 72 61 6e 67 65 20 63  68 65 63 6b 69 6e 67 20  | range checking |
00008a20  69 73 20 73 70 65 63 69  66 69 65 64 20 69 6e 20  |is specified in |
00008a30  74 68 65 20 3c 4f 50 54  3e 20 63 6f 64 65 2c 20  |the <OPT> code, |
00008a40  61 6e 20 65 72 72 6f 72  20 6d 65 73 73 61 67 65  |an error message|
00008a50  20 77 69 6c 6c 20 62 65  20 73 65 6e 74 20 69 66  | will be sent if|
00008a60  20 74 68 69 73 20 6c 69  6d 69 74 20 69 73 20 72  | this limit is r|
00008a70  65 61 63 68 65 64 2e 00  44 41 54 41 02 05 00 00  |eached..DATA....|
00008a80  4f 50 54 0a 23 62 61 63  6b 67 72 6f 75 6e 64 20  |OPT.#background |
00008a90  77 69 6d 70 20 31 0a 23  77 72 61 70 20 6f 6e 0a  |wimp 1.#wrap on.|
00008aa0  54 68 69 73 20 70 73 65  75 64 6f 20 6f 70 63 6f  |This pseudo opco|
00008ab0  64 65 20 64 6f 65 73 20  6e 6f 74 20 70 72 6f 64  |de does not prod|
00008ac0  75 63 65 20 61 6e 79 20  6d 61 63 68 69 6e 65 20  |uce any machine |
00008ad0  63 6f 64 65 2c 20 62 75  74 20 64 69 72 65 63 74  |code, but direct|
00008ae0  73 20 74 68 65 20 61 73  73 65 6d 62 6c 65 72 20  |s the assembler |
00008af0  74 6f 20 70 65 72 66 6f  72 6d 20 61 20 6e 75 6d  |to perform a num|
00008b00  62 65 72 20 6f 66 20 66  75 6e 63 74 69 6f 6e 73  |ber of functions|
00008b10  2c 20 77 68 69 63 68 20  61 72 65 20 64 65 73 63  |, which are desc|
00008b20  72 69 62 65 64 20 69 6e  20 74 68 65 20 66 6f 6c  |ribed in the fol|
00008b30  6c 6f 77 69 6e 67 20 74  61 62 6c 65 3a 0a 23 77  |lowing table:.#w|
00008b40  72 61 70 20 6f 66 66 0a  23 61 6c 69 67 6e 20 63  |rap off.#align c|
00008b50  65 6e 74 72 65 0a 23 69  6e 64 65 6e 74 20 31 37  |entre.#indent 17|
00008b60  0a 23 74 61 62 0a 09 2a  52 61 6e 67 65 2a 09 2a  |.#tab..*Range*.*|
00008b70  4f 66 66 73 65 74 2a 09  2a 45 72 72 6f 72 73 2a  |Offset*.*Errors*|
00008b80  09 2a 4c 69 73 74 69 6e  67 2a 0a 09 2a 43 68 65  |.*Listing*..*Che|
00008b90  63 6b 2a 09 2a 41 73 73  65 6d 62 6c 79 2a 09 2a  |ck*.*Assembly*.*|
00008ba0  52 65 70 6f 72 74 65 64  2a 09 2a 50 72 6f 64 75  |Reported*.*Produ|
00008bb0  63 65 64 2a 0a 4f 50 54  20 30 09 4e 6f 09 4e 6f  |ced*.OPT 0.No.No|
00008bc0  09 4e 6f 09 4e 6f 0a 4f  50 54 20 31 09 4e 6f 09  |.No.No.OPT 1.No.|
00008bd0  4e 6f 09 4e 6f 09 59 65  73 0a 4f 50 54 20 32 09  |No.No.Yes.OPT 2.|
00008be0  4e 6f 09 4e 6f 09 59 65  73 09 4e 6f 0a 4f 50 54  |No.No.Yes.No.OPT|
00008bf0  20 33 09 4e 6f 09 4e 6f  09 59 65 73 09 59 65 73  | 3.No.No.Yes.Yes|
00008c00  0a 4f 50 54 20 34 09 4e  6f 09 59 65 73 09 4e 6f  |.OPT 4.No.Yes.No|
00008c10  09 4e 6f 0a 4f 50 54 20  35 09 4e 6f 09 59 65 73  |.No.OPT 5.No.Yes|
00008c20  09 4e 6f 09 59 65 73 0a  4f 50 54 20 36 09 4e 6f  |.No.Yes.OPT 6.No|
00008c30  09 59 65 73 09 59 65 73  09 4e 6f 0a 4f 50 54 20  |.Yes.Yes.No.OPT |
00008c40  37 09 4e 6f 09 59 65 73  09 59 65 73 09 59 65 73  |7.No.Yes.Yes.Yes|
00008c50  0a 4f 50 54 20 38 09 59  65 73 09 4e 6f 09 4e 6f  |.OPT 8.Yes.No.No|
00008c60  09 4e 6f 0a 4f 50 54 20  39 09 59 65 73 09 4e 6f  |.No.OPT 9.Yes.No|
00008c70  09 4e 6f 09 59 65 73 0a  4f 50 54 20 31 30 09 59  |.No.Yes.OPT 10.Y|
00008c80  65 73 09 4e 6f 09 59 65  73 09 4e 6f 0a 4f 50 54  |es.No.Yes.No.OPT|
00008c90  20 31 31 09 59 65 73 09  4e 6f 09 59 65 73 09 59  | 11.Yes.No.Yes.Y|
00008ca0  65 73 0a 4f 50 54 20 31  32 09 59 65 73 09 59 65  |es.OPT 12.Yes.Ye|
00008cb0  73 09 4e 6f 09 4e 6f 0a  4f 50 54 20 31 33 09 59  |s.No.No.OPT 13.Y|
00008cc0  65 73 09 59 65 73 09 4e  6f 09 59 65 73 0a 4f 50  |es.Yes.No.Yes.OP|
00008cd0  54 20 31 34 09 59 65 73  09 59 65 73 09 59 65 73  |T 14.Yes.Yes.Yes|
00008ce0  09 4e 6f 0a 4f 50 54 20  31 35 09 59 65 73 09 59  |.No.OPT 15.Yes.Y|
00008cf0  65 73 09 59 65 73 09 59  65 73 0a 23 74 61 62 0a  |es.Yes.Yes.#tab.|
00008d00  23 69 6e 64 65 6e 74 0a  23 61 6c 69 67 6e 20 63  |#indent.#align c|
00008d10  65 6e 74 72 65 0a 28 54  68 65 20 64 65 66 61 75  |entre.(The defau|
00008d20  6c 74 20 76 61 6c 75 65  20 69 73 20 33 29 0a 23  |lt value is 3).#|
00008d30  61 6c 69 67 6e 0a 23 6c  69 6e 65 0a 23 77 72 61  |align.#line.#wra|
00008d40  70 20 6f 6e 0a 57 68 65  6e 20 61 20 70 72 6f 67  |p on.When a prog|
00008d50  72 61 6d 20 77 72 69 74  74 65 6e 20 69 6e 20 61  |ram written in a|
00008d60  73 73 65 6d 62 6c 79 20  6c 61 6e 67 75 61 67 65  |ssembly language|
00008d70  20 69 73 20 61 73 73 65  6d 62 6c 65 64 2c 20 69  | is assembled, i|
00008d80  74 20 73 68 6f 75 6c 64  20 62 65 20 64 6f 6e 65  |t should be done|
00008d90  20 74 77 69 63 65 20 2d  20 6f 6e 63 65 20 77 69  | twice - once wi|
00008da0  74 68 20 4f 50 54 20 30  20 28 6f 72 20 4f 50 54  |th OPT 0 (or OPT|
00008db0  20 38 29 2c 20 74 68 65  6e 20 61 67 61 69 6e 20  | 8), then again |
00008dc0  77 69 74 68 20 4f 50 54  20 33 20 28 6f 72 20 4f  |with OPT 3 (or O|
00008dd0  50 54 20 31 31 29 2e 20  54 68 69 73 20 61 6c 6c  |PT 11). This all|
00008de0  6f 77 73 20 74 68 65 20  61 73 73 65 6d 62 6c 65  |ows the assemble|
00008df0  72 20 74 6f 20 27 73 65  65 27 20 61 6c 6c 20 74  |r to 'see' all t|
00008e00  68 65 20 6c 61 62 65 6c  73 20 62 65 66 6f 72 65  |he labels before|
00008e10  20 69 74 20 61 63 74 75  61 6c 6c 79 20 61 73 73  | it actually ass|
00008e20  65 6d 62 6c 65 73 20 74  68 65 20 70 72 6f 67 72  |embles the progr|
00008e30  61 6d 2e 20 54 68 65 20  74 77 6f 2d 70 61 73 73  |am. The two-pass|
00008e40  20 73 79 73 74 65 6d 20  63 61 6e 20 65 61 73 69  | system can easi|
00008e50  6c 79 20 62 65 20 69 6d  70 6c 65 6d 65 6e 74 65  |ly be implemente|
00008e60  64 20 77 69 74 68 20 61  20 46 4f 52 2e 2e 2e 4e  |d with a FOR...N|
00008e70  45 58 54 20 6c 6f 6f 70  2e 0a 23 6c 69 6e 65 0a  |EXT loop..#line.|
00008e80  52 61 6e 67 65 20 63 68  65 63 6b 69 6e 67 20 61  |Range checking a|
00008e90  6c 6c 6f 77 73 20 74 68  65 20 75 73 65 72 20 74  |llows the user t|
00008ea0  6f 20 69 6e 66 6f 72 6d  20 74 68 65 20 61 73 73  |o inform the ass|
00008eb0  65 6d 62 6c 65 72 20 6f  66 20 74 68 65 20 75 70  |embler of the up|
00008ec0  70 65 72 20 62 6f 75 6e  64 61 72 79 20 6f 66 20  |per boundary of |
00008ed0  74 68 65 20 6d 65 6d 6f  72 79 20 72 65 73 65 72  |the memory reser|
00008ee0  76 65 64 20 66 6f 72 20  69 74 73 20 6f 62 6a 65  |ved for its obje|
00008ef0  63 74 20 63 6f 64 65 2e  20 49 74 20 77 69 6c 6c  |ct code. It will|
00008f00  20 74 68 65 6e 20 69 73  73 75 65 20 61 20 77 61  | then issue a wa|
00008f10  72 6e 69 6e 67 20 61 6e  64 20 61 62 6f 72 74 20  |rning and abort |
00008f20  69 66 20 74 68 69 73 20  6c 69 6d 69 74 20 69 73  |if this limit is|
00008f30  20 72 65 61 63 68 65 64  2e 20 54 68 65 20 69 6e  | reached. The in|
00008f40  74 65 67 65 72 20 76 61  72 69 61 62 6c 65 20 3c  |teger variable <|
00008f50  4c 25 3e 20 73 68 6f 75  6c 64 20 63 6f 6e 74 61  |L%> should conta|
00008f60  69 6e 20 74 68 65 20 75  70 70 65 72 20 6d 65 6d  |in the upper mem|
00008f70  6f 72 79 20 6c 69 6d 69  74 2e 00 00 44 41 54 41  |ory limit...DATA|
00008f80  57 01 00 00 50 25 3a 20  41 73 73 65 6d 62 6c 65  |W...P%: Assemble|
00008f90  72 20 4c 6f 63 61 74 69  6f 6e 20 43 6f 75 6e 74  |r Location Count|
00008fa0  65 72 0a 23 62 61 63 6b  67 72 6f 75 6e 64 20 77  |er.#background w|
00008fb0  69 6d 70 20 31 0a 23 77  72 61 70 20 6f 6e 0a 54  |imp 1.#wrap on.T|
00008fc0  68 65 20 63 6f 6e 74 65  6e 74 73 20 6f 66 20 74  |he contents of t|
00008fd0  68 69 73 20 69 6e 74 65  67 65 72 20 76 61 72 69  |his integer vari|
00008fe0  61 62 6c 65 20 74 65 6c  6c 20 74 68 65 20 61 73  |able tell the as|
00008ff0  73 65 6d 62 6c 65 72 20  74 68 65 20 61 64 64 72  |sembler the addr|
00009000  65 73 73 20 61 74 20 77  68 69 63 68 20 77 65 20  |ess at which we |
00009010  77 61 6e 74 20 74 68 65  20 6d 61 63 68 69 6e 65  |want the machine|
00009020  20 63 6f 64 65 20 70 72  6f 67 72 61 6d 20 74 6f  | code program to|
00009030  20 73 74 61 72 74 2e 20  41 74 20 61 6e 79 20 67  | start. At any g|
00009040  69 76 65 6e 20 74 69 6d  65 2c 20 50 25 20 77 69  |iven time, P% wi|
00009050  6c 6c 20 61 6c 77 61 79  73 20 68 6f 6c 64 20 74  |ll always hold t|
00009060  68 65 20 61 64 64 72 65  73 73 20 69 6e 20 6d 65  |he address in me|
00009070  6d 6f 72 79 20 77 68 65  72 65 20 74 68 65 20 6e  |mory where the n|
00009080  65 78 74 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |ext instruction |
00009090  77 69 6c 6c 20 62 65 20  77 72 69 74 74 65 6e 20  |will be written |
000090a0  74 6f 2e 0a 23 6c 69 6e  65 0a 23 61 6c 69 67 6e  |to..#line.#align|
000090b0  20 63 65 6e 74 72 65 0a  3c 52 65 73 65 72 76 69  | centre.<Reservi|
000090c0  6e 67 20 6d 65 6d 6f 72  79 3d 3e 52 65 73 65 72  |ng memory=>Reser|
000090d0  76 65 3e 00 44 41 54 41  30 03 00 00 52 65 73 65  |ve>.DATA0...Rese|
000090e0  72 76 69 6e 67 20 6d 65  6d 6f 72 79 20 66 6f 72  |rving memory for|
000090f0  20 61 73 73 65 6d 62 6c  79 20 70 72 6f 67 72 61  | assembly progra|
00009100  6d 73 0a 23 62 61 63 6b  67 72 6f 75 6e 64 20 77  |ms.#background w|
00009110  69 6d 70 20 31 0a 23 77  72 61 70 20 6f 6e 0a 54  |imp 1.#wrap on.T|
00009120  68 65 20 42 41 53 49 43  20 61 73 73 65 6d 62 6c  |he BASIC assembl|
00009130  65 72 20 6d 61 6b 65 73  20 6e 6f 20 63 68 65 63  |er makes no chec|
00009140  6b 73 20 6f 6e 20 74 68  65 20 76 61 6c 75 65 20  |ks on the value |
00009150  6f 66 20 3c 50 25 3e 20  74 6f 20 64 65 74 65 72  |of <P%> to deter|
00009160  6d 69 6e 65 20 77 68 65  74 68 65 72 20 6f 72 20  |mine whether or |
00009170  6e 6f 74 20 74 68 65 20  6d 65 6d 6f 72 79 20 77  |not the memory w|
00009180  68 69 63 68 20 69 74 20  70 6f 69 6e 74 73 20 74  |hich it points t|
00009190  6f 20 69 73 20 27 73 61  66 65 27 20 74 6f 20 75  |o is 'safe' to u|
000091a0  73 65 2e 20 54 68 65 20  73 69 6d 70 6c 65 73 74  |se. The simplest|
000091b0  20 77 61 79 20 74 6f 20  72 65 73 65 72 76 65 20  | way to reserve |
000091c0  61 20 73 61 66 65 20 61  72 65 61 20 6f 66 20 6d  |a safe area of m|
000091d0  65 6d 6f 72 79 20 69 73  20 74 6f 20 75 73 65 20  |emory is to use |
000091e0  61 20 73 70 65 63 69 61  6c 20 66 6f 72 6d 20 6f  |a special form o|
000091f0  66 20 74 68 65 20 44 49  4d 20 73 74 61 74 65 6d  |f the DIM statem|
00009200  65 6e 74 3a 0a 23 77 72  61 70 20 6f 66 66 0a 23  |ent:.#wrap off.#|
00009210  69 6e 64 65 6e 74 20 32  0a 44 49 4d 20 5c 3c 76  |indent 2.DIM \<v|
00009220  61 72 69 61 62 6c 65 5c  3e 20 5c 3c 6e 75 6d 62  |ariable\> \<numb|
00009230  65 72 5c 3e 0a 23 69 6e  64 65 6e 74 0a 23 77 72  |er\>.#indent.#wr|
00009240  61 70 20 6e 6f 6a 6f 69  6e 0a 27 56 61 72 69 61  |ap nojoin.'Varia|
00009250  62 6c 65 27 20 69 73 20  61 6e 79 20 6e 75 6d 65  |ble' is any nume|
00009260  72 69 63 20 76 61 72 69  61 62 6c 65 2c 20 61 6e  |ric variable, an|
00009270  64 20 27 6e 75 6d 62 65  72 27 20 69 73 20 74 68  |d 'number' is th|
00009280  65 20 6e 75 6d 62 65 72  20 6f 66 20 62 79 74 65  |e number of byte|
00009290  73 20 6f 66 20 6d 65 6d  6f 72 79 20 74 6f 20 62  |s of memory to b|
000092a0  65 20 72 65 73 65 72 76  65 64 2e 20 46 6f 72 20  |e reserved. For |
000092b0  65 78 61 6d 70 6c 65 2c  20 27 44 49 4d 20 63 6f  |example, 'DIM co|
000092c0  64 65 20 31 30 32 34 27  20 77 69 6c 6c 20 72 65  |de 1024' will re|
000092d0  73 65 72 76 65 20 31 30  32 34 20 62 79 74 65 73  |serve 1024 bytes|
000092e0  20 6f 66 20 6d 65 6d 6f  72 79 2c 20 61 6e 64 20  | of memory, and |
000092f0  77 69 6c 6c 20 73 65 74  20 74 68 65 20 76 61 72  |will set the var|
00009300  69 61 62 6c 65 20 27 63  6f 64 65 27 20 74 6f 20  |iable 'code' to |
00009310  70 6f 69 6e 74 20 74 6f  20 74 68 65 20 66 69 72  |point to the fir|
00009320  73 74 20 6f 66 20 74 68  65 73 65 20 62 79 74 65  |st of these byte|
00009330  73 2e 20 54 68 65 20 61  64 64 72 65 73 73 20 72  |s. The address r|
00009340  65 74 75 72 6e 65 64 20  69 73 20 61 6c 73 6f 20  |eturned is also |
00009350  67 75 61 72 61 6e 74 65  65 64 20 74 6f 20 62 65  |guaranteed to be|
00009360  20 77 6f 72 64 2d 61 6c  69 67 6e 65 64 2e 0a 57  | word-aligned..W|
00009370  65 20 63 61 6e 20 6e 6f  77 20 74 65 6c 6c 20 74  |e can now tell t|
00009380  68 65 20 61 73 73 65 6d  62 6c 65 72 20 74 6f 20  |he assembler to |
00009390  75 73 65 20 74 68 65 20  72 65 73 65 72 76 65 64  |use the reserved|
000093a0  20 61 72 65 61 20 6f 66  20 6d 65 6d 6f 72 79 2c  | area of memory,|
000093b0  20 66 6f 72 20 73 74 6f  72 69 6e 67 20 6d 61 63  | for storing mac|
000093c0  68 69 6e 65 20 63 6f 64  65 20 69 6e 2c 20 62 79  |hine code in, by|
000093d0  20 74 68 65 20 73 69 6d  70 6c 65 20 69 6e 73 74  | the simple inst|
000093e0  72 75 63 74 69 6f 6e 3a  0a 23 69 6e 64 65 6e 74  |ruction:.#indent|
000093f0  20 32 0a 50 25 20 3d 20  63 6f 64 65 0a 23 69 6e  | 2.P% = code.#in|
00009400  64 65 6e 74 44 41 54 41  fd 01 00 00 41 44 52 0a  |dentDATA....ADR.|
00009410  23 62 61 63 6b 67 72 6f  75 6e 64 20 77 69 6d 70  |#background wimp|
00009420  20 31 0a 23 77 72 61 70  20 6f 6e 0a 49 74 20 69  | 1.#wrap on.It i|
00009430  73 20 6f 66 74 65 6e 20  76 65 72 79 20 75 73 65  |s often very use|
00009440  66 75 6c 20 74 6f 20 62  65 20 61 62 6c 65 20 74  |ful to be able t|
00009450  6f 20 67 65 74 20 74 68  65 20 61 63 74 75 61 6c  |o get the actual|
00009460  20 61 64 64 72 65 73 73  20 61 73 73 6f 63 69 61  | address associa|
00009470  74 65 64 20 77 69 74 68  20 61 20 6c 61 62 65 6c  |ted with a label|
00009480  20 69 6e 74 6f 20 6f 6e  65 20 6f 66 20 74 68 65  | into one of the|
00009490  20 70 72 6f 63 65 73 73  6f 72 20 72 65 67 69 73  | processor regis|
000094a0  74 65 72 73 2e 20 46 6f  72 20 65 78 61 6d 70 6c  |ters. For exampl|
000094b0  65 2c 20 74 68 65 20 6c  61 62 65 6c 20 63 6f 75  |e, the label cou|
000094c0  6c 64 20 6d 61 72 6b 20  74 68 65 20 62 65 67 69  |ld mark the begi|
000094d0  6e 6e 69 6e 67 20 6f 66  20 61 20 64 61 74 61 20  |nning of a data |
000094e0  74 61 62 6c 65 20 69 6e  20 61 20 70 72 6f 67 72  |table in a progr|
000094f0  61 6d 2e 20 46 6f 72 20  74 68 69 73 20 77 65 20  |am. For this we |
00009500  77 6f 75 6c 64 20 6e 65  65 64 20 74 6f 20 68 61  |would need to ha|
00009510  76 65 20 74 68 69 73 20  61 64 64 72 65 73 73 20  |ve this address |
00009520  69 6e 20 61 20 72 65 67  69 73 74 65 72 20 74 6f  |in a register to|
00009530  20 61 63 63 65 73 73 20  65 6e 74 72 69 65 73 20  | access entries |
00009540  69 6e 20 74 68 65 20 74  61 62 6c 65 2e 20 41 44  |in the table. AD|
00009550  52 20 63 61 6e 20 62 65  20 75 73 65 64 20 66 6f  |R can be used fo|
00009560  72 20 74 68 69 73 20 70  75 72 70 6f 73 65 2e 0a  |r this purpose..|
00009570  23 6c 69 6e 65 0a 23 77  72 61 70 20 6f 66 66 0a  |#line.#wrap off.|
00009580  53 79 6e 74 61 78 3a 20  41 44 52 20 5c 3c 72 65  |Syntax: ADR \<re|
00009590  67 69 73 74 65 72 5c 3e  2c 20 5c 3c 6c 61 62 65  |gister\>, \<labe|
000095a0  6c 5c 3e 0a 23 77 72 61  70 20 6f 6e 0a 27 52 65  |l\>.#wrap on.'Re|
000095b0  67 69 73 74 65 72 27 20  69 73 20 74 68 65 20 6e  |gister' is the n|
000095c0  61 6d 65 20 6f 66 20 74  68 65 20 72 65 67 69 73  |ame of the regis|
000095d0  74 65 72 20 77 68 69 63  68 20 69 73 20 74 6f 20  |ter which is to |
000095e0  63 6f 6e 74 61 69 6e 20  74 68 65 20 61 64 64 72  |contain the addr|
000095f0  65 73 73 20 6f 66 20 74  68 65 20 6c 61 62 65 6c  |ess of the label|
00009600  2e 00 00 00 44 41 54 41  5f 01 00 00 41 4c 49 47  |....DATA_...ALIG|
00009610  4e 0a 23 62 61 63 6b 67  72 6f 75 6e 64 20 77 69  |N.#background wi|
00009620  6d 70 20 31 0a 23 77 72  61 70 20 6f 6e 0a 54 68  |mp 1.#wrap on.Th|
00009630  69 73 20 70 73 65 75 64  6f 20 6f 70 63 6f 64 65  |is pseudo opcode|
00009640  20 64 6f 65 73 20 6e 6f  74 20 70 72 6f 64 75 63  | does not produc|
00009650  65 20 61 6e 79 20 6d 61  63 68 69 6e 65 20 63 6f  |e any machine co|
00009660  64 65 2c 20 62 75 74 20  64 69 72 65 63 74 73 20  |de, but directs |
00009670  74 68 65 20 61 73 73 65  6d 62 6c 65 72 20 74 6f  |the assembler to|
00009680  20 63 68 65 63 6b 20 74  68 65 20 76 61 6c 75 65  | check the value|
00009690  20 6f 66 20 3c 50 25 3e  20 74 6f 20 63 68 65 63  | of <P%> to chec|
000096a0  6b 20 77 68 65 74 68 65  72 20 74 68 65 20 61 64  |k whether the ad|
000096b0  64 72 65 73 73 20 69 74  20 63 6f 6e 74 61 69 6e  |dress it contain|
000096c0  73 20 69 73 20 77 6f 72  64 2d 61 6c 69 67 6e 65  |s is word-aligne|
000096d0  64 2e 20 49 66 20 6e 6f  74 2c 20 50 25 20 69 73  |d. If not, P% is|
000096e0  20 72 6f 75 6e 64 65 64  20 75 70 20 74 6f 20 74  | rounded up to t|
000096f0  68 65 20 6e 65 78 74 20  77 6f 72 64 20 62 6f 75  |he next word bou|
00009700  6e 64 61 72 79 2e 0a 23  6c 69 6e 65 0a 50 25 20  |ndary..#line.P% |
00009710  69 73 20 6f 66 74 65 6e  20 6e 6f 74 20 77 6f 72  |is often not wor|
00009720  64 2d 61 6c 69 67 6e 65  64 20 61 66 74 65 72 20  |d-aligned after |
00009730  3c 45 51 55 42 3d 3e 45  51 55 3e 2c 20 3c 45 51  |<EQUB=>EQU>, <EQ|
00009740  55 57 3d 3e 45 51 55 3e  20 6f 72 20 3c 45 51 55  |UW=>EQU> or <EQU|
00009750  53 3d 3e 45 51 55 3e 20  64 69 72 65 63 74 69 76  |S=>EQU> directiv|
00009760  65 73 2e 00 44 41 54 41  1d 02 00 00 50 61 73 73  |es..DATA....Pass|
00009770  69 6e 67 20 64 61 74 61  20 66 72 6f 6d 20 42 41  |ing data from BA|
00009780  53 49 43 20 74 6f 20 74  68 65 20 61 73 73 65 6d  |SIC to the assem|
00009790  62 6c 65 72 0a 23 62 61  63 6b 67 72 6f 75 6e 64  |bler.#background|
000097a0  20 77 69 6d 70 20 31 0a  23 77 72 61 70 20 6e 6f  | wimp 1.#wrap no|
000097b0  6a 6f 69 6e 0a 49 74 20  69 73 20 6f 66 74 65 6e  |join.It is often|
000097c0  20 6e 65 63 65 73 73 61  72 79 20 74 6f 20 70 61  | necessary to pa|
000097d0  73 73 20 64 61 74 61 20  66 72 6f 6d 20 61 20 42  |ss data from a B|
000097e0  41 53 49 43 20 70 72 6f  67 72 61 6d 20 74 6f 20  |ASIC program to |
000097f0  61 6d 61 63 68 69 6e 65  20 63 6f 64 65 20 72 6f  |amachine code ro|
00009800  75 74 69 6e 65 2e 20 54  68 65 20 3c 43 41 4c 4c  |utine. The <CALL|
00009810  3e 20 73 74 61 74 65 6d  65 6e 74 20 68 61 73 20  |> statement has |
00009820  73 6f 6d 65 20 61 64 76  61 6e 63 65 64 20 65 78  |some advanced ex|
00009830  74 65 6e 73 69 6f 6e 73  20 66 6f 72 20 74 68 69  |tensions for thi|
00009840  73 20 70 75 72 70 6f 73  65 20 2d 20 68 6f 77 65  |s purpose - howe|
00009850  76 65 72 2c 20 74 68 69  73 20 69 73 20 63 6f 6d  |ver, this is com|
00009860  70 6c 69 63 61 74 65 64  2e 20 55 70 20 74 6f 20  |plicated. Up to |
00009870  65 69 67 68 74 20 33 32  2d 62 69 74 20 69 6e 74  |eight 32-bit int|
00009880  65 67 65 72 73 20 63 61  6e 20 62 65 20 70 61 73  |egers can be pas|
00009890  73 65 64 20 74 6f 20 74  68 65 20 61 73 73 65 6d  |sed to the assem|
000098a0  62 6c 65 72 20 76 65 72  79 20 65 61 73 69 6c 79  |bler very easily|
000098b0  2c 20 73 69 6d 70 6c 79  20 62 79 20 70 6c 61 63  |, simply by plac|
000098c0  69 6e 67 20 74 68 65 6d  20 69 6e 74 6f 20 74 68  |ing them into th|
000098d0  65 20 69 6e 74 65 67 65  72 20 76 61 72 69 61 62  |e integer variab|
000098e0  6c 65 73 20 41 25 20 74  6f 20 48 25 2e 0a 4a 75  |les A% to H%..Ju|
000098f0  73 74 20 62 65 66 6f 72  65 20 74 72 61 6e 73 66  |st before transf|
00009900  65 72 72 69 6e 67 20 63  6f 6e 74 72 6f 6c 20 74  |erring control t|
00009910  6f 20 61 20 6d 61 63 68  69 6e 65 20 63 6f 64 65  |o a machine code|
00009920  20 72 6f 75 74 69 6e 65  2c 20 42 41 53 49 43 20  | routine, BASIC |
00009930  63 6f 70 69 65 73 20 74  68 65 20 76 61 6c 75 65  |copies the value|
00009940  73 20 6f 66 20 74 68 65  20 69 6e 74 65 67 65 72  |s of the integer|
00009950  20 76 61 72 69 61 62 6c  65 73 20 69 6e 74 6f 20  | variables into |
00009960  74 68 65 20 70 72 6f 63  65 73 73 6f 72 20 72 65  |the processor re|
00009970  67 69 73 74 65 72 73 20  52 30 20 74 6f 20 52 37  |gisters R0 to R7|
00009980  2e 00 00 00 44 41 54 41  c1 01 00 00 52 65 74 75  |....DATA....Retu|
00009990  72 6e 69 6e 67 20 64 61  74 61 20 74 6f 20 42 41  |rning data to BA|
000099a0  53 49 43 0a 23 62 61 63  6b 67 72 6f 75 6e 64 20  |SIC.#background |
000099b0  77 69 6d 70 20 31 0a 23  77 72 61 70 20 6e 6f 6a  |wimp 1.#wrap noj|
000099c0  6f 69 6e 0a 49 66 20 77  65 20 77 61 6e 74 20 74  |oin.If we want t|
000099d0  6f 20 70 61 73 73 20 61  6e 20 69 6e 74 65 67 65  |o pass an intege|
000099e0  72 20 76 61 72 69 61 62  6c 65 20 62 61 63 6b 20  |r variable back |
000099f0  66 72 6f 6d 20 61 20 6d  61 63 68 69 6e 65 20 63  |from a machine c|
00009a00  6f 64 65 20 72 6f 75 74  69 6e 65 20 74 6f 20 42  |ode routine to B|
00009a10  41 53 49 43 2c 20 74 68  65 6e 20 77 65 20 63 61  |ASIC, then we ca|
00009a20  6e 20 75 73 65 20 74 68  65 20 55 53 52 20 73 74  |n use the USR st|
00009a30  61 74 65 6d 65 6e 74 3a  0a 23 77 72 61 70 20 6f  |atement:.#wrap o|
00009a40  66 66 0a 23 69 6e 64 65  6e 74 20 32 0a 5c 3c 76  |ff.#indent 2.\<v|
00009a50  61 72 69 61 62 6c 65 5c  3e 20 3d 20 55 53 52 28  |ariable\> = USR(|
00009a60  20 5c 3c 61 64 64 72 65  73 73 5c 3e 20 29 0a 23  | \<address\> ).#|
00009a70  69 6e 64 65 6e 74 0a 23  6c 69 6e 65 0a 23 77 72  |indent.#line.#wr|
00009a80  61 70 20 6f 6e 0a 54 68  69 73 20 69 73 20 73 69  |ap on.This is si|
00009a90  6d 69 6c 61 72 20 74 6f  20 3c 43 41 4c 4c 3e 20  |milar to <CALL> |
00009aa0  62 65 63 61 75 73 65 20  69 74 20 63 61 75 73 65  |because it cause|
00009ab0  73 20 42 41 53 49 43 20  74 6f 20 65 78 65 63 75  |s BASIC to execu|
00009ac0  74 65 20 61 20 6d 61 63  68 69 6e 65 20 63 6f 64  |te a machine cod|
00009ad0  65 20 72 6f 75 74 69 6e  65 20 61 74 20 61 20 73  |e routine at a s|
00009ae0  70 65 63 69 66 69 65 64  20 61 64 64 72 65 73 73  |pecified address|
00009af0  2e 20 48 6f 77 65 76 65  72 2c 20 77 68 65 6e 20  |. However, when |
00009b00  42 41 53 49 43 20 69 73  20 72 65 74 75 72 6e 65  |BASIC is returne|
00009b10  64 20 74 6f 2c 20 55 53  52 20 72 65 74 75 72 6e  |d to, USR return|
00009b20  73 20 74 68 65 20 63 6f  6e 74 65 6e 74 73 20 6f  |s the contents o|
00009b30  66 20 52 30 20 69 6e 74  6f 20 27 76 61 72 69 61  |f R0 into 'varia|
00009b40  62 6c 65 27 2e 00 00 00  44 41 54 41 d6 00 00 00  |ble'....DATA....|
00009b50  50 69 70 65 6c 69 6e 65  20 73 75 73 70 65 6e 64  |Pipeline suspend|
00009b60  0a 23 62 61 63 6b 67 72  6f 75 6e 64 20 77 69 6d  |.#background wim|
00009b70  70 20 31 0a 23 77 72 61  70 20 6f 6e 0a 54 68 65  |p 1.#wrap on.The|
00009b80  20 27 50 27 20 73 75 66  66 69 78 20 64 69 73 61  | 'P' suffix disa|
00009b90  62 6c 65 73 20 70 69 70  65 6c 69 6e 69 6e 67 20  |bles pipelining |
00009ba0  74 6f 20 61 6c 6c 6f 77  20 77 72 69 74 69 6e 67  |to allow writing|
00009bb0  20 74 6f 20 52 31 35 2e  20 54 68 65 20 72 65 73  | to R15. The res|
00009bc0  75 6c 74 20 6f 66 20 74  68 65 20 6f 70 65 72 61  |ult of the opera|
00009bd0  6e 64 20 28 75 73 75 61  6c 6c 79 20 54 45 51 29  |nd (usually TEQ)|
00009be0  20 69 73 20 77 72 69 74  74 65 6e 20 62 61 63 6b  | is written back|
00009bf0  20 2a 64 69 72 65 63 74  6c 79 2a 20 74 6f 20 74  | *directly* to t|
00009c00  68 65 20 73 74 61 74 75  73 20 62 69 74 73 20 28  |he status bits (|
00009c10  32 36 2d 33 31 29 20 6f  66 20 52 31 35 2e 00 00  |26-31) of R15...|
00009c20  46 52 45 45 40 00 00 00  ff ff ff ff 20 54 68 65  |FREE@....... The|
00009c30  20 4c 69 6e 6b 20 52 65  67 69 73 74 65 72 0a 23  | Link Register.#|
00009c40  62 61 63 6b 67 72 6f 75  6e 64 20 77 69 6d 70 20  |background wimp |
00009c50  31 0a 23 77 72 61 70 20  6e 6f 6a 6f 69 6e 0a 54  |1.#wrap nojoin.T|
00009c60  46 52 45 45 30 01 00 00  90 9d 00 00 20 50 72 6f  |FREE0....... Pro|
00009c70  67 72 61 6d 20 43 6f 75  6e 74 65 72 20 26 20 53  |gram Counter & S|
00009c80  74 61 74 75 73 20 52 65  67 69 73 74 65 72 0a 23  |tatus Register.#|
00009c90  62 61 63 6b 67 72 6f 75  6e 64 20 77 69 6d 70 20  |background wimp |
00009ca0  31 0a 23 77 72 61 70 20  6f 6e 0a 52 65 67 69 73  |1.#wrap on.Regis|
00009cb0  74 65 72 20 52 31 35 20  69 73 20 61 20 73 70 65  |ter R15 is a spe|
00009cc0  63 69 61 6c 20 70 75 72  70 6f 73 65 20 72 65 67  |cial purpose reg|
00009cd0  69 73 74 65 72 20 64 65  64 69 63 61 74 65 64 20  |ister dedicated |
00009ce0  74 6f 20 6d 61 69 6e 74  61 69 6e 69 6e 67 20 74  |to maintaining t|
00009cf0  68 65 20 41 52 4d 27 73  20 70 72 6f 67 72 61 6d  |he ARM's program|
00009d00  20 63 6f 75 6e 74 65 72  2c 20 73 74 61 74 75 73  | counter, status|
00009d10  20 66 6c 61 67 73 20 61  6e 64 20 6d 6f 64 65 20  | flags and mode |
00009d20  66 6c 61 67 73 2e 0a 0a  23 46 63 6f 64 65 3b 20  |flags...#Fcode; |
00009d30  77 72 61 70 20 6f 66 66  0a 42 69 74 3a 20 33 31  |wrap off.Bit: 31|
00009d40  20 33 30 20 32 39 20 32  38 20 32 37 20 32 36 20  | 30 29 28 27 26 |
00009d50  32 35 09 09 20 20 32 20  20 31 20 20 30 0a 52 31  |25..  2  1  0.R1|
00009d60  35 3a 20 20 4e 20 20 5a  20 20 43 20 20 56 20 20  |5:  N  Z  C  V  |
00009d70  49 20 20 46 20 2e 2e 2e  50 72 6f 67 72 61 6d 20  |I  F ...Program |
00009d80  43 6f 75 6e 74 65 72 2e  2e 2e 20 53 31 20 53 30  |Counter... S1 S0|
00009d90  46 52 45 45 1e 01 00 00  20 9c 00 00 20 50 72 6f  |FREE.... ... Pro|
00009da0  67 72 61 6d 20 43 6f 75  6e 74 65 72 20 26 20 53  |gram Counter & S|
00009db0  74 61 74 75 73 20 52 65  67 69 73 74 65 72 0a 23  |tatus Register.#|
00009dc0  62 61 63 6b 67 72 6f 75  6e 64 20 77 69 6d 70 20  |background wimp |
00009dd0  31 0a 23 77 72 61 70 20  6f 6e 0a 52 65 67 69 73  |1.#wrap on.Regis|
00009de0  74 65 72 20 52 31 35 20  69 73 20 61 20 73 70 65  |ter R15 is a spe|
00009df0  63 69 61 6c 20 70 75 72  70 6f 73 65 20 72 65 67  |cial purpose reg|
00009e00  69 73 74 65 72 20 64 65  64 69 63 61 74 65 64 20  |ister dedicated |
00009e10  74 6f 20 6d 61 69 6e 74  61 69 6e 69 6e 67 20 74  |to maintaining t|
00009e20  68 65 20 41 52 4d 27 73  20 70 72 6f 67 72 61 6d  |he ARM's program|
00009e30  20 63 6f 75 6e 74 65 72  2c 20 73 74 61 74 75 73  | counter, status|
00009e40  20 66 6c 61 67 73 20 61  6e 64 20 6d 6f 64 65 20  | flags and mode |
00009e50  66 6c 61 67 73 2e 0a 42  69 74 3a 20 33 31 20 33  |flags..Bit: 31 3|
00009e60  30 20 32 39 20 32 38 20  32 37 20 32 36 20 32 35  |0 29 28 27 26 25|
00009e70  09 09 20 20 32 20 20 31  20 20 30 0a 52 31 35 3a  |..  2  1  0.R15:|
00009e80  20 20 4e 20 20 5a 20 20  43 20 20 56 20 20 49 20  |  N  Z  C  V  I |
00009e90  20 46 20 2e 2e 2e 50 72  6f 67 72 61 6d 20 43 6f  | F ...Program Co|
00009ea0  75 6e 74 65 72 2e 2e 2e  20 53 31 20 53 30 00 00  |unter... S1 S0..|
00009eb0  44 41 54 41 58 08 00 00  43 41 4c 4c 0a 23 62 61  |DATAX...CALL.#ba|
00009ec0  63 6b 67 72 6f 75 6e 64  20 77 69 6d 70 20 31 0a  |ckground wimp 1.|
00009ed0  23 77 72 61 70 20 6f 66  66 0a 53 79 6e 74 61 78  |#wrap off.Syntax|
00009ee0  3a 20 43 41 4c 4c 20 5c  3c 61 64 64 72 65 73 73  |: CALL \<address|
00009ef0  5c 3e 20 5c 7b 2c 5c 3c  70 61 72 61 6d 65 74 65  |\> \{,\<paramete|
00009f00  72 73 5c 3e 5c 7d 0a 4f  70 65 72 61 74 69 6f 6e  |rs\>\}.Operation|
00009f10  3a 20 49 6e 69 74 69 61  74 65 73 20 6d 61 63 68  |: Initiates mach|
00009f20  69 6e 65 20 63 6f 64 65  20 72 6f 75 74 69 6e 65  |ine code routine|
00009f30  20 61 74 20 67 69 76 65  6e 20 61 64 64 72 65 73  | at given addres|
00009f40  73 0a 23 77 72 61 70 20  6f 6e 0a 23 6c 69 6e 65  |s.#wrap on.#line|
00009f50  0a 54 68 65 20 6f 70 74  69 6f 6e 61 6c 20 70 61  |.The optional pa|
00009f60  72 61 6d 65 74 65 72 73  20 61 72 65 20 61 20 6c  |rameters are a l|
00009f70  69 73 74 20 61 20 63 6f  6d 6d 61 2d 73 65 70 61  |ist a comma-sepa|
00009f80  72 61 74 65 64 20 42 41  53 49 43 20 76 61 72 69  |rated BASIC vari|
00009f90  61 62 6c 65 73 2c 20 74  68 65 20 76 61 6c 75 65  |ables, the value|
00009fa0  73 20 6f 66 20 77 68 69  63 68 20 61 72 65 20 74  |s of which are t|
00009fb0  6f 20 62 65 20 6d 61 64  65 20 61 76 61 69 6c 61  |o be made availa|
00009fc0  62 6c 65 20 74 6f 20 74  68 65 20 6d 61 63 68 69  |ble to the machi|
00009fd0  6e 65 20 63 6f 64 65 20  72 6f 75 74 69 6e 65 2e  |ne code routine.|
00009fe0  20 53 6f 2c 20 69 6e 20  61 64 64 69 74 69 6f 6e  | So, in addition|
00009ff0  20 74 6f 20 73 65 74 74  69 6e 67 20 75 70 20 72  | to setting up r|
0000a000  65 67 69 73 74 65 72 73  20 52 30 20 74 6f 20 52  |egisters R0 to R|
0000a010  38 20 66 72 6f 6d 20 74  68 65 20 69 6e 74 65 67  |8 from the integ|
0000a020  65 72 20 76 61 72 69 61  62 6c 65 73 2c 20 43 41  |er variables, CA|
0000a030  4c 4c 20 61 6c 73 6f 20  73 65 74 73 20 75 70 20  |LL also sets up |
0000a040  74 68 65 20 66 6f 6c 6c  6f 77 69 6e 67 20 74 77  |the following tw|
0000a050  6f 20 72 65 67 69 73 74  65 72 73 3a 0a 23 77 72  |o registers:.#wr|
0000a060  61 70 20 6f 66 66 0a 23  69 6e 64 65 6e 74 20 32  |ap off.#indent 2|
0000a070  0a 52 39 3a 09 50 6f 69  6e 74 65 72 20 74 6f 20  |.R9:.Pointer to |
0000a080  70 61 72 61 6d 65 74 65  72 73 20 64 65 73 63 72  |parameters descr|
0000a090  69 70 74 6f 72 20 62 6c  6f 63 6b 0a 52 31 30 3a  |iptor block.R10:|
0000a0a0  09 4e 75 6d 62 65 72 20  6f 66 20 70 61 72 61 6d  |.Number of param|
0000a0b0  65 74 65 72 73 20 70 61  73 73 65 64 20 75 73 69  |eters passed usi|
0000a0c0  6e 67 20 43 41 4c 4c 0a  23 69 6e 64 65 6e 74 0a  |ng CALL.#indent.|
0000a0d0  23 77 72 61 70 20 6e 6f  6a 6f 69 6e 0a 52 65 67  |#wrap nojoin.Reg|
0000a0e0  69 73 74 65 72 20 52 39  20 70 6f 69 6e 74 73 20  |ister R9 points |
0000a0f0  74 6f 20 74 68 65 20 6d  65 6d 6f 72 79 20 62 6c  |to the memory bl|
0000a100  6f 63 6b 20 77 68 65 72  65 20 61 20 70 61 72 61  |ock where a para|
0000a110  6d 65 74 65 72 20 6c 69  73 74 20 68 61 73 20 62  |meter list has b|
0000a120  65 65 6e 20 63 72 65 61  74 65 64 2e 20 54 68 69  |een created. Thi|
0000a130  73 20 6c 69 73 74 20 68  61 73 20 61 20 74 77 6f  |s list has a two|
0000a140  2d 77 6f 72 64 20 65 6e  74 72 79 20 69 6e 20 69  |-word entry in i|
0000a150  74 20 66 6f 72 20 65 61  63 68 20 76 61 72 69 61  |t for each varia|
0000a160  62 6c 65 20 69 6e 20 74  68 65 20 70 61 72 61 6d  |ble in the param|
0000a170  65 74 65 72 20 6c 69 73  74 2e 20 41 6e 20 69 6d  |eter list. An im|
0000a180  70 6f 72 74 61 6e 74 20  70 6f 69 6e 74 20 74 6f  |portant point to|
0000a190  20 6e 6f 74 65 20 69 73  20 74 68 61 74 20 74 68  | note is that th|
0000a1a0  65 20 65 6e 74 72 69 65  73 20 69 6e 20 74 68 65  |e entries in the|
0000a1b0  20 70 61 72 61 6d 65 74  65 72 20 62 6c 6f 63 6b  | parameter block|
0000a1c0  20 61 72 65 20 73 65 74  20 75 70 20 69 6e 20 72  | are set up in r|
0000a1d0  65 76 65 72 73 65 20 6f  72 64 65 72 2e 0a 54 68  |everse order..Th|
0000a1e0  65 20 66 69 72 73 74 20  77 6f 72 64 20 6f 66 20  |e first word of |
0000a1f0  65 61 63 68 20 65 6e 74  72 79 20 69 73 20 61 20  |each entry is a |
0000a200  70 6f 69 6e 74 65 72 20  74 6f 20 74 68 65 20 61  |pointer to the a|
0000a210  64 64 72 65 73 73 20 77  68 65 72 65 20 74 68 65  |ddress where the|
0000a220  20 76 61 72 69 61 62 6c  65 20 69 74 73 65 6c 66  | variable itself|
0000a230  20 69 73 20 73 74 6f 72  65 64 2e 20 54 68 65 20  | is stored. The |
0000a240  73 65 63 6f 6e 64 20 77  6f 72 64 20 63 6f 6e 74  |second word cont|
0000a250  61 69 6e 73 20 61 20 6e  75 6d 62 65 72 20 77 68  |ains a number wh|
0000a260  69 63 68 20 72 65 70 72  65 73 65 6e 74 73 20 74  |ich represents t|
0000a270  68 65 20 74 79 70 65 20  6f 66 20 76 61 72 69 61  |he type of varia|
0000a280  62 6c 65 20 70 61 73 73  65 64 2e 20 54 68 65 20  |ble passed. The |
0000a290  74 61 62 6c 65 20 62 65  6c 6f 77 20 6c 69 73 74  |table below list|
0000a2a0  73 20 74 68 65 20 64 69  66 66 65 72 65 6e 74 20  |s the different |
0000a2b0  74 79 70 65 20 6e 75 6d  62 65 72 73 3a 0a 23 77  |type numbers:.#w|
0000a2c0  72 61 70 20 6f 66 66 0a  23 69 6e 64 65 6e 74 20  |rap off.#indent |
0000a2d0  31 32 0a 23 74 61 62 0a  2a 54 79 70 65 2a 09 2a  |12.#tab.*Type*.*|
0000a2e0  4f 62 6a 65 63 74 20 61  64 64 72 65 73 73 2a 09  |Object address*.|
0000a2f0  2a 45 78 61 6d 70 6c 65  73 20 6f 66 20 70 6f 73  |*Examples of pos|
0000a300  73 69 62 6c 65 2a 0a 2a  6e 75 6d 62 65 72 2a 09  |sible*.*number*.|
0000a310  2a 70 6f 69 6e 74 73 20  74 6f 2a 09 2a 42 41 53  |*points to*.*BAS|
0000a320  49 43 20 76 61 72 69 61  62 6c 65 73 2a 0a 30 09  |IC variables*.0.|
0000a330  53 69 6e 67 6c 65 20 62  79 74 65 20 6e 75 6d 62  |Single byte numb|
0000a340  65 72 09 3f 76 61 72 0a  34 09 46 6f 75 72 2d 62  |er.?var.4.Four-b|
0000a350  79 74 65 20 69 6e 74 65  67 65 72 09 21 76 61 72  |yte integer.!var|
0000a360  2c 20 76 61 72 25 2c 20  76 61 72 25 28 6e 29 0a  |, var%, var%(n).|
0000a370  35 09 52 65 61 6c 20 6e  75 6d 62 65 72 20 28 35  |5.Real number (5|
0000a380  20 62 79 74 65 73 29 09  76 61 72 2c 20 76 61 72  | bytes).var, var|
0000a390  28 6e 29 0a 31 32 38 09  53 74 72 69 6e 67 20 69  |(n).128.String i|
0000a3a0  6e 66 6f 72 6d 61 74 69  6f 6e 20 62 6c 6f 63 6b  |nformation block|
0000a3b0  09 76 61 72 24 2c 20 76  61 72 24 28 6e 29 0a 31  |.var$, var$(n).1|
0000a3c0  32 39 09 54 65 72 6d 69  6e 61 74 65 64 20 63 68  |29.Terminated ch|
0000a3d0  61 72 61 63 74 65 72 20  73 74 72 69 6e 67 09 24  |aracter string.$|
0000a3e0  76 61 72 0a 32 35 36 2b  34 09 49 6e 74 65 67 65  |var.256+4.Intege|
0000a3f0  72 20 61 72 72 61 79 20  62 6c 6f 63 6b 09 76 61  |r array block.va|
0000a400  72 25 28 29 0a 32 35 36  2b 35 09 52 65 61 6c 20  |r%().256+5.Real |
0000a410  61 72 72 61 79 20 62 6c  6f 63 6b 09 76 61 72 28  |array block.var(|
0000a420  29 0a 32 35 36 2b 31 32  38 09 53 74 72 69 6e 67  |).256+128.String|
0000a430  20 61 72 72 61 79 20 62  6c 6f 63 6b 09 76 61 72  | array block.var|
0000a440  24 28 29 0a 23 74 61 62  0a 23 69 6e 64 65 6e 74  |$().#tab.#indent|
0000a450  0a 23 77 72 61 70 20 6e  6f 6a 6f 69 6e 0a 2a 4e  |.#wrap nojoin.*N|
0000a460  42 2a 3a 20 54 68 65 20  76 61 6c 75 65 73 20 6f  |B*: The values o|
0000a470  66 20 76 61 72 69 61 62  6c 65 73 20 61 72 65 20  |f variables are |
0000a480  6e 6f 74 20 67 75 61 72  61 6e 74 65 65 64 20 74  |not guaranteed t|
0000a490  6f 20 62 65 20 73 74 6f  72 65 64 20 61 74 20 77  |o be stored at w|
0000a4a0  6f 72 64 2d 61 6c 69 67  6e 65 64 20 61 64 64 72  |ord-aligned addr|
0000a4b0  65 73 73 65 73 2e 0a 49  6e 20 74 68 65 20 63 61  |esses..In the ca|
0000a4c0  73 65 20 6f 66 20 70 61  72 61 6d 65 74 65 72 20  |se of parameter |
0000a4d0  74 79 70 65 73 20 34 2c  20 35 2c 20 61 6e 64 20  |types 4, 5, and |
0000a4e0  31 32 39 20 74 68 65 69  72 20 61 64 64 72 65 73  |129 their addres|
0000a4f0  73 20 70 6f 69 6e 74 73  20 74 6f 20 74 68 65 20  |s points to the |
0000a500  76 61 72 69 61 62 6c 65  20 76 61 6c 75 65 2e 20  |variable value. |
0000a510  49 6e 20 6f 74 68 65 72  20 63 61 73 65 73 20 74  |In other cases t|
0000a520  68 65 20 61 64 64 72 65  73 73 20 70 6f 69 6e 74  |he address point|
0000a530  73 20 74 6f 20 61 6e 6f  74 68 65 72 20 69 6e 66  |s to another inf|
0000a540  6f 72 6d 61 74 69 6f 6e  20 62 6c 6f 63 6b 20 61  |ormation block a|
0000a550  62 6f 75 74 20 74 68 65  20 63 6f 72 72 65 73 70  |bout the corresp|
0000a560  6f 6e 64 69 6e 67 20 76  61 72 69 61 62 6c 65 2e  |onding variable.|
0000a570  0a 46 6f 72 20 42 41 53  49 43 20 73 74 72 69 6e  |.For BASIC strin|
0000a580  67 20 76 61 72 69 61 62  6c 65 73 20 28 74 79 70  |g variables (typ|
0000a590  65 20 31 32 38 29 20 74  68 65 20 61 64 64 72 65  |e 128) the addre|
0000a5a0  73 73 20 69 6e 20 74 68  65 20 70 61 72 61 6d 65  |ss in the parame|
0000a5b0  74 65 72 20 62 6c 6f 63  6b 20 70 6f 69 6e 74 73  |ter block points|
0000a5c0  20 74 6f 20 61 20 73 74  72 69 6e 67 20 69 6e 66  | to a string inf|
0000a5d0  6f 72 6d 61 74 69 6f 6e  20 62 6c 6f 63 6b 2e 20  |ormation block. |
0000a5e0  54 68 69 73 20 62 6c 6f  63 6b 20 69 73 20 67 75  |This block is gu|
0000a5f0  61 72 61 6e 74 65 65 64  20 74 6f 20 65 78 69 73  |aranteed to exis|
0000a600  74 20 61 74 20 61 20 77  6f 72 64 2d 61 6c 69 67  |t at a word-alig|
0000a610  6e 65 64 20 61 64 64 72  65 73 73 20 61 6e 64 20  |ned address and |
0000a620  68 61 73 20 74 68 65 20  66 6f 6c 6c 6f 77 69 6e  |has the followin|
0000a630  67 20 66 6f 72 6d 61 74  3a 0a 23 69 6e 64 65 6e  |g format:.#inden|
0000a640  74 20 32 0a 42 79 74 65  73 20 30 2d 33 09 50 6f  |t 2.Bytes 0-3.Po|
0000a650  69 6e 74 65 72 20 74 6f  20 74 68 65 20 63 68 61  |inter to the cha|
0000a660  72 61 63 74 65 72 73 20  63 6f 6e 74 61 69 6e 65  |racters containe|
0000a670  64 20 69 6e 20 74 68 65  20 73 74 72 69 6e 67 0a  |d in the string.|
0000a680  42 79 74 65 20 34 09 09  43 75 72 72 65 6e 74 20  |Byte 4..Current |
0000a690  6e 75 6d 62 65 72 20 6f  66 20 63 68 61 72 61 63  |number of charac|
0000a6a0  74 65 72 73 20 69 6e 20  74 68 65 20 73 74 72 69  |ters in the stri|
0000a6b0  6e 67 0a 23 69 6e 64 65  6e 74 0a 56 61 72 69 61  |ng.#indent.Varia|
0000a6c0  62 6c 65 73 20 6f 66 20  74 79 70 65 20 32 35 36  |bles of type 256|
0000a6d0  2b 20 72 65 66 65 72 20  74 6f 20 61 72 72 61 79  |+ refer to array|
0000a6e0  73 20 61 6e 64 20 72 65  71 75 69 72 65 20 61 20  |s and require a |
0000a6f0  6d 6f 72 65 20 63 6f 6d  70 6c 69 63 61 74 65 64  |more complicated|
0000a700  20 73 79 73 74 65 6d 2e  44 41 54 41 7a 01 00 00  | system.DATAz...|
0000a710  43 72 65 64 69 74 73 20  61 6e 64 20 43 6f 70 79  |Credits and Copy|
0000a720  72 69 67 68 74 0a 23 62  61 63 6b 67 72 6f 75 6e  |right.#backgroun|
0000a730  64 20 77 69 6d 70 20 31  0a 23 77 72 61 70 20 6e  |d wimp 1.#wrap n|
0000a740  6f 6a 6f 69 6e 0a 54 68  69 73 20 6d 61 6e 75 61  |ojoin.This manua|
0000a750  6c 20 69 73 20 61 6e 20  75 70 64 61 74 65 64 20  |l is an updated |
0000a760  76 65 72 73 69 6f 6e 20  6f 66 20 74 68 65 20 27  |version of the '|
0000a770  41 73 73 65 6d 62 6c 79  27 20 6d 61 6e 75 61 6c  |Assembly' manual|
0000a780  2c 20 70 72 65 76 69 6f  75 73 6c 79 20 73 75 70  |, previously sup|
0000a790  70 6c 69 65 64 20 77 69  74 68 20 21 53 74 72 6f  |plied with !Stro|
0000a7a0  6e 67 48 65 6c 70 2c 20  62 79 20 47 75 74 74 6f  |ngHelp, by Gutto|
0000a7b0  72 6d 20 56 69 6b 2e 20  54 68 65 20 69 6e 66 6f  |rm Vik. The info|
0000a7c0  72 6d 61 74 69 6f 6e 20  77 61 73 20 6f 62 74 61  |rmation was obta|
0000a7d0  69 6e 65 64 20 66 72 6f  6d 20 27 41 72 63 68 69  |ined from 'Archi|
0000a7e0  6d 65 64 65 73 20 41 73  73 65 6d 62 6c 79 20 4c  |medes Assembly L|
0000a7f0  61 6e 67 75 61 67 65 27  20 28 32 6e 64 20 65 64  |anguage' (2nd ed|
0000a800  2e 29 20 62 79 20 4d 69  6b 65 20 47 69 6e 6e 73  |.) by Mike Ginns|
0000a810  2e 0a 23 6c 69 6e 65 0a  23 61 6c 69 67 6e 20 63  |..#line.#align c|
0000a820  65 6e 74 72 65 0a 2a 55  70 64 61 74 65 64 20 62  |entre.*Updated b|
0000a830  79 20 4a 61 73 70 65 72  20 74 68 65 20 41 70 72  |y Jasper the Apr|
0000a840  69 63 6f 74 2a 0a 6d 2e  64 2e 66 69 65 6c 64 40  |icot*.m.d.field@|
0000a850  77 61 72 77 69 63 6b 2e  61 63 2e 75 6b 0a 68 74  |warwick.ac.uk.ht|
0000a860  74 70 3a 2f 2f 77 77 77  2e 63 73 76 2e 77 61 72  |tp://www.csv.war|
0000a870  77 69 63 6b 2e 61 63 2e  75 6b 2f 7e 6c 73 75 71  |wick.ac.uk/~lsuq|
0000a880  66 0a 00 00 44 41 54 41  71 01 00 00 52 31 34 3a  |f...DATAq...R14:|
0000a890  20 54 68 65 20 4c 69 6e  6b 20 52 65 67 69 73 74  | The Link Regist|
0000a8a0  65 72 0a 23 62 61 63 6b  67 72 6f 75 6e 64 20 77  |er.#background w|
0000a8b0  69 6d 70 20 31 0a 23 77  72 61 70 20 6e 6f 6a 6f  |imp 1.#wrap nojo|
0000a8c0  69 6e 0a 54 68 65 20 6c  69 6e 6b 20 72 65 67 69  |in.The link regi|
0000a8d0  73 74 65 72 20 69 73 20  75 73 65 64 20 74 6f 20  |ster is used to |
0000a8e0  70 72 6f 76 69 64 65 20  61 20 64 65 67 72 65 65  |provide a degree|
0000a8f0  20 6f 66 20 73 75 70 70  6f 72 74 20 66 6f 72 20  | of support for |
0000a900  69 6d 70 6c 65 6d 65 6e  74 69 6e 67 20 73 75 62  |implementing sub|
0000a910  72 6f 75 74 69 6e 65 73  20 69 6e 20 6d 61 63 68  |routines in mach|
0000a920  69 6e 65 20 63 6f 64 65  2e 20 52 31 34 20 69 73  |ine code. R14 is|
0000a930  20 75 73 65 64 20 74 6f  20 73 74 6f 72 65 20 74  | used to store t|
0000a940  68 65 20 61 64 64 72 65  73 73 20 74 68 65 20 70  |he address the p|
0000a950  72 6f 67 72 61 6d 20 72  65 74 75 72 6e 73 20 74  |rogram returns t|
0000a960  6f 20 6f 6e 63 65 20 61  20 73 75 62 72 6f 75 74  |o once a subrout|
0000a970  69 6e 65 20 68 61 73 20  66 69 6e 69 73 68 65 64  |ine has finished|
0000a980  2e 0a 0a 52 31 34 20 69  73 20 75 73 65 64 20 65  |...R14 is used e|
0000a990  61 63 68 20 74 69 6d 65  20 74 68 65 20 3c 42 4c  |ach time the <BL|
0000a9a0  3e 20 69 6e 73 74 72 75  63 74 69 6f 6e 20 69 73  |> instruction is|
0000a9b0  20 63 61 72 72 69 65 64  20 6f 75 74 2e 20 41 74  | carried out. At|
0000a9c0  20 6f 74 68 65 72 20 74  69 6d 65 73 20 69 74 20  | other times it |
0000a9d0  69 73 20 75 6e 75 73 65  64 20 61 6e 64 20 69 73  |is unused and is|
0000a9e0  20 66 72 65 65 20 66 6f  72 20 6e 6f 72 6d 61 6c  | free for normal|
0000a9f0  20 75 73 65 2e 00 00 00  44 41 54 41 3e 01 00 00  | use....DATA>...|
0000aa00  52 31 35 3a 20 50 72 6f  67 72 61 6d 20 43 6f 75  |R15: Program Cou|
0000aa10  6e 74 65 72 20 26 20 53  74 61 74 75 73 20 52 65  |nter & Status Re|
0000aa20  67 69 73 74 65 72 0a 23  62 61 63 6b 67 72 6f 75  |gister.#backgrou|
0000aa30  6e 64 20 77 69 6d 70 20  31 0a 23 77 72 61 70 20  |nd wimp 1.#wrap |
0000aa40  6f 6e 0a 52 65 67 69 73  74 65 72 20 52 31 35 20  |on.Register R15 |
0000aa50  69 73 20 61 20 73 70 65  63 69 61 6c 20 70 75 72  |is a special pur|
0000aa60  70 6f 73 65 20 72 65 67  69 73 74 65 72 20 64 65  |pose register de|
0000aa70  64 69 63 61 74 65 64 20  74 6f 20 6d 61 69 6e 74  |dicated to maint|
0000aa80  61 69 6e 69 6e 67 20 74  68 65 20 41 52 4d 27 73  |aining the ARM's|
0000aa90  20 70 72 6f 67 72 61 6d  20 63 6f 75 6e 74 65 72  | program counter|
0000aaa0  2c 20 73 74 61 74 75 73  20 66 6c 61 67 73 20 61  |, status flags a|
0000aab0  6e 64 20 6d 6f 64 65 20  66 6c 61 67 73 2e 0a 0a  |nd mode flags...|
0000aac0  23 46 63 6f 64 65 3b 20  77 72 61 70 20 6f 66 66  |#Fcode; wrap off|
0000aad0  0a 42 69 74 3a 20 33 31  20 33 30 20 32 39 20 32  |.Bit: 31 30 29 2|
0000aae0  38 20 32 37 20 32 36 20  20 20 20 20 20 20 20 20  |8 27 26         |
0000aaf0  2e 2e 2e 2e 2e 20 20 20  20 20 20 20 20 20 20 31  |.....          1|
0000ab00  20 20 30 0a 52 31 35 3a  20 20 4e 20 20 5a 20 20  |  0.R15:  N  Z  |
0000ab10  43 20 20 56 20 20 49 20  20 46 20 2e 2e 2e 50 72  |C  V  I  F ...Pr|
0000ab20  6f 67 72 61 6d 20 43 6f  75 6e 74 65 72 2e 2e 2e  |ogram Counter...|
0000ab30  20 53 31 20 53 30 00 00                           | S1 S0..|
0000ab38