Timeline for Why does the Z80 have a half-carry bit?
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 18, 2020 at 8:29 | history | edited | CommunityBot |
Commonmark migration
|
|
Oct 6, 2017 at 21:40 | history | edited | Leo B. | CC BY-SA 3.0 |
added 15 characters in body
|
Oct 6, 2017 at 21:40 | comment | added | Leo B. | @supercat I've expanded the explanation, but without going into details about reasons for using BCD. IMO, expounding on application details favoring binary vs packed BCD vs unpacked BCD would detract from the answer, because it is specific to packed BCD. | |
Oct 6, 2017 at 21:20 | history | edited | Leo B. | CC BY-SA 3.0 |
Explained the BCD format.
|
Oct 5, 2017 at 19:16 | comment | added | supercat | I think your answer might be improved by including a brief blurb about what BCD is (essentially performing base-ten math with two digits per byte) rather than relying upon the Wikipedia link. Programs that perform additions and subtractions purely for purposes of displaying values can benefit from performing such operations in decimal format rather than performing them in binary and then having to convert the result to base ten. | |
Sep 11, 2017 at 14:34 | comment | added | JeremyP |
@Spektre DAA was the worst instruction to implement on my Z80 implementation. It took me ages to get it right but I found two pieces of goodish documentation and looking at somebody else's emulator to get it to pass ZEXALL . .
|
|
Sep 9, 2017 at 18:09 | comment | added | Spektre |
@LeoB. yep it is the best stuff I found on the matter. Without it I would never got with my Emulator so far. Heh haven done anything on it for 3 years (just using it time to time) till today major updates :). The tests are really long it take around 35-60 min to complete on turbo speed ~50MHz if my memory serves well.
|
|
Sep 9, 2017 at 17:59 | comment | added | Leo B. | @Spektre Looks like it is an exhaustive test after all. It is possible to fool it by constructing a table that would give the same CRC, but virtually all "honest" errors will be caught. | |
Sep 9, 2017 at 17:38 | comment | added | Spektre |
@LeoB. as expected it did not pass screenshot ... took only ~15min to test up to the daa tests
|
|
Sep 9, 2017 at 17:22 | comment | added | Spektre | @LeoB. no not yet but without this implementation I never passed ... I just started the zexall with single value in the LUT changed (not in a part of coarse) it will take a while my sim runs on ~50MHz tops on my setup ... | |
Sep 9, 2017 at 16:52 | comment | added | Leo B. | @Spektre Have you tried introducing random errors in your table and checking if it still passes the test? | |
Sep 9, 2017 at 12:06 | comment | added | Spektre |
@NieDzejkob so DAA is dependent on register a obviously and also on bits 0,1,4 from flag register. The resulting code is passing ZEXALL so it should be correct.
|
|
Sep 9, 2017 at 11:59 | comment | added | Spektre |
@NieDzejkob yes I did and implemented it in mine emulator ... it is in form of huge 2048x16bit LUT table. not sure where I fount it anymore it has been some years ago but I still got the source code... From a quick search on the first line of LUT I fount this z80_lib/Tables.h but that is most likely not the source I got it from ... The code for mine daa looks like this: void Z80::ins0_DAA (){ static int aaa; aaa=reg.r8.a+(((reg.r8.f&3)+((reg.r8.f&16)>>2))<<8); reg.r16.af=_z80_table_DAA[aaa]; return; }
|
|
Sep 9, 2017 at 11:09 | comment | added | Maya | @Spektre Since you put "undefined" in quotes, have you been able to find the documentation on this instruction? | |
Sep 9, 2017 at 7:46 | comment | added | Spektre |
the adjustment is done by DAA instruction which is one of the most ugly instructions in Z80 to emulate properly due to "undefined" behavior of some of the flag bits...
|
|
Sep 9, 2017 at 6:27 | history | answered | Leo B. | CC BY-SA 3.0 |