mariuszw Posted December 30, 2015 Share Posted December 30, 2015 Hi, Here is new game port I have been working on last few weeks: Pentagram. For those who doesn't know this game, Pentagram is final game in Sabreman saga, and it is a sequel to well known Knight Lore. To play the game, use Altirra emulator and run pg.obx. On the title screen, press 1 to play with keyboard and press 2 to play with (emulated) Kempston joystick. Then press 0 to start the game. Other input means (Cursor Joystick and Interface II) are not emulated. Game was ported from Spectrum. For the purpose of porting, I have developed simple static recompiler which takes Spectrum Z80 code and produces equivalent 6502 code. Created code is slow and unoptimized, but it is mostly working correctly. Recompiler is not designed to produce 100% correct 6502 code, but instead it can detect several situations which require manual intervention, like A register being read by Z80 instruction and not set by previous instruction. Also, I have developed a tool to verify correctness of the code. It runs both Spectrum and Atari versions in parallel using Z80 and 6502 emulators and compares memory accesses (read and writes) of both versions and reports differences. It skips all opcode reads (as these are obviously different) and for memory reads it checks if given address from Z80 version is properly mapped to 6502 version. Game is slower at this moment as Spectrum version, but it is almost not optimized, so this is expected at this point. Hopefully it can be brought to better speeds later. Game is also not much tested, so there may be some gameplay issues. For those interested in development, I included source code: - pg_disassembly.txt: Pentagram disassembly found here: http://retrospec.sgn.net/users/nwalker/filmation/ - z80.asm: defines and routines used by Z80 recompiler - spectrum.asm: defines and routines used to emulate Spectrum I/O on Atari (at this moment screen, keyboard, joystick and buzzer are emulated, colours are not) - pentagram_atari.asm: Atari 6502 code of Pentagram - pg.asm: main asm file, assemble it with MADS to create game executable Main routines in the game (which needs optimizing) are: - PrintSprite, which renders the sprite, applying rotation if necessary - LB58A, which render game objects and renders them when necessary Feel free to send me your better optimized versions of these routines. Happy New Year 2016! Mariusz. pg.obx pg_disassembly.txt pg.asm spectrum.asm z80.asm pentagram_atari.asm 23 Quote Link to comment Share on other sites More sharing options...
pirx Posted December 30, 2015 Share Posted December 30, 2015 it was my dream in the nineties, i have even coined a name "emuler" (emulator + compilator) and we (our5oft) purchased zx spectrum to give it a go. too difficult it was, all i did was a routine checking where is all accessible z80 code. the rest seemed too difficult at the time. great to see it is possible after all 1 Quote Link to comment Share on other sites More sharing options...
Tezz Posted December 31, 2015 Share Posted December 31, 2015 (edited) Hats off Mariusz, that's excellent! Recompiling z80 was on my list of wip projects. Edited December 31, 2015 by Tezz Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 31, 2015 Share Posted December 31, 2015 Are you using the MADS optimisation options on the command line? Or do you want better code first before using these? Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted December 31, 2015 Share Posted December 31, 2015 (edited) Cool! Maybe a collaboration with XXL (http://atariage.com/forums/user/9219-xxl/) makes sense? AFAIK he has a similar process to convert Z80 code... Next target: Z80 Game-Boy ports... GBTest.xex Edited December 31, 2015 by Irgendwer 5 Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 31, 2015 Share Posted December 31, 2015 Mariuszw, I like the game. Is anyone else having issues starting the game, I have to hold down '0' for a long time and then press it a few times for the game to start. I think that it may be due to non-optimisation at the moment. Once the game starts, it seems like a game I'm going to like a lot. As a request though, can you change the direction controls? Like Tezz did with Chimera+, is it possible that you don't have to rotate your character to move? Just move the joystick in the direction that you want to go? As a question for all, as for the Gameboy ports request, what has held up GB ports in the past? Is it due to the games tending to be quite big and not fitting in 64K? Or is it because it has a tiling system built into the GB which needs emulating? Or some other reason? I'd love to see more GB games on the Atari. Quote Link to comment Share on other sites More sharing options...
mariuszw Posted December 31, 2015 Author Share Posted December 31, 2015 Are you using the MADS optimisation options on the command line? Or do you want better code first before using these? Not sure what you mean by MADS optimisation options? I haven't found any. Please let me know what they are. Quote Link to comment Share on other sites More sharing options...
xxl Posted December 31, 2015 Share Posted December 31, 2015 WOW! Pentagram! Thanks. nice :-) Quote Link to comment Share on other sites More sharing options...
mariuszw Posted December 31, 2015 Author Share Posted December 31, 2015 Cool! Maybe a collaboration with XXL (http://atariage.com/forums/user/9219-xxl/) makes sense? AFAIK he has a similar process to convert Z80 code... Next target: Z80 Game-Boy ports... GBTest.png Faster CPU (than ZX Spectrum), 40 hardware sprites, full tilemap. Atari can't do that Quote Link to comment Share on other sites More sharing options...
mariuszw Posted December 31, 2015 Author Share Posted December 31, 2015 (edited) Mariuszw, I like the game. Is anyone else having issues starting the game, I have to hold down '0' for a long time and then press it a few times for the game to start. I think that it may be due to non-optimisation at the moment. Once the game starts, it seems like a game I'm going to like a lot. As a request though, can you change the direction controls? Like Tezz did with Chimera+, is it possible that you don't have to rotate your character to move? Just move the joystick in the direction that you want to go? As a question for all, as for the Gameboy ports request, what has held up GB ports in the past? Is it due to the games tending to be quite big and not fitting in 64K? Or is it because it has a tiling system built into the GB which needs emulating? Or some other reason? I'd love to see more GB games on the Atari. You need to press '0' and wait a little bit- if you have speaker, you will hear music which plays at that time, when music ends, game starts. Control scheme is a little weird, but hero can shoot (fire) and jump (joystick down). Not sure how to handle these on joystick without direction controls. Gameboy: too much hardware inside (see my previous post). Edited December 31, 2015 by mariuszw Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted December 31, 2015 Share Posted December 31, 2015 (edited) Faster CPU (than ZX Spectrum), 40 hardware sprites, full tilemap. Atari can't do that <20% more speed isn't something that would break game play - and games run from ROM, so that some SMC magic could speed things up a little bit... I know, the hardest part would be "emulation" of tile map and sprites, but it sounds also like an interesting technical challenge... (even if the result could be more or less a slide show...) Edit: Atari would also be a bit faster in the depicted mode (compared to Spectrum "emulation"), because screen DMA is reduced in every third scan line (second mode line)... test.xex Edited December 31, 2015 by Irgendwer 2 Quote Link to comment Share on other sites More sharing options...
Mclaneinc Posted December 31, 2015 Share Posted December 31, 2015 Thank you Marius...Another great looking port.. 1 Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted December 31, 2015 Share Posted December 31, 2015 (edited) Had a quick look into the code. "EXX" seems to be kind of bottle-neck (I'm sure you know that already). Does a macro expansion really violates the memory footprint? (16 occurrences) 12 saved cycles (jst/rts) isn't that bad... This looks suspicious too: jsr exx ; EXX ; couldn't this be changed to simply jump after @@43 ?@@43 jsr exx ; EXX Edit: Single expansion at $6925 (@@43) for EXX saves one % Edited December 31, 2015 by Irgendwer Quote Link to comment Share on other sites More sharing options...
mariuszw Posted December 31, 2015 Author Share Posted December 31, 2015 Had a quick look into the code. "EXX" seems to be kind of bottle-neck (I'm sure you know that already). Does a macro expansion really violates the memory footprint? (16 occurrences) 12 saved cycles (jst/rts) isn't that bad... This looks suspicious too: jsr exx ; EXX ; couldn't this be changed to simply jump after @@43 ? @@43 jsr exx ; EXX Edit: Single expansion at $6925 (@@43) for EXX saves one % EXX is most expensive Z80 instruction to run on 6502 My idea is to remove these completely, and instead emit code which operates on shadow Z80 registers directly, for example following Z80 code: ;@@43 EXX ;B361: LD C,(HL) ;B362: LD A,(BC) ;B363: LD E,A ;B364: INC HL ;B365: LD C,(HL) ;B366: LD A,(BC) ;B367: LD D,A ;B368: INC HL ;B369: PUSH DE ;B36A: EXX could be recompiled to: @@43 ; jsr exx ; EXX ldy #$00 ; LD C,(HL) lda (z80_hlp),y sta z80_cp ldy #$00 ; LD A,(BC) lda (z80_bcp),y sta z80_ep ; LD E,A inc z80_lp ; INC HL bne *+4 inc z80_hp ldy #$00 ; LD C,(HL) lda (z80_hlp),y sta z80_cp ldy #$00 ; LD A,(BC) lda (z80_bcp),y sta z80_dp; LD D,A inc z80_l ; INC HL bne *+4 inc z80_hp lda z80_ep ; PUSH DE pha lda z80_dp pha ; jsr exx ; EXX The code you mentioned (around @@43) takes care of flipping the sprites (if necessary). They use interesting trick: when they find they need to flip the sprite, they flip it and save back to memory in the same place. As with next frame sprite is probably still flipped, they save cost of flipping on next frame. 1 Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 31, 2015 Share Posted December 31, 2015 Super cool present for new year! THANKS Marius!!! Your coding skills seem to be better every day... Who knows what else you have to release and are just teasing us Target Renegade.. Midnight Resistance...Silkworm.... Uhhhh.... So much possibility Quote Link to comment Share on other sites More sharing options...
mariuszw Posted December 31, 2015 Author Share Posted December 31, 2015 To tell you the truth, one of my favourite games in 80s was Gunfright Btw: can anybody recommend good Spectrum Z80 disassembler? I also need mapping between Spectrum and Atari colors. Then Pentagram may get some colors. Quote Link to comment Share on other sites More sharing options...
+CharlieChaplin Posted January 2, 2016 Share Posted January 2, 2016 (edited) Hmmm, the XEX loads under emulation, but it does not load from an ATR with DOS, gamedos or bootloader - most likely due to a segment that uses memory $0800-0CAC. Maybe it is possible to relocate that segment somewhere else or just raise the memory from e.g. $0800-Axxx to $1000-Bxxx ?!? Edited January 2, 2016 by CharlieChaplin Quote Link to comment Share on other sites More sharing options...
snicklin Posted January 2, 2016 Share Posted January 2, 2016 You need to press '0' and wait a little bit- if you have speaker, you will hear music which plays at that time, when music ends, game starts. Control scheme is a little weird, but hero can shoot (fire) and jump (joystick down). Not sure how to handle these on joystick without direction controls. Gameboy: too much hardware inside (see my previous post). Now that makes more sense, I didn't have my speaker on previously. The first improvement to the game might be to either remove the music or make it so that it can be interrupted. As for the control scheme, how about 2 different selectable options? 1) Controls as they are now (useful for those without a keyboard). 2) Directional controls, fire button to jump and space bar to fire. I know that the controls as they are do wind some people up. Head over Heels is an example of a game with good controls. Super work by the way - as always. Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted January 2, 2016 Share Posted January 2, 2016 Charlie.... Put it on an dos disk with xboot header and rename it to autorun? Xboot by xxl can load from $800... Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted January 2, 2016 Share Posted January 2, 2016 I mean xboot as boot loader. Quote Link to comment Share on other sites More sharing options...
+Adam+ Posted January 6, 2016 Share Posted January 6, 2016 Hi, you can download a newer version of Pentagram from AtariOnline.pl: link More details in this article. 1 Quote Link to comment Share on other sites More sharing options...
snicklin Posted January 7, 2016 Share Posted January 7, 2016 I've found a map online. I can't say whether this version is faithful to the original map, but can only presume so. https://s-media-cache-ak0.pinimg.com/originals/b2/72/ce/b272ce97121fd57c3ba431f9d97b918d.jpg Quote Link to comment Share on other sites More sharing options...
José Pereira Posted January 7, 2016 Share Posted January 7, 2016 (edited) Hi, here's the real for sure, _3 and _4 .png: http://worldofspectrum.org/infoseekid.cgi?id=0009389 Edited January 7, 2016 by José Pereira Quote Link to comment Share on other sites More sharing options...
José Pereira Posted January 7, 2016 Share Posted January 7, 2016 (edited) DEL. Edited January 7, 2016 by José Pereira Quote Link to comment Share on other sites More sharing options...
cpt ron Posted January 9, 2016 Share Posted January 9, 2016 Pentagram.zip 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.