SIC63616-(Rev. 1.0) NO. P145
3240-0412
4.12.5 Execution cycle
Both the multiplication and division take 10 CPU cycles for an operation. Therefore, before the results can
be read from the destination register DRH/DRL, wait at least 5 bus cycles after writing to CALMD. The
same applies to reading the operation flags NF/VF/ZF.
The following shows a sample program.
ldb
%ext, src_data@h
ldb
%xl, src_data@l
; Set RAM address for operand
ldb
%ext, au@h
ldb
%yl, au@l
; Set multiplier I/O memory address
;
ldb
%ba, [%x]+
ldb
[%y]+, %ba
; Set data to SR
ldb
%ba, [%x]+
ldb
[%y]+, %ba
; Set data to DRL
ldb
%ba, [%x]+
ldb
[%y]+, %ba
; Set data to DRH
;
ld
[%y], 0b0001
; Start operation (select calculation mode)
;
ldb
%ext, rslt_data@h
ldb
%xl, rslt_data@l
; Set result store address
nop
nop
nop
; Dummy instructions to wait end of operation
;
bit
[%y], 0b0100
jrnz
overflow
; Jump to error routine if VF = "1"
;
add
%y, -4
; Set DRL again
;
ldb
%ba, [%y]+
ldb
[%x]+, %ba
; Store result (quotient) into RAM
ldb
%ba, [%y]+
ldb
[%x]+, %ba
; Store result (remainder) into RAM