News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Recent posts

#11
The Workshop / Re: gdiplus tests
Last post by zedd151 - March 21, 2025, 07:16:02 AM
Quote from: sinsi on March 21, 2025, 07:15:06 AMI started to look into it but lost interest...
    invoke  GdipGetPropertyItemSize,GpImage,PropertyTagFrameDelay,addr delaysize
    invoke  GdipGetPropertyItem,GpImage,PropertyTagFrameDelay,delaysize,addr delay

Thanks sinsi, I'll look into that... eventually.  :smiley:
It's not an urgent need, but it might be useful in the future.
#12
The Workshop / Re: gdiplus tests
Last post by sinsi - March 21, 2025, 07:15:06 AM
Quote from: zedd151 on March 21, 2025, 04:00:47 AMIs there any way to correlate the delay per frame in the code, to what the frame delay is in the gif file rather than a 'one size fits all' timer delay?
What I mean is, is there any way to get the information from the gif file, for the delay for each frame? As you might have noticed, I have only a slight clue about gdiplus functions. The MS documentation isn't a great help, either.

I started to look into it but lost interest...

    invoke  GdipGetPropertyItemSize,GpImage,PropertyTagFrameDelay,addr delaysize
    invoke  GdipGetPropertyItem,GpImage,PropertyTagFrameDelay,delaysize,addr delay

PropertyTagFrameDelay has more information, among other interesting stuff :biggrin:
#13
The Workshop / Re: gdiplus tests
Last post by zedd151 - March 21, 2025, 07:06:52 AM
Quote from: daydreamer on March 21, 2025, 06:48:50 AMIs it possible make old moonlander game,but with rotating a image of moonlander,instead of original vectorgraohics ?
If you can get screenshots, sure. Maybe using DosBox or similar?
1. Just make all of the graphics elements into seperate bitmaps {taken from screenshot(s)}
2. Using mspaint or other similar tool to create each frame using the graphics elements created in step 1, incuding the background.
3. Use ImageReady, Gimp or similar program to create the animated .gif file from the indidual bitmaps (created in step 2) that represent the animation frames. There are undoubtedly other tools out now, that can do similar tasks. Even possibly do all of these within the same program.

Similar steps were used in creating the pacman gif file above.
#14
The Orphanage / Re: ChatGPT+Gemini Experiments
Last post by daydreamer - March 21, 2025, 07:01:42 AM
I remember i have old copy of ms office,gonna try install publisher,which helps you print out small books which you fokd oages to half size of A4 to A5 book size,keeping track of page numbers to end up in right places
#15
The Orphanage / Re: ChatGPT+Gemini Experiments
Last post by daydreamer - March 21, 2025, 06:56:53 AM
Quote from: NoCforMe on March 14, 2025, 07:15:20 AM
Quote from: daydreamer on March 14, 2025, 07:10:51 AMI wrote several .doc files in english as parts of my fantasy novel and desided to translate it to swedish,for those who dont understand english
Google translate was dissppointment,chatgpt might do better ?

Well, try it and let us know. (It's free, innit?)
Or you could try DeepSeek.
It worked much better than google translate
chatgpt intelligently understand word meaning different depending on in which context its used,while google translate seem more translate word by word,dont care about which context its used in

Wonder anyone interesting in reading my fantasy story and give feedback ?
#16
The Campus / Re: Simple array in assembly l...
Last post by Vortex - March 21, 2025, 06:49:09 AM
Here is a simple string array example :

include     \masm32\include\masm32rt.inc

.data

string1     db 'Melon',0
string2     db 'Apple',0
string3     db 'Orange',0
string4     db 'Banana',0

strArray    dd string1,string2
            dd string3,string4

msg         db 'Fruit %u = %s'
            db 13,10,0

.code

start:

    call    main
    invoke  ExitProcess,0

main PROC uses esi ebx

    xor     ebx,ebx
    mov     esi,OFFSET strArray
@@:
    inc     ebx
    invoke  crt_printf,ADDR msg,\
            ebx,DWORD PTR [esi]
           
    add     esi,4
    cmp     ebx,4
    jne     @b
    ret
   
main ENDP

END start
#17
The Workshop / Re: gdiplus tests
Last post by daydreamer - March 21, 2025, 06:48:50 AM
Is it possible make old moonlander game,but with rotating a image of moonlander,instead of original vectorgraohics ?
Old atari game from 1970"s running on 6502 1.8 mhz
#18
The Campus / Re: Simple array in assembly l...
Last post by NoCforMe - March 21, 2025, 05:32:57 AM
Well, Steve, as the OP here I don't think your post is inappropriate.
I do think it's a bit too big of a chunk for someone just starting to use matrices in an assembly-language program to bite off. But I'll leave that for them to decide.

Rather than get into all the intricacies of matrix manipulation at the outset, I'm much more interested in just getting our n00b started on laying out and addressing a simple matrix.

First things first, y'know.
#19
The Campus / Re: Simple array in assembly l...
Last post by FORTRANS - March 21, 2025, 05:22:32 AM
Hi,

   Usual comment; if the original poster of this thread, or a moderator,
thinks this is an inappropiate addition to this thread, have at it.

   This thread was about how an array is set up in an assembly program.
This post is partly that, and partly something else all together.  I
hope it helps someone to see how to use an array a bit clearer.

   An array can be used to represent a matrix.  A matrix is a:  "A
rectangular array of numerical or algebraic quantities treated as an
algebraic entity."  Nifty, that's what you get from a dictionary.  Here
I will use an array of numbers in a three by three square as my subset
of matrices.  Matrices are used as a shorthand to apply mathematical
operations to a system of equations.  Multiple algebraic operations
applied to a set of numbers in a specified order shown as numbers en-
closed by brackets.  Well, numbers arranged in a rectangle, enclosed in
brackets is a matrix.  The operations use the matrices.

   This post will discuss my implementation of a program to display
a set of elementary matrix operations to a user.  The program shows
how the matrix is changed by each action.  It was originally a DOS
program that I later converted to a Windows program.  Thanks to Raymond
for his Windows FPU library routines.

   I was using the extended ASCII characters from the default code page
(437) in a VDM for my ease of use to draw the matrix.  This does not
work in Wordpad or Notepad.  Wordpad has an option when opening a file
to open as a "DOS text file".  That doesn't work to do anything.  I
tried using Word, but that did not work either.  Though admittedly an
ancient version.  I had thought the forum editor had an insert symbol
option, but I must have been wrong.

   So a matrix should be shown as (Big left bracket), (Numbers), and
(Big right bracket).  I will use the following notation.
   
   | 1 2 3 |
   | 4 5 6 |
   | 7 8 9 |

   Ugly but workable.

   A matrix uses a one based indexing system in row then column order.
Here the matrix is represented as elements with the address of the
element as numbers in the form below.

       | a11 a12 a13 |
   A = | a21 a22 a23 |
       | a31 a32 a33 |

   High level languages like BASIC or FORTRAN use one based addressing
as well.  Text and reference books use the one based addressing for the
matrices they use.  As mentioned in Reply #4, MASM assembly language
programs normally use zero based addressing for arrays.  So, the main
problem for a programmer is that the machine wants a zero based address
and the user wants the display to be using one based indicies.

   I can use one based indexing by ignoring the zeroth element in the
array to represent a matrix.  That way I can sort of think of it as a
one based array.

   An array is laid out in a linear fashion in memory.

   0 1 2 3 4 5 6 7 8 9

   When used as a matrix we order the elements into a square.

   0  1 2 3      | 11 12 13 |
      4 5 6  =>  | 21 22 23 |
      7 8 9      | 31 32 33 |

   Not using the zeroth element is used to think about the ordering of
the elements in the matrices.  It was to make programming simpler.  Or
actually to make debugging the program and displaying intermediate
results easier.  The following discussion is about how I worked on the
programming.  It is not necessary for anyone else to use this.  It made
things easier for me, and did not violate the 15% rule.

   So now for some code to show how things were written.  These are
snippets and just show some of the thought behind the program operation
and is not intended to be used as your program's organization.  Do your
own thing.

   I am using three by three maticies with floating point numbers to be
used with the FPU. 

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; - - - EQUates. - - -
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Element EQU     3       ; Number of elements in a column or row.
ElSize  EQU     10      ; Ten bytes per floating point number.
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

; - - - 3 x 3 matrices with leading zero element for addressing.
IdentWrk DT     0.0,  1.0, 0.0, 0.0,  0.0, 1.0, 0.0,  0.0, 0.0, 1.0
IdentTmp DT     0.0,  1.0, 0.0, 0.0,  0.0, 1.0, 0.0,  0.0, 0.0, 1.0
IdentRes DT     0.0,  1.0, 0.0, 0.0,  0.0, 1.0, 0.0,  0.0, 0.0, 1.0
MatrixWk DT     0.0,  3.0,-2.0, 2.0,  1.0, 2.0,-3.0,  4.0, 1.0, 2.0
MatrixW2 DT     0.0,  3.0,-2.0, 2.0,  1.0, 2.0,-3.0,  4.0, 1.0, 2.0
ColumnWk DT     10 DUP( 0.0 )
RowWork  DT     10 DUP( 0.0 )
TempWork DT     10 DUP( 0.0 )

ColI    DW      0
ColJ    DW      0
RowI    DW      0
IndxWrk DW      0
Matrix  DD      OFFSET MatrixWk ; Defines an OFFSET to the wanted matrix.
Three   DW      Element
Ten     DW      ElSize

; - - - Matrix OFFSETs for FMatMul
MatrixA DD      OFFSET RowWork
MatrixB DD      OFFSET MatrixWk
MatrixC DD      OFFSET TempWork

; - - - Matrix elements are specified by row and column number.
IndexI  DW      0
IndexJ  DW      0
IndexK  DW      0

; - - - Matrix elements are specified by one number, an offset
;       from array start.
;   C(I,J)=C(I,J)+(A(I,K)*B(K,J))
IndexIJ  DW     0
IndexIK  DW     0
IndexKJ  DW     0

; - - - Matrix elements are specified by an address, one number,
;       an offset from array start based on element size.
ADDR_IJ  DD     0
ADDR_IK  DD     0
ADDR_KJ  DD     0

   For instance, the IndexIJ, IndexIK, and IndexKJ came from the matrix
multiply routine.  It uses something like;

 C(I,J) = C(I,J) + ( A(I,K) * B(K,J) )

in a loop.  Matrix C is made from the product of A multiplied by B.

   The ColI, ColJ, and RowI were one based indices used in the display
code.  The IndexI, IndexJ, and IndexK were one based indices intended
to be used in the calculation portions of the program.  This was a
side effect of reusing some older code.

COMMENT !
28 August 2019
   Implement a set of elementary matrix operations.

Type One:   Interchange of (swap) the ith and jth columns denoted by
            C(i,j).
Type Two:   Multiplication of the ith column vector by the nonzero
            constant c, denoted by cCi.
Type Three: Adding to the ith Col vector, k times the jth column
            vector, denoted by Ci + kCj.

   These can be done as an algorithm or by using a multiplcation by
an elementary matrix.

Reference:  Basic Matrix Theory, Leonard E. Fuller, Dover edition
            2017; Prentice-Hall edition 1962.
        !

   Note that there are the equivalent set of elementary row operations.
And column and row operations can be both be used.

   The higher level routines then tend to look like the following code.

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ColT1   PROC
; Type One:
;    Interchange of (swap) the ith and jth columns denoted by C(i,j).
;
;  Change identity   | 1  0  0 |    | 1  0  0 |
;  matrix to a swap  | 0 ii  0 | -> | 0  0 ij |
;  columns matrix.   | 0  0 jj |    | 0 ji  0 |
;
;  INPUT: ColI
;         ColJ
;         Matrix
        MOV     EBX, OFFSET ColumnWk
        CALL MkIdent
        CALL ZeroII
        CALL ZeroJJ
        CALL OneIJ
        CALL OneJI
        RET

ColT1   ENDP
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   Note that in the above, the matrix is hard wired and not an input
despite the comment.  Hey, work was in progress type of excuse?

   Now for some low level routines to show how the matrix is actually
accessed by the program.  First a routine to create the identity matrix.

   | 1.0  0.0  0.0 |
   | 0.0  1.0  0.0 |
   | 0.0  0.0  1.0 |

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MkIdent PROC
;    While matrix notation is one based, X86 addressing is
; easier as zero based.  Either think or be confused?

; Element is the number of rows and columns
; in the square matrix, one based.
;
;  INPUT: EBX = OFFSET Matrix

        MOV     CX,0    ; Column counter
        MOV     EDI,10   ; Offset in matrix IdentWrk
MId_1:
        MOV     BP,0    ; Row counter
MId_2:
        CMP     CX,BP   ; I = J ?
        JNE     MId_3
        FLD1
;-      FSTP    IdentWrk[EDI]
        FSTP    TBYTE PTR [EBX+EDI]
        JMP     MId_4
MId_3:
        FLDZ
;-      FSTP    IdentWrk[EDI]
        FSTP    TBYTE PTR [EBX+EDI]
MId_4:
        ADD     EDI,10   ; Size of number...

        INC     BP
        CMP     BP,Element     ; End of row?
        JB      MId_2
        MOV     BP,0

        INC     CX
        CMP     CX,Element     ; End of Matrix?
        JB      MId_1

        RET

MkIdent ENDP
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   The commented out lines with IdentWrk were when the identity matrix
was hard wired to a default matrix.  Program growth required an arbi-
trary matrix to be filled in.  So the input matrix address is passed
in EBX.

   The next routine converts ColI and ColJ to IndexWrk.  ColI and ColJ
are integer index numbers ( 1, 2, 3 ).  IndexWrk is the byte address in
memory.  An artifact of writing the program is that a matrix element
address is specified by ColI and ColJ instead of RowI and ColJ.  Oh
well, sorry.  IndexWrk is the linear address into the array as specified
by the row index and the column index.  The array elements are ten bytes
apiece.

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MkIndexIJ PROC
;  INPUT: ColI
;         ColJ

        MOV     AX,[ColI]
        DEC     AX      ; One to zero based.
        MUL     Three
        MOV     DX,[ColJ]
        DEC     DX      ; One to zero based.
        ADD     AX,DX
        INC     AX      ; Zero to one based.
        MUL     Ten     ; Array element size.
        MOV     [IndxWrk],AX

        RET
MkIndexIJ ENDP
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   The program is attached.  It was written by me, for my use, to
answer a question posed by some lectures and the reference book.  Once
that was done, work mostly stopped.  It basiclly shows what happens to
a matrix as it is worked to create the matrix inverse.

cheers,

Steve
#20
The Workshop / Re: gdiplus tests
Last post by zedd151 - March 21, 2025, 04:00:47 AM
Quote from: sinsi on March 14, 2025, 04:48:14 AMMight try a bigger GIF with more frames next.
I played around with your program today, sinsi.
The gif I used here is not Transparent, I just wanted to see how well it displayed.

Is there any way to correlate the delay per frame in the code, to what the frame delay is in the gif file rather than a 'one size fits all' timer delay?
What I mean is, is there any way to get the information from the gif file, for the delay for each frame? As you might have noticed, I have only a slight clue about gdiplus functions. The MS documentation isn't a great help, either.

Screenshot of program


Original gif file... I had made this years ago, for use as an avatar on another forum.