- Top Stats

Top Posters Top Topic Starters Top Topics
NewsBot 1453
Gryzor 738
TFM 649
TotO 500
MacDeath 221
NewsBot 1117
Gryzor 19
Border_7 11
eliot 9
SyX 9
X-MASS, a mass... - 156764 Views TotO 19:32, 14 December 14
X-MEM, a new m... - 99832 Views TotO 22:41, 26 April 14
Amstrad CPC 16... - 79803 Views SyX 21:31, 01 January 13
*FR* - FenixIn... - 44847 Views NewsBot 01:01, 13 January 11
Pac-Man emulat... - 28252 Views TotO 01:01, 02 April 12


Author Topic: Ant Attack Sinclair Zx Spectrum Emulator for Amstrad CPC 6128(+)  (Read 4323 times)

0 Members and 1 Guest are viewing this topic.

Offline 40Crisis

  • CPC464
  • **
  • Posts: 41
  • Liked: 123
You can download here the first release of Ant Attack Sinclair Zx Spectrum 48k
Emulator for Amstrad 6128(+) CPC range.

Ant Attack is a game for Sinclair Zx Spectrum 48K made by Sandy White and
Angela Sutherland and released in 1983 by QUICKSILVA.

This game is the first 3D isometric game released for the Zx Spectrum and one
of the first isometric game released for computers.

It's also a non-sexist game as you can choose for character boy or girl.
Some people considered it to be the very beginnings of the survival horror genre.

Zx Spectrum game is necessary to run the emulator but is not provided.

Please read the "Ant_Attack_Sinclair_Zx_Spectrum_Emulator_For_Amstrad_CPC_6128(+).txt"
file for details on how to use the emulator.

Enjoy.  ;)

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.833
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2853
Oh wow, this is extremely interesting!!!


Is the game really not available for legal downloading? Maybe you could give a MD5 for the TZX so we know we have the correct one...

Offline 40Crisis

  • CPC464
  • **
  • Posts: 41
  • Liked: 123
MD5 for the TZX file is the following:
298f4013df217 *AntAttack.tzx



Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.038
  • Country: fr
  • Liked: 1108
Damn, another speccy port... yet I wasn't aware SIM Ant was ported on speccy.
 :laugh:

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1977
Pretty cool thingy! Thanks a lot!  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.331
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2244
Damn, another speccy port... yet I wasn't aware SIM Ant was ported on speccy.
 :laugh:
Yes true, but this is a different approach. Here the game is not allowed for distribution, so the code loads up the existing game and patches it to work on cpc.
So what you then release is the patch and not the game.

It's up to the person who wants to use the patch to find the game.

I started on the same idea with atic atac, but as of yet I didn't complete this patch.

it's a good achievement because you must identify the areas of data to patch, then implement a way to load the original code and patch it.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.331
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2244
MD5 for the TZX file is the following:
298f4013df217 *AntAttack.tzx
@40Crisis: What is the speed on CPC compared to Spectrum?
Are you converting graphics each time they are drawn, or are you converting them once and using this converted result?
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Sykobee (Briggsy)

  • 6128 Plus
  • ******
  • Posts: 662
  • Country: gb
  • Liked: 220
This would look great with some proper MODE 1 graphics - but I guess that would require some insane patching deep into the graphics rendering routines!


Nice game though, large map.

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.038
  • Country: fr
  • Liked: 1108
Quote
It's up to the person who wants to use the patch to find the game.
yeay just like the PacMan emulator.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1977
BTW... If somebody would send me a DSK which I can just start - I wouldn't mind. ;)


I can start the Speccy emulator, and then? I don't know how to program that machine, every key makes a command, but I can't even take a look at the disc. Strange new world.

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.331
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2244
BTW... If somebody would send me a DSK which I can just start - I wouldn't mind. ;)


I can start the Speccy emulator, and then? I don't know how to program that machine, every key makes a command, but I can't even take a look at the disc. Strange new world.
Oh it actually boots into speccy basic?

I see...

hmmm.. my atic atac hack doesn't do that, runs and looks like a normal cpc program.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline McKlain

  • 6128 Plus
  • ******
  • Posts: 867
  • Country: es
  • Programmable Sound Generator
    • www.mcklain.com
  • Liked: 338

Offline 40Crisis

  • CPC464
  • **
  • Posts: 41
  • Liked: 123
@40Crisis: What is the speed on CPC compared to Spectrum?
Are you converting graphics each time they are drawn, or are you converting them once and using this converted result?


Zx spectrum version renders the 3d display zone in a linear buffer of 116 lines 32 bytes long,
then this buffer is transfered to zx spectrum video memory line by line 30 bytes per line
copied with ldir instruction.

The display for this buffer is most of the time in black and white colors but the white color
can be changed to other color in specific occasions (ammno shoots, end of rescue ).
Only text messages can have multiple colors on ant attack spectrum. They are added by calling the basic
rom which writes directly in video ram.

So the graphics stay all the time monochromatics in the working buffer.

The graphics being monochromatics, to render this on the cpc I just have to convert
8 pixels on one byte on the spectrum into two bytes on the cpc at the cpc format
with minimal instructions unrolled for the whole line to
avoid looping. I use the stack to get data from the zx spectrum buffer.

I wrote a first version that was like this:


        push    ix
        ld    ixh,116                      ; 116 lines to copy   
        ld (save_sp),sp
        ld  sp,$A181                    ; zx source buffer
        ld  de,$E042                    ; dest cpc video memory
        ld  c,$0F                           ; mask
trans1:       
        ld     b,$F0
trans:   
        ; !!!! missing in this listing unroll 14 times the following block !!!!!
       
        pop    hl
        ld     a,l
        and     b
        ld     (de),a
        inc    e
        ld    a,l
        add    a,a
        add    a,a
        add    a,a
        add    a,a
        ld    (de),a
        inc    e
        ld     a,h
        and     b
        ld     (de),a
        inc    e
        ld    a,h
        add    a,a
        add    a,a
        add    a,a
        add    a,a
        ld    (de),a
        inc    e
       
       
        pop    hl
        ld     a,l
        and     b
        ld     (de),a
        inc    e
        ld    a,l
        add    a,a
        add    a,a
        add    a,a
        add    a,a
        ld    (de),a
        inc    e
        ld     a,h
        and     b
        ld     (de),a
        inc    e
        ld    a,h
        add    a,a
        add    a,a
        add    a,a
        add    a,a
        ld    (de),a
       
        pop     hl
               
        ld    hl,2048-59
        add    hl,de
        jr    nc,no_overflow
        ld    de,$C000+64
        add    hl,de
no_overflow:
        ex    de,hl           
        dec    ixh
        jp    nz,trans1
        ld sp,(save_sp)
        pop    ix   
        ret

save_sp:     .dw 0
   



Then I found an optimisation (4 add a,a instructions replaced with an and instruction) by
duplicating the black color, using only 3 colors for the display.
Pen 0 is white pen 1 is black pen 2 is black.

It looks now like this:

        push    ix
        ld    ixh,116         ; 116 lines to copy   
        ld (save_sp),sp
        ld  sp,$A181        ; zx source buffer
        ld  de,$E042        ; dest cpc video memory
        ld  bc,$F00F         ; mask for left/right pixels on cpc
       
trans1:
        ; !!!! missing in this listing unroll 14 times the following block !!!!!
       
        pop hl
        ld  a,l
        and b
        ld (de),a
        inc e
        ld a,l
        and c
        ld (de),a
        inc e
        ld  a,h
        and b
        ld (de),a
        inc e
        ld a,h
        and c
        ld (de),a
        inc e
       
       
        pop hl
        ld  a,l
        and b
        ld (de),a
        inc e
        ld a,l
        and c
        ld (de),a
        inc e
        ld  a,h
        and b
        ld (de),a
        inc e
        ld a,h
        and c
        ld (de),a
       
        pop     hl
               
        ld    hl,2048-59
        add    hl,de
        jr    nc,no_overflow
        ld    de,$C000+64
        add    hl,de
no_overflow:
        ex    de,hl
       
        dec    ixh
        jp    nz,trans1
        ld sp,(save_sp)
        pop    ix   
        ret
   
save_sp:     .dw 0


In zx Spectrum emulator Fuse I measured 100074 Tstates to transfer whole buffer.
1 Tstate = 1 / 3500000 s

In Cpc emulator Arnold  I measured 42102 Nops to transfer whole buffer.
1 Nops = 1 / 1000000 s


If I'm right Zx spectrum display routine is 0.042102/0.028592 = 1.47 faster than cpc display

Offline Xyphoe

  • 6128 Plus
  • ******
  • Posts: 885
  • Country: gb
    • GX4000.CO.UK
  • Liked: 309
Hi guys and 40Crisis - I have done a video of this! Review and longplay :)

[AMSTRAD CPC] Ant Attack - Longplay & Review! (Spectrum classic emulated on the CPC!!)
[AMSTRAD CPC] Ant Attack - Longplay & Review! (Spectrum classic emulated on the CPC!!)

Thank you again 40Crisis, I think this is BRILLIANT work.


Offline 40Crisis

  • CPC464
  • **
  • Posts: 41
  • Liked: 123
Hi guys and 40Crisis - I have done a video of this! Review and longplay :)

[AMSTRAD CPC] Ant Attack - Longplay & Review! (Spectrum classic emulated on the CPC!!)
[AMSTRAD CPC] Ant Attack - Longplay & Review! (Spectrum classic emulated on the CPC!!)

Thank you again 40Crisis, I think this is BRILLIANT work.

Many thanks for this nice video  :)

It's always nice to see people appreciating your work.
It's sometimes a hard work making all behave on the cpc as close as it does in the original zx spectrum game, but finally you manage to do it.
 

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.119
  • Liked: 417
@40Crisis

This is amazing. I would never of thought that emulating another home computer on the CPC would of been possible.
A few questions:

1) Does the CPC have to be 128kb to emulate a 48kb machine?
2) Does the emulator work with RAM expansions?
3) If the RAM expansion is 256kb could it also emulate a 128kb machine?
4) Does the CPC also emulate the beeper or would it disregard that sound?
5) Are there speed differences between an original spectrum game and the emulated version on a CPC?

Great work and it would be interesting to see other games emulated.

This has me wondering if the CPC could emulate an MSX 1.....


Offline mahlemiut

  • CPC6128
  • ****
  • Posts: 271
  • Country: nz
  • Liked: 128
This has me wondering if the CPC could emulate an MSX 1.....

The Aleste 520EX does this to some extent, with a little hardware help, although VDP emulation is done in software.
- Barry Rodewald
Amstrad CPC, Sharp X68000, Neo Geo Pocket, and Neo Geo AES system leader at HARP
http://www.homeactionreplay.org/

Offline 40Crisis

  • CPC464
  • **
  • Posts: 41
  • Liked: 123
@40Crisis

This is amazing. I would never of thought that emulating another home computer on the CPC would of been possible.
A few questions:

1) Does the CPC have to be 128kb to emulate a 48kb machine?
2) Does the emulator work with RAM expansions?
3) If the RAM expansion is 256kb could it also emulate a 128kb machine?
4) Does the CPC also emulate the beeper or would it disregard that sound?
5) Are there speed differences between an original spectrum game and the emulated version on a CPC?

Great work and it would be interesting to see other games emulated.

This has me wondering if the CPC could emulate an MSX 1.....

First of all, my zx spectrum rom emulation is partial, and at the moment
only emulates the features needed by zx basic parts from the supported zx games.
For instance, Maziacs doesn't have zx basic graphics functions emulation, because it doesn't use it.
For Ant Attack I only need to add the circle basic function emulation.

A complete zx spectrum basic emulator is available: ZXM. It only emulates zx basic programs in black and white
output. It has less memory than a real 48k Spectrum because the emulation code is for 64K CPC.
It's a nice piece of software and this is one of the program that convinced me it's was possible
to emulate a 48K spectrum on a CPC.

1)

It depends on the zx spectrum program you want to emulate.
The two games emulators I wrote for CPC ( Maziacs and Ant Attack ) uses zx basic and assembly.
Zx basic use means that you need to have 16 KB zx spectrum rom loaded in memory at location 0.
Then you need to had emulation code (about 6 KB) plus 16K CPC screen memory (which can be optimized if necessary to 12288 bytes by tweeking
CRTC registers to have linear screen memory).


For example my first emulator for zx maziacs fits in 64K CPC memory because the zx game
doesn't use full 48K ram available on speccy.

Ant Attack emulator didn't fit in 64k because it makes use of full 48K Ram. Only the zx spectrum display memory
(6912 bytes) was available. I use it to put emulation code. So I need 16K extra memory for CPC screen.



2)

I think it should if expansion uses standard memory bank addressing.


3)

Yes, it's perfectly possible if the emulator supports it, which is not the case

4)

The zx spectrum beeper sound is emulating at runtime (no sound records) in a very similar way to the zx.

5)

Most of zx spectrum machine code runs unchanged on the CPC. Only parts contening I/O need to be emulated
(graphics output, controls input and sound output).

When possible, I tried to write code as fast as possible on the CPC to get close to spectrum speed.
The main problem is the graphics, On the CPC you have to read/write twice memory compared to speccy graphic memory.
The zx spectrum beeper sound could be also CPU intensive to emulate but wastes nearly the same as it does on a speccy.

Maziacs emulated on CPC is as fast as on the zx. Luckily the zx game waits about 60% of the available CPU time to slow it down.
This is probably because zx graphic display is very fast. Graphics background of the maze, covering nearly full screen, are displayed using zx graphics attributes (on byte write =
64 pixels displayed). This was hard to emulate on the CPC but I could do it displaying tiles using the stack.

Ant Attack emulator is a bit slower due to optimisation I explained above in this topics.


Regarding MSX emulation:

MSX has a hardware graphic chip for displaying sprites that CPC lacks.
Sound chip is the same that the CPC one.
Emulation is probably possible but will be probably much slower.

Offline VincentGR

  • 6128 Plus
  • ******
  • Posts: 998
  • Country: gr
    • Parts from the past.
  • Liked: 468
That is great, thank you!!!
I hope we see an Ikari Warriors port  ;D although there are to much happening on screen in this game  :'(

To blit, or not to blit?
Amiga 1200 Black Project

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.833
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2853
So lovingly nerdy :) Thanks for the vid mate!