| |

VerySource

 Forgot password?
 Register
Search
View: 1454|Reply: 3

Reward for a compilation question

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-28 13:30:01
| Show all posts |Read mode
Enter two arbitrary four-digit decimal numbers to multiply, and display the result! !
Thank you for taking a look! !
Reply

Use magic Report

0

Threads

15

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-9-30 09:45:01
| Show all posts
0 ascii -> bin

1 mul

2 bin -> ascii
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-9-30 20:30:01
| Show all posts
Is there any expert to solve it?
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-9-30 21:30:01
| Show all posts
4-digit decimal, up to 9999, two bytes are enough, that is, two bytes multiplied by two bytes, double-byte binary unsigned number multiplication:
; Entry conditions: the multiplicand is in R2 and R3, and the multiplier is in R6 and R7.
;Exit information: the product is in R2, R3, R4, R5.
; Affected resources: PSW, A, B, R2 ~ R7 Stack requirements: 2 bytes

MULD: MOV A, R3; calculate R3 and multiply R7
MOV B, R7
MUL AB
MOV R4, B; Temporarily store partial product
MOV R5,A
MOV A, R3; calculate R3 by R6
MOV B, R6
MUL AB
ADD A, R4; accumulate partial product
MOV R4,A
CLR A
ADDC A,B
MOV R3,A
MOV A, R2; calculate R2 multiplied by R7
MOV B, R7
MUL AB
ADD A, R4; accumulate partial product
MOV R4,A
MOV A, R3
ADDC A,B
MOV R3,A
CLR A
RLC A
XCH A, R2; calculate R2 by R6
MOV B, R6
MUL AB
ADD A, R3; accumulate partial product
MOV R3,A
MOV A, R2
ADDC A,B
MOV R2,A
RET
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list