From 4f0775cc7c1b5a61c314aa8d0aad826ab872e7f4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 16 May 2017 21:37:09 -0400 Subject: [PATCH] Imported the Zexall.com tester, as a first thing to throw at the Z80 to be. --- .../Mac/Clock SignalTests/Zexall/Copying | 339 ++++ .../Mac/Clock SignalTests/Zexall/zexall.com | Bin 0 -> 8587 bytes .../Mac/Clock SignalTests/Zexall/zexall.src | 1561 +++++++++++++++++ .../Mac/Clock SignalTests/Zexall/zexdoc.com | Bin 0 -> 8587 bytes .../Mac/Clock SignalTests/Zexall/zexdoc.src | 1561 +++++++++++++++++ 5 files changed, 3461 insertions(+) create mode 100644 OSBindings/Mac/Clock SignalTests/Zexall/Copying create mode 100755 OSBindings/Mac/Clock SignalTests/Zexall/zexall.com create mode 100644 OSBindings/Mac/Clock SignalTests/Zexall/zexall.src create mode 100755 OSBindings/Mac/Clock SignalTests/Zexall/zexdoc.com create mode 100644 OSBindings/Mac/Clock SignalTests/Zexall/zexdoc.src diff --git a/OSBindings/Mac/Clock SignalTests/Zexall/Copying b/OSBindings/Mac/Clock SignalTests/Zexall/Copying new file mode 100644 index 000000000..916d1f0f2 --- /dev/null +++ b/OSBindings/Mac/Clock SignalTests/Zexall/Copying @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/OSBindings/Mac/Clock SignalTests/Zexall/zexall.com b/OSBindings/Mac/Clock SignalTests/Zexall/zexall.com new file mode 100755 index 0000000000000000000000000000000000000000..33f553cb483a5f68e79c2d9dbb1df9c51e373bd1 GIT binary patch literal 8587 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 sequence, so parameters are passed +; explicitly +; + ds n,c not supported, so strings are set to full explicity length +; +; This program is free software; you can redistribute it and/or +; modify it under the terms of the GNU General Public License +; as published by the Free Software Foundation; either version 2 +; of the License, or (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + aseg + org 100h + + jp start + +; machine state before test (needs to be at predictably constant address) +msbt: ds 14 +spbt: ds 2 +msbthi equ msbt / 0100h +msbtlo equ msbt & 0ffh + + +; For the purposes of this test program, the machine state consists of: +; a 2 byte memory operand, followed by +; the registers iy,ix,hl,de,bc,af,sp +; for a total of 16 bytes. + +; The program tests instructions (or groups of similar instructions) +; by cycling through a sequence of machine states, executing the test +; instruction for each one and running a 32-bit crc over the resulting +; machine states. At the end of the sequence the crc is compared to +; an expected value that was found empirically on a real Z80. + +; A test case is defined by a descriptor which consists of: +; a flag mask byte, +; the base case, +; the incement vector, +; the shift vector, +; the expected crc, +; a short descriptive message. +; +; The flag mask byte is used to prevent undefined flag bits from +; influencing the results. Documented flags are as per Mostek Z80 +; Technical Manual. +; +; The next three parts of the descriptor are 20 byte vectors +; corresponding to a 4 byte instruction and a 16 byte machine state. +; The first part is the base case, which is the first test case of +; the sequence. This base is then modified according to the next 2 +; vectors. Each 1 bit in the increment vector specifies a bit to be +; cycled in the form of a binary counter. For instance, if the byte +; corresponding to the accumulator is set to 0ffh in the increment +; vector, the test will be repeated for all 256 values of the +; accumulator. Note that 1 bits don't have to be contiguous. The +; number of test cases 'caused' by the increment vector is equal to +; 2^(number of 1 bits). The shift vector is similar, but specifies a +; set of bits in the test case that are to be successively inverted. +; Thus the shift vector 'causes' a number of test cases equal to the +; number of 1 bits in it. + +; The total number of test cases is the product of those caused by the +; counter and shift vectors and can easily become unweildy. Each +; individual test case can take a few milliseconds to execute, due to +; the overhead of test setup and crc calculation, so test design is a +; compromise between coverage and execution time. + +; This program is designed to detect differences between +; implementations and is not ideal for diagnosing the causes of any +; discrepancies. However, provided a reference implementation (or +; real system) is available, a failing test case can be isolated by +; hand using a binary search of the test space. + + +start: ld hl,(6) + ld sp,hl + ld de,msg1 + ld c,9 + call bdos + + ld hl,tests ; first test case +loop: ld a,(hl) ; end of list ? + inc hl + or (hl) + jp z,done + dec hl + call stt + jp loop + +done: ld de,msg2 + ld c,9 + call bdos + jp 0 ; warm boot + +tests: + dw adc16 + dw add16 + dw add16x + dw add16y + dw alu8i + dw alu8r + dw alu8rx + dw alu8x + dw bitx + dw bitz80 + dw cpd1 + dw cpi1 + dw daaop ; can't use opcode as label + dw inca + dw incb + dw incbc + dw incc + dw incd + dw incde + dw ince + dw inch + dw inchl + dw incix + dw inciy + dw incl + dw incm + dw incsp + dw incx + dw incxh + dw incxl + dw incyh + dw incyl + dw ld161 + dw ld162 + dw ld163 + dw ld164 + dw ld165 + dw ld166 + dw ld167 + dw ld168 + dw ld16im + dw ld16ix + dw ld8bd + dw ld8im + dw ld8imx + dw ld8ix1 + dw ld8ix2 + dw ld8ix3 + dw ld8ixy + dw ld8rr + dw ld8rrx + dw lda + dw ldd1 + dw ldd2 + dw ldi1 + dw ldi2 + dw negop ; jgh: can't use opcode as label + dw rldop ; jgh: can't use opcode as label + dw rot8080 + dw rotxy + dw rotz80 + dw srz80 + dw srzx + dw st8ix1 + dw st8ix2 + dw st8ix3 + dw stabd + dw 0 + +; jgh: macro syntax changed for ZMAC and MAXAM +; can't use opcodes as labels +; ZMAC allows &nn as hex, so & removed from local labels +; +tstr macro insn1,insn2,insn3,insn4,memop,riy,rix,rhl,rde,rbc,flags,acc,rsp,?lab +?lab: db insn1,insn2,insn3,insn4 + dw memop,riy,rix,rhl,rde,rbc + db flags + db acc + dw rsp + if $-?lab ne 20 + error 'missing parameter' + endif + endm + +tmsg macro msg,?lab +?lab: db 'msg' + if $ ge ?lab+31 + error 'message too long' + else +; ds ?lab+30-$,'.' ; jgh: ZMAC/MAXAM don't have char parameter + endif + db '$' + endm + +; jgh: ZMAC/MAXAM don't recognise syntax for macros, so full parameters given +; jgh: each tmsg has full string, as ZMAC/MAXAM don't have ds n,c pseudo-op + +; hl, (38,912 cycles) +adc16: db 0ffh ; flag mask + tstr 0edh,042h,0,0,0832ch,04f88h,0f22bh,0b339h,07e1fh,01563h,0d3h,089h,0465eh + tstr 0,038h,0,0,0,0,0,0f821h,0,0,0,0,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,-1,-1,-1,0d7h,0,-1 ; (38 cycles) + db 0d4h,08ah,0d5h,019h ; expected crc + tmsg ' hl,....' + +; add hl, (19,456 cycles) +add16: db 0ffh ; flag mask + tstr 9,0,0,0,0c4a5h,0c4c7h,0d226h,0a050h,058eah,08566h,0c6h,0deh,09bc9h + tstr 030h,0,0,0,0,0,0,0f821h,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,-1,-1,-1,0d7h,0,-1 ; (38 cycles) + db 0d9h,0a4h,0cah,005h ; expected crc + tmsg 'add hl,..........' + +; add ix, (19,456 cycles) +add16x: db 0ffh ; flag mask + tstr 0ddh,9,0,0,0ddach,0c294h,0635bh,033d3h,06a76h,0fa20h,094h,068h,036f5h + tstr 0,030h,0,0,0,0,0f821h,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,-1,0,-1,-1,0d7h,0,-1 ; (38 cycles) + db 0b1h,0dfh,08eh,0c0h ; expected crc + tmsg 'add ix,..........' + +; add iy, (19,456 cycles) +add16y: db 0ffh ; flag mask + tstr 0fdh,9,0,0,0c7c2h,0f407h,051c1h,03e96h,00bf4h,0510fh,092h,01eh,071eah + tstr 0,030h,0,0,0,0f821h,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,-1,0,0,-1,-1,0d7h,0,-1 ; (38 cycles) + db 039h,0c8h,058h,09bh ; expected crc + tmsg 'add iy,..........' + +; aluop a,nn (28,672 cycles) +alu8i: db 0ffh ; flag mask + tstr 0c6h,0,0,0,009140h,07e3ch,07a67h,0df6dh,05b61h,00b29h,010h,066h,085b2h + tstr 038h,0,0,0,0,0,0,0,0,0,0,-1,0 ; (2048 cycles) + tstr 0,-1,0,0,0,0,0,0,0,0,0d7h,0,0 ; (14 cycles) + db 051h,0c1h,09ch,02eh ; expected crc + tmsg 'aluop a,nn....................' + +; aluop a, (753,664 cycles) +alu8r: db 0ffh ; flag mask + tstr 080h,0,0,0,0c53eh,0573ah,04c4dh,msbt,0e309h,0a666h,0d0h,03bh,0adbbh + tstr 03fh,0,0,0,0,0,0,0,0,0,0,-1,0 ; (16,384 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,0,0 ; (46 cycles) + db 006h,0c7h,0aah,08eh ; expected crc + tmsg 'aluop a,..' + +; aluop a, (376,832 cycles) +alu8rx: db 0ffh ; flag mask + tstr 0ddh,084h,0,0,0d6f7h,0c76eh,0accfh,02847h,022ddh,0c035h,0c5h,038h,0234bh + tstr 020h,039h,0,0,0,0,0,0,0,0,0,-1,0 ; (8,192 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,0,0 ; (46 cycles) + db 0a8h,086h,0cch,044h ; expected crc + tmsg 'aluop a,.....' + +; aluop a,(+1) (229,376 cycles) +alu8x: db 0ffh ; flag mask + tstr 0ddh,086h,1,0,090b7h,msbt-1,msbt-1,032fdh,0406eh,0c1dch,045h,06eh,0e5fah + tstr 020h,038h,0,0,0,1,1,0,0,0,0,-1,0 ; (16,384 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,0,0 ; (14 cycles) + db 0d3h,0f2h,0d7h,04ah ; expected crc + tmsg 'aluop a,(+1)...........' + +; bit n,(+1) (2048 cycles) +bitx: db 0ffh ; flag mask + tstr 0ddh,0cbh,1,046h,02075h,msbt-1,msbt-1,03cfch,0a79ah,03d74h,051h,027h,0ca14h + tstr 020h,0,0,038h,0,0,0,0,0,0,053h,0,0 ; (256 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0,0,0 ; (8 cycles) + db 083h,053h,04eh,0e1h ; expected crc + tmsg 'bit n,(+1).............' + +; bit n, (49,152 cycles) +bitz80: db 0ffh ; flag mask + tstr 0cbh,040h,0,0,03ef1h,09dfch,07acch,msbt,0be61h,07a86h,050h,024h,01998h + tstr 0,03fh,0,0,0,0,0,0,0,0,053h,0,0 ; (1024 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0,-1,0 ; (48 cycles) + db 05eh,002h,00eh,098h ; expected crc + tmsg 'bit n,....' + +; cpd (1) (6144 cycles) +cpd1: db 0ffh ; flag mask + tstr 0edh,0a9h,0,0,0c7b6h,072b4h,018f6h,msbt+17,08dbdh,1,0c0h,030h,094a3h + tstr 0,010h,0,0,0,0,0,0,0,010,0,-1,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 013h,04bh,062h,02dh ; expected crc + tmsg 'cpd........................' + +; cpi (1) (6144 cycles) +cpi1: db 0ffh ; flag mask + tstr 0edh,0a1h,0,0,04d48h,0af4ah,0906bh,msbt,04e71h,1,093h,06ah,0907ch + tstr 0,010h,0,0,0,0,0,0,0,010,0,-1,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 02dh,0a4h,02dh,019h ; expected crc + tmsg 'cpi........................' + +; +daaop: db 0ffh ; flag mask + tstr 027h,0,0,0,02141h,009fah,01d60h,0a559h,08d5bh,09079h,004h,08eh,0299dh + tstr 018h,0,0,0,0,0,0,0,0,0,0d7h,-1,0 ; (65,536 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + db 06dh,02dh,0d2h,013h ; expected crc + tmsg '.............' + +; a (3072 cycles) +inca: db 0ffh ; flag mask + tstr 03ch,0,0,0,04adfh,0d5d8h,0e598h,08a2bh,0a7b0h,0431bh,044h,05ah,0d030h + tstr 001h,0,0,0,0,0,0,0,0,0,0,-1,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 081h,0fah,081h,000h ; expected crc + tmsg ' a...................' + +; b (3072 cycles) +incb: db 0ffh ; flag mask + tstr 004h,0,0,0,0d623h,0432dh,07a61h,08180h,05a86h,01e85h,086h,058h,09bbbh + tstr 001h,0,0,0,0,0,0,0,0,0ff00h,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 077h,0f3h,05ah,073h ; expected crc + tmsg ' b...................' + +; bc (1536 cycles) +incbc: db 0ffh ; flag mask + tstr 003h,0,0,0,0cd97h,044abh,08dc9h,0e3e3h,011cch,0e8a4h,002h,049h,02a4dh + tstr 008h,0,0,0,0,0,0,0,0,0f821h,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0d2h,0aeh,03bh,0ech ; expected crc + tmsg ' bc..................' + +; c (3072 cycles) +incc: db 0ffh ; flag mask + tstr 00ch,0,0,0,0d789h,00935h,0055bh,09f85h,08b27h,0d208h,095h,005h,00660h + tstr 001h,0,0,0,0,0,0,0,0,0ffh,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 01ah,0f6h,012h,0a7h ; expected crc + tmsg ' c...................' + +; d (3072 cycles) +incd: db 0ffh ; flag mask + tstr 014h,0,0,0,0a0eah,05fbah,065fbh,0981ch,038cch,0debch,043h,05ch,003bdh + tstr 001h,0,0,0,0,0,0,0,0ff00h,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0d1h,046h,0bfh,051h ; expected crc + tmsg ' d...................' + +; de (1536 cycles) +incde: db 0ffh ; flag mask + tstr 013h,0,0,0,0342eh,0131dh,028c9h,00acah,09967h,03a2eh,092h,0f6h,09d54h + tstr 008h,0,0,0,0,0,0,0,0f821h,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0aeh,0c6h,0d4h,02ch ; expected crc + tmsg ' de..................' + +; e (3072 cycles) +ince: db 0ffh ; flag mask + tstr 01ch,0,0,0,0602fh,04c0dh,02402h,0e2f5h,0a0f4h,0a10ah,013h,032h,05925h + tstr 001h,0,0,0,0,0,0,0,0ffh,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0cah,08ch,06ah,0c2h ; expected crc + tmsg ' e...................' + +; h (3072 cycles) +inch: db 0ffh ; flag mask + tstr 024h,0,0,0,01506h,0f2ebh,0e8ddh,0262bh,011a6h,0bc1ah,017h,006h,02818h + tstr 001h,0,0,0,0,0,0,0ff00h,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 056h,00fh,095h,05eh ; expected crc + tmsg ' h...................' + +; hl (1536 cycles) +inchl: db 0ffh ; flag mask + tstr 023h,0,0,0,0c3f4h,007a5h,01b6dh,04f04h,0e2c2h,0822ah,057h,0e0h,0c3e1h + tstr 008h,0,0,0,0,0,0,0f821h,0,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0fch,00dh,06dh,04ah ; expected crc + tmsg ' hl..................' + +; ix (1536 cycles) +incix: db 0ffh ; flag mask + tstr 0ddh,023h,0,0,0bc3ch,00d9bh,0e081h,0adfdh,09a7fh,096e5h,013h,085h,00be2h + tstr 0,8,0,0,0,0,0f821h,0,0,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0a5h,04dh,0beh,031h ; expected crc + tmsg ' ix..................' + +; iy (1536 cycles) +inciy: db 0ffh ; flag mask + tstr 0fdh,023h,0,0,09402h,0637ah,03182h,0c65ah,0b2e9h,0abb4h,016h,0f2h,06d05h + tstr 0,8,0,0,0,0f821h,0,0,0,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 050h,05dh,051h,0a3h ; expected crc + tmsg ' iy..................' + +; l (3072 cycles) +incl: db 0ffh ; flag mask + tstr 02ch,0,0,0,08031h,0a520h,04356h,0b409h,0f4c1h,0dfa2h,0d1h,03ch,03ea2h + tstr 001h,0,0,0,0,0,0,0ffh,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0a0h,0a1h,0b4h,09fh ; expected crc + tmsg ' l...................' + +; (hl) (3072 cycles) +incm: db 0ffh ; flag mask + tstr 034h,0,0,0,0b856h,00c7ch,0e53eh,msbt,0877eh,0da58h,015h,05ch,01f37h + tstr 001h,0,0,0,0ffh,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 028h,029h,05eh,0ceh ; expected crc + tmsg ' (hl)................' + +; sp (1536 cycles) +incsp: db 0ffh ; flag mask + tstr 033h,0,0,0,0346fh,0d482h,0d169h,0deb6h,0a494h,0f476h,053h,002h,0855bh + tstr 008h,0,0,0,0,0,0,0,0,0,0,0,0f821h ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 05dh,0ach,0d5h,027h ; expected crc + tmsg ' sp..................' + +; (+1) (6144 cycles) +incx: db 0ffh ; flag mask + tstr 0ddh,034h,1,0,0fa6eh,msbt-1,msbt-1,02c28h,08894h,05057h,016h,033h,0286fh + tstr 020h,1,0,0,0ffh,0,0,0,0,0,0,0,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 00bh,095h,0a8h,0eah ; expected crc + tmsg ' (+1).........' + +; ixh (3072 cycles) +incxh: db 0ffh ; flag mask + tstr 0ddh,024h,0,0,0b838h,0316ch,0c6d4h,03e01h,08358h,015b4h,081h,0deh,04259h + tstr 0,1,0,0,0,0ff00h,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 06fh,046h,036h,062h ; expected crc + tmsg ' ixh.................' + +; ixl (3072 cycles) +incxl: db 0ffh ; flag mask + tstr 0ddh,02ch,0,0,04d14h,07460h,076d4h,006e7h,032a2h,0213ch,0d6h,0d7h,099a5h + tstr 0,1,0,0,0,0ffh,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 002h,07bh,0efh,02ch ; expected crc + tmsg ' ixl.................' + +; iyh (3072 cycles) +incyh: db 0ffh ; flag mask + tstr 0ddh,024h,0,0,02836h,09f6fh,09116h,061b9h,082cbh,0e219h,092h,073h,0a98ch + tstr 0,1,0,0,0ff00h,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 02dh,096h,06ch,0f3h ; expected crc + tmsg ' iyh.................' + +; iyl (3072 cycles) +incyl: db 0ffh ; flag mask + tstr 0ddh,02ch,0,0,0d7c6h,062d5h,0a09eh,07039h,03e7eh,09f12h,090h,0d9h,0220fh + tstr 0,1,0,0,0ffh,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 036h,0c1h,01eh,075h ; expected crc + tmsg ' iyl.................' + +; ld ,(nnnn) (32 cycles) +ld161: db 0ffh ; flag mask + tstr 0edh,04bh,msbtlo,msbthi,0f9a8h,0f559h,093a4h,0f5edh,06f96h,0d968h,086h,0e6h,04bd8h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 04dh,045h,0a9h,0ach ; expected crc + tmsg 'ld ,(nnnn).............' + +; ld hl,(nnnn) (16 cycles) +ld162: db 0ffh ; flag mask + tstr 02ah,msbtlo,msbthi,0,09863h,07830h,02077h,0b1feh,0b9fah,0abb8h,004h,006h,06015h + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 05fh,097h,024h,087h ; expected crc + tmsg 'ld hl,(nnnn)..................' + +; ld sp,(nnnn) (16 cycles) +ld163: db 0ffh ; flag mask + tstr 0edh,07bh,msbtlo,msbthi,08dfch,057d7h,02161h,0ca18h,0c185h,027dah,083h,01eh,0f460h + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 07ah,0ceh,0a1h,01bh ; expected crc + tmsg 'ld sp,(nnnn)..................' + +; ld ,(nnnn) (32 cycles) +ld164: db 0ffh ; flag mask + tstr 0ddh,02ah,msbtlo,msbthi,0ded7h,0a6fah,0f780h,0244ch,087deh,0bcc2h,016h,063h,04c96h + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 085h,08bh,0f1h,06dh ; expected crc + tmsg 'ld ,(nnnn).............' + +; ld (nnnn), (64 cycles) +ld165: db 0ffh ; flag mask + tstr 0edh,043h,msbtlo,msbthi,01f98h,0844dh,0e8ach,0c9edh,0c95dh,08f61h,080h,03fh,0c7bfh + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,0,0,0,0,-1,-1,0,0,0 ; (32 cycles) + db 064h,01eh,087h,015h ; expected crc + tmsg 'ld (nnnn),.............' + +; ld (nnnn),hl (16 cycles) +ld166: db 0ffh ; flag mask + tstr 022h,msbtlo,msbthi,0,0d003h,07772h,07f53h,03f72h,064eah,0e180h,010h,02dh,035e9h + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + tstr 0,0,0,0,0,0,0,-1,0,0,0,0,0 ; (16 cycles) + db 0a3h,060h,08bh,047h ; expected crc + tmsg 'ld (nnnn),hl..................' + +; ld (nnnn),sp (16 cycles) +ld167: db 0ffh ; flag mask + tstr 0edh,073h,msbtlo,msbthi,0c0dch,0d1d6h,0ed5ah,0f356h,0afdah,06ca7h,044h,09fh,03f0ah + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + tstr 0,0,0,0,0,0,0,0,0,0,0,0,-1 ; (16 cycles) + db 016h,058h,05fh,0d7h ; expected crc + tmsg 'ld (nnnn),sp..................' + +; ld (nnnn), (64 cycles) +ld168: db 0ffh ; flag mask + tstr 0ddh,022h,msbtlo,msbthi,06cc3h,00d91h,06900h,08ef8h,0e3d6h,0c3f7h,0c6h,0d9h,0c2dfh + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,0,-1,-1,0,0,0,0,0,0 ; (32 cycles) + db 0bah,010h,02ah,06bh ; expected crc + tmsg 'ld (nnnn),.............' + +; ld ,nnnn (64 cycles) +ld16im: db 0ffh ; flag mask + tstr 1,0,0,0,05c1ch,02d46h,08eb9h,06078h,074b1h,0b30eh,046h,0d1h,030cch + tstr 030h,0,0,0,0,0,0,0,0,0,0,0,0 ; (4 cycles) + tstr 0,0ffh,0ffh,0,0,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0deh,039h,019h,069h ; expected crc + tmsg 'ld ,nnnn.........' + +; ld ,nnnn (32 cycles) +ld16ix: db 0ffh ; flag mask + tstr 0ddh,021h,0,0,087e8h,02006h,0bd12h,0b69bh,07253h,0a1e5h,051h,013h,0f1bdh + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0ffh,0ffh,0,0,0,0,0,0,0,0,0 ; (16 cycles) + db 022h,07dh,0d5h,025h ; expected crc + tmsg 'ld ,nnnn...............' + +; ld a,<(bc),(de)> (44 cycles) +ld8bd: db 0ffh ; flag mask + tstr 00ah,0,0,0,0b3a8h,01d2ah,07f8eh,042ach,msbt,msbt,0c6h,0b1h,0ef8eh + tstr 010h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,-1,0 ; (22 cycles) + db 0b0h,081h,089h,035h ; expected crc + tmsg 'ld a,<(bc),(de)>..............' + +; ld ,nn (64 cycles) +ld8im: db 0ffh ; flag mask + tstr 6,0,0,0,0c407h,0f49dh,0d13dh,00339h,0de89h,07455h,053h,0c0h,05509h + tstr 038h,0,0,0,0,0,0,0,0,0,0,0,0 ; (8 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,-1,0 ; (8 cycles) + db 0f1h,0dah,0b5h,056h ; expected crc + tmsg 'ld ,nn....' + +; ld (+1),nn (32 cycles) +ld8imx: db 0ffh ; flag mask + tstr 0ddh,036h,1,0,01b45h,msbt-1,msbt-1,0d5c1h,061c7h,0bdc4h,0c0h,085h,0cd16h + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,-1,0,0,0,0,0,0,0,-1,0 ; (16 cycles) + db 026h,0dbh,047h,07eh ; expected crc + tmsg 'ld (+1),nn.............' + +; ld ,(+1) (512 cycles) +ld8ix1: db 0ffh ; flag mask + tstr 0ddh,046h,1,0,0d016h,msbt-1,msbt-1,04260h,07f39h,00404h,097h,04ah,0d085h + tstr 020h,018h,0,0,0,1,1,0,0,0,0,0,0 ; (32 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0cch,011h,006h,0a8h ; expected crc + tmsg 'ld ,(+1)......' + +; ld ,(+1) (256 cycles) +ld8ix2: db 0ffh ; flag mask + tstr 0ddh,066h,1,0,084e0h,msbt-1,msbt-1,09c52h,0a799h,049b6h,093h,000h,0eeadh + tstr 020h,008h,0,0,0,1,1,0,0,0,0,0,0 ; (16 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0fah,02ah,04dh,003h ; expected crc + tmsg 'ld ,(+1)..........' + +; ld a,(+1) (128 cycles) +ld8ix3: db 0ffh ; flag mask + tstr 0ddh,07eh,1,0,0d8b6h,msbt-1,msbt-1,0c612h,0df07h,09cd0h,043h,0a6h,0a0e5h + tstr 020h,0,0,0,0,1,1,0,0,0,0,0,0 ; (8 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0a5h,0e9h,0ach,064h ; expected crc + tmsg 'ld a,(+1)..............' + +; ld ,nn (32 cycles) +ld8ixy: db 0ffh ; flag mask + tstr 0ddh,026h,0,0,03c53h,04640h,0e179h,07711h,0c107h,01afah,081h,0adh,05d9bh + tstr 020h,8,0,0,0,0,0,0,0,0,0,0,0 ; (4 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,-1,0 ; (8 cycles) + db 024h,0e8h,082h,08bh ; expected crc + tmsg 'ld ,nn.......' + +; ld , (3456 cycles) +ld8rr: db 0ffh ; flag mask + tstr 040h,0,0,0,072a4h,0a024h,061ach,msbt,082c7h,0718fh,097h,08fh,0ef8eh + tstr 03fh,0,0,0,0,0,0,0,0,0,0,0,0 ; (64 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,-1,0 ; (54 cycles) + db 074h,04bh,001h,018h ; expected crc + tmsg 'ld ,........' + +; ld , (6912 cycles) +ld8rrx: db 0ffh ; flag mask + tstr 0ddh,040h,0,0,0bcc5h,msbt,msbt,msbt,02fc2h,098c0h,083h,01fh,03bcdh + tstr 020h,03fh,0,0,0,0,0,0,0,0,0,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,-1,0 ; (54 cycles) + db 047h,08bh,0a3h,06bh ; expected crc + tmsg 'ld ,........' + +; ld a,(nnnn) / ld (nnnn),a (44 cycles) +lda: db 0ffh ; flag mask + tstr 032h,msbtlo,msbthi,0,0fd68h,0f4ech,044a0h,0b543h,00653h,0cdbah,0d2h,04fh,01fd8h + tstr 008h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycle) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,-1,0 ; (22 cycles) + db 0c9h,026h,02dh,0e5h ; expected crc + tmsg 'ld a,(nnnn) / ld (nnnn),a.....' + +; ldd (1) (44 cycles) +ldd1: db 0ffh ; flag mask + tstr 0edh,0a8h,0,0,09852h,068fah,066a1h,msbt+3,msbt+1,1,0c1h,068h,020b7h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 094h,0f4h,027h,069h ; expected crc + tmsg 'ldd (1)....................' + +; ldd (2) (44 cycles) +ldd2: db 0ffh ; flag mask + tstr 0edh,0a8h,0,0,0f12eh,0eb2ah,0d5bah,msbt+3,msbt+1,2,047h,0ffh,0fbe4h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 039h,0ddh,03dh,0e1h ; expected crc + tmsg 'ldd (2)....................' + +; ldi (1) (44 cycles) +ldi1: db 0ffh ; flag mask + tstr 0edh,0a0h,0,0,0fe30h,003cdh,06058h,msbt+2,msbt,1,004h,060h,02688h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 0f7h,082h,0b0h,0d1h ; expected crc + tmsg 'ldi (1)....................' + +; ldi (2) (44 cycles) +ldi2: db 0ffh ; flag mask + tstr 0edh,0a0h,0,0,04aceh,0c26eh,0b188h,msbt+2,msbt,2,014h,02dh,0a39fh + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 0e9h,0eah,0d0h,0aeh ; expected crc + tmsg 'ldi (2)....................' + +; neg (16,384 cycles) +negop: db 0ffh ; flag mask + tstr 0edh,044h,0,0,038a2h,05f6bh,0d934h,057e4h,0d2d6h,04642h,043h,05ah,009cch + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,-1,0 ; (16,384 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + db 0d6h,038h,0ddh,06ah ; expected crc + tmsg 'neg...........................' + +; (7168 cycles) +rldop: db 0ffh ; flag mask + tstr 0edh,067h,0,0,091cbh,0c48bh,0fa62h,msbt,0e720h,0b479h,040h,006h,08ae2h + tstr 0,8,0,0,0ffh,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,-1,0 ; (14 cycles) + db 0ffh,082h,03eh,077h ; expected crc + tmsg '.....................' + +; (6144 cycles) +rot8080: db 0ffh ; flag mask + tstr 7,0,0,0,0cb92h,06d43h,00a90h,0c284h,00c53h,0f50eh,091h,0ebh,040fch + tstr 018h,0,0,0,0,0,0,0,0,0,0,-1,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 09bh,0a3h,080h,07ch ; expected crc + tmsg '...........' + +; shift/rotate (+1) (416 cycles) +rotxy: db 0ffh ; flag mask + tstr 0ddh,0cbh,1,6,0ddafh,msbt-1,msbt-1,0ff3ch,0dbf6h,094f4h,082h,080h,061d9h + tstr 020h,0,0,038h,0,0,0,0,0,0,080h,0,0 ; (32 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,057h,0,0 ; (13 cycles) + db 071h,000h,034h,0cbh ; expected crc + tmsg 'shf/rot (+1)...........' + +; shift/rotate (6784 cycles) +rotz80: db 0ffh ; flag mask + tstr 0cbh,0,0,0,0ccebh,05d4ah,0e007h,msbt,01395h,030eeh,043h,078h,03dadh + tstr 0,03fh,0,0,0,0,0,0,0,0,080h,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,057h,-1,0 ; (53 cycles) + db 0a4h,025h,058h,033h ; expected crc + tmsg 'shf/rot ..' + +; n, (7936 cycles) +srz80: db 0ffh ; flag mask + tstr 0cbh,080h,0,0,02cd5h,097abh,039ffh,msbt,0d14bh,06ab2h,053h,027h,0b538h + tstr 0,07fh,0,0,0,0,0,0,0,0,0,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,-1,0 ; (62 cycles) + db 08bh,057h,0f0h,008h ; expected crc + tmsg ' n,.....' + +; n,(+1) (1792 cycles) +srzx: db 0ffh ; flag mask + tstr 0ddh,0cbh,1,086h,0fb44h,msbt-1,msbt-1,0ba09h,068beh,032d8h,010h,05eh,0a867h + tstr 020h,0,0,078h,0,0,0,0,0,0,0,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,0,0 ;(14 cycles) + db 0cch,063h,0f9h,08ah ; expected crc + tmsg ' n,(+1).......' + +; ld (+1), (1024 cycles) +st8ix1: db 0ffh ; flag mask + tstr 0ddh,070h,1,0,0270dh,msbt-1,msbt-1,0b73ah,0887bh,099eeh,086h,070h,0ca07h + tstr 020h,003h,0,0,0,1,1,0,0,0,0,0,0 ; (32 cycles) + tstr 0,0,0,0,0,0,0,0,-1,-1,0,0,0 ; (32 cycles) + db 004h,062h,06ah,0bfh ; expected crc + tmsg 'ld (+1),......' + +; ld (+1), (256 cycles) +st8ix2: db 0ffh ; flag mask + tstr 0ddh,074h,1,0,0b664h,msbt-1,msbt-1,0e8ach,0b5f5h,0aafeh,012h,010h,09566h + tstr 020h,001h,0,0,0,1,1,0,0,0,0,0,0 ; (16 cycles) + tstr 0,0,0,0,0,0,0,-1,0,0,0,0,0 ; (32 cycles) + db 06ah,01ah,088h,031h ; expected crc + tmsg 'ld (+1),..........' + +; ld (+1),a (64 cycles) +st8ix3: db 0ffh ; flag mask + tstr 0ddh,077h,1,0,067afh,msbt-1,msbt-1,04f13h,00644h,0bcd7h,050h,0ach,05fafh + tstr 020h,0,0,0,0,1,1,0,0,0,0,0,0 ; (8 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,-1,0 ; (8 cycles) + db 0cch,0beh,05ah,096h ; expected crc + tmsg 'ld (+1),a..............' + +; ld (),a (96 cycles) +stabd: db 0ffh ; flag mask + tstr 2,0,0,0,00c3bh,0b592h,06cffh,0959eh,msbt,msbt+1,0c1h,021h,0bde7h + tstr 018h,0,0,0,0,0,0,0,0,0,0,0,0 ; (4 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,-1,0 ; (24 cycles) + db 07ah,04ch,011h,04fh ; expected crc + tmsg 'ld (),a................' + +; start test pointed to by (hl) +stt: push hl + ld a,(hl) ; get pointer to test + inc hl + ld h,(hl) + ld l,a + ld a,(hl) ; flag mask + ld (flgmsk+1),a + inc hl + push hl + ld de,20 + add hl,de ; point to incmask + ld de,counter + call initmask + pop hl + push hl + ld de,20+20 + add hl,de ; point to scanmask + ld de,shifter + call initmask + ld hl,shifter + ld (hl),1 ; first bit + pop hl + push hl + ld de,iut ; copy initial instruction under test + ld bc,4 + ldir + ld de,msbt ; copy initial machine state + ld bc,16 + ldir + ld de,20+20+4 ; skip incmask, scanmask and expcrc + add hl,de + ex de,hl + ld c,9 + call bdos ; show test name + call initcrc ; initialise crc +; test loop +tlp: ld a,(iut) + cp 076h ; pragmatically avoid halt intructions + jp z,tlp2 + and a,0dfh + cp 0ddh + jp nz,tlp1 + ld a,(iut+1) + cp 076h +tlp1: call nz,test ; execute the test instruction +tlp2: call count ; increment the counter + call nz,shift ; shift the scan bit + pop hl ; pointer to test case + jp z,tlp3 ; done if shift returned NZ + ld de,20+20+20 + add hl,de ; point to expected crc + call cmpcrc + ld de,okmsg + jp z,tlpok + ld de,ermsg1 + ld c,9 + call bdos + call phex8 + ld de,ermsg2 + ld c,9 + call bdos + ld hl,crcval + call phex8 + ld de,crlf +tlpok: ld c,9 + call bdos + pop hl + inc hl + inc hl + ret + +tlp3: push hl + ld a,1 ; initialise count and shift scanners + ld (cntbit),a + ld (shfbit),a + ld hl,counter + ld (cntbyt),hl + ld hl,shifter + ld (shfbyt),hl + + ld b,4 ; bytes in iut field + pop hl ; pointer to test case + push hl + ld de,iut + call setup ; setup iut + ld b,16 ; bytes in machine state + ld de,msbt + call setup ; setup machine state + jp tlp + +; setup a field of the test case +; b = number of bytes +; hl = pointer to base case +; de = destination +setup: call subyte + inc hl + dec b + jp nz,setup + ret + +subyte: push bc + push de + push hl + ld c,(hl) ; get base byte + ld de,20 + add hl,de ; point to incmask + ld a,(hl) + cp 0 + jp z,subshf + ld b,8 ; 8 bits +subclp: rrca + push af + ld a,0 + call c,nxtcbit ; get next counter bit if mask bit was set + xor c ; flip bit if counter bit was set + rrca + ld c,a + pop af + dec b + jp nz,subclp + ld b,8 +subshf: ld de,20 + add hl,de ; point to shift mask + ld a,(hl) + cp 0 + jp z,substr + ld b,8 ; 8 bits +sbshf1: rrca + push af + ld a,0 + call c,nxtsbit ; get next shifter bit if mask bit was set + xor c ; flip bit if shifter bit was set + rrca + ld c,a + pop af + dec b + jp nz,sbshf1 +substr: pop hl + pop de + ld a,c + ld (de),a ; mangled byte to destination + inc de + pop bc + ret + +; get next counter bit in low bit of a +cntbit: ds 1 +cntbyt: ds 2 + +nxtcbit: push bc + push hl + ld hl,(cntbyt) + ld b,(hl) + ld hl,cntbit + ld a,(hl) + ld c,a + rlca + ld (hl),a + cp a,1 + jp nz,ncb1 + ld hl,(cntbyt) + inc hl + ld (cntbyt),hl +ncb1: ld a,b + and c + pop hl + pop bc + ret z + ld a,1 + ret + +; get next shifter bit in low bit of a +shfbit: ds 1 +shfbyt: ds 2 + +nxtsbit: push bc + push hl + ld hl,(shfbyt) + ld b,(hl) + ld hl,shfbit + ld a,(hl) + ld c,a + rlca + ld (hl),a + cp a,1 + jp nz,nsb1 + ld hl,(shfbyt) + inc hl + ld (shfbyt),hl +nsb1: ld a,b + and c + pop hl + pop bc + ret z + ld a,1 + ret + + +; clear memory at hl, bc bytes +clrmem: push af + push bc + push de + push hl + ld (hl),0 + ld d,h + ld e,l + inc de + dec bc + ldir + pop hl + pop de + pop bc + pop af + ret + +; initialise counter or shifter +; de = pointer to work area for counter or shifter +; hl = pointer to mask +initmask: + push de + ex de,hl + ld bc,20+20 + call clrmem ; clear work area + ex de,hl + ld b,20 ; byte counter + ld c,1 ; first bit + ld d,0 ; bit counter +imlp: ld e,(hl) +imlp1: ld a,e + and a,c + jp z,imlp2 + inc d +imlp2: ld a,c + rlca + ld c,a + cp a,1 + jp nz,imlp1 + inc hl + dec b + jp nz,imlp +; got number of 1-bits in mask in reg d + ld a,d + and 0f8h + rrca + rrca + rrca ; divide by 8 (get byte offset) + ld l,a + ld h,0 + ld a,d + and a,7 ; bit offset + inc a + ld b,a + ld a,080h +imlp3: rlca + dec b + jp nz,imlp3 + pop de + add hl,de + ld de,20 + add hl,de + ld (hl),a + ret + +; multi-byte counter +count: push bc + push de + push hl + ld hl,counter ; 20 byte counter starts here + ld de,20 ; somewhere in here is the stop bit + ex de,hl + add hl,de + ex de,hl +cntlp: inc (hl) + ld a,(hl) + cp 0 + jp z,cntlp1 ; overflow to next byte + ld b,a + ld a,(de) + and a,b ; test for terminal value + jp z,cntend + ld (hl),0 ; reset to zero +cntend: pop bc + pop de + pop hl + ret + +cntlp1: inc hl + inc de + jp cntlp + + +; multi-byte shifter +shift: push bc + push de + push hl + ld hl,shifter ; 20 byte shift register starts here + ld de,20 ; somewhere in here is the stop bit + ex de,hl + add hl,de + ex de,hl +shflp: ld a,(hl) + or a + jp z,shflp1 + ld b,a + ld a,(de) + and b + jp nz,shlpe + ld a,b + rlca + cp a,1 + jp nz,shflp2 + ld (hl),0 + inc hl + inc de +shflp2: ld (hl),a + xor a ; set Z +shlpe: pop hl + pop de + pop bc + ret +shflp1: inc hl + inc de + jp shflp + +counter: ds 2*20 +shifter: ds 2*20 + +; test harness +test: push af + push bc + push de + push hl + if 0 + ld de,crlf + ld c,9 + call bdos + ld hl,iut + ld b,4 + call hexstr + ld e,' ' + ld c,2 + call bdos + ld b,16 + ld hl,msbt + call hexstr + endif + di ; disable interrupts + ld (spsav),sp ; save stack pointer + ld sp,msbt+2 ; point to test-case machine state + pop iy ; and load all regs + pop ix + pop hl + pop de + pop bc + pop af + ld sp,(spbt) +iut: ds 4 ; max 4 byte instruction under test + ld (spat),sp ; save stack pointer + ld sp,spat + push af ; save other registers + push bc + push de + push hl + push ix + push iy + ld sp,(spsav) ; restore stack pointer + ei ; enable interrupts + ld hl,(msbt) ; copy memory operand + ld (msat),hl + ld hl,flgsat ; flags after test + ld a,(hl) +flgmsk: and a,0d7h ; mask-out irrelevant bits (self-modified code!) + ld (hl),a + ld b,16 ; total of 16 bytes of state + ld de,msat + ld hl,crcval +tcrc: ld a,(de) + inc de + call updcrc ; accumulate crc of this test case + dec b + jp nz,tcrc + if 0 + ld e,' ' + ld c,2 + call bdos + ld hl,crcval + call phex8 + ld de,crlf + ld c,9 + call bdos + ld hl,msat + ld b,16 + call hexstr + ld de,crlf + ld c,9 + call bdos + endif + pop hl + pop de + pop bc + pop af + ret + +; machine state after test +msat: ds 14 ; memop,iy,ix,hl,de,bc,af +spat: ds 2 ; stack pointer after test +; ZMAC/MAXAM doesn't like ':' after label with EQUs +flgsat equ spat-2 ; flags + +spsav: ds 2 ; saved stack pointer + +; display hex string (pointer in hl, byte count in b) +hexstr: ld a,(hl) + call phex2 + inc hl + dec b + jp nz,hexstr + ret + +; display hex +; display the big-endian 32-bit value pointed to by hl +phex8: push af + push bc + push hl + ld b,4 +ph8lp: ld a,(hl) + call phex2 + inc hl + dec b + jp nz,ph8lp + pop hl + pop bc + pop af + ret + +; display byte in a +phex2: push af + rrca + rrca + rrca + rrca + call phex1 + pop af +; fall through + +; display low nibble in a +phex1: push af + push bc + push de + push hl + and a,0fh + cp a,10 + jp c,ph11 + add a,'a'-'9'-1 +ph11: add a,'0' + ld e,a + ld c,2 + call bdos + pop hl + pop de + pop bc + pop af + ret + +bdos push af + push bc + push de + push hl + call 5 + pop hl + pop de + pop bc + pop af + ret + +msg1: db 'Z80all instruction exerciser',10,13,'$' +msg2: db 'Tests complete' +crlf: db 10,13,'$' +okmsg: db ' OK',10,13,'$' +ermsg1: db ' ERROR **** crc expected:$' +ermsg2: db ' found:$' + +; compare crc +; hl points to value to compare to crcval +cmpcrc: push bc + push de + push hl + ld de,crcval + ld b,4 +cclp: ld a,(de) + cp a,(hl) + jp nz,cce + inc hl + inc de + dec b + jp nz,cclp +cce: pop hl + pop de + pop bc + ret + +; 32-bit crc routine +; entry: a contains next byte, hl points to crc +; exit: crc updated +updcrc: push af + push bc + push de + push hl + push hl + ld de,3 + add hl,de ; point to low byte of old crc + xor a,(hl) ; xor with new byte + ld l,a + ld h,0 + add hl,hl ; use result as index into table of 4 byte entries + add hl,hl + ex de,hl + ld hl,crctab + add hl,de ; point to selected entry in crctab + ex de,hl + pop hl + ld bc,4 ; c = byte count, b = accumulator +crclp: ld a,(de) + xor a,b + ld b,(hl) + ld (hl),a + inc de + inc hl + dec c + jp nz,crclp + if 0 + ld hl,crcval + call phex8 + ld de,crlf + ld c,9 + call bdos + endif + pop hl + pop de + pop bc + pop af + ret + +initcrc:push af + push bc + push hl + ld hl,crcval + ld a,0ffh + ld b,4 +icrclp: ld (hl),a + inc hl + dec b + jp nz,icrclp + pop hl + pop bc + pop af + ret + +crcval ds 4 + +crctab: db 000h,000h,000h,000h + db 077h,007h,030h,096h + db 0eeh,00eh,061h,02ch + db 099h,009h,051h,0bah + db 007h,06dh,0c4h,019h + db 070h,06ah,0f4h,08fh + db 0e9h,063h,0a5h,035h + db 09eh,064h,095h,0a3h + db 00eh,0dbh,088h,032h + db 079h,0dch,0b8h,0a4h + db 0e0h,0d5h,0e9h,01eh + db 097h,0d2h,0d9h,088h + db 009h,0b6h,04ch,02bh + db 07eh,0b1h,07ch,0bdh + db 0e7h,0b8h,02dh,007h + db 090h,0bfh,01dh,091h + db 01dh,0b7h,010h,064h + db 06ah,0b0h,020h,0f2h + db 0f3h,0b9h,071h,048h + db 084h,0beh,041h,0deh + db 01ah,0dah,0d4h,07dh + db 06dh,0ddh,0e4h,0ebh + db 0f4h,0d4h,0b5h,051h + db 083h,0d3h,085h,0c7h + db 013h,06ch,098h,056h + db 064h,06bh,0a8h,0c0h + db 0fdh,062h,0f9h,07ah + db 08ah,065h,0c9h,0ech + db 014h,001h,05ch,04fh + db 063h,006h,06ch,0d9h + db 0fah,00fh,03dh,063h + db 08dh,008h,00dh,0f5h + db 03bh,06eh,020h,0c8h + db 04ch,069h,010h,05eh + db 0d5h,060h,041h,0e4h + db 0a2h,067h,071h,072h + db 03ch,003h,0e4h,0d1h + db 04bh,004h,0d4h,047h + db 0d2h,00dh,085h,0fdh + db 0a5h,00ah,0b5h,06bh + db 035h,0b5h,0a8h,0fah + db 042h,0b2h,098h,06ch + db 0dbh,0bbh,0c9h,0d6h + db 0ach,0bch,0f9h,040h + db 032h,0d8h,06ch,0e3h + db 045h,0dfh,05ch,075h + db 0dch,0d6h,00dh,0cfh + db 0abh,0d1h,03dh,059h + db 026h,0d9h,030h,0ach + db 051h,0deh,000h,03ah + db 0c8h,0d7h,051h,080h + db 0bfh,0d0h,061h,016h + db 021h,0b4h,0f4h,0b5h + db 056h,0b3h,0c4h,023h + db 0cfh,0bah,095h,099h + db 0b8h,0bdh,0a5h,00fh + db 028h,002h,0b8h,09eh + db 05fh,005h,088h,008h + db 0c6h,00ch,0d9h,0b2h + db 0b1h,00bh,0e9h,024h + db 02fh,06fh,07ch,087h + db 058h,068h,04ch,011h + db 0c1h,061h,01dh,0abh + db 0b6h,066h,02dh,03dh + db 076h,0dch,041h,090h + db 001h,0dbh,071h,006h + db 098h,0d2h,020h,0bch + db 0efh,0d5h,010h,02ah + db 071h,0b1h,085h,089h + db 006h,0b6h,0b5h,01fh + db 09fh,0bfh,0e4h,0a5h + db 0e8h,0b8h,0d4h,033h + db 078h,007h,0c9h,0a2h + db 00fh,000h,0f9h,034h + db 096h,009h,0a8h,08eh + db 0e1h,00eh,098h,018h + db 07fh,06ah,00dh,0bbh + db 008h,06dh,03dh,02dh + db 091h,064h,06ch,097h + db 0e6h,063h,05ch,001h + db 06bh,06bh,051h,0f4h + db 01ch,06ch,061h,062h + db 085h,065h,030h,0d8h + db 0f2h,062h,000h,04eh + db 06ch,006h,095h,0edh + db 01bh,001h,0a5h,07bh + db 082h,008h,0f4h,0c1h + db 0f5h,00fh,0c4h,057h + db 065h,0b0h,0d9h,0c6h + db 012h,0b7h,0e9h,050h + db 08bh,0beh,0b8h,0eah + db 0fch,0b9h,088h,07ch + db 062h,0ddh,01dh,0dfh + db 015h,0dah,02dh,049h + db 08ch,0d3h,07ch,0f3h + db 0fbh,0d4h,04ch,065h + db 04dh,0b2h,061h,058h + db 03ah,0b5h,051h,0ceh + db 0a3h,0bch,000h,074h + db 0d4h,0bbh,030h,0e2h + db 04ah,0dfh,0a5h,041h + db 03dh,0d8h,095h,0d7h + db 0a4h,0d1h,0c4h,06dh + db 0d3h,0d6h,0f4h,0fbh + db 043h,069h,0e9h,06ah + db 034h,06eh,0d9h,0fch + db 0adh,067h,088h,046h + db 0dah,060h,0b8h,0d0h + db 044h,004h,02dh,073h + db 033h,003h,01dh,0e5h + db 0aah,00ah,04ch,05fh + db 0ddh,00dh,07ch,0c9h + db 050h,005h,071h,03ch + db 027h,002h,041h,0aah + db 0beh,00bh,010h,010h + db 0c9h,00ch,020h,086h + db 057h,068h,0b5h,025h + db 020h,06fh,085h,0b3h + db 0b9h,066h,0d4h,009h + db 0ceh,061h,0e4h,09fh + db 05eh,0deh,0f9h,00eh + db 029h,0d9h,0c9h,098h + db 0b0h,0d0h,098h,022h + db 0c7h,0d7h,0a8h,0b4h + db 059h,0b3h,03dh,017h + db 02eh,0b4h,00dh,081h + db 0b7h,0bdh,05ch,03bh + db 0c0h,0bah,06ch,0adh + db 0edh,0b8h,083h,020h + db 09ah,0bfh,0b3h,0b6h + db 003h,0b6h,0e2h,00ch + db 074h,0b1h,0d2h,09ah + db 0eah,0d5h,047h,039h + db 09dh,0d2h,077h,0afh + db 004h,0dbh,026h,015h + db 073h,0dch,016h,083h + db 0e3h,063h,00bh,012h + db 094h,064h,03bh,084h + db 00dh,06dh,06ah,03eh + db 07ah,06ah,05ah,0a8h + db 0e4h,00eh,0cfh,00bh + db 093h,009h,0ffh,09dh + db 00ah,000h,0aeh,027h + db 07dh,007h,09eh,0b1h + db 0f0h,00fh,093h,044h + db 087h,008h,0a3h,0d2h + db 01eh,001h,0f2h,068h + db 069h,006h,0c2h,0feh + db 0f7h,062h,057h,05dh + db 080h,065h,067h,0cbh + db 019h,06ch,036h,071h + db 06eh,06bh,006h,0e7h + db 0feh,0d4h,01bh,076h + db 089h,0d3h,02bh,0e0h + db 010h,0dah,07ah,05ah + db 067h,0ddh,04ah,0cch + db 0f9h,0b9h,0dfh,06fh + db 08eh,0beh,0efh,0f9h + db 017h,0b7h,0beh,043h + db 060h,0b0h,08eh,0d5h + db 0d6h,0d6h,0a3h,0e8h + db 0a1h,0d1h,093h,07eh + db 038h,0d8h,0c2h,0c4h + db 04fh,0dfh,0f2h,052h + db 0d1h,0bbh,067h,0f1h + db 0a6h,0bch,057h,067h + db 03fh,0b5h,006h,0ddh + db 048h,0b2h,036h,04bh + db 0d8h,00dh,02bh,0dah + db 0afh,00ah,01bh,04ch + db 036h,003h,04ah,0f6h + db 041h,004h,07ah,060h + db 0dfh,060h,0efh,0c3h + db 0a8h,067h,0dfh,055h + db 031h,06eh,08eh,0efh + db 046h,069h,0beh,079h + db 0cbh,061h,0b3h,08ch + db 0bch,066h,083h,01ah + db 025h,06fh,0d2h,0a0h + db 052h,068h,0e2h,036h + db 0cch,00ch,077h,095h + db 0bbh,00bh,047h,003h + db 022h,002h,016h,0b9h + db 055h,005h,026h,02fh + db 0c5h,0bah,03bh,0beh + db 0b2h,0bdh,00bh,028h + db 02bh,0b4h,05ah,092h + db 05ch,0b3h,06ah,004h + db 0c2h,0d7h,0ffh,0a7h + db 0b5h,0d0h,0cfh,031h + db 02ch,0d9h,09eh,08bh + db 05bh,0deh,0aeh,01dh + db 09bh,064h,0c2h,0b0h + db 0ech,063h,0f2h,026h + db 075h,06ah,0a3h,09ch + db 002h,06dh,093h,00ah + db 09ch,009h,006h,0a9h + db 0ebh,00eh,036h,03fh + db 072h,007h,067h,085h + db 005h,000h,057h,013h + db 095h,0bfh,04ah,082h + db 0e2h,0b8h,07ah,014h + db 07bh,0b1h,02bh,0aeh + db 00ch,0b6h,01bh,038h + db 092h,0d2h,08eh,09bh + db 0e5h,0d5h,0beh,00dh + db 07ch,0dch,0efh,0b7h + db 00bh,0dbh,0dfh,021h + db 086h,0d3h,0d2h,0d4h + db 0f1h,0d4h,0e2h,042h + db 068h,0ddh,0b3h,0f8h + db 01fh,0dah,083h,06eh + db 081h,0beh,016h,0cdh + db 0f6h,0b9h,026h,05bh + db 06fh,0b0h,077h,0e1h + db 018h,0b7h,047h,077h + db 088h,008h,05ah,0e6h + db 0ffh,00fh,06ah,070h + db 066h,006h,03bh,0cah + db 011h,001h,00bh,05ch + db 08fh,065h,09eh,0ffh + db 0f8h,062h,0aeh,069h + db 061h,06bh,0ffh,0d3h + db 016h,06ch,0cfh,045h + db 0a0h,00ah,0e2h,078h + db 0d7h,00dh,0d2h,0eeh + db 04eh,004h,083h,054h + db 039h,003h,0b3h,0c2h + db 0a7h,067h,026h,061h + db 0d0h,060h,016h,0f7h + db 049h,069h,047h,04dh + db 03eh,06eh,077h,0dbh + db 0aeh,0d1h,06ah,04ah + db 0d9h,0d6h,05ah,0dch + db 040h,0dfh,00bh,066h + db 037h,0d8h,03bh,0f0h + db 0a9h,0bch,0aeh,053h + db 0deh,0bbh,09eh,0c5h + db 047h,0b2h,0cfh,07fh + db 030h,0b5h,0ffh,0e9h + db 0bdh,0bdh,0f2h,01ch + db 0cah,0bah,0c2h,08ah + db 053h,0b3h,093h,030h + db 024h,0b4h,0a3h,0a6h + db 0bah,0d0h,036h,005h + db 0cdh,0d7h,006h,093h + db 054h,0deh,057h,029h + db 023h,0d9h,067h,0bfh + db 0b3h,066h,07ah,02eh + db 0c4h,061h,04ah,0b8h + db 05dh,068h,01bh,002h + db 02ah,06fh,02bh,094h + db 0b4h,00bh,0beh,037h + db 0c3h,00ch,08eh,0a1h + db 05ah,005h,0dfh,01bh + db 02dh,002h,0efh,08dh + diff --git a/OSBindings/Mac/Clock SignalTests/Zexall/zexdoc.com b/OSBindings/Mac/Clock SignalTests/Zexall/zexdoc.com new file mode 100755 index 0000000000000000000000000000000000000000..7f0d37e49bcc260596e9e2b16aa36eab0bdd107d GIT binary patch literal 8587 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 nH*)>sCX_Qh3Ree`Ft(xN59Dc;{_mD{>PcU#D literal 0 HcmV?d00001 diff --git a/OSBindings/Mac/Clock SignalTests/Zexall/zexdoc.src b/OSBindings/Mac/Clock SignalTests/Zexall/zexdoc.src new file mode 100644 index 000000000..49fb4df30 --- /dev/null +++ b/OSBindings/Mac/Clock SignalTests/Zexall/zexdoc.src @@ -0,0 +1,1561 @@ + title 'Z80 instruction set exerciser' + +; zexdoc.src - Z80 documented instruction set exerciser +; Original Copyright (C) 1994 Frank D. Cringle +; Changes at 03-Nov-2002 Copyright (C) 2002 J.G.Harston +; + Source syntax tweeked to assemble with ZMAC Z80 Macro Assembler +; and MAXAM Assembler, marked in the source with 'jgh:' +; + labels on equates mustn't have trailing colon +; + macros don't understand <...> sequence, so parameters are passed +; explicitly +; + ds n,c not supported, so strings are set to full explicity length +; +; This program is free software; you can redistribute it and/or +; modify it under the terms of the GNU General Public License +; as published by the Free Software Foundation; either version 2 +; of the License, or (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + aseg + org 100h + + jp start + +; machine state before test (needs to be at predictably constant address) +msbt: ds 14 +spbt: ds 2 +msbthi equ msbt / 0100h +msbtlo equ msbt & 0ffh + + +; For the purposes of this test program, the machine state consists of: +; a 2 byte memory operand, followed by +; the registers iy,ix,hl,de,bc,af,sp +; for a total of 16 bytes. + +; The program tests instructions (or groups of similar instructions) +; by cycling through a sequence of machine states, executing the test +; instruction for each one and running a 32-bit crc over the resulting +; machine states. At the end of the sequence the crc is compared to +; an expected value that was found empirically on a real Z80. + +; A test case is defined by a descriptor which consists of: +; a flag mask byte, +; the base case, +; the incement vector, +; the shift vector, +; the expected crc, +; a short descriptive message. +; +; The flag mask byte is used to prevent undefined flag bits from +; influencing the results. Documented flags are as per Mostek Z80 +; Technical Manual. +; +; The next three parts of the descriptor are 20 byte vectors +; corresponding to a 4 byte instruction and a 16 byte machine state. +; The first part is the base case, which is the first test case of +; the sequence. This base is then modified according to the next 2 +; vectors. Each 1 bit in the increment vector specifies a bit to be +; cycled in the form of a binary counter. For instance, if the byte +; corresponding to the accumulator is set to 0ffh in the increment +; vector, the test will be repeated for all 256 values of the +; accumulator. Note that 1 bits don't have to be contiguous. The +; number of test cases 'caused' by the increment vector is equal to +; 2^(number of 1 bits). The shift vector is similar, but specifies a +; set of bits in the test case that are to be successively inverted. +; Thus the shift vector 'causes' a number of test cases equal to the +; number of 1 bits in it. + +; The total number of test cases is the product of those caused by the +; counter and shift vectors and can easily become unweildy. Each +; individual test case can take a few milliseconds to execute, due to +; the overhead of test setup and crc calculation, so test design is a +; compromise between coverage and execution time. + +; This program is designed to detect differences between +; implementations and is not ideal for diagnosing the causes of any +; discrepancies. However, provided a reference implementation (or +; real system) is available, a failing test case can be isolated by +; hand using a binary search of the test space. + + +start: ld hl,(6) + ld sp,hl + ld de,msg1 + ld c,9 + call bdos + + ld hl,tests ; first test case +loop: ld a,(hl) ; end of list ? + inc hl + or (hl) + jp z,done + dec hl + call stt + jp loop + +done: ld de,msg2 + ld c,9 + call bdos + jp 0 ; warm boot + +tests: + dw adc16 + dw add16 + dw add16x + dw add16y + dw alu8i + dw alu8r + dw alu8rx + dw alu8x + dw bitx + dw bitz80 + dw cpd1 + dw cpi1 + dw daaop ; can't use opcode as label + dw inca + dw incb + dw incbc + dw incc + dw incd + dw incde + dw ince + dw inch + dw inchl + dw incix + dw inciy + dw incl + dw incm + dw incsp + dw incx + dw incxh + dw incxl + dw incyh + dw incyl + dw ld161 + dw ld162 + dw ld163 + dw ld164 + dw ld165 + dw ld166 + dw ld167 + dw ld168 + dw ld16im + dw ld16ix + dw ld8bd + dw ld8im + dw ld8imx + dw ld8ix1 + dw ld8ix2 + dw ld8ix3 + dw ld8ixy + dw ld8rr + dw ld8rrx + dw lda + dw ldd1 + dw ldd2 + dw ldi1 + dw ldi2 + dw negop ; jgh: can't use opcode as label + dw rldop ; jgh: can't use opcode as label + dw rot8080 + dw rotxy + dw rotz80 + dw srz80 + dw srzx + dw st8ix1 + dw st8ix2 + dw st8ix3 + dw stabd + dw 0 + +; jgh: macro syntax changed for ZMAC and MAXAM +; can't use opcodes as labels +; ZMAC allows &nn as hex, so & removed from local labels +; +tstr macro insn1,insn2,insn3,insn4,memop,riy,rix,rhl,rde,rbc,flags,acc,rsp,?lab +?lab: db insn1,insn2,insn3,insn4 + dw memop,riy,rix,rhl,rde,rbc + db flags + db acc + dw rsp + if $-?lab ne 20 + error 'missing parameter' + endif + endm + +tmsg macro msg,?lab +?lab: db 'msg' + if $ ge ?lab+31 + error 'message too long' + else +; ds ?lab+30-$,'.' ; jgh: ZMAC/MAXAM don't have char parameter + endif + db '$' + endm + +; jgh: ZMAC/MAXAM don't recognise syntax for macros, so full parameters given +; jgh: each tmsg has full string, as ZMAC/MAXAM don't have ds n,c pseudo-op + +; hl, (38,912 cycles) +adc16: db 0c7h ; flag mask + tstr 0edh,042h,0,0,0832ch,04f88h,0f22bh,0b339h,07e1fh,01563h,0d3h,089h,0465eh + tstr 0,038h,0,0,0,0,0,0f821h,0,0,0,0,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,-1,-1,-1,0d7h,0,-1 ; (38 cycles) + db 0f8h,0b4h,0eah,0a9h ; expected crc + tmsg ' hl,....' + +; add hl, (19,456 cycles) +add16: db 0c7h ; flag mask + tstr 9,0,0,0,0c4a5h,0c4c7h,0d226h,0a050h,058eah,08566h,0c6h,0deh,09bc9h + tstr 030h,0,0,0,0,0,0,0f821h,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,-1,-1,-1,0d7h,0,-1 ; (38 cycles) + db 089h,0fdh,0b6h,035h ; expected crc + tmsg 'add hl,..........' + +; add ix, (19,456 cycles) +add16x: db 0c7h ; flag mask + tstr 0ddh,9,0,0,0ddach,0c294h,0635bh,033d3h,06a76h,0fa20h,094h,068h,036f5h + tstr 0,030h,0,0,0,0,0f821h,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,-1,0,-1,-1,0d7h,0,-1 ; (38 cycles) + db 0c1h,033h,079h,00bh ; expected crc + tmsg 'add ix,..........' + +; add iy, (19,456 cycles) +add16y: db 0c7h ; flag mask + tstr 0fdh,9,0,0,0c7c2h,0f407h,051c1h,03e96h,00bf4h,0510fh,092h,01eh,071eah + tstr 0,030h,0,0,0,0f821h,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,-1,0,0,-1,-1,0d7h,0,-1 ; (38 cycles) + db 0e8h,081h,07bh,09eh ; expected crc + tmsg 'add iy,..........' + +; aluop a,nn (28,672 cycles) +alu8i: db 0d7h ; flag mask + tstr 0c6h,0,0,0,009140h,07e3ch,07a67h,0df6dh,05b61h,00b29h,010h,066h,085b2h + tstr 038h,0,0,0,0,0,0,0,0,0,0,-1,0 ; (2048 cycles) + tstr 0,-1,0,0,0,0,0,0,0,0,0d7h,0,0 ; (14 cycles) + db 048h,079h,093h,060h ; expected crc + tmsg 'aluop a,nn....................' + +; aluop a, (753,664 cycles) +alu8r: db 0d7h ; flag mask + tstr 080h,0,0,0,0c53eh,0573ah,04c4dh,msbt,0e309h,0a666h,0d0h,03bh,0adbbh + tstr 03fh,0,0,0,0,0,0,0,0,0,0,-1,0 ; (16,384 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,0,0 ; (46 cycles) + db 0feh,043h,0b0h,016h ; expected crc + tmsg 'aluop a,..' + +; aluop a, (376,832 cycles) +alu8rx: db 0d7h ; flag mask + tstr 0ddh,084h,0,0,0d6f7h,0c76eh,0accfh,02847h,022ddh,0c035h,0c5h,038h,0234bh + tstr 020h,039h,0,0,0,0,0,0,0,0,0,-1,0 ; (8,192 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,0,0 ; (46 cycles) + db 0a4h,002h,06dh,05ah ; expected crc + tmsg 'aluop a,.....' + +; aluop a,(+1) (229,376 cycles) +alu8x: db 0d7h ; flag mask + tstr 0ddh,086h,1,0,090b7h,msbt-1,msbt-1,032fdh,0406eh,0c1dch,045h,06eh,0e5fah + tstr 020h,038h,0,0,0,1,1,0,0,0,0,-1,0 ; (16,384 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,0,0 ; (14 cycles) + db 0e8h,049h,067h,06eh ; expected crc + tmsg 'aluop a,(+1)...........' + +; bit n,(+1) (2048 cycles) +bitx: db 053h ; flag mask + tstr 0ddh,0cbh,1,046h,02075h,msbt-1,msbt-1,03cfch,0a79ah,03d74h,051h,027h,0ca14h + tstr 020h,0,0,038h,0,0,0,0,0,0,053h,0,0 ; (256 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0,0,0 ; (8 cycles) + db 0a8h,0eeh,008h,067h ; expected crc + tmsg 'bit n,(+1).............' + +; bit n, (49,152 cycles) +bitz80: db 053h ; flag mask + tstr 0cbh,040h,0,0,03ef1h,09dfch,07acch,msbt,0be61h,07a86h,050h,024h,01998h + tstr 0,03fh,0,0,0,0,0,0,0,0,053h,0,0 ; (1024 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0,-1,0 ; (48 cycles) + db 07bh,055h,0e6h,0c8h ; expected crc + tmsg 'bit n,....' + +; cpd (1) (6144 cycles) +cpd1: db 0d7h ; flag mask + tstr 0edh,0a9h,0,0,0c7b6h,072b4h,018f6h,msbt+17,08dbdh,1,0c0h,030h,094a3h + tstr 0,010h,0,0,0,0,0,0,0,010,0,-1,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0a8h,07eh,06ch,0fah ; expected crc + tmsg 'cpd........................' + +; cpi (1) (6144 cycles) +cpi1: db 0d7h ; flag mask + tstr 0edh,0a1h,0,0,04d48h,0af4ah,0906bh,msbt,04e71h,1,093h,06ah,0907ch + tstr 0,010h,0,0,0,0,0,0,0,010,0,-1,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 006h,0deh,0b3h,056h ; expected crc + tmsg 'cpi........................' + +; +daaop: db 0d7h ; flag mask + tstr 027h,0,0,0,02141h,009fah,01d60h,0a559h,08d5bh,09079h,004h,08eh,0299dh + tstr 018h,0,0,0,0,0,0,0,0,0,0d7h,-1,0 ; (65,536 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + db 09bh,04bh,0a6h,075h ; expected crc + tmsg '.............' + +; a (3072 cycles) +inca: db 0d7h ; flag mask + tstr 03ch,0,0,0,04adfh,0d5d8h,0e598h,08a2bh,0a7b0h,0431bh,044h,05ah,0d030h + tstr 001h,0,0,0,0,0,0,0,0,0,0,-1,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0d1h,088h,015h,0a4h ; expected crc + tmsg ' a...................' + +; b (3072 cycles) +incb: db 0d7h ; flag mask + tstr 004h,0,0,0,0d623h,0432dh,07a61h,08180h,05a86h,01e85h,086h,058h,09bbbh + tstr 001h,0,0,0,0,0,0,0,0,0ff00h,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 05fh,068h,022h,064h ; expected crc + tmsg ' b...................' + +; bc (1536 cycles) +incbc: db 0d7h ; flag mask + tstr 003h,0,0,0,0cd97h,044abh,08dc9h,0e3e3h,011cch,0e8a4h,002h,049h,02a4dh + tstr 008h,0,0,0,0,0,0,0,0,0f821h,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0d2h,0aeh,03bh,0ech ; expected crc + tmsg ' bc..................' + +; c (3072 cycles) +incc: db 0d7h ; flag mask + tstr 00ch,0,0,0,0d789h,00935h,0055bh,09f85h,08b27h,0d208h,095h,005h,00660h + tstr 001h,0,0,0,0,0,0,0,0,0ffh,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0c2h,084h,055h,04ch ; expected crc + tmsg ' c...................' + +; d (3072 cycles) +incd: db 0d7h ; flag mask + tstr 014h,0,0,0,0a0eah,05fbah,065fbh,0981ch,038cch,0debch,043h,05ch,003bdh + tstr 001h,0,0,0,0,0,0,0,0ff00h,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 045h,023h,0deh,010h ; expected crc + tmsg ' d...................' + +; de (1536 cycles) +incde: db 0d7h ; flag mask + tstr 013h,0,0,0,0342eh,0131dh,028c9h,00acah,09967h,03a2eh,092h,0f6h,09d54h + tstr 008h,0,0,0,0,0,0,0,0f821h,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0aeh,0c6h,0d4h,02ch ; expected crc + tmsg ' de..................' + +; e (3072 cycles) +ince: db 0d7h ; flag mask + tstr 01ch,0,0,0,0602fh,04c0dh,02402h,0e2f5h,0a0f4h,0a10ah,013h,032h,05925h + tstr 001h,0,0,0,0,0,0,0,0ffh,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0e1h,075h,0afh,0cch ; expected crc + tmsg ' e...................' + +; h (3072 cycles) +inch: db 0d7h ; flag mask + tstr 024h,0,0,0,01506h,0f2ebh,0e8ddh,0262bh,011a6h,0bc1ah,017h,006h,02818h + tstr 001h,0,0,0,0,0,0,0ff00h,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 01ch,0edh,084h,07dh ; expected crc + tmsg ' h...................' + +; hl (1536 cycles) +inchl: db 0d7h ; flag mask + tstr 023h,0,0,0,0c3f4h,007a5h,01b6dh,04f04h,0e2c2h,0822ah,057h,0e0h,0c3e1h + tstr 008h,0,0,0,0,0,0,0f821h,0,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0fch,00dh,06dh,04ah ; expected crc + tmsg ' hl..................' + +; ix (1536 cycles) +incix: db 0d7h ; flag mask + tstr 0ddh,023h,0,0,0bc3ch,00d9bh,0e081h,0adfdh,09a7fh,096e5h,013h,085h,00be2h + tstr 0,8,0,0,0,0,0f821h,0,0,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0a5h,04dh,0beh,031h ; expected crc + tmsg ' ix..................' + +; iy (1536 cycles) +inciy: db 0d7h ; flag mask + tstr 0fdh,023h,0,0,09402h,0637ah,03182h,0c65ah,0b2e9h,0abb4h,016h,0f2h,06d05h + tstr 0,8,0,0,0,0f821h,0,0,0,0,0,0,0 ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 050h,05dh,051h,0a3h ; expected crc + tmsg ' iy..................' + +; l (3072 cycles) +incl: db 0d7h ; flag mask + tstr 02ch,0,0,0,08031h,0a520h,04356h,0b409h,0f4c1h,0dfa2h,0d1h,03ch,03ea2h + tstr 001h,0,0,0,0,0,0,0ffh,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 056h,0cdh,006h,0f3h ; expected crc + tmsg ' l...................' + +; (hl) (3072 cycles) +incm: db 0d7h ; flag mask + tstr 034h,0,0,0,0b856h,00c7ch,0e53eh,msbt,0877eh,0da58h,015h,05ch,01f37h + tstr 001h,0,0,0,0ffh,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0b8h,03ah,0dch,0efh ; expected crc + tmsg ' (hl)................' + +; sp (1536 cycles) +incsp: db 0d7h ; flag mask + tstr 033h,0,0,0,0346fh,0d482h,0d169h,0deb6h,0a494h,0f476h,053h,002h,0855bh + tstr 008h,0,0,0,0,0,0,0,0,0,0,0,0f821h ; (256 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 05dh,0ach,0d5h,027h ; expected crc + tmsg ' sp..................' + +; (+1) (6144 cycles) +incx: db 0d7h ; flag mask + tstr 0ddh,034h,1,0,0fa6eh,msbt-1,msbt-1,02c28h,08894h,05057h,016h,033h,0286fh + tstr 020h,1,0,0,0ffh,0,0,0,0,0,0,0,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 020h,058h,014h,070h ; expected crc + tmsg ' (+1).........' + +; ixh (3072 cycles) +incxh: db 0d7h ; flag mask + tstr 0ddh,024h,0,0,0b838h,0316ch,0c6d4h,03e01h,08358h,015b4h,081h,0deh,04259h + tstr 0,1,0,0,0,0ff00h,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 06fh,046h,036h,062h ; expected crc + tmsg ' ixh.................' + +; ixl (3072 cycles) +incxl: db 0d7h ; flag mask + tstr 0ddh,02ch,0,0,04d14h,07460h,076d4h,006e7h,032a2h,0213ch,0d6h,0d7h,099a5h + tstr 0,1,0,0,0,0ffh,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 002h,07bh,0efh,02ch ; expected crc + tmsg ' ixl.................' + +; iyh (3072 cycles) +incyh: db 0d7h ; flag mask + tstr 0ddh,024h,0,0,02836h,09f6fh,09116h,061b9h,082cbh,0e219h,092h,073h,0a98ch + tstr 0,1,0,0,0ff00h,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 02dh,096h,06ch,0f3h ; expected crc + tmsg ' iyh.................' + +; iyl (3072 cycles) +incyl: db 0d7h ; flag mask + tstr 0ddh,02ch,0,0,0d7c6h,062d5h,0a09eh,07039h,03e7eh,09f12h,090h,0d9h,0220fh + tstr 0,1,0,0,0ffh,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 0fbh,0cbh,0bah,095h ; expected crc + tmsg ' iyl.................' + +; ld ,(nnnn) (32 cycles) +ld161: db 0d7h ; flag mask + tstr 0edh,04bh,msbtlo,msbthi,0f9a8h,0f559h,093a4h,0f5edh,06f96h,0d968h,086h,0e6h,04bd8h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 04dh,045h,0a9h,0ach ; expected crc + tmsg 'ld ,(nnnn).............' + +; ld hl,(nnnn) (16 cycles) +ld162: db 0d7h ; flag mask + tstr 02ah,msbtlo,msbthi,0,09863h,07830h,02077h,0b1feh,0b9fah,0abb8h,004h,006h,06015h + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 05fh,097h,024h,087h ; expected crc + tmsg 'ld hl,(nnnn)..................' + +; ld sp,(nnnn) (16 cycles) +ld163: db 0d7h ; flag mask + tstr 0edh,07bh,msbtlo,msbthi,08dfch,057d7h,02161h,0ca18h,0c185h,027dah,083h,01eh,0f460h + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 07ah,0ceh,0a1h,01bh ; expected crc + tmsg 'ld sp,(nnnn)..................' + +; ld ,(nnnn) (32 cycles) +ld164: db 0d7h ; flag mask + tstr 0ddh,02ah,msbtlo,msbthi,0ded7h,0a6fah,0f780h,0244ch,087deh,0bcc2h,016h,063h,04c96h + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 085h,08bh,0f1h,06dh ; expected crc + tmsg 'ld ,(nnnn).............' + +; ld (nnnn), (64 cycles) +ld165: db 0d7h ; flag mask + tstr 0edh,043h,msbtlo,msbthi,01f98h,0844dh,0e8ach,0c9edh,0c95dh,08f61h,080h,03fh,0c7bfh + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,0,0,0,0,-1,-1,0,0,0 ; (32 cycles) + db 064h,01eh,087h,015h ; expected crc + tmsg 'ld (nnnn),.............' + +; ld (nnnn),hl (16 cycles) +ld166: db 0d7h ; flag mask + tstr 022h,msbtlo,msbthi,0,0d003h,07772h,07f53h,03f72h,064eah,0e180h,010h,02dh,035e9h + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + tstr 0,0,0,0,0,0,0,-1,0,0,0,0,0 ; (16 cycles) + db 0a3h,060h,08bh,047h ; expected crc + tmsg 'ld (nnnn),hl..................' + +; ld (nnnn),sp (16 cycles) +ld167: db 0d7h ; flag mask + tstr 0edh,073h,msbtlo,msbthi,0c0dch,0d1d6h,0ed5ah,0f356h,0afdah,06ca7h,044h,09fh,03f0ah + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + tstr 0,0,0,0,0,0,0,0,0,0,0,0,-1 ; (16 cycles) + db 016h,058h,05fh,0d7h ; expected crc + tmsg 'ld (nnnn),sp..................' + +; ld (nnnn), (64 cycles) +ld168: db 0d7h ; flag mask + tstr 0ddh,022h,msbtlo,msbthi,06cc3h,00d91h,06900h,08ef8h,0e3d6h,0c3f7h,0c6h,0d9h,0c2dfh + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,0,-1,-1,0,0,0,0,0,0 ; (32 cycles) + db 0bah,010h,02ah,06bh ; expected crc + tmsg 'ld (nnnn),.............' + +; ld ,nnnn (64 cycles) +ld16im: db 0d7h ; flag mask + tstr 1,0,0,0,05c1ch,02d46h,08eb9h,06078h,074b1h,0b30eh,046h,0d1h,030cch + tstr 030h,0,0,0,0,0,0,0,0,0,0,0,0 ; (4 cycles) + tstr 0,0ffh,0ffh,0,0,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0deh,039h,019h,069h ; expected crc + tmsg 'ld ,nnnn.........' + +; ld ,nnnn (32 cycles) +ld16ix: db 0d7h ; flag mask + tstr 0ddh,021h,0,0,087e8h,02006h,0bd12h,0b69bh,07253h,0a1e5h,051h,013h,0f1bdh + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0ffh,0ffh,0,0,0,0,0,0,0,0,0 ; (16 cycles) + db 022h,07dh,0d5h,025h ; expected crc + tmsg 'ld ,nnnn...............' + +; ld a,<(bc),(de)> (44 cycles) +ld8bd: db 0d7h ; flag mask + tstr 00ah,0,0,0,0b3a8h,01d2ah,07f8eh,042ach,msbt,msbt,0c6h,0b1h,0ef8eh + tstr 010h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,-1,0 ; (22 cycles) + db 0b0h,081h,089h,035h ; expected crc + tmsg 'ld a,<(bc),(de)>..............' + +; ld ,nn (64 cycles) +ld8im: db 0d7h ; flag mask + tstr 6,0,0,0,0c407h,0f49dh,0d13dh,00339h,0de89h,07455h,053h,0c0h,05509h + tstr 038h,0,0,0,0,0,0,0,0,0,0,0,0 ; (8 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,-1,0 ; (8 cycles) + db 0f1h,0dah,0b5h,056h ; expected crc + tmsg 'ld ,nn....' + +; ld (+1),nn (32 cycles) +ld8imx: db 0d7h ; flag mask + tstr 0ddh,036h,1,0,01b45h,msbt-1,msbt-1,0d5c1h,061c7h,0bdc4h,0c0h,085h,0cd16h + tstr 020h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,-1,0,0,0,0,0,0,0,-1,0 ; (16 cycles) + db 026h,0dbh,047h,07eh ; expected crc + tmsg 'ld (+1),nn.............' + +; ld ,(+1) (512 cycles) +ld8ix1: db 0d7h ; flag mask + tstr 0ddh,046h,1,0,0d016h,msbt-1,msbt-1,04260h,07f39h,00404h,097h,04ah,0d085h + tstr 020h,018h,0,0,0,1,1,0,0,0,0,0,0 ; (32 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0cch,011h,006h,0a8h ; expected crc + tmsg 'ld ,(+1)......' + +; ld ,(+1) (256 cycles) +ld8ix2: db 0d7h ; flag mask + tstr 0ddh,066h,1,0,084e0h,msbt-1,msbt-1,09c52h,0a799h,049b6h,093h,000h,0eeadh + tstr 020h,008h,0,0,0,1,1,0,0,0,0,0,0 ; (16 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0fah,02ah,04dh,003h ; expected crc + tmsg 'ld ,(+1)..........' + +; ld a,(+1) (128 cycles) +ld8ix3: db 0d7h ; flag mask + tstr 0ddh,07eh,1,0,0d8b6h,msbt-1,msbt-1,0c612h,0df07h,09cd0h,043h,0a6h,0a0e5h + tstr 020h,0,0,0,0,1,1,0,0,0,0,0,0 ; (8 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,0,0 ; (16 cycles) + db 0a5h,0e9h,0ach,064h ; expected crc + tmsg 'ld a,(+1)..............' + +; ld ,nn (32 cycles) +ld8ixy: db 0d7h ; flag mask + tstr 0ddh,026h,0,0,03c53h,04640h,0e179h,07711h,0c107h,01afah,081h,0adh,05d9bh + tstr 020h,8,0,0,0,0,0,0,0,0,0,0,0 ; (4 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,-1,0 ; (8 cycles) + db 024h,0e8h,082h,08bh ; expected crc + tmsg 'ld ,nn.......' + +; ld , (3456 cycles) +ld8rr: db 0d7h ; flag mask + tstr 040h,0,0,0,072a4h,0a024h,061ach,msbt,082c7h,0718fh,097h,08fh,0ef8eh + tstr 03fh,0,0,0,0,0,0,0,0,0,0,0,0 ; (64 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,-1,0 ; (54 cycles) + db 074h,04bh,001h,018h ; expected crc + tmsg 'ld ,........' + +; ld , (6912 cycles) +ld8rrx: db 0d7h ; flag mask + tstr 0ddh,040h,0,0,0bcc5h,msbt,msbt,msbt,02fc2h,098c0h,083h,01fh,03bcdh + tstr 020h,03fh,0,0,0,0,0,0,0,0,0,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,-1,0 ; (54 cycles) + db 047h,08bh,0a3h,06bh ; expected crc + tmsg 'ld ,........' + +; ld a,(nnnn) / ld (nnnn),a (44 cycles) +lda: db 0d7h ; flag mask + tstr 032h,msbtlo,msbthi,0,0fd68h,0f4ech,044a0h,0b543h,00653h,0cdbah,0d2h,04fh,01fd8h + tstr 008h,0,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycle) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,-1,0 ; (22 cycles) + db 0c9h,026h,02dh,0e5h ; expected crc + tmsg 'ld a,(nnnn) / ld (nnnn),a.....' + +; ldd (1) (44 cycles) +ldd1: db 0d7h ; flag mask + tstr 0edh,0a8h,0,0,09852h,068fah,066a1h,msbt+3,msbt+1,1,0c1h,068h,020b7h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 094h,0f4h,027h,069h ; expected crc + tmsg 'ldd (1)....................' + +; ldd (2) (44 cycles) +ldd2: db 0d7h ; flag mask + tstr 0edh,0a8h,0,0,0f12eh,0eb2ah,0d5bah,msbt+3,msbt+1,2,047h,0ffh,0fbe4h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 05ah,090h,07eh,0d4h ; expected crc + tmsg 'ldd (2)....................' + +; ldi (1) (44 cycles) +ldi1: db 0d7h ; flag mask + tstr 0edh,0a0h,0,0,0fe30h,003cdh,06058h,msbt+2,msbt,1,004h,060h,02688h + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 09ah,0bdh,0f6h,0b5h ; expected crc + tmsg 'ldi (1)....................' + +; ldi (2) (44 cycles) +ldi2: db 0d7h ; flag mask + tstr 0edh,0a0h,0,0,04aceh,0c26eh,0b188h,msbt+2,msbt,2,014h,02dh,0a39fh + tstr 0,010h,0,0,0,0,0,0,0,0,0,0,0 ; (2 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0d7h,0,0 ; (22 cycles) + db 0ebh,059h,089h,01bh ; expected crc + tmsg 'ldi (2)....................' + +; neg (16,384 cycles) +negop: db 0d7h ; flag mask + tstr 0edh,044h,0,0,038a2h,05f6bh,0d934h,057e4h,0d2d6h,04642h,043h,05ah,009cch + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,-1,0 ; (16,384 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,0,0 ; (1 cycle) + db 06ah,03ch,03bh,0bdh ; expected crc + tmsg 'neg...........................' + +; (7168 cycles) +rldop: db 0d7h ; flag mask + tstr 0edh,067h,0,0,091cbh,0c48bh,0fa62h,msbt,0e720h,0b479h,040h,006h,08ae2h + tstr 0,8,0,0,0ffh,0,0,0,0,0,0,0,0 ; (512 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,-1,0 ; (14 cycles) + db 095h,05bh,0a3h,026h ; expected crc + tmsg '.....................' + +; (6144 cycles) +rot8080: db 0d7h ; flag mask + tstr 7,0,0,0,0cb92h,06d43h,00a90h,0c284h,00c53h,0f50eh,091h,0ebh,040fch + tstr 018h,0,0,0,0,0,0,0,0,0,0,-1,0 ; (1024 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0d7h,0,0 ; (6 cycles) + db 025h,013h,030h,0aeh ; expected crc + tmsg '...........' + +; shift/rotate (+1) (416 cycles) +rotxy: db 0d7h ; flag mask + tstr 0ddh,0cbh,1,6,0ddafh,msbt-1,msbt-1,0ff3ch,0dbf6h,094f4h,082h,080h,061d9h + tstr 020h,0,0,038h,0,0,0,0,0,0,080h,0,0 ; (32 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,057h,0,0 ; (13 cycles) + db 071h,03ah,0cdh,081h ; expected crc + tmsg 'shf/rot (+1)...........' + +; shift/rotate (6784 cycles) +rotz80: db 0d7h ; flag mask + tstr 0cbh,0,0,0,0ccebh,05d4ah,0e007h,msbt,01395h,030eeh,043h,078h,03dadh + tstr 0,03fh,0,0,0,0,0,0,0,0,080h,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,057h,-1,0 ; (53 cycles) + db 0ebh,060h,04dh,058h ; expected crc + tmsg 'shf/rot ..' + +; n, (7936 cycles) +srz80: db 0d7h ; flag mask + tstr 0cbh,080h,0,0,02cd5h,097abh,039ffh,msbt,0d14bh,06ab2h,053h,027h,0b538h + tstr 0,07fh,0,0,0,0,0,0,0,0,0,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,-1,-1,0d7h,-1,0 ; (62 cycles) + db 08bh,057h,0f0h,008h ; expected crc + tmsg ' n,.....' + +; n,(+1) (1792 cycles) +srzx: db 0d7h ; flag mask + tstr 0ddh,0cbh,1,086h,0fb44h,msbt-1,msbt-1,0ba09h,068beh,032d8h,010h,05eh,0a867h + tstr 020h,0,0,078h,0,0,0,0,0,0,0,0,0 ; (128 cycles) + tstr 0,0,0,0,0ffh,0,0,0,0,0,0d7h,0,0 ;(14 cycles) + db 0cch,063h,0f9h,08ah ; expected crc + tmsg ' n,(+1).......' + +; ld (+1), (1024 cycles) +st8ix1: db 0d7h ; flag mask + tstr 0ddh,070h,1,0,0270dh,msbt-1,msbt-1,0b73ah,0887bh,099eeh,086h,070h,0ca07h + tstr 020h,003h,0,0,0,1,1,0,0,0,0,0,0 ; (32 cycles) + tstr 0,0,0,0,0,0,0,0,-1,-1,0,0,0 ; (32 cycles) + db 004h,062h,06ah,0bfh ; expected crc + tmsg 'ld (+1),......' + +; ld (+1), (256 cycles) +st8ix2: db 0d7h ; flag mask + tstr 0ddh,074h,1,0,0b664h,msbt-1,msbt-1,0e8ach,0b5f5h,0aafeh,012h,010h,09566h + tstr 020h,001h,0,0,0,1,1,0,0,0,0,0,0 ; (16 cycles) + tstr 0,0,0,0,0,0,0,-1,0,0,0,0,0 ; (32 cycles) + db 06ah,01ah,088h,031h ; expected crc + tmsg 'ld (+1),..........' + +; ld (+1),a (64 cycles) +st8ix3: db 0d7h ; flag mask + tstr 0ddh,077h,1,0,067afh,msbt-1,msbt-1,04f13h,00644h,0bcd7h,050h,0ach,05fafh + tstr 020h,0,0,0,0,1,1,0,0,0,0,0,0 ; (8 cycles) + tstr 0,0,0,0,0,0,0,0,0,0,0,-1,0 ; (8 cycles) + db 0cch,0beh,05ah,096h ; expected crc + tmsg 'ld (+1),a..............' + +; ld (),a (96 cycles) +stabd: db 0d7h ; flag mask + tstr 2,0,0,0,00c3bh,0b592h,06cffh,0959eh,msbt,msbt+1,0c1h,021h,0bde7h + tstr 018h,0,0,0,0,0,0,0,0,0,0,0,0 ; (4 cycles) + tstr 0,0,0,0,-1,0,0,0,0,0,0,-1,0 ; (24 cycles) + db 07ah,04ch,011h,04fh ; expected crc + tmsg 'ld (),a................' + +; start test pointed to by (hl) +stt: push hl + ld a,(hl) ; get pointer to test + inc hl + ld h,(hl) + ld l,a + ld a,(hl) ; flag mask + ld (flgmsk+1),a + inc hl + push hl + ld de,20 + add hl,de ; point to incmask + ld de,counter + call initmask + pop hl + push hl + ld de,20+20 + add hl,de ; point to scanmask + ld de,shifter + call initmask + ld hl,shifter + ld (hl),1 ; first bit + pop hl + push hl + ld de,iut ; copy initial instruction under test + ld bc,4 + ldir + ld de,msbt ; copy initial machine state + ld bc,16 + ldir + ld de,20+20+4 ; skip incmask, scanmask and expcrc + add hl,de + ex de,hl + ld c,9 + call bdos ; show test name + call initcrc ; initialise crc +; test loop +tlp: ld a,(iut) + cp 076h ; pragmatically avoid halt intructions + jp z,tlp2 + and a,0dfh + cp 0ddh + jp nz,tlp1 + ld a,(iut+1) + cp 076h +tlp1: call nz,test ; execute the test instruction +tlp2: call count ; increment the counter + call nz,shift ; shift the scan bit + pop hl ; pointer to test case + jp z,tlp3 ; done if shift returned NZ + ld de,20+20+20 + add hl,de ; point to expected crc + call cmpcrc + ld de,okmsg + jp z,tlpok + ld de,ermsg1 + ld c,9 + call bdos + call phex8 + ld de,ermsg2 + ld c,9 + call bdos + ld hl,crcval + call phex8 + ld de,crlf +tlpok: ld c,9 + call bdos + pop hl + inc hl + inc hl + ret + +tlp3: push hl + ld a,1 ; initialise count and shift scanners + ld (cntbit),a + ld (shfbit),a + ld hl,counter + ld (cntbyt),hl + ld hl,shifter + ld (shfbyt),hl + + ld b,4 ; bytes in iut field + pop hl ; pointer to test case + push hl + ld de,iut + call setup ; setup iut + ld b,16 ; bytes in machine state + ld de,msbt + call setup ; setup machine state + jp tlp + +; setup a field of the test case +; b = number of bytes +; hl = pointer to base case +; de = destination +setup: call subyte + inc hl + dec b + jp nz,setup + ret + +subyte: push bc + push de + push hl + ld c,(hl) ; get base byte + ld de,20 + add hl,de ; point to incmask + ld a,(hl) + cp 0 + jp z,subshf + ld b,8 ; 8 bits +subclp: rrca + push af + ld a,0 + call c,nxtcbit ; get next counter bit if mask bit was set + xor c ; flip bit if counter bit was set + rrca + ld c,a + pop af + dec b + jp nz,subclp + ld b,8 +subshf: ld de,20 + add hl,de ; point to shift mask + ld a,(hl) + cp 0 + jp z,substr + ld b,8 ; 8 bits +sbshf1: rrca + push af + ld a,0 + call c,nxtsbit ; get next shifter bit if mask bit was set + xor c ; flip bit if shifter bit was set + rrca + ld c,a + pop af + dec b + jp nz,sbshf1 +substr: pop hl + pop de + ld a,c + ld (de),a ; mangled byte to destination + inc de + pop bc + ret + +; get next counter bit in low bit of a +cntbit: ds 1 +cntbyt: ds 2 + +nxtcbit: push bc + push hl + ld hl,(cntbyt) + ld b,(hl) + ld hl,cntbit + ld a,(hl) + ld c,a + rlca + ld (hl),a + cp a,1 + jp nz,ncb1 + ld hl,(cntbyt) + inc hl + ld (cntbyt),hl +ncb1: ld a,b + and c + pop hl + pop bc + ret z + ld a,1 + ret + +; get next shifter bit in low bit of a +shfbit: ds 1 +shfbyt: ds 2 + +nxtsbit: push bc + push hl + ld hl,(shfbyt) + ld b,(hl) + ld hl,shfbit + ld a,(hl) + ld c,a + rlca + ld (hl),a + cp a,1 + jp nz,nsb1 + ld hl,(shfbyt) + inc hl + ld (shfbyt),hl +nsb1: ld a,b + and c + pop hl + pop bc + ret z + ld a,1 + ret + + +; clear memory at hl, bc bytes +clrmem: push af + push bc + push de + push hl + ld (hl),0 + ld d,h + ld e,l + inc de + dec bc + ldir + pop hl + pop de + pop bc + pop af + ret + +; initialise counter or shifter +; de = pointer to work area for counter or shifter +; hl = pointer to mask +initmask: + push de + ex de,hl + ld bc,20+20 + call clrmem ; clear work area + ex de,hl + ld b,20 ; byte counter + ld c,1 ; first bit + ld d,0 ; bit counter +imlp: ld e,(hl) +imlp1: ld a,e + and a,c + jp z,imlp2 + inc d +imlp2: ld a,c + rlca + ld c,a + cp a,1 + jp nz,imlp1 + inc hl + dec b + jp nz,imlp +; got number of 1-bits in mask in reg d + ld a,d + and 0f8h + rrca + rrca + rrca ; divide by 8 (get byte offset) + ld l,a + ld h,0 + ld a,d + and a,7 ; bit offset + inc a + ld b,a + ld a,080h +imlp3: rlca + dec b + jp nz,imlp3 + pop de + add hl,de + ld de,20 + add hl,de + ld (hl),a + ret + +; multi-byte counter +count: push bc + push de + push hl + ld hl,counter ; 20 byte counter starts here + ld de,20 ; somewhere in here is the stop bit + ex de,hl + add hl,de + ex de,hl +cntlp: inc (hl) + ld a,(hl) + cp 0 + jp z,cntlp1 ; overflow to next byte + ld b,a + ld a,(de) + and a,b ; test for terminal value + jp z,cntend + ld (hl),0 ; reset to zero +cntend: pop bc + pop de + pop hl + ret + +cntlp1: inc hl + inc de + jp cntlp + + +; multi-byte shifter +shift: push bc + push de + push hl + ld hl,shifter ; 20 byte shift register starts here + ld de,20 ; somewhere in here is the stop bit + ex de,hl + add hl,de + ex de,hl +shflp: ld a,(hl) + or a + jp z,shflp1 + ld b,a + ld a,(de) + and b + jp nz,shlpe + ld a,b + rlca + cp a,1 + jp nz,shflp2 + ld (hl),0 + inc hl + inc de +shflp2: ld (hl),a + xor a ; set Z +shlpe: pop hl + pop de + pop bc + ret +shflp1: inc hl + inc de + jp shflp + +counter: ds 2*20 +shifter: ds 2*20 + +; test harness +test: push af + push bc + push de + push hl + if 0 + ld de,crlf + ld c,9 + call bdos + ld hl,iut + ld b,4 + call hexstr + ld e,' ' + ld c,2 + call bdos + ld b,16 + ld hl,msbt + call hexstr + endif + di ; disable interrupts + ld (spsav),sp ; save stack pointer + ld sp,msbt+2 ; point to test-case machine state + pop iy ; and load all regs + pop ix + pop hl + pop de + pop bc + pop af + ld sp,(spbt) +iut: ds 4 ; max 4 byte instruction under test + ld (spat),sp ; save stack pointer + ld sp,spat + push af ; save other registers + push bc + push de + push hl + push ix + push iy + ld sp,(spsav) ; restore stack pointer + ei ; enable interrupts + ld hl,(msbt) ; copy memory operand + ld (msat),hl + ld hl,flgsat ; flags after test + ld a,(hl) +flgmsk: and a,0d7h ; mask-out irrelevant bits (self-modified code!) + ld (hl),a + ld b,16 ; total of 16 bytes of state + ld de,msat + ld hl,crcval +tcrc: ld a,(de) + inc de + call updcrc ; accumulate crc of this test case + dec b + jp nz,tcrc + if 0 + ld e,' ' + ld c,2 + call bdos + ld hl,crcval + call phex8 + ld de,crlf + ld c,9 + call bdos + ld hl,msat + ld b,16 + call hexstr + ld de,crlf + ld c,9 + call bdos + endif + pop hl + pop de + pop bc + pop af + ret + +; machine state after test +msat: ds 14 ; memop,iy,ix,hl,de,bc,af +spat: ds 2 ; stack pointer after test +; ZMAC/MAXAM doesn't like ':' after label with EQUs +flgsat equ spat-2 ; flags + +spsav: ds 2 ; saved stack pointer + +; display hex string (pointer in hl, byte count in b) +hexstr: ld a,(hl) + call phex2 + inc hl + dec b + jp nz,hexstr + ret + +; display hex +; display the big-endian 32-bit value pointed to by hl +phex8: push af + push bc + push hl + ld b,4 +ph8lp: ld a,(hl) + call phex2 + inc hl + dec b + jp nz,ph8lp + pop hl + pop bc + pop af + ret + +; display byte in a +phex2: push af + rrca + rrca + rrca + rrca + call phex1 + pop af +; fall through + +; display low nibble in a +phex1: push af + push bc + push de + push hl + and a,0fh + cp a,10 + jp c,ph11 + add a,'a'-'9'-1 +ph11: add a,'0' + ld e,a + ld c,2 + call bdos + pop hl + pop de + pop bc + pop af + ret + +bdos push af + push bc + push de + push hl + call 5 + pop hl + pop de + pop bc + pop af + ret + +msg1: db 'Z80doc instruction exerciser',10,13,'$' +msg2: db 'Tests complete' +crlf: db 10,13,'$' +okmsg: db ' OK',10,13,'$' +ermsg1: db ' ERROR **** crc expected:$' +ermsg2: db ' found:$' + +; compare crc +; hl points to value to compare to crcval +cmpcrc: push bc + push de + push hl + ld de,crcval + ld b,4 +cclp: ld a,(de) + cp a,(hl) + jp nz,cce + inc hl + inc de + dec b + jp nz,cclp +cce: pop hl + pop de + pop bc + ret + +; 32-bit crc routine +; entry: a contains next byte, hl points to crc +; exit: crc updated +updcrc: push af + push bc + push de + push hl + push hl + ld de,3 + add hl,de ; point to low byte of old crc + xor a,(hl) ; xor with new byte + ld l,a + ld h,0 + add hl,hl ; use result as index into table of 4 byte entries + add hl,hl + ex de,hl + ld hl,crctab + add hl,de ; point to selected entry in crctab + ex de,hl + pop hl + ld bc,4 ; c = byte count, b = accumulator +crclp: ld a,(de) + xor a,b + ld b,(hl) + ld (hl),a + inc de + inc hl + dec c + jp nz,crclp + if 0 + ld hl,crcval + call phex8 + ld de,crlf + ld c,9 + call bdos + endif + pop hl + pop de + pop bc + pop af + ret + +initcrc:push af + push bc + push hl + ld hl,crcval + ld a,0ffh + ld b,4 +icrclp: ld (hl),a + inc hl + dec b + jp nz,icrclp + pop hl + pop bc + pop af + ret + +crcval ds 4 + +crctab: db 000h,000h,000h,000h + db 077h,007h,030h,096h + db 0eeh,00eh,061h,02ch + db 099h,009h,051h,0bah + db 007h,06dh,0c4h,019h + db 070h,06ah,0f4h,08fh + db 0e9h,063h,0a5h,035h + db 09eh,064h,095h,0a3h + db 00eh,0dbh,088h,032h + db 079h,0dch,0b8h,0a4h + db 0e0h,0d5h,0e9h,01eh + db 097h,0d2h,0d9h,088h + db 009h,0b6h,04ch,02bh + db 07eh,0b1h,07ch,0bdh + db 0e7h,0b8h,02dh,007h + db 090h,0bfh,01dh,091h + db 01dh,0b7h,010h,064h + db 06ah,0b0h,020h,0f2h + db 0f3h,0b9h,071h,048h + db 084h,0beh,041h,0deh + db 01ah,0dah,0d4h,07dh + db 06dh,0ddh,0e4h,0ebh + db 0f4h,0d4h,0b5h,051h + db 083h,0d3h,085h,0c7h + db 013h,06ch,098h,056h + db 064h,06bh,0a8h,0c0h + db 0fdh,062h,0f9h,07ah + db 08ah,065h,0c9h,0ech + db 014h,001h,05ch,04fh + db 063h,006h,06ch,0d9h + db 0fah,00fh,03dh,063h + db 08dh,008h,00dh,0f5h + db 03bh,06eh,020h,0c8h + db 04ch,069h,010h,05eh + db 0d5h,060h,041h,0e4h + db 0a2h,067h,071h,072h + db 03ch,003h,0e4h,0d1h + db 04bh,004h,0d4h,047h + db 0d2h,00dh,085h,0fdh + db 0a5h,00ah,0b5h,06bh + db 035h,0b5h,0a8h,0fah + db 042h,0b2h,098h,06ch + db 0dbh,0bbh,0c9h,0d6h + db 0ach,0bch,0f9h,040h + db 032h,0d8h,06ch,0e3h + db 045h,0dfh,05ch,075h + db 0dch,0d6h,00dh,0cfh + db 0abh,0d1h,03dh,059h + db 026h,0d9h,030h,0ach + db 051h,0deh,000h,03ah + db 0c8h,0d7h,051h,080h + db 0bfh,0d0h,061h,016h + db 021h,0b4h,0f4h,0b5h + db 056h,0b3h,0c4h,023h + db 0cfh,0bah,095h,099h + db 0b8h,0bdh,0a5h,00fh + db 028h,002h,0b8h,09eh + db 05fh,005h,088h,008h + db 0c6h,00ch,0d9h,0b2h + db 0b1h,00bh,0e9h,024h + db 02fh,06fh,07ch,087h + db 058h,068h,04ch,011h + db 0c1h,061h,01dh,0abh + db 0b6h,066h,02dh,03dh + db 076h,0dch,041h,090h + db 001h,0dbh,071h,006h + db 098h,0d2h,020h,0bch + db 0efh,0d5h,010h,02ah + db 071h,0b1h,085h,089h + db 006h,0b6h,0b5h,01fh + db 09fh,0bfh,0e4h,0a5h + db 0e8h,0b8h,0d4h,033h + db 078h,007h,0c9h,0a2h + db 00fh,000h,0f9h,034h + db 096h,009h,0a8h,08eh + db 0e1h,00eh,098h,018h + db 07fh,06ah,00dh,0bbh + db 008h,06dh,03dh,02dh + db 091h,064h,06ch,097h + db 0e6h,063h,05ch,001h + db 06bh,06bh,051h,0f4h + db 01ch,06ch,061h,062h + db 085h,065h,030h,0d8h + db 0f2h,062h,000h,04eh + db 06ch,006h,095h,0edh + db 01bh,001h,0a5h,07bh + db 082h,008h,0f4h,0c1h + db 0f5h,00fh,0c4h,057h + db 065h,0b0h,0d9h,0c6h + db 012h,0b7h,0e9h,050h + db 08bh,0beh,0b8h,0eah + db 0fch,0b9h,088h,07ch + db 062h,0ddh,01dh,0dfh + db 015h,0dah,02dh,049h + db 08ch,0d3h,07ch,0f3h + db 0fbh,0d4h,04ch,065h + db 04dh,0b2h,061h,058h + db 03ah,0b5h,051h,0ceh + db 0a3h,0bch,000h,074h + db 0d4h,0bbh,030h,0e2h + db 04ah,0dfh,0a5h,041h + db 03dh,0d8h,095h,0d7h + db 0a4h,0d1h,0c4h,06dh + db 0d3h,0d6h,0f4h,0fbh + db 043h,069h,0e9h,06ah + db 034h,06eh,0d9h,0fch + db 0adh,067h,088h,046h + db 0dah,060h,0b8h,0d0h + db 044h,004h,02dh,073h + db 033h,003h,01dh,0e5h + db 0aah,00ah,04ch,05fh + db 0ddh,00dh,07ch,0c9h + db 050h,005h,071h,03ch + db 027h,002h,041h,0aah + db 0beh,00bh,010h,010h + db 0c9h,00ch,020h,086h + db 057h,068h,0b5h,025h + db 020h,06fh,085h,0b3h + db 0b9h,066h,0d4h,009h + db 0ceh,061h,0e4h,09fh + db 05eh,0deh,0f9h,00eh + db 029h,0d9h,0c9h,098h + db 0b0h,0d0h,098h,022h + db 0c7h,0d7h,0a8h,0b4h + db 059h,0b3h,03dh,017h + db 02eh,0b4h,00dh,081h + db 0b7h,0bdh,05ch,03bh + db 0c0h,0bah,06ch,0adh + db 0edh,0b8h,083h,020h + db 09ah,0bfh,0b3h,0b6h + db 003h,0b6h,0e2h,00ch + db 074h,0b1h,0d2h,09ah + db 0eah,0d5h,047h,039h + db 09dh,0d2h,077h,0afh + db 004h,0dbh,026h,015h + db 073h,0dch,016h,083h + db 0e3h,063h,00bh,012h + db 094h,064h,03bh,084h + db 00dh,06dh,06ah,03eh + db 07ah,06ah,05ah,0a8h + db 0e4h,00eh,0cfh,00bh + db 093h,009h,0ffh,09dh + db 00ah,000h,0aeh,027h + db 07dh,007h,09eh,0b1h + db 0f0h,00fh,093h,044h + db 087h,008h,0a3h,0d2h + db 01eh,001h,0f2h,068h + db 069h,006h,0c2h,0feh + db 0f7h,062h,057h,05dh + db 080h,065h,067h,0cbh + db 019h,06ch,036h,071h + db 06eh,06bh,006h,0e7h + db 0feh,0d4h,01bh,076h + db 089h,0d3h,02bh,0e0h + db 010h,0dah,07ah,05ah + db 067h,0ddh,04ah,0cch + db 0f9h,0b9h,0dfh,06fh + db 08eh,0beh,0efh,0f9h + db 017h,0b7h,0beh,043h + db 060h,0b0h,08eh,0d5h + db 0d6h,0d6h,0a3h,0e8h + db 0a1h,0d1h,093h,07eh + db 038h,0d8h,0c2h,0c4h + db 04fh,0dfh,0f2h,052h + db 0d1h,0bbh,067h,0f1h + db 0a6h,0bch,057h,067h + db 03fh,0b5h,006h,0ddh + db 048h,0b2h,036h,04bh + db 0d8h,00dh,02bh,0dah + db 0afh,00ah,01bh,04ch + db 036h,003h,04ah,0f6h + db 041h,004h,07ah,060h + db 0dfh,060h,0efh,0c3h + db 0a8h,067h,0dfh,055h + db 031h,06eh,08eh,0efh + db 046h,069h,0beh,079h + db 0cbh,061h,0b3h,08ch + db 0bch,066h,083h,01ah + db 025h,06fh,0d2h,0a0h + db 052h,068h,0e2h,036h + db 0cch,00ch,077h,095h + db 0bbh,00bh,047h,003h + db 022h,002h,016h,0b9h + db 055h,005h,026h,02fh + db 0c5h,0bah,03bh,0beh + db 0b2h,0bdh,00bh,028h + db 02bh,0b4h,05ah,092h + db 05ch,0b3h,06ah,004h + db 0c2h,0d7h,0ffh,0a7h + db 0b5h,0d0h,0cfh,031h + db 02ch,0d9h,09eh,08bh + db 05bh,0deh,0aeh,01dh + db 09bh,064h,0c2h,0b0h + db 0ech,063h,0f2h,026h + db 075h,06ah,0a3h,09ch + db 002h,06dh,093h,00ah + db 09ch,009h,006h,0a9h + db 0ebh,00eh,036h,03fh + db 072h,007h,067h,085h + db 005h,000h,057h,013h + db 095h,0bfh,04ah,082h + db 0e2h,0b8h,07ah,014h + db 07bh,0b1h,02bh,0aeh + db 00ch,0b6h,01bh,038h + db 092h,0d2h,08eh,09bh + db 0e5h,0d5h,0beh,00dh + db 07ch,0dch,0efh,0b7h + db 00bh,0dbh,0dfh,021h + db 086h,0d3h,0d2h,0d4h + db 0f1h,0d4h,0e2h,042h + db 068h,0ddh,0b3h,0f8h + db 01fh,0dah,083h,06eh + db 081h,0beh,016h,0cdh + db 0f6h,0b9h,026h,05bh + db 06fh,0b0h,077h,0e1h + db 018h,0b7h,047h,077h + db 088h,008h,05ah,0e6h + db 0ffh,00fh,06ah,070h + db 066h,006h,03bh,0cah + db 011h,001h,00bh,05ch + db 08fh,065h,09eh,0ffh + db 0f8h,062h,0aeh,069h + db 061h,06bh,0ffh,0d3h + db 016h,06ch,0cfh,045h + db 0a0h,00ah,0e2h,078h + db 0d7h,00dh,0d2h,0eeh + db 04eh,004h,083h,054h + db 039h,003h,0b3h,0c2h + db 0a7h,067h,026h,061h + db 0d0h,060h,016h,0f7h + db 049h,069h,047h,04dh + db 03eh,06eh,077h,0dbh + db 0aeh,0d1h,06ah,04ah + db 0d9h,0d6h,05ah,0dch + db 040h,0dfh,00bh,066h + db 037h,0d8h,03bh,0f0h + db 0a9h,0bch,0aeh,053h + db 0deh,0bbh,09eh,0c5h + db 047h,0b2h,0cfh,07fh + db 030h,0b5h,0ffh,0e9h + db 0bdh,0bdh,0f2h,01ch + db 0cah,0bah,0c2h,08ah + db 053h,0b3h,093h,030h + db 024h,0b4h,0a3h,0a6h + db 0bah,0d0h,036h,005h + db 0cdh,0d7h,006h,093h + db 054h,0deh,057h,029h + db 023h,0d9h,067h,0bfh + db 0b3h,066h,07ah,02eh + db 0c4h,061h,04ah,0b8h + db 05dh,068h,01bh,002h + db 02ah,06fh,02bh,094h + db 0b4h,00bh,0beh,037h + db 0c3h,00ch,08eh,0a1h + db 05ah,005h,0dfh,01bh + db 02dh,002h,0efh,08dh +