Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,24 @@ on:
# activating dispatch to allow manual runs
# workflow_dispatch:

env:
MSYS2_INSTALL_FOLDER: C:\msys64\ # provided by GitHub Actions VMs
# env:
# MSYS2_INSTALL_FOLDER: C:\msys64\ # provided by GitHub Actions VMs


jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, macos-14, macos-15-intel, windows-2022]
os: [ubuntu-22.04, macos-15-intel, macos-26, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Setup MSYS2
if: startsWith(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: coreutils binutils base-devel git mingw-w64-ucrt-x86_64-gcc
- name: Check out code from the repository
uses: actions/checkout@v4
with:
Expand All @@ -39,12 +46,7 @@ jobs:
echo Build Complete
- name: Build on Windows
if: startsWith(matrix.os, 'windows')
run: |
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -c "pacman -S binutils make mingw-w64-x86_64-gcc git --noconfirm"
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -where %CD% -c "make"
echo Build Complete
- name: Build on MacOs-14
if: startsWith(matrix.os, 'macos-14')
shell: msys2 {0}
run: |
make
echo Build Complete
Expand All @@ -53,6 +55,11 @@ jobs:
run: |
make
echo Build Complete
- name: Build on MacOs-26
if: startsWith(matrix.os, 'macos-26')
run: |
make
echo Build Complete
- name: Archive toolchain
uses: actions/upload-artifact@v4
with:
Expand All @@ -67,10 +74,17 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-22.04, macos-14, macos-15-intel, windows-2022]
os: [ubuntu-22.04, macos-15-intel, macos-26, windows-2022]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Setup MSYS2
if: startsWith(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: coreutils binutils base-devel git mingw-w64-ucrt-x86_64-gcc
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previoulsy built artifacts
Expand All @@ -88,13 +102,6 @@ jobs:
make check
make test
echo Test Complete
- name: Setup Msys2
if: startsWith(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: coreutils make git
- name: Run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: msys2 {0}
Expand All @@ -112,10 +119,17 @@ jobs:
package:
strategy:
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
os: [ubuntu-22.04, macos-26, windows-2022]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Setup MSYS2
if: startsWith(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: coreutils binutils base-devel git zip
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previously built artifacts
Expand All @@ -129,9 +143,9 @@ jobs:
echo Package Complete
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'windows')
shell: msys2 {0}
run: |
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -c "pacman -S binutils make mingw-w64-x86_64-make git zip --noconfirm"
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -where %CD% -c "make package"
make package
echo Package Complete
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'macos')
Expand All @@ -153,14 +167,14 @@ jobs:
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previoulsy built artifacts win64
- name: Get previously built artifacts win64
uses: actions/download-artifact@v4
with:
name: package-windows-2022
- name: Get previously built artifacts macos
uses: actions/download-artifact@v4
with:
name: package-macos-14
name: package-macos-26
- name: Get previously built artifacts linux
uses: actions/download-artifact@v4
with:
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ package:
mv tmp/* bin/
rm -d tmp
ifeq ($(OS),Windows_NT)
cp /mingw64/bin/mingw32-make bin/
wget https://mirror.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-make-4.4.1-3-any.pkg.tar.zst
tar --zstd -xf mingw-w64-ucrt-x86_64-make-4.4.1-3-any.pkg.tar.zst ucrt64/bin/mingw32-make.exe
cp ucrt64/bin/mingw32-make.exe bin/
rm -f mingw-w64-ucrt-x86_64-make-4.4.1-3-any.pkg.tar.zst
rm -fr ucrt64
endif
rm -f huc-$(DATE)-$(PLATFORMSUFFIX).zip
cd .. ; zip -r huc/huc-$(DATE)-$(PLATFORMSUFFIX).zip huc/* -x *.zip -x .*
Expand Down
2 changes: 1 addition & 1 deletion examples/hucc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Makefile for examples
#

SUBDIRS = overlay scroll sgx shmup \
SUBDIRS = overlay scroll sgx sgx-subpixel-scroll shmup \
metatile1-chrblkmap metatile2-multimap metatile3-multiblk \
obeybrew-tutorial1 obeybrew-tutorial2 obeybrew-tutorial3 obeybrew-tutorial4 \
obeybrew-tutorial5 obeybrew-tutorial6 obeybrew-tutorial7
Expand Down
10 changes: 9 additions & 1 deletion examples/hucc/metatile3-multiblk/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
all: multiblk.pce
all: multiblk.pce multiblk.iso

include ../Make_ex.inc

SRC = multiblk.c graphics.asm
ISO = multiblk.ovl datafile.bin

CFLAGS ?= -v -O2 -fno-recursive -gL
CDFLAGS ?= --scd --overlay

multiblk.ovl: $(SRC)
$(CC) $(CFLAGS) $(CDFLAGS) $< $(LIBS)

multiblk.iso: $(ISO)
$(IL) $@ --ipl="MultiBLK" $+

multiblk.pce: $(SRC)
$(CC) $(CFLAGS) $< $(LIBS)
1 change: 1 addition & 0 deletions examples/hucc/metatile3-multiblk/datafile.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, I am text in a CD file!
19 changes: 19 additions & 0 deletions examples/hucc/metatile3-multiblk/multiblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,25 @@ test_multiblk()
put_string( " Use 2 sets of blocks in a map. ", 0, 0 );
put_string( " LRUD to scroll. RUN for next. ", 0, 1 );

#ifdef _OVERLAY // Defined by HuCC when building a CD overlay file.

// This bit shows how to load a data file into memory from the CD. It really
// has nothing to do with the multiblk example, but it was convenient to add
// it here. Sorry if this is confusing! ;-)
//
// Load 1 sector (i.e. 2048 bytes) of CD file 2 into bank $87 which is known
// to be unused because this example is so short!

cd_loadbank( 2, 0, 0x87, 1 );

// Bank $87 is automatically mapped into MPR2 (address $4000-$5FFF) at start
// and this just prints that memory as a string.

set_font_pal( 8 );
put_string( 0x4000, 1, 3 );

#endif

scroll_split( 0, 0, vdc_map_pxl_x & (BAT_W - 1), vdc_map_pxl_y & (BAT_H - 1), BKG_ON | SPR_ON );

vsync();
Expand Down
3 changes: 3 additions & 0 deletions examples/hucc/metatile3-multiblk/multiblk.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FILE "multiblk.iso" BINARY
TRACK 1 MODE1/2048
INDEX 1 00:00:00
2 changes: 1 addition & 1 deletion include/hucc/hucc-codegen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5885,7 +5885,7 @@ __sub.upf .macro
phy
ldy #\2
sec
sbc [\1]
sbc [\1], y
ply
bcs !+
dey
Expand Down
18 changes: 11 additions & 7 deletions include/hucc/hucc-systemcard.asm
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ _cd_loaddata.4 .proc
;
; unsigned char __fastcall cd_loadbank( unsigned char ovl_index<_cl>, unsigned int sect_offset<_si>, unsigned char bank<_bl>, unsigned int sectors<_al> );

_cd_loadbank.4 .macro
_cd_loadbank.4 .proc

ldx <_cl ; Get file address and length.
jsr get_file_info

Expand All @@ -436,21 +437,24 @@ _cd_loadbank.4 .macro
beq !+
sta <_al

!: lda #4 ; Use MPR4.
!: lda #3 ; Use MPR3.
sta <_dh

tma4 ; Preserve MPR4.
tma3 ; Preserve MPR3.
pha

system cd_read

tax ; Restore MPR4 because the
tax ; Restore MPR3 because the
pla ; System Card function has
tam4 ; a bug which destroys the
tam3 ; a bug which destroys the
txa ; value on a CD error.

cly
.endm
cly ; Return code in Y:X, X -> A.

leave ; Return and copy X -> A.

.endp



Expand Down
6 changes: 3 additions & 3 deletions src/hucc/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,9 @@ enum ICOMPARE {
/* symbol table entry format */
/* N.B. nasty hack to allow space beyond NAMEMAX (see "copysym") */

#define NAMESIZE 48
#define NAMEMAX 47
#define NAMEALLOC 64
#define NAMESIZE 80
#define NAMEMAX 79
#define NAMEALLOC 96

typedef struct symbol {
char name[NAMEALLOC]; /* symbol name */
Expand Down
3 changes: 1 addition & 2 deletions src/hucc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,13 @@ int main (int argc, char *argv[])
incl_globals_h();
}

// gtext ();
parse();
fclose(input);
ol(".dbg\tclear");
// gbss ();
dumplits();
dumpglbs();
dumpfinal();
gtext();
errorsummary();
pl("");
errs = errs || errfile;
Expand Down
45 changes: 35 additions & 10 deletions src/mkit/as/pngreadwrite/compress.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
* Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/

/* @(#) $Id$ */

#define ZLIB_INTERNAL
#include "zlib.h"
#include <stddef.h>

/* ===========================================================================
Compresses the source buffer into the destination buffer. The level
Expand All @@ -18,13 +19,19 @@
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.

The _z versions of the functions take size_t length arguments.
*/
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
z_size_t sourceLen, int level) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
uLong left;
z_size_t left;

if ((sourceLen > 0 && source == NULL) ||
destLen == NULL || (*destLen > 0 && dest == NULL))
return Z_STREAM_ERROR;

left = *destLen;
*destLen = 0;
Expand All @@ -43,23 +50,36 @@ int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,

do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
stream.avail_out = left > (z_size_t)max ? max : (uInt)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
stream.avail_in = sourceLen > (z_size_t)max ? max :
(uInt)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
} while (err == Z_OK);

*destLen = stream.total_out;
*destLen = (z_size_t)(stream.next_out - dest);
deflateEnd(&stream);
return err == Z_STREAM_END ? Z_OK : err;
}

int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
int ret;
z_size_t got = *destLen;
ret = compress2_z(dest, &got, source, sourceLen, level);
*destLen = (uLong)got;
return ret;
}
/* ===========================================================================
*/
int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
z_size_t sourceLen) {
return compress2_z(dest, destLen, source, sourceLen,
Z_DEFAULT_COMPRESSION);
}
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen) {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
Expand All @@ -69,7 +89,12 @@ int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
z_size_t ZEXPORT compressBound_z(z_size_t sourceLen) {
z_size_t bound = sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
return bound < sourceLen ? (z_size_t)-1 : bound;
}
uLong ZEXPORT compressBound(uLong sourceLen) {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
z_size_t bound = compressBound_z(sourceLen);
return (uLong)bound != bound ? (uLong)-1 : (uLong)bound;
}
Loading
Loading