Author Topic: Rasm Z80 assembler v0.117 [update 2019.11.22]  (Read 31532 times)

0 Members and 2 Guests are viewing this topic.

Offline krusty_benediction

  • CPC664
  • ***
  • Posts: 140
  • Country: fr
  • Liked: 102
  • Likes Given: 36
Re: Rasm Z80 assembler v0.103 [update 2018.10.17]
« Reply #175 on: 17:23, 28 December 18 »
It is currently only a library ;not an executable able to assemble any file.I have not implemented all the mnemonics and directives. Only the things I needed to advance.
I have a parser that generates tokens from a source code. These same tokens can be generated (to noyt code the effect myseld) or manipulated (to optimize or inject specific code at specific place/moment) by my other demotools.
And I have the assembler that transform these tokens in a stream of bytes. My other tools inject them in a snapshot.
So barely useable by someone else ;) If you are curious, everything is there: https://github.com/cpcsdk/rust.cpclib/tree/master/src/assembler

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.103 [update 2018.10.17]
« Reply #176 on: 09:33, 02 January 19 »
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
I've done the ticker  ;)
update v0.105- bugfix wrong error with operator+non decimal negative value
- do not allow CALL (IX) or CALL (IY) syntax
- added comments begining with //
- added SIZEOF support for fields of structures
- new directive TICKER to count instruction duration
New French and English documentation by Siko (St├ęphane S.) in the first post 8)

use RASM, the best assembler ever made :p

I will survive

Offline krusty_benediction

  • CPC664
  • ***
  • Posts: 140
  • Country: fr
  • Liked: 102
  • Likes Given: 36
Re: Rasm Z80 assembler v0.105 [update 2019.01.02]
« Reply #177 on: 20:00, 02 January 19 »
super manuel. Il y a quelques typos avec {sizeof}

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #178 on: 16:36, 16 January 19 »
update v0.106

- multi-line comments with /*  */

update v0.107
- colored output with Unix terminal- trigger error if a (VOID) arg is used with a macro which has parameter(s)
- added Vasm syntax ENDREP and ENDREPEAT to end a REPEAT block
- enforce zero result when there is an error in a calculation
- new directives NOEXPORT/ENOEXPORT to disable/enable on demand symbol export
use RASM, the best assembler ever made :p

I will survive

Offline norecess

  • CPC664
  • ***
  • Posts: 98
  • Country: ca
  • Liked: 254
  • Likes Given: 87
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #179 on: 16:50, 16 January 19 »
Thanks @roudoudou !!

Offline HAL 6128

  • 464 Plus
  • *****
  • Posts: 491
  • Country: de
    • index.php?action=treasury
  • Liked: 243
  • Likes Given: 1213
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #180 on: 21:20, 16 January 19 »
Really cool progress. Would it also possible to have (oldschool) .PHASE and .DEPHASE directives , like in the M80 assembler?
...proudly supported Schnaps Demo and Pentomino, NQ-Music-Disc with GFX

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #181 on: 22:14, 16 January 19 »
Really cool progress. Would it also possible to have (oldschool) .PHASE and .DEPHASE directives , like in the M80 assembler?
I may add it in the next release, but you can do it already with macros  ;D
Code: [Select]
macro phase adr
org {adr},$
mend
macro dephase
org $
mend
use RASM, the best assembler ever made :p

I will survive

Offline HAL 6128

  • 464 Plus
  • *****
  • Posts: 491
  • Country: de
    • index.php?action=treasury
  • Liked: 243
  • Likes Given: 1213
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #182 on: 13:07, 17 January 19 »
Very helpful, thanks!
...proudly supported Schnaps Demo and Pentomino, NQ-Music-Disc with GFX

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 960
  • Country: fr
  • Liked: 920
  • Likes Given: 141
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #183 on: 00:55, 23 January 19 »
What would you think the best way to emulate the MAP feature of SJAsmPlus:



   MAP 8
Label # 2     ; Label=8
Kip   # 3     ; Kip=10
Kop   #       ; Kop=13
Kop2  # 1     ; Kop2=13

I would like to avoid doing this:
Start equ #4000
Stuff1 equ Start + 0
Stuff2 equ Start + 1
Stuff3 equ Start + 3
...
Ideally, I'd like to declare the size of each item:
Start <struct> #4000
stuff1 <declare byte>     ;stuff1=#4000
stuff2 <declare word>    ;stuff2=#4001
stuff3 <declare word>    ;stuff3=#4003
...
« Last Edit: 01:05, 23 January 19 by Targhan »
Targhan/Arkos

Arkos Tracker 2 - alpha 7 now released! - Follow the news on Twitter!
Disark A cross-platform Z80 disassembler/source converter

Imperial Mahjong
Orion Prime

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #184 on: 08:16, 23 January 19 »
you have the STRUCT directive
Code: [Select]
struct targhan
stuff1 defs 1
stuff2 defs 4
stuff3 defs 2
stuff4
endstruct

nocode
org #4000
struct targhan m4
code

; m4.stuff1=#4000
; m4.stuff2=#4001
; m4.stuff3=#4005
; m4.stuff4=#4007
use RASM, the best assembler ever made :p

I will survive

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 960
  • Country: fr
  • Liked: 920
  • Likes Given: 141
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #185 on: 10:03, 23 January 19 »
Ahhhh good. I knew about Struct, but forgot about the "nocode" directive. Thanks!!
Targhan/Arkos

Arkos Tracker 2 - alpha 7 now released! - Follow the news on Twitter!
Disark A cross-platform Z80 disassembler/source converter

Imperial Mahjong
Orion Prime

Offline krusty_benediction

  • CPC664
  • ***
  • Posts: 140
  • Country: fr
  • Liked: 102
  • Likes Given: 36
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #186 on: 14:35, 23 January 19 »
I think it is not documented; I discovered it in the post

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #187 on: 14:56, 23 January 19 »
I think it is not documented; I discovered it in the post
These directives are obsolete. They were used in Maxam in order to create kind of structures.
I realize now that we can have a more modern usage  :D
use RASM, the best assembler ever made :p

I will survive

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.398
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 794
  • Likes Given: 1674
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #188 on: 17:13, 23 January 19 »
Well, IMHO nocode is really useful, every assembler should understand it. I work with Z80, I have my style and I don't need anything modern.  ;D ;) :)
RASM is great, and Maxam compatibility is (for me) the most important thing.  :)
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 960
  • Country: fr
  • Liked: 920
  • Likes Given: 141
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #189 on: 20:26, 23 January 19 »
It works, but makes the code a bit complicated :). The ORG change is problematic, so I have to save it and restore it then:
SaveOrg = $
...
org SaveOrg


But it works :).
Targhan/Arkos

Arkos Tracker 2 - alpha 7 now released! - Follow the news on Twitter!
Disark A cross-platform Z80 disassembler/source converter

Imperial Mahjong
Orion Prime

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #190 on: 21:22, 23 January 19 »
It works, but makes the code a bit complicated :) . The ORG change is problematic, so I have to save it and restore it then:
SaveOrg = $
...
org SaveOrg


But it works :) .
I will read again the MAXAM doc about the behaviour of CODE/NOCODE

« Last Edit: 21:24, 23 January 19 by roudoudou »
use RASM, the best assembler ever made :p

I will survive

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.398
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 794
  • Likes Given: 1674
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #191 on: 21:53, 23 January 19 »
Assembling in RAM: NOCODE will stop putting bytes into RAM, when using CODE the bytes are again written in RAM, at the right address.

Assembling to disc: NOCODE stops writing bytes to the output file (binary), then the CODE command will again write the bytes to the file, but the gap in between will NOT be filles with zeros.

So after NOCODE and CODE the binary output file will have a gap and the bytes written after CODE are to early in the file.

Usage of NOCODE: Very nice when testing, but you don't want to write to RAM or file.
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #192 on: 23:52, 23 January 19 »
Thanks Gunhed so the actual NOCODE is legacy but i may add an option to CODE to get the previous $
CODE NOGAP or something like this?
use RASM, the best assembler ever made :p

I will survive

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 960
  • Country: fr
  • Liked: 920
  • Likes Given: 141
Re: Rasm Z80 assembler v0.107 [update 2019.01.16]
« Reply #193 on: 21:51, 27 January 19 »
Advice needed. The Arkos Tracker players have duplicated code (for each channel). I'd like to avoid this, but this is tricky. Maybe one of you can enlighten me on how to improve this.

I know I can use macro and local labels.

MACRO ManageNote
ld hl,(@stuff + 1)
@stuff ld de,#4000
ENDM

ManageNote ;For channel 1
ManageNote ;For channel 2
ManageNote ;For channel 3

The problem is, I would like to have these macros to address labels from the related channel.

MACRO ManageTrack
ld hl,(@stuff + 1)     ;From the macro above!!
ld de,12
add hl,de
ENDM

ManageTrack ;For channel 1
ManageTrack ;For channel 2
ManageTrack ;For channel 3

How is it possible? I should be able to generate labels, maybe from placeholder and parameters in the macro, but it probably won't work...
... After testing... YES IT WORKS!! Damn, this is great!

        MACRO test chan
         defb {chan}
stuff{chan} ld a,0
        ENDM
       
        test 1     ; This generated a "stuff1" label!
        test 2     ; This generated a "stuff2" label!

This is amazing!! Well done Roudoudou!! This is crazy stuff. Ok, I guess I have found my solution, but if anyone want to add it 2 cents, thanks :).
Targhan/Arkos

Arkos Tracker 2 - alpha 7 now released! - Follow the news on Twitter!
Disark A cross-platform Z80 disassembler/source converter

Imperial Mahjong
Orion Prime

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.108 [update 2019.01.28]
« Reply #194 on: 09:18, 28 January 19 »

update v0.108

- allow var name beginning with '_'

- CODE directive may retrieve last outputed byte adress


Code: [Select]
org #100
nocode
nop
code
print $ ; #101

org #200
nocode
nop
code skip
print $ ; #200
use RASM, the best assembler ever made :p

I will survive

Offline HAL 6128

  • 464 Plus
  • *****
  • Posts: 491
  • Country: de
    • index.php?action=treasury
  • Liked: 243
  • Likes Given: 1213
Re: Rasm Z80 assembler v0.108 [update 2019.01.28]
« Reply #195 on: 16:17, 28 January 19 »
Hi roudoudou,
a question regarding the 'save' directive: what are the options for overwriting an existing file on a DSK?
...proudly supported Schnaps Demo and Pentomino, NQ-Music-Disc with GFX

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.108 [update 2019.01.28]
« Reply #196 on: 21:34, 28 January 19 »
Hi roudoudou,
a question regarding the 'save' directive: what are the options for overwriting an existing file on a DSK?
this is the -eo option with the command line
use RASM, the best assembler ever made :p

I will survive

Offline krusty_benediction

  • CPC664
  • ***
  • Posts: 140
  • Country: fr
  • Liked: 102
  • Likes Given: 36
Re: Rasm Z80 assembler v0.108 [update 2019.01.28]
« Reply #197 on: 21:23, 02 February 19 »
Here is another directive suggestion for rasm LOCOMOTIVE/ENDLOCOMOTIVE in order to generate basic bootstrap code that launches the binary file.I've just validated the concept with my prototype assembler.
Here is the sample file I have produced (and I have enclosed the generated file):

    LOCOMOTIVE code
10 ' Hello world
20 call {code}
    ENDLOCOMOTIVE

code

    di
        ld hl, 0xc9fb
        ld (0x38), hl
    ei
   
    ld bc, 0x7f10 : out (c), c
    ld a, 0x40 : out (c), a
    jp $


The assembler generates the tokens of the basic program.One of the instruction is call {code} where {code} is replaced by the value of the label {code} in the assembly code. So any {XXX} is replaced by the value of XXX in the symbole table if XXX is provided as an argument of LOCOMOTIVE

It is probalby interesting to add specific comments that contain tags asking to hide some basic lines (for a demo line 20 should be hidden).




Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.108 [update 2019.01.28]
« Reply #198 on: 22:35, 02 February 19 »
would be such a huuuuuuuuuuuge work

ps: PDF documentation updated!
« Last Edit: 23:28, 02 February 19 by roudoudou »
use RASM, the best assembler ever made :p

I will survive

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 694
  • Country: fr
    • urban exploration
  • Liked: 968
  • Likes Given: 610
Re: Rasm Z80 assembler v0.108 [update 2019.01.28]
« Reply #199 on: 12:11, 03 February 19 »
Hi roudoudou,
a question regarding the 'save' directive: what are the options for overwriting an existing file on a DSK?
I found an issue with file overwriting and DSK update
You should delete the dsk meanwhile i fix this
use RASM, the best assembler ever made :p

I will survive