• Error when running z80pack with -x option

    From Paolo Amoroso@21:1/5 to All on Tue Oct 26 12:00:06 2021
    Is the -x filename option of the z80pack CP/M emulation scripts supposed to boot CP/M and run the filename executable program? If so, I have an issue with -x.

    Here's a Linux shell session in which I try to run the te screen editor by Miguel Garcia:


    paoloamoroso@penguin:~/cpm/sim$ ./cpm2 -x te.com

    ####### ##### ### ##### ### # #
    # # # # # # # # ## ##
    # # # # # # # # # # #
    # ##### # # ##### ##### # # # #
    # # # # # # # # #
    # # # # # # # # # #
    ####### ##### ### ##### ### # #

    Release 1.37, Copyright (C) 1987-2021 by Udo Munk

    CPU speed is unlimited, CPU executes undocumented instructions
    Loader statistics for file te.com:
    START : FFFFH
    END : 0000H
    LOADED: 0002H (2)


    Booting...

    INT disabled and HALT Op-Code reached at 7704
    paoloamoroso@penguin:~/cpm/sim$


    Executing the same command with the -f option results in a different error, and sometimes the session hangs at Booting... (omitting the banner and version number for brevity):


    paoloamoroso@penguin:~/cpm/sim$ ./cpm2 -f4 -x te.com

    [...]

    CPU speed is 4 MHz, CPU executes undocumented instructions
    Loader statistics for file te.com:
    START : FFFFH
    END : 0000H
    LOADED: 0002H (2)


    Booting...

    E (1535) system: Op-code trap at e91b fd f5
    paoloamoroso@penguin:~/cpm/sim$


    The error happens with any CP/M program. The same executable files that cause an error with -x run fine when copied to a disk image and invoked from CCP.

    I'm using z80pack on Crostini Linux, the Chrome OS Linux container that currently runs Debian Buster. z80pack otherwise works great with the same setup.

    Any insight or suggestions? Am I using the -x option or the argument incorrectly?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Udo Munk@21:1/5 to All on Tue Oct 26 12:11:03 2021
    With option -x the code gets loaded and executed, there is no CP/M and the program will
    run off.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paolo Amoroso@21:1/5 to All on Tue Oct 26 12:53:18 2021
    Thanks Udo, I misunderstood what -x does. I thought cpmsim booted CP/M and passed the -x argument to the operating system for execution, instead it runs the argument in a Z80 system with no operating system environment.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Udo Munk@21:1/5 to All on Tue Oct 26 14:49:36 2021
    Correct, you can use -x to load a monitor or some other boot code, passing arguments to CP/M for execution
    after cold boot is not implemented in the OS.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paolo Amoroso@21:1/5 to All on Wed Oct 27 00:59:17 2021
    I thought the z80pack -x option worked like the CP/M emulator by Joe Allen[1], which can take an executable .com file as a command line argument and run it inside the CP/M environment.


    [1] https://github.com/jhallen/cpm

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Udo Munk@21:1/5 to All on Fri Oct 29 04:00:17 2021
    If you want that prepare a modified CP/M without cold boot, that jumps to 0100H instead
    of into the CCP and load it together with the CP/M program. Also setup DI!HLT @ 0 instead
    of the usual JMP, probably no point in warm booting if the program terminates.

    BTW, the -x option can load files in Intel Hex or Mostek binary format, not a plain binary.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dott.Piergiorgio@21:1/5 to Udo Munk on Fri Nov 5 13:57:25 2021
    On 29/10/21 13:00, Udo Munk wrote:
    If you want that prepare a modified CP/M without cold boot, that jumps to 0100H instead
    of into the CCP and load it together with the CP/M program. Also setup DI!HLT @ 0 instead
    of the usual JMP, probably no point in warm booting if the program terminates.

    BTW, the -x option can load files in Intel Hex or Mostek binary format, not a plain binary.


    Aside that is easy to get (or cobble together...) a bin2hex converter, I
    think that a binary loader isn't a bad addition, the only complication
    being that the switch need two parameters (the binary file and its
    address in memory)

    Best regards from Italy,
    dott. Piergiorgio.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Udo Munk@21:1/5 to dott.Piergiorgio on Fri Nov 5 08:09:23 2021
    dott.Piergiorgio schrieb am Freitag, 5. November 2021 um 13:57:27 UTC+1:
    Aside that is easy to get (or cobble together...) a bin2hex converter, I think that a binary loader isn't a bad addition, the only complication
    being that the switch need two parameters (the binary file and its
    address in memory)

    That is why z80pack includes a bin2hex in cpmsim/srctools.
    And that is why it loads Intel hex and Mostek binary, because theses include load address(es).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paolo Amoroso@21:1/5 to All on Fri Nov 12 07:13:22 2021
    After running a program with the -x option, is there any way of inspecting the machine state such as the contents of the registers or memory?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Udo Munk@21:1/5 to paolo....@gmail.com on Fri Nov 12 07:51:37 2021
    paolo....@gmail.com schrieb am Freitag, 12. November 2021 um 16:13:24 UTC+1:
    After running a program with the -x option, is there any way of inspecting the machine state such as the contents of the registers or memory?

    Yes, with option -s the complete machine state, registers and 64KB memory of bank 0 are written
    into a file core.z80 which can be inspected.
    For post mortem analysis z80sim -l is helpful, with the ICE it is possible to look at CPU registers
    and memory that were saved into a core.z80 file.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paolo Amoroso@21:1/5 to All on Fri Nov 12 07:57:16 2021
    Thanks, I see the core.z80 dump generated by the -s option is a binary file. Is it in a standard file format I can inspect with some tool?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Udo Munk@21:1/5 to paolo....@gmail.com on Fri Nov 12 08:21:52 2021
    paolo....@gmail.com schrieb am Freitag, 12. November 2021 um 16:57:17 UTC+1:
    Thanks, I see the core.z80 dump generated by the -s option is a binary file. Is it in a standard file format I can inspect with some tool?

    The binary file just contains the CPU registers and memory contents. As I said, it can be loaded with -l
    into z80sim and then CPU registers and memory can be inspected. Or you can write your own tools,
    the file format is trivial, for order of contents see here: https://github.com/udo-munk/z80pack/blob/master/z80core/sim0.c
    Functions save_core() and load_core().

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paolo Amoroso@21:1/5 to All on Sun Nov 14 03:47:41 2021
    When I start the emulator with the -l option, it exits to the shell after running the code in the loaded core file, so I'm not sure to inspect the registers or memory. However, I wrote some Bash scripts[1] for inspecting z80pack core files.


    [1] https://groups.google.com/g/comp.os.cpm/c/T6Aj_XciVnY/m/kJ6CEPvnBwAJ

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paolo Amoroso@21:1/5 to All on Sun Nov 14 05:12:55 2021
    Got it, you're of course right. I was running cpmsim instead of z80sim.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Udo Munk@21:1/5 to paolo....@gmail.com on Sun Nov 14 04:28:50 2021
    paolo....@gmail.com schrieb am Sonntag, 14. November 2021 um 12:47:42 UTC+1:
    When I start the emulator with the -l option, it exits to the shell after running the code in the loaded core file, so I'm not sure to inspect the registers or memory. However, I wrote some Bash scripts[1] for inspecting z80pack core files.

    Which simulation are you using? You need to build and use z80sim included in z80pack,
    it will not start running anything, also not with option -l. At the prompt type ? for help.

    The other emulation will continue to execute the saved machine state when used with option -l.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)