News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_m_dr_m

Orgams: Best assembler in my living room.

Started by m_dr_m, 04:57, 28 April 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Orgams: Separator for module (aka namespace)

. (dot)
7 (87.5%)
:: (double colon)
1 (12.5%)

Total Members Voted: 8

Ast

it would be friendly to use



/*
ld hl,#4000
ld de,#4001
ld bc,#3fff
ld (hl),l
ldir
*/
ld hl,#c000 ; this instruction will be assembled.



in this case, all the instructions between /* and */ are comments...





_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

m_dr_m

#51
Thank you for the suggestion.
Yet, in my book it's far more convenient to do:

if 0
ld hl,#4000
ld de,#4001
ld bc,#3fff
ld (hl),l
ldir
end


or even better:


clear_screen = 0
display_tm = 1
dev_checks = 1
[...]


if clear_screen
ld hl,#4000
ld de,#4001
ld bc,#3fff
ld (hl),l
ldir
end


So you can control all conditional assembly from one place, and go from the flag definition to its use(s) with CONTROL-*.
There are other advantages not to bury code in comments.

Alternatively, you can put the clear routine in a macro, and just comment the macro invocation.


Be creative!

GUNHED

#52
Or get out of the 50ies. Let the Editor care about what's comment and what's not.
On screen show code and comments in different colors or in regular and italics. Something like that.
This would save us from strange comment characters like ";" or "/*".


Yes, you won't like the idea, but I needed to tell .  :) :) :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Cwiiis

After getting used to Orgams a bit more, I think my number 1 feature request would be to show all 8 bits, including leading zeros for binary numbers, and all 2 or 4 characters for 8 or 16-bit hex values. Thought I'd post because that seems like quite an easy thing to do and would have a huge impact, at least for me :)
I suppose with the 80-character per line limit, perhaps it'd make more sense for it to just remember the number of leading zeros the user inputs, but if that's less feasible, I'd definitely pick showing all 2/4/8 digits over stripping the leading zeros.

m_dr_m

Quote from: GUNHED on 13:53, 11 August 21Or get out of the 50ies. Let the Editor care about what's comment and what's not.
On screen show code and comments in different colors or in regular and italics. Something like that.
This would save as from strange comment characters like ";" or "/*".

* Orgams already shows comments in shaded colour. You should try it, really.
* Ast suggestion was about block-comment. Relying on editor command and invisible markers isn't practical in my book. For instance, that means you have to reselect the whole block to uncomment.

Yes, keeping the leading 0s for binary or hex values is good idea!


GUNHED

Yeah, I guessed that. The world is not ready for my idea. I'll come back to it in 2028.  ;D
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Cwiiis

Another feature request; I'm very used to using vim and split panels - if you could introduce a horizontal split at the cursor so you could look at a different range of lines in the same file, that would be great. I realise you could open the same file in a different tab, but sometimes you just want to have a reference handy. Still really liking Orgams btw :)

Cwiiis

A question and possible request, for macros, can you use parameters in commands? I wanted to do this for a line-interrupt macro;


MACRO LINE_INT n
        MAP_PLUS(1)
        ld a,n
        ld (&6800),a
        MAP_PLUS(0)
ENDM


MAP_PLUS is a predicate macro to page in CRTC registers. Building this, I get a syntax error on ld a,n - is there a way to do this currently? If not, that'd definitely be nice :)


m_dr_m

I'm also a long time user of Vim (hence the CONTROL-* to go to next occurrence of label!).
Split panes would require a lot of work, though. Maybe less through Gedeihen (Declarative GUI engine), which is still WIP.


Parameters in MACRO is meant to work, and you are the first one to report a bug about that.
I wasn't able to reproduce your problem, would you be able to post a complete exemple with invocation that triggers the syntax error?


Hypothesis: there is a syntax error in MAP_PLUS(1), and a bug about the reported line.
What happen if you put a NOP before ld a,n?

Cwiiis

Quote from: m_dr_m on 23:12, 15 August 21
Hypothesis: there is a syntax error in MAP_PLUS(1), and a bug about the reported line.
What happen if you put a NOP before ld a,n?
No idea what happened, but I uncommented it and it just works now. Previously it was complaining that the parameter label didn't exist... Who knows!

Another question, are there greater than/less than predicates? Following your example for a nops macro, I wanted it to preserve all registers and in the case that you give it a value less than the minimum, just use nops... But it seems </> aren't valid syntax. They aren't mentioned in the user guide, so I suppose not... In which case, that's definitely another feature request :)

And aside, I've switched to real hardware instead of WinAPE now (6128 Plus, X-MEM and Gotek) and a weird bug I get, on first launch of Orgams, after scrolling a few pages, it resets back to basic. Relaunching orgams, everything seems fine and I can just carry on as normal (the cursor starts in the margin, but once I move it away, it behaves normally). Bit of an odd one!

m_dr_m

Quote from: Cwiiis on 17:41, 18 August 21Previously it was complaining that the parameter label didn't exist...
That can happen when the passed expression cannot be resolved at invocation time (e.g. forward reference).

   LINE_INT(defined_after)
[...]
defined_after = 4


Quote from: Cwiiis on 17:41, 18 August 21Another question, are there greater than/less than predicates?
Not yet! I can explain how to add them :)

Quote from: Cwiiis on 17:41, 18 August 21it resets back to basic
Orgams is pretty much crash-safe (at worse, some assert/breakpoint might be triggered, which would switch to debugger page).
Make sure your connector is perfectly clean.
Anyway, glad to hear you use the real stuff!

Cwiiis

I've got to the point where I could really use a way of transferring text from PC to Amstrad. If I put a text file on a disc using WinAPE without generating an AMSDOS header, Protext views it fine, but if I try to import it in Orgams, it hangs.

On reset, I can see it imported the text, but then it also imports thousands of lines of nothing... So I guess somehow Orgams is missing the end of the file, or I'm not doing this correctly? I don't have an M4 cart, so Gotek + WinAPE to edit disc files is my current means of transfer. Any tips?

GUNHED

Can you please make a DSK with that file and post it here. I will have a look at it.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

m_dr_m

Quote from: Cwiiis on 00:16, 26 August 21then it also imports thousands of lines of nothing...
Which DOS are you using?
If CubeMDOS, this is due to https://www.cpcwiki.eu/forum/applications/cubeios-fat16fat32-rom-for-the-cpc's-with-xmass/msg203159/#msg203159

Either way, I'll try to publish a corrected version this week-end.

Cwiiis

I don't recall if I was using AMSDOS or ParaDOS, but one of those. I've attached the disc image, 'GHOST.TXT' is the text file in question (I think - can't conveniently check right now). Please ignore the rest of it :)

m_dr_m

Quote from: Cwiiis on 21:58, 11 August 21I think my number 1 feature request would be to show all 8 bits
Done!
Quote from: Cwiiis on 00:16, 26 August 21So I guess somehow Orgams is missing the end of the file
Fixed!

Available in alpha7. http://orgams.wikidot.com/working

Quote from: GUNHED on 13:52, 12 August 21The world is not ready for my idea
The world was ready decades ago. It's called WYSIWYG, and that's usually in a pain in the ass.
I guess the best of both worlds is markdown-like markup with immediate render.

m_dr_m

Poll: Separator for module (aka namespace)
Context:
Since FroggyFlags Alpha2, Orgams allows local labels (which can be reused in different scope / macro invocations):

gen_mesh
   ld b,width
.loopx
    [...]
    djnz loopx
[...]
   
display_mesh
   ld b,width
.loopx
    [...]
    djnz loopx
[...]

For now, you cannot access those labels outside of their scopes. Once possible, the syntax would be:

   ld b,width2
   jr gen_mesh.loopx



Now, I will also introduce module/namespace:
[/size]In that case you can write:

module Player


init
[...]


update
.loop
  [...]
  djnz .loop
  ret


display
  [...]



endmodule

[/size]The poll question amounts to how to access `init` outside `Player` scope?

       
  • [/size]Also with dot notation.

call Player.init
jr Player.update.loop


       
  • [/size]Used dy other assemblers (e.g. sjasmplus)
  • [/size]Nice symmetry with global+local labels (it's a pro from some, a con for others).

       
  • [/size]With :: separator

call Player::init
jr Player::update.loop


       
  • [/size]Similar to namespace qualification in some languages (rust)
  • [/size]Would allow having both a module and a global label with the same name (I'm not convinced it's a good thing).
  • [/size]Would allow having two imports with same name but different extension (idem):

import "math.i"
import "math.o"


    ld hl,math.i::PI
    call math.o::cos

[/size]FWIW, rams uses `_`, but since it's also a valid label character, I find it too ambiguous.



krusty

I vote for the dot and will implement like this for my own assembler.
There is no reason to differentiate modules from global labels. And to use : everywhere would be unusual.Nested modules should be possible.To name a module with the imported file name is maybe not a good idea: you illustrate the issue with the extension, and what happens with compatible cross-assembler that can use complex paths ? I would rather use the filename without extension/path or provide it explicitly

import "math.i" as math_i
import "math.o" as math_o


In case of ambiguity, module name could be prefixed by :: to ensure lookup starts at module level and not inside module level

::Player is module Player
Player
is label player if any otherwise module Player

m_dr_m

The 'as' syntax is sweet, but I'd rather re-use existing mechanism (well, not existing yet, but soon enough):



module math_i
   import "math.i"
endmodule



module math_o
   import "math.o"
endmodule

m_dr_m


m_dr_m

#70
Beta D This link will give you a link: http://memoryfull.net/post.php?id=32#906

People that use Orgams with only 128k RAM:
* Remainder: **All** first 64k and bank &c5 are free for your personal use (you can crash the system, and still breakpoint / return to Orgams).
* Question: Would you rather Orgams reclaim the Bank &c5 to be able to load bigger sources?

Powered by SMFPacks Menu Editor Mod