flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > Assembler support for 8080 or Z80 on linux hosts

Author
Thread Post new topic Reply to topic
al_Fazline



Joined: 24 Oct 2018
Posts: 54
al_Fazline 05 Jan 2023, 08:48
I have found a web based assembler, or actually three of them,

https://svofski.github.io/pretty-8080-assembler/ this one looks the best so far, however it's far from ideal since it's based on the web.

https://www.asm80.com/index.html this one is a bit more complex, having an entire IDE. I'd say it's too complex.

https://eliben.org/js8080/ this is the simplest one, however I didn't get anything useful out of it.

PS https://rk86.ru/ this one is quite good and includes an emulator, but the update is lagging a bit, so you might be running old version of your code unknowingly. Same goes with hexdump views, they are not updated until you switch pages.

GNU as seem to be able to support z80, however I'm not sure how usable it is going to be.

as86, nasm and yasm only seem to support x86 code.

There is a topic of fasmg plugin for 8085. I haven't tested it thoroughly, but it's not ideal because it does not support non-x86 hosts, such as arm64-based desktops without things like qemu-usermode.

So, I guess GNU as is the way to go, since it supports binary output format and comes included with the operating system. However quick search didn't reveal any code examples, so I'm yet to learn how to use it..

So, here is my first program for Radio 86rk, which outputs HL register pair in hex first, to confirm the endianess, then uses a syscall to get the highest address of usable memory, then returns control to the MONITOR.

Code:
; code for https://svofski.github.io/pretty-8080-assembler/
; outputs end of available RAM in hex codes
; target file name and type (radio-86rk)
.project ram_end.rk
.tape rk-bin

org 100h

; constants
quit equ 0xf86c
print_hex equ 0xf815
puts equ 0xf818
ram_size equ 0xf830

start:
        lxi hl, nline   ; to avoid overwriting the prompt
        push h
        call puts       ; make a line break
        pop h           ; the syscall seems to alter the HL
        call print_hl   ; this should print nline address
        call puts
        call ram_size   ; end of available ram -> hl
        call print_hl
        jmp quit        ; exit to monitor

print_hl:
        mov a,h
        call print_hex  ; print a in hex
        mov a,l
        call print_hex
        ret
nline:
        db 0x0d, 0x0a, 0x00
    


I would appreciate help in translating this to as code, as well, as testing the code in various emulators or on a real machine if you have got one.
Post 05 Jan 2023, 08:48
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 08 Jan 2023, 18:26
try this in emu80:
Code:
;=======================================================================
include "8085.inc"
include "rks.inc"
;-----------------------------------------------------------------------
rk_start
;-----------------------------------------------------------------------
; code for https://svofski.github.io/pretty-8080-assembler/
; outputs end of available RAM in hex codes
; target file name and type (radio-86rk)
;.project ram_end.rk
;.tape rk-bin

;org 100h

; constants
quit equ 0xf86c
print_hex equ 0xf815
puts equ 0xf818
ram_size equ 0xf830

start:
        lxi h, nline   ; to avoid overwriting the prompt
        push h
        call puts       ; make a line break
        pop h           ; the syscall seems to alter the HL
        call print_hl   ; this should print nline address
        call puts
        call ram_size   ; end of available ram -> hl
        call print_hl
        jmp quit        ; exit to monitor

print_hl:
        mov a,h
        call print_hex  ; print a in hex
        mov a,l
        call print_hex
        ret
nline:
        db 0x0d, 0x0a, 0x00
;-----------------------------------------------------------------------
rk_end
;=======================================================================

    


Description:
Filesize: 668 Bytes
Viewed: 1993 Time(s)

convert_rk.png


Description:
Download
Filename: convert_rk.rk.zip
Filesize: 200 Bytes
Downloaded: 147 Time(s)


_________________
UNICODE forever!
Post 08 Jan 2023, 18:26
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 08 Jan 2023, 18:28
source has a typo: lxi hl
Post 08 Jan 2023, 18:28
View user's profile Send private message Visit poster's website Reply with quote
al_Fazline



Joined: 24 Oct 2018
Posts: 54
al_Fazline 09 Jan 2023, 15:19
shoorick, It was not a typo, pretty 8080 assembler accepts this form of instruction, which actually is logical, since the operation is done on register pair HL, rather than just register H.
Post 09 Jan 2023, 15:19
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 09 Jan 2023, 19:07
logical or not it is incompatible with standard intel instructions set for i8080
Post 09 Jan 2023, 19:07
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.