3

I am trying to learn IBM's basic assembly language and I was wondering if there was a way of assembling BAL code on a Linux guest running on a mainframe?

I have nasm and as installed, but I think these are normally used for Intel processors rather than Z.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • I never felt the urge while I had access to zLinux, but does this wikipedia article help? https://en.wikipedia.org/wiki/IBM_Basic_Assembly_Language_and_successors – tink Jul 16 '19 at 20:40
  • 1
    Nasm is only x86, despite its name of Netwide Assembler. The default `as` will be for the host machine. You will need a cross-compiled toolchain for the target `as`. (Are you sure you need a cross `as`? Usually you just need an interpreter for Basic). – jww Jul 16 '19 at 21:07
  • @jww: It's named that way because it can *run* anywhere. (Unlike some earlier assemblers, especially DOS-based, that weren't portable or even freely distributable over the 'net). It doesn't have to run on an x86 host, but it does only work with x86 machine code. [What does "netwide" mean in Netwide Assembler (NASM)?](//stackoverflow.com/q/55653976) – Peter Cordes Jul 17 '19 at 06:37
  • I'd expect `as` to always target the native machine-code of your Linux install, though. You can just use `gcc -c` to assemble `.s` or `.S` files (with `as`). Or `gcc` (without -c) to assemble+link. – Peter Cordes Jul 17 '19 at 06:39
  • 1
    The GNU assembler does support s390x if configured correctly and so does the Go assembler. However, the syntax is quite different from the IBM assembler. – fuz Jul 17 '19 at 15:59

2 Answers2

3

There is a tool chain in Linux so that you can write assembler. as as an assembler then link edit and go. However, assembler is just a “language” which depends on a broader eco-system of APIs.

For instance, on z/OS there are a number of manuals that document the interfaces to operating system services, authorization of assembler and other “operating system services” that are going to vary depending on the OS you are developing in.

If you want to code 390x assembler on Linux you can but you are using OS services in Linux which are very different than other OS’ like z/OS.

If you are interested in a compare and contrast of the architectural differences between z/OS and zLinux you will find this presentation enlightening.

Hogstrom
  • 3,581
  • 2
  • 9
  • 25
2

Here are a few other possibilities, in no particular order:

  1. IBM offers a commercially licensed HLASM for Linux on Z/LinuxONE. The standalone IBM Program Number for IBM HLASM is 5696-234, but it can also be licensed via other IBM operating systems for Z, such as z/OS. IBM distributes HLASM for Linux as a .rpm file, and it'll be something like asma90-1.6.0-47.rpm (where 47 is a revision level, the most current I see at the moment but subject to change).

  2. Dignus offers a commercially licensed product known as Systems/ASM (or DASM for short).

  3. z390 may be of interest: http://www.z390.org Please note that z390 apparently hasn't been updated since 2012, so it likely won't include support for recent machine models' instructions.