Post Reply 
"New-Yorke" ?
07-15-2020, 07:59 PM
Post: #26
RE: "New-Yorke" ?
(06-29-2020 06:17 AM)cyrille de brébisson Wrote:  Hello,
Quote: Raymond Del Tondo Wrote:
(06-27-2020 12:29 PM)Giuseppe Donnini Wrote:
Not even Horror Mode (aka MASD syntax), introduced with the HP-49G in 1999, is considered level 3—which is only consistent since these are by no means actual instructions, but mere macros (which surely would have won haut la main the "International Obfuscated SASM Code Contest", if it existed).
You nailed it:-)
ΗΑ! :D I concur! :D
Regards,
Jonathan

HEY NOW, I TAKE OFFENCE TO THAT!

No offense or insult intended -- it was said in jest :) ( Mostly :P )

Quote:MASD syntax was pure genius, with functionality that are still missing from languages like C++!

I think C++20 might have MASD syntax covered :P

Quote:Look at what it can produce for example: Such a snipet of code (which actually comes from MASD itself!) would have taken 5 pages in the other syntax, making understanding the actual code an absolute pain.

Code:
% write debug info
CD1EX D1=C R4=C.A                                 % save start address
A=0.A DAT1=A.A D1+5                               % write a 0 (nb entries)
D0=(5)_DebugInfoBuffer+#5 C=0.A C=DAT0.B D0-5     % Ba: pos in buffer, D0: on buffer
B=0.A                                             % Ba: nb entries
A=DAT0.A ?A#0.A                                   % is the buffer used?
{
  B+1.XS B-C.A                                    % get nb of used entries in first buffer
  C+C.A C+C.A A+C.A C+C.A A+C.A D0=A C=B.A C+C.A C+B.A C+C.A C+C.A GOSBVL MOVEDOWN % copy them
  {                                               % for each buffer
    D0+2 A=DAT0.A D0=A ?A=0.A EXIT                % end of the list?
    LC 00100 B+C.A                                % 100 more entries
    LC(5)_DebugBufferSize-#7 GOSBVL MOVEDOWN      % copy buffer
    UP
  }
  % invert the data to be from low address to high address
  CD1EX D1=C RSTK=C C=R4.A D0=C                   % point on start and end
  C=B.A DAT0=C.A D0+5                             % write nb entries
  BSRB.A B-1.A SKC                                % for nb entries/2 do
  {
    D1-12 A=DAT0.12 C=DAT1.12 DAT0=C.12 DAT1=A.12 D0+12 % invert the entries
    B-1.A UPNC                                    % next
  }
  C=RSTK D1=C
}

MASD syntax added a slew of great features, including some that are still missing from most common languages even C++.

Well, I don't know about the C++ claim, but many experienced Saturn assembly programmers' revulsion to MASD syntax stems from just being so familiar with the HP Tools / Jazz syntax that it's almost instinctual :) Also, when programming in assembly ( for any CPU ), for me at least, I *want* more verbosity as it makes the code more "self documenting" and easier to understand :)

Quote:But let us look at the MASD syntax in details to understand the what and whys...
The first BIG change with other ASM languages is the multi instruction per line and the drop of the "first column=label" concept (which where inherited from punch cards!).
2 Things there. First, MASD nearly got rid of all labels. A good MASD code will have little to no labels in it (see later). Second, labels are prefixed by a "*" avoiding the first column=label.
This frees room on the screen.
Now, the 48 had 4 lines of 22 characters. That is all! so allowing more instructions per lines allowed you to actually SEE your program (What can you do with minimal instructions if you only see 4 of them at a time!!!). With masd syntax, you could see around 16 instructions at a time! SO MUCH BETTER for a programmer!

Well, that's kind of a straw-man argument :) Although, I might be misunderstanding you if you're talking about the *usable* text space on the 131x64 pixel display with the default "system" font ( ie. for the default HP48 8 line by 22 character font ). The Jazz "small" / "mini" font gets you 10 lines of text with 33 characters per line on an HP48 :) Also, having many instructions crammed onto one line may allow easier on-calc programming, but IMNSHO it greatly reduces readability :)

Quote:This was allowed by the multi instructions per line and the unneded redudancy on repeated registers. A=A+B A can be replaced by A+B A (since the A= is kind of redudant)...
Please note that, FOR clarity, the devil that is the MASD syntax allowed the use of a '.' as a field separator so as to clearly link the field with the instruction a in A+B.A C+D.A where you can clearly see 2 distinct instructions (I did toy, at some point, with the idea that the 'A' field would be by default, thus making it optional. I also toyed with the idea of 'last field use is default', but discarded this as it would be, in my opinion, error prone, making subsequent instruction dependent on previous ones)...

Well, again, at least for me, I *want* more redundancy, to make the code easier to understand :)

Quote:MASD allowed for great use of constants, subsequently defined constants and the like which made programming much easier than what we had before. simillary, you could do D1+34 instead of having to do D1=D1+ 16
D1=D1+ 16
D1=D1+2

But, the BEST thing about masd is of course the blocks {} which can be used in the same way that they be in C or java. Add to this the up/exit "n" syntax, which allowed you to exit, or return to the top of a block at this or any other level and this really transformed ASM programming from the crud it was to something that was 1/2 way up the chain to a "real langauge"...

I'm a hypocrite if I don't praise MASD's ingenuity at inferring instruction sequences and making use of structured control blocks. MASD definitely wasn't the first implementation of structured high-level programming concepts applied to assembly though -- the first high level assemblers were created circa 1960 ( See eg. here and here ).

In the vein of what MASD was meant to accomplish, a fellow HP48 hacker and I had been working on a type of "high level assembler" ( inspired in part by this, although much simpler ) which is now just a pre-processor to SASM :) The ultimate goal is to include "most" of the basic / core syntactic and semantic constructs present in the C99 standard ( sans the standard libraries of course ), but in a form that is really assembly with a lot of instruction sequence inference :) The project hasn't been worked on in a while**. It's built using Flex and Bison ( and some GNU M4 :) ) and I eventually intend to add basic / rudimentary register allocation to it with some type of "no-clobber" constructs :) , possibly augmenting the simple graph coloring algorithm with a genetic / evolutionary one.

Some example output for the following

Code:
do {
        C.B = *D1++;
} while (C.B);
D1 = *A;
B.A = A.A ? C.A : D.A;

Would be

Code:
-       D1=D1+  1
        C=DAT1  B
        ?C#0    B
        GOYES   -
        AD1EX    
        A=DAT1  A
        AD1EX
        ?A=0    A
        GOYES   +
        B=C     A
        GONC    ++
+       CDEX    A
        B=C     A
        CDEX    A
++

( ** The reason the project hasn't been worked on in a while is due to the other author having little time because of various things and also because of me having little time due to various things of which the main thing is my move to Colorado this year )

Quote:So, here you go, MASD was a great syntax, 100 times better than the SASM one.

It might make on-calc assembly programming easier in terms of less key-presses, but I don't really like on-calc assembly programming :) -- I prefer a text editor running on a Linux distro :)

Quote:And I would continue saying it, even if I did not, as it goes, have a "slight" bias :-)

Cyrille

"Slight bias" accepted :P

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
"New-Yorke" ? - Jonathan Busby - 06-15-2020, 07:27 PM
RE: "New-Yorke" ? - cyrille de brébisson - 06-16-2020, 05:48 AM
RE: "New-Yorke" ? - Jonathan Busby - 06-16-2020, 07:35 PM
RE: "New-Yorke" ? - pinkman - 06-16-2020, 11:03 PM
RE: "New-Yorke" ? - cyrille de brébisson - 06-17-2020, 05:42 AM
RE: "New-Yorke" ? - Jonathan Busby - 06-17-2020, 07:51 PM
RE: "New-Yorke" ? - cyrille de brébisson - 06-18-2020, 05:50 AM
RE: "New-Yorke" ? - Jonathan Busby - 06-18-2020, 07:17 PM
RE: "New-Yorke" ? - pinkman - 06-18-2020, 06:46 AM
RE: "New-Yorke" ? - pinkman - 06-18-2020, 10:11 PM
RE: "New-Yorke" ? - Jonathan Busby - 06-18-2020, 10:36 PM
RE: "New-Yorke" ? - Jonathan Busby - 06-18-2020, 10:49 PM
RE: "New-Yorke" ? - EugeneNine - 06-18-2020, 11:17 PM
RE: "New-Yorke" ? - Steve Simpkin - 06-19-2020, 03:49 AM
RE: "New-Yorke" ? - Jonathan Busby - 06-19-2020, 07:28 PM
RE: "New-Yorke" ? - Giuseppe Donnini - 06-27-2020, 02:29 AM
RE: "New-Yorke" ? - EdS2 - 06-27-2020, 05:44 AM
RE: "New-Yorke" ? - Jonathan Busby - 06-27-2020, 08:42 PM
RE: "New-Yorke" ? - Raymond Del Tondo - 06-28-2020, 12:33 AM
RE: "New-Yorke" ? - Jonathan Busby - 06-28-2020, 04:35 PM
RE: "New-Yorke" ? - Giuseppe Donnini - 06-28-2020, 01:17 AM
RE: "New-Yorke" ? - Jonathan Busby - 06-28-2020, 04:33 PM
RE: "New-Yorke" ? - cyrille de brébisson - 06-29-2020, 06:17 AM
RE: "New-Yorke" ? - sunhp - 07-11-2020, 01:05 AM
RE: "New-Yorke" ? - aamiel - 07-15-2020, 11:42 AM
RE: "New-Yorke" ? - Jonathan Busby - 07-15-2020 07:59 PM



User(s) browsing this thread: 3 Guest(s)