Skip to content

Commit

Permalink
Falcon port
Browse files Browse the repository at this point in the history
  • Loading branch information
gameblabla committed Apr 16, 2018
1 parent f941578 commit 7ab9db5
Show file tree
Hide file tree
Showing 59 changed files with 3,274 additions and 0 deletions.
Binary file added Consoles_port/Falcon_port/BMPConv/background.bmp
Binary file not shown.
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/bullet.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/end.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/font.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/go.bmp
Binary file not shown.
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/lvl1.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/lvl2.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/lvl3.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/lvl4.bmp
Binary file not shown.
90 changes: 90 additions & 0 deletions Consoles_port/Falcon_port/BMPConv/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
The MIT License (MIT)
Copyright (c) 2018 Gameblabla
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:
*/

#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <stdio.h>
#include <stdlib.h>
#include <byteswap.h>

SDL_Surface* screen;
SDL_Surface* tmp;
#define RGB565(r, g, b) ((r << 11) + (g << 5) + b)

int main(int argc, char* argv[])
{
unsigned long long i;
unsigned long FZ_SIZE;
unsigned long red, green, blue;
unsigned short width, height;
unsigned short newwidth, newheight;
unsigned char* data, *newdata;
FILE* fp = NULL;
FILE* output = NULL;

if(argc != 3)
{
printf("Converter to Falcon RGB565 format (Gameblabla's Custom Bitmap format)\n Enter your pict and the new format name\n");
return 0;
}

fp = fopen(argv[1], "rb");
if (fgetc(fp)!='B' || fgetc(fp)!='M')
{
fclose(fp);
printf("%s is not a bitmap file.\n", argv[1]);
exit(1);
}

fseek(fp,18, SEEK_SET);
fread(&width, sizeof(unsigned short), 1, fp);
fseek(fp,22, SEEK_SET);
fread(&height,sizeof(unsigned short), 1, fp);
fseek(fp, 0, SEEK_SET);
FZ_SIZE = (width * height) * 2;

data = (unsigned char *) malloc(FZ_SIZE+4);
newdata = (unsigned char *) malloc(FZ_SIZE+4);
fseek(fp, 70, SEEK_SET); //138 with color information, 70 without
fread(newdata, 1, FZ_SIZE, fp);
fclose(fp);

SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(width, height, 16, SDL_SWSURFACE);
memcpy(screen->pixels, newdata, FZ_SIZE);

while(1)
{
Uint8 *keystate = SDL_GetKeyState(NULL);
if (keystate[SDLK_ESCAPE] || keystate[SDLK_SPACE]) break;
SDL_Event event;
SDL_Flip(screen);
SDL_PollEvent(&event);
}

/* Handling endianess */
output = fopen(argv[2],"wb");
newwidth = bswap_16(width);
newheight = bswap_16(height);
fwrite(&newwidth,sizeof(unsigned short),1,output);
fwrite(&newheight,sizeof(unsigned short),1,output);
for(i = FZ_SIZE;i>0;i--)
{
fwrite(&newdata[(i-1)],1,1,output);
}

if (output != NULL) fclose(output);
if (newdata != NULL) free(newdata);
if (data != NULL) free(data);
SDL_Quit();
};
Binary file added Consoles_port/Falcon_port/BMPConv/mission.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/player.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/temp.bmp
Binary file not shown.
Binary file added Consoles_port/Falcon_port/BMPConv/title.bmp
Binary file not shown.
27 changes: 27 additions & 0 deletions Consoles_port/Falcon_port/CREDITS.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Alexandr Zhelanov for Battle
CC-BY-SA 4.0, CC-BY-SA 3.0
http://creativecommons.org/licenses/by-sa/4.0/
http://creativecommons.org/licenses/by-sa/3.0/

p0ss for History (music) [orchestral into futuristic] (https://opengameart.org/users/p0ss)
CC-BY-SA 3.0
http://creativecommons.org/licenses/by-sa/3.0/

cynicmusic https://opengameart.org/content/crystal-cave-song18
CC-BY 3.0
http://creativecommons.org/licenses/by/3.0/

Alex McCulloch, https://opengameart.org/users/amac1990
CC0

Australian National Anthem from the Department of Foreign Affairs and Trade's official youtube channel (or so they claim...)
https://www.youtube.com/watch?v=RfvTXt-iNyQ
Licensed under the Creative Commons BY (as defined by Youtube : https://www.youtube.com/t/creative_commons)


Videl routine by Anders Eriksson from DHS
C2P routine by Mikael Kalms from TBL, Improved by MiKRO
IKBD routine by Patrice Mandin
DSP MP2 Audio Player by Tomas Berndtsson, NoBrain/NoCrew

Falco System (modified) by Orion
Binary file added Consoles_port/Falcon_port/DATA/MUS/auss.mp2
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/MUS/batt.mp2
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/MUS/end.mp2
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/MUS/hero.mp2
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/MUS/inst.mp2
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/MUS/win.mp2
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/bullet.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/end.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/ev60_dsp.prg
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/ev60_nodsp.prg
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/ev_dsp.prg
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/ev_nodsp.prg
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/font.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/go.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/inst.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/l1.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/l2.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/l3.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/l4.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/miss.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/player.gcb
Binary file not shown.
Binary file added Consoles_port/Falcon_port/DATA/title.gcb
Binary file not shown.
3 changes: 3 additions & 0 deletions Consoles_port/Falcon_port/MISC.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
I used ffmpeg to convert the songs to mp2.

ffmpeg -i "auss.ogg" -b:a 128k -codec:a mp2 -ar 32000 auss.mp2
22 changes: 22 additions & 0 deletions Consoles_port/Falcon_port/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CC = vc
DSP = YES
# change compilation / linking flag options
CFLAGS = -cpu=68030 -Os -size -const-in-data -sc -sd -unroll-all -no-intz

# Files to be compiled
SRC = ./src/falcsys.c ./src/graphics.c ./src/main.c ./src/mp2.c ./src/falcsysa_asm.s ./src/itoa.c
ifeq ($(DSP), YES)
SRC += ./src/mp2_asm.s
PRGNAME = ev_dsp.prg
endif

ifeq ($(DSP), NO)
CFLAGS += -DNO_DSP
PRGNAME = ev_nodsp.prg
endif

# Rules to make executable
$(PRGNAME): $(SRC)
$(CC) +tos $(CFLAGS) -o $(PRGNAME) $^
clean:
rm -f $(PRGNAME) *.o
22 changes: 22 additions & 0 deletions Consoles_port/Falcon_port/Makefile.ct60
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CC = vc
DSP = YES
# change compilation / linking flag options
CFLAGS = -cpu=68040 -Os -size -const-in-data -sc -sd -unroll-all -no-intz -D_CT60

# Files to be compiled
SRC = ./src/falcsys.c ./src/graphics.c ./src/main.c ./src/mp2.c ./src/falcsysa_asm.s ./src/itoa.c
ifeq ($(DSP), YES)
SRC += ./src/mp2_asm.s
PRGNAME = ev60_dsp.prg
endif

ifeq ($(DSP), NO)
CFLAGS += -DNO_DSP
PRGNAME = ev60_nodsp.prg
endif

# Rules to make executable
$(PRGNAME): $(SRC)
$(CC) +tos $(CFLAGS) -o $(PRGNAME) $^
clean:
rm -f $(PRGNAME) *.o
39 changes: 39 additions & 0 deletions Consoles_port/Falcon_port/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FalconSystem v5
by Orion_ [2009 - 2013]

Videl routine by Anders Eriksson from DHS
C2P routine by Mikael Kalms from TBL, Improved by MiKRO
IKBD routine by Patrice Mandin
DSP MP2 Audio Player by Tomas Berndtsson, NoBrain/NoCrew


This is a general Demo/Game System Library for the Falcon 030/060.
The library was designed to compile with VBCC.
Download my windows distribution of VBCC here:
http://onorisoft.free.fr/atari/falcon.htm

Features:
-320x240 in 8bits and 16bits mode.
-640x480 in 8bits mode.
-Double Buffering.
-Triple Buffering. (allow faster processing without the need to wait for the VBL)
-CT60 mode (using work screen in FastRam)
-Chunky to Planar automatic conversion (in 8bits and CT60 mode)
-Emulator mode (for CT60 program but without setting 060 cache & superscalar to avoid emulator crash)
-Mouse and Keyboard processing. (custom IKBD routine)
-'Exit on space key' flag.
-Custom VBL user function pointer. (ex: for custom sound mixer)
-An Additionnal MP2 player C wrapper.


Add falcsys.c and falcsysa.s to your compilation command.
Add mp2.c and mp2.s to your compilation command if you use the MP2 player.

There are a bunch of indication on how to use the library in falcsys.h
But to make it easier to understand I made a little demo showing how to use the different parts of the library, see main.c


Tested on a real Falcon 030/CT60, Hatari, and Aranym.
The mouse and keyboard routine won't work on Aranym. (?)

Any bug report or improving appreciated :)
27 changes: 27 additions & 0 deletions Consoles_port/Falcon_port/src/dma.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @file src/audio/dsp.h DSP definitions. */

#ifndef DMA_H
#define DMA_H

typedef struct tagS
{
unsigned char* data;
unsigned long size;
} SOUND;


/* STE/TT/Falcon DMA Sound is able to play at :
* 50066Hz 25033Hz 12517Hz 6258Hz
* (6258Hz is not available on falcon) */
#define DMASOUND_FREQ 12517
#define DMASOUND_BUFFER_SIZE 64*1024

#define Sound_Play(x,b) DMA_Play(x,b)
extern void Sound_Load(const unsigned char* path, SOUND* s);
extern void DMA_Play(const unsigned char *data, const unsigned long size);
extern void DMA_Stop(void);
extern unsigned char DMA_GetStatus(void);
extern bool DMA_Init(void);
extern void DMA_Uninit(void);

#endif /* DMA_H */
74 changes: 74 additions & 0 deletions Consoles_port/Falcon_port/src/dma_atari.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/** @file src/audio/dsp_atari.c Atari DMA Sound implementation of the DSP. */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <tos.h>
#include "types.h"
#include "dsp.h"

extern void set_dma_sound(void * buffer, unsigned int len);
extern void stop_dma_sound(void); /* needs to be called in supervisor mode */
extern unsigned int get_dma_status(void); /* needs to be called in supervisor mode */

static unsigned char *s_stRamBuffer;
static unsigned int s_stRamBufferSize;

void Sound_Load(const unsigned char* path, SOUND* s)
{
FILE* fp;
fp = fopen(path, "rb");
fseek(fp, 0L, SEEK_END);
s->size = ftell(fp);
fseek(fp, 0L, SEEK_SET);
s->data = (unsigned char *)Mxalloc(s->size, MX_STRAM);
fread(s->data, 1, s->size, fp);
fclose(fp);
}

void Sound_free(SOUND s)
{
if (s.data != NULL) Mfree(s.data);
}

void DMA_Stop(void)
{
Supexec(stop_dma_sound);
}

void DMA_Uninit(void)
{
DMA_Stop();
if (s_stRamBuffer != NULL) {
Mfree(s_stRamBuffer);
s_stRamBuffer = NULL;
}
s_stRamBufferSize = 0;
}

bool DMA_Init(void)
{
/* allocate ST RAM buffer for audio */
s_stRamBufferSize = DMASOUND_BUFFER_SIZE;
s_stRamBuffer = (unsigned char *)Mxalloc(s_stRamBufferSize, MX_STRAM);
if(s_stRamBuffer == NULL) {
printf("Failed to allocate %u bytes of ST RAM for DMA sound.\n", s_stRamBufferSize);
s_stRamBufferSize = 0;
return false;
}
return true;
}

void DMA_Play(const unsigned char *data, const unsigned long size)
{
set_dma_sound(data, size);
}

/**
* Should return 2 if playing sound, 0 if not
*/
unsigned char DMA_GetStatus(void)
{
unsigned char status = (unsigned char)Supexec(get_dma_status);
return (status != 0) ? 2 : 0;
}
Loading

0 comments on commit 7ab9db5

Please sign in to comment.