ASM6 for Android (and possibly other OSes that use an ARM)

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
SNgamer
Posts: 44
Joined: Tue Feb 11, 2014 7:12 am

ASM6 for Android (and possibly other OSes that use an ARM)

Post by SNgamer »

I thought this could be useful for anyone that wishes to compile and test their code on the go, or (if they are in my situation) if they are on vacation only having their tablet (phone) running Android.
While being on flight I started to learn how Assembly works and wanted to start coding for our beloved NES, but I had to face the problem that there is no specific assembler for Android. Fortunately, the source code for asm6 is available, and no modification was needed to compile it in order to run on android.

At this point I want to point out, that I did not create this program. I just compiled it and want to share it as it might come in handy for one or the other.

Setting it up to actually compile something is really not hard, you just need to get Terminal Emulator and place asm6 in the specified folder by TE where executing code is allowed (just look into settings to see which directory enables executing programs). If needed I can write a tutorial for setting everything up.

I had no issues assembling code, only debugging is very hard, as there is no debugger for NES on Android, but that is another story.
Attachments
asm6.txt
Precompiled version of asm6, just remove .txt extension
(53.54 KiB) Downloaded 510 times
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by tokumaru »

Awesome, now I can work on my projects anywhere I want, since all my projects already target ASM6! I do not have experience in running programs like this on Android though, so that tutorial for setting things up would actually be very welcome! =)
SNgamer
Posts: 44
Joined: Tue Feb 11, 2014 7:12 am

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by SNgamer »

Well, here is how to set everything up:
1) Get yourself the Terminal Emulator from the Play Store:
https://play.google.com/store/apps/deta ... ndroidterm
2) Start the App, and go to Setting
3) Scroll down to Shell, there should be an option to setup startup commands, I setup the PATH to point to the folder specified in the settings (this is the only folder where executeables are, well, executeable on non-rooted devices). I will just assume it looks the same on every device, so you could just copy and paste:

Code: Select all

PATH=$PATH:/data/data/jackpal.androidterm/app_HOME/
cd /sdcard/ASM
The cd /sdcard/ASM command points to my .asm files (obviously), so when I start the app, it will directly change the directory to my ASM files
4) Back in the Terminal, cd (command for Change Directory) to the directory where asm6 is located (for example cd /sdcard/Download)
5) Type in:

Code: Select all

cp asm6 /data/data/jackpal.androidterm/app_HOME/asm6
to copy asm6 to said directory
6) now cd to /data/data/jackpal.androidterm/app_HOME/
7) type in:

Code: Select all

chmod 700 asm6
This will enable asm6 to be executed

Well this should do, after you restart the terminal app, it will automatically set PATH where asm6 is now executeable.
Now you also can just type:

Code: Select all

asm6 example.asm example.nes
And it will output an NES file which will be useable with your favorite NES emulator (I use NES.emu)
For ASM editing, I tested several editors, I recommend DroidEdit, it's got a very nice design. You could also use Qedit, it is also decent, but lags at some point.
Last edited by SNgamer on Tue Aug 19, 2014 2:46 pm, edited 2 times in total.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by lidnariq »

SNgamer wrote:7) type in: chmod 777 asm6
While the android security model probably means that that's safe, it'd be better form to use 755, 700, or 500 instead of 777.
SNgamer
Posts: 44
Joined: Tue Feb 11, 2014 7:12 am

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by SNgamer »

lidnariq wrote:
SNgamer wrote:7) type in: chmod 777 asm6
While the android security model probably means that that's safe, it'd be better form to use 755, 700, or 500 instead of 777.
Oh, you are right, it should also be possible to type +x to enable execution instead changing all access rights with numbers.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by koitsu »

lidnariq wrote:
SNgamer wrote:7) type in: chmod 777 asm6
While the android security model probably means that that's safe, it'd be better form to use 755, 700, or 500 instead of 777.
777 is often a bad habit (propagated by crappy web developers and misunderstanding of how UNIX permissions work, combined with even worse web hosting providers), when most of the time what the person wants is 1777 (that's 777 with sticky-bit set, ensuring only the file owner can delete files; non-sticky-bit means anyone can delete files). But on some environments 777 is actually needed/intended, given implementation details (say, through a GUI, a daemon for managing files running as user userA, while a CLI session might be running under userB, but both essentially want to be able to nuke anything in /some/dir).

P.S. -- Do not be afraid of octal numbers in chmod. They're a hell of a lot easier to remember than the weird letter combinations (r/s/t/w/x/X/u/g/o), especially since this is a thread about getting an assembler. If you're afraid of bits or bases you shouldn't be doing assembly ;P But then again I'm an old UNIX bastard who got used to them a long time ago.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by tepples »

SNgamer wrote:Now you also can just type:

Code: Select all

asm6 example.asm example.nes
And it will output an NES file which will be useable with your favorite NES emulator (I use NES.emu)
Say I want to write a shell script that builds the file and then starts an NES emulator. Somehow this is done with "intents"; is there an example of how to fire one off from the shell?

Anything good for editing pixel art with an indexed palette on Android? The pixel paint programs I found on Google Play Store last time I checked seem to assume 8-bit-per-channel true color.
SNgamer
Posts: 44
Joined: Tue Feb 11, 2014 7:12 am

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by SNgamer »

tepples wrote:
SNgamer wrote:Now you also can just type:

Code: Select all

asm6 example.asm example.nes
And it will output an NES file which will be useable with your favorite NES emulator (I use NES.emu)
Say I want to write a shell script that builds the file and then starts an NES emulator. Somehow this is done with "intents"; is there an example of how to fire one off from the shell?

Anything good for editing pixel art with an indexed palette on Android? The pixel paint programs I found on Google Play Store last time I checked seem to assume 8-bit-per-channel true color.
I checked if it is possible, but it looks like the Terminal Emulator cannot execute any apps from command line, so writing a shellscript to automate everything is unfortunately not possible (at least as far as I know, but maybe if the terminal emulator gains root access through a rooted device, it might be able to do so).
I did not get to the point where pixel art is involved on creating NES homebrew (just started and got some examples assembled and modified them to see what happens in order to understand), but I do not seem to be able to find anything that would fit the needs...
What I really wished for was an NES emulator on Android, which has integrated debugging features, because like that, I am not able to debug anything, which is a real pain...
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by tepples »

I was under the impression that root would not be needed, as any Activity can start an Intent, and the terminal is an Activity.
SNgamer
Posts: 44
Joined: Tue Feb 11, 2014 7:12 am

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by SNgamer »

tepples wrote:I was under the impression that root would not be needed, as any Activity can start an Intent, and the terminal is an Activity.
No need for root applies to the execution of asm6 when it is placed into the specified folder by the app which allows programs to run within terminal emulator.
I did already research on whether terminal can execute apps "outside", I recall reading something about the terimnal emulator not being able to access the folders of apps nor being able to actually execute any app that is not within the specified folder in the app that would allow for execution without root permission.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by tepples »

That's because an app on Android doesn't start another app by "executing a program". But an app can start another app by passing an Intent to startActivity(). Otherwise, how would the Gallery app open the video player app, or how would the Google Now app open the Chrome or YouTube app when I tap the title of a search result, or how would a third-party launcher open any apps at all?
SNgamer
Posts: 44
Joined: Tue Feb 11, 2014 7:12 am

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by SNgamer »

Whoops, I somehow misunderstood the term Intent and Activity (should have done research).
After a short research i found this:
http://learnandroid.blogspot.com.tr/200 ... d.html?m=1
This might just be what we were in search of.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by tepples »

I posted another topic about emulators, and I wonder how a touch-oriented editor for 6502 asm would work.
User avatar
Gilbert
Posts: 564
Joined: Sun Dec 12, 2010 10:27 pm
Location: Hong Kong
Contact:

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by Gilbert »

To edit pixel graphics with indiced colour, you may try the Android port of Grafx2, which can be considered some sort of open-sourced replacement of Deluxe Paint.

Anyway, back to topic a bit, I think I'll try this assembler, as my more recent Famicom and Apple ][ projects all use ASM6, though I may switch back to NESASM for Famicom projects (as I may target also the PCE platform, and if you think of the root of NESASM as a modified version of PCEAS most of its "shortcomings" make a lot of sense).
therektafire
Posts: 3
Joined: Thu Nov 30, 2017 12:34 am

Re: ASM6 for Android (and possibly other OSes that use an AR

Post by therektafire »

Hm, it appears this acts kind of funky in newer versions of Android. It looks like you have to change byte $10 in the file from 2 to 3 otherwise you get a "position independent executable (PIE) required" error in the terminal, at least on non rooted devices. I found this out after running into this issue after trying to install it on my phone which I have had for a little over a year now and doing some research about how to fix it. Hope that helps people :)
Post Reply