|
BASIC and ARM assembler |
|
kuliand (18:50 23/5/2006) monkeyson2 (19:03 23/5/2006) kuliand (20:06 23/5/2006) monkeyson2 (20:19 23/5/2006) cterran (22:46 23/5/2006) kuliand (12:08 24/5/2006) monkeyson2 (12:09 24/5/2006) monkeyson2 (12:11 24/5/2006)
|
|
andrew |
Message #75662, posted by kuliand at 18:50, 23/5/2006 |
Member
Posts: 18
|
another question were can i find the instruction set for ARM assembler there are several pdf's on the official ARM site but are any of these any use for risc os programming? |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #75666, posted by monkeyson2 at 19:03, 23/5/2006, in reply to message #75662 |
Please don't let them make me be a monkey butler
Posts: 12380
|
There's a tutorial here: http://www.heyrick.co.uk/assembler/ And more here: http://tofla.iconbar.com/tofla/arm/index.htm |
|
[ Log in to reply ] |
|
andrew |
Message #75673, posted by kuliand at 20:06, 23/5/2006, in reply to message #75666 |
Member
Posts: 18
|
so is BASIC and ARM assembler the same thing? and is there any programs to de-compile apps writen in ARM assembler?
(ok then back on track) |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #75674, posted by monkeyson2 at 20:19, 23/5/2006, in reply to message #75673 |
Please don't let them make me be a monkey butler
Posts: 12380
|
so is BASIC and ARM assembler the same thing? Sort of, but not really.
BBC Basic contains an ARM assembler. You can use it to assemble ARM code. You don't have to use BASIC, instead you could write it directly using Zap or StrongED (which contain Assembly modes) - but that would be a bit silly. There's also ObjASM which is part of the Castle developer tools which lets you assemble ARM code using a slightly different syntax.
The advantage of using BASIC is that you can use the language to build up bits, use functions as macros, etc.
DIM blockOfMemoryForCode% 2048 FOR pass=0 TO 2 STEP 2 P%=blockOfMemoryForCode% [OPT pass ADR r0, text SWI "OS_Write" MOV R15,R14 .text EQUS "This code was compiled at " + TIME$ + CHR$0 ] NEXT
Then you could call it from within the same program:
CALL blockOfMemoryForCode%
Or then you could save it:
OSCLI("SAVE myCode " + STR$~blockOfMemoryForCode + " +2048") OSCLI("SetType myCode absolute")
END
And then you'll have some ARM code you can run directly by double-clicking it or running it from a !Run file. You could even throw away the BASIC program that generated it if you knew you wouldn't want to change it.
Alternatively, you could load it into a different program and call it: DIM myCode% 2048 OSCLI("Load myCode " + STR$~myCode%) PRINT "Some stuff" CALL myCode% PRINT "Some other stuff"
The above example might not be right, I've not done any ARM code for a bit so it's probably wrong. And the OSCLIs are a bit naughty. But this is the principle anyway.
and is there any programs to de-compile apps writen in ARM assembler? Dunno. There's the ABC compiler which goes the other way, speeding up BASIC programs by compiling them into machine code.
You could drag and drop the program onto StrongED or Zap which would disassemble it. Useful if you're poking around to see what's happening. But be careful not to infringe people's copyright in the process.
[Edited by monkeyson2 at 21:26, 23/5/2006] |
|
[ Log in to reply ] |
|
Chris |
Message #75680, posted by cterran at 22:46, 23/5/2006, in reply to message #75662 |
Member
Posts: 163
|
another question were can i find the instruction set for ARM assembler there are several pdf's on the official ARM site but are any of these any use for risc os programming? Peter Cockerell's book is an excellent source of info, with RISC OS examples. Available here:
http://www.peter-cockerell.net/aalp/?the_id=78 |
|
[ Log in to reply ] |
|
andrew |
Message #75694, posted by kuliand at 12:08, 24/5/2006, in reply to message #75680 |
Member
Posts: 18
|
thanks for the link to that book (can you still buy the book i prefer reading things from paper rather of the screen if not i will have to print it all out. when using strongED how do you know what laguage to view the file in? |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #75695, posted by monkeyson2 at 12:09, 24/5/2006, in reply to message #75694 |
Please don't let them make me be a monkey butler
Posts: 12380
|
when using strongED how do you know what laguage to view the file in? StrongED and Zap can usually work it out automagically from the filetype. |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #75696, posted by monkeyson2 at 12:11, 24/5/2006, in reply to message #75694 |
Please don't let them make me be a monkey butler
Posts: 12380
|
(can you still buy the book i prefer reading things from paper rather of the screen if not i will have to print it all out. Alligata Media did a reprint, which is distributed by APDL: http://www.apdl.co.uk/books.htm |
|
[ Log in to reply ] |
|
|