flat assembler
Message board for the users of flat assembler.

Index > Main > Portable Assembler?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007 13 Jul 2006, 02:57
I originally posted this at programmersheaven but thought that I would get better feedback here.

I just had a thought on how to make one instruction set more portable to other architectures. Computers are the same, right? This is a fundemental fact. One might be more powerful than the other but, given enough time, they can do the same things. Using emulation techniques, we could convert or translate x86 code to another ISA. You could program in the instruction set that you are familiar with and the assembler would convert the instructions to another ISA. When writing a emulators CPU core for a system, you convert the opcodes of that system into similiar opcodes of the target system. The assembler could have support for different cores and different ISAs you could program in. Of course, you would run into situations where one system had unique instructions and problems writing a translator for that but for the most part you could port over simple instructions like add, sub, mul, div, mov, or, and, nor, not, xor, ect. which most systems have. The initial code generated might not be the fastest and most compact around but it would prove a point. This would throw the whole adage of assembler not being portable out the window. Think of it like the universal translator on Star Trek but in a written form. What do you think?
Post 13 Jul 2006, 02:57
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 13 Jul 2006, 04:29
what should it be good for?
Post 13 Jul 2006, 04:29
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
quasar



Joined: 09 Oct 2005
Posts: 16
quasar 13 Jul 2006, 05:57
It's simpler to use C
Post 13 Jul 2006, 05:57
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 843
Location: Jakarta, Indonesia
TmX 13 Jul 2006, 07:37
Maybe you should take a look on an "assembler-like" language called
Linoleum

Here's the site : http://www.anywherebb.com
Post 13 Jul 2006, 07:37
View user's profile Send private message Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88 13 Jul 2006, 11:20
shaolin007 wrote:
Computers are the same, right?


Ha.

Hahaha.
Post 13 Jul 2006, 11:20
View user's profile Send private message Visit poster's website Reply with quote
Remy Vincent



Joined: 16 Sep 2005
Posts: 155
Location: France
Remy Vincent 13 Jul 2006, 14:12
shaolin007 wrote:
Think of it like the universal translator on Star Trek but in a written form. What do you think?



http://www.geocities.com/remyvincent/RVEduExamples-INDEX.HTM
At this page, there are THREE LINKS (=3) with assembler programs translated "by hand" :
- http://www.geocities.com/remyvincent/RVEduExamples-forFasm.zip
- http://www.geocities.com/remyvincent/RVEduExamples-forNasm.zip
- http://www.geocities.com/remyvincent/RVEduExamples-forTasm.zip

I SWEAR all this code is translated by hand, so if you heard about automatic ASM translators, I could check my translated code... THANKS...
Post 13 Jul 2006, 14:12
View user's profile Send private message Visit poster's website Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007 13 Jul 2006, 19:31
vid wrote:
what should it be good for?



What? Well, I guess it could be good for allowing you to program in the langauge of your choice and some portability. I would imagine.
Post 13 Jul 2006, 19:31
View user's profile Send private message Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007 13 Jul 2006, 19:36
mattst88 wrote:
shaolin007 wrote:
Computers are the same, right?


Ha.

Hahaha.



I fail to see the humor. From a computer science perspective, computers are the same in what they can do and any computer given enough time and memory will be able to do the same things that other computers can do.
Post 13 Jul 2006, 19:36
View user's profile Send private message Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007 13 Jul 2006, 19:42
Remy Vincent wrote:
shaolin007 wrote:
Think of it like the universal translator on Star Trek but in a written form. What do you think?



http://www.geocities.com/remyvincent/RVEduExamples-INDEX.HTM
At this page, there are THREE LINKS (=3) with assembler programs translated "by hand" :
- http://www.geocities.com/remyvincent/RVEduExamples-forFasm.zip
- http://www.geocities.com/remyvincent/RVEduExamples-forNasm.zip
- http://www.geocities.com/remyvincent/RVEduExamples-forTasm.zip

I SWEAR all this code is translated by hand, so if you heard about automatic ASM translators, I could check my translated code... THANKS...


Real funny. I am serious. Have you done any emulation programming or are you talking out of your ass?
Post 13 Jul 2006, 19:42
View user's profile Send private message Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88 14 Jul 2006, 02:42
shaolin007 wrote:
mattst88 wrote:
shaolin007 wrote:
Computers are the same, right?


Ha.

Hahaha.



I fail to see the humor. From a computer science perspective, computers are the same in what they can do and any computer given enough time and memory will be able to do the same things that other computers can do.


A portable assembly language already exists. It's called C.

Seriously, take a peek at how programming differs from x86 to ARM. Computers are not all the same.
Post 14 Jul 2006, 02:42
View user's profile Send private message Visit poster's website Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007 14 Jul 2006, 03:35
mattst88 wrote:
shaolin007 wrote:
mattst88 wrote:
shaolin007 wrote:
Computers are the same, right?


Ha.

Hahaha.



I fail to see the humor. From a computer science perspective, computers are the same in what they can do and any computer given enough time and memory will be able to do the same things that other computers can do.


A portable assembly language already exists. It's called C.

Seriously, take a peek at how programming differs from x86 to ARM. Computers are not all the same.


Really, well I guess all of those computer science books I have read, written by people with PHD's, are totally wrong. Thanks, I never would of thought different if it wasn't for your enlightening response. C is not assembly by the way. What gave you that idea? Maybe because some compilers support it inline?
Post 14 Jul 2006, 03:35
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 14 Jul 2006, 06:28
computer books written by PHDs are too "off" most of time, people who write them are almost theoretists who live outside reality, their theories looks nice, true and compact, but only until you have to implement them, then you notice that this particular things needs to beheave little different in some case, well, it's not that big deal, we can make an exception.... and this will happen again and again until you have something different than the original theory was.

i would rather read some book from someone who has been actively programming 4 types of processors, than from someone with PHD whose biggest source had 10KB.

for example, in ARM processors you can access memory addressed by immediate only in range 4096 bytes from instruction, other times you need to use indirect addressing. so forget about things like "mov [variable], 123". In ARM you can do things with one instruction that need 3-4 instructions on x86. Resulting code would be unreadable and maybe worse than C's
Post 14 Jul 2006, 06:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 14 Jul 2006, 09:25
The idea seems silly to me.

Either code for some generic virtual machine which can be compiled or JITed, or do the sane thing and code it in C. No reason to lose speed by emulation, or limit yourself to the lowest common denominator that all your target CPUs support.

_________________
Image - carpe noctem
Post 14 Jul 2006, 09:25
View user's profile Send private message Visit poster's website Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 14 Jul 2006, 10:07
Boyz: everyone is free to image and write some source....sometimes strange ideas become fantastic project and programs.....

shaolin007: write your own code...I hope you'll have great result, more than C or other languages.... Wink
Post 14 Jul 2006, 10:07
View user's profile Send private message Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost 20 Jul 2006, 00:29
shaolin007 wrote:
Think of it like the universal translator on Star Trek but in a written form. What do you think?


i think the star trek reference makes this thread worth while, should i mention when my cellphone opens it makes the tricorder sound Smile

_________________
redghost.ca
Post 20 Jul 2006, 00:29
View user's profile Send private message AIM Address MSN Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 23 Jul 2006, 16:14
shaolin007 wrote:
mattst88 wrote:
shaolin007 wrote:
mattst88 wrote:
shaolin007 wrote:
Computers are the same, right?


Ha.

Hahaha.



I fail to see the humor. From a computer science perspective, computers are the same in what they can do and any computer given enough time and memory will be able to do the same things that other computers can do.


A portable assembly language already exists. It's called C.

Seriously, take a peek at how programming differs from x86 to ARM. Computers are not all the same.


Really, well I guess all of those computer science books I have read, written by people with PHD's, are totally wrong. Thanks, I never would of thought different if it wasn't for your enlightening response. C is not assembly by the way. What gave you that idea? Maybe because some compilers support it inline?


He's right... If it was doable it would have been done. Yes, they all run on memory and input devices, but once again you must consider that most processors have different commands and different bus sizes and such. You, shaolin007, are thinking of a standardization... Which can only be implimented 2 ways... Building processors with all the same instructions (will never happen to begin with, plus it won't do any good for the old processors) or "another level of indirection" which is done by programming for an OS or an extention to another program (which would run on all OSes of all processors) which will be much slower (reminds me of java). Essentually, it's not gonna happen.
Post 23 Jul 2006, 16:14
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 26 Jul 2006, 05:19
Quote:
If it was doable it would have been done.


Guess we'll never put a man on Mars. Or cure cancer. Or anything else. (Why is it so easy to give up hope?)

If you have a goal, don't listen to everybody's opinion, just try hard (and good luck)! The only surefire way to fail is to not try.

I remember a certain intelligent programmer for the Atari Jag64 saying that it would be years and years before home PCs could emulate the Jag. It wasn't too much longer afterwards that several emulators existed (and I am sure that it wasn't easy!).

They used to think that running the mile in less than four minutes would make your lungs explode (or something silly like that). Then some guy did it. Poof, proved you all wrong, ha! Wink

Oh, and don't tell me that you weren't amazed when you first found out about (choose one: MAME, Linux, Bochs, FreeDOS, NASM, FASM, Menuet, Firefox, Doom, Descent, GP32, Wikipedia, GCC, Juno, NetZero, VIM, GNU Emacs, The Broth/Mosaic, Geocities, OpenWatcom, Gmail, OpenOffice, etc.). Not exactly small feats, those! Razz

Don't forget that we drive around in motorized carriages and ride on flying engines in the sky!

<EDIT> 200th post, woot! </EDIT> Wink
Post 26 Jul 2006, 05:19
View user's profile Send private message Visit poster's website Reply with quote
DennisCGc



Joined: 03 May 2004
Posts: 24
Location: Zoetermeer, The Netherlands
DennisCGc 29 Jul 2006, 23:53
shaolin007 wrote:
mattst88 wrote:

A portable assembly language already exists. It's called C.

C is not assembly by the way. What gave you that idea? Maybe because some compilers support it inline?


No, but... C is pretty low-level. Seriously, have you ever done something in C?

Anyway, I think when the design is complete, it'll be somehow an HLL... But, good luck Smile
Post 29 Jul 2006, 23:53
View user's profile Send private message MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 08 Sep 2006, 07:02
this project idea turned to discussion - i am moving it to Main section
Post 08 Sep 2006, 07:02
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost 08 Sep 2006, 09:19
Just because ARM and x86 differ in RISC and CISC doesn't mean they are totally different, I think ARM asm can be very similar to x86.

Making a portable assembler seems a bit weird considering the opcodes and syntax of each processor and how it does things with addressing or memory can vary greatly. I am with them go for C or PASCAL, and if you want a "portable asm" use JAVA and it's bytecode Very Happy

_________________
redghost.ca
Post 08 Sep 2006, 09:19
View user's profile Send private message AIM Address MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.