News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#11
User contributions / Re: Github-kuba miniz for Pell...
Last post by TimoVJL - Yesterday at 09:19:12 AM
Test projects without library for testing defines.
First project with static crt and second with pocrt.dll, so actual code size seen.
#12
User contributions / Re: Github-kuba miniz for Pell...
Last post by Vortex - April 23, 2026, 09:17:27 PM
Adding this line to the top of zip.c and rebuilding the static library :

#define ZIP_ENABLE_INFLATE 0
The size of my test executable dropped from 138K to 134K.
#13
User contributions / Re: Github-kuba miniz for Pell...
Last post by TimoVJL - April 23, 2026, 01:29:23 PM
A miniz main problem is, that it is one file and not easy to split modules for static library.

msvc have a -Gy option for that.


This tool can help with modified source code:
split source file using tags
Just have an another tool to add tags a new version of code.
#14
User contributions / Re: Github-kuba miniz for Pell...
Last post by Vortex - April 23, 2026, 12:52:49 PM
QuoteOptional features
The library supports three compile-time flags to strip unused functionality and reduce binary size. All features are enabled by default -- if you just drop the source files into your project and compile, everything works as before.

https://github.com/kuba--/zip
#15
Assembly discussions / Console scroll demo
Last post by Vortex - April 23, 2026, 12:03:04 PM
Here is a console scroll demo :

.386
.model flat,stdcall
option casemap:none

include ConsoleScroll.inc

.data

Coordinates dw  30,5
message     db '        This is a scroll test. ',0

.code

start:

    invoke  ClearScreen

    call    scroll
    invoke  ExitProcess,0

scroll PROC uses esi edi ebx

LOCAL hStd:DWORD

    invoke  GetStdHandle,STD_OUTPUT_HANDLE
    mov     hStd,eax

    mov     esi,OFFSET message
    invoke  lstrlen,esi
    mov     ebx,eax
    mov     edi,1
@@:
    invoke  SetConsoleCursorPosition,\
            hStd,Coordinates
           
    invoke  StdOut,esi
    invoke  Sleep,200
    add     esi,edi
    dec     ebx
    jnz     @b
    ret

scroll ENDP


ClearScreen PROC ; function from the Masm32 package

    LOCAL   hOutPut:DWORD
    LOCAL   noc    :DWORD
    LOCAL   cnt    :DWORD
    LOCAL   sbi    :CONSOLE_SCREEN_BUFFER_INFO

    invoke  GetStdHandle,STD_OUTPUT_HANDLE
    mov     hOutPut, eax

    invoke  GetConsoleScreenBufferInfo,hOutPut,ADDR sbi

    mov     eax, sbi.dwSize

    push    ax
    rol     eax, 16
    mov     cx, ax
    pop     ax
    mul     cx
    cwde
    mov     cnt, eax

    invoke  FillConsoleOutputCharacter,hOutPut,\
            32,cnt,0,ADDR noc

    invoke  locate,0,0
    ret
   
ClearScreen ENDP


locate PROC x:DWORD,y:DWORD ; function from the Masm32 package

LOCAL hOutPut  :DWORD
   
    invoke  GetStdHandle,STD_OUTPUT_HANDLE
    mov     hOutPut, eax

  ; -----------------------------------
  ; make both co-ordinates into a DWORD
  ; -----------------------------------
    mov     ecx,x
    mov     eax,y
    shl     eax,16
    mov     ax,cx

    invoke SetConsoleCursorPosition,hOutPut,eax

    ret

locate ENDP

StdOut PROC lpszText:DWORD ; function from the Masm32 package

LOCAL hOutPut  :DWORD
LOCAL bWritten :DWORD
LOCAL sl       :DWORD

    invoke  GetStdHandle,STD_OUTPUT_HANDLE
    mov     hOutPut, eax

    invoke  lstrlen,lpszText
    mov     sl,eax

    invoke  WriteFile,hOutPut,lpszText,\
            sl,ADDR bWritten,0

    mov     eax,bWritten
    ret

StdOut ENDP

END start
#16
Beginner questions / Re: same code pelles c and gcc...
Last post by Pelle - April 23, 2026, 10:21:31 AM
Quote from: mid-kid on April 22, 2026, 09:50:18 PMI hope this helps solve the conundrum  :D
Yes, it does. Thanks!  :)

This is the good news. The bad news is I have to go back and fix the code in several places. Bah.
#17
User contributions / Re: Github-kuba miniz for Pell...
Last post by TimoVJL - April 23, 2026, 08:53:44 AM
Why not do bit more
int __cdecl main(void)
{
    zip_t *zip = zip_open("test.zip", ZIP_DEFAULT_COMPRESSION_LEVEL, 'w');
    if (zip) {
        zip_entry_open(zip, "sample.docx");
        zip_entry_fwrite(zip, "sample.docx");
        zip_entry_close(zip);
        zip_close(zip);
    }
    return 0;
}
#18
User contributions / Re: Github-kuba miniz for Pell...
Last post by Vortex - April 22, 2026, 11:11:11 PM
Source code reviewed to remove some unnecessary struct statements :

#include <stdlib.h>
#pragma comment(lib, "zip.lib")
#define ZIP_DEFAULT_COMPRESSION_LEVEL 6
typedef struct zip_t zip_t;
extern zip_t __stdcall *zip_open(const char *zipname, int level, char mode);
extern int __stdcall zip_entry_open(zip_t *zip, const char *entryname);
extern int __stdcall zip_entry_fwrite(zip_t *zip, const char *filename);
extern int __stdcall zip_entry_close(zip_t *zip);
extern int __stdcall zip_close(zip_t *zip);

int __cdecl main(void)
{
    zip_t *zip = zip_open("test.zip", ZIP_DEFAULT_COMPRESSION_LEVEL, 'w');
    {
        zip_entry_open(zip, "sample.docx");
        {
            zip_entry_fwrite(zip, "sample.docx");
        }
        zip_entry_close(zip);
    }
    zip_close(zip);
    return 0;
}
#19
Beginner questions / Re: same code pelles c and gcc...
Last post by mid-kid - April 22, 2026, 09:50:18 PM
I've looked into the standard's explanation quoted above with a friend, and we came up with the following:

Quotestdc_first_leaning_one finds the first 1 bit, searching from most significant to least significant. The index of this bit is returned such that the most significant bit is 1 and the least significant bit is w, where w is the amount of bits in the data type. 0 is returned when no match was found.

The key to understanding the definition in the standard, is to realize that the term "most significant index" refers to a way of indexing the number and not a specific index.

I hope this helps solve the conundrum  :D
#20
User contributions / Re: Github-kuba miniz for Pell...
Last post by John Z - April 22, 2026, 09:11:21 PM
Thanks Timo,

I appreciate, very much, all of your help!

John Z