CONFIGURE: Add support for m68k-atari-mintelf

This is basically the same as m68k-atari-mint host os but with a
different compiler/file format.
This commit is contained in:
Miro Kropacek 2023-08-12 04:25:35 +02:00
parent b510eff336
commit dcab5d3369
10 changed files with 209 additions and 93 deletions

View File

@ -19,20 +19,22 @@
*
*/
.global _asm_screen_tt_save
.global _asm_screen_falcon_save
#include "../../platform/atari/symbols.h"
.global _asm_screen_tt_restore
.global _asm_screen_falcon_restore
.global SYM(asm_screen_tt_save)
.global SYM(asm_screen_falcon_save)
.global _asm_draw_4bpl_sprite
.global _asm_draw_8bpl_sprite
.global SYM(asm_screen_tt_restore)
.global SYM(asm_screen_falcon_restore)
.global SYM(asm_draw_4bpl_sprite)
.global SYM(asm_draw_8bpl_sprite)
.text
| extern void asm_screen_tt_save(void);
|
_asm_screen_tt_save:
SYM(asm_screen_tt_save):
bsr wait_vbl | avoid flickering
lea 0xffff8400.w,a0
@ -51,7 +53,7 @@ tt_save_loop:
| extern void asm_screen_falcon_save(void);
|
_asm_screen_falcon_save:
SYM(asm_screen_falcon_save):
movem.l d2-d7/a2,-(sp)
bsr wait_vbl | avoid flickering
@ -99,7 +101,7 @@ falcon_save_loop:
| extern void asm_screen_tt_restore(void);
|
_asm_screen_tt_restore:
SYM(asm_screen_tt_restore):
bsr wait_vbl | avoid flickering
lea save_video,a1
@ -117,7 +119,7 @@ _asm_screen_tt_restore:
| extern void asm_screen_falcon_restore(void);
|
_asm_screen_falcon_restore:
SYM(asm_screen_falcon_restore):
movem.l d2-d7/a2,-(sp)
bsr wait_vbl | avoid flickering
@ -188,7 +190,7 @@ wait_vbl:
| extern void asm_draw_4bpl_sprite(uint16 *dstBuffer, const uint16 *srcBuffer, const uint16 *srcMask,
| uint destX, uint destY, uint dstPitch, uint w, uint h);
|
_asm_draw_4bpl_sprite:
SYM(asm_draw_4bpl_sprite):
movem.l d0-d7/a0-a2,-(sp) | 11 longs
move.l (4+11*4,sp),a2 | a2: dstBuffer
@ -286,7 +288,7 @@ sprite4_xloop:
| extern void asm_draw_8bpl_sprite(uint16 *dstBuffer, const uint16 *srcBuffer, const uint16 *srcMask,
| uint destX, uint destY, uint dstPitch, uint w, uint h);
|
_asm_draw_8bpl_sprite:
SYM(asm_draw_8bpl_sprite):
movem.l d0-d7/a0-a2,-(sp) | 11 longs
move.l (4+11*4,sp),a2 | a2: dstBuffer

View File

@ -19,20 +19,22 @@
*
*/
#include "../../platform/atari/symbols.h"
| C2P by Mikael Kalms (public domain)
| See https://github.com/Kalmalyzer/kalms-c2p
.globl _asm_c2p1x1_8
.globl _asm_c2p1x1_8_tt
.globl _asm_c2p1x1_8_rect
.globl _asm_c2p1x1_4
.globl _asm_c2p1x1_4_rect
.globl SYM(asm_c2p1x1_8)
.globl SYM(asm_c2p1x1_8_tt)
.globl SYM(asm_c2p1x1_8_rect)
.globl SYM(asm_c2p1x1_4)
.globl SYM(asm_c2p1x1_4_rect)
.text
| void asm_c2p1x1_8(const byte *pChunky, const byte *pChunkyEnd, byte *pScreen);
_asm_c2p1x1_8:
SYM(asm_c2p1x1_8):
move.l (4,sp),a0 | chunky
move.l (8,sp),d0 | chunky end
move.l (12,sp),a1 | screen
@ -229,7 +231,7 @@ c2p1x1_8_start:
| void asm_c2p1x1_8_tt(const byte *pChunky, const byte *pChunkyEnd, byte *pScreen, uint32 screenPitch);
_asm_c2p1x1_8_tt:
SYM(asm_c2p1x1_8_tt):
movem.l d2-d7/a2-a6,-(sp) | 6 + 5 = 11 longs
move.l (11*4+4,sp),a0 | a0: chunky
@ -444,7 +446,7 @@ c2p1x1_8_tt_start:
| void asm_c2p1x1_8_rect(const byte *pChunky, const byte *pChunkyEnd, uint32 chunkyWidth, uint32 chunkyPitch, byte *pScreen, uint32 screenPitch);
_asm_c2p1x1_8_rect:
SYM(asm_c2p1x1_8_rect):
movem.l d2-d7/a2-a6,-(sp) | 6 + 5 = 11 longs
move.l (11*4+4,sp),a0 | a0: chunky
@ -676,7 +678,7 @@ c2p1x1_8_rect_done:
| void asm_c2p1x1_4(const byte *pChunky, const byte *pChunkyEnd, byte *pScreen);
_asm_c2p1x1_4:
SYM(asm_c2p1x1_4):
move.l (4,sp),a0 | chunky
move.l (8,sp),d0 | chunky end
move.l (12,sp),a1 | screen
@ -780,7 +782,7 @@ c2p1x1_4_start:
| void asm_c2p1x1_4_rect(const byte *pChunky, const byte *pChunkyEnd, uint32 chunkyWidth, uint32 chunkyPitch, byte *pScreen, uint32 screenPitch);
_asm_c2p1x1_4_rect:
SYM(asm_c2p1x1_4_rect):
movem.l d2-d7/a2-a6,-(sp) | 6 + 5 = 11 longs
move.l (11*4+4,sp),a0 | a0: chunky

View File

@ -19,14 +19,16 @@
*
*/
.globl _atari_200hz_init
.globl _atari_200hz_shutdown
#include "symbols.h"
.globl _counter_200hz
.globl SYM(atari_200hz_init)
.globl SYM(atari_200hz_shutdown)
.globl SYM(counter_200hz)
.text
_atari_200hz_init:
SYM(atari_200hz_init):
move sr,-(sp)
or #0x700,sr
@ -36,7 +38,7 @@ _atari_200hz_init:
move (sp)+,sr
rts
_atari_200hz_shutdown:
SYM(atari_200hz_shutdown):
move sr,-(sp)
or #0x700,sr
@ -50,7 +52,7 @@ _atari_200hz_shutdown:
old_200hz:
dc.l 0
my_200hz:
addq.l #1,_counter_200hz
addq.l #1,SYM(counter_200hz)
move.l old_200hz,-(sp)
rts
@ -59,5 +61,5 @@ my_200hz:
.bss
.even
_counter_200hz:
SYM(counter_200hz):
ds.l 1

View File

@ -19,23 +19,25 @@
*
*/
.global _atari_kbdvec
.global _atari_mousevec
.global _atari_vkbderr
#include "symbols.h"
.extern _g_atari_ikbd_mouse_buttons_state
.extern _g_atari_ikbd_mouse_delta_x
.extern _g_atari_ikbd_mouse_delta_y
.global SYM(atari_kbdvec)
.global SYM(atari_mousevec)
.global SYM(atari_vkbderr)
.extern _g_atari_ikbd_scancodes
.extern _g_atari_ikbd_scancodes_mask
.extern _g_atari_ikbb_scancodes_head
.extern SYM(g_atari_ikbd_mouse_buttons_state)
.extern SYM(g_atari_ikbd_mouse_delta_x)
.extern SYM(_atari_ikbd_mouse_delta_y)
.extern _g_atari_old_kbdvec
.extern SYM(g_atari_ikbd_scancodes)
.extern SYM(g_atari_ikbd_scancodes_mask)
.extern SYM(g_atari_ikbb_scancodes_head)
.extern SYM(g_atari_old_kbdvec)
.text
_atari_kbdvec:
SYM(atari_kbdvec):
tst.w (vkbderr_count,pc)
bne.b kbdvec_end
@ -51,7 +53,7 @@ key_released:
| if we get a sudden release key event,
| let the original handler process it
move.l _g_atari_old_kbdvec,a0
move.l SYM(g_atari_old_kbdvec),a0
tst.l a0
beq.b kbdvec_end
jmp (a0)
@ -64,38 +66,38 @@ key_pressed:
addq.b #1,(a0,d1.l) | mark as pressed
kbdvec_process:
lea _g_atari_ikbd_scancodes,a0
move.w _g_atari_ikbb_scancodes_head,d1
lea SYM(g_atari_ikbd_scancodes),a0
move.w SYM(g_atari_ikbb_scancodes_head),d1
| g_atari_ikbd_scancodes[g_atari_ikbb_scancodes_head] = scancode
move.b d0,(0.b,a0,d1.w)
addq.l #1,d1
and.w _g_atari_ikbd_scancodes_mask,d1
move.w d1,_g_atari_ikbb_scancodes_head
and.w SYM(g_atari_ikbd_scancodes_mask),d1
move.w d1,SYM(g_atari_ikbb_scancodes_head)
kbdvec_end:
rts
_atari_vkbderr:
SYM(atari_vkbderr):
addq.w #1,vkbderr_count
rts
_atari_mousevec:
SYM(atari_mousevec):
clr.w vkbderr_count
move.b (a0)+,_g_atari_ikbd_mouse_buttons_state
move.b (a0)+,SYM(g_atari_ikbd_mouse_buttons_state)
move.b (a0)+,d0
ext.w d0
add.w d0,_g_atari_ikbd_mouse_delta_x
add.w d0,SYM(g_atari_ikbd_mouse_delta_x)
move.b (a0)+,d0
ext.w d0
add.w d0,_g_atari_ikbd_mouse_delta_y
add.w d0,SYM(g_atari_ikbd_mouse_delta_y)
rts
// place it within reach of 32K (PC relative)

View File

@ -6,15 +6,18 @@
mkdir -p build-release
cd build-release
PLATFORM=m68k-atari-mintelf
export ASFLAGS="-m68020-60"
export CXXFLAGS="-m68020-60 -DUSE_MOVE16 -DUSE_SUPERVIDEL -DUSE_SV_BLITTER"
export LDFLAGS="-m68020-60"
export PKG_CONFIG_LIBDIR="$(${PLATFORM}-gcc -print-sysroot)/usr/lib/m68020-60/pkgconfig"
if [ ! -f config.log ]
then
../configure \
--backend=atari \
--host=m68k-atari-mint \
--host=${PLATFORM} \
--enable-release \
--disable-mt32emu \
--disable-lua \
@ -35,6 +38,13 @@ make -j 16
rm -rf dist-generic
make dist-generic
# make memory protection friendly
${PLATFORM}-flags -S dist-generic/scummvm/scummvm.ttp
# create symbol file and strip
${PLATFORM}-nm -C dist-generic/scummvm/scummvm.ttp | grep -vF ' .L' | grep ' [TtWV] ' | ${PLATFORM}-c++filt | sort -u > dist-generic/scummvm/scummvm.sym
${PLATFORM}-strip -s dist-generic/scummvm/scummvm.ttp
# remove unused files; absent gui-icons.dat massively speeds up startup time (used for the grid mode)
rm -f dist-generic/scummvm/data/{gui-icons,achievements,macgui,shaders}.dat
@ -52,3 +62,9 @@ cd -
# readme.txt
cp ../backends/platform/atari/readme.txt dist-generic/scummvm
unix2dos dist-generic/scummvm/readme.txt
cd dist-generic
zip -r -9 scummvm-fat.zip scummvm
cd -
mv dist-generic/scummvm-fat.zip ..

View File

@ -6,15 +6,18 @@
mkdir -p build-release030
cd build-release030
PLATFORM=m68k-atari-mintelf
export ASFLAGS="-m68030"
export CXXFLAGS="-m68030 -DDISABLE_FANCY_THEMES"
export LDFLAGS="-m68030"
export PKG_CONFIG_LIBDIR="$(${PLATFORM}-gcc -print-sysroot)/usr/lib/m68020-60/pkgconfig"
if [ ! -f config.log ]
then
../configure \
--backend=atari \
--host=m68k-atari-mint \
--host=${PLATFORM} \
--enable-release \
--disable-mt32emu \
--disable-lua \
@ -36,9 +39,22 @@ make -j 16
rm -rf dist-generic
make dist-generic
# make memory protection friendly
${PLATFORM}-flags -S dist-generic/scummvm/scummvm.ttp
# create symbol file and strip
${PLATFORM}-nm -C dist-generic/scummvm/scummvm.ttp | grep -vF ' .L' | grep ' [TtWV] ' | ${PLATFORM}-c++filt | sort -u > dist-generic/scummvm/scummvm.sym
${PLATFORM}-strip -s dist-generic/scummvm/scummvm.ttp
# remove unused files
rm -f dist-generic/scummvm/data/*.zip dist-generic/scummvm/data/{gui-icons,achievements,macgui,shaders}.dat
# readme.txt
cp ../backends/platform/atari/readme.txt dist-generic/scummvm
unix2dos dist-generic/scummvm/readme.txt
cd dist-generic
zip -r -9 scummvm-slim.zip scummvm
cd -
mv dist-generic/scummvm-slim.zip ..

View File

@ -0,0 +1,79 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Atari a.out / ELF symbol handling by Thorsten Otto.
// include in each of the .S files and put every global symbol into
// SYM(<symbol name>).
#ifndef __USER_LABEL_PREFIX__
#define __USER_LABEL_PREFIX__ _
#endif
#ifndef __REGISTER_PREFIX__
#define __REGISTER_PREFIX__
#endif
#ifndef __IMMEDIATE_PREFIX__
#define __IMMEDIATE_PREFIX__ #
#endif
#define CONCAT1(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a ## b
/* Use the right prefix for global labels. */
#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
#ifdef __ELF__
#define FUNC(x) .type SYM(x),function
#else
/* The .proc pseudo-op is accepted, but ignored, by GAS. We could just
define this to the empty string for non-ELF systems, but defining it
to .proc means that the information is available to the assembler if
the need arises. */
#define FUNC(x) .proc
#endif
#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x)
#define d0 REG(d0)
#define d1 REG(d1)
#define d2 REG(d2)
#define d3 REG(d3)
#define d4 REG(d4)
#define d5 REG(d5)
#define d6 REG(d6)
#define d7 REG(d7)
#define a0 REG(a0)
#define a1 REG(a1)
#define a2 REG(a2)
#define a3 REG(a3)
#define a4 REG(a4)
#define a5 REG(a5)
#define a6 REG(a6)
#define a7 REG(a7)
#define fp REG(fp)
#define sp REG(sp)
#define pc REG(pc)
#define sr REG(sr)

18
configure vendored
View File

@ -1738,10 +1738,10 @@ kos32)
_host_cpu=i686
_host_alias=kos32
;;
m68k-atari-mint)
m68k-atari-mint*)
_host_os=mint
_host_cpu=m68k
_host_alias=m68k-atari-mint
_host_alias=$_host
;;
maemo)
_host_os=maemo
@ -3704,12 +3704,12 @@ if test -n "$_host"; then
add_line_to_config_mk 'KOS32_SDK_DIR = '"${KOS32_SDK_DIR}"
_port_mk="backends/platform/sdl/kolibrios/kolibrios.mk"
;;
m68k-atari-mint)
m68k-atari-mint*)
# auto -> yes (overriden by $_release_build = yes)
if test "$_debug_build" = "no"; then
# --disable-debug
append_var LDFLAGS "-s"
fi
#if test "$_debug_build" = "no"; then
# # --disable-debug
# append_var LDFLAGS "-s"
#fi
# auto -> no
if test "$_optimizations" = "yes"; then
@ -3724,8 +3724,8 @@ if test -n "$_host"; then
# --enable-release
append_var DEFINES "-DNDEBUG"
#append_var DEFINES "-DDISABLE_TEXT_CONSOLE"
append_var CXXFLAGS "-I$HOME/gnu-tools/m68000/m68k-atari-mint/sys-root/opt/mintlib-dlmalloc/include"
append_var LDFLAGS "-L$HOME/gnu-tools/m68000/m68k-atari-mint/sys-root/opt/mintlib-dlmalloc/lib/m68020-60"
append_var CXXFLAGS "-I$($_host_alias-gcc -print-sysroot)/opt/mintlib-dlmalloc/include"
append_var LDFLAGS "-L$($_host_alias-gcc -print-sysroot)/opt/mintlib-dlmalloc/lib/m68020-60"
fi
_seq_midi=no

View File

@ -202,15 +202,15 @@ void copyBlit(byte *dst, const byte *src,
#ifdef USE_MOVE16
if (hasMove16() && ((uintptr)src & (ALIGN - 1)) == 0 && ((uintptr)dst & (ALIGN - 1)) == 0) {
__asm__ volatile(
" move.l %2,d0\n"
" lsr.l #4,d0\n"
" move.l %2,%%d0\n"
" lsr.l #4,%%d0\n"
" beq.b 3f\n"
" moveq #0x0f,d1\n"
" and.l d0,d1\n"
" neg.l d1\n"
" lsr.l #4,d0\n"
" jmp (2f,pc,d1.l*4)\n"
" moveq #0x0f,%%d1\n"
" and.l %%d0,%%d1\n"
" neg.l %%d1\n"
" lsr.l #4,%%d0\n"
" jmp (2f,%%pc,%%d1.l*4)\n"
"1:\n"
" move16 (%0)+,(%1)+\n"
" move16 (%0)+,(%1)+\n"
@ -229,14 +229,14 @@ void copyBlit(byte *dst, const byte *src,
" move16 (%0)+,(%1)+\n"
" move16 (%0)+,(%1)+\n"
"2:\n"
" dbra d0,1b\n"
" dbra %%d0,1b\n"
// handle also the unlikely case when 'dstPitch'
// is not divisible by 16 but 'src' and 'dst' are
"3:\n"
" moveq #0x0f,d0\n"
" and.l %2,d0\n"
" neg.l d0\n"
" jmp (4f,pc,d0.l*2)\n"
" moveq #0x0f,%%d0\n"
" and.l %2,%%d0\n"
" neg.l %%d0\n"
" jmp (4f,%%pc,%%d0.l*2)\n"
// only 15x move.b as 16 would be handled above
" move.b (%0)+,(%1)+\n"
" move.b (%0)+,(%1)+\n"
@ -269,26 +269,26 @@ void copyBlit(byte *dst, const byte *src,
if (hasMove16() && ((uintptr)src & (ALIGN - 1)) == 0 && ((uintptr)dst & (ALIGN - 1)) == 0
&& (srcPitch & (ALIGN - 1)) == 0 && (dstPitch & (ALIGN - 1)) == 0) {
__asm__ volatile(
" move.l %2,d0\n"
" move.l %2,%%d0\n"
" moveq #0x0f,d1\n"
" and.l d0,d1\n"
" neg.l d1\n"
" lea (4f,pc,d1.l*2),a0\n"
" move.l a0,a1\n"
" moveq #0x0f,%%d1\n"
" and.l %%d0,%%d1\n"
" neg.l %%d1\n"
" lea (4f,%%pc,%%d1.l*2),%%a0\n"
" move.l %%a0,%%a1\n"
" lsr.l #4,d0\n"
" lsr.l #4,%%d0\n"
" beq.b 3f\n"
" moveq #0x0f,d1\n"
" and.l d0,d1\n"
" neg.l d1\n"
" lea (2f,pc,d1.l*4),a0\n"
" lsr.l #4,d0\n"
" move.l d0,d1\n"
" moveq #0x0f,%%d1\n"
" and.l %%d0,%%d1\n"
" neg.l %%d1\n"
" lea (2f,%%pc,%%d1.l*4),%%a0\n"
" lsr.l #4,%%d0\n"
" move.l %%d0,%%d1\n"
"0:\n"
" move.l d1,d0\n"
" jmp (a0)\n"
" move.l %%d1,%%d0\n"
" jmp (%%a0)\n"
"1:\n"
" move16 (%0)+,(%1)+\n"
" move16 (%0)+,(%1)+\n"
@ -307,10 +307,10 @@ void copyBlit(byte *dst, const byte *src,
" move16 (%0)+,(%1)+\n"
" move16 (%0)+,(%1)+\n"
"2:\n"
" dbra d0,1b\n"
" dbra %%d0,1b\n"
// handle (w * bytesPerPixel) % 16
"3:\n"
" jmp (a1)\n"
" jmp (%%a1)\n"
// only 15x move.b as 16 would be handled above
" move.b (%0)+,(%1)+\n"
" move.b (%0)+,(%1)+\n"

View File

@ -61,9 +61,6 @@ dist-generic: $(EXECUTABLE) $(PLUGINS)
mkdir -p ./dist-generic/scummvm/doc
rm -f ./dist-generic/scummvm/$(EXECUTABLE)
cp $(EXECUTABLE) ./dist-generic/scummvm
ifeq ($(BACKEND), atari)
m68k-atari-mint-flags -S ./dist-generic/scummvm/$(EXECUTABLE)
endif
cp $(DIST_FILES_DOCS) ./dist-generic/scummvm/doc
cp $(DIST_FILES_THEMES) ./dist-generic/scummvm/data
ifdef DIST_FILES_ENGINEDATA