Skip to content

Commit

Permalink
Atari ST version
Browse files Browse the repository at this point in the history
  • Loading branch information
gameblabla committed May 14, 2023
1 parent 9ba719e commit b9f7cbf
Show file tree
Hide file tree
Showing 61 changed files with 4,262 additions and 0 deletions.
4 changes: 4 additions & 0 deletions AtariST/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.o
*.a
atarist/
*.prg
20 changes: 20 additions & 0 deletions AtariST/APORN.gpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GIMP Palette
Name: APORN
Columns: 16
#
73 36 36 Untitled
109 73 36 Untitled
146 73 36 Untitled
146 109 73 Untitled
182 109 73 Untitled
219 109 36 Untitled
182 146 109 Untitled
255 109 73 Untitled
219 146 109 Untitled
255 146 73 Untitled
255 146 109 Untitled
219 182 146 Untitled
255 182 109 Untitled
255 219 146 Untitled
255 219 182 Untitled
255 255 219 Untitled
20 changes: 20 additions & 0 deletions AtariST/BAKURA.gpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GIMP Palette
Name: BAKURA
Columns: 16
#
0 0 0 Untitled
36 36 36 Untitled
109 73 73 Untitled
73 109 146 Untitled
109 109 146 Untitled
146 109 73 Untitled
182 146 182 Untitled
219 146 73 Untitled
219 146 182 Untitled
146 182 219 Untitled
182 182 182 Untitled
219 182 146 Untitled
219 219 219 Untitled
219 219 255 Untitled
255 219 182 Untitled
255 255 255 Untitled
Binary file added AtariST/DaDither.64.exe
Binary file not shown.
82 changes: 82 additions & 0 deletions AtariST/LIB.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/************************************************************************/
/* interface to the MINT kernel because you must not use GEMDOS or BIOS */
/* calls in an XDD. */
/* TC calling convention to stay compatible with TC's TCTOSLIB */
/* Copyright: Dr. Thomas Redelberger, 2000 */
/* Tab 4 */
/************************************************************************/
/*
$Id$
*/

#include "filesys.h"
#include "LIB.H"

extern struct kerinfo *kernel;

/* can use only kernel entry points in a MINT XDD */

int Cconws( const char *buf )
{
return (*kernel->dos_tab[0x09])((char*)buf);
}


long Dcntl(short a, long b, long c)
{
return (*kernel->dos_tab[0x130])((short)a, (long)b, (long)c);
}

int Tgettime(void)
{
return (*kernel->dos_tab[0x2c])();
}


int Tgetdate(void)
{
return (*kernel->dos_tab[0x2a])();
}


int Fcreate(char* a, short b)
{
return (*kernel->dos_tab[0x3c])((char*)a, (short)b);
}


int Fopen(char* a, short b)
{
return (*kernel->dos_tab[0x3d])((char*)a, (short)b);
}


int Fclose(short a)
{
return (*kernel->dos_tab[0x3e])((short)a);
}


long Fread(short a, long b, char* c)
{
return (*kernel->dos_tab[0xef])((short)a, (long)b, (char*)c);
}


long Fwrite(short a, long b, char* c)
{
return (*kernel->dos_tab[0x40])((short)a, (long)b, (char*)c);
}


int Fdelete(char* a)
{
return (*kernel->dos_tab[0x41])((char*)a);
}


int Fseek(long a, int b, int c)
{
return (*kernel->dos_tab[0x42])((long)a, (int)b, (int)c);
}

53 changes: 53 additions & 0 deletions AtariST/LIB.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/************************************************************************/
/* interface to the MINT kernel because you must nor use GEMDOS or BIOS */
/* calls in an XDD */
/* Copyright: Dr. Thomas Redelberger, 2000 */
/* Tab 4 */
/************************************************************************/
/*
$Id$
*/

/* referenced by transport.h */
typedef struct
{
char d_reserved[21];
unsigned char d_attrib;
unsigned int d_time;
unsigned int d_date;
unsigned long d_length;
char d_fname[14];
} DTA;
typedef struct baspag
{
void *p_lowtpa;
void *p_hitpa;
void *p_tbase;
long p_tlen;
void *p_dbase;
long p_dlen;
void *p_bbase;
long p_blen;
DTA *p_dta;
struct baspag *p_parent;
long p_resrvd0;
char *p_env;
char p_stdfh[6];
char p_resrvd1;
char p_curdrv;
long p_resrvd2[18];
char p_cmdlin[128];
} BASPAG;


int Cconws( const char *buf );
long Dcntl(short a, long b, long c);
int Tgettime(void);
int Tgetdate(void);
int Fcreate(char* a, short b);
int Fopen(char* a, short b);
int Fclose(short a);
long Fread(short a, long b, char* c);
long Fwrite(short a, long b, char* c);
int Fdelete(char* a);
int Fseek(long a, int b, int c);
21 changes: 21 additions & 0 deletions AtariST/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016/2018/2019 by Matthias Arndt <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions AtariST/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CC=m68k-atari-mint-gcc
AS=m68k-atari-mint-gcc
AR=m68k-atari-mint-ar
RANLIB=m68k-atari-mint-ranlib

CFLAGS=-Isrc -m68000 -O2 -fomit-frame-pointer -Wextra -Wall -std=c99 -nostdlib
ASFLAGS=-m68000
ARFLAGS=cr
LDFLAGS= -Wl,--as-needed -s
TARGET=main.prg
ASM_SRC = ikbd.S jagpad.S atari_dma_sound.S lz4w.S
C_SRC = main.c keys.c psg.c dma_atari.c psgpcm.c atarist.c fonts.c

all: $(TARGET)

%.S.o: %.S
$(AS) $(ASFLAGS) -o $@ -c $<

%.c.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<


$(TARGET): startup.S $(C_SRC:.c=.c.o) $(ASM_SRC:.S=.S.o)
$(CC) $(CFLAGS) $^ -o $@ $(LIBS) $(LDFLAGS)

clean:
rm -f *.o *.d $(LIBS) $(TARGET)
18 changes: 18 additions & 0 deletions AtariST/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Paradize ST Sprite Kernel ported to gcc

(c) 2016/2018/2019 by Matthias Arndt <[email protected]>

The MIT License applies to this software. Please refer to the file LICENSE for
further details.

## Abstract

This is a port of the Paradize ST Sprite Kernel to a GCC environment.
The original kernel was intended for use with GFABASIC and put into action with
the game "Attackwave" in 2009.

The kernl allows handling of basic masked sprites on ST-Low screen without clipping.

## Requirements
...

Binary file added AtariST/RIK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AtariST/RIKL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AtariST/RIKN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AtariST/TITLE
Binary file not shown.
Binary file added AtariST/TITLE.PAL
Binary file not shown.
Binary file added AtariST/TITLE.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AtariST/TITLE.RAW
Binary file not shown.
Binary file added AtariST/TITLE.lz
Binary file not shown.
Binary file added AtariST/TITLE.pi1
Binary file not shown.
119 changes: 119 additions & 0 deletions AtariST/aplib.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
| unaplib_68000.s - aPLib decompressor for 68000 - 156 bytes
| in: a0 = start of compressed data
| a1 = start of decompression buffer
| out: d0 = decompressed size
| Copyright (C) 2020 Emmanuel Marty
| With parts of the code inspired by Franck "hitchhikr" Charlet
| This software is provided 'as-is', without any express or implied
| warranty. In no event will the authors be held liable for any damages
| arising from the use of this software.
| Permission is granted to anyone to use this software for any purpose,
| including commercial applications, and to alter it and redistribute it
| freely, subject to the following restrictions:
| 1. The origin of this software must not be misrepresented| you must not
| claim that you wrote the original software. If you use this software
| in a product, an acknowledgment in the product documentation would be
| appreciated but is not required.
| 2. Altered source versions must be plainly marked as such, and must not be
| misrepresented as being the original software.
| 3. This notice may not be removed or altered from any source distribution.

.global apl_decompress
.global apl_decompress_
.global _apl_decompress

apl_decompress_:
_apl_decompress:
apl_decompress:
movem.l a2-a6/d2-d3,-(sp)

moveq #-128,d1 | initialize empty bit queue
| plus bit to roll into carry
lea 32000.w,a2 | load 32000 offset constant
lea 1280.w,a3 | load 1280 offset constant
lea 128.w,a4 | load 128 offset constant
move.l a1,a5 | save destination pointer

.literal: move.b (a0)+,(a1)+ | copy literal byte
.after_lit: moveq #3,d2 | set LWM flag

.next_token: bsr.s .get_bit | read 'literal or match' bit
bcc.s .literal | if 0: literal

bsr.s .get_bit | read '8+n bits or other type' bit
bcs.s .other_match | if 11x: other type of match

bsr.s .get_gamma2 | 10: read gamma2-coded high offset bits
sub.l d2,d0 | high offset bits == 2 when LWM == 3 ?
bcc.s .no_repmatch | if not, not a rep-match

bsr.s .get_gamma2 | read repmatch length
bra.s .got_len | go copy large match

.no_repmatch: lsl.l #8,d0 | shift high offset bits into place
move.b (a0)+,d0 | read low offset byte
move.l d0,d3 | copy offset into d3

bsr.s .get_gamma2 | read match length
cmp.l a2,d3 | offset >= 32000 ?
bge.s .inc_by_2 | if so, increase match len by 2
cmp.l a3,d3 | offset >= 1280 ?
bge.s .inc_by_1 | if so, increase match len by 1
cmp.l a4,d3 | offset < 128 ?
bge.s .got_len | if so, increase match len by 2
.inc_by_2: addq.l #1,d0 | increase match len by 1
.inc_by_1: addq.l #1,d0 | increase match len by 1

.got_len: move.l a1,a6 | calculate backreference address
sub.l d3,a6 | (dest - match offset)
subq.l #1,d0 | dbf will loop until d0 is -1, not 0
.copy_match: move.b (a6)+,(a1)+ | copy matched byte
dbf d0,.copy_match | loop for all matched bytes
moveq #2,d2 | clear LWM flag
bra.s .next_token | go decode next token

.other_match: bsr.s .get_bit | read '7+1 match or short literal' bit
bcs.s .short_match | if 111: 4 bit offset for 1-byte copy

moveq #1,d0 | 110: prepare match length
moveq #0,d3 | clear high bits of offset
move.b (a0)+,d3 | read low bits of offset + length bit
lsr.b #1,d3 | shift offset into place, len into carry
beq.s .done | check for EOD
addx.b d0,d0 | len = (1 << 1) + carry bit, ie. 2 or 3
bra.s .got_len | go copy match

.short_match: moveq #0,d0 | clear short offset before reading 4 bits
bsr.s .get_dibits | read a data bit into d0, one into carry
addx.b d0,d0 | shift second bit into d0
bsr.s .get_dibits | read a data bit into d0, one into carry
addx.b d0,d0 | shift second bit into d0
tst.b d0 | check offset value
beq.s .write_zero | if offset is zero, write a 0

move.l a1,a6 | calculate backreference address
sub.l d0,a6 | (dest - short offset)
move.b (a6),d0 | read matched byte
.write_zero: move.b d0,(a1)+ | write matched byte or 0
bra.s .after_lit | set LWM flag and go decode next token

.done: move.l a1,d0 | pointer to last decompressed byte + 1
sub.l a6,d0 | minus start of decompression buffer = size
movem.l (sp)+,a2-a6/d2-d3
rts

.get_gamma2: moveq #1,d0 | init to 1 so it gets shifted to 2 below
.gamma2_loop: bsr.s .get_dibits | read data bit, shift into d0
| and read continuation bit
bcs.s .gamma2_loop | loop until a 0 continuation bit is read
rts

.get_dibits: bsr.s .get_bit | read bit
addx.l d0,d0 | shift into d0
| fall through
.get_bit: add.b d1,d1 | shift bit queue, high bit into carry
bne.s .got_bit | queue not empty, bits remain
move.b (a0)+,d1 | read 8 new bits
addx.b d1,d1 | shift bit queue, high bit into carry
| and shift 1 from carry into bit queue
.got_bit: rts
Loading

0 comments on commit b9f7cbf

Please sign in to comment.