Write the corresponding S19 file for the code below ORG 0080
Write the corresponding S19 file for the code below:
ORG $0080
Sum: DS.B 1
ORG $FC00
Start: lda Ax
sub #$AB
sta Sum
Done: bra Done
Ax: DC.B $12
ORG $FFFE
DC.W Start
Solution
1) ORG $0080
Explination:
org Set starting value of location counter org $0080 where code or data will go
2) Sum: DS.B 1
Explination:
ds[.size] Allocate specified number of table: ds.w 1 storage spaces. size is the same as for dc directive
3) ORG $FC00
Explination:
org Set starting value of location counter org $FC00 where code or data will go
4) Start: lda Ax
Explination:
LDA copies the data byte into accumulator from the memory location specified by the 16-bit address
5) sub #$AB
Explination:
The sub instruction stores in the value of its first operand the result of subtracting the value of its second operand from the value of its first operand
6) sta Sum
Explination:
STA copies the data byte from the accumulator in the memory location specified by 16-bit address
7) Done: bra Done
Explination:
BRA is a relative jump from current position to anywhere within +1023 and -1024 locations
8) Ax: DC.B $12
Explination:
The DCB directive allocates one or more bytes of memory, and defines the initial runtime contents of the memory.
9) ORG $FFFE
Explination:
org Set starting value of location counter org $FFFE where code or data will go
10) DC.W Start
Explination:
DC.B - Define constant in memory of length of one byte. This assigns a memory address to a constant and initializes it to the constant

