LisaList2

Advanced search  

News:

2022.06.03 added links to LisaList1 and LisaFAQ to the General Category

Pages: [1]   Go Down

Author Topic: Somewhat OT, but, EASy68k CLI assembler for Linux now available  (Read 10919 times)

rayarachelian

  • Administrator
  • Hero Member
  • *****
  • Karma: +105/-0
  • Offline Offline
  • Posts: 772
  • writing the code,writing the code,writing the code
    • LisaEm

In case you're doing assembly development for the Lisa, or want to assemble NeoWidEx, Tom's bootloader, or NanoBug, this might be useful. It's the EASy68k assembler pulled out from the EASy68k IDE and ported to Linux. Likely it will work on mac OS X/*BSD as well, haven't yet tested.
I'll try to build it on macos X at some point and if I can get it built on Windows, I'll do that too, but for now it's got a stupid simple Makefile that works on Linux and isn't necessarily guaranteed to work anywhere else, but might.  :o
https://github.com/rayarachelian/EASy68K-asm
Note that I'm not 100% certain this is working as it should as it produces somewhat different output than assembling the same code via EASY68k within WINE. Do let me know if you find bugs please.
Logged
You don't know what it's like, you don't have a clue, if you did you'd find yourselves doing the same thing, too, Writing the code, Writing the code

jamesdenton

  • Administrator
  • Sr. Member
  • *****
  • Karma: +67/-0
  • Offline Offline
  • Posts: 164
  • ArcaneByte
    • ArcaneByte
Re: Somewhat OT, but, EASy68k CLI assembler for Linux now available
« Reply #1 on: October 08, 2019, 09:43:33 pm »

I recently kicked the tires on this, and had to make a couple of changes to get it to compile on Mac OS X (Mojave), namely:

1. In asm.h:

// Replace the location of malloc for OS X
//#include <malloc.h>
#include <malloc/malloc.h>

2. In STRUCTURED.CPP:

// Comment this out for OS X
//#include <bits/stdc++.h> // RA added

I put together a simple 'Hello World' example that assembled successfully:

---
macbook-pro:simple jdenton$ cat hello.asm
START   ORG   $1000

   LEA   MESSAGE,A1
   MOVE.B   #14,D0
   TRAP   #15

   MOVE.B   #9,D0
   TRAP   #15

MESSAGE DC.B   'Hello World!',0

   END   START
---

macbook-pro:simple jdenton$ asy68k hello.asm
Assembling hello.asm

I opened up the resulting hello.S68 file in Sim68k and it ran! I was able to assemble NeoWidEx without any errors, and Sim68k didn't complain, but I'm not sure how to get it from assembled application to disk to Lisa. Another task for another day.
Logged

rayarachelian

  • Administrator
  • Hero Member
  • *****
  • Karma: +105/-0
  • Offline Offline
  • Posts: 772
  • writing the code,writing the code,writing the code
    • LisaEm
Re: Somewhat OT, but, EASy68k CLI assembler for Linux now available
« Reply #2 on: October 09, 2019, 12:22:27 pm »

I recently kicked the tires on this, and had to make a couple of changes to get it to compile on Mac OS X (Mojave), namely:

1. In asm.h:

// Replace the location of malloc for OS X
//#include <malloc.h>
#include <malloc/malloc.h>

2. In STRUCTURED.CPP:

// Comment this out for OS X
//#include <bits/stdc++.h> // RA added

I put together a simple 'Hello World' example that assembled successfully:

---
macbook-pro:simple jdenton$ cat hello.asm
START   ORG   $1000

   LEA   MESSAGE,A1
   MOVE.B   #14,D0
   TRAP   #15

   MOVE.B   #9,D0
   TRAP   #15

MESSAGE DC.B   'Hello World!',0

   END   START
---

macbook-pro:simple jdenton$ asy68k hello.asm
Assembling hello.asm

I opened up the resulting hello.S68 file in Sim68k and it ran! I was able to assemble NeoWidEx without any errors, and Sim68k didn't complain, but I'm not sure how to get it from assembled application to disk to Lisa. Another task for another day.

Great! Thanks! I'll have to make a note to update the code for that.

Actually if you look at the NeoWidEx stuff and the boot loader code Tom Stepleton has, he's got a bit of python code that builds a bootable Disk Copy image as the end result. But then if you're just trying to transfer a single file rather than to boot a standalone app like NeoWidEx, that's not going to do it.

You could also create a large file on a fully erased ( zero filled) floppy that contains a single file with nothing but sequential NOPs, make an image of that image, and then use LisaFSH-tool to replace it with your freshly assembled code a block at a time. It's not very straightforward, but could be done.  LisaFSH-tool is somewhat scriptable in the sense that you can pipe commands and data to it as if you were typing it, so if you write a bit of a script that keeps track of the sequential order of the sectors on such a floppy, and converts each block into hex and the right commands, you could use that to generate a Disk Image, which can then be fed to the Lisa.

If that's not good enough you can directly use libdc42 to read/write blocks and create images. But it doesn't understand the file system, so it's all block oriented. But if you start with a known image and know the sequence of blocks, it can be done. libdc42 works a lot like fopen/fread/fwrite/fclose but with dc42 images.  You'd always open an existing image, then you'd get back a pointer to a handle - just like fopen gives, which can then be used to read/write blocks and tags and then you'd close the image when you're done. There's some other functions that create a blank new image or convert an image, etc. It's documented in the comments at the top of the .h and or .c files.

I thought I could get a better lisafsh-tool file system handler for the Lisa built in a few days, but I was way off. :) and got busy/side tracked with other things, but that is on the stack of things to do eventually.

You can also paste text from the clipboard into LisaEm running the LPW Editor, but that's less ideal as you'd need something on the Lisa side to convert hex to binary and write it to a file. It doesn't look like LisaTerminal supports Xmodem or other file transfers sadly, though you can copy and paste from it to a Write document. http://bitsavers.org/pdf/apple/lisa/office_system/A6L0147_LisaTerminal_1983.pdf

Perhaps you could write a program in LPW that receives from the serial port and writes to a file using Xmodem (or better yet zmodem) and vice versa? Once compiled and linked that should work on LisaEm (since the trouble with LisaEm is the linker trips some weird emulation bug.)

XModem is pretty trivial to implement, either in C, Pascal, or 68k, ZModem a lot more complex, but there are reference implementations of various rzsz in C. You might compile one of those with a 68k toolchain on your macbook and then move the assembled code to the Lisa. I think there's some gcc toolchain out there for the Amiga that runs on modern linuxen. I think Steve Chamberlin of Big Mess O'Wires mentioned in his 68KATY project. Might be worth messing with.

Logged
You don't know what it's like, you don't have a clue, if you did you'd find yourselves doing the same thing, too, Writing the code, Writing the code
Pages: [1]   Go Up