News:

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

Main Menu

Windows Projects

Started by Manos, February 09, 2019, 06:22:42 AM

Previous topic - Next topic

TimoVJL

Still some errors and equate.c hangs.
C:\code\UAsm\UASM-master\H\codegenv2.h(112):  error:
More than 25 errors. Compilation stoped.
251 errors

C:\code\UAsm\UASM-master\hll.c
22 errors

C:\code\UAsm\UASM-masterX\macro.c(66):  error: Syntax error: ; expected
1 errors

#ifdef __WATCOMC__
static _inline char HexDigit( char x )
#elif defined(_MSC_VER)
static _inline char HexDigit( char x )   // line 66
#else
static char HexDigit( char x )
#endif
{
    x &= 0xF;
    return((x > 9) ? (x - 10 + 'A') : (x + '0'));
}
May the source be with you

Manos

pcc32 is for Windows projects.
If UASM has been builded with another compiler, you should do changes in the source.

Manos.

Manos

As I found in your code there is: static _inline etc.
pcc32 accepts inline functions when enable the switch: /C99
Also instead of _inline you must write: inline

Manos.

TimoVJL

OK. -D_inline=inline helps with macro.c and hll.c
equate.c hangs and codegen.c have errorsC:\code\UAsm\UASM-masterX\H\codegenv2.h(8):  error: Enumerated type 'instr_group' previously defined
C:\code\UAsm\UASM-masterX\H\codegenv2.h(7):  warning: Previous declaration of 'instr_group' here
C:\code\UAsm\UASM-masterX\H\codegenv2.h(9):  error: Multiple declaration of 'GP1'
...
C:\code\UAsm\UASM-masterX\H\codegenv2.h(111):  error: Multiple declaration of 'M32UINT'
C:\code\UAsm\UASM-masterX\H\codegenv2.h(112):  error: Multiple declaration of 'M64UINT'
C:\code\UAsm\UASM-masterX\H\codegenv2.h(112):  error:
More than 25 errors. Compilation stoped.
251 errors
So pcc32 don't support #pragma once ?
May the source be with you

Manos

pcc32 support #pragma once
But #pragma once must include in header files.

Manos.

TimoVJL

equate.c + headers for testing.
Quote from: Manos on February 18, 2019, 07:05:59 AM
pcc32 support #pragma once
But #pragma once must include in header files.

Manos.
This fixed it#pragma once
#ifndef _CODEGENV2_H_INCLUDED
#define _CODEGENV2_H_INCLUDED
...
#endif  // _CODEGENV2_H_INCLUDED
May the source be with you

Manos


Manos

You forgot to include the equate.c file for testing.

Manos.

TimoVJL

It should be in test_equate.zip

In test2.zip that #pragma once issue.
May the source be with you

Vortex

An inline assembly example based on the Nasm syntax :

#include <windows.h>
#include <stdio.h>

char msg[] = "Hello world!";
char title[] = "pcc32";

void WriteMessage(void)
{

asm{
    push    0
    push    title
    push    msg
    push    0
    call    MessageBox
    }

}

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine, int nCmdShow)
{
    WriteMessage();
    return 0;
}

Manos

Good example.

The option: /SUBSYSTEM:WINDOWS is unnecessary
because Link32 has it as default.
Have a look at: http://masm32.com/board/index.php?topic=7681.0

Manos.

Vortex

Creating an MD5 Hash from File Content :

https://docs.microsoft.com/en-us/windows/desktop/SecCrypto/example-c-program--creating-an-md-5-hash-from-file-content

Source code built with pcc32

Vortex

liblzg built with pcc32

Quoteliblzg is a minimal implementation of an LZ77 class compression library. The main characteristic of the library is that the decoding routine is very simple, fast, and requires no memory.

In general, liblzg does not compress as well as zlib, for instance. On the other hand the decoder is very simple and very fast - ideal for systems with tight memory limits or limited processing capabilities.

Also, the decompression routine is easliy ported to just about any conceivable programming language (assembly language, JavaScript, etc).

http://liblzg.bitsnbites.eu

Vortex

Simple dialog box example.

Vortex

Quick example using msvcrt.lib supplied with pcc32 :

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\user32.inc
include     \masm32\include\masm32.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\user32.lib
includelib  \masm32\lib\masm32.lib

printf PROTO C :DWORD,:VARARG

.data

string  db '%s',13,10,0

.code

main PROC C uses esi ebx argc:DWORD,argv:DWORD

    mov     ebx,argc
    mov     esi,argv
@@:
    invoke  printf,ADDR string,DWORD PTR [esi]
    add     esi,4
    dec     ebx
    jnz     @b
    ret

main ENDP

END