Download presentation
Presentation is loading. Please wait.
Published byAllison Tate Modified over 5 years ago
1
The .ASCII and .END Assembler Input ;Stan Warford ;January 13, 2005
;A program to output “Hi” ; CHARO 0x0007, d ; Output ‘H’ CHARO 0x0008, d ;Output ‘i’ STOP .ASCII “Hi” .END Assembler Output zz Program output Hi
2
The .ASCII and .END Pep/8 assembly language is line-oriented, unlike C++: Each assembly language statement must be contained on only one line. No statement can continue onto another line. Two statements can not be place on the same line. A comment begins with a semicolon ; and continue until the end of the line. The .ASCII generates contiguous bytes of ASCII characters. You must end your assembly language program with the .END command. It does not insert bits into the program the way the .ASCII command does. It indicates the end of the assembly language program.
3
The .BLOCK Pseudo-op Generate a block of a specific number of bytes.
Means generate a block of one byte. .BLOCK 2 Means generate a block of two bytes. The statement generates code for the loader.
4
The .BLOCK Pseudo-op
5
The .WORD and .BYTE Pseudo-ops
The .WORD is similar to the .BLOCK as it generates code for the loader, .WORD is different from .BLOCK in two ways: It always generates one word (2 bytes). The programmer can specify the content of the word. .WORD 5 Means generate one word with a value of 5. .WORD 0x0030 Means generate one word with a value of 0030 (hex).
6
The .WORD and .BYTE Pseudo-ops
.BYTE is similar to .WORD but it generates one byte instead of 2 bytes (one word). .WORD 0x0030 is equal to .BYTE 0x00 .BYTE 0x30
7
The .WORD and .BYTE Pseudo-ops
8
Immediate Addressing
9
The problem of Address Calculation
The problem with placing the data at the end of the program is that you do not know exactly how long the instruction part of the program until you have finished it. You do not know the address of the data while writing the instruction that requires that data. One modification will change the addresses of the data, and every instruction that refers to the data will need to be modified to reflect the new addresses.
10
The unconditional branch instruction
Instruction specifier: a Mnemonic: BR Skips to a different memory location for the next instruction to be executed. The branch instruction almost always uses immediate addressing. The Pep/8 assembler does not enforce that the addressing mode to be specified. If no addressing mode specified, the assembler will assume the immediate addressing and generate 000 for the addressing-aaa field.
11
The decimal input instruction
Instruction specifier: aaa Mnemonic: DECI Convert a string of ASCII characters from the input device into a 16-bit signed integer (two’s complement) and store it into memory. It sets the status bits as follows: Z to 1 if the input was 0. N to 1 if the input was a negative value. V to 1 if the input was out of range. C is not affected by the instruction.
12
The decimal output instruction
Instruction specifier: aaa Mnemonic: DECO Convert a 16-bit signed integer (two’s complement) from memory into a string of ASCII characters and send the string to the output device
14
The string output instruction
Instruction specifier: aaa Mnemonic: STRO Send a string of null-terminated ASCII characters to the output device. The operand for the STRO is a contiguous sequence of bytes; each one is interpreted as an ASCII character. The last byte must be a byte of all 0’s, which is interpreted as the sentinel. When the string is output the sentinel will not appear.
15
The string output instruction
16
Symbols
17
ch sChar sInt i Assignment statements
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.