Zap Disassemble
Steffen Huber (91) 1953 posts |
So who is going to fork James’ Zap GitHub repo and takes over coordination of all the Zap fixes floating around? |
Rick Murray (539) 13850 posts |
Not touching DebuggerPlus. ;-) However…
Yes, that is rather unpleasant. It would have been much better if some sort of identification flag could have been presented to Zap. My plan, given that:
It looks like the code switch does a lot more than toggle DebuggerPlus. Zap pretty much works with both (trying the Plus, and falling back if that didn’t work). I think, without that switch, the Assembler mode is stupid and barely different to a straight output from Debugger. :-/ The problem for ZapBASIC was a side effect. A function calls the Debugger to get the current instruction as text. It then calls another function which checks the module version and, if present, does an undocumented (?) SWI (that Debugger_63 again). This also happens in Zap. Unfortunately in ZapBASIC, most of the function that deals with setting up the minibuffer is on a VC conditional, and the failing SWI sets V. So I’ve left the version number checking alone for now and simply disabled the code that would have set V. This may or may not break use with DebuggerPlus on 26 bit systems, but I’m not bothered as these builds are not aimed there…
That’s not a good fix, though, as it is just pushing a possible problem until further down the line. Granted, both RISC OS and myself may cease existing before v3.xx is reached, but still. ;-)
I’ve downloaded it, and am dealing with the filename mess (comma filetype suffix) as the need arises. It’s not a managed repository, it’s a directory on my SD card…
My versions are based upon tim-01 which I believe is the most recent prior. I left things for a while to see if somebody who has already played with Zap would be willing to continue… silence. So I guess it’ll be me. But there’s no repo and nor will there be (never got the damned things to work with RISC OS). If you want a zip of all the sources in a DDE buildable form, just ask. I’ve not done one yet as most of the extensions are in Git-munged form. Stuff that still needs to be sorted out… So: Here’s my update that works with a faked Debugger v2.50. Zap and ZapRedraw should be the same so you can ignore these if you picked up rick-01 yesterday. |
Rick Murray (539) 13850 posts |
The Zap distro from GitHub is a horrible mess due to the issue of filetypes not being known on non-FileCore systems. To aid with this, has anybody written a utility that will take a bunch of files (recursive into subdirectories) that has names like thingy,fff and whatever,fec and strip the comma-stuff and apply the indicated filetype? |
edwardx (1628) 37 posts |
Lua: local dir, sys in (require "riscos") local function set_type(pathname, filetype) assert(0 <= filetype and filetype <= 0xFFF, "Filetype out of range") local e, err_msg = sys("OS_File", 18, pathname.."\0", filetype) if not e then return nil, err_msg end return true end local function rename(pathname, new_pathname) local e, err_msg = sys("OS_FSControl", 25, pathname.."\0", new_pathname.."\0") if not e then return nil, err_msg end return true end local function set_types(dirname) for leaf, ftype in dir(dirname) do local pathname = dirname.."."..leaf if ftype == 0x1000 or ftype == 0x2000 then set_types(pathname) else local name, ftype2 = leaf:match("^(.+),(%x%x%x)$") if name then if set_type(pathname, tonumber(ftype2, 16)) then rename(pathname, dirname.."."..name) end end end end end set_types(arg[1]) |
John McCartney (426) 148 posts |
Nick Roberts’ Rename has a built-in function to strip ,xyz from filenames. |
Colin Ferris (399) 1818 posts |
Rename – is able to change say ‘file.txt’ to ‘file’ and sets the file type to &FFF. |
Rick Murray (539) 13850 posts |
Thanks for that. I probably would have taken ages to work out the syntax, but it had a ready-made example to do exactly what was necessary. The next questions:
This is because MakeMenus and MenuConf never got translated to 32 bit, so editing the menus is more annoying than it would otherwise be; and both of these programs refer to weirdo libraries that I’ve never heard of before… If anybody would like a copy of the Zap font editor Zed, I’ve built a copy and placed it at http://heyrick.ddns.net/files/zap-zed.zip |
Rick Murray (539) 13850 posts |
I think I’ve found the sources to libgnu at http://zap.tartarus.org/downloads/ds/GNU/32/src/ (libgnu.zip) but I can’t build them as the latest AOF compatible version of GCC is broken (alignment checking ON it reports “ Useful. If I can’t find 32 bit friendly versions of these libraries (which surely exist as the other configuration tools have been converted), I’ll need to give up on this. |
Colin Ferris (399) 1818 posts |
Thanks for all the help with Zap VRPC-DL RO5.25. I did try changing the module number to 1.99 in the ROM – but ended up with a red screen at startup – does the ROM do a check on startup? Ended up putting a 1.99/2.02 Debugger module in predesk. When starting up in RO4.02 mode – Debugger Plus gets loaded. (if needed I have a If32bit and If26bit utils in the Library dir) If Rick can’t find the Libs he is looking for – perhaps FF8 ‘MakeMenus’ & FF8 ‘MenuConf’ can be ‘what I call hand patched’ to 32bit. |
Rick Murray (539) 13850 posts |
It may do a CRC or checksum?
There’s an option in the configuration to toggle whether or not it gets loaded. Iconbar menu → Misc → Autoload.
I doubt it. They’re written in C, and converting 26 bit CLib to 32 bit CLib is somewhat different to patching in a different SWI name. I’ve not had any success with hacking C programs like that. For now, it seems to suffice to quit Zap, edit the live menu structure, and restart Zap. The primary difference is the count and offsets are applied by MakeMenus, though the basic file layout is the same (it’s not as if it translated it into a binary format – thankfully). |
nemo (145) 2556 posts |
David said
I’m going to quibble about the word ‘obsolete’. Unless you mean that the built-in debugger does everything that DebuggerPlus does, then it is not obsolete. It may well have been disabled in the 32b version, but the 26b Zap has a long list of debugging options that DebuggerPlus implements:
etc – so it may not work but is it ‘obsolete’? |
nemo (145) 2556 posts |
Steffen nobly said
<Audience breaks out in appreciative applause> Well done Steffen for volunteering! I’d be very grateful for a start. ;-) I toyed with doing it myself but came to my senses. I have too much to do. |
nemo (145) 2556 posts |
Rick said
Is DebuggerPlus beyond fixing? Do you want me to look at it? |
Steve Pampling (1551) 8172 posts |
I’m curious whether DebuggerPlus could be made obsolete by adding the features to the standard Debugger module. |
nemo (145) 2556 posts |
There’s almost no flag preservation at all in there. It’s a simple 32b conversion. Is source available? If not I can make one. |
Rick Murray (539) 13850 posts |
Followed by…
;-) It looks like the “most recent build” is the one sitting on my harddisc. As I said earlier, I can make archives, but no repo.
Yes. It doesn’t do the rather useful exception dump stuff, it probably doesn’t understand anything post-StrongARM, and I doubt it does anything to do with Thumb either (not that Debugger is hot there). Debugger will, at least, understand some VFP too! It will likely be a lot more useful/beneficial to look at tweaking Debugger to do what DebuggerPlus used to offer. We’re partway there: *Set Disassemble$Options meh Valid options are: [-arm | -apcs] [-sb | -v6] [-sl | -v7] [-fp | -v8] [-r13 | -sp] [-r14 | -lr] (note how it’s not in the Debugger$ namespace! ;-)) So Debugger can now use APCS register naming, or standard with sb/sl/fp/sp/lr options (so could do R0-R12, SP, LR). What I think we need, off the top of my head and likely missing stuff:
Edit:
|
Rick Murray (539) 13850 posts |
There was a time when DebuggerPlus was far better than Debugger. However… http://old-www.moreofthesa.me.uk/progs/Debugger.zip |
GavinWraith (26) 1563 posts |
@edwardx |
nemo (145) 2556 posts |
Rick said
I came not to praise DebuggerPlus, but to bury it. |
nemo (145) 2556 posts |
Gavin pointed out
The behaviour is undefined. Anything can happen, including getting the same file again and missing another entirely. It is delegated (of course) to the underlying FS and it is not stateful. Technically there’s no reason to believe that consecutive reads will necessarily deliver every file once and once only even now. If we ever get true multithreading (as opposed to some Tube-like compromise) all bets are off with those GBPB calls. |
Rick Murray (539) 13850 posts |
Like many things, it was good in its day. |
nemo (145) 2556 posts |
Much like RISC OS then. And myself. |
Steffen Huber (91) 1953 posts |
nemo said…
As a passionate hater of Git and even more so GitHub, along with nothing more than a generic “I am a RISC OS user” interest in Zap (I am a StrongED guy since Guttorm made StrongEd 2), I might not be the ideal choice… A propos too much to do, I have to get that CDVDBurn release done ASAP. After that, I only have a few more projects to finish, so ask me again in 20-30 years. |
nemo (145) 2556 posts |
:-D Honestly, you should see my to-do list.
This means war. |
Rick Murray (539) 13850 posts |
I probably should have stayed in bed on this miserable rainy Sunday and watched DVDs… but… I didn’t. I broke Zap instead. :-) Here’s what’s new in the “rick-03” release:
It’s working nicely here. Hope it works as nicely for you too. http://heyrick.ddns.net/files/zap-rick03.zip 1 It still likely makes loads of calls to unimplemented SWIs (such as Debugger_Flags), but these have no side effects so I’ve left them as-is. |