flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > HJA430 --- is there RTL for the MSP430 anywhere? Goto page Previous 1, 2 |
Author |
|
Hugh-Aguilar 06 May 2024, 18:56
Hugh-Aguilar wrote:
I really wish that somebody would answer this question. I have been wondering about this since the 80s. I had expected that this forum would have assembly language experts who could answer a question such as this, but apparently not --- in my experience, experts don't answer questions about why things are the way that they are --- the experts just explain how things are, which is useless because that is what the manual is for. Having only one instruction per line is horrible! You get a tall vertical pillar of instructions so that very little code can be seen on the computer screen, requiring the reader to scroll up and down continuously. In the bad old days of MS-DOS, the screen had only 25 lines, although we get slightly more now. Each subroutine is many screens in length, although if there were multiple instructions per line the entire subroutine would fit on the screen along with a block of comments describing what it does. Note that, although my assembler is single-pass, I do have labels that can be both forward and backward referenced. The labels need PREDEF ahead of time, which establishes them as unsettled. I also have UNSETTLE that unsettles a label that has been settled --- this is so labels can be reused. I mostly provided labels because assembly-language programmers seem to expect them. In practice, I rarely use labels for anything other than subroutine start points --- I use code blocks inside of subroutines for control flow --- on rare occasions I will use labels inside of subroutines in order to avoid excessively deep nesting of code blocks that can be confusing. I'm also still interested in finding out what is going on in Poland. That guy Mark represents Poland as being solid Nazi and heavily armed with weapons smuggled over the border from Ukraine. He may be a kook though --- I would like to get information from other sources in Poland for a better perspective on the country. Mark appears to be an ethnic Pole, although he must be an American citizen because he bought an AK-74 at the gun show and I don't think foreigners can legally buy guns in America. He was traveling to and from America and Poland with a passport, but illegally slipping over the border into Ukraine from Poland --- apparently the border is pretty porous and people can easily go back and forth without a passport. _________________ When all else fails, write the source. |
|||
06 May 2024, 18:56 |
|
bitRAKE 06 May 2024, 20:47
Obviously, you have tried using fasmg. Put the whole program on one line if you want.
As a concrete example, the core of my XML parser: Code: retaincomments isolatelines calminstruction reader! &line& match =purge ?, line jyes process match <?=xml? any ?>, line jyes skip match <!-- any? -->, line jyes skip local head,tmp,tag _line: match tag line?, line, <> jno skip match <tag/>, tag jyes complete match </tag>, tag jyes close match <tag>, tag jyes open arrange content, content tag _tag: match , line jno _line skip: exit open: arrange tmp, match head tmp?, tag take attributes, tmp arrange tmp, =TAG_BEGIN.tag assemble tmp take scope, head jump _tag complete: arrange tmp, =TAG_BEGIN.tag assemble tmp arrange tmp, match tag tmp?, tag take attributes, tmp arrange head, tag take scope, head close: take , scope arrange tmp, =TAG_END.tag attributes assemble tmp take , attributes jump _tag process: assemble line end calminstruction include 'vk.xml',mvmacro ?,reader purge ? removecomments combinelines The multi-instruction "assemblers" I know of: Randal Hyde, HLA Betov, RosASM uart777, Z - The Final Language https://board.flatassembler.net/topic.php?p=163039#163039 Seems like it has been answered, or you'll need to be more specific. Some claim that HLA, and Z are not assembly language, but a layer on top of assembly. It's all a matter of perspective - through the years people have even shunned macro assemblers - "If it's not a 1:1 relationship with the ISA then how can one claim it's assembly?" Eh, it's religion for nerds. I know what my preferences are - most it has to do with readability and that's a very personal bias. Some of it does relate to the 1:1 relationship - if I can't produce the instructions I want to use then the abstraction is in the way. Sometimes it's about the abstraction not fitting the problem trying to be solved. So, this multi-line thing - what do you mean? add eax, ecx ; mov [saved], eax ; ... ... because that's child's play. It's been done. add eax, ecx mov [saved], eax ... ... much more difficult, but I think we are just making problems for ourselves at this point. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
06 May 2024, 20:47 |
|
revolution 07 May 2024, 02:00
There is a whole topic about one liners.
https://board.flatassembler.net/topic.php?t=5411 |
|||
07 May 2024, 02:00 |
|
Hugh-Aguilar 07 May 2024, 04:26
bitRAKE wrote: Obviously, you have tried using fasmg. Put the whole program on one line if you want. Since you like FASMG, write an MSP430 assembler in FASMG for comparison to mine. The only assembler that I've written for money was MFX. That wouldn't get done in FASMG because it involves out-of-ordering the instructions. HJA430 and the PAZ assembler were both pretty easy compared to MFX. FASMG could be used for the MSP430. I doubt that FASMG could be used for the PAZ because the PAZ uses static variables for return-addresses and local-variable frames, so you have to keep track of what level each subroutine is (level-1 can call level-0, level-2 can call level-1 or level-0, etc.). The level of a subroutine is determined after it is written according to what level subroutines it called internally. Each level has its own local frame (including return-address) in static memory. Using static memory for the local frame makes PAZ fast because it doesn't have to do indexed addressing to access local variables or the return-address. If you want to show off FASMG, start with the MSP430 that is realistic to be done in FASMG. I don't think that FASMG could support the PAZ, but if somebody wants to take a shot at it, I can provide the description of the PAZ processor. MFX was very different than anything that anybody has ever encountered. There were no operands at all. There were no jump instructions (the NXT instruction was the only way to modify control flow). Attempting something like this in FASMG would be crazy! bitRAKE wrote: The multi-instruction "assemblers" I know of: I haven't looked at RosASM or Z, so I can't comment on those. I am aware of HLA and played around with it. I was impressed! I am also aware that Randal Hyde got banned from CLAX because of HLA. I got banned from CLAX too: https://groups.google.com/g/comp.lang.asm.x86/c/IVtSmnc2ddw/m/CH3O3IUjBAAJ I prefer FASM to HLA because T.G. provided me with a macro that would allow me to selectively paragraph-align a function only if the whole function would be contained in fewer paragraphs if it was paragraph aligned. This can't be done in HLA (I didn't actually ask Randall Hyde though, so maybe he knows how to do it). T.G.'s macro was a huge benefit to me because it allows me to pack more functions in the 32KB cache. I didn't need HLA's structured programming high-level aspects for my Forth system because it is just a collection of short functions, none of which are complicated. I think that HLA would be more useful for a full program written in HLA --- that seems to be what Randall Hyde intended --- HLA would be an alternative to C or Pascal. bitRAKE wrote: So, this multi-line thing - what do you mean? I don't have semicolons or any other delimiter in my assembler. It wasn't a problem. This brings us to the macro-language issue. In FASMG you have to write your own macro language. For example, the [saved] above has to be parsed and interpreted. If you want to calculate an address, that facility has to be provided by the macro language. In my assembler, all of this is free because Forth is the macro language --- anything that can be done in Forth can be done to calculate the address or the literal value or whatever operand you need. _________________ When all else fails, write the source. |
|||
07 May 2024, 04:26 |
|
bitRAKE 07 May 2024, 16:21
"the macro-language issue" is a non-issue, lol. You like Forth and want every language you use to be Forth - cool. This is actually common with Forth zealots.
Ever use Wolfram Language? The multi-paradigm nature of the language is interesting to me. It makes the language not particularly best at anything; but it teaches one to shift perspectives to solve problems in modalities that better suit the problem. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup Last edited by bitRAKE on 07 May 2024, 16:43; edited 1 time in total |
|||
07 May 2024, 16:21 |
|
revolution 07 May 2024, 16:31
For fasm, if you want multiple instructions per line then I think the best separator is "#". It doesn't conflict with any other syntax unless you are in a macro where it can be escaped with backslash "\". It looks visually distinct; it has many pixels in the glyph for easier identification. You can still use comments.
Code: mov ax, 0 # add cl, dl # jz @f ; if error # ret # @@: ud2 |
|||
07 May 2024, 16:31 |
|
revolution 08 May 2024, 19:29
Russia posts have been moved to another place.
https://board.flatassembler.net/topic.php?t=22439 |
|||
08 May 2024, 19:29 |
|
Hugh-Aguilar 08 May 2024, 19:39
bitRAKE wrote: "the macro-language issue" is a non-issue, lol. You like Forth and want every language you use to be Forth - cool. This is actually common with Forth zealots. A lot of people think that Forth is an RPN version of C and that "Forth zealots" just like the funky syntax for reasons unknown. This isn't really true though. A major feature of Forth is that we can write code that executes at compile-time rather than run-time. C doesn't have that. In C the #DEFINE is just simple string-expansion done at compile-time but is not a language. This feature is the primary reason why Forth works well for writing assemblers. bitRAKE wrote: Ever use Wolfram Language? The multi-paradigm nature of the language is interesting to me. It makes the language not particularly best at anything; but it teaches one to shift perspectives to solve problems in modalities that better suit the problem. I don't have any interest in "multi-paradigm" languages --- such high-level programming is not for me --- I like assembly-language, and I have always thought of Forth as being an overgrown macro assembler. I don't really consider HJA430 to be "child's play" as you said. Also, HJA430 is the least challenging assembler that I have written. The PAZ processor is several times more complicated than the MSP430, and the MiniForth processor (for which I wrote MFX) was several times more complicated than the PAZ. Primarily what is innovative about HJA430 is the support for code blocks. These are somewhat like the code blocks in C in so much as they have { } brackets. They are different from the C code blocks though because the conditional jump is inside of the code block rather than prior to it. Also, my code blocks support jumping to the start or end of parent or grandparent code blocks. This is like the CONTINUE and BREAK in C except a lot more robust. _________________ When all else fails, write the source. |
|||
08 May 2024, 19:39 |
|
bitRAKE 08 May 2024, 20:50
Oh, I'm aware of what Forth is - that's why it was funny when you criticized macros and held up Forth as the "free" answer.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
08 May 2024, 20:50 |
|
bitRAKE 09 May 2024, 15:32
Hugh-Aguilar wrote: A major feature of Forth is that we can write code that executes at compile-time rather than run-time. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
09 May 2024, 15:32 |
|
Hugh-Aguilar 13 May 2024, 02:20
bitRAKE wrote: Oh, I'm aware of what Forth is - that's why it was funny when you criticized macros and held up Forth as the "free" answer. I noticed a typo in my documentation of the macros. I had messed up the documentation of R@S and R@D --- this is presumably what bitRAKE considered to be "funny" about my macros. Here is a fixed version: Quote:
_________________ When all else fails, write the source. |
|||
13 May 2024, 02:20 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.