-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, based on original source. Original including precompi…
…led files http://www.komkon.org/~dekogel/m2000.html
- Loading branch information
0 parents
commit 61b9d63
Showing
46 changed files
with
27,473 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
/*** M2000: Portable P2000 emulator *****************************************/ | ||
/*** ***/ | ||
/*** Asm.S ***/ | ||
/*** ***/ | ||
/*** This file contains MS-DOS specific assembler routines ***/ | ||
/*** ***/ | ||
/*** Copyright (C) Marcel de Kogel 1996,1997 ***/ | ||
/*** You are not allowed to distribute this software commercially ***/ | ||
/*** Please, notify me, if you make any changes to this file ***/ | ||
/****************************************************************************/ | ||
|
||
.file "Asm.S" | ||
|
||
.data | ||
.align 4 | ||
DisplayStart: .long 0xA0000 | ||
TimerCount: .long 0 | ||
OldInt8: .long 0 | ||
OldInt8Selector:.word 0 | ||
.globl _DosSelector | ||
.globl _cs_alias | ||
|
||
.text | ||
|
||
.globl _nofunc | ||
_nofunc: | ||
ret | ||
|
||
.globl ___enable | ||
___enable: | ||
sti | ||
ret | ||
|
||
.globl ___disable | ||
___disable: | ||
cli | ||
ret | ||
|
||
.globl _JoyGetPos | ||
_JoyGetPos: | ||
pushl %ebx | ||
pushl %ecx | ||
pushl %edx | ||
pushl %esi | ||
pushl %edi | ||
movw $0x201,%dx | ||
movl $10000,%ecx | ||
subl %esi,%esi | ||
subl %edi,%edi | ||
cli | ||
outb %al,%dx | ||
jmp _JoyGetPos_Loop | ||
_JoyGetPos_Loop: | ||
inb %dx,%al | ||
movl %eax,%ebx | ||
shrl $1,%ebx | ||
adcl $0,%esi | ||
shrl $1,%ebx | ||
adcl $0,%edi | ||
testb $3,%al | ||
loopnz _JoyGetPos_Loop | ||
sti | ||
movl %edi,%eax | ||
shll $16,%eax | ||
movw %si,%ax | ||
popl %edi | ||
popl %esi | ||
popl %edx | ||
popl %ecx | ||
popl %ebx | ||
ret | ||
|
||
.globl _ReadTimer | ||
_ReadTimer: | ||
pushl %edi | ||
pushl %esi | ||
pushl %edx | ||
pushl %ecx | ||
pushl %ebx | ||
movl $50,%ecx | ||
ReadTimer_Loop: | ||
call _nofunc | ||
loop ReadTimer_Loop | ||
ReadTimer_Again: | ||
movl (TimerCount),%eax | ||
shll $16,%eax | ||
outb %al,$0x43 | ||
jmp ReadTim1 | ||
ReadTim1: | ||
jmp ReadTim2 | ||
ReadTim2: | ||
inb $0x40,%al | ||
jmp ReadTim3 | ||
ReadTim3: | ||
jmp ReadTim4 | ||
ReadTim4: | ||
movb %al,%ah | ||
inb $0x40,%al | ||
xchgb %al,%ah | ||
notw %ax | ||
movl (TimerCount),%ebx | ||
shll $16,%ebx | ||
movw %ax,%bx | ||
cmpl %eax,%ebx | ||
jne ReadTimer_Again | ||
popl %ebx | ||
popl %ecx | ||
popl %edx | ||
popl %esi | ||
popl %edi | ||
ret | ||
|
||
timer_interrupt: | ||
pushl %eax | ||
pushw %ds | ||
.byte 0x2e | ||
movw _cs_alias,%ax | ||
movw %ax,%ds | ||
incl (TimerCount) | ||
pushfl | ||
lcall (OldInt8) | ||
popw %ds | ||
popl %eax | ||
iret | ||
|
||
install_timer_int: | ||
pushal | ||
movl $0x204,%eax | ||
movb $8,%bl | ||
int $0x31 | ||
movl %edx,OldInt8 | ||
movw %cx,OldInt8Selector | ||
movw %cs,%cx | ||
leal timer_interrupt,%edx | ||
movb $8,%bl | ||
movl $0x205,%eax | ||
int $0x31 | ||
popal | ||
ret | ||
|
||
restore_timer_int: | ||
pushal | ||
movl OldInt8,%edx | ||
movw OldInt8Selector,%cx | ||
movb $8,%bl | ||
movl $0x205,%eax | ||
int $0x31 | ||
popal | ||
ret | ||
|
||
.globl _StartTimer | ||
_StartTimer: | ||
pushl %eax | ||
cli | ||
movb $0x34,%al | ||
outb %al,$0x43 | ||
jmp StartTim1 | ||
StartTim1: | ||
jmp StartTim2 | ||
StartTim2: | ||
subb %al,%al | ||
outb %al,$0x40 | ||
jmp StartTim3 | ||
StartTim3: | ||
jmp StartTim4 | ||
StartTim4: | ||
outb %al,$0x40 | ||
sti | ||
call install_timer_int | ||
popl %eax | ||
ret | ||
|
||
.globl _RestoreTimer | ||
_RestoreTimer: | ||
pushl %eax | ||
cli | ||
movb $0x36,%al | ||
outb %al,$0x43 | ||
jmp ResTim1 | ||
ResTim1: | ||
jmp ResTim2 | ||
ResTim2: | ||
subb %al,%al | ||
outb %al,$0x40 | ||
jmp ResTim3 | ||
ResTim3: | ||
jmp ResTim4 | ||
ResTim4: | ||
outb %al,$0x40 | ||
sti | ||
call restore_timer_int | ||
popl %eax | ||
ret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*** M2000: Portable P2000 emulator *****************************************/ | ||
/*** ***/ | ||
/*** Asm.h ***/ | ||
/*** ***/ | ||
/*** This file contains prototypes for MS-DOS specific assembler routines ***/ | ||
/*** ***/ | ||
/*** Copyright (C) Marcel de Kogel 1996,1997 ***/ | ||
/*** You are not allowed to distribute this software commercially ***/ | ||
/*** Please, notify me, if you make any changes to this file ***/ | ||
/****************************************************************************/ | ||
|
||
unsigned JoyGetPos (void); | ||
void StartTimer (void); | ||
unsigned ReadTimer (void); | ||
void RestoreTimer (void); | ||
void nofunc (void); | ||
void __enable (void); | ||
void __disable (void); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/****************************************************************************/ | ||
/** **/ | ||
/** Bitmap.c **/ | ||
/** **/ | ||
/** Routines to create screen shots in Windows bitmap format **/ | ||
/** **/ | ||
/** Copyright (C) Marcel de Kogel 1996 **/ | ||
/** You are not allowed to distribute this software commercially **/ | ||
/** Please, notify me, if you make any changes to this file **/ | ||
/****************************************************************************/ | ||
|
||
#include <stdio.h> | ||
#include "Bitmap.h" | ||
|
||
static void putint (char *p,int n) | ||
{ | ||
p[0]=n&255; | ||
p[1]=(n>>8)&255; | ||
p[2]=(n>>16)&255; | ||
p[3]=(n>>24)&255; | ||
} | ||
|
||
/****************************************************************************/ | ||
/* Return values: */ | ||
/* >=0 - Succes */ | ||
/* -1 - File creation error */ | ||
/* -2 - Write error */ | ||
/****************************************************************************/ | ||
int WriteBitmap (char *szFileName, int nBitsPerPixel, int nColoursUsed, | ||
int nWidthImageBuffer, | ||
int nWidthImage, int nHeightImage, | ||
char *pBitmapBits, char *pPalette) | ||
{ | ||
int i,j,nPadBytes,nImageBytes,nBufBytes; | ||
FILE *f; | ||
static char bitmapheader[]= | ||
{ | ||
/* BITMAPFILEHEADER */ | ||
0x42,0x4D, /* 0 type='BM' */ | ||
0x00,0x00,0x00,0x00, /* 2 size of file in bytes */ | ||
0x00,0x00, /* 6 reserved */ | ||
0x00,0x00, /* 8 reserved */ | ||
0x00,0x00,0x00,0x00, /* 10 offset of bitmap data */ | ||
/* BITMAPINFOHEADER */ | ||
0x28,0x00,0x00,0x00, /* 14 size of this structure in bytes */ | ||
0x00,0x00,0x00,0x00, /* 18 width of the image in pixels */ | ||
0x00,0x00,0x00,0x00, /* 22 height of the image in pixels */ | ||
0x01,0x00, /* 26 number of planes */ | ||
0x00,0x00, /* 28 bits per pixel */ | ||
0x00,0x00,0x00,0x00, /* 30 compression method */ | ||
0x00,0x00,0x00,0x00, /* 34 size of the image in bytes */ | ||
/* set to 0 if no compression is used */ | ||
0xE8,0x05,0x00,0x00, /* 38 horizontal resolution in pixels per meter */ | ||
0xE8,0x05,0x00,0x00, /* 42 vertical resolution in pixels per meter */ | ||
0x00,0x00,0x00,0x00, /* 46 number of colours used in the colour table */ | ||
0x00,0x00,0x00,0x00 /* 50 number of colours used in the image */ | ||
}; | ||
f=fopen (szFileName,"wb"); | ||
if (!f) return -1; | ||
bitmapheader[28]=nBitsPerPixel; | ||
putint (bitmapheader+46,nColoursUsed); | ||
putint (bitmapheader+50,nColoursUsed); | ||
putint (bitmapheader+18,nWidthImage); | ||
putint (bitmapheader+22,nHeightImage); | ||
putint (bitmapheader+10,sizeof(bitmapheader)+nColoursUsed*4); | ||
nBufBytes=(nWidthImageBuffer*nBitsPerPixel+7)/8; | ||
i=nImageBytes=(nWidthImage*nBitsPerPixel+7)/8; | ||
nPadBytes=(4-(i&3))&3; | ||
i+=nPadBytes; | ||
putint (bitmapheader+2,(i*nHeightImage)+sizeof(bitmapheader)+nColoursUsed*4); | ||
if (fwrite(bitmapheader,sizeof(bitmapheader),1,f)!=1) | ||
{ | ||
fclose (f); | ||
return -2; | ||
} | ||
for (i=0;i<nColoursUsed;++i) | ||
{ | ||
if (fputc(pPalette[i*3+2],f)==EOF) | ||
{ | ||
fclose (f); | ||
return -2; | ||
} | ||
if (fputc(pPalette[i*3+1],f)==EOF) | ||
{ | ||
fclose (f); | ||
return -2; | ||
} | ||
if (fputc(pPalette[i*3+0],f)==EOF) | ||
{ | ||
fclose (f); | ||
return -2; | ||
} | ||
if (fputc(0,f)==EOF) | ||
{ | ||
fclose (f); | ||
return -2; | ||
} | ||
} | ||
for (i=nHeightImage-1;i>=0;--i) | ||
{ | ||
if (fwrite(pBitmapBits+nBufBytes*i,nImageBytes,1,f)!=1) | ||
{ | ||
fclose (f); | ||
return -2; | ||
} | ||
for (j=0;j<nPadBytes;++j) | ||
{ | ||
if (fputc(0,f)==EOF) | ||
{ | ||
fclose (f); | ||
return -2; | ||
} | ||
} | ||
} | ||
fclose (f); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/****************************************************************************/ | ||
/** **/ | ||
/** Bitmap.h **/ | ||
/** **/ | ||
/** Routines to create screen shots in Windows bitmap format **/ | ||
/** **/ | ||
/** Copyright (C) Marcel de Kogel 1996 **/ | ||
/** You are not allowed to distribute this software commercially **/ | ||
/** Please, notify me, if you make any changes to this file **/ | ||
/****************************************************************************/ | ||
|
||
/****************************************************************************/ | ||
/* Return values: */ | ||
/* >=0 - Succes */ | ||
/* -1 - File creation error */ | ||
/* -2 - Write error */ | ||
/****************************************************************************/ | ||
int WriteBitmap (char *szFileName, int nBitsPerPixel, int nColoursUsed, | ||
int nWidthImageBuffer, | ||
int nWidthImage, int nHeightImage, | ||
char *pBitmapBits, char *pPalette); |
Oops, something went wrong.