z80 | A csharp emulator for the Zilog Z80 CPU

 by   sklivvz C# Version: Current License: BSD-3-Clause

kandi X-RAY | z80 Summary

kandi X-RAY | z80 Summary

z80 is a C# library typically used in Hardware applications. z80 has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

A csharp emulator for the Zilog Z80 CPU.

            kandi-support Support

              z80 has a low active ecosystem.
              It has 65 star(s) with 18 fork(s). There are 12 watchers for this library.
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. On average issues are closed in 156 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of z80 is current.

            kandi-Quality Quality

              z80 has 0 bugs and 0 code smells.

            kandi-Security Security

              z80 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              z80 code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              z80 is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              z80 releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of z80
            Get all kandi verified functions for this library.

            z80 Key Features

            No Key Features are available at this moment for z80.

            z80 Examples and Code Snippets

            No Code Snippets are available at this moment for z80.

            Community Discussions


            Z80 division algorithm not functioning properly
            Asked 2021-Dec-24 at 03:42

            I am attempting to run the following code:



            Answered 2021-Dec-24 at 03:16

            The problem with your code is that $+4 and $-7 are both referring to byte counts, not instruction counts, and the JR instruction is 2 bytes. The indentation gives you a clue. You need to move your labels:

            Source https://stackoverflow.com/questions/70469035


            How do you relocate the Zero Page on a 65816
            Asked 2021-Oct-19 at 06:35

            Background information

            As a modern days PHP developer with a passing interest in 8-bit technologies, I'm a little sketchy on real low level stuff. Although I've worked with the Z80 processor, and done some MIPs assembly at University, I'm least well versed in the 65x processor family.

            What I'm trying to achieve

            What I want to do is to relocate the zero page to 0xd300 for my application - I've had a obligatory Internet search but am not able to find a good example that I am able to understand. I'm working in 65c02 but on a 65816 processor; I have found out, thanks to a friend, that you can only relocate the zero page in native mode, not emulation mode as it's not supported by the 65c02. This isn't an issue as I can switch to native mode for what I'm doing and revert to emulation mode should I want to return gracefully to BASIC (well, not only that I know).

            If someone could also provide an example for the 8502 (Commodore C128) as well please as I know that has a relocatable zero page. I know that's two questions in one, but it's related to what I want to do.



            Answered 2021-Oct-19 at 06:35

            The Direct Page register D is a 16-bit register specifying which 256-byte page within bank 0 that should be the current Direct Page (what you call Zero Page).

            There are a couple of different instructions you can use to write to D. So e.g. something like this should work:

            Source https://stackoverflow.com/questions/69514435


            Sjasm: can't assemble DW or OUTPUT directive?
            Asked 2021-Sep-15 at 08:17

            This is my code:



            Answered 2021-Sep-15 at 08:17

            It helps if you read the manual.

            The main error: Only labels start in the first column, insert at least a space or tab before any instruction or pseudo instruction.

            ejemplo1.asm(1) : Unrecognized instruction: "ejemplo1.

            output is interpreted as label, and consequently the filename is tried as an instruction. The interesting detail is that the point "." is taken as a separator. BTW, the filename is not in quotation marks, according to the examples.

            ejemplo1.asm(3) : Label not found: fe

            db is interpreted as label, and perhaps #fe is interpreted as a structure field entry. # defines the length on a field, and therefore fe is not recognized as a number, but as a label. This interpretation looks like a bug in the assembler to me.

            ejemplo1.asm(4) : Unrecognized instruction: start

            dw is interpreted as label, and consequently start is tried as an instruction.

            ejemplo1.asm(5) : Duplicate labelname: dw

            dw is again interpreted as label, as the error message tells us that it is already defined (in the line before).

            Note: If you correct your code and get new errors, feel free to post a new question. You might want to add this to this question, but don't remove the current contents, add it and mark it as addition.

            Source https://stackoverflow.com/questions/69187180


            Z80 function called by Joystick button prints extra strings instead of the expected one
            Asked 2021-Aug-27 at 18:14

            While exploring joystick connection to the Z80 games I've got this code, which should print 1 letter when I press Up, Left or Right. But for some reason when I press Left it prints lru, when I press Right it prints ru, and u after pressing Up.



            Answered 2021-Aug-27 at 18:14

            The subroutines change the value of the BC register so if one of them is called the subsequent IN A,(C) instructions will read the wrong port.

            Put a LD BC,31 before every IN A,(C) to fix this. Or you could save and restore BC in the subroutines with a push and pop like so:

            Source https://stackoverflow.com/questions/68957508


            Assembly's numeric variable modifies the previous one
            Asked 2021-Aug-25 at 16:42

            While learning Z80 assembly I've go a strange behavior that after declaring 2 numeric variables the value of the first one gets a totally different value.




            Answered 2021-Aug-25 at 16:42

            Yes, exactly; using defw will increase the size of the data (2 bytes each) to match the data size specification of the instruction being used in code.

            Code and data sizes have to match; each instruction that references data tells the CPU what size the data has, and, data declarations also have a size.  In many assembly languages, consistency is programmer responsibility — assemblers often do not complain about (size) mismatches.

            The CPU never sees data declarations, it only sees instructions.  So, each and every time an instruction references data, it has to specify how (i.e. the data size).  The CPU doesn't remember or care about mismatches between code in one place and code in another place, or between code & data; it just takes one instruction at a time and does what that says.

            Expanding the data to match what the code does is the easiest fix here because your print subroutine takes the argument to print in the bc 16-bit register pair.

            Otherwise, you can change the instruction to use the same size load as the defb, namely byte-sized instead of word-sized.  This would be done using an instruction like LD c,(score1), which loads only the c 8-bit register — and this is appropriate for data declared to 8-bits using defb.

            To continue and use the print function, however, since the print expects a value in 16-bit bc, the 8-bit value in c will have to be expanded to a 16-bit value in bc, by clearing b (set b to 0, or by sign extending into b).

            If I got the endian wrong, then swap references to the 8-bit registers with one letters b and c in what I said above.

            Source https://stackoverflow.com/questions/68925672


            Deleting grouped row with other value than desired value
            Asked 2021-Jan-21 at 12:33

            Is there a way to delete the variable id with other dx than "I10"?



            Answered 2021-Jan-21 at 02:49

            You can select the id's where all the values are 'I10'

            Using dplyr :

            Source https://stackoverflow.com/questions/65820286


            Waiting for some time on Z80 CP/M
            Asked 2021-Jan-18 at 20:23

            I want to write a game loop on CP/M 2.X (Z80) and would need to wait for some time e.g. a second. I've looked at BDOS but did not find a function, a loop depends on processor (emulation speed), interrupts like vertical blank do not exist.

            Any ideas on how to write a game loop?


            The z88dk CP/M lib says

            Not (of course) CPM 1.x and 2.x, which have no real-time functions; ,nor QX/M, its clock is not BCD based.

            There were action games like LADDER so there should be a way for a game loop.


            I could let the user check 5 secs with two keypresses and measure the speed (double loop) once to config the game - but only as a last resort.



            Answered 2021-Jan-18 at 20:23

            There's no portable way of waiting for a certain amount of time under CP/M 2.2. CP/M doesn't require or use a real time clock or any kind of timer, and so you can't even assume one is present in the system, let alone that it uses any kind of common interface.

            Turbo Pascal's Delay function worked by assuming a certain CPU frequency, one that was configured when Turbo Pascal was installed. The CP/M game Ladder was written in Turbo Pascal and used its Delay function, so it also assumed a certain CPU frequency. If you played on a faster or slower CPU the game would play faster or slower than intended.

            The simplest solution would be to implement your own delay function that assumed a certain CPU frequency. I believe 4 MHz was the most common Z80 speed for CP/M. You can make this a configurable option so users can change the assumed CPU speed. You're probably also going to want to give users the option of changing the terminal type, just like Ladder did, as there are many possible terminals that can be used with CP/M.

            Source https://stackoverflow.com/questions/65777890


            How do I do a "greater than" jump in Z80 Assembly, rather than "greater than or equal to"?
            Asked 2020-Nov-06 at 15:10

            I'm trying to learn Z80 assembly - and forgive me if this is extremely obvious - but I'm rather new to assembly as a whole.

            I have familiarised myself with how jumps work after making a comparison with cp and how they equate to things I know, that NZ is the equivilant of "!=", C correlates to "<" and so on. Though from as far as I've been able to see, ">" isn't as easy.

            NC is the opposite of C, NC - as I understand - correlates to ">=" in my scenario. My assumption is that I can combine NC and NZ in the same jump condition to remove the "=" so to speak, but it doesn't seem to work.

            What can I do to make my jump's condition be that a is more than the compared amount, without allowing them to equal zero?



            Answered 2020-Nov-06 at 15:10

            CP performs a subtraction and sets the flags appropriately. It doesn't store the results of the subtraction.

            So to compare for the A greater than the operand, you need to look for a result of that subtraction that was a strictly positive number, i.e. it was 1 or greater.

            There's no direct route to that, you'll have to do it as a compound — NC to eliminate all results less than 0, getting you to greater than or equal, followed by NZ to eliminate the possibility of equality. But you might want to flip those for more straightforward code. E.g.

            Source https://stackoverflow.com/questions/64705779


            Extracting LSB and MSB on Z80 Assembly
            Asked 2020-Oct-28 at 17:51

            Lets say i have a data (15H) on memory 0040.

            My question is, how an I extract that most significant and least significant bit for further usage?

            I have lookup on the Z80 User manual and found nothing. Any help will be appreciated



            Answered 2020-Oct-28 at 17:51

            I just want to wrote down what @Jester already explained to me

            how to get the LSB
            1. using AND

            Source https://stackoverflow.com/questions/64539061


            Why using char type as index for looping gives unexpected results?
            Asked 2020-Jun-27 at 18:34

            Bear in mind this is an old version of the C compiler: CP/M for Z80.



            Answered 2020-Jun-20 at 10:00

            Golly. LONG time since I used a z80 C compiler, and most were buggy as [unprintable] back then. I would suggest that you dump the assembler if the compiler allows. My GUESS is that internally the char is being promoted to a 16 bit INT with indeterminate upper bits set.

            The problem is that %04X expects an integer - not a char.

            You might try forcing the compiler to play nice by explicitly casting the char to an int - i.e.

            printf("0x%04x | ", (int) i);

            Source https://stackoverflow.com/questions/62484208

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install z80

            You can download it from GitHub.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone sklivvz/z80

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with z80

            Consider Popular C# Libraries


            by microsoft


            by shadowsocks


            by PowerShell


            by dotnet


            by 2dust

            Try Top Libraries by sklivvz


            by sklivvzC


            by sklivvzC


            by sklivvzCSS


            by sklivvzC


            by sklivvzC