Example 2
8-Bit Addition
Purpose: Add the contents of memory locations 0040 and 0041, and place the result in memory
location 0042.
Sample Problem:
(0040) = 39
(0041) = 2B
Result: (0042) = 64
Source Program:
.ORG 0
LDA #$39
STA $40
LDA #$2B
STA $41
CLC ;CLEAR CARRY TO START
LDA $40 ;GET FIRST OPERAND
ADC $41 ;ADD SECOND OPERAND
STA $42 ;STORE RESULT
BRK
No comments:
Post a Comment