tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Asm tuts

Wed Oct 30, 2013 1:13 pm

DavidS wrote:anothe hour to remove all of the hard spaces added by the forum. In the futrure would you please include a downloadable copy?

I had to remove the comments in order to get rid of the Hard Spaces that were causing the assembler fits.
That's a tool issue at your side, David. Just copied Dex's source from the forum, pasted into vi, and hexdumped it and the only spaces are 0x20 (indeed, nothing above ascii code point 0x7f - i.e. it's plain 7 bit ascii). If you're seeing odd characters, they are coming from the tools you're using to cut / paste / edit. Still, to save time, assuming you've saved to a file, try this:

Code: Select all

perl -pi -e 's/\s/ /misg' filename.txt
…which will move all "whitespace" characters to plain ascii spaces. Shouldn't take more than a millisecond or two, although it may break formatting in stuff that uses hard tabs.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Asm tuts

Wed Oct 30, 2013 2:45 pm

Thank you tufty. Do you know of a good perl implementation for RISC OS?

It could be that NetSurf is the source of the odd characters, though I have seen others complain of similar so figured otherwize.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Asm tuts

Wed Oct 30, 2013 6:24 pm

Can you post a assembled ver of your convertion of the mouse, thanks.

"Unfortunately no. Most RISC OS assemblers are written in C (much as Fasm and Nasm are). "

Fasm is self assembling, that's what put me off nasm, no self respecting asm programmer could get away with using a assembler thats written in C.
Even though nasm's C compiler users gas as it backend.
Batteries not included, Some assembly required.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Asm tuts

Thu Oct 31, 2013 1:14 am

DexOS wrote:Can you post a assembled ver of your convertion of the mouse, thanks.
No problem attached. It causes a buffer overflow, still have not got around to debuging.

"Unfortunately no. Most RISC OS assemblers are written in C (much as Fasm and Nasm are). "
Now that is very good news. In this case I am glad I was wrong.
Though I would like a good ARM syntax assembler writen in ARM assembly, there used to be a few.
Fasm is self assembling, that's what put me off nasm, no self respecting asm programmer could get away with using a assembler thats written in C.
Even though nasm's C compiler users gas as it backend.
I agree I found two that are written in assembler. One is the BBC BASIC V assembler (part of BBC BASIC V, and thus included with the OS), and the other is ExtBASasm though it is just an extension of the BBC BASIC V assembler to allow things such as producing linkable objects.

Also ExtBASasm is for 26bit addressing mode only so will not run on RISC OS 5. Though it is open source, so it could be ported (with some work as it relies on the internal workings of BBC BASIC).
Thus:
http://old-www.moreofthesa.me.uk/progs.source.html


I had looked for this for some time, and today the link was given on my Assembly for RISC OS thread by Steve Drain so I thank him.

I beleive that ASM is writen in Assembly, though it is closed source.
Attachments
Mouse2.zip
(575 Bytes) Downloaded 173 times
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Asm tuts

Thu Oct 31, 2013 2:34 pm

Thanks i will test and see if can fine the over flow.
Also extasm comes with assembly source code, not sure about the licence.
Batteries not included, Some assembly required.

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Asm tuts

Thu Oct 31, 2013 4:33 pm

DavidS wrote:Thank you tufty. Do you know of a good perl implementation for RISC OS?

It could be that NetSurf is the source of the odd characters, though I have seen others complain of similar so figured otherwize.
'fraid not. Do you have something like sed or some other command line editor? That should do the job for you.

Otherwise, you want an editor that can search for regular expressions or otherwise find characters that are above hex point #x7f (i.e. that have the top bit set) and convert them into spaces. Pretty much any decent code editor should be able to do this (indeed, I would argue that any editor that can't do this doesn't count as an editor, let alone a code editor - even the hated vi can do it)

Simon

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Asm tuts

Thu Oct 31, 2013 8:05 pm

@Tufty:
Well it can be done with Edit, Zap, StrongED, SrcEdit, etc. Though on looking at the source again the hiden characters are below 31. It looks as if it is using CR+LF for EOL, though that should not cause a problem, and some other characters (a few places it had NULL characters between the mnemonic and the the dest arg).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Asm tuts

Thu Oct 31, 2013 8:07 pm

DexOS wrote:Thanks i will test and see if can fine the over flow.
Also extasm comes with assembly source code, not sure about the licence.
Probably just something dumb that I overlooked. I have not been at my computers today (until now).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

Bakul Shah
Posts: 321
Joined: Sun Sep 25, 2011 1:25 am

Re: Asm tuts

Sun Nov 03, 2013 7:22 pm

tufty wrote:If you're seeing odd characters, they are coming from the tools you're using to cut / paste / edit. Still, to save time, assuming you've saved to a file, try this:

Code: Select all

perl -pi -e 's/\s/ /misg' filename.txt
…which will move all "whitespace" characters to plain ascii spaces. Shouldn't take more than a millisecond or two, although it may break formatting in stuff that uses hard tabs.
expand < inputfile > outputfile

This will maintain alignment. By default tabs are 8 chars apart. Use "-t N" if the original had tabs that were supposed to be N chars apart (Note that setting tabs to something other than 8 can often mess things up. If you want to indent by N spaces instead of 8, in vi you can use :set sw=N. sw is abbrev. for shiftwidth. Now you can increase or decrease indentation when starting a new line by using ^T or ^D. And >> or << for existing lines).

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Asm tuts

Mon Nov 04, 2013 7:03 am

Hah. Been using unix for getting on for 30 years now, and I've never come across that one. I've always used sed or perl to do it.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Asm tuts

Mon Nov 04, 2013 10:13 pm

I have not heard of that one either, and have used Unixens off and on for most of my life. Also I can not find a RISC OS equilivelent, though no matter I have Perl working (not that I like perl [even for dynamic HTML I use the apropriate assembly language for the server system]).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Asm tuts

Tue Nov 05, 2013 3:26 pm

And that, ladies and gentlemen, is how real comedy lines are delivered.

mark4
Posts: 15
Joined: Wed Jan 15, 2014 10:10 pm

Re: Asm tuts

Thu Jan 16, 2014 1:55 am

snippets are of limited practical use, they never quite do asm coding justice as there are sooo many different ways to skin a cat and so many cats to skin! As an alternative example for coding asm on an arm linux might i present...

www.isforth.com/a4.tar.bz2 my not quite officially released subroutine threaded forth for ARM Linux written entirely in assembler (and forth :)

User avatar
williebegoode
Posts: 36
Joined: Wed Jun 26, 2013 1:39 pm
Contact: Website

Change File Permissions

Sat Jun 14, 2014 1:20 am

Here's a simple post on how to change file permissions using Raspbian with either File Manager or Terminal. (The terminal code is applicable to other Linux and even Unix systems.)

http://www.php5dp.com/change-file-permi ... mini-post/

Lots of PHP stuff too....

Return to “Other programming languages”