Assembler for puppy?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
KusaNoKaito
Posts: 99
Joined: Fri 19 Feb 2010, 22:52
Location: Florida
Contact:

Assembler for puppy?

#1 Post by KusaNoKaito »

Hi! simple question, is there an assembler available for puppy?

If there is not and other people here want the same, I could try packaging some of the assemblers I use?

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#2 Post by technosaurus »

the gnu assembler is on the devx sfs as is nasm
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#3 Post by 8-bit »

The version included in devx is 0.98.39 dated Oct 22,2007.
The latest stable version at their site http://www.nasm.us/ is 2.07.
And version 2.08 is in development.
According to their site it supports 64bit processors too.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#4 Post by Lobster »

You might like to try Linoleum assembler (you will have to compile it first)
http://en.wikipedia.org/wiki/Linoleum_( ... _language)

last Puppy compiling attempted here
http://www.murga-linux.com/puppy/viewto ... 951#100613
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#5 Post by nooby »

My naive dumb question.

When I used MS DOS and used several of their assemblers and C compilers and Pascal and such. then the executables had .com and was standalone things in that one clicked on them and they run.

what is it in Linux that one do assembler and how does one run them?

What can one do with them?
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#6 Post by Lobster »

apparently yasm is in at least Quirky 003 and probably later versions . . .

fasm info
http://flatassembler.net/
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#7 Post by DMcCunney »

nooby wrote: When I used MS DOS and used several of their assemblers and C compilers and Pascal and such. then the executables had .com and was standalone things in that one clicked on them and they run.

what is it in Linux that one do assembler and how does one run them?

What can one do with them?
The standard Linix assembler is "as". It's available for Puppy as part of the DEVX toolset. In the old days in Unix, the C compiler "cc" would compile to assembler source, which was then assembled by as to create object filesthat were linked to form an executable by "ld". It was possible for the programmer to interrupt the process before as was called, and hand optimize the assembler code generated by cc for performance, before having it assembled and linked. These days, compilers do their own optimization, and can generally do it better than the programmer.

".com" files are a relic of the addressing model used by the Intel 8088 CPU used in early PCs. Intel CPUs use a "segmented" architecture. On the 8088, with a one megabyte address space, a segment was 64K. There were half a dozen different memory models a DOS programmer had to deal with, depending upon whether both code and data fit in 64K, or code fit in 64K, but data required another segment, or code fit in 64K, but data required more than an additional 64K segment, or code required more than 64K, etc.

Code branching within a 64K segment was fairly simple. Branching was to offset from the current location. Code that needed to cross segments required "far calls", and got more complicated. Branching was to segment:offset. "com" files under DOS and Windows were all programs that could be done in 64K or less. Beyond 64K, you dealt with EXE files. It's entirely possible to write large EXE application entirely in Assembler, and a variety exist. But things tend to be easier to write and maintain in a higher level language like C.

On 32 bit machines using the 80386, 80486, or Pentium class CPUs, a segment is 4 gigabytes, and the issues faced by old DOS programmers don't exist.

Folks used to write write in Assembler for performance. When the CPU on the PC runs at 4.77mhz, you can run into cases where the machine just isn't fast enough to do what you want in a high level language and you need to get low level to get the performance.

On current hardware, CPU speed is seldom the limiting factor. Most PCs are "I/O bound", not "compute bound". The bottleneck will be reading from/writing to disk, which is why more RAM is the first suggestion for boosting performance, to reduce the need to read from and write to disk. In most of what users do on PCs, the CPU spends most time in a wait state, waiting for user input or for a disk operation to complete, and all machines wait at the same speed.

Can you write in assembler for Linux? Sure. The question is why you would need to. Writing in C or C++, standard system libraries handle a lot of things for you, like startup code. Writing in assembler, you have to handle that yourself. About the only time I can see resorting to assembler is when writing a device driver where you must do low lever hardware access. Even then, you may not have to.

In addition, assembler is by nature processor specific. The assembler code for an Intel or compatible CPU will be quite different from the code for the IBM/Motorola PPC chips used in older Macs, or the SPARC RISC processors used in Sun Microsystems machines, or the ARM processors used by various smartphones. Write your code in portable C or C++ and you ought to be able to move it to a machine running Linux using a different architecture and compile and build it. Write in assembler and you'll have to rewrite from scratch
______
Dennis

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#8 Post by nooby »

Dennis, I trust you on this so when do we use assembler in Linux then?

The thread starter seems to at least want to have it available just in case him needs it?

One good thing would be to be able to run it all in RAM? Instead of having some 1GB programs fighting over a 1GB Netbook that can not be given more memory we can have a 100KB OS that leave 900KB for applications?
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#9 Post by 8-bit »

nooby,
The operating system ISO is around 100 megs, not 100kb.
But.....
When you have the operating system running and setting at the desktop, open a terminal and type "free" in it to see actual memory usage by the operating system.
You will find memory usage is more than 100 megs.

User avatar
KusaNoKaito
Posts: 99
Joined: Fri 19 Feb 2010, 22:52
Location: Florida
Contact:

#10 Post by KusaNoKaito »

technosaurus wrote:the gnu assembler is on the devx sfs as is nasm
I question NASMs power because it is not coded in assembler, its coded in C.
Lobster wrote:You might like to try Linoleum assembler (you will have to compile it first)
http://en.wikipedia.org/wiki/Linoleum_( ... _language)

last Puppy compiling attempted here
http://www.murga-linux.com/puppy/viewto ... 951#100613
Will have a look at that.
nooby wrote: The thread starter seems to at least want to have it available just in case him needs it?

One good thing would be to be able to run it all in RAM? Instead of having some 1GB programs fighting over a 1GB Netbook that can not be given more memory we can have a 100KB OS that leave 900KB for applications?
You're right! i enjoy writing programs from the ground up!

---------

I compiled YASM so people here can use it without installing devx. Note: it appears to be written in several languages.

2lss
Posts: 225
Joined: Sun 20 Sep 2009, 23:54

#11 Post by 2lss »

I've been playing around with writing asm programs for my ti -83 graphing calculator. I have an ide that is set up for the z80 type microprocessor, it's pretty nice. So far I like the "ground up" part but I've only done a couple 'hello world' type programs so my opinion may change later...

I read somewhere that assembly is used by people who reverse engineer software by some how disassembling binaries into asm. Not sure if its true but sounds interesting.

User avatar
KusaNoKaito
Posts: 99
Joined: Fri 19 Feb 2010, 22:52
Location: Florida
Contact:

#12 Post by KusaNoKaito »

2lss wrote:I've been playing around with writing asm programs for my ti -83 graphing calculator. I have an ide that is set up for the z80 type microprocessor, it's pretty nice. So far I like the "ground up" part but I've only done a couple 'hello world' type programs so my opinion may change later...

I read somewhere that assembly is used by people who reverse engineer software by some how disassembling binaries into asm. Not sure if its true but sounds interesting.
Yes there is "dissassemblers" out there people use them to change software crack product keys etc. but why do that when there is open source?

Assembly language teaches really good programing, and how your computer actually works. but its not very useful unless you wanna do something really low level.

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#13 Post by DMcCunney »

KusaNoKaito wrote:
technosaurus wrote:the gnu assembler is on the devx sfs as is nasm
I question NASMs power because it is not coded in assembler, its coded in C.
So is just about everything else. So what?

Remember that Assembler is low level code. Each Assembler language instruction normally translates to one machine language instruction.

With a high level language like C/C++. one line in the source file might compile to hundreds of machine language instructions.

With something like GCC, you rely on the compiler to optimize for you, and generate the best machine code from the high level source. and there will always be tradeoffs, as you can optimize for small code size or high speed, but they are largely mutually exclusive.

With Assembler, optimization is on you. You are specifying exactly what machine code is created, instruction by instruction. The assembler is mostly just translating an assembler mnemonic into the equivalent machine instruction.

Writing an assembler in assembler may make it faster to assemble source to object code, but isn't going to make it more powerful.

C was originally designed for systems programming, to be efficient enough that you didn't have to write in assembler to get performance, and you could do things like write operating systems in it. Linux is written in C.

Unless you absolutely have to for some reason, it's usually better to work in a higher level language than to write in assembler. High level coder is easier to write and maintain, and current hardware is fast enough that performance normally isn't a problem.
______
Dennis

User avatar
efiguy
Posts: 164
Joined: Thu 07 Sep 2006, 02:51

Assembler for puppy

#14 Post by efiguy »

Hi Group,
I work with a few of the automotive computer systems, most of the analysis programs and system programs from processor manufacturers are in windows or old dos format. - Getting tools together to program for microprossers has always been my downfall - always missing some lib or other obscure tidbit.
Some of this involves direct hex editing of binary data files.

Thinking about this thread, - In my simple probing of the Puppy system, it seems that programing or modifing an application is more of a natural state of inherent operation - rather than the windows system - at least it is for me, not being very savvy visual basic programer. And having been able to follow and mod apps with Geany.

Are there cross libraries for 8051, old Motorola, Xilinx, and such for use within Puppy? Dah! never even considered the posibility - for all the other researchers i've been in contact used windo tech.

Jay

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

Re: Assembler for puppy

#15 Post by DMcCunney »

efiguy wrote: Are there cross libraries for 8051, old Motorola, Xilinx, and such for use within Puppy? Dah! never even considered the posibility - for all the other researchers i've been in contact used windo tech.
I think what you're asking for is not Puppy specific.

Linux development is normally done in GCC, the Gnu Compiler Suite. GCC is modular, and implemented as a front-end parser for the languages GCC supports (C, C++, Ada, Fortran, Objective C and Java), and a back end code generator. This separation makes it possible to use GCC as a cross-compiler, writing code on one architecture (in this case, Intel), but compiling machine code for another, like Motorola 680X0 or ARM.

I don't deal with things like Xilinx microcontrollers, but as far as I know, you can use GCC to build code for them.

Puppy does not include GCC by default. To get GCC for Puppy, you'll need to install the appropriate Devx SFS file, which will get you GCC and the related tools. Setting up GCC as a cross-compiler is a non-trivial process. (I have not done it, but know enough to know it's not simple.)

I'd also look at installing Java and Eclipse. Eclipse is IBM's open source programmer's IDE, written in Java, Eclipse is extensible, and has plugins for embedded development. I believe you can find plugins for Eclipse intended for supporting development on things like 8051 chips.

Take Puppy out of the equation for the moment, and do some research on using GCC for this sort of thing, and using Eclipse as your environment. If you determine it's feasible and you want to pursue it, it should be doable in Puppy or any other Linux distro. The most important limitation will be hardware. GCC and Eclipse aren't small programs, and you'll probably want a reasonable machine running Puppy simply so that doing things doesn't take forever.
______
Dennis


User avatar
KusaNoKaito
Posts: 99
Joined: Fri 19 Feb 2010, 22:52
Location: Florida
Contact:

#17 Post by KusaNoKaito »

"Linux Assembly" looks interesting. Thanks for sharing!

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#18 Post by amigo »

asm is commonly found in most distros -you need it to compile things like most bootloaders. It's not big and can be compiled with whatever gcc, etc, you have.

Post Reply