32bit ARM assembler.
Keith Sloan (1493) 32 posts |
I am trying to assemble some old code and get a warning ARM AOF Macro Assembler 4.01 (Acorn Computers Ltd) [04 Jul 2011] Assembled program starts AREA |C$$code|, CODE, READONLY revsprite and ends ;*************************************************** What is the correct coding these days? |
|
Steve Revill (20) 1361 posts |
Well, you should never normally be pushing PC. Next, you’ve got a stack imbalance because you’ve pushed one more register than you’ve pulled, even accounting for the odd “leaving R0-R3 behind” thing. On top of that, you shouldn’t be doing LDM^ – this isn’t 32 bit safe; you don’t need the ^. Finally, why doesn’t the LDM also use FD? That would be much clearer. Oh, if this was code in a RISC OS build environment, you could GET Hdr:Macros and use Push/Pull or even better Entry/EXIT macros. Apart from that, the STM/LDMs are fine. ;) |
|
Steve Revill (20) 1361 posts |
The “No task registered for throwback” message means the system hasn’t seen an editor that can handle throwback (listing warnings and errors in a special window) – editors such as Zap or StrongEd certainly do. Not sure about Edit or SrcEdit (can’t say I’ve ever really used either). |
|
Jeffrey Lee (213) 6048 posts |
Steady on there Steve! That’s an APCS function entry/exit veneer that you’re looking at, so everything you’re seeing is perfectly normal. (I’ll just assume you’re suffering from sleep deprivation, shall I? ;-)) The only bit that’s “wrong” is the LDM ^, since as you’ve pointed out that isn’t 32bit safe. I’m tempted to say that you should just ignore the deprecated instruction warning. You could get round it by splitting the STM into a STM and STR, but since the current version of Norcroft generates code which falls foul of the same warning, and the PC value that gets pushed will only be used for debugging, it’s not a particularly serious issue. |
|
Colin Ferris (399) 1818 posts |
AREA |C$$code|,CODE,READONLY
;*************************************** ; remove ^ from pc}^ ; restore work regs leave args on stack for The above assembles – the GCC and Acorn Compilers use it. |
|
Steve Revill (20) 1361 posts |
Really? It looks bonkers to me… I really must be tired. :( |
|
Steve Revill (20) 1361 posts |
Colin, did you really mean STMDB/LDMDB? That seems a bit suspect to me. But as we’ve already established, I’m not firing on all cylinders… :) |
|
Keith Sloan (1493) 32 posts |
Well I think I probably got the coding from the Norcroft C manual which I am guessing had a section on calling assembler from C. This is back in the 26bit days and I no longer have the manual. Would be nice to see some documentation on how one is supposed to Call assembler from C these days for 32 bit with some clarification on making 26bit tolerant. |