nesdev.com
https://forums.nesdev.com/

ASM6 for Android (and possibly other OSes that use an ARM)
https://forums.nesdev.com/viewtopic.php?f=2&t=11552
Page 1 of 1

Author:  SNgamer [ Tue Aug 19, 2014 7:24 am ]
Post subject:  ASM6 for Android (and possibly other OSes that use an ARM)

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:
File comment: Precompiled version of asm6, just remove .txt extension
asm6.txt [53.54 KiB]
Downloaded 223 times

Author:  tokumaru [ Tue Aug 19, 2014 8:09 am ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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! =)

Author:  SNgamer [ Tue Aug 19, 2014 2:08 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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:
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:
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:
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:
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.

Author:  lidnariq [ Tue Aug 19, 2014 2:13 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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.

Author:  SNgamer [ Tue Aug 19, 2014 2:18 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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.

Author:  koitsu [ Tue Aug 19, 2014 2:22 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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.

Author:  tepples [ Tue Aug 19, 2014 2:26 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

SNgamer wrote:
Now you also can just type:
Code:
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.

Author:  SNgamer [ Tue Aug 19, 2014 2:40 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

tepples wrote:
SNgamer wrote:
Now you also can just type:
Code:
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...

Author:  tepples [ Tue Aug 19, 2014 2:59 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

I was under the impression that root would not be needed, as any Activity can start an Intent, and the terminal is an Activity.

Author:  SNgamer [ Tue Aug 19, 2014 3:10 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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.

Author:  tepples [ Tue Aug 19, 2014 3:28 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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?

Author:  SNgamer [ Tue Aug 19, 2014 3:52 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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.

Author:  tepples [ Tue Aug 19, 2014 5:07 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

I posted another topic about emulators, and I wonder how a touch-oriented editor for 6502 asm would work.

Author:  Gilbert [ Tue Aug 19, 2014 7:12 pm ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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).

Author:  therektafire [ Thu Nov 30, 2017 2:11 am ]
Post subject:  Re: ASM6 for Android (and possibly other OSes that use an AR

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 :)

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/