• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

More pico-mac stuff

(val<<n)|(val>>(9-n))|(carry<<(n-1)) for byte
Did you test this yet?

I came up with this but I don't know if it's correct:
Code:
perl -E '
for ($i = 0 ; $i < 64 ; $i++) {
	# select some initial conditions
	$n = $i;
	$carry = 0;
	$val = 0b10000001;

	# do the ROXL.B
	$val |= $carry << 8;
	$n %= 9;
	$result = ($val << $n) | ($val >> (9 - $n));
	$carryresult = ($result >> 8) & 1;
	$result &= 0xff;

	# print the results
	printf "%2d %08b %d\n", $i, $result, $carryresult;
}
'

Should create a project in CodeWarrior that has a ROXL assembly function to compare the results with.

I used risu from qemu to generate random PowerPC instructions and compare the results of each instruction on a real CPU and an emulated CPU. It runs in Mac OS 7,8,9,or X. It needs updating/testing to work with 68K instructions (although it does have some code for 68K already).
https://github.com/joevt/risu
 
Hi @joevt,
Did you test this yet?

I actually just reasoned it so far . A normal ROL of n is: (x << n)|(x>>(8-n)). A ROL with carry will shift the upper bits just as much, but the next bit is filled with the carry (ie X on the 68000) and so the lower bits must be shifted by 1 more bit to make room. I could easily have an error, but it’ll be along those lines.


I came up with this but I don't know if it's correct:
Code:
perl -E '
for ($i = 0 ; $i < 64 ; $i++) {
    # select some initial conditions
    $n = $i;
    $carry = 0;
    $val = 0b10000001;

    # do the ROXL.B
    $val |= $carry << 8;
    $n %= 9;
    $result = ($val << $n) | ($val >> (9 - $n));
    $carryresult = ($result >> 8) & 1;
    $result &= 0xff;

    # print the results
    printf "%2d %08b %d\n", $i, $result, $carryresult;
}
'

I don’t know Perl, but it looks like it makes sense.

Should create a project in CodeWarrior that has a ROXL assembly function to compare the results with.

I used risu from qemu to generate random PowerPC instructions and compare the results of each instruction on a real CPU and an emulated CPU. It runs in Mac OS 7,8,9,or X. It needs updating/testing to work with 68K instructions (although it does have some code for 68K already).
https://github.com/joevt/risu
Ok, wow, thanks for that!
 
Wow. I am not a programmer but this is really fascinating. I am grateful for people like Snial who make big projects for us to play with.
 
Back
Top