z80

How to write two bytes to a chunk of RAM repeatedly in Z80 asm

帅比萌擦擦* 提交于 2021-02-08 13:12:32
问题 I'm trying to write two bytes (color values) to the VRAM of my TI-84 Plus CE-T calculator, which uses the Zilog eZ80 CPU. The VRAM starts at 0xD40000 and is 0x25800 bytes long. The calculator has a built in syscall called MemSet , which fills a chunk of memory with one byte, but I want it to alternate between two different values and store these in memory. I tried using the following code: #include "includes\ti84pce.inc" .assume ADL=1 .org userMem-2 .db tExtTok,tAsm84CeCmp call _homeup call

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

徘徊边缘 提交于 2020-01-01 04:45:11
问题 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

Z80 DAA instruction

别说谁变了你拦得住时间么 提交于 2019-12-20 17:33:08
问题 Apologies for this seemingly minor question, but I can't seem to find the answer anywhere - I'm just coming up to implementing the DAA instruction in my Z80 emulator, and I noticed in the Zilog manual that it is for the purposes of adjusting the accumulator for binary coded decimal arithmetic. It says the instruction is intended to be run right after an addition or subtraction instruction. My questions are: what happens if it is run after another instruction? how does it know what instruction

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

天涯浪子 提交于 2019-12-18 07:35:28
问题 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

Question about cycle counting accuracy when emulating a CPU

那年仲夏 提交于 2019-12-18 03:41:28
问题 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,

Question about cycle counting accuracy when emulating a CPU

大城市里の小女人 提交于 2019-12-18 03:41:08
问题 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,

How to type-pun in C

安稳与你 提交于 2019-12-13 08:38:24
问题 Follow-up to extended discussion in Casting behavior in C I'm trying to emulate a Z80 in C, where several 8-bit registers can be combined to create 16-bit registers. This is the logic I'm trying to use: struct { uint8_t b; uint8_t c; uint16_t *bc; } regs[1]; ... regs->bc = (uint16_t *)&(regs->b); Why is this incorrect, and how can I do it correctly (using type-punning if needed)? I need to do this multiple times, preferably within the same structure. For those of you that I haven't mentioned

Issue With Using dec to Create a Delay

孤人 提交于 2019-12-12 04:27:05
问题 I've started experimenting with Gameboy programming using Z80 assembly, but I've found something kind of weird. I found a snippet of code used to create a delay: simpleDelay: dec bc ld a,b or c jr nz, simpleDelay ret While playing around with that, I discovered that writing dec bc twice shortens the delay, but writing it 3 times makes the delay longer than using it once or twice. Why does having an even number of dec statements shorten the delay? EDIT: Here's the snippet of code calling the

PutS only displaying one character on TI-84 Plus Silver edition

六月ゝ 毕业季﹏ 提交于 2019-12-11 20:57:27
问题 I have recently discovered that my TI-84 plus silver edition can be programmed in hex. I have been messing around with it but have had a few bugs. Whenever I try to make a bcall to PutS it only prints one character and moves on. If I add a second PutS command it puts the second letter down and to the right by one. My current code is: AsmPrgm 219D9D EFD9481C C9 48692100 回答1: Necro reply: It seems like you are using one of the new Math Print OSes. Because of the "pretty print" math, TI had to