z80

sdcc not accepting code

一世执手 提交于 2019-12-11 00:57:12
问题 I have an issue with SDCC. My code (which I am attempting to port from another compiler) uses structs with flexible array members. However, when I try to compile the following code: /** header of string list */ typedef struct { int nCount; int nMemUsed; int nMemAvail; } STRLIST_HEADER; /** string list entry data type */ typedef struct { int nLen; char str[]; } STRLIST_ENTRY; /** string list data type */ typedef struct { STRLIST_HEADER header; STRLIST_ENTRY entry[]; } STRLIST; // By the way,

What is the purpose of the reserved/undefined bit in the flag register?

為{幸葍}努か 提交于 2019-12-10 06:19:26
问题 In the flag register of Z80, 8080, 8085, and 8086 processors, what is the purpose of bits 1, 3, 5, which are documented as "reserved" or "undefined"? 回答1: These bits are unused; that is, no instruction explicitly sets them to any value. The designers decided that 5/6 flags was enough, and they just left the remaining bits of the flags register unused. They are documented as being "undefined" because it is not possible to know in advance which value will they have after any of the instructions

What is the purpose of the reserved/undefined bit in the flag register?

余生颓废 提交于 2019-12-05 12:26:21
In the flag register of Z80, 8080, 8085, and 8086 processors, what is the purpose of bits 1, 3, 5, which are documented as "reserved" or "undefined"? Konamiman These bits are unused; that is, no instruction explicitly sets them to any value. The designers decided that 5/6 flags was enough, and they just left the remaining bits of the flags register unused. They are documented as being "undefined" because it is not possible to know in advance which value will they have after any of the instructions are executed—the processor design is simpler that way, as opposed to setting them explicitly to 0

Writing a graphical Z80 emulator in C or C++ [closed]

白昼怎懂夜的黑 提交于 2019-12-03 18:35:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I want to take an interest in writing my own simple emulator for the Z80 processor. I have no experience with this type of programming. I am mostly fine with using C-based languages as they are the ones I know best. What do I need to accomplish this and what are some good tutorials/references that could aid me

Writing a Z80 assembler - lexing ASM and building a parse tree using composition?

核能气质少年 提交于 2019-12-03 13:06:02
I'm very new to the concept of writing an assembler and even after reading a great deal of material, I'm still having difficulties wrapping my head around a couple of concepts. What is the process to actually break up a source file into tokens? I believe this process is called lexing, and I've searched high and low for a real code examples that make sense, but I can't find a thing so simple code examples very welcome ;) When parsing, does information ever need to be passed up or down the tree? The reason I ask is as follows, take: LD BC, nn It needs to be turned into the following parse tree

GBZ80: How does LD HL,(SP+e) affect H and C flags?

放肆的年华 提交于 2019-11-30 05:34:07
问题 On Gameboy Z80, exactly how does the LD HL,(SP+e) operation affect H and C flags? (Half-carry + carry) Reference: http://www.devrs.com/gb/files/opcodes.html 回答1: I realise this is an old question but I had a similar problem a while ago and would just like to add my solution as there is absolutely no documentation or open-source emulator that does it correctly to my knowledge. Took me some actual debugging on a real gameboy to find the solution. For both 16bit SP + s8 (signed immediate)

GBZ80: What constitutes a “half-carry”?

馋奶兔 提交于 2019-11-30 00:26:31
The Game Boy Z80 CPU has a half-carry flag, and I can't seem to find much information about when to set/clear it. What I understand so far is that any 8-bit add, subtract, shift, or rotate operation (and maybe others?) set it to bit 4 of the result(?), and the DAA instruction sets/uses this somehow. What I'm not sure is how 16-bit instructions affect it and whether it's affected or not by the use of certain registers. It's the carry from bit 3 to bit 4, just like the normal carry flag records carry from bit 7. So, e.g. to get the half carry bit in an add: ((a&0xf) + (value&0xf))&0x10 Which

Writing a graphical Z80 emulator in C or C++ [closed]

老子叫甜甜 提交于 2019-11-29 23:17:40
I want to take an interest in writing my own simple emulator for the Z80 processor. I have no experience with this type of programming. I am mostly fine with using C-based languages as they are the ones I know best. What do I need to accomplish this and what are some good tutorials/references that could aid me in this project? I would also like a tutorial for coding a ROM-dumping application for my TI-84 Plus calculator so I can use its ROM with this emulator. Perhaps start by looking at these: A good tutorial can be found here: Independent Z80 Assembly Guide Z80 DOCUMENTATION The Undocumented

What's the purpose of instructions for loading a register to itself?

Deadly 提交于 2019-11-29 13:33:44
While looking through the Gameboy's instruction set, I came across instructions such as: LD A, A LD B, B LD C, C LD D, D ... Each of these instructions has it's own opcode in this table , which makes me think they are of some importance due to the restrictions on the number of possible opcodes. I first thought that it might be dereferencing a pointer in that register and storing the value at that pointer ( like in this question ), but in an emulator , LD A, A is implemented as: Z80._r.a = Z80._r.a They seem to have no effect on the state of the processor (just set registers to their own value)

Question about cycle counting accuracy when emulating a CPU

孤者浪人 提交于 2019-11-29 02:28:21
I am planning on creating a Sega Master System emulator over the next few months, as a hobby project in Java (I know it isn't the best language for this but I find it very comfortable to work in, and as a frequent user of both Windows and Linux I thought a cross-platform application would be great). My question regards cycle counting; I've looked over the source code for another Z80 emulator, and for other emulators as well, and in particular the execute loop intrigues me - when it is called, an int is passed as an argument (let's say 1000 as an example). Now I get that each opcode takes a