Although I have no idea what this topic is all about, it's nice to watch all these WOSsers compare code. Looks like you're having a lot of fun. :)
You should all get together at a pub meet!
What I like about these threads is that it seems that if you post any code, as well as a solution to your problem you'll also get as a bonus:
(a) a version which uses the least memory
(b) a version which uses the fewest T states..! :smile:
I do find stuff like this useful, as I still haven't fully grasped "RL" vs "ADC", for example, that probably comes naturally for a lot of the programmers on here.
i know that contribution is over, but for curious people ;]
with different aproach (but according to Battle Bunny's conditions - not using instructions like add hl,hl nor using memory arrays nor loops)
it is possible to get 3T faster routine compared to Gedlion's #11 with the same byte size:
ld a,h
rlca
rlca
rlca
rlca
ld h,a
ld a,l
rlca
rlca
rlca
rlca
ld l,a
and 15
xor h
ld h,a
and 15
xor l
ld l,a
and 15
xor h
ld h,a
it is the same to antoniovillena's #29 - first part (which is faster and smaller than this one), but it doesn't use other register (B) to swap nibbles
idea is:
1) rotate H and L by 4 bits (each register on its own) - we start with H=ab L=cd and we get H=ba L=dc
2) swap lower nibble of H and L - in three steps by famous xor way (a=a^c; c=a^c; a=a^c)
These things are tricky, which is the reason I took the time to prepare this table before starting to work on BIFROST*. I hope this table will be useful for someone else.
Any chance of adding a function on the MISC page of the XLS version of that file so that a sequence of commands can be entered and then it uses VLOOKUP or MATCH or something to get the timings for the sequence and adds them up? Otherwise I'll do one sometime.
Any chance of adding a function on the MISC page of the XLS version of that file so that a sequence of commands can be entered and then it uses VLOOKUP or MATCH or something to get the timings for the sequence and adds them up? Otherwise I'll do one sometime.
It's a good idea, but I don't think this will work so well, since it won't consider loops and you will have to type all instructions using "nn" instead of their actual parameters. Besides, I prefer all formats (XLS, PDF, HTML) to have exactly the same content, so I'm not planning to add this feature to the "official" version... but you are welcome to implement this yourself!
Comments
What I like about these threads is that it seems that if you post any code, as well as a solution to your problem you'll also get as a bonus:
(a) a version which uses the least memory
(b) a version which uses the fewest T states..! :smile:
I do find stuff like this useful, as I still haven't fully grasped "RL" vs "ADC", for example, that probably comes naturally for a lot of the programmers on here.
with different aproach (but according to Battle Bunny's conditions - not using instructions like add hl,hl nor using memory arrays nor loops)
it is possible to get 3T faster routine compared to Gedlion's #11 with the same byte size:
it is the same to antoniovillena's #29 - first part (which is faster and smaller than this one), but it doesn't use other register (B) to swap nibbles
idea is:
1) rotate H and L by 4 bits (each register on its own) - we start with H=ab L=cd and we get H=ba L=dc
2) swap lower nibble of H and L - in three steps by famous xor way (a=a^c; c=a^c; a=a^c)
ld a,l and $f0 xor h ld h,a and $f0 xor l ld l,a and $f0 xor h rlca rlca rlca rlca ld h,a ld a,l rlca rlca rlca rlca ld l,aAny chance of adding a function on the MISC page of the XLS version of that file so that a sequence of commands can be entered and then it uses VLOOKUP or MATCH or something to get the timings for the sequence and adds them up? Otherwise I'll do one sometime.
It's a good idea, but I don't think this will work so well, since it won't consider loops and you will have to type all instructions using "nn" instead of their actual parameters. Besides, I prefer all formats (XLS, PDF, HTML) to have exactly the same content, so I'm not planning to add this feature to the "official" version... but you are welcome to implement this yourself!