* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: scas - a new assembler & linker  (Read 1599 times)

0 Members and 1 Guest are viewing this topic.

Offline SirCmpwn

  • Full User
  • Join Date: Mar 2015
  • Location:
  • Posts: 80
  • Post Rating Ratio: +1/-0
    • View Profile
scas - a new assembler & linker
« on: April 07, 2015, 04:07:31 am »
scas is the assembler and linker that we've been working on to replace sass for KnightOS. It also works great for TIOS. Here's the rundown of what makes it interesting:

  • Separate assembly and linking steps
  • ASxxxx compatibility (which means SDCC support)
  • Runs on any POSIXish system (plus Windows)
  • Detailed documentation and Unix style design
  • Clean and maintainable codebase
  • KEXC, 8xp, and binary output supported

scas is not complete, but the list of features above is working. I can explain in detail why each of those features is important.

Separate assembler and linker
This is really long so I put it in a spoiler tag:
(click to show/hide)

ASxxx compatability
scas is the basis of KnightOS's C support, when combined with kcc (our fork of SDCC). With this, you can write C programs that run on KnightOS. You can probably ALSO write C programs that run on TIOS with scas! More on that soon.

POSIXish support
scas is officially supported on Linux, OSX, Windows, BSD, and BeOS (Haiku). It'll run on just about anything that supports a handful of POSIX functions. You could probably port it to ndless if you wanted, too. Unfortunately it's not likely to run on KnightOS itself, due to size constraints.

Detailed documentation etc
If you're on a Unix system, you'll appreciate the fact that scas has a nice set of man pages. If you're on Windows, you'll appreciate the fact that everyone else has a nice set of man pages to read. The code base is also really clean and easy to get into, unlike basically every other assembler.

KEXC, 8xp, and binary output
scas natively supports KEXC (the KnightOS executable format), 8xp (the TIOS executable format), and straight up binary. Example:

scas -fformat=8xp -f8xp-name=SOMENAME -f8xp-protected=yes [rest of args]

Conclusions
scas is shaping up to be the best assembler (and linker) for z80 out there. I really like it. It's not completely done yet, but you can probably start using it for your projects now (several people in the KnightOS community are) so long as you're okay with the occasional breakage. I'll keep you guys updated on progress.

https://github.com/KnightOS/scas

One of the things KnightOS tries to do is not only make an OS for calcs, but improve the tooling we have for calculators even outside of KnightOS. scas is part of that mission.



Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3137
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: scas - a new assembler & linker
« Reply #1 on: April 07, 2015, 09:35:57 am »
Cool :) Though i can't build it myself and the version you gave me doesn't work :/
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline Duke "Tape" Eiyeron

  • Urist McEiyolobster
  • Super User
  • Join Date: Nov 2014
  • Location: (V)(-_(//));(V)
  • Posts: 1636
  • Post Rating Ratio: +11/-2
  • Fanciest Walrus of the oceans.
    • @@Eiyeron
    • Eiyeron
    • /u/Eiyeron
    • Eiyeron
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
  • Gender: Male
Re: scas - a new assembler & linker
« Reply #2 on: April 07, 2015, 11:44:49 am »
Nice work! Does it support gcc's object file? (Just for curiosity)
  • Calculators owned: A lot.

Offline SirCmpwn

  • Full User
  • Join Date: Mar 2015
  • Location:
  • Posts: 80
  • Post Rating Ratio: +1/-0
    • View Profile
Re: scas - a new assembler & linker
« Reply #3 on: April 07, 2015, 02:00:32 pm »
Nice work! Does it support gcc's object file? (Just for curiosity)

No. We have a different object file format (elf is ill suited to 8-bit CPUs). Our object format is documented here:

https://github.com/KnightOS/scas/blob/master/doc/sobj

Offline Duke "Tape" Eiyeron

  • Urist McEiyolobster
  • Super User
  • Join Date: Nov 2014
  • Location: (V)(-_(//));(V)
  • Posts: 1636
  • Post Rating Ratio: +11/-2
  • Fanciest Walrus of the oceans.
    • @@Eiyeron
    • Eiyeron
    • /u/Eiyeron
    • Eiyeron
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
  • Gender: Male
Re: scas - a new assembler & linker
« Reply #4 on: April 07, 2015, 03:27:40 pm »
As I said, it was by curiosity. and gcc seems to let executable with a consequent size most of the time...
  • Calculators owned: A lot.

Offline SirCmpwn

  • Full User
  • Join Date: Mar 2015
  • Location:
  • Posts: 80
  • Post Rating Ratio: +1/-0
    • View Profile
Re: scas - a new assembler & linker
« Reply #5 on: April 07, 2015, 03:28:43 pm »
As I said, it was by curiosity. and gcc seems to let executable with a consequent size most of the time...

The question did not upset me. What do you mean by a "consequent size"?

Offline Duke "Tape" Eiyeron

  • Urist McEiyolobster
  • Super User
  • Join Date: Nov 2014
  • Location: (V)(-_(//));(V)
  • Posts: 1636
  • Post Rating Ratio: +11/-2
  • Fanciest Walrus of the oceans.
    • @@Eiyeron
    • Eiyeron
    • /u/Eiyeron
    • Eiyeron
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
  • Gender: Male
Re: scas - a new assembler & linker
« Reply #6 on: April 07, 2015, 03:31:27 pm »
I remembered seeing full fledged C compilers which outputted (very) smaller object files from the same sources than GCC.
  • Calculators owned: A lot.

Offline SirCmpwn

  • Full User
  • Join Date: Mar 2015
  • Location:
  • Posts: 80
  • Post Rating Ratio: +1/-0
    • View Profile
Re: scas - a new assembler & linker
« Reply #7 on: April 07, 2015, 03:35:30 pm »
I remembered seeing full fledged C compilers which outputted (very) smaller object files from the same sources than GCC.

I see. That's not entirely relevant to how scas works - scas is an assembler for z80, which is an 8-bit CPU. gcc mainly targets i686 (or x86/amd64), which is 32 to 64 bits. The object format gcc/gas/gold uses is ELF, which is well suited to such architectures. scas uses SCASOBJ, which is better suited to 8-bit architectures (and is actually flexible enough to support any width of arch up to 64, fwiw). ELF only (according to the spec, at least) supports 32 and 64 bit architectures, and uses data structures that are more difficult to implement on an 8 bit architecture, and as such I didn't think it was a good idea to use ELF. That being said, I just recently built some abstractions around the code for generating output files and adding ELF support is probably possible if you truly desire it.

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games