Final answer:
To write an assembly program for the HCS12 Dragon board in CodeWarrior software, define variables to store the input numbers, use the getchar subroutine to get input, add the values, and display the result.
Step-by-step explanation:
Solution:
To write an assembly program for the HCS12 Dragon board in CodeWarrior software, you can follow these steps:
- Define two variables, var1 and var2, to store the input numbers.
- Use the getchar subroutine to get input from the user and store it in var1 and var2.
- Add the values of var1 and var2 and store the result in a separate variable, sum.
- Display the result on the screen.
Here's an example code snippet:
section .data
var1 db 0
var2 db 0
sum db 0
section .text
global _start
_start:
mov ah, 0
int 16h ; get input for var1
mov [var1], al
mov ah, 0
int 16h ; get input for var2
mov [var2], al
mov al, [var1]
add al, [var2]
mov [sum], al
mov ah, 0eh ; display result
mov al, [sum]
add al, 30h ; convert to ASCII
int 10h
done:
mov ah, 0
int 16h ; wait for key press
int 20h ; exit