News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

reliving 30+ year old memories by building a Z80 assembler in Basic

Started by eriktier, 12:02, 08 May 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

eriktier

During my recent vacation I decided to write a Z80 assembler in Locomotive Basic, with the specific goal of being able to assemble and run a simple program by the end of the vacation (ended up taking les s than 3 days :): https://erikvandertier.com/blog/coding/basm-basic-assembler-part-1/
The GitHub repo can be found here: https://github.com/eriktier/BASM
I've gotten quite a bit further on it since the end of my vacation. Next plans are to finish it (support full instruction set and at least support for labels), then built a simple game using it and finally porting the assembler to assembler and have it assemble that version ;)
Anyway, hope you enjoy and get inspiration for your own projects.


Cheers,
  Erik

andycadley

Neat. I remember writing my first assembler in Locomotive BASIC and it taught me a fair deal about how the Z80 instruction set is arranged. It wasn't fast, but it worked. :-)

tjohnson


menegator

Wow,

I remember a disassembler that I wrote in basic as part of a memory monitor. It worked but it was sloooooow however I used it as proof of superiority both of locomotive basic and amstrad cpc 6128

In the end my program ended too big to be a useful monitir but the hell with it, i wrote it because i could!

I learned assembly in order to make a parser for a mini language used in my dbase like app, but in the end I abandoned it because the main program (writen in basic) became also too big to be usefull.

These were the days my friends...

Sykobee (Briggsy)

My first assembler was a BASIC program from CWTA.


You would write your ASM as BASIC comments in the assembler listing itself, which the assembler code would read from memory to assemble!

eriktier


Yeah, might have been the same as I used, and which is what I'm building now as well.

Quote from: Sykobee (Briggsy) on 13:00, 10 May 18
My first assembler was a BASIC program from CWTA.


You would write your ASM as BASIC comments in the assembler listing itself, which the assembler code would read from memory to assemble!

SRS

I used this one for ages:
Quote10000 '********************************
10001 '*      CPC  International      *
10002 '*        Z 80-ASSEMBLER        *
10003 '*    c 1985 Matthias Uphoff    *
10004 '********************************


then switched to the advanced version:
Quote10000 '***********************************
10010 '*****  CPC - Assembler V 2.0  *****
10020 '***** (c) 1987 DMV / M.Uphoff *****
10030 '***********************************


eriktier


This might well have been the one I used as well. Hard to say after so many years ;)

Quote from: SRS on 11:10, 11 May 18
I used this one for ages:


AMSDOS

I was too young to really understand what Machine Code was and what an Assembler did when I wanted to get back into typing in Type-ins. That occurred once I had typed in all the programs (mostly games), from the Magazines we had from 1985, which was a couple of ACUs and the Aussie The Amstrad User magazine. After that I was collecting Amstrad Action with Issue 44, the 1st program in that was the Game of Life with lengthy Machine Code loader. I remember making 2 mistakes in the data and the program stopped, so I removed the STOP command, fortunately the program didn't crash, unfortunately the program was corrected and the old version was wiped over. If there was ever a bad time to get into typing in programs AA44 presented challenges, after all I was using a 464, didn't know anything about Machine code, so the type-ins presented was Life, Binary Loader, Hacker extra which was just an explanation on using Hacker from AA43, the BASIC 1.1 Abstract program and the Discourse program. It was also the issue prior to AA launching their Typerwriter program!  :o
By AA48 I remember putting the magazine back on the stand at the newsagents because I missed AA45 with the Typewriter program and was so confused, it wasn't until my brother showed me that I didn't need the Typewriter program by typing in some checksummed programs in AA46, to get them working on our 464, I decided to buy more AA. That commenced with AA50, which was again another bad issue to be typing in programs from. Though on this occasion, most of the programs had bugs in them. I remember typing in Boggle and getting that to work by removing the BASIC 1.1 command that AA advised 464 users to do and then there was the Fireworks program & the David Hall screen demos. Later on when I got to understand the DATA being Machine Code, I used that to convert an early Assembly example from one of the early ACUs we had, which was of a simple game, you used your ship to shoot the other one down, though you also had to avoid the bombs it dropped in your direction. Anyhow, I remember the data it was coded in for the BASIC loader was in decimal, so I used the Data Creator in AA50 to make it Hexadecimal.

Though it wasn't until AA had permanent covertapes, I ever got into understanding Assembly language. The 3rd tape which had Spindizzy & Wizard's Lair, had a Toolkit program on it, which was the 1st Monitor program I had which had all these neat things for Disassembling, Viewing Memory and Poking to Memory as well as a Graphical Memory Representation of the memory being used and finally by the 5th Covertape, Devpac had arrived and that was when I started typing in Assembly programs!  :D
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod