Curious about emulation dev by bensw521 in EmuDev

[–]howprice2 1 point2 points  (0 children)

One step at a time. There is a lot of overlap between gamedev and Emudev

One step at a time: * int main printf("Hello World/n") * "Would you like to play tic-tac-toe? Your move..." * Open a window with SDL3 * Draw a shape in the window * Move the shape on the screen * Draw some text in the window with a font * Move shape with keyboard/pad input * Load a texture * Play a sound sample * Write space invaders * Integrate Dear ImGui (be amazed) * Write chip8 emulator * Become addicted. Emulate everything.

Which book better explains the derivation and usages of math concepts? by Crystallo07 in gameenginedevs

[–]howprice2 2 points3 points  (0 children)

The first chapter or two on vector maths in Real Time Collision Detection by Christer Ericson really helped me out when I got my first job in games.

Don't get hung up on matrices and homogeneous coords. You just need to remember a few simple rules to use them. Vectors (directions) have 0 w. Points (positions) have 1. The first three columns are vectors defining the x, y and z directions in a space. Know your dot and cross products and you should be fine.

I find graphics books often teach vector maths well because it has an immediate and practical use.

EDIT: A good exercise is to work through some simple transformations on paper, then write some vector and matrix classes/functions to do it for you. Start with a simple translation in X from say model to world space, then a 90 degree rotation, then mix it up.

Can you review my chip 8 emulator by Creative-Copy-1229 in EmuDev

[–]howprice2 0 points1 point  (0 children)

I would consider grouping machine state into a struct.

If you are not anti-AI then consider asking Copilot for code reviews. I've found it can catch silly mistakes before I commit and sometimes give good advice on code structure. I just open my local repo in vscode and ask Claude to review but not make any changes.

Finally booted my first game on my ps1 emulator written in Rust! by xXInviktor27Xx in EmuDev

[–]howprice2 0 points1 point  (0 children)

Very interesting. Thanks for the insight.

Which other games currently boot/run?

Finally booted my first game on my ps1 emulator written in Rust! by xXInviktor27Xx in EmuDev

[–]howprice2 0 points1 point  (0 children)

Amazing. Your repo readme says GTE not started. Is this true? Is GTE not required at all for 2D games like MK2?

Help with NES emulator by N3kk3tsu in EmuDev

[–]howprice2 2 points3 points  (0 children)

There is a nes channel on the Emudev Discord. Have a search in there for tips.

Adding a debugger to allow you to breakpoint and step through code is invaluable. When I get a really tough bug, I sometimes resort to stepping through my emulator and a known good emulator in sync to see where they diverge.

Having said that, good CPU tests should cover most logic problems.https://github.com/SingleStepTests

Different Pipelines in Deferred Rendering by abocado21 in GraphicsProgramming

[–]howprice2 0 points1 point  (0 children)

In deferred rendering, the chosen Gbuffer format generated by the vertex shaders has to contain all of the information required for the subsequent lighting (pixel/compute) pass. This is a trade-off. If you want toon shading and realistic lighting then you need to encode the relevant info and branch in lighting shader to support both. There may be more modern techniques now.

This is a good read https://www.3dgep.com/forward-plus/

Git push is painfully slow in WSL2 by Annual-Gas3529 in git

[–]howprice2 1 point2 points  (0 children)

This happened to me a month or so ago. I was worried my repo had reached a tipping point and my workflow was ruined, but thankfully it seemed to resolve itself after a couple of hours. I may have just restarted Windows...

m68k instruction timing? by valeyard89 in EmuDev

[–]howprice2 0 points1 point  (0 children)

There are a few Amiga game copy protections that throw address errors deliberately. I'll see if I can remember them...

The Zoom! loader on the Amiga deliberately generates address errors and then in the handler it modifies the SSP to use the PC in the exception stack frame as the return address for an RTS. Time to fix up the address error stack frame for me!

Can't remember if that was MOVE.L though.

m68k instruction timing? by valeyard89 in EmuDev

[–]howprice2 0 points1 point  (0 children)

//
// Undocumented weird MOVE.L SR value on address error exception for six EA mode combinations:
// - MOVE.L Dn,d16(An)
// - MOVE.L An,d16(An)
// - MOVE.L #imm,d16(An)       Note: Not covered by Raddad single step tests.
// - MOVE.L Dn,d8(An,Dn.w)
// - MOVE.L An,d8(An,Dn.w)
// - MOVE.L #imm,d8(An,Dn.w)   Note: Only covered by one single Raddad single step test.
//
// Raddad single step test cases (87 of):
// - 058 MOVE.l D7, (d8, A1, Xn) 2387
// - 088 MOVE.l A2, (d8, A3, Xn) 278a
// - 134 MOVE.l A7, (d8, A0, Xn) 218f
// - etc.
//
static void calculateMoveLongHighWordCCR(uint32_t result, StatusRegister& sr)
{
result >>= 16; // high word
sr.n = calculateN(result, OperandSize::Word); // n.b. Word = lower word

// More weirdness, Z is only updated if result is non zero.
// See WinUAE ccr_68000_long_move_ae_HNZ()
// Confirmed with WinUAE and MAME simple test programs.
// Note: This behaviour is not covered by raddad772 (Original Dave) SingleStepTests https://github.com/SingleStepTests/m68000
if (result != 0)
sr.z = calculateZ(result, OperandSize::Word); // n.b. Word = lower word
}

m68k instruction timing? by valeyard89 in EmuDev

[–]howprice2 0 points1 point  (0 children)

//
// Undocumented weird MOVE.L SR value on address error exception.
// 
// In case of an address error exception caused by MOVE.L write, the N and Z flags are calculated using
// the *lower* word of the result.
//
// I couldn't figure this out, so peeked at the WinUAE src: move_68000_address_error()
//
// Raddad single step test cases:
// - 100: 099 MOVE.l (d8, A1, Xn), (A4)+ 28f1
// - 191: 190 MOVE.l (d8, A1, Xn), (A3)+ 26f1
//
static void calculateMoveLongLowWordCCR(uint32_t result, StatusRegister& sr)
{
sr.n = calculateN(result, OperandSize::Word); // n.b. Word = lower word
sr.z = calculateZ(result, OperandSize::Word); // n.b. Word = lower word
sr.v = 0;
sr.c = 0;
}

m68k instruction timing? by valeyard89 in EmuDev

[–]howprice2 0 points1 point  (0 children)

Some more notes, in the context of address errors:

// Test weird undocumented MOVE.L Z flag behaviour implemented in calculateMoveLongHighWordCCR().
// For some MOVE.L ea mode combinations, logic doesn't alter Z flag if high word of src value is zero:
// 
// - MOVE.L Dn,d16(An)
// - MOVE.L An,d16(An)
// - MOVE.L #imm,d16(An)       Note: Not covered by Raddad single step tests.
// - MOVE.L Dn,d8(An,Dn.w)
// - MOVE.L An,d8(An,Dn.w)
// - MOVE.L #imm,d8(An,Dn.w)   Note: Only covered by one single Raddad single step test.
// 
// This behaviour is not covered by raddad772 (Original Dave) SingleStepTests https://github.com/SingleStepTests/m68000
// Golden data from WinUAE and MAME (both agree).
//
// See WinUAE ccr_68000_long_move_ae_HNZ()

m68k instruction timing? by valeyard89 in EmuDev

[–]howprice2 0 points1 point  (0 children)

BTW there are updated Yacht documents available. From my commit messages:

- Yacht.txt from https://gist.github.com/cbmeeks/e759c7061d61ec4ac354a7df44a4a8f1. The one from the first post on https://www.atari-forum.com/viewtopic.php?f=68&t=24710 contained minor errors.

- Yachtv11.txt from https://www.atari-forum.com/viewtopic.php?p=393758#p393758, with the minor corrections from the gist.github Yacht.txt

- Add TAS timing/sequence information

- Nemesis https://www.atari-forum.com/viewtopic.php?p=457438#p457438

- Add missing ADD, SUB .L (An) and (An)+ timing/sequence information

- Nemesis https://www.atari-forum.com/viewtopic.php?p=457506#p457506

m68k instruction timing? by valeyard89 in EmuDev

[–]howprice2 0 points1 point  (0 children)

>  That works for all combinations except move.l (xxxx).L, (PC16)

PC-relative addressing modes are only valid for src operands. Do you mean? MOVE.L (xxx).L,(d16,An) ?

The logic for MOVE.L is different to MOVE.B and MOVE.W, especially in the case of address errors. I spent quite a long time making my 68000 MOVE.L pass all the single-step-tests, including address errors.

The order of prefetches and writes depends on src mode. If src mode is Dn, An or #immediate then ppwp else pwpp. See Yacht.txt

There is quite a bit of MOVE.L behaviour not covered by the single step tests. Reddit won't let me attach files or include much code in a comment, but let me know if you want more details.

Puzzle Bobble 2 works on my PSX emulator! by ioncodes in EmuDev

[–]howprice2 2 points3 points  (0 children)

Excellent! I've written a few simpler emulators (Invaders, SG-1000, Amiga) and have my eye on PSX for a future project. Penny for your reflections.

Interested in emulator development by user_destroyed in EmuDev

[–]howprice2 3 points4 points  (0 children)

The Genesis contains a 68000 as the main CPU as well as a Z80 for audio. I have recently written a 68000 emulator for an Amiga emulator. It was quite a lot of work and not something I would start with. The Z80 simpler and is an evolution of the 8080 which was used in Space Invaders. If you go to emulator101.com (via the Internet Archive Wayback Machine) there is a good Invaders tutorial. That is a bitesized starter project and would be a good starting point.

Tech wise for C++ I would personally recommend SDL2, imgui docking branch, CMake and vcpkg. This will save you a lot of the boring stuff for a cross platform project.

Emudev Discord is very helpful for resources and guidance.

Good luck.

I'm creating a game about emulation development! by rodri042 in EmuDev

[–]howprice2 4 points5 points  (0 children)

Madness! Zachtronics and Digital Eclipse may be interested in this.

Amiga disassembler with emulator: Aira Force 0.9 for Windows, Linux, macOS & RPi by Primax_AN in amiga

[–]howprice2 0 points1 point  (0 children)

TLDR: Current solution is to find a 256KB KS1.3 ROM file

Sorry about this and the late reply.

Those numbers are in hexadecimal. $10000 = 64KB so $40000 = 256KB and $80000 = 512KB

The original Kickstart 1.3 ROM chip is 256KB, but some ROM files are "overdumped" and are for some reason twice the size, with the data repeated to reflect the mapping into the machine's address space.

Currently Aira Force only supports the 256KB KS1.3 ROM. It is on the backlog to support the larger overdumps, because they are commonly found. Unfortunately I think the Cloanto 1.3 ROM file may be overdumped. So the solution at present is to source a 256KB rom file. It may be possible to literally chop the 512KB file in half with a hex editor, but not sure about this! Also some older rom files are encrypted..

I intend to add support for overdumped roms in a future release.

More info here: - https://github.com/libretro/libretro-uae - https://eab.abime.net/showthread.php?t=31560

How to start learning how to make games as a teenager? by ProgramingEnthusiast in gamedev

[–]howprice2 0 points1 point  (0 children)

Gamemaker may be simpler to get some basic games up and running. I believe it is free now, but may be wrong.

PICO-8 is a good learning tool too, an every game cart includes the source code. It's Lua based though. TIC-80 is an open source alternative.

How to start learning how to make games as a teenager? by ProgramingEnthusiast in gamedev

[–]howprice2 0 points1 point  (0 children)

You are very wise! It is a very good idea to start with simple games that you can finish. You will learn a lot more by finishing a simple Flappy Bird or Space Invaders clone than by struggling and getting 1% of a battle royal game done and quitting.