converting ZX128 software for SAM COUPE

edited October 2013 in Games
SAM COUPE is computer compatible with ZX48 model. Use same ports, same keyboard with compatible membrane, 64kB adress space with possibility connect any ROM from adress 0, compatible ZX graphic mode, etc...

Big part of SAM's software it games for ZX16/48 kB. And what about using ZX128 software on SAM COUPE ? Exist only several ZX128 games conversions for SAM (for example ROBOCOP 2). SAM use different memory layout/paging than ZX128. Adress space 64kB is on SAM divided to two 32kB blocks - on ZX128 is possible memory paging only in high 16kB. This is big hardware difference = is very hard(impossible) convert ZX128 software for this layout.

But now exist easy way for import ZX128 games to SAM COUPE if 1MB memory upgrade is connect !!! Yes, it's very very easy. 1MB external memory for SAM COUPE enable also memory paging in high 16kB of adress space as on ZX128. Only different paging ports and bit layout is used.

This is bits on ZX128 paging port 32765:
D0 = paging bit 0
D1 = paging bit 1
D2 = paging bit 2
D3 = videoram 0/1
D4 = rom 128/48
D5 = disable port 32765
D6 = unused
D7 = unused

And this is bits on 1MB memory for SAM COUPE on port 129:
D0 = paging bit 0
D1 = paging bit 1
D2 = paging bit 2
D3 = paging bit 3
D4 = paging bit 4
D5 = paging bit 5
D6 = unused
D7 = unused

As you can see - 1MB memory use only more paging bits and absent extra bits for rom/vram switching. This is way for convert any game for SAM COUPE:

1) load ZX128 game and jump before start to debugger in emulator
2) rewrite adress of paging port 32765 to adress 129. All writed values for paging port must be masked by AND 7 instrustion, if game use also next bits than D0-D2.
For example this is original code:
LD BC,32765
OUT (C),A
And we can replace this code with:
AND 7
OUT (129),A
3) disable AY sound
4) export all used memory pages to BIN files
5) import BIN files(ZX pages) to identical page in 1MB memory
Page 5 must be on SAM loaded to adress 16384.
6) load on SAM from adress 0 original ZX 48 rom to ram memory with write protect
7) set ZX graphic mode, set ZX color palette , enable external memory in high 32kB, set port 128 to value 2 and port 129 to value from original port 32765 (only first 3 bits). Jump to starting adress....

Wow...it's work excellent....
This is conversions of games TOTAL RECALL and NAVY SEALS 1
http://velesoft.speccy.cz/other/zx128games_for_samcoupe.zip

navy-seals-sam.png

total-recall-sam.png

sam-128-dir.png

sam-128-loader.png

Additional info about 1MB memory and AY ports:
- converted software use all 8 memory pages as ZX128
- page 5 is additional page, not mirrored to adress space 16384-32767
- page 2 is morrored to adress 32768-49151 as on original ZX128
- is ignored switching to second ZX videoram, page 7 is used only as ram
- in adress space 0-32767 CPU run about 10-20% faster than on ZX128
- in adress space 32768-65535 CPU run at 6.0 MHz - games is faster
- all AY ports can be disables/removed because ports #xxFD is on SAM COUPE used for MIDI controll and slow-down CPU (too much).
- can be converted also software for ZX clones with extended memory support. (software for Pentagon 256, Pentagon 512, Pentagon 1024, Assemblers, etc...)
- color palette can be changed before start game/program (each of 16 ZX colors can contain one of 128 possible SAM's colors). This is color palette on SAM COUPE:
samcoupe-palette.png
Post edited by velesoft on
«1

Comments

  • edited April 2010
    Incredibly useful! And one can modify the game palette in the process :) ACE.
  • edited April 2010
    Looks good..

    Do you think Street Fighter 2 could be adapted to work on disc on the SAM to avoid the lengthy tape loads? I know the game is DENIED, but this is just a theory question.
  • edited April 2010
    Looks good..

    Do you think Street Fighter 2 could be adapted to work on disc on the SAM to avoid the lengthy tape loads? I know the game is DENIED, but this is just a theory question.

    All is possible. Old modified ZX48 roms for sam coupe also use tap emulation (loading from HDD/FDD/ramdisc). Tape routines in rom can be replaced with return to SAM basic and all other is easy...
  • edited April 2010
    Two words: Carrier Command :grin:
  • edited April 2010
    velesoft wrote: »
    All is possible. Old modified ZX48 roms for sam coupe also use tap emulation (loading from HDD/FDD/ramdisc). Tape routines in rom can be replaced with return to SAM basic and all other is easy...

    Same is done with SAM81 and SAM2ZX81.
    When a call is made to load, the file is loaded from disk.
  • oboobo
    edited April 2010
    velesoft wrote: »
    But now exist easy way for import ZX128 games to SAM COUPE if 1MB memory upgrade is connect !!!
    Using external RAM has come up before for 128K paging (probably on the sam-users list?), but seemed to be dismissed due to not enough people owning external memory. Though with more people using the emulator nowadays it's become a viable option!

    It'd be nice to try automating the conversion too, perhaps using libspectrum to read existing 128K snapshots. The code matching might not need too many variations to handle most cases, and it can always be extended as needed. The same might even be possible for AY sound too, since we can convert AY registers values to SAA, and there's plenty of spare RAM for the code and tables. Most tunes should be fine, though white noise can sound a bit harsher.
  • edited April 2010
    yeh an automated process would be an excellent idea an option in the emulator to do some sort of 128 compatability mose
  • oboobo
    edited April 2010
    BiNMaN wrote: »
    yeh an automated process would be an excellent idea an option in the emulator to do some sort of 128 compatability mose
    The automated process would likely be a separate program, converting 128K snapshots to SAM disk images.

    SimCoupe won't be getting any special features to support it, otherwise the conversions wouldn't run on real SAM hardware. If you want native support for 128K software, use the original snapshot with a Speccy emulator! ;-)
  • edited April 2010
    obo wrote: »
    The automated process would likely be a separate program, converting 128K snapshots to SAM disk images.

    an equally excellent idea (well a better one actually)
  • edited April 2010
    obo wrote: »
    The automated process would likely be a separate program, converting 128K snapshots to SAM disk images.

    SimCoupe won't be getting any special features to support it, otherwise the conversions wouldn't run on real SAM hardware. If you want native support for 128K software, use the original snapshot with a Speccy emulator! ;-)

    Actually I use 48rom with short (about 100 bytes) routine for install all 128kB memory pages from SAM COUPE ram to 1MB pages. I use 128kB SNA files divided to 8 blocks (ZX pages 16kB). With easy modification I can load original SNA 128 files as single file and automatically find and rewrite all instructions LD BC,32765 to LD BC,129. But this automatic conversion will not usable at 100%.... some games/software use different memory paging routines combined with access to AY ports. Also all original values writed to port 32765 must be only in range 0-7....etc....

    I load any 128kB game in ZX emulator on PC and before start game save SNA 128kB snapshot. After start SNA file must be find and disable all access to AY ports. After this patch must find and replace all instructions LD BC,#7FFD (bytes 01 FD 7F). In emulator set breakpoint at access to port #7FFD (this help with finding), also AY ports #BFFD and #FFFD. Only in this way is possible correct convert ZX128 software for SAM. Automat is bad (unreliable)
  • edited April 2010
    zxbruno wrote: »
    Two words: Carrier Command :grin:

    OK, converted....

    carrier_command-sam.png

    http://velesoft.speccy.cz/other/carrier_command_for_samcoupe.zip
  • edited April 2010
    Additional info about code of converted software:

    SAM COUPE (con)versions use identical code as original software for ZX128. Only paging port #7FFD is rewrited to port #81, data for paging port contain only page number value 0-7(vram and rom bits=0) and AY ports disabled.

    This code can work on real SAM COUPE and also on real ZX128. ZX Spectrum use uncomplette port adressation (A15-A0: 0xxxxxxx xxxxxx0x). Write value to port #81(for 1MB memory on SAM) work on ZX128 identical as OUT #7FFD. Result: software using paging port #81 is compatible with ZX128 and SAM COUPE !!!
    Problem can be only if software use access to 48 rom. I use bit D4 on port #81 always in log.0 (on ZX128 set ROM0 with 128 editor...).
    Disabled AY ports = silence on ZX128, but software work....

    I have SNA 128kB files of each converted game. This SNApshot contain all patches/modifications and is runable also on emulators/real ZX128.
  • edited April 2010
    obo wrote: »
    The same might even be possible for AY sound too, since we can convert AY registers values to SAA, and there's plenty of spare RAM for the code and tables. Most tunes should be fine, though white noise can sound a bit harsher.

    I am not musician. Exist this AY to SAA convertor as single routine ? I need more info about implement it. For example can be this convertor placed to extra memory page. Each access to AY ports can be replaced with RST xx and jump to modified ZX rom. Routine in ZX rom set extra memory page and call convertor. After return set back original memory page and continue in program… Is this AY to SAA convertor fast ? Use big table for convert registers ? Is source code ?
  • edited April 2010
    This source code for SAM COUPE contain also AY-3-8912 to SAA1099 convertor...

    http://home.earthlink.net/~simoncooke/samcoupe/infobase/source/htbtter.txt
  • edited May 2010
    Where are the Sam users? Simon where art thou? :D This would be a good opportunity to finally have games with AY support on the Sam, either 48K or 128K ones.

    A couple more:

    Where Time Stood Still
    Robocop
    Chase HQ
    Batman the Movie
  • edited May 2010
    zxbruno wrote: »
    Where are the Sam users? Simon where art thou? :D

    http://www.mail-archive.com/sam-users@nvg.ntnu.no/maillist.html
    zxbruno wrote: »
    This would be a good opportunity to finally have games with AY support on the Sam, either 48K or 128K ones.

    A couple more:

    Where Time Stood Still
    Robocop
    Chase HQ
    Batman the Movie

    Where Time Stood Still is impossible convert. All sprites in game flash if is set stable first videoram.
  • edited May 2010
    This is runner for SNA 48/128 snapshots on SAM COUPE. 48kB SNA files can be loaded without modifications. Only 128kB SNA files must be modified (replaced all access to port #7FFD to new port #81).

    http://velesoft.speccy.cz/other/snaper-2010-v001.zip

    snaper-2010-v001-1.png

    snaper-2010-v001-2.png

    snaper-2010-v001-3.png

    snaper-2010-v001-4.png

    SNAPER utility load any selected file and detect file structure and version of SNA (48kB / 128kB). 48kB SNA files is loaded in 48kB mode in SAM ram (run about 20% faster than original ZX Spectrum). But is possible manually change value of basic variale "SLOW=1"
    to "SLOW=0" for run 48kB SNApshots to 1MB external memory (games run at 6.0 MHz = turbo). ZX color palette is also set in basic and can be modified. After detect correct structure of SNA 128kB is all 128kB pages copied to 1MB memory (if default value of port 7FFD in SNA is in range #10-#17 then ZX pages is installed to 1MB memory pages #10-#17. If contain value 0-7 then all pages is copied to 1MB pages 0-7. Bits D3,D5,D6 and D7 for paging port in SNA must be always set to value 0 !!!

    All SNApshots is runable on SAM coupe and on ZX machines (compatibility).
  • edited May 2010
    zxbruno wrote: »
    Where are the Sam users? Simon where art thou? :D This would be a good opportunity to finally have games with AY support on the Sam, either 48K or 128K ones.

    A couple more:

    Where Time Stood Still
    Robocop
    Chase HQ
    Batman the Movie

    Tons of 128K games were hacked to run on SAM back in the early 1990/91 days - plenty of disks of hacked games were floating around the scene.

    They were hacked to run on the standard 256K/512K SAM with the 128K memory paging code modified so no external memory was needed by the SAM - in fact the 1MB external memory wasn't even out then! AY sound was also patched to play on the SAA.

    Colin.
    Quazar - Celebrating 23 years of Developing for the SAM Coupé
    Hardware, Software, Magazines and more for the SAM Coupé
    Website: www.samcoupe.com
    Twitter: QuazarSamCoupe
  • edited May 2010
    Quazar: Where those games preserved? As of today I've never had the privilege of playing a 128K game on the Sam, or any Spectrum game with SAA music/sound. :sad:
  • edited May 2010
    zxbruno wrote: »
    Quazar: Where those games preserved? As of today I've never had the privilege of playing a 128K game on the Sam, or any Spectrum game with SAA music/sound. :sad:

    I know only ROBOCOP 2 conversion for SAM COUPE (with AY music converted to SAA1099 music). Each ZX128 game can be converted for original SAM COUPE, but it will very very hard on some games.

    SAM COUPE memory adress space 64kB is divided to two 32kB blocks. Memory paging on ZX128 is only in last 16kB of adress space. Exist one easy way for conversion:
    - ZX memory page 2 (32768-49151) copy to SAM pages 0,2,4,6,8,10,12 and 14
    - ZX mem.page 0 copy to SAM page 1
    - ZX mem.page 1 copy to SAM page 3
    - ZX mem.page 2 copy to SAM page 5
    - ZX mem.page 3 copy to SAM page 7
    - ZX mem.page 4 copy to SAM page 9
    - ZX mem.page 5 copy to SAM page 11
    - ZX mem.page 6 copy to SAM page 13
    - ZX mem.page 7 copy to SAM page 15
    - rewrite paging routine for work with SAM ram
    - rewrite routines rewriting adress space 32768-49151 (ideally move to adress space 0-16384 instead ZX rom). This routines must work with adress space 0-16384 instead 32768-49151.

    Some ZX128 game versions is only 128kB remix. It can be easy convert to original SAM COUPE, but functionality is same as on 48kB version of this games, only TAPe support must be emulated in ZX rom.
  • edited May 2010
    zxbruno wrote: »
    Quazar: Where those games preserved? As of today I've never had the privilege of playing a 128K game on the Sam, or any Spectrum game with SAA music/sound. :sad:

    I remember finding some on the net a few years back.

    Google 'sam coupe 128k games disk' and you should find them quite quickly.
  • edited May 2010
    I have upped the tosec Spectrum games for Sam Coupe here ... there are a coupe of 128k compliations there too... 12Mb big pack. Hope none of them are denied, don't have an emulator here to look...

    http://pc.sux.org/tomcat/SamCoupeSpectrumGames.zip

    169,856 Spectrum Games Compilation 01 (19xx)(-).zip
    409,431 Spectrum Games Compilation 02 (19xx)(-).zip
    361,591 Spectrum Games Compilation 03 (19xx)(-).zip
    395,804 Spectrum Games Compilation 04 (19xx)(-).zip
    405,580 Spectrum Games Compilation 05 (19xx)(-).zip
    377,544 Spectrum Games Compilation 06 (19xx)(-).zip
    429,309 Spectrum Games Compilation 07 (19xx)(-).zip
    386,842 Spectrum Games Compilation 08 (19xx)(-).zip
    344,096 Spectrum Games Compilation 09 (19xx)(-).zip
    411,021 Spectrum Games Compilation 10 (19xx)(-).zip
    393,055 Spectrum Games Compilation 11 (19xx)(-).zip
    404,949 Spectrum Games Compilation 12 (19xx)(-).zip
    294,885 Spectrum Games Compilation 13 (19xx)(-).zip
    257,449 Spectrum Games Compilation 14 (19xx)(-).zip
    381,523 Spectrum Games Compilation 15 (19xx)(-).zip
    357,411 Spectrum Games Compilation 16 (19xx)(-).zip
    317,092 Spectrum Games Compilation 17 (19xx)(-).zip
    428,437 Spectrum Games Compilation 18 (19xx)(-).zip
    365,316 Spectrum Games Disk 01 (19xx)(-)(128K).zip
    406,695 Spectrum Games Disk 02 (19xx)(-)(128K).zip
    371,958 Spectrum Games Disk 03 (19xx)(-)(128K).zip
    273,951 Spectrum Games Disk 04 (19xx)(-)(128K).zip
    481,772 Spectrum Games Disk 05 (19xx)(-)(128K).zip
    359,377 Spectrum Games Disk 06 (19xx)(-)(128K).zip
    302,423 Spectrum Games Disk 07 (19xx)(-)(128K).zip
    366,130 Spectrum Games Disk 08 (19xx)(-)(128K).zip
    390,170 Spectrum Games Disk 09 (19xx)(-)(128K).zip
    362,738 Spectrum Games Disk 1 (19xx)(-)(48K).zip
    364,071 Spectrum Games Disk 10 (19xx)(-)(128K).zip
    332,015 Spectrum Games Disk 11 (19xx)(-)(128K).zip
    122,077 Spectrum Games Disk 12 (19xx)(-)(128K).zip
    331,445 Spectrum Games Disk 2 (19xx)(-)(48K).zip
    330,171 Spectrum Games Disk 3 (19xx)(-)(48K).zip
    345,669 Spectrum Games Disk 4 (19xx)(-)(48K).zip
    325,070 Spectrum Games Disk 5 (19xx)(-)(48K).zip
    286,402 Spectrum Games Disk 6 (19xx)(-)(48K).zip
  • edited May 2010
    Tom-Cat wrote: »
    I have upped the tosec Spectrum games for Sam Coupe here ... there are a coupe of 128k compliations there too... 12Mb big pack. Hope none of them are denied, don't have an emulator here to look...

    http://pc.sux.org/tomcat/SamCoupeSpectrumGames.zip

    I load all this games... and this is result:
    - this is games for ZX Spectrum 48kB with additional AY sound/music
    - some games signed as 128kB is on ZX Spectrum signed as 48/128 compatible or it's remix of 48 games with AY music
    - I see only three full conversions of 128kB games (ROBOCOP 2,MYSTICAL and PANG)

    My result: On SAM COUPE exist very small part of true conversions of original ZX128kB games (no remix or 48/128kB compatible games). With existing hardware is possible run ZX128 games only if 1MB memory is connect.

    http://velesoft.speccy.cz/samcoupe_1mb-cz.htm

    1mb-mem-czech_top.jpg
  • edited May 2010
    Next version of SNAPER 2010 v002beta:

    MENU
    snaper-2010-v002beta-2.png
    Menu contain new feature - possibility set position of CPU interrupt in screen area. Default value is 0 = interrupt will on first screen line. But some sprites in ZX games can flash (SAM use different timing). This can be eliminate via set INTERRUPT AT LINE 191 (as on russian ZX clone PENTAGON...). For example game NAVY SEALS 1 after start show incorrect graphic. After set interrupt at line 191 game graphic is ok. All 48kB SNApshots can be started in SAM ram (don't need 1MB memory) in slow mode, or started in fast 1MB memory at full 6MHz. All 128kB SNA files run always in 1MB memory at 6.0 MHz. Games is faster than on real ZX Spectrum. But more games use correct timing via interrupt 50Hz then games work correct. 3D games work faster than on ZX :-)

    SELECT COLOR PALETTE
    snaper-2010-v002beta-1.png

    Screenshot of game EXOLON with GREY palette
    snaper-2010-v002beta-3.png

    Direct link to SNAPER 2010 - v002
    http://velesoft.speccy.cz/other/snaper-2010-v002beta.zip

    This new SNAPER version can modify color palette, set interrupt position on screen, can run 48kB SNApshots in 6.0MHz mode.
    From basic line 3000 (step 20) begin data of color palettes. At first line must be name of palette, on other lines is values of colors 0-15. You can add at lines 3080,3100,3120,... data of your new palettes. This is complette colour table with values for data:
    samcoupe-palette-values.png

    SIMCOUPE emulator also support external 1MB memory. It's way for SAM users without real hardware..
    simcoupe-1mb.png
  • edited May 2010
    velesoft wrote: »
    This source code for SAM COUPE contain also AY-3-8912 to SAA1099 convertor...

    http://home.earthlink.net/~simoncooke/samcoupe/infobase/source/htbtter.txt

    There's been a bit of discussion over at WoSAM and there is source and the translation table to download:

    http://www.worldofsam.org/node/670

    Dan.
  • edited May 2010
    Screenshots of ZX games on SAM COUPE with new color palette:

    SUBACUATIC:
    subacuatic1.png
    subacuatic2.png
    subacuatic3.png
    subacuatic4.png
    subacuatic5.png

    CYBERNOID 2
    cybernoid2-sam.png

    EXTREME
    extreme-sam.png

    Color palettes used in this ZX games are inspired by screenshots on this web page:
    http://sites.google.com/site/ulaplus/

    And this is my palette editor for ZX screen:
    palette-editor-sam.png

    Add new palette editor in SNAPER:
    snaper-palette-editor.png
  • edited June 2010
    DOWNLOAD FULL VERSION (+ some games on disc)

    http://velesoft.speccy.cz/other/snaper-2010-v0_3.zip

    Main menu:
    snaper03-1.png

    Select palette for games:
    snaper03-2.png

    Help:
    snaper03-3.png

    Comfortable palette editor with possibility create new palettes:
    snaper03-4.png

    Before start SNA file can show Z80 registers:
    snaper03-5.png

    Select SNA file from disc: (autodetect SNA file 48/128kB from file structure):
    snaper03-6.png

    ZX games with palette ported from ULA PLUS:
    snaper03-hz.png
    snaper03-sgt.png
    snaper03-subar1.png
    snaper03-exolon.png
  • edited September 2010
    OFFICIAL RELEASE of SNAPER for SAM COUPE

    http://velesoft.speccy.cz/sam_zx128.htm
  • JmkJmk
    edited September 2010
    It's getting better, just needs a magical sound chip... I wonder if certain patterns of bytes could be searched for and then patched to call the SAA converter which could be hidden somewhere in 0-16383 (or just a routine there to bank in another page and then call it)?

    I suspect it could get quite complicated.

    Here is something to practice with (I didn't check for your particular snapshots, just checked while the game was running) ;)

    Exolon:
    49009 LD BC,65533
    49012 OUT (C),A
    49014 LD B,191
    49016 OUT (C),H

    Sgt Helmet Zero:
    Slightly odd routine at 49650 in page 1.

    Subaquatic 1 & 2:
    Almost the same routine as Sgt Helmet Zero at 49650, page 1.
  • edited September 2010
    http://cid-1c842d5b23e1e0e2.office.live.com/self.aspx/.Public/zx%20spectrum/system.IMG


    load p5
    is tasword basic
    theres three tap files on the tascon+d conversion tape
    this also has teh +d tape setup files stored for alterations to the disc drive seti
    please help
    tasword +2 converted with tascon +d wot work in sam coupe due to ram paging differences any one help please?
    setup

    velesoft already converted f-16 chunky verison for sam?
    -but not torun in 1mb or use mode 2 yet...
Sign In or Register to comment.