dosbox-staging/include/callback.h

116 lines
3.1 KiB
C++
Raw Normal View History

/*
* Copyright (C) 2002-2021 The DOSBox Team
*
* 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 2 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DOSBOX_CALLBACK_H
#define DOSBOX_CALLBACK_H
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
typedef Bitu (*CallBack_Handler)(void);
extern CallBack_Handler CallBack_Handlers[];
enum { CB_RETN,CB_RETF,CB_RETF8,CB_RETF_STI,CB_RETF_CLI,
CB_IRET,CB_IRETD,CB_IRET_STI,CB_IRET_EOI_PIC1,
CB_IRQ0,CB_IRQ1,CB_IRQ9,CB_IRQ12,CB_IRQ12_RET,CB_IRQ6_PCJR,CB_MOUSE,
CB_INT29,CB_INT16,CB_HOOKABLE,CB_TDE_IRET,CB_IPXESR,CB_IPXESR_RET,
Import Custom S3 Trio Patch Posted 2013-04-07 by s3freak on vogons.org, described as having the following features: - 24-bit colour support - I just wanted to experiment with this. It can be disabled by using machine types vesa_no24bpp or vesa_nolfb_no24bpp in dosbox.conf as it can confuse a few DOS apps such as SVGATest and SEA picture viewer. - Some additional modes, including 1600x1200 - The mode list has been heavily customised to my own liking. - Refresh rates for VESA modes inside DOSBox - The refresh rates can be set under a new section called vesa_refresh in dosbox.conf - This allows you to match the refresh rate inside DOSBox to your monitor. This only works for VESA modes, not standard VGA, EGA, CGA, etc. - Extended text modes (80x60, 132x25, 132x43, 132x50 and 132x60), 9 pixels wide per character, which improves text mode readability, compared to 8 pixels wide - My very first graphics (Trident T9000i) card has such extended text modes. - VGA text mode with 9 pixels wide per character for S3 Trio, not just standard VGA - This is the behaviour of other virtualisation solutions, such as VirtualBox and VMWare, and real graphics cards, including my real S3 Trio 64 / Vision 968. - 512KB, 1MB, 2MB, 4MB and 8MB video memory options (4MB default). Therefore you can run Windows 3.1 in 1024x768 32bpp, with 4MB, etc. You cannot use more than 4MB in Windows 3.1 or else it will crash on startup. I have S3 Trio cards with with 4MB. - Smooth page flipping under VBETest - Taken from DOSBox MB6. - 64KB aligned page sizes - Taken from DOSBox SVN. Credit to the original authors for the last 2 features. Regarding applicability, it was mentioned it does not apply to modern DOSBoxes (Yesterplay80): "This patch is so old, it certainly won't apply anywhere any more." s3freak: This is for DOSBox 0.74, which this patch is originally for, where I fixed a few bugs recently during my project to patch a S3 Trio / Vision BIOS on actual cards. I have not been updating the base DOSBox build ever since, especially when my focus is now on actual hardware. Attachments: - Patch filename: custom-vga-s3.patch - Patch size: 56.28 KiB - File license: Fair use/fair dealing exception Imported-from: https://www.vogons.org/download/file.php?id=51017
2021-08-24 17:46:55 -07:00
CB_INT21,CB_INT13,CB_VESA_START,CB_VESA_WAIT,CB_VESA_PM};
#define CB_MAX 128
#define CB_SIZE 32
#define CB_SEG 0xF000
#define CB_SOFFSET 0x1000
enum {
CBRET_NONE=0,CBRET_STOP=1
};
extern Bit8u lastint;
static INLINE RealPt CALLBACK_RealPointer(Bitu callback) {
return RealMake(CB_SEG,(Bit16u)(CB_SOFFSET+callback*CB_SIZE));
}
static INLINE PhysPt CALLBACK_PhysPointer(Bitu callback) {
return PhysMake(CB_SEG,(Bit16u)(CB_SOFFSET+callback*CB_SIZE));
}
static INLINE PhysPt CALLBACK_GetBase(void) {
return (CB_SEG << 4) + CB_SOFFSET;
}
Bitu CALLBACK_Allocate();
void CALLBACK_Idle(void);
void CALLBACK_RunRealInt(Bit8u intnum);
void CALLBACK_RunRealFar(Bit16u seg,Bit16u off);
bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,const char* descr);
Bitu CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,PhysPt addr,const char* descr);
const char* CALLBACK_GetDescription(Bitu callback);
bool CALLBACK_Free(Bitu callback);
void CALLBACK_SCF(bool val);
void CALLBACK_SZF(bool val);
void CALLBACK_SIF(bool val);
extern Bitu call_priv_io;
2020-07-11 11:10:54 +02:00
class CALLBACK_HandlerObject {
private:
bool installed;
Bitu m_callback;
2020-07-11 11:10:54 +02:00
enum { NONE, SETUP, SETUPAT } m_type;
struct {
RealPt old_vector;
2020-07-11 11:10:54 +02:00
uint8_t interrupt;
bool installed;
} vectorhandler;
2020-07-11 11:10:54 +02:00
public:
2020-07-11 11:10:54 +02:00
CALLBACK_HandlerObject()
: installed(false),
m_callback(0),
m_type(NONE),
vectorhandler{0, 0, false}
{}
virtual ~CALLBACK_HandlerObject();
//Install and allocate a callback.
void Install(CallBack_Handler handler,Bitu type,const char* description);
void Install(CallBack_Handler handler,Bitu type,PhysPt addr,const char* description);
void Uninstall();
//Only allocate a callback number
void Allocate(CallBack_Handler handler,const char* description=0);
Bit16u Get_callback() {
return (Bit16u)m_callback;
}
RealPt Get_RealPointer() {
return CALLBACK_RealPointer(m_callback);
}
void Set_RealVec(Bit8u vec);
};
#endif