Suppose, 10 data (16-bit) stored from 220H memory address (12-bit) must be transferred to another block starting from 250H memory address. For this, each data should be loaded to accumulator first and then stored to destination address. Then, source address and destination address should be incremented. Assembly program will be the following:
X, BSA TRN
/TRN is a subroutine to transfer data
BSA SRC
/SRC is a subroutine for source address management
BSA DST
/DST is a subroutine for destination address management
ISZ CTR
/CTR is counter for 10 data
BUN X
HLT
TRN, HEX 0
LDA A I
STA B I
BUN TRN I
SRC, HEX 0
LDA A
INC
STA A
BUN SRC I
DST, HEX 0
LDA B
INC
STA B
BUN DST I
A, HEX 220
B, HEX 250
CTR, DEC -10
END
No comments:
Post a Comment