This code provides 2 subroutines for multiplying and dividing two bytes. As I am using my phone for posting this topic, I cannot type and look at my code at the same time, so I will post the dump later. It successfully multiplies/divides Index X by Index Y and leaves the result in the accumulator. At first, it should have bit-shifting commands, but the code was slow and has serious bugs (it works on quotients without remainders only. If the quotient has a remainder, the subroutine will loop FOREVER!) So, I just make the subroutine much simpler and it should work perfectly and faster now. Have fun learning JBit!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, my former description is now invalid. The description now is: "JSR 3:3 for multiplication and JSR 3:17 for division. Execution starts at 4:0. After opening MulDivLib, resize the program to at least 2 pages of code.
Before JSR-ing the subroutines, the operands for multiplication must be at 0:0 and 0:1, the result would be at the accumulator. For division, 0:0 = numerator, 0:1 = denominator. The quotient is at 0:0 and remainder at the accumulator."
But if you can, feel free to modify it so that the former description would work. I can, but I don't have much time.
Have fun!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This code provides 2 subroutines for multiplying and dividing two bytes. As I am using my phone for posting this topic, I cannot type and look at my code at the same time, so I will post the dump later. It successfully multiplies/divides Index X by Index Y and leaves the result in the accumulator. At first, it should have bit-shifting commands, but the code was slow and has serious bugs (it works on quotients without remainders only. If the quotient has a remainder, the subroutine will loop FOREVER!) So, I just make the subroutine much simpler and it should work perfectly and faster now. Have fun learning JBit!
C 3:0
000: 076 000 004 162 008 010 006 000
008: 144 003 024 101 001 202 208 245
016: 096 169 000 162 008 006 000 042
024: 197 001 144 002 229 001 038 000
032: 202 208 244 096 000 000 000 000
Well, my former description is now invalid. The description now is: "JSR 3:3 for multiplication and JSR 3:17 for division. Execution starts at 4:0. After opening MulDivLib, resize the program to at least 2 pages of code.
Before JSR-ing the subroutines, the operands for multiplication must be at 0:0 and 0:1, the result would be at the accumulator. For division, 0:0 = numerator, 0:1 = denominator. The quotient is at 0:0 and remainder at the accumulator."
But if you can, feel free to modify it so that the former description would work. I can, but I don't have much time.
Have fun!