MEGA65 / mega65-tools

Tools and Utilities for the MEGA65 Retro Computers
GNU General Public License v3.0
29 stars 31 forks source link

M65: Injecting a basic prg with m65 not working properly #40

Closed hstampfl closed 3 years ago

hstampfl commented 3 years ago

Injecting a BASIC V10 prg with m65 tool does not get correctly injected. The program get transfered and it correctly starts, but editing the program crashes the mega65.

This issue was not seen before because an assembly program mostly won't be edited after executing.

See more details on discord: https://discord.com/channels/719326990221574164/795760112425369610/809155791718187060

Use following steps to reproduce:

  1. unzip and transfer attached program with m65 (on windows: m65 -l COMxxx -F -r rasterwait.prg)
  2. Press RUN/STOP
  3. Execute LIST
  4. Edit last Line and press RETURN
  5. You should see an similar screen as attached screenshot.
  6. mega65-screen-basic_injection_issue

rasterwait.zip

Edilbert commented 3 years ago

After transferring the program, the pointer "text_top" ($82/$83) must be set to the end of the program text. It is the same value, like the (eal/eah) = End Address Load = ($ae/$af). The editor needs this information, if not set to the correct value, the editor will produce strange results or crash. The fix is, that the transfer program sets this pointer "text_top".

gardners commented 3 years ago

In theory this should be correctly handled by having the X and Y registers loaded with the top address of the LOAD. But now that we trap the LOAD vector in a more generic manner (see commit for fixing issue #2 ), we probably need to set this directly.

gardners commented 3 years ago

Seems to be fixed by the above.

gurcei commented 3 years ago

I've confirmed that this has resolved the issue.