10 September 2019, 07:01 | #21 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
link to code is dead
|
10 September 2019, 08:09 | #22 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Here's how I would handle this one...
I'd start by analysing the opcodes that are used in the pacman disassembly, the z80 cpu has about 700 different opcodes... as shown here: http://z80.info/opcodes.txt I'd then be looking to come up with a strategy to mapping the z80 registers to the 68k regs. I don't see the above being too difficult.. The hard part as I see it is knowing how to do the memory mapping. I'm not sure (yet) how I would be able to distinguish a 16bit memory mapped address from a 16bit absolute value used for other purpose. You could keep an address register at a 64kb boundary and somehow map the z80 addresses to it. I really haven't thought this post through at all have it. I'll keep thinking. Geezer |
10 September 2019, 08:13 | #23 |
Zone Friend
Join Date: May 2006
Location: France
Posts: 1,801
|
|
10 September 2019, 09:20 | #24 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,334
|
|
10 September 2019, 15:10 | #25 |
Retro Gamer
Join Date: Jan 2005
Location: Underworld
Age: 51
Posts: 4,058
|
Never mind - for some strange reason you can't post M E D I A F I R E links on EAB. (or write that word here )
Uploaded file to the zone.. Last edited by Anubis; 10 September 2019 at 15:17. |
10 September 2019, 15:52 | #26 |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
|
10 September 2019, 18:11 | #27 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
So I had a bit of a further think about this, apologies but I haven't been able to test any of it yet.
@mods - you might want to move this into a technical section. I'd setup my z80 -> 68k registers like below, the I register does not seem to be directly updated. Code:
REGISTERS: A equr D0 B equr D1 C equr D2 D equr D3 E equr D4 H equr D5 L equr D6 HL equr A0 BC equr A1 DE equr A2 IX equr A3 IY equr A4 SP equr SP SCRATCH equr D7
I'd approach this by using a translator that reads the rom code section and creates equivalent 68000 code, all of the instructions that relate to branches/loops would need to be calculated and the status register honored. If any of Z80 instructions update a register I would create code from the macros below. (i.e. if address reg HL updates then the H and L data regs must be updated too. This will probably be fast enough. Code:
; Update 8 bit regs... UPDATE_DATA_HL MACRO move.l HL,L ; HL into H move.w L,H ; L done lsr.w #8,H ; H done ENDM UPDATE_DATA_BC MACRO move.l BC,C ; BC into B move.w C,B ; C done lsr.w #8,B ; B done ENDM UPDATE_DATA_DE MACRO move.l DE,E ; DE into D move.w E,D ; E done lsr.w #8,D ; D done ENDM ; SCRATCH (d7) register holds memory base 64k segment. for example.... $30000 UPDATE_ADDR_HL MACRO move.w H,SCRATCH ; H into Scratch reg lsl.w #8,SCRATCH ; shift up into high byte or.b L,SCRATCH ; fetch L into low byte move.l SCRATCH,HL ; Update HL ENDM UPDATE_ADDR_BC MACRO move.w B,SCRATCH ; B into Scratch reg lsl.w #8,SCRATCH ; shift up into high byte or.b C,SCRATCH ; fetch C into low byte move.l SCRATCH,BC ; Update BC ENDM UPDATE_ADDR_DE MACRO move.w D,SCRATCH ; D into Scratch reg lsl.w #8,SCRATCH ; shift up into high byte or.b E,SCRATCH ; fetch E into low byte move.l SCRATCH,DE ; Update DE ENDM Code:
move.w #1,SCRATCH add.w SCRATCH,HL add.b SCRATCH,H The status register could be tricky (would need to store that somewhere possibly in D7?). One massive improvement a 68020 would have over this is that data regs can be used as address registers, so effectively... it would fly. Thoughts...? Am i crazy? Last edited by mcgeezer; 10 September 2019 at 19:09. |
10 September 2019, 19:32 | #28 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
the program would need to reside in 0-$8000 addresses right? because of the 16 bit registers and the 32 bit signed?
There's a "nibble" status register too. I'm zoning the Z80 to 68000 converter I dug up. |
10 September 2019, 20:17 | #29 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
So in the high word of d7 the 64kb segment... i.e. $0003 which would have the rom loaded at $30000. |
|
10 September 2019, 21:10 | #30 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
You forgot undocumented registers accesses like IYL, IYH, IXL and IXH.
|
10 September 2019, 21:12 | #31 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
|
10 September 2019, 21:32 | #32 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
is there anything about tiles (maze) and chars (letters/score) somewhere? the info on sprites is very clear in MAME (wow, they went C++!!) but nothing on tiles/charset.
Damn this game could just be done with sprites and a few bobs. I've already converted some sprites to amiga format and displayed a ghost on a amiga 4-planar screen... but the trickiest part remains the code (unless it's rewritten from the very detailed specs given in some links below, but that's not the point) Last edited by jotd; 10 September 2019 at 22:08. |
19 September 2019, 14:46 | #33 | |
Registered User
Join Date: Sep 2004
Location: Brasil
Age: 49
Posts: 181
|
Sorry, we have people working in home and i have not time for coming here...
Quote:
You can find the tile format in "src/mame/drivers/pacman.cpp". More exactly this piece of code: Code:
static const gfx_layout tilelayout = { 8,8, /* 8*8 characters */ RGN_FRAC(1,2), /* 256 characters */ 2, /* 2 bits per pixel */ { 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */ { 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 }, /* bits are packed in groups of four */ { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, 16*8 /* every char takes 16 bytes */ }; . . . static GFXDECODE_START( gfx_pacman ) GFXDECODE_ENTRY( "gfx1", 0x0000, tilelayout, 0, 128 ) GFXDECODE_ENTRY( "gfx1", 0x1000, spritelayout, 0, 128 ) GFXDECODE_END Then, later in that file, you can see which roms are used for graphics and where in the memory map are (even if the roms are interleaved or not): Code:
ROM_START( puckman ) ROM_REGION( 0x10000, "maincpu", 0 ) . . . ROM_REGION( 0x2000, "gfx1", 0 ) ROM_LOAD( "pm1_chg1.5e", 0x0000, 0x0800, CRC(2066a0b7) SHA1(6d4ccc27d6be185589e08aa9f18702b679e49a4a) ) ROM_LOAD( "pm1_chg2.5h", 0x0800, 0x0800, CRC(3591b89d) SHA1(79bb456be6c39c1ccd7d077fbe181523131fb300) ) ROM_LOAD( "pm1_chg3.5f", 0x1000, 0x0800, CRC(9e39323a) SHA1(be933e691df4dbe7d12123913c3b7b7b585b7a35) ) ROM_LOAD( "pm1_chg4.5j", 0x1800, 0x0800, CRC(1b1d9096) SHA1(53771c573051db43e7185b1d188533056290a620) ) ROM_REGION( 0x0120, "proms", 0 ) . . . ROM_END And in the attached picture, you can see the tiles in a graphic ripper. It is not maptapper, because it doesn't support this format, but you can see the tiles and sprites using the mame graphic viewer (F4) and it is not very difficult to rip from there. With respect to the tilemap, the information is in "src/mame/video/pacman.cpp" (the palette information is there too); but the tilemap is simple, it is fixed in $4000-$43FF in the z80 memory map; and every byte is a tile number, there is not mirroring or another extra feature. The only thing to remember is that the arcade uses a vertical monitor (and graphics and tilemap are encoded in that way). In my CPC implementation, i used a dirty buffer for only updating the tiles that were changed between frames. And with respect to the graphics, i extracted and my artist partner retouched until get the best result in the CPC 4 colour screen mode. Just in case, you can find this version here. |
|
19 September 2019, 15:01 | #34 | |
Registered User
Join Date: Sep 2004
Location: Brasil
Age: 49
Posts: 181
|
Quote:
Those two games are not possible in the CPC without extra hardware (the memory paging system in the CPC is very limited), but i have a test with Ms. Pac-Man and Pengo working in the Amstrad PCW and MSX systems, although need extra polishing for releasing them. |
|
19 September 2019, 21:17 | #35 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 339
|
Converting from one CPU platform to another is exciting but be careful. Some instructions that looks similar between processors doesn't affect the condition-status register flags (CCR on the Amiga) the same way. I've investigated 6502 -> 68000 conversion and encountered this problem.
If considering emulation, I can also highly recommend storing the emulated CPU-registers using the Amiga-registers instead (D0,D1...), storing them in RAM would slow down things very much (been there, done that. First few unreleased versions of A/NES did just that). |
20 September 2019, 09:28 | #36 |
Ex nihilo nihil
Join Date: Oct 2017
Location: CH
Posts: 4,856
|
Pac-man related info on Worthy's thread
|
20 September 2019, 15:10 | #37 |
Retro Gamer
Join Date: Jan 2005
Location: Underworld
Age: 51
Posts: 4,058
|
I never programmed any emulators/games, specially nothing in ASM, but this thread make me wonder on internet for info and try to understand what is going on and how emulators on different systems are made.
Found very instructional web page emulator 101 - http://emulator101.com/ Using Space Invaders to explain how 8080 processor works and how to emulate it, also how to disassemble code in C++. Author also posted reference for both 8080 and 6502. There is also link for step-by-step explanation what 8080 code does and how program works: http://computerarcheology.com/Arcade...ders/Code.html At the moment I am playing with 6502 disassembler, found here on github: https://github.com/kpmiller/emulator...bler/dis6502.c This is really interesting, probably will spend some more time learning about this, and how can this be used in amiga. Thank you for thread. Last edited by Anubis; 20 September 2019 at 15:46. |
31 May 2020, 17:09 | #38 |
Registered User
Join Date: Feb 2016
Location: Sydney, Australia
Posts: 21
|
Did you end up deciding on an approach and did you get anywhere with it?
The first transcode I came across was Arcade Donkey Kong (Z80) to the CoCo3 (6809). That was done 'algorithmically' if not fully automated. Impressive work and it inspired my own project (below). As mentioned elsewhere in this thread, there's Glen's Pacman (he also did Space Invaders and Defender is WIP). Also mentioned was the Pentagram port to Atari 8-bit which used optimisations of the original source to run at full speed. I ask because I've done a few hand-transcoded projects myself. Arcade Donkey Kong (Z80) -> 68k ASM (Neo Geo, 50% complete) Apple II Lode Runner (6502) -> 6809 ASM (CoCo3) & C (Neo Geo) Arcade Space Invaders (8080) -> 6809 ASM (CoCo3) Z80 Spectrum Knight Lore (Z80) -> 6809 ASM (CoCo3) & C (Amiga, Neo Geo) Asteroids (6502) -> 6809 ASM (CoCo3) & C (WIP) I've also done a few patches/ports of original code (same CPU) to different systems: Arcade Space Invaders -> TRS-80 Model 4 Arcade Tutankham -> CoCo3 MSX Lode Runner -> TRS-80 Model 4 Arcade Asteroids -> Apple IIGS I've got a few more projects in mind, targetting the 68K, primarily Z80. I was thinking this time, get an emulator running on the 68K, even if woefully slow, just to see things running. Not sure if that'll help the process ultimately, but it's another step along the way. |
31 May 2020, 17:54 | #39 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
well, I decided to port another arcade game to amiga instead, Bagman
I had written the game in C++ for SDL. I ported it to native amiga. So no, nothing at the moment. But your work looks very interesting. |
03 August 2021, 18:01 | #40 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
okay, back to Pacman after all.
We'll see the AI later on. Decided to go 100% asm. 4 planes. 1 plane for maze 1 plane for pacman using blitter (1 plane) 1 plane for dots 1 other plane (to be able to blit bonuses with proper colors) sprites for ghosts (4 different color palettes preventing to use a sprite for pacman) hoping to avoid double buffering and getting 50Hz with only 1 blit on 1 plane. That should be doable. I'm not too concerned about the AI ATM. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Worst Arcade Conversion | Hewitson | Nostalgia & memories | 57 | 09 April 2019 12:51 |
Arcade / Console --> Amiga conversion discussions | dlfrsilver | Coders. General | 587 | 04 September 2018 17:11 |
Pacman / Gridrunner crossover game | pickaweapon | Looking for a game name ? | 4 | 02 July 2012 23:41 |
Landover's Amiga Arcade Conversion Contest | Frog | News | 1 | 28 January 2005 23:41 |
Old Atari ST ? Game...not sure if there was an Amiga conversion.. | HCF | Looking for a game name ? | 14 | 17 October 2004 17:43 |
|
|