News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_roudoudou

Rasm Z80 assembler

Started by roudoudou, 08:58, 22 February 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

krusty_benediction

For those using Visual Studio Code as Integrated Development Environment for the Amstrad CPC, you can install the "z80 macro assembler" extension that provides syntaxic coloration of code and some snippets for rasm. On my side it has completely replaced vim and its tailored extension. Syntax error analysis is only the missing thing for me

Targhan

QuoteFor those using Visual Studio Code as Integrated Development Environment for the Amstrad CPC, you can install the "z80 macro assembler"


Looks interesting. But the "Goto definition" does not seem to look outside the current file. And how do you create a build task?
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

krusty_benediction

A javascript master like you may be able to fix this goto issue by proposing a patch to its author ;)
On my side I use Makefiles in a Dockerized environment  to manage all my stuff, so my build task is simply a Makefile call. So my minimum tasks.json file looks like taht
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "type": "shell",
            "command": "./bootstrap.sh make",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },

        {
            "label": "CPC",
            "type": "shell",
            "command": "./bootstrap.sh make run_on_cpc",
            "group": {
                "kind": "run",
                "isDefault": false
            }
        }
    ]
}


Targhan

Javascript master? Well, that's one language I certainly don't master :). Thanks for the script, I'll check it out! But right now, the solution isn't as good as what I already have!
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

roudoudou

update v0.96
- bugfix memory leak in tag translation with PRINT directive
- bugfix negative offset with INCBIN
- bugfix autotests memory handling
- added include path in command line
- doc updated
msdos version does not include all v96 update (monday)
My pronouns are RASM and ACE

krusty_benediction

Quote from: Targhan on 10:46, 24 July 18

Looks interesting. But the "Goto definition" does not seem to look outside the current file. And how do you create a build task?
are you sure about the goto thing ? Just be able to jump in another (but opened) file

roudoudou

update v0.97
- bugfix conditionnal code inhibition with macro declaration
- better alias infinite recursivity detection
My pronouns are RASM and ACE

norecess464

So I finally decided to give a try to Rasm.. so far so good :P

The transition was smooth (coming after years of dev under WinAPE). I was used to & for hexadecimal values, had to spend few hours before getting used to # notation.

What I am appreciating so far:
- the doc is awesome (I started with the English version but finally ended with the French one, my eyes were bleeding too much ;-).
- the << >> & parentheses etc. All those stuff works as expected. Under WinAPE, I (sometimes) had to fight with several constants to get same result
- the print vs. fail commands is good catch! I use fail in my macros to simulate an Assert at compile-time, very practical
- WinAPE was often kind of confused when dealing with macros, rasm does a much better job here to handle (report) errors
- looks mature in current state!

Good job Roudoudou.
My personal website: https://norecess.cpcscene.net
My current project is Sonic GX, a remake of Sonic the Hedgehog for the awesome Amstrad GX-4000 game console!

krusty_benediction

Yes, this is definitively the most promising assembler.
However, it is not yet enough mature (I regularly hit bugs), but is going to be as Roudoudou is really reactive when we catch bugs (and is not closed to suggestions).

I have not yet totally switch from vasm to rasm.

HAL6128

Hi @roudoudou
the code next shows me an error message "cannot use register 6<>A in this context". How can I solve this?
Kind regards,
HAL6128

macro setreg val
if {val}<>a
ld a,{val}
endif
push bc
ld bc,PORT ;PORT to be defined
out (c),a
pop bc
endm

org #9000
setreg 6
ret
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

krusty_benediction

conditional directives do not know the content of registers, so this is a correct behavior for any assembler
maybe you should add a second argument to your macro that contains the current value of A but YOU have to know it when calling it

HAL6128


This is a code snipped from 1990. Compiled with Z80ASM which looks like this. Maybe I misinterpreted it?
macro setreg val
ifdif val,a
  ld a,val
endif
.. endm
org #9000
setreg 6
ret

...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

roudoudou

With a (partial) integrated code simulator this may work but not in all cases (example: register a taking his previous value from memory)
Golem is using macros and variables like this, with a variable REG_A mirroring register A, so when he does LD A,n he's doing also REG_A=n
This can work with very linear code
My pronouns are RASM and ACE

roudoudou

update v0.98
- bugfix with snapshot v2 memory size detection
- new optional parameter to get file size when load and crunch on the fly
- new option to remove warnings
- new fake instructions RR,RL,SRL,SRA,SLL,SLA with 16 bits (BC,DE,HL) registers
- preprocessing does not allow empty parameter to avoid confusion
- extended error may suggest a name if a variable/label/alias looks similar to a 'not found' value
My pronouns are RASM and ACE

roudoudou

update v0.99
- new directive UNDEF
- bugfix memory leaks
- bugfix calculations with functions immediatly followed by two or more opened parenthesis
My pronouns are RASM and ACE

Arnaud

#165
Quote from: roudoudou on 14:13, 16 August 18
update v0.99
- new directive UNDEF
- bugfix memory leaks
- bugfix calculations with functions immediatly followed by two or more opened parenthesis
The v1.0 is near  :D 

roudoudou

back from holidays, small update
update v0.100
- bugfix crash with zeroed output file
- bugfix moar memory leaks
My pronouns are RASM and ACE

roudoudou

update v0.101
- warn if no byte is written to a snapshot
- warn if RUN directive was already used
- bugfix calculation error cases
- bugfix maxam AND/OR/XOR/MOD operator (regression of v0.89)
- UNDEF does not care anymore about variable existence
- better error management with macro and wrong number of parameters

Siko is working on a new FR/ENG documentation, please be patient  8)
My pronouns are RASM and ACE

roudoudou

update v0.102
- bugfix 'BREAKPOINT <adress>' export
- bugfix default limit of 65535
- bugfix limit autotest
- bugfix path simplification for dependencies export
- bugfix memory leak when using (VOID) with macro
- new math function to get a random value

My pronouns are RASM and ACE

gryken

Hi,
Very impressive work with RASM  ;)
I have noticed an error in documentation
I think that it should be
- Merkle tree
and not
- Merkel tree.
Don't you think ?

Bye.

roudoudou

Quote from: gryken on 11:31, 29 November 18
Hi,
Very impressive work with RASM  ;)
I have noticed an error in documentation
I think that it should be
- Merkle tree
and not
- Merkel tree.
Don't you think ?

Bye.
Thanks
The documentation will be updated soon
My pronouns are RASM and ACE

krusty_benediction

Hello,I mainly use rasm for my current handwritten code, but I have also written an assembler for my computer generated code (of course, wh'ne I'll have the courage to implement all mnemonics it will replace rasm in my workflow ;)).I have played today with some directives that could be also usefull with rasm.
Here is a test code that validated the approach

        ld a, screen_height
player_line_loop
        stableticker start effectduration ; Start to count nops
            ex af, af'

            pop hl ; 0 1
            xor a : out (c), a : out (c), l
            inc a : out (c), a : out (c), h

            repeat 7
                pop hl ; 2 3 to 14 15
                inc a : out (c), a : out (c), l
                inc a : out (c), a : out (c), h
            endr

            ex af, af'
            dec a
        stableticker stop
        defs 64*3 - effectduration - (1 + duration(jr nz, player_line_loop))
    jr nz, player_line_loop

There is a simple routine that must be played at a certain frequency. Usually we manually compute the number of nops it takes in order to add filling instructions to have the right duration.Its booooring, especially when you forget the timing. So I have added 2 directives to delegate the job to the assembler:- stableticker that counts the number of nops and store them in a variable- duration that can be used in any expression and provide the number of nops of its instruction
Of course there is a limitation with the conditional opcodes having different durations. In my implementation I select the shortest one (that's why I add 1).
This can be generalized to other kind of functions like opcode(mnemonic) that would return the 16bits value of any 8bits/16bits instruction. It will be probalby my homework of tomorrow

@roudoudou what do you think about implementing them (or more egonomics versions) ?

roudoudou

Quote from: krusty_benediction on 00:19, 28 December 18...

This would be cool!
But if you start ticker with a variable name, why not stopping ticker also with a variable name?
Then you may start as many tickers as you want?
My pronouns are RASM and ACE

krusty_benediction

2 resaons :
- I did that late, it is more difficult to make good choices ;)

- I only though about nested calls and not overlapping calls. But yes to provide an optional argument to stop allows to handle all cases

roudoudou

BTW tell us more about your assembler  :P
My pronouns are RASM and ACE

Powered by SMFPacks Menu Editor Mod