Has anybody managed to get ZapMJE to compile with the DDE?
Rick Murray (539) 13840 posts |
… I have picked apart the ZapMJE sources from CVS into proper RISC OS filetypes, and added the “Macros” and “System” headers, as I don’t have the full installation of Zap’s sources (too much to mess around with). The problem with ZapMJE failing on the Pi2 is because of this, in “s.support” function “callc”: STR r10,[r10,#-4]! Yet another WTF instruction that I’m surprised worked elsewhere for this long. When trying to build ZapMJE, it seems as if every reference to “PUSH” is faulted with a “Bad symbol” error and I can’t see why. I’ve already fixed the “SEV” macro to be “SETV” (now that SEV is an actual instruction)… Here are PUSH and PULL (defined in “h.macros”, the ones in “h.main” are not used): ; Push a register list $a onto the stack MACRO $la PUSH $a,$cc INSTR "$a","," [ :LNOT: InStr INSTR "$a","-" ] [ InStr $la STM$cc.FD R13!,{$a} | $la STR$cc $a,[R13,#-4]! ] MEND ; Pull a register list $a from the stack MACRO $la PULL $a,$cc INSTR "$a","," [ :LNOT: InStr INSTR "$a","-" ] [ InStr $la LDM$cc.FD R13!,{$a} | $la LDR$cc $a,[R13],#4 ] MEND I include PULL because the system isn’t faulting PULL, only PUSH. Here is INSTR: ; test if a string is inside another string ; returns result in GBLA InStr MACRO INSTR $str, $substr LCLA SubLen LCLA Pos LCLS TempStr SubLen SETA :LEN:"$substr" Pos SETA :LEN:"$str" InStr SETL {FALSE} WHILE (Pos >= SubLen) :LAND::LNOT: InStr TempStr SETS ("$str" :LEFT: Pos) :RIGHT: SubLen [ TempStr = "$substr" InStr SETL {TRUE} ] Pos SETA Pos-1 WEND MEND To be honest, I have made little use of macros myself, so this is all a bit gibberish. Can anybody spot anything obviously wrong? … I think to do what it wants, I need to replace: STR r10,[r10,#-4]! with: STR R10,[R10,#-4] SUB R10,R10,#4 but this requires an extra word which means a full rebuild. I tried to patch the following into the module, replacing: ADD R10,R13,#12 STR R10,[R10,#-4]! with: ADD R10,R13,#8 ; 8 = 12 minus 4 written in STR STR R10, [R13, #8] ; R13 + 12 is where word is written (FD stack, so word is word prior, hence 8) But this crashes Zap too. :-/ |
Rick Murray (539) 13840 posts |
In the meantime… …does anybody know how to change StrongEd to run a build upon pressing Shift-Ctrl-C, and to get it to toss the parent folder’s1 “MakeFile” to “amu”? At the moment, a build is invoked by pressing F10 and it tries to do something with gcc (which I don’t have). 1 The file being worked upon will be in .c or .h or maybe .s, the file “MakeFile” is one directory up from there. |
Jeffrey Lee (213) 6048 posts |
UAL uses PUSH and POP as aliases for R13-based LDM/STM/LDR/STR. They behave just like those PUSH and PULL macros, the only real difference is that you write the condition code in the correct location. So just like with SEV, ObjAsm will be trying to interpret the PUSH macro as an instruction. If you convert the PUSH macro to mixed case then it should work (ROOL sources use a “Push” macro just fine). |
Fred Graute (114) 645 posts |
|
Rick Murray (539) 13840 posts |
Cheers. I added “-quit” to the TaskWindow and “-k” to the AMU command, to match Zap’s behaviour. It almost works – tells me it can’t find files and doesn’t know how to build anything. It works fine if I set the current directory to be the same as the MakeFile, but not if the CSD is $. Is it possible to issue two commands? I think it may be necessary to do a Thank you for the rapid response! |
Rick Murray (539) 13840 posts |
Thanks for the quick reply Jeffrey.
Oh, I see. I thought PUSH and POP were just a Thumb thing that assumed R13 and FD to save the bits required to actually encode that.
Then I have just discovered two bugs in objasm. :-) 1. Trying to interpret UAL instructions for a later processor when specifically told otherwise in the command line “-acps 3/32bit -32 —cpu=ARM710” (32 bit code, pre-UAL, target is ARM710). 2. Encountering a macro with the same name as a recognised instruction (that it shouldn’t be supporting, mind) and not faulting this. If it raised warnings about the macro “PUSH”, maybe I’d have cottoned on and not wasted so much time yesterday. ;-)
I’ve just done that. Works fine. Thank you. |
Rick Murray (539) 13840 posts |
Okay, ZapMJE now works on the Pi 2. Which means one can now1 use Zap to edit C/assembler code on ARMv7 and later processors that are stricter about what instructions they will accept. You can download the updated ZapMJE module from: http://heyrick.ddns.net/files/zapmje.zip The module carries today’s date so it can be distinguished from the twelve-years-ago version. The version number hasn’t been bumped as this was just a bug fix. Please, everybody, do not let it be lost on you the massive irony of using StrongEd to repair Zap. :-) This job was made a lot simpler with StrongEd’s ability to search and replace across all open files. Yeah, Zap can do that too – but (Src)Edit sure can’t! Anyway, for those who like Zap1, it now works on ARMv7 Pi 2s. 1 The Pi2 isn’t old, yet I’ve not seen this reported before. Am I the only person still using it for writing code?!?!? |
Jeffrey Lee (213) 6048 posts |
In the context of PUSH/POP, the CPU model isn’t relevant, since the instructions they map to will work all the way back to ARMv1. UAL only affects the assembler syntax, like gas vs. ARM/Acorn. Whether it should accept UAL syntax when running in non-UAL mode is certainly a matter of opinion, however. At the moment it will accept the syntax but throw a warning (for each and every UAL syntax instruction). This can be useful (you can write mixed-syntax code just fine, as long as you ignore the warnings) but sometimes it can result in confusion (e.g. your case, or my typical case of accidentally missing the ‘#’ out of an immediate constant, or missing an operand out of a 3-operand instruction, and getting a UAL syntax warning) |
Rick Murray (539) 13840 posts |
…unless there’s a differing macro with the same name that it didn’t appear to notice/fault, in which case the warnings turn into errors as the syntax between the two won’t match. ;-) |
Fred Graute (114) 645 posts |
Yes. This should work:
That should all be on 1 line of course.
Hehe, I’m sure I’ve done to opposite when 32-bitting StrongED. Just goes to show that having 2 capable editors is a good thing. |
Rick Murray (539) 13840 posts |
The ZapMJE update is now linked from my blog – it’s probably better/quicker than prodding my personal server (though the file is still there too)… |
Clive Semmens (2335) 3276 posts |
I loved Zap, but don’t currently have a working copy at all. Nice as it is to see the ZapMJE update, what I really need is a copy of Zap itself. I’ve not spotted where I can get one. Any hints would be much appreciated! (I’m running RISCOS 5.23 / RC15 on a Pi3 if that’s relevant at all.) |
Chris Hall (132) 3554 posts |
Try !Store or v1.48 (12 Jul 2015) tnk-11. You can get the latest Zap module from http://www.tankstage.co.uk/Software/ZeroZap.zip or updated Tank’s 1.48 tnk11 sources to tim-01 to fix all the ZeroPains that occurred on my machine and put them all will a compiled Zap module in an archive http://www.riscos-digitalcd.net/apps/ZapSource148tim01.zip (see other threads for detail). |
Martin Avison (27) 1494 posts |
And I think that sums up why I have recently gone through the process of converting myself to use StrongEd, after being a faithfull Zap user for decades. Unless someone has the time, energy and expertise to create a complete new version with all known updates, together with the corresponding updated sources, making a known central resource for obtaining or changing Zap, then it is going to continue to wither and die slowly. Which would be a real shame. |
Rick Murray (539) 13840 posts |
That’s the plan, though since http://cvs.tartarus.org/zap/ is no longer responding, it may mean wading though the utter mess that GitHub made of the sources (when downloading “all” as an archive). |
Rick Murray (539) 13840 posts |
I will, however, see about putting together an updated installation archive (this evening?) because the current list of things to do to install Zap is a joke. |
Jeffrey Lee (213) 6048 posts |
Nope. The GCCSDK autobuilder has a recipe for it, but it looks like there are some unresolved filename handling issues that prevent it from working. |
Sprow (202) 1158 posts |
Looks like my list from August 2016 still applies then. Everybody would love it if Zap wasn’t withering, somebody could certainly take it on, but nobody has so far. As you know from our Pluto/eSpeak endeavors Martin, the programming is pretty peripheral, it’s the legwork tracking people down that takes the time. If it’s now listed on !Store, maybe the distribution rights got sorted in the last year? |
Rick Murray (539) 13840 posts |
I’m planning to get the sources together (no CVS or fancy stuff) just so that I can get the damn thing to build the next time something crops up. As you might have seen, there is a problem with objasm and UAL that will require extensive modification of the sources. Gotta clock in now, more later. |
Rick Murray (539) 13840 posts |
Okay, I think I have assembled all the bits into one archive. Anybody willing to be a guinea pig? :-) Zap Ultimate Edition → http://heyrick.ddns.net/files/zap_ultimate.zip (about 3MiB) Tested extracted to RAMdisc on a dead-booted system. BTW, don’t expect more than 60 to 70K/sec, that’s what my upstream rate achieves on a good day with a tailwind… If it works okay (don’t forget to try C/assembler editing on an ARMv7 or ARMv8 machine), I can put it on my website so people can download that instead of the current rigamarole. |
Clive Semmens (2335) 3276 posts |
As long as you’re reasonably confident it’s not going to leave my Pi’s installation knackered, I’m very willing! How say you? |
Rick Murray (539) 13840 posts |
Installation? You already have Zap? Or do you mean RISC OS? There are two components in !Boot – !ZapUser (goes in !Boot.Choices) and !ZapFonts (goes in !Boot.Resources). The main application goes… wherever you want, but $.Apps is logical. !ZapUser and !ZapFonts shouldn’t affect system boot, they only set up some variables so Zap knows where its resources are. Probably best to install everything (there are lengthy instructions included), then reboot to check the resources get picked up correctly, so that running Zap should “just work”. |
Clive Semmens (2335) 3276 posts |
I meant RISCOS. I do not already have Zap – I used to, but not on this installation of RISCOS. Not since I had RISC PCs. Many thanks, and will try tomorrow! |
Rick Murray (539) 13840 posts |
Jee… keep us in suspense why don’t you? :-P |
Chris Hall (132) 3554 posts |
If it’s now listed on !Store, maybe the distribution rights got sorted in the last year? It’s been listed on !Store since day one I think. |