Welcome!
Note that SP isn't trashed, it's borrowed for the LSB while the PC is written to the stack. During those writes, the value of SP must be decremented, so it spends a few cycles in the ALU - leaving the SP register free as a temporary!
The tcstate presentation is a bug, I'm afraid. It should show values like 011111, 101111 and so on, but I added the bits instead of concatenating them. There's a fix in the works!
(If you feel intrepid, you can find your browser's Javascript Console, get it to print out busToString, and adjust it to read
Code:
function busToString(busname){
// takes a signal name or prefix
// returns an appropriate string representation
if(busname=='cycle')
return cycle>>1;
if(busname=='pc')
return busToHex('pch') + busToHex('pcl');
if(busname=='p')
return readPstring();
if(busname=='tcstate')
return ['clock1','clock2','t2','t3','t4','t5'].map(busToHex).join("");
return busToHex(busname);
}
which is code you can
find on github)
You should then see something like this tabulation:
Code:
cycle ab db rw sync pc a x y s p ir tcstate pd adl adh sb alu alucin alua alub alucout aluvout dasb
0 0000 a9 1 1 0000 aa 00 00 fd nv-bdIZc 00 011111 ff 00 00 ff 00 0 ff 00 0 0 ff
0 0000 a9 1 1 0000 aa 00 00 fd nv-bdIZc 00 011111 56 01 00 ff ff 0 ff 00 0 0 ff
1 0001 00 1 0 0001 aa 00 00 fd nv-bdIZc a9 100111 56 01 00 ff ff 0 ff ff 0 0 ff
1 0001 00 1 0 0001 aa 00 00 fd nv-bdIZc a9 100111 ff 02 00 ff fe 0 ff ff 1 0 ff
2 0002 20 1 1 0002 00 00 00 fd nv-bdIZc a9 011111 ff 02 00 00 fe 0 00 00 1 0 00
2 0002 20 1 1 0002 00 00 00 fd nv-bdIZc a9 011111 df 03 00 00 00 0 00 00 0 0 00
3 0003 10 1 0 0003 00 00 00 fd nv-bdIZc 20 110111 df 03 00 00 00 0 00 00 0 0 00
3 0003 10 1 0 0003 00 00 00 fd nv-bdIZc 20 110111 ef fd 01 ff 00 0 00 00 0 0 ff
4 01fd 00 1 0 0004 00 00 00 10 nv-bdIZc 20 111011 ef fd 01 10 00 0 00 fd 0 0 10
4 01fd 00 1 0 0004 00 00 00 10 nv-bdIZc 20 111011 ff fd ff ff fd 0 00 fd 0 0 ff
5 01fd 00 0 0 0004 00 00 00 10 nv-bdIZc 20 111101 ff fd ff ff fd 0 ff fd 0 0 ff
5 01fd 00 0 0 0004 00 00 00 10 nv-bdIZc 20 111101 ff fc ff ff fc 0 ff fd 1 0 ff
6 01fc 00 0 0 0004 00 00 00 10 nv-bdIZc 20 111110 ff fc ff ff fc 0 ff fc 1 0 ff
6 01fc 04 0 0 0004 00 00 00 10 nv-bdIZc 20 111110 fb 04 00 fb fb 0 ff fc 1 0 fb
7 0004 00 1 0 0004 00 00 00 10 nv-bdIZc 20 101111 fb 04 00 fb fb 0 fb 00 1 0 fb
7 0004 00 1 0 0004 00 00 00 10 nv-bdIZc 20 101111 ff 10 ff fb fb 0 fb 00 0 0 fb
8 0010 e8 1 1 0010 00 00 00 fb nv-bdIZc 20 011111 ff 10 00 fb fb 0 00 00 0 0 fb
8 0010 e8 1 1 0010 00 00 00 fb nv-bdIZc 20 011111 17 11 00 00 00 0 00 00 0 0 00
Cheers!
Ed
edit: SP is of course decremented, not incremented, for a push