Jump to content
IGNORED

How do I inspect the contents of RAM in jzintv?


emerson

Recommended Posts

As the title states, I would like to inspect the contents of RAM in jzintv. Where does IntyBasic assign variables? How can I view them?

 

edit: I am using IntyBasic SDK v1.1.1 with IntyBasic compiler v1.2.9

Edited by emerson
Link to comment
Share on other sites

IntyBASIC assigns variables in the order they are found in the BASIC program, with internal assembler syntax V1 .. Vnn etc. The 8-bit ones are placed in the scratch memory at $0100 and the 16-bit ones in the system memory at $02F0.

 

In order to enable debugging and also get to see exactly which address each variable was located to, follow these steps:

  • intybasic program.bas program.asm
  • as1600 -j program.smap -s program.sym -o program.bin -l program.lst program.asm
  • intysmap program.smap
  • jzintv -d program.bin --src-map=program.smap --sym-file=program.sym
Replace file names as requirred. Probably the SDK already has a script for enabling compile with debug info?

 

In the file program.lst you will be able to find the exact address of each variable.

 

Here is a command summary about the debugger in jzintv, quoted from the documentation:

 

    S<#>        Step <#> cycles, showing execution trace.
    R<#>        Run <#> cycles, suppressing execution trace.
    T           Run until JSR returns.  Works only if no data after JSR.
    D           Dump logs to disk
    B<#>        set Breakpoint at <#>
    N<#>        uNset breakpoint at <#>
    M<a> <#>    Show <#> words of memory around <a>.  <#> defaults to 64.
    U<a> <#>    uNassemble <#> instructions at <a>.  <#> defaults to 16.
    E<a> <#>    Enter the value <#> into address <a>.  Triggers side effects.
    P<a> <#>    Poke the value <#> into address <a>.  May update ROM.
    G<r> <#>    set reGister <r> to value <#>.
    H           toggle History logging
    W<a> <b>    toggle Watch status on addressed <a> through <b>.
    A           toggle memory Attribute discovery

So once in the emulator, type R to start the program or if you like to set a breakpoint first, then use F4 to return to the debugger and the M command to check memory contents. It should be said the addresses are given without any prefix, so M02F0 will show the content starting at $02F0.

 

The majority of this information was gathered from the IntyBASIC manual and the jzintv manual. I just verified that it works as described.

Edited by carlsson
  • Like 1
Link to comment
Share on other sites

When I tried using the debugger before I was using 'm 0100 0100' and 'm 0200 0200' (assuming thats where the variables were placed) and did not see the values I expected, so maybe my code is bad. I will follow your instructions and report back with my results.

 

Thank you for the detailed write-up carlsson!

Link to comment
Share on other sites

When I tried using the debugger before I was using 'm 0100 0100' and 'm 0200 0200' (assuming thats where the variables were placed) and did not see the values I expected, so maybe my code is bad. I will follow your instructions and report back with my results.

 

Thank you for the detailed write-up carlsson!

m 0200-02EF is screen memory

m 02F0-0307 is the 24 byte of stack(where it holds the memory address of your procedure go and varies stuff unknown to me). And your 16-bit variable starts at 0x308.

 

Open up the .lst file and scroll to the bottom to see what address your variables are placed.

Link to comment
Share on other sites

So I figured out my problem. It turns out I was quitting program execution before my code wrote to the variables. Everything seems to work fine now. Thanks to both of you for verifying the necessary steps and providing the variable addresses.

  • Like 2
Link to comment
Share on other sites

BTW, if you follow the directions in #2, and set your terminal width to 160 characters or wider, jzIntv's debugger will show the BASIC code next to the disassembled code. This can make it easier to debug your BASIC program. If you're in Windows, you might need to issue a command like >160 to jzIntv to widen the window, as it cannot detect window sizes very reliably in Windows.

  • Like 1
Link to comment
Share on other sites

IntyBASIC assigns variables in the order they are found in the BASIC program, with internal assembler syntax V1 .. Vnn etc. The 8-bit ones are placed in the scratch memory at $0100 and the 16-bit ones in the system memory at $02F0.

 

In order to enable debugging and also get to see exactly which address each variable was located to, follow these steps:

  • intybasic program.bas program.asm
  • as1600 -j program.smap -s program.sym -o program.bin -l program.lst program.asm
  • intysmap program.smap
  • jzintv -d program.bin --src-map=program.smap --sym-file=program.sym
Replace file names as requirred. Probably the SDK already has a script for enabling compile with debug info?

 

In the file program.lst you will be able to find the exact address of each variable.

 

Here is a command summary about the debugger in jzintv, quoted from the documentation:

 

    S<#>        Step <#> cycles, showing execution trace.
    R<#>        Run <#> cycles, suppressing execution trace.
    T           Run until JSR returns.  Works only if no data after JSR.
    D           Dump logs to disk
    B<#>        set Breakpoint at <#>
    N<#>        uNset breakpoint at <#>
    M<a> <#>    Show <#> words of memory around <a>.  <#> defaults to 64.
    U<a> <#>    uNassemble <#> instructions at <a>.  <#> defaults to 16.
    E<a> <#>    Enter the value <#> into address <a>.  Triggers side effects.
    P<a> <#>    Poke the value <#> into address <a>.  May update ROM.
    G<r> <#>    set reGister <r> to value <#>.
    H           toggle History logging
    W<a> <b>    toggle Watch status on addressed <a> through <b>.
    A           toggle memory Attribute discovery

So once in the emulator, type R to start the program or if you like to set a breakpoint first, then use F4 to return to the debugger and the M command to check memory contents. It should be said the addresses are given without any prefix, so M02F0 will show the content starting at $02F0.

 

The majority of this information was gathered from the IntyBASIC manual and the jzintv manual. I just verified that it works as described.

 

 

The SDK has a command "INTYDBUG" that invokes the debugger with all the appropriate symbol and listing files and command line options. Check out the "IntyBASIC SDK Tools Usage Guide" in the "Documents" folder of the SDK. It should even set it up for source-level debugging with the IntyBASIC source and symbols.

 

Others have already stated how to use the debugger itself.

 

-dZ.

Link to comment
Share on other sites

By the way, the IntyBASIC SDK also includes a tool called "INTYTEST" which will combine "INTYBUILD" with "INTYDBUG" so that you can build and test in one go.

 

The document "IntyBASIC SDK Tools Usage Guide" that comes with the SDK should provide all the details on how to use these tools.

 

-dZ.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...