RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Any progress being made with ZX81 emulation?

    Scheduled Pinned Locked Moved Help and Support
    zx81lr-81
    28 Posts 2 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JimmyFromTheBay @Folly
      last edited by JimmyFromTheBay

      @Folly Many thanks yet again :) Would editing the script to something like this called sz80.sh

      #!/usr/bin/env bash
      
      # This file is part of The RetroPie Project
      #
      # The RetroPie Project is the legal property of its developers, whose names are
      # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
      #
      # See the LICENSE.md file at the top-level directory of this distribution and
      # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
      #
      
      rp_module_id="sz80"
      rp_module_desc="Sinclair ZX80 emulator"
      rp_module_help="ROM Extensions: .o .p .80 .81\n\nCopy your ZX80 roms to $romdir/zx80\n\n
          Exit          - Exit emulator (F10)\n
          Reset         - Reset emulator (F12)\n\n
      Read the README files for more information\n
          
      "
      rp_module_licence="GPL2 https://github.com/SegHaxx/sz81/blob/main/README"
      rp_module_repo="git https://github.com/SegHaxx/sz81.git main"
      rp_module_section="exp"
      
      function sources_sz81() {
          gitPullOrClone
      }
      
      function build_sz81() {
          make clean
          make
          md_ret_require="$md_build/sz81"
      }
      
      function install_sz81() {
          md_ret_files=(
              "."
          )
      }
      
      function configure_sz81() {
          mkRomDir "zx80"
          defaultRAConfig "zx80"
      
          addEmulator 1 "$md_id" "zx80" "pushd $md_inst; $md_inst/sz81 -f %ROM%; popd"
          addSystem "zx80"
      }
      

      Install another instance of it labelled SZ80 that might run the ZX80 games? (I have really zero idea how scripts work.)

      Raspberry Pi 3b and 8GB Raspberry Pi 4, both running Retropie 4.7.1 installed from scratch using Raspberry Pi Imager, with wired keyboard, wireless mouse and double arcade joystick attached.

      F 4 Replies Last reply Reply Quote 0
      • F
        Folly @JimmyFromTheBay
        last edited by

        @JimmyFromTheBay said in Any progress being made with ZX81 emulation?:

        Would editing the script to something like this

        Nice try, though I would try to do both zx80 and zx81 in one script.
        However, the difficult part would be the config file.
        If the same emulator is used for both systems and the same config file is used then if will not always boot into the proper system.
        So when you select zx80 you want to boot into zx80 and not in zx81.
        It's the same vice-versa, got it ?

        I will have a look if we can use separate configs.

        1 Reply Last reply Reply Quote 0
        • F
          Folly @JimmyFromTheBay
          last edited by

          @JimmyFromTheBay

          BTW.
          Did you try altering the video-mode in the runcommand launch menu for displaying the emulator screen properly or better ?

          J 1 Reply Last reply Reply Quote 0
          • F
            Folly @JimmyFromTheBay
            last edited by Folly

            @JimmyFromTheBay said in Any progress being made with ZX81 emulation?:

            (I have really zero idea how scripts work.)

            I would suggest you read this :
            https://www.freecodecamp.org/news/how-to-learn-linux-terminal-as-a-beginner/
            and this :
            https://www.freecodecamp.org/news/shell-scripting-crash-course-how-to-write-bash-scripts-in-linux/

            There are many more sites on the internet to find.

            Terminal commands can be used in a bash script.
            RetroPie is a collection of bash scripts and are basically tied together.
            For beginners the most difficult part is how these scripts work.
            I had the same issue when starting to write module-scripts.
            (A module-script is basically 1 script of the collection of RetroPie scripts.)
            The most important thing is to recognize that a module-script contains functions and also that it uses functions.
            Also variable are used.
            These functions and variables are made and used to simplify the scripts so they can be used in more module-scripts.
            Most functions can be found in the RetroPie-Setup/scriptmodules/helpers.sh.
            That is basically the summary.

            Have a look and hopefully you will understand it better now.

            You can experiment with it testing just 1 function in a module-script.
            Lets say you only want to test the function sources_sz81 from the sz81.sh :

            function sources_sz81() {
                gitPullOrClone
            }
            

            Then you can go into the terminal and do :

            cd
            cd Retropie-Setup
            sudo ./retropie_packages sz81 sources
            

            It will then download the sz81 source code, using the gitPullOrClone function, and places it in :
            ~/RetroPie-Setup/tmp/build/sz81
            If you want to remove source code for sz81 then you can use :

            sudo ./retropie_packages sz81 clean
            

            You can just do a test in the sources_sz81 function and replace gitPullOrClone with something like :

            echo "hello world"
            

            Then if you do :

            sudo ./retropie_packages sz81 sources
            

            Instead it will output :
            hello world

            So you can test every function one by one (and add stuff in there just to test) :

            sudo ./retropie_packages sz81 depends (if it's there)
            sudo ./retropie_packages sz81 sources
            sudo ./retropie_packages sz81 build
            sudo ./retropie_packages sz81 install
            sudo ./retropie_packages sz81 configure
            sudo ./retropie_packages sz81 clean
            

            This, however, will execute all functions in one go :

            sudo ./retropie_packages sz81
            

            Just like when running it from the retropie_setup.

            1 Reply Last reply Reply Quote 1
            • F
              Folly @JimmyFromTheBay
              last edited by Folly

              @JimmyFromTheBay

              Seems it wasn't possible to make one script because of not being able to load the config as an option.
              So I created a separate module-script for zx80 just like you suggested :
              https://github.com/FollyMaddy/RetroPie-Share/blob/main/00-scriptmodules-00/emulators/sz80.sh

              It patches the source code to make use of a different config directory (.sz80 instead of sz81)

              Read the help.
              First time it will boot in zx81 by default.
              Change the it by clicking the config icon inside the emulator and save the config.

              J 1 Reply Last reply Reply Quote 1
              • J
                JimmyFromTheBay @Folly
                last edited by

                @Folly Works! Fantastic! ZX80 games! Thank you! :)

                Raspberry Pi 3b and 8GB Raspberry Pi 4, both running Retropie 4.7.1 installed from scratch using Raspberry Pi Imager, with wired keyboard, wireless mouse and double arcade joystick attached.

                1 Reply Last reply Reply Quote 0
                • J
                  JimmyFromTheBay @Folly
                  last edited by

                  @Folly said in Any progress being made with ZX81 emulation?:

                  @JimmyFromTheBay

                  BTW.
                  Did you try altering the video-mode in the runcommand launch menu for displaying the emulator screen properly or better ?

                  Yes, can't get it to make any difference.

                  Raspberry Pi 3b and 8GB Raspberry Pi 4, both running Retropie 4.7.1 installed from scratch using Raspberry Pi Imager, with wired keyboard, wireless mouse and double arcade joystick attached.

                  F 2 Replies Last reply Reply Quote 1
                  • F
                    Folly @JimmyFromTheBay
                    last edited by

                    @JimmyFromTheBay

                    I tested hero and had exactly the same image.
                    I will add that second option to the script that you suggested.

                    1 Reply Last reply Reply Quote 1
                    • F
                      Folly @JimmyFromTheBay
                      last edited by

                      @JimmyFromTheBay

                      A suggestion is to read the manual.
                      It can be found in the folder manual in the source.

                      Found that it can also do Chroma.
                      So games that have color will work too.

                      Here are some examples :
                      Wall.png
                      Rebound.png

                      In the Makefile you can also add more, ZXPAND is an example which is an external addon.
                      It seems to be working but I do not know yet where to put the SD-card files

                      J 1 Reply Last reply Reply Quote 0
                      • J
                        JimmyFromTheBay @Folly
                        last edited by

                        @Folly Ooh, getting ZXPAND in would be great, because then Zedragon II would work, and maybe the DK'Tronics version of Space Invaders by Jeff Minter.

                        Raspberry Pi 3b and 8GB Raspberry Pi 4, both running Retropie 4.7.1 installed from scratch using Raspberry Pi Imager, with wired keyboard, wireless mouse and double arcade joystick attached.

                        F 1 Reply Last reply Reply Quote 0
                        • F
                          Folly @JimmyFromTheBay
                          last edited by Folly

                          @JimmyFromTheBay

                          When also doing the ZX81-ZXPAND I think the approach should be similar as what we did with zx80.

                          • rename the function names
                          • do the same patch as in zx80 to separate the config file for the zxpand version
                          • patch the makefile so the option -zxpand will be added for compiling the emulator with xzpand
                          • edit the help part if we know where to put the sdcard files for zxpand
                          • edit where the configure part so the binary is saver in a different folder than the standar sz81 emultor and edit where the runcommands go to and how they are called

                          Looking at the previous module-scripts I made, would you be able to make the module-script for zxpand now ?

                          J 1 Reply Last reply Reply Quote 0
                          • J
                            JimmyFromTheBay @Folly
                            last edited by JimmyFromTheBay

                            @Folly

                            • What is the "makefile"?

                            • What are the "sdcard files" for ZXPAND?

                            • "edit where the configure part so the binary is saver in a different folder than the standar sz81 emultor" - is that referring to these lines?

                            function sources_sz80() {
                                gitPullOrClone
                                #patch and change the config directory for ZX80
                                sed -i 's/\"\.sz81\"/\"\.sz80\"/g' "sdl_resources.h"
                            

                            Because I have NO idea what that's all about, or what the different slashes mean. There basically isn't one part of that last line I understand :(

                            So it looks like the answer to your question, sadly, is "Hell no" :D

                            Raspberry Pi 3b and 8GB Raspberry Pi 4, both running Retropie 4.7.1 installed from scratch using Raspberry Pi Imager, with wired keyboard, wireless mouse and double arcade joystick attached.

                            F 1 Reply Last reply Reply Quote 0
                            • F
                              Folly @JimmyFromTheBay
                              last edited by Folly

                              @JimmyFromTheBay said in Any progress being made with ZX81 emulation?:

                              @Folly

                              • What is the "makefile"?

                              Here you can find what makefiles do.

                              The sourcecode of sz81 is here.
                              You will notice the Makefile.
                              I highlighted these lines to give you an impression on what can be added to the CFLAGS in order to compile the source code with for example zxpand.
                              To add zxpand it has to be added in the line 40 :
                              .... -D_DZ80_EXCLUDE_SCRIPT -DZXPAND

                              • What are the "sdcard files" for ZXPAND?

                              I am not an expert on zxpand but it seems that program files are loaded from sdcard.
                              More info about zxpand can be found here.
                              You can also read that the SZ81 emulator can emulate the ZXpand+. To run a ZXpand-compatible program, you have to put the P file and its .wad file in the ZXpand_SD_Card folder.

                              • "edit where the configure part so the binary is saver in a different folder than the standar sz81 emultor" - is that referring to these lines?
                              function sources_sz80() {
                                  gitPullOrClone
                                  #patch and change the config directory for ZX80
                                  sed -i 's/\"\.sz81\"/\"\.sz80\"/g' "sdl_resources.h"
                              

                              no,
                              I meant :
                              function configure_sz80()

                              What you mention is sources part , look at the function name.

                              Because I have NO idea what that's all about, or what the different slashes mean. There basically isn't one part of that last line I understand :(

                              You can read more about what the program sed does over here.

                              So it looks like the answer to your question, sadly, is "Hell no" :D

                              Haha, I understand.
                              In the beginning it's all garbage.
                              Try to read the stuff I send you.
                              Hope you will understand it a little bit better.

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                              Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.