It is currently Fri Oct 20, 2017 2:49 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Tue Aug 19, 2014 7:24 am 
Offline

Joined: Tue Feb 11, 2014 7:12 am
Posts: 44
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 146 times
Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 8:09 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10064
Location: Rio de Janeiro - Brazil
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! =)


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 2:08 pm 
Offline

Joined: Tue Feb 11, 2014 7:12 am
Posts: 44
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.


Last edited by SNgamer on Tue Aug 19, 2014 2:46 pm, edited 2 times in total.

Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 2:13 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6288
Location: Seattle
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.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 2:18 pm 
Offline

Joined: Tue Feb 11, 2014 7:12 am
Posts: 44
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.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 2:22 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
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.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 2:26 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19110
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 2:40 pm 
Offline

Joined: Tue Feb 11, 2014 7:12 am
Posts: 44
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...


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 2:59 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19110
Location: NE Indiana, USA (NTSC)
I was under the impression that root would not be needed, as any Activity can start an Intent, and the terminal is an Activity.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 3:10 pm 
Offline

Joined: Tue Feb 11, 2014 7:12 am
Posts: 44
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.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 3:28 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19110
Location: NE Indiana, USA (NTSC)
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?


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 3:52 pm 
Offline

Joined: Tue Feb 11, 2014 7:12 am
Posts: 44
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.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 5:07 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19110
Location: NE Indiana, USA (NTSC)
I posted another topic about emulators, and I wonder how a touch-oriented editor for 6502 asm would work.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 7:12 pm 
Offline
User avatar

Joined: Sun Dec 12, 2010 10:27 pm
Posts: 282
Location: Hong Kong
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).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group