OBJECTIVES:
Gateway2000, RAPID Microcontroller Development System.
REFERENCES:
Example 1.
org rom ;sets
the starting address $0300 for the code that follows
start: lda #$10 ;loads the hex number 10 (decimal
16) into ACCA
ldx #$11 ;loads
the hex number 11 (decimal 17) into the index register X
mul
;multiplies the contents of ACCA by the contents of X.
;After the operation,X contains the upper 8 bits of the
;16-bit result and ACCA contains the lower 8 bits
stop
org $7FE ;sets
the address $07FE for the object code that follows
back1: fdb start ;forms double byte address constant start
that defines
;where the program counter begins on reset
After this program executes, X and ACCA together contain the hexadecimal number 110 (decimal 272).
Example 2.
temp1 equ $C0 ;one byte temp storage
location
org rom ;program will start at $0300
start: lda #$D ;loads the hexadecimal number
D (decimal 13) into
;the accumulator ACCA
sta temp1 ;stores
the contents of ACCA (hex D (decimal 13)) in
;temp1 (the address
)
lda #$20 ;loads
the hexadecimal number 20 (decimal 32) into ACCA
sub temp1 ;subtracts
the contents of temp1 from ACCA and places
;the result in ACCA
stop
org $7FE ;sets
the address $07FE for the object code that follows
back1: fdb start ;forms double byte address constant start
that defines
;where the program counter begins on reset
After executing this program, ACCA contains the hexadecimal number 13 (decimal 19).
Example 3.
temp1 equ $C0 ;one byte temp storage
location
temp2 equ $C1 ;one byte temp storage
location
org rom
;program will start at $0300
start: lda #$5 ;loads the hexadecimal number 5 (decimal
5) into ACCA
sta temp1 ;stores
the contents of ACCA (the hexadecimal number 5
;(decimal 5)) in temp1 (the address $C0)
lda #$2
;loads the hexadecimal number 2 (decimal 2) into ACCA
sta temp2 ;stores
the contents of ACCA (the hexadecimal number 2
;(decimal 2)) in temp2 (the address $C1 )
lda #$1
;loads the hex number 1 (decimal 1) into ACCA
loop1: ldx temp2 ;loads the hex number 2 (decimal 2) into
index register X
mul
;multiplies the contents of ACCA by the contents of X.
;After the operation, X contains the upper 8 bits of the
;16-bit result and ACCA contains the lower 8 bits
dec temp1 ;subtracts
one from the contents of temp1
bne loop1 ;the branch
(jump to the label loop1) will occur if the
;contents of temp1 is not equal to 0
stop
;stop oscillator of the microcontroller
org $7FE ;sets
the address $07FE for the object code that follows
back1: fdb start ;forms double byte address constant start
After executing this example ACCA and X contain the hexadecimal number 80 (decimal 128).
PRELAB:
Using the above examples as a guide, develop the following programs:
..\is highlighted.
Pathname of file:C:\ICS05J1A\*.ASMtype in instead of * the name of the ASM file (for this example type: first1).
Debugger command:C:\ICS05J1A\FIRST1.S19Press Enter. Now you see ICS05J1A Main Screen (Fig. 1).
| X | Y | F |
| 0 | $0F | |
| $0C | $00 | |
| $12 | $02 | |
| $05 | $0A |
G. Print your programs.
C:\ICS05J1A\Use the print command in the notepad application to print the file.
