News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

plotting in masm 32 bit

Started by markallyn, March 06, 2018, 07:19:16 AM

Previous topic - Next topic

LiaoMi

Quote from: markallyn on March 08, 2018, 01:03:26 AM
Good morning/afternoon, Jochen,

After studying your example a bit I realized it could be/should be a template for what I want to accomplish.  By the time that penetrated my thick skull it was too late in the day to do anything about it.   But today is a new day.

One point of clarification regarding gnuplot:  In my gnuplot distro there is no single gnuplot.dll.  There are a bunch of Linux derived .dll's (pango, etc.), but I don't see a gnuplot.dll.  So, what to load to do the job--should I wish to try it in this fashion--is problematic.

Second:  You obviously are fully aware of GSL and have used it.  I have too, but in C applications, never assembler.  I love GSL.  But, I don't see how I would use it.  There is also OCTAVE which has plot routines in it.  I haven't looked into how one might use them, however.

Thanks for taking an interest in this.

Regards,
Mark

In this case, you can not use gnuplot directly, it's impossible, otherwise you have to write your own wrapper, just like here done https://github.com/raimundomartins/gnuplotcha All this is not so effective for the programmer in assembler :icon_redface:

I compiled separately dll and libraries for both processor modes https://mega.co.nz/#!1h4XgRbL!AAAAAAAAAAA9aMZukBleowAAAAAAAAAAPWjGbpAZXqM Unfortunately, I did not make Headers and Includes for assembler, there are errors during the conversion of structures  :(


HSE

#16
subsystem:windows
Try removing entry.
(IF you solve the assembling problem) 

The last JJ example only work from RichMasm!

Out of RichMasm, before MbGui.asm requiere:
GuiParas equ "MasmBasic: I have forgotten something", x50, y50, w1200, h666

Equations in Assembly: SmplMath

jj2007

Quote from: markallyn on March 08, 2018, 06:27:26 AM
good afternoon/evening Jochen,

OK.  I downloaded uasm32, then copied your code as jjdraw.asm and ran a little .bat file (makejjdraw.bat).  Got an error in assembly step I don't understand.

Hi Mark,

I don't understand it either, it's weird - in principle, such code should build "as is" with qEditor or RichMasm. But HSE found the culprit: If it is not built with RichMasm, then the GuiParas line (see attached source) is needed. There is no logic in this, though :(

Anyway, attached two batch files for building projects with UAsm32, plus the demo code in *.asm, tested OK. In case you want to use qEditor.exe, add two lines in \Masm32\menus.ini before &Tools (but RichMasm is far easier to use IMHO - drag the *.asm or *.asc over \Masm32\MasmBasic\RichMasm.exe, hit F6, done...):

Build+Run Console,\MASM32\BldRunUAsmConsole.bat "{b}"
Build+Run Windows,\MASM32\BldRunUAsmConsole.bat "{b}"

[&Tools]


Re how to plot an array: Just use the loop in the demo with SetFloat MyArray(ct)=ST(0) (obviously with whatever you have in the FPU). If you have any difficulties with that, please post a few lines showing how you get your values, and we will sort it out.

Regards,
Jochen

markallyn

good morning/afternoon/evening JJ2007, HSE, and LiaoMi,

Many thanks for your suggestions.  I would not have tumbled to the RichMasm notion without your assistance.  In addition, it may well be that I must use /subassembly:windows rather than /subsystem:console.  That alone might be required.  Later this morning I will play with it some more.

JJ2007--Thanks for the assistance with plotting arrays.  This should be sufficient to answer my question.

I will keep you all informed of progress.

Regards,
Mark

markallyn

Good afternoon, JJ,

OK, I tried using bldrunuasmconsole.bat and got, unfortunately, the same error as I did using my .bat file.  Someone, HSE or LiaoMi wrote that it needed to be built with RichMasm, and I'd like to try that.  So I peeked in my download of MasmBasic and sure enough there is a listing there for RichMasm.exe.  However, the listing also shows that there are 0 bytes of code there and I get a nasty message from the sys informing me that the file isn't valid. 

Pest that I am, could you please tell me how to download richmasm?  I'll keep trying to find out on my own but if you happen to read this I'd be grateful.

Mark

markallyn

Update-

It appears that my Norton firewall is preventing SetupMasmBasic.exe from installing RichMasm.exe.  I have tried to turn the filter off temporarily, but without any success.  It runs the Setup fine, but when setup tries to work its magic, Norton bars it.

I'll keep plugging away...

Mark

jj2007

Quote from: markallyn on March 09, 2018, 04:41:20 AMIt appears that my Norton firewall is preventing SetupMasmBasic.exe from installing RichMasm.exe.  I have tried to turn the filter off temporarily, but without any success.  It runs the Setup fine, but when setup tries to work its magic, Norton bars it.

Most of us stumble sooner or later over false positives. Some AV allow to exclude e.g. C:\Masm32 and its subfolders, but I have no idea how Norton handles that. Anyway, I attach a non-packed version of RichMasm, to be extracted to ?:\Masm32\MasmBasic\RichMasm.exe - for Jotti, this version is absolutely clean. In contrast, the packed version has 2 positives with ClamAV and F-Prot.. Norton is not in the list, though.

But the demo should assemble also with the batch files, provided the GuiParas line is in the right place:GuiParas equ "Sinus and Cosinus Demo"
include \masm32\MasmBasic\Res\MbGui.asm
...


If you got RichMasm working, note that it uses by default \Masm32\bin\UAsm64.exe (you have UAsm32, right?). You can force UAsm32 with a line
; OPT_Assembler UAsm32
... somewhere in your source, otherwise download UAsm64 if your OS is 64 bit.

markallyn

JJ-

Thanks for the last message.  It answered the question I was about to ask.  Yes, I am running uasm32 and was getting a message telling me I needed to install uasm64. 

Bloody firewalls.  When I finally figured out how to breach it the installer ran perfectly.

Well, anyway, we seem to be getting there!

Regards,
Mark

HSE

You need in some part of the code (no matter where, I think):
; OPT_Assembler UASM32
Equations in Assembly: SmplMath

markallyn

Hello HSE.

Yes, it is essential.  Thanks.

Mark

dedndave

windows provides a function named PolyBezier

https://msdn.microsoft.com/en-us/library/dd162811(v=vs.85).aspx

you need to do some "pre-math" to convert an array of data points into an array of control points
then, pass the address of the control point array to PolyBezier and it will draw the graph

i wrote a routine to convert an array of data points to control points, using FPU code
the function is named "deBoorBezierSpline", and it calls a helper subroutine named "GetFirstControlPoints"

you can download a little demo program here

http://masm32.com/board/index.php?topic=1969.msg20671#msg20671


markallyn

Hello Dave,

Thanks for the tip and the code.  I will follow up on it.  I was completely unaware of the polybezier function.

Regards,
Mark

dedndave

it works well - surprisingly fast  :t

i will give you a little heads-up
sometimes, the minima and maxima of the graph exceeds the range of data point values (not by a lot)
typically, it's ok - in fact, a good extrapolation of the real world data

markallyn

Good morning/afternoon JJ:

Trying to figure out how to do the array plotting using your modified example 1.  Here is the code so far:

Quote
; OPT_Res   0      ; RichMasm thinks this code needs no resources - delete if rsrc.rc is needed
include \masm32\MasmBasic\Res\MbGui.asm
plotpoints   REAL4  1.1,2.2,3.3,4.4,5.5

;OPT_Assembler uasm32
  Dim MySinus() As REAL4        ; prepare an array for being plotted (real4 or real8)
  finit
  For_ ct=0 To 4
        fld  plotpoints(ct)
        SetFloat MySinus(ct)=st(0)
  Next
Event Paint
  ArrayPlot RgbCol(192, 222, 255)               ; init & set background
  ArrayPlot MySinus(), 0, lines=2               ; draw the array with 2px lines
  ArrayPlot exit, "Playing with Sinus() plots"  ; finish with a title
EndOfCode


As you can see I am just creating a very simple test array and then trying to print in a loop.  Unfortunately, I get an error when trying to build with richmasm.exe.  The error is:

Quote
Cannot add two relocatable labels
This is being emitted due to line 9 above.

What do you think?

Regards,
Mark

markallyn

Dave:

I downloaded the "little demo" code and was rather overwhelmed by its extent.  It is impressive and you are being (as usual) overly modest in sizing it.  I have to confess I really don't understand how to input a set of points to be plotted.  This could happen in at least one of two ways:  by passing an array of some sort, or by passing a function with x-coordinates to be evaluated.  How do you assign inputs?

Regards,
Mark