github publish

This commit is contained in:
Ondrej Novak 2025-01-24 18:27:22 +01:00
commit 506e23bf32
542 changed files with 120675 additions and 0 deletions

View file

@ -0,0 +1,71 @@
/*********************************************/
/*** DOS memory allocation - DOSMEM.C ***/
/*** vykostena verze chlumakova memalloc.c ***/
/*********************************************/
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dosmem.h"
/*** Alokace pole v dolni pameti ***/
void *mem_alloc(int size)
{
static union REGS r;
MEMREC memrec;
r.x.eax=0x0100;
r.x.ebx=(size>>4)+1;
size=r.x.ebx<<4;
int386(0x31,&r,&r);
if (r.x.cflag)
{
printf ("No fucking DOS memory left!!!");
exit(1);
}
memrec.ptr=(void *)((r.x.eax&0xFFFF)<<4);
Selector=memrec.selector=(short int)r.x.edx;
return memrec.ptr;
}
/*** Uvolneni dolni pameti ***/
void mem_free(void *ptr)
{
union REGS r;
if(ptr!=NULL)
{
r.x.eax=0x0101;
r.x.edx=Selector;
int386(0x31,&r,&r);
if(r.x.cflag)
printf("Cannot free DOS memory!!!!");
}
}
/*** Vyvolani preruseni pomoci protected modu ***/
void WtNs386(int IntNum, DPMIREGS *dpmiregs)
{
union REGS r;
struct SREGS sr;
r.w.ax=0x300;
r.h.bl=(char)IntNum;
r.h.bh=0;
r.w.cx=0;
segread(&sr);
sr.es=FP_SEG(dpmiregs);
r.x.edi=FP_OFF(dpmiregs);
int386x(0x31,&r,&r,&sr);
}

View file

@ -0,0 +1,46 @@
/************************************/
/*** Hlavickovt soubor k DOSMEM.H ***/
/************************************/
typedef enum
{ DOS_MEMORY,
NEW,
} MEMORY_ITEMS;
typedef struct
{ int EDI;
int ESI;
int EBP;
int reserved;
int EBX;
int EDX;
int ECX;
int EAX;
short int Flags;
short int ES;
short int DS;
short int GS;
short int IP;
short int CS;
short int SP;
short int SS;
} DPMIREGS;
typedef struct
{ void *ptr;
int size;
int selector; //smysl jen u DOS_MEMORY
} MEMREC;
#define D32RealSeg(P) ((((unsigned int)(P))>>4)&0xFFFF)
#define D32RealOff(P) (((unsigned int)(P))&0xF)
int Selector;
DPMIREGS dpmiregs;
void *mem_alloc(int size);
void mem_free(void *ptr);
void WtNs386(int IntNum, DPMIREGS *dpmiregs);

5
VIDEO/FLC/ANALYSE/FLC.C Normal file
View file

@ -0,0 +1,5 @@
//
// Knihovna pro dekompresi FLC souboru
//
#include "flc.h"

54
VIDEO/FLC/ANALYSE/FLC.H Normal file
View file

@ -0,0 +1,54 @@
//
// Hlavickovy soubor ke knihovne FLC.C slouzici k dekompresi FLC
//
#ifndef _FLC_H
#define _FLC_H
typedef struct FLCHEADER {
unsigned int size; // delka souboru vcetne hlavicky
unsigned short idflc; // ID FLC=0AF12h
unsigned short frames; // pocet frejmu
unsigned short width; // sirka vsech obrazku
unsigned short height; // vyska vsech obrazku
unsigned short color; // hloubka barvy (bpp)
unsigned short flag1;
unsigned int speed; // rychlost prehravani (v 1/1000 s)
unsigned short reserv1; // rezervovany
unsigned int date1; // datum a cas vytvoreni
unsigned int serial; // seriove cislo programu
unsigned int date2; // datum a cas posledni zmeny
unsigned short XA;
unsigned short YA;
char reserv2 [42]; // rezervovano
unsigned int offset1; // offset prvniho frame
unsigned int offset2; // offset druheho frame
char reserv3 [40]; // rezervovano
} flcheader;
typedef struct FRAMEHEADER {
unsigned int size; // velikost frame v bytech
unsigned short sign; // znacka frame OFAF1h
unsigned short actions; // pocet akci v tomto frame
char reserv [8]; // rezervovano
} frameheader;
typedef struct ACTIONHEADER {
unsigned int size; // velikost akce v bytech
unsigned short code; // kod akce
// 04h - predani casti nebo cele palety
// 07h - predavani zmenenych casti obrazu
// 0Dh - vymaze obrazovku
// 0Fh - cela obrazovka v RLE
// 10h - nekomprimovana kopie cele obrazovky
// nasleduji data akce
} actionheader;
char frame_buffer [307200];
char *flc_buffer;
void Get_first_frame (void);
void Get_next_frame (void);
void Decompress_frame (void);
#endif

54
VIDEO/FLC/ANALYSE/PLAY.C Normal file
View file

@ -0,0 +1,54 @@
#include <stdio.h>
#include <conio.h>
#include <graph.h>
#include "flc.h"
flcheader h_flc;
frameheader h_frame;
actionheader h_action;
void main (int argc, char *argv[])
{
FILE *flc;
long pozice;
int frames, actions, x, y;
flc = fopen (argv[1], "rb");
fread (&h_flc, sizeof(flcheader), 1, flc);
frames=h_flc.frames;
printf ("\nHlavicka FLC souboru %s:\n", argv[1]);
printf ("Delka celeho souboru: %d\n", h_flc.size);
printf ("Pocet frame: %d\n", h_flc.frames);
printf ("Velikost filmu: %dx%d\n", h_flc.width, h_flc.height);
printf ("Hloubka barvy: %d\n", h_flc.color);
printf ("Rychlost prehravani: %d fps\n", 1000/h_flc.speed);
printf ("Offset prvniho frame: %d\n", h_flc.offset1);
fseek (flc, h_flc.offset1, SEEK_SET);
for (x=0; x<=(frames-1); x++)
{
fread (&h_frame, sizeof(frameheader), 1, flc);
actions=h_frame.actions;
printf ("\nHlavicka %d framu:\n", x+1);
printf ("Velikost framu: %d\n", h_frame.size);
printf ("Pocet akci ve framu: %d\n", h_frame.actions);
for (y=0; y<=(actions-1); y++)
{
pozice = ftell (flc);
fread (&h_action, sizeof(actionheader), 1, flc);
fseek (flc, (pozice+h_action.size), SEEK_SET);
printf ("\nHlavicka %d akce:\n", y+1);
printf ("Velikost dat pro tuto akci: %d\n", h_action.size);
printf ("Kod akce: %x\n", h_action.code);
}
getch ();
_clearscreen (_GCLEARSCREEN);
}
fclose (flc);
}

296
VIDEO/FLC/ANALYSE/VESA.C Normal file
View file

@ -0,0 +1,296 @@
/********************************/
/* Prace se SVGA VESA adapterem */
/********************************/
#include <dos.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "vesa.h"
#include "dosmem.h"
extern void wm_ChangeBank_(int bank);
#pragma aux (ASM) wm_ChangeBank_;
void Set_VESA_mode (int mode)
{
union REGS r;
r.w.ax=0x4f02;
r.w.bx=mode;
int386 (0x10, &r, &r);
}
void Show_screen (char *display)
{
wm_ChangeBank_ (0);
memmove (0xa0000, display, 65536);
wm_ChangeBank_ (1);
memmove (0xa0000, (display+65536), 65536);
wm_ChangeBank_ (2);
memmove (0xa0000, (display+131072), 65536);
wm_ChangeBank_ (3);
memmove (0xa0000, (display+196608), 65536);
wm_ChangeBank_ (4);
memmove (0xa0000, (display+262144), 45056);
}
void Put_image (int x, int y, int xlen, int ylen, char *image)
{
int a,b,c,d;
long int posunuti=0;
int banka;
if (y<103) {wm_ChangeBank_ (0); banka=0;}
if (y>103 && y<205) {wm_ChangeBank_ (1); banka=1;}
if (y>205 && y<308) {wm_ChangeBank_ (2); banka=2;}
if (y>308 && y<410) {wm_ChangeBank_ (3); banka=3;}
if (y>410) {wm_ChangeBank_ (4); banka=4;}
for (a=0; a<=ylen; a++)
{
d=y+a;
switch (d)
{
case 102:
if ((x+xlen)<256){
posunuti=(y+a)*640+x;
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (1); banka=1;}
if (x>=256){
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
}
if (x<256 && (x+xlen)>256){
posunuti=(y+a)*640+x; b=x; c=0;
while (b!=256)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
case 204:
if ((x+xlen)<512){
posunuti=(((y+a)*640+x)-65536);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (2); banka=2;}
if (x>=512){
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);}
if (x<512 && (x+xlen)>512){
posunuti=(((y+a)*640+x)-65536); b=x; c=0;
while (b!=512)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
case 307:
if ((x+xlen)<128){
posunuti=(((y+a)*640+x)-131072);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (3); banka=3;}
if (x>=128){
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);}
if (x<128 && (x+xlen)>128){
posunuti=(((y+a)*640+x)-131072); b=x; c=0;
while (b!=128)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
case 409:
if ((x+xlen)<384){
posunuti=(((y+a)*640+x)-196608);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (4); banka=4;}
if (x>=384){
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);}
if (x<384 && (x+xlen)>384){
posunuti=(((y+a)*640+x)-196608); b=x; c=0;
while (b!=384)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
default:
posunuti=(y+a)*640+x-banka*65536;
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
break;
};
}
}
void Get_image (int x, int y, int xlen, int ylen, char *image)
{
int a,b,c,d;
long int posunuti=0;
int banka;
if (y<103) {wm_ChangeBank_ (0); banka=0;}
if (y>103 && y<205) {wm_ChangeBank_ (1); banka=1;}
if (y>205 && y<308) {wm_ChangeBank_ (2); banka=2;}
if (y>308 && y<410) {wm_ChangeBank_ (3); banka=3;}
if (y>410) {wm_ChangeBank_ (4); banka=4;}
for (a=0; a<=ylen; a++)
{
d=y+a;
switch (d)
{
case 102:
if ((x+xlen)<256){
posunuti=(y+a)*640+x;
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (1); banka=1;}
if (x>=256){
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
}
if (x<256 && (x+xlen)>256){
posunuti=(y+a)*640+x; b=x; c=0;
while (b!=256)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
case 204:
if ((x+xlen)<512){
posunuti=(((y+a)*640+x)-65536);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (2); banka=2;}
if (x>=512){
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);}
if (x<512 && (x+xlen)>512){
posunuti=(((y+a)*640+x)-65536); b=x; c=0;
while (b!=512)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
case 307:
if ((x+xlen)<128){
posunuti=(((y+a)*640+x)-131072);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (3); banka=3;}
if (x>=128){
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);}
if (x<128 && (x+xlen)>128){
posunuti=(((y+a)*640+x)-131072); b=x; c=0;
while (b!=128)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
case 409:
if ((x+xlen)<384){
posunuti=(((y+a)*640+x)-196608);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (4); banka=4;}
if (x>=384){
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);}
if (x<384 && (x+xlen)>384){
posunuti=(((y+a)*640+x)-196608); b=x; c=0;
while (b!=384)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
default:
posunuti=(y+a)*640+x-banka*65536;
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
break;
};
}
}
void Get_VESA_info (void)
{
char far *str;
VESA_INFO_BLOCK *p;
p=(VESA_INFO_BLOCK *)mem_alloc(sizeof(VESA_INFO_BLOCK));
memset(&dpmiregs,0,sizeof(DPMIREGS));
dpmiregs.EAX=0x00004f00;
dpmiregs.DS=D32RealSeg(p);
dpmiregs.ES=D32RealSeg(p);
dpmiregs.EDI=D32RealOff(p);
WtNs386(0x10,&dpmiregs);
str=(char far *)MK_FP(Selector,0);
_fmemcpy(&VesaInfoBlock,str,sizeof(VESA_INFO_BLOCK));
mem_free(p);
if(dpmiregs.EAX!=0x4f)
{
printf ("VESA Bios extension not found!!!!");
exit (1);
}
}
void Get_mode_info (int mode)
{
char far *str;
VESA_MODE_INFO_BLOCK *p;
p=(VESA_MODE_INFO_BLOCK *)mem_alloc(sizeof(VESA_MODE_INFO_BLOCK));
memset(&dpmiregs,0,sizeof(DPMIREGS)); //nuluje registry
dpmiregs.EAX=0x00004f01;
dpmiregs.DS=D32RealSeg(p);
dpmiregs.ES=D32RealSeg(p);
dpmiregs.EDI=D32RealOff(p);
dpmiregs.ECX=mode;
WtNs386(0x10,&dpmiregs);
str=(char far *)MK_FP(Selector,0);
_fmemcpy(&VesaModeInfoBlock,str,sizeof(VESA_INFO_BLOCK));
_VGAGran=VesaModeInfoBlock.WinGranularity;
mem_free(p);
}

70
VIDEO/FLC/ANALYSE/VESA.H Normal file
View file

@ -0,0 +1,70 @@
/********************************/
/* Prace se SVGA VESA adapterem */
/********************************/
#ifndef __VESA_H
#define __VESA_H
typedef struct
{ char VESASignature[4];
short VESAversion;
unsigned OEMStringPtr;
char capabilities[4];
short int *videomodeptr;
short int TotalMemory;
char dummy[236];
} VESA_INFO_BLOCK;
typedef struct
{ short unsigned ModeAttributes;
char WinAAttributes;
char WinBAttributes;
short unsigned WinGranularity;
short unsigned WinSize;
short unsigned WinASegment;
short unsigned WinBSegment;
short unsigned WinFuncPtroff;
short unsigned WinFuncPtrseg;
short unsigned BytesPerScanLine;
short unsigned XResolution;
short unsigned YResolution;
char Xcharsize;
char Ycharsize;
char NumberOfPlanes;
char BitsPerPixel;
char NumberOfBanks;
char MemoryModel;
char BankSize;
char NumberOfImagePages;
char Reserved;
char RedMaskSize;
char RedFieldPosition;
char GreenMaskSize;
char GreenFieldPosition;
char BlueMaskSize;
char BlueFieldPosition;
char RsvdMaskSize;
char DirectColorModeInfo;
char Dummy[216];
} VESA_MODE_INFO_BLOCK;
VESA_MODE_INFO_BLOCK VesaModeInfoBlock;
VESA_INFO_BLOCK VesaInfoBlock;
extern unsigned char _VGAPage=0;
extern unsigned char _VGAGran=0;
void Set_VESA_mode (int mode);
void Show_screen (char *display);
void Get_VESA_info (void);
void Get_mode_info (int mode);
void Put_image (int x, int y, int xlen, int ylen, char *image);
void Get_image (int x, int y, int xlen, int ylen, char *image);
#endif

View file

@ -0,0 +1,63 @@
;EAX EDX EBX ECX
.386p
jumps
;############################################################################
; Constanty
;############################################################################
dlt_x equ 640
dlt_y equ 480
;############################################################################
; Datovy segment
;############################################################################
_DATA SEGMENT PARA PUBLIC USE32 'DATA'
align 4
EXTRN __VGAPage:BYTE
EXTRN __VGAGran:BYTE
_DATA ENDS
DGROUP GROUP _DATA
;############################################################################
; Kodovy segment
;############################################################################
_TEXT SEGMENT PARA PUBLIC USE32 'CODE'
ASSUME cs:_TEXT, ds:_DATA
public wm_ChangeBank__
wm_ChangeBank__ PROC
push es
pushad
push eax
mov edx, eax
mov ebx, 0000h
mov eax, 4f05h
int 10h
pop eax
mov edx, eax
mov ebx, 0001h
mov eax, 4f05h
int 10h
popad
pop es
ret
wm_ChangeBank__ endp
;----------------------------------------------------------------------------
_TEXT ENDS
END

71
VIDEO/FLC/DOSMEM.C Normal file
View file

@ -0,0 +1,71 @@
/*********************************************/
/*** DOS memory allocation - DOSMEM.C ***/
/*** vykostena verze chlumakova memalloc.c ***/
/*********************************************/
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dosmem.h"
/*** Alokace pole v dolni pameti ***/
void *mem_alloc(int size)
{
static union REGS r;
MEMREC memrec;
r.x.eax=0x0100;
r.x.ebx=(size>>4)+1;
size=r.x.ebx<<4;
int386(0x31,&r,&r);
if (r.x.cflag)
{
printf ("No fucking DOS memory left!!!");
exit(1);
}
memrec.ptr=(void *)((r.x.eax&0xFFFF)<<4);
Selector=memrec.selector=(short int)r.x.edx;
return memrec.ptr;
}
/*** Uvolneni dolni pameti ***/
void mem_free(void *ptr)
{
union REGS r;
if(ptr!=NULL)
{
r.x.eax=0x0101;
r.x.edx=Selector;
int386(0x31,&r,&r);
if(r.x.cflag)
printf("Cannot free DOS memory!!!!");
}
}
/*** Vyvolani preruseni pomoci protected modu ***/
void WtNs386(int IntNum, DPMIREGS *dpmiregs)
{
union REGS r;
struct SREGS sr;
r.w.ax=0x300;
r.h.bl=(char)IntNum;
r.h.bh=0;
r.w.cx=0;
segread(&sr);
sr.es=FP_SEG(dpmiregs);
r.x.edi=FP_OFF(dpmiregs);
int386x(0x31,&r,&r,&sr);
}

46
VIDEO/FLC/DOSMEM.H Normal file
View file

@ -0,0 +1,46 @@
/************************************/
/*** Hlavickovt soubor k DOSMEM.H ***/
/************************************/
typedef enum
{ DOS_MEMORY,
NEW,
} MEMORY_ITEMS;
typedef struct
{ int EDI;
int ESI;
int EBP;
int reserved;
int EBX;
int EDX;
int ECX;
int EAX;
short int Flags;
short int ES;
short int DS;
short int GS;
short int IP;
short int CS;
short int SP;
short int SS;
} DPMIREGS;
typedef struct
{ void *ptr;
int size;
int selector; //smysl jen u DOS_MEMORY
} MEMREC;
#define D32RealSeg(P) ((((unsigned int)(P))>>4)&0xFFFF)
#define D32RealOff(P) (((unsigned int)(P))&0xF)
int Selector;
DPMIREGS dpmiregs;
void *mem_alloc(int size);
void mem_free(void *ptr);
void WtNs386(int IntNum, DPMIREGS *dpmiregs);

176
VIDEO/FLC/FLC.C Normal file
View file

@ -0,0 +1,176 @@
//
// Knihovna pro dekompresi FLC souboru
//
#include <stdio.h>
#include <conio.h>
#include <malloc.h>
#include <string.h>
#include <i86.h>
#include "flc.h"
void Open_FLC (char *filename)
{
flc = fopen (filename, "rb");
fread (&h_flc, sizeof(flcheader), 1, flc);
}
void Close_FLC (void)
{
fclose (flc);
free (flc_buffer);
}
void Get_first_frame (void)
{
fseek (flc, h_flc.offset1, SEEK_SET);
fread (&h_frame, sizeof(frameheader), 1, flc);
flc_buffer = (char*)malloc((h_frame.size-sizeof(frameheader)));
fread (flc_buffer, (h_frame.size-sizeof(frameheader)), 1, flc);
}
void Get_next_frame (void)
{
free (flc_buffer);
fread (&h_frame, sizeof(frameheader), 1, flc);
flc_buffer = (char*)malloc((h_frame.size-sizeof(frameheader)));
fread (flc_buffer, (h_frame.size-sizeof(frameheader)), 1, flc);
}
void Decompress_frame (void)
{
unsigned short x,y,z,w;
unsigned short changes, nfo_word, packets, offset, row;
int frame_pos=0;
unsigned int scr_pos;
char c1, c2, c3, a;
char hi, lo;
for (z=1; z<=h_frame.actions; z++)
{
memmove ( &h_action, (flc_buffer+frame_pos), sizeof(actionheader) );
switch (h_action.code)
{
case 4:
a=1;//fcl_buffer[frame_pos];
// b=0;//flc_buffer[frame_pos];
// c=256; //0=256
frame_pos+=10;
outp (0x3c8, 0);
for (x=0; x<=768; x++) outp (0x3c9, (flc_buffer[(x+frame_pos)]/=4) );
frame_pos+=768;
break;
case 7:
frame_pos+=6;
lo=flc_buffer[frame_pos]; frame_pos++;
hi=flc_buffer[frame_pos]; frame_pos++;
changes=hi*256+lo;
row=0;
for (y=0; y<=(changes-1); y++) // pocet menenych radek
{
lo=flc_buffer[frame_pos]; frame_pos++;
hi=flc_buffer[frame_pos]; frame_pos++;
nfo_word=hi*256+lo;
scr_pos=row*h_flc.width;
if (nfo_word>=0xC000) // preskakovane radky
{
nfo_word=0xFFFF-nfo_word+1;
row+=nfo_word;
}
else
{
for (z=1; z<=nfo_word; z++) // pocet menenych bloku
{
x=1; a=0;
offset = flc_buffer[frame_pos]; // rel. offset bloku
frame_pos++;
scr_pos+=offset;
// while (!a) // zmena bloku
// {
c1 = flc_buffer[frame_pos];
frame_pos++;
if (c1>128)
{
c1=0xFF-c1+1;
c2=flc_buffer[frame_pos];
frame_pos++;
c3=flc_buffer[frame_pos];
frame_pos++;
for (w=1; w<=c1; w++)
{ frame_buffer[scr_pos]=c2;
scr_pos++;
frame_buffer[scr_pos]=c3;
scr_pos++; }
}
else
{
// c3=0xFF-c3+1;
for (w=1; w<=c1; w++)
{ frame_buffer[scr_pos]=flc_buffer[frame_pos];
frame_pos++;
scr_pos++;
frame_buffer[scr_pos]=flc_buffer[frame_pos];
frame_pos++;
scr_pos++; }
}
// if (x>=640) a=1;
// }
}
row++;
}
}
// frame_pos+=h_action.size;
break;
case 15:
frame_pos+=6;
for (y=0; y<=(h_flc.height-1); y++)
{
frame_pos++; x=1; //a=0;
scr_pos=y*h_flc.width;
while (x<=h_flc.width)
{
c1 = flc_buffer[frame_pos];
frame_pos++;
if (c1<128)
{
c2=flc_buffer[frame_pos];
frame_pos++;
for (w=1; w<=c1; w++)
{ frame_buffer[scr_pos]=c2;
scr_pos++;
x++; }
}
else
{
c1=0xFF-c1+1;
for (w=1; w<=c1; w++)
{ frame_buffer[scr_pos]=flc_buffer[frame_pos];
scr_pos++;
frame_pos++;
x++; }
}
}
}
break;
default: frame_pos+=h_action.size;
break;
};
}
}

61
VIDEO/FLC/FLC.H Normal file
View file

@ -0,0 +1,61 @@
//
// Hlavickovy soubor ke knihovne FLC.C slouzici k dekompresi FLC
//
#ifndef _FLC_H
#define _FLC_H
typedef struct FLCHEADER {
unsigned int size; // delka souboru vcetne hlavicky
unsigned short idflc; // ID FLC=0AF12h
unsigned short frames; // pocet frejmu
unsigned short width; // sirka vsech obrazku
unsigned short height; // vyska vsech obrazku
unsigned short color; // hloubka barvy (bpp)
unsigned short flag1;
unsigned int speed; // rychlost prehravani (v 1/1000 s)
unsigned short reserv1; // rezervovany
unsigned int date1; // datum a cas vytvoreni
unsigned int serial; // seriove cislo programu
unsigned int date2; // datum a cas posledni zmeny
unsigned short XA;
unsigned short YA;
char reserv2 [42]; // rezervovano
unsigned int offset1; // offset prvniho frame
unsigned int offset2; // offset druheho frame
char reserv3 [40]; // rezervovano
} flcheader;
typedef struct FRAMEHEADER {
unsigned int size; // velikost frame v bytech
unsigned short sign; // znacka frame OFAF1h
unsigned short actions; // pocet akci v tomto frame
char reserv [8]; // rezervovano
} frameheader;
typedef struct ACTIONHEADER {
unsigned int size; // velikost akce v bytech
unsigned short code; // kod akce
// 04h - predani casti nebo cele palety
// 07h - predavani zmenenych casti obrazu
// 0Dh - vymaze obrazovku
// 0Fh - cela obrazovka v RLE
// 10h - nekomprimovana kopie cele obrazovky
// nasleduji data akce
} actionheader;
FILE *flc;
flcheader h_flc;
frameheader h_frame;
actionheader h_action;
char frame_buffer [307205];
char *flc_buffer;
//unsigned int ladici;
void Open_FLC (char *filename);
void Close_FLC (void);
void Get_first_frame (void);
void Get_next_frame (void);
void Decompress_frame (void);
#endif

54
VIDEO/FLC/PLAY.C Normal file
View file

@ -0,0 +1,54 @@
#include <stdio.h>
#include <conio.h>
#include <graph.h>
#include <dos.h>
#include "flc.h"
#include "vesa.h"
void Set_TEXT_mode (void);
void main (int argc, char *argv[])
{
int x;
Open_FLC (argv[1]);
printf ("\nHlavicka FLC souboru %s:\n", argv[1]);
printf ("Delka celeho souboru: %d\n", h_flc.size);
printf ("Pocet frame: %d\n", h_flc.frames);
printf ("Velikost filmu: %dx%d\n", h_flc.width, h_flc.height);
printf ("Hloubka barvy: %d\n", h_flc.color);
// printf ("Rychlost prehravani: %d fps\n", 1000/h_flc.speed);
printf ("Offset prvniho frame: %d\n", h_flc.offset1);
getch ();
Set_VESA_mode (0x101);
delay (1000);
Get_first_frame ();
Decompress_frame ();
Show_screen (frame_buffer);
for (x=2; x<=h_flc.frames; x++)
{
Get_next_frame ();
Decompress_frame ();
Show_screen (frame_buffer);
delay (7);
}
getch ();
Set_TEXT_mode ();
Close_FLC ();
}
void Set_TEXT_mode (void)
{
union REGS inr, outr;
inr.h.ah = 0x00;
inr.h.al = 03;
int386 (0x10, &inr, &outr);
}

296
VIDEO/FLC/VESA.C Normal file
View file

@ -0,0 +1,296 @@
/********************************/
/* Prace se SVGA VESA adapterem */
/********************************/
#include <dos.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "vesa.h"
#include "dosmem.h"
extern void wm_ChangeBank_(int bank);
#pragma aux (ASM) wm_ChangeBank_;
void Set_VESA_mode (int mode)
{
union REGS r;
r.w.ax=0x4f02;
r.w.bx=mode;
int386 (0x10, &r, &r);
}
void Show_screen (char *display)
{
wm_ChangeBank_ (0);
memmove (0xa0000, display, 65536);
wm_ChangeBank_ (1);
memmove (0xa0000, (display+65536), 65536);
wm_ChangeBank_ (2);
memmove (0xa0000, (display+131072), 65536);
wm_ChangeBank_ (3);
memmove (0xa0000, (display+196608), 65536);
wm_ChangeBank_ (4);
memmove (0xa0000, (display+262144), 45056);
}
void Put_image (int x, int y, int xlen, int ylen, char *image)
{
int a,b,c,d;
long int posunuti=0;
int banka;
if (y<103) {wm_ChangeBank_ (0); banka=0;}
if (y>103 && y<205) {wm_ChangeBank_ (1); banka=1;}
if (y>205 && y<308) {wm_ChangeBank_ (2); banka=2;}
if (y>308 && y<410) {wm_ChangeBank_ (3); banka=3;}
if (y>410) {wm_ChangeBank_ (4); banka=4;}
for (a=0; a<=ylen; a++)
{
d=y+a;
switch (d)
{
case 102:
if ((x+xlen)<256){
posunuti=(y+a)*640+x;
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (1); banka=1;}
if (x>=256){
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
}
if (x<256 && (x+xlen)>256){
posunuti=(y+a)*640+x; b=x; c=0;
while (b!=256)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
case 204:
if ((x+xlen)<512){
posunuti=(((y+a)*640+x)-65536);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (2); banka=2;}
if (x>=512){
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);}
if (x<512 && (x+xlen)>512){
posunuti=(((y+a)*640+x)-65536); b=x; c=0;
while (b!=512)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
case 307:
if ((x+xlen)<128){
posunuti=(((y+a)*640+x)-131072);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (3); banka=3;}
if (x>=128){
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);}
if (x<128 && (x+xlen)>128){
posunuti=(((y+a)*640+x)-131072); b=x; c=0;
while (b!=128)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
case 409:
if ((x+xlen)<384){
posunuti=(((y+a)*640+x)-196608);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
wm_ChangeBank_ (4); banka=4;}
if (x>=384){
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);}
if (x<384 && (x+xlen)>384){
posunuti=(((y+a)*640+x)-196608); b=x; c=0;
while (b!=384)
{memmove ((0xa0000+posunuti), (image+a*(xlen+1)+c), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((0xa0000+posunuti+c), (image+a*(xlen+1)+c), (xlen-c));}
break;
default:
posunuti=(y+a)*640+x-banka*65536;
memmove ((0xa0000+posunuti), (image+a*(xlen+1)), xlen);
break;
};
}
}
void Get_image (int x, int y, int xlen, int ylen, char *image)
{
int a,b,c,d;
long int posunuti=0;
int banka;
if (y<103) {wm_ChangeBank_ (0); banka=0;}
if (y>103 && y<205) {wm_ChangeBank_ (1); banka=1;}
if (y>205 && y<308) {wm_ChangeBank_ (2); banka=2;}
if (y>308 && y<410) {wm_ChangeBank_ (3); banka=3;}
if (y>410) {wm_ChangeBank_ (4); banka=4;}
for (a=0; a<=ylen; a++)
{
d=y+a;
switch (d)
{
case 102:
if ((x+xlen)<256){
posunuti=(y+a)*640+x;
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (1); banka=1;}
if (x>=256){
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
}
if (x<256 && (x+xlen)>256){
posunuti=(y+a)*640+x; b=x; c=0;
while (b!=256)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (1); banka=1;
posunuti=(((y+a)*640+x)-65536);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
case 204:
if ((x+xlen)<512){
posunuti=(((y+a)*640+x)-65536);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (2); banka=2;}
if (x>=512){
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);}
if (x<512 && (x+xlen)>512){
posunuti=(((y+a)*640+x)-65536); b=x; c=0;
while (b!=512)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (2); banka=2;
posunuti=(((y+a)*640+x)-131072);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
case 307:
if ((x+xlen)<128){
posunuti=(((y+a)*640+x)-131072);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (3); banka=3;}
if (x>=128){
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);}
if (x<128 && (x+xlen)>128){
posunuti=(((y+a)*640+x)-131072); b=x; c=0;
while (b!=128)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (3); banka=3;
posunuti=(((y+a)*640+x)-196608);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
case 409:
if ((x+xlen)<384){
posunuti=(((y+a)*640+x)-196608);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
wm_ChangeBank_ (4); banka=4;}
if (x>=384){
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);}
if (x<384 && (x+xlen)>384){
posunuti=(((y+a)*640+x)-196608); b=x; c=0;
while (b!=384)
{memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti), 1);
posunuti++; b++; c++;}
wm_ChangeBank_ (4); banka=4;
posunuti=(((y+a)*640+x)-262144);
memmove ((image+a*(xlen+1)+c), (0xa0000+posunuti+c), (xlen-c));}
break;
default:
posunuti=(y+a)*640+x-banka*65536;
memmove ((image+a*(xlen+1)), (0xa0000+posunuti), xlen);
break;
};
}
}
void Get_VESA_info (void)
{
char far *str;
VESA_INFO_BLOCK *p;
p=(VESA_INFO_BLOCK *)mem_alloc(sizeof(VESA_INFO_BLOCK));
memset(&dpmiregs,0,sizeof(DPMIREGS));
dpmiregs.EAX=0x00004f00;
dpmiregs.DS=D32RealSeg(p);
dpmiregs.ES=D32RealSeg(p);
dpmiregs.EDI=D32RealOff(p);
WtNs386(0x10,&dpmiregs);
str=(char far *)MK_FP(Selector,0);
_fmemcpy(&VesaInfoBlock,str,sizeof(VESA_INFO_BLOCK));
mem_free(p);
if(dpmiregs.EAX!=0x4f)
{
printf ("VESA Bios extension not found!!!!");
exit (1);
}
}
void Get_mode_info (int mode)
{
char far *str;
VESA_MODE_INFO_BLOCK *p;
p=(VESA_MODE_INFO_BLOCK *)mem_alloc(sizeof(VESA_MODE_INFO_BLOCK));
memset(&dpmiregs,0,sizeof(DPMIREGS)); //nuluje registry
dpmiregs.EAX=0x00004f01;
dpmiregs.DS=D32RealSeg(p);
dpmiregs.ES=D32RealSeg(p);
dpmiregs.EDI=D32RealOff(p);
dpmiregs.ECX=mode;
WtNs386(0x10,&dpmiregs);
str=(char far *)MK_FP(Selector,0);
_fmemcpy(&VesaModeInfoBlock,str,sizeof(VESA_INFO_BLOCK));
_VGAGran=VesaModeInfoBlock.WinGranularity;
mem_free(p);
}

70
VIDEO/FLC/VESA.H Normal file
View file

@ -0,0 +1,70 @@
/********************************/
/* Prace se SVGA VESA adapterem */
/********************************/
#ifndef __VESA_H
#define __VESA_H
typedef struct
{ char VESASignature[4];
short VESAversion;
unsigned OEMStringPtr;
char capabilities[4];
short int *videomodeptr;
short int TotalMemory;
char dummy[236];
} VESA_INFO_BLOCK;
typedef struct
{ short unsigned ModeAttributes;
char WinAAttributes;
char WinBAttributes;
short unsigned WinGranularity;
short unsigned WinSize;
short unsigned WinASegment;
short unsigned WinBSegment;
short unsigned WinFuncPtroff;
short unsigned WinFuncPtrseg;
short unsigned BytesPerScanLine;
short unsigned XResolution;
short unsigned YResolution;
char Xcharsize;
char Ycharsize;
char NumberOfPlanes;
char BitsPerPixel;
char NumberOfBanks;
char MemoryModel;
char BankSize;
char NumberOfImagePages;
char Reserved;
char RedMaskSize;
char RedFieldPosition;
char GreenMaskSize;
char GreenFieldPosition;
char BlueMaskSize;
char BlueFieldPosition;
char RsvdMaskSize;
char DirectColorModeInfo;
char Dummy[216];
} VESA_MODE_INFO_BLOCK;
VESA_MODE_INFO_BLOCK VesaModeInfoBlock;
VESA_INFO_BLOCK VesaInfoBlock;
extern unsigned char _VGAPage=0;
extern unsigned char _VGAGran=0;
void Set_VESA_mode (int mode);
void Show_screen (char *display);
void Get_VESA_info (void);
void Get_mode_info (int mode);
void Put_image (int x, int y, int xlen, int ylen, char *image);
void Get_image (int x, int y, int xlen, int ylen, char *image);
#endif

63
VIDEO/FLC/VESA_.ASM Normal file
View file

@ -0,0 +1,63 @@
;EAX EDX EBX ECX
.386p
jumps
;############################################################################
; Constanty
;############################################################################
dlt_x equ 640
dlt_y equ 480
;############################################################################
; Datovy segment
;############################################################################
_DATA SEGMENT PARA PUBLIC USE32 'DATA'
align 4
EXTRN __VGAPage:BYTE
EXTRN __VGAGran:BYTE
_DATA ENDS
DGROUP GROUP _DATA
;############################################################################
; Kodovy segment
;############################################################################
_TEXT SEGMENT PARA PUBLIC USE32 'CODE'
ASSUME cs:_TEXT, ds:_DATA
public wm_ChangeBank__
wm_ChangeBank__ PROC
push es
pushad
push eax
mov edx, eax
mov ebx, 0000h
mov eax, 4f05h
int 10h
pop eax
mov edx, eax
mov ebx, 0001h
mov eax, 4f05h
int 10h
popad
pop es
ret
wm_ChangeBank__ endp
;----------------------------------------------------------------------------
_TEXT ENDS
END