text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```objective-c #ifndef SOUND_YM7128_H #define SOUND_YM7128_H typedef struct ym7128_t { int a0; int sci; uint8_t dat; int reg_sel; uint8_t regs[32]; int gl[8]; int gr[8]; int vm; int vc; int vl; int vr; int c0; int c1; int t[9]; int16_t filter_dat; int16_t prev_l; int16_t prev_r; int16_t delay_buffer[2400]; int delay_pos; int16_t last_samp; } ym7128_t; void ym7128_init(ym7128_t *ym7128); void ym7128_write(ym7128_t *ym7128, uint8_t val); void ym7128_apply(ym7128_t *ym7128, int16_t *buffer, int len); #endif /*SOUND_YM7128_H*/ ```
/content/code_sandbox/src/include/86box/snd_ym7128.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
224
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the PS/2 cmos/nvr device. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Sarah Walker, <path_to_url * * * This program is free software; you can redistribute it and/or modify * (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 * * along with this program; if not, write to the: * * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307 * USA. */ #ifndef EMU_NVRPS2_H #define EMU_NVRPS2_H extern const device_t ps2_nvr_device; extern const device_t ps2_nvr_55ls_device; #endif /*EMU_NVRPS2_H*/ ```
/content/code_sandbox/src/include/86box/nvr_ps2.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
298
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Define the various platform support functions. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_PLAT_H #define EMU_PLAT_H #include <stdint.h> #include <stdio.h> #include "86box/device.h" #include "86box/machine.h" #ifndef GLOBAL # define GLOBAL extern #endif /* String ID numbers. */ enum { STRING_MOUSE_CAPTURE, /* "Click to capture mouse" */ STRING_MOUSE_RELEASE, /* "Press F8+F12/Ctrl+End to release mouse" */ STRING_MOUSE_RELEASE_MMB, /* "Press F8+F12/Ctrl+End or middle button to release mouse" */ STRING_INVALID_CONFIG, /* "Invalid configuration" */ STRING_NO_ST506_ESDI_CDROM, /* "MFM/RLL or ESDI CD-ROM drives never existed" */ STRING_NET_ERROR, /* "Failed to initialize network driver" */ STRING_NET_ERROR_DESC, /* "The network configuration will be switched..." */ STRING_PCAP_ERROR_NO_DEVICES, /* "No PCap devices found" */ STRING_PCAP_ERROR_INVALID_DEVICE, /* "Invalid PCap device" */ STRING_PCAP_ERROR_DESC, /* "Make sure libpcap is installed..." */ STRING_GHOSTSCRIPT_ERROR_TITLE, /* "Unable to initialize Ghostscript" */ STRING_GHOSTSCRIPT_ERROR_DESC, /* "gsdll32.dll/gsdll64.dll/libgs is required..." */ STRING_HW_NOT_AVAILABLE_TITLE, /* "Hardware not available" */ STRING_HW_NOT_AVAILABLE_MACHINE, /* "Machine \"%hs\" is not available..." */ STRING_HW_NOT_AVAILABLE_VIDEO, /* "Video card \"%hs\" is not available..." */ STRING_HW_NOT_AVAILABLE_VIDEO2, /* "Video card #2 \"%hs\" is not available..." */ STRING_MONITOR_SLEEP, /* "Monitor in sleep mode" */ STRING_GHOSTPCL_ERROR_TITLE, /* "Unable to initialize GhostPCL" */ STRING_GHOSTPCL_ERROR_DESC /* "gpcl6dll32.dll/gpcl6dll64.dll/libgpcl6 is required..." */ }; /* The Win32 API uses _wcsicmp. */ #ifdef _WIN32 # define wcscasecmp _wcsicmp # define strcasecmp _stricmp #else /* Declare these functions to avoid warnings. They will redirect to strcasecmp and strncasecmp respectively. */ extern int stricmp(const char *s1, const char *s2); extern int strnicmp(const char *s1, const char *s2, size_t n); #endif #if (defined(__HAIKU__) || defined(__unix__) || defined(__APPLE__)) && !defined(__linux__) /* FreeBSD has largefile by default. */ # define fopen64 fopen # define fseeko64 fseeko # define ftello64 ftello # define off64_t off_t #elif defined(_MSC_VER) // # define fopen64 fopen # define fseeko64 _fseeki64 # define ftello64 _ftelli64 # define off64_t off_t #endif #ifdef _MSC_VER # define UNUSED(arg) arg #else /* A hack (GCC-specific?) to allow us to ignore unused parameters. */ # define UNUSED(arg) __attribute__((unused)) arg #endif /* Return the size (in wchar's) of a wchar_t array. */ #define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t)) #ifdef __cplusplus # include <atomic> # define atomic_flag_t std::atomic_flag # define atomic_bool_t std::atomic_bool extern "C" { #else # include <stdatomic.h> # define atomic_flag_t atomic_flag # define atomic_bool_t atomic_bool #endif #if defined(_MSC_VER) # define ssize_t intptr_t #endif #ifdef _MSC_VER # define fallthrough do {} while (0) /* fallthrough */ #else # if __has_attribute(fallthrough) # define fallthrough __attribute__((fallthrough)) # else # if __has_attribute(__fallthrough__) # define fallthrough __attribute__((__fallthrough__)) # endif # define fallthrough do {} while (0) /* fallthrough */ # endif #endif /* Global variables residing in the platform module. */ extern int dopause; /* system is paused */ extern int mouse_capture; /* mouse is captured in app */ extern volatile int is_quit; /* system exit requested */ #ifdef MTR_ENABLED extern int tracing_on; #endif extern uint64_t timer_freq; extern int infocus; extern char emu_version[200]; /* version ID string */ extern int rctrl_is_lalt; extern int update_icons; extern int kbd_req_capture; extern int hide_status_bar; extern int hide_tool_bar; /* System-related functions. */ extern FILE *plat_fopen(const char *path, const char *mode); extern FILE *plat_fopen64(const char *path, const char *mode); extern void plat_remove(char *path); extern int plat_getcwd(char *bufp, int max); extern int plat_chdir(char *path); extern void plat_tempfile(char *bufp, char *prefix, char *suffix); extern void plat_get_exe_name(char *s, int size); extern void plat_get_global_config_dir(char *outbuf, uint8_t len); extern void plat_get_global_data_dir(char *outbuf, uint8_t len); extern void plat_get_temp_dir(char *outbuf, uint8_t len); extern void plat_init_rom_paths(void); extern int plat_dir_check(char *path); extern int plat_dir_create(char *path); extern void *plat_mmap(size_t size, uint8_t executable); extern void plat_munmap(void *ptr, size_t size); extern uint64_t plat_timer_read(void); extern uint32_t plat_get_ticks(void); extern void plat_delay_ms(uint32_t count); extern void plat_pause(int p); extern void plat_mouse_capture(int on); extern int plat_vidapi(const char *name); extern char *plat_vidapi_name(int api); extern void plat_resize(int x, int y, int monitor_index); extern void plat_resize_request(int x, int y, int monitor_index); extern uint32_t plat_language_code(char *langcode); extern void plat_language_code_r(uint32_t lcid, char *outbuf, int len); extern void plat_get_cpu_string(char *outbuf, uint8_t len); extern void plat_set_thread_name(void *thread, const char *name); /* Resource management. */ extern wchar_t *plat_get_string(int id); /* Emulator start/stop support functions. */ extern void do_start(void); extern void do_stop(void); /* Power off. */ extern void plat_power_off(void); /* Platform-specific device support. */ extern void cassette_mount(char *fn, uint8_t wp); extern void cassette_eject(void); extern void cartridge_mount(uint8_t id, char *fn, uint8_t wp); extern void cartridge_eject(uint8_t id); extern void floppy_mount(uint8_t id, char *fn, uint8_t wp); extern void floppy_eject(uint8_t id); extern void cdrom_mount(uint8_t id, char *fn); extern void plat_cdrom_ui_update(uint8_t id, uint8_t reload); extern void zip_eject(uint8_t id); extern void zip_mount(uint8_t id, char *fn, uint8_t wp); extern void zip_reload(uint8_t id); extern void mo_eject(uint8_t id); extern void mo_mount(uint8_t id, char *fn, uint8_t wp); extern void mo_reload(uint8_t id); extern int ioctl_open(uint8_t id, char d); extern void ioctl_reset(uint8_t id); extern void ioctl_close(uint8_t id); /* Other stuff. */ extern void startblit(void); extern void endblit(void); /* Conversion between UTF-8 and UTF-16. */ extern size_t mbstoc16s(uint16_t dst[], const char src[], int len); extern size_t c16stombs(char dst[], const uint16_t src[], int len); #ifdef __cplusplus } #endif #endif /*EMU_PLAT_H*/ ```
/content/code_sandbox/src/include/86box/plat.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,875
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of a generic Magneto-Optical Disk drive * commands, for both ATAPI and SCSI usage. * * * * Authors: Natalia Portillo <claunia@claunia.com> * Fred N. van Kempen, <decwiz@yahoo.com> * Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_MO_H #define EMU_MO_H #define MO_NUM 4 #define BUF_SIZE 32768 #define MO_TIME 10.0 #define MO_IMAGE_HISTORY 4 typedef struct mo_type_t { uint32_t sectors; uint16_t bytes_per_sector; } mo_type_t; #define KNOWN_MO_TYPES 10 static const mo_type_t mo_types[KNOWN_MO_TYPES] = { // 3.5" standard M.O. disks { 248826, 512 }, { 446325, 512 }, { 1041500, 512 }, { 310352, 2048 }, { 605846, 2048 }, { 1063146, 2048 }, // 5.25" M.O. disks { 573624, 512 }, { 314568, 1024 }, { 904995, 512 }, { 637041, 1024 }, }; typedef struct mo_drive_type_t { const char vendor[9]; const char model[16]; const char revision[5]; int8_t supported_media[KNOWN_MO_TYPES]; } mo_drive_type_t; #define KNOWN_MO_DRIVE_TYPES 22 static const mo_drive_type_t mo_drive_types[KNOWN_MO_DRIVE_TYPES] = { {"86BOX", "MAGNETO OPTICAL", "1.00", { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }}, { "FUJITSU", "M2512A", "1314", { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "FUJITSU", "M2513-MCC3064SS", "1.00", { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }}, { "FUJITSU", "MCE3130SS", "0070", { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }}, { "FUJITSU", "MCF3064SS", "0030", { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }}, { "FUJITSU", "MCJ3230UB-S", "0040", { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }}, { "HP", "S6300.65", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }}, { "HP", "C1716C", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 }}, { "IBM", "0632AAA", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }}, { "IBM", "0632CHC", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 }}, { "IBM", "0632CHX", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 }}, { "IBM", "MD3125A", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "IBM", "MD3125B", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "IBM", "MTA-3127", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "IBM", "MTA-3230", "1.00", { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "MATSHITA", "LF-3000", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "MOST", "RMD-5100", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "RICOH", "RO-5031E", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }}, { "SONY", "SMO-C301", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "SONY", "SMO-C501", "1.00", { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }}, { "TEAC", "OD-3000", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "TOSHIBA", "OD-D300", "1.00", { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}, }; enum { MO_BUS_DISABLED = 0, MO_BUS_ATAPI = 5, MO_BUS_SCSI = 6, MO_BUS_USB = 7 }; typedef struct mo_drive_t { uint8_t id; union { uint8_t res; uint8_t res0; /* Reserved for other ID's. */ uint8_t res1; uint8_t ide_channel; uint8_t scsi_device_id; }; uint8_t bus_type; /* 0 = ATAPI, 1 = SCSI */ uint8_t bus_mode; /* Bit 0 = PIO suported; Bit 1 = DMA supportd. */ uint8_t read_only; /* Struct variable reserved for media status. */ uint8_t pad; uint8_t pad0; FILE *fp; void *priv; char image_path[1024]; char prev_image_path[1024]; char *image_history[MO_IMAGE_HISTORY]; uint32_t type; uint32_t medium_size; uint32_t base; uint16_t sector_size; } mo_drive_t; typedef struct mo_t { mode_sense_pages_t ms_pages_saved; mo_drive_t *drv; #ifdef EMU_IDE_H ide_tf_t * tf; #else void * tf; #endif uint8_t *buffer; uint8_t atapi_cdb[16]; uint8_t current_cdb[16]; uint8_t sense[256]; #ifdef ANCIENT_CODE /* Task file. */ uint8_t features; uint8_t phase; uint16_t request_length; uint8_t status; uint8_t error; uint16_t pad; uint32_t pos; #endif uint8_t id; uint8_t cur_lun; uint8_t pad0; uint8_t pad1; uint16_t max_transfer_len; uint16_t pad2; int requested_blocks; int packet_status; int total_length; int do_page_save; int unit_attention; int request_pos; int old_len; int pad3; uint32_t sector_pos; uint32_t sector_len; uint32_t packet_len; double callback; } mo_t; extern mo_t *mo[MO_NUM]; extern mo_drive_t mo_drives[MO_NUM]; #if 0 extern uint8_t atapi_mo_drives[8]; extern uint8_t scsi_mo_drives[16]; #endif #define mo_sense_error dev->sense[0] #define mo_sense_key dev->sense[2] #define mo_asc dev->sense[12] #define mo_ascq dev->sense[13] #ifdef __cplusplus extern "C" { #endif extern void mo_disk_close(mo_t *dev); extern void mo_disk_reload(mo_t *dev); extern void mo_insert(mo_t *dev); extern void mo_global_init(void); extern void mo_hard_reset(void); extern void mo_reset(scsi_common_t *sc); extern int mo_load(mo_t *dev, char *fn); extern void mo_close(void); #ifdef __cplusplus } #endif #endif /*EMU_MO_H*/ ```
/content/code_sandbox/src/include/86box/mo.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
2,253
```objective-c #ifndef EMU_PPI_H #define EMU_PPI_H typedef struct PPI { int s2; uint8_t pa; uint8_t pb; } PPI; extern int ppispeakon; extern PPI ppi; extern void ppi_reset(void); #endif /*EMU_PPI_H*/ ```
/content/code_sandbox/src/include/86box/ppi.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
69
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Configuration file handler header. * * * * Authors: Sarah Walker, * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * Overdoze, * */ #ifndef EMU_CONFIG_H #define EMU_CONFIG_H #ifdef __cplusplus extern "C" { #endif #if 0 typedef struct storage_cfg_t { uint8_t id; uint8_t bus_type; /* Bus type: IDE, SCSI, etc. */ uint8_t bus : 4; /* ID of the bus (for example, for IDE, 0 = primary, 1 = secondary, etc. */ uint8_t bus_id : 4; /* ID of the device on the bus */ uint8_t type; /* Type flags, interpretation depends on the device */ uint8_t is_image; /* This is only used for CD-ROM: 0 = Image; 1 = Host drive */ wchar_t path[1024]; /* Name of current image file or host drive */ uint32_t spt; /* Physical geometry parameters */ uint32_t hpc; uint32_t tracks; } storage_cfg_t; typedef struct config_t { /* General configuration */ int vid_resize; /* Window is resizable or not */ int vid_renderer; /* Renderer */ int vid_fullscreen_scale; /* Full screen scale type */ int vid_fullscreen_start; /* Start emulator in full screen */ int vid_force_43; /* Force 4:3 display ratio in windowed mode */ int vid_scale; /* Windowed mode scale */ int vid_overscan; /* EGA/(S)VGA overscan enabled */ int vid_cga_contrast; /* CGA alternate contrast enabled */ int vid_grayscale; /* Video is grayscale */ int vid_grayscale_type; /* Video grayscale type */ int vid_invert_display; /* Invert display */ int rctrl_is_lalt; /* Right CTRL is left ALT */ int update_icons; /* Update status bar icons */ int window_remember; /* Remember window position and size */ int window_w; /* Window coordinates */ int window_h; int window_x; int window_y; int sound_gain; /* Sound gain */ # ifdef USE_LANGUAGE uint16_t language_id; /* Language ID (0x0409 = English (US)) */ # endif /* Machine cateogory */ int machine; /* Machine */ int cpu; /* CPU */ # ifdef USE_DYNAREC int cpu_use_dynarec; /* CPU recompiler enabled */ # endif int wait_states; /* CPU wait states */ int enable_external_fpu; /* FPU enabled */ int time_sync; /* Time sync enabled */ uint32_t mem_size; /* Memory size */ /* Video category */ int video_card; /* Video card */ int voodoo_enabled; /* Voodoo enabled */ /* Input devices category */ int mouse_type; /* Mouse type */ int joystick_type; /* Joystick type */ /* Sound category */ int sound_card; /* Sound card */ int midi_device; /* Midi device */ int mpu_401; /* Standalone MPU-401 enabled */ int ssi_2001_enabled; /* SSI-2001 enabled */ int game_blaster_enabled; /* Game blaster enabled */ int gus_enabled; /* Gravis Ultrasound enabled */ int opl_type; /* OPL emulation type */ int sound_is_float; /* Sound is 32-bit float or 16-bit integer */ /* Network category */ int network_type; /* Network type (SLiRP or PCap) */ int network_card; /* Network card */ char network_host[520]; /* PCap device */ /* Ports category */ char parallel_devices[PARALLEL_MAX][32]; /* LPT device names */ # ifdef USE_SERIAL_DEVICES char serial_devices[SERIAL_MAX][32]; /* Serial device names */ # endif /* Other peripherals category */ int fdc_current[FDC_MAX]; /* Floppy disk controller type */ int hdc_current[HDC_MAX]; /* Hard disk controller type */ int hdc; /* Hard disk controller */ int scsi_card; /* SCSI controller */ int ide_ter_enabled; /* Tertiary IDE controller enabled */ int ide_qua_enabled; /* Quaternary IDE controller enabled */ int bugger_enabled; /* ISA bugger device enabled */ int isa_rtc_type; /* ISA RTC card */ int isa_mem_type[ISAMEM_MAX]; /* ISA memory boards */ /* Hard disks category */ storage_cfg_t hdd[HDD_NUM]; /* Hard disk drives */ /* Floppy drives category */ storage_cfg_t fdd[FDD_NUM]; /* Floppy drives */ /* Other removable devices category */ storage_cfg_t cdrom[CDROM_NUM]; /* CD-ROM drives */ storage_cfg_t rdisk[ZIP_NUM]; /* Removable disk drives */ } config_t; #endif extern void config_load(void); extern void config_save(void); #ifdef EMU_INI_H extern ini_t config_get_ini(void); #else extern void *config_get_ini(void); #endif #define config_delete_var(head, name) ini_delete_var(config_get_ini(), head, name) #define config_get_int(head, name, def) ini_get_int(config_get_ini(), head, name, def) #define config_get_double(head, name, def) ini_get_double(config_get_ini(), head, name, def) #define config_get_hex16(head, name, def) ini_get_hex16(config_get_ini(), head, name, def) #define config_get_hex20(head, name, def) ini_get_hex20(config_get_ini(), head, name, def) #define config_get_mac(head, name, def) ini_get_mac(config_get_ini(), head, name, def) #define config_get_string(head, name, def) ini_get_string(config_get_ini(), head, name, def) #define config_get_wstring(head, name, def) ini_get_wstring(config_get_ini(), head, name, def) #define config_set_int(head, name, val) ini_set_int(config_get_ini(), head, name, val) #define config_set_double(head, name, val) ini_set_double(config_get_ini(), head, name, val) #define config_set_hex16(head, name, val) ini_set_hex16(config_get_ini(), head, name, val) #define config_set_hex20(head, name, val) ini_set_hex20(config_get_ini(), head, name, val) #define config_set_mac(head, name, val) ini_set_mac(config_get_ini(), head, name, val) #define config_set_string(head, name, val) ini_set_string(config_get_ini(), head, name, val) #define config_set_wstring(head, name, val) ini_set_wstring(config_get_ini(), head, name, val) #define config_find_section(name) ini_find_section(config_get_ini(), name) #define config_rename_section ini_rename_section #ifdef __cplusplus } #endif #endif /*EMU_CONFIG_H*/ ```
/content/code_sandbox/src/include/86box/config.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,651
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the video controller module. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_VIDEO_H #define EMU_VIDEO_H #ifdef __cplusplus # include <atomic> using atomic_bool = std::atomic_bool; using atomic_int = std::atomic_int; #else # include <stdatomic.h> #endif #define makecol(r, g, b) ((b) | ((g) << 8) | ((r) << 16)) #define makecol32(r, g, b) ((b) | ((g) << 8) | ((r) << 16)) #define getcolr(color) (((color) >> 16) & 0xFF) #define getcolg(color) (((color) >> 8) & 0xFF) #define getcolb(color) ((color) & 0xFF) enum { VID_NONE = 0, VID_INTERNAL }; enum { FULLSCR_SCALE_FULL = 0, FULLSCR_SCALE_43, FULLSCR_SCALE_KEEPRATIO, FULLSCR_SCALE_INT, FULLSCR_SCALE_INT43 }; #ifdef __cplusplus extern "C" { #endif enum { VIDEO_ISA = 0, VIDEO_MCA, VIDEO_BUS, VIDEO_PCI, VIDEO_AGP }; #define VIDEO_FLAG_TYPE_CGA 0 #define VIDEO_FLAG_TYPE_MDA 1 #define VIDEO_FLAG_TYPE_SPECIAL 2 #define VIDEO_FLAG_TYPE_8514 3 #define VIDEO_FLAG_TYPE_XGA 4 #define VIDEO_FLAG_TYPE_NONE 5 #define VIDEO_FLAG_TYPE_MASK 7 typedef struct video_timings_t { int type; int write_b; int write_w; int write_l; int read_b; int read_w; int read_l; } video_timings_t; typedef struct bitmap_t { int w; int h; uint32_t *dat; uint32_t *line[2112]; } bitmap_t; typedef struct rgb_t { uint8_t r; uint8_t g; uint8_t b; } rgb_t; typedef struct dbcs_font_t { uint8_t chr[32]; } dbcs_font_t; struct blit_data_struct; typedef struct monitor_t { char name[512]; int mon_xsize; int mon_ysize; int mon_scrnsz_x; int mon_scrnsz_y; int mon_efscrnsz_y; int mon_unscaled_size_x; int mon_unscaled_size_y; double mon_res_x; double mon_res_y; int mon_bpp; bitmap_t *target_buffer; int mon_video_timing_read_b; int mon_video_timing_read_w; int mon_video_timing_read_l; int mon_video_timing_write_b; int mon_video_timing_write_w; int mon_video_timing_write_l; int mon_overscan_x; int mon_overscan_y; int mon_force_resize; int mon_fullchange; int mon_changeframecount; atomic_int mon_screenshots; uint32_t *mon_pal_lookup; int *mon_cga_palette; int mon_pal_lookup_static; /* Whether it should not be freed by the API. */ int mon_cga_palette_static; /* Whether it should not be freed by the API. */ const video_timings_t *mon_vid_timings; int mon_vid_type; struct blit_data_struct *mon_blit_data_ptr; } monitor_t; typedef struct monitor_settings_t { int mon_window_x; /* (C) window size and position info. */ int mon_window_y; int mon_window_w; int mon_window_h; int mon_window_maximized; } monitor_settings_t; #define MONITORS_NUM 2 extern monitor_t monitors[MONITORS_NUM]; extern monitor_settings_t monitor_settings[MONITORS_NUM]; extern atomic_bool doresize_monitors[MONITORS_NUM]; extern int monitor_index_global; extern int show_second_monitors; extern int video_fullscreen_scale_maximized; typedef rgb_t PALETTE[256]; #if 0 extern int changeframecount; #endif extern volatile int screenshots; #if 0 extern bitmap_t *buffer32; #endif #define buffer32 (monitors[monitor_index_global].target_buffer) #define pal_lookup (monitors[monitor_index_global].mon_pal_lookup) #define overscan_x (monitors[monitor_index_global].mon_overscan_x) #define overscan_y (monitors[monitor_index_global].mon_overscan_y) #define video_timing_read_b (monitors[monitor_index_global].mon_video_timing_read_b) #define video_timing_read_l (monitors[monitor_index_global].mon_video_timing_read_l) #define video_timing_read_w (monitors[monitor_index_global].mon_video_timing_read_w) #define video_timing_write_b (monitors[monitor_index_global].mon_video_timing_write_b) #define video_timing_write_l (monitors[monitor_index_global].mon_video_timing_write_l) #define video_timing_write_w (monitors[monitor_index_global].mon_video_timing_write_w) #define video_res_x (monitors[monitor_index_global].mon_res_x) #define video_res_y (monitors[monitor_index_global].mon_res_y) #define video_bpp (monitors[monitor_index_global].mon_bpp) #define xsize (monitors[monitor_index_global].mon_xsize) #define ysize (monitors[monitor_index_global].mon_ysize) #define cga_palette (*monitors[monitor_index_global].mon_cga_palette) #define changeframecount (monitors[monitor_index_global].mon_changeframecount) #define scrnsz_x (monitors[monitor_index_global].mon_scrnsz_x) #define scrnsz_y (monitors[monitor_index_global].mon_scrnsz_y) #define efscrnsz_y (monitors[monitor_index_global].mon_efscrnsz_y) #define unscaled_size_x (monitors[monitor_index_global].mon_unscaled_size_x) #define unscaled_size_y (monitors[monitor_index_global].mon_unscaled_size_y) extern PALETTE cgapal; extern PALETTE cgapal_mono[6]; #if 0 extern uint32_t pal_lookup[256]; #endif extern int video_fullscreen; extern int video_fullscreen_scale; extern int video_fullscreen_first; extern uint8_t fontdat[2048][8]; extern uint8_t fontdatm[2048][16]; extern uint8_t fontdat2[2048][8]; extern uint8_t fontdatm2[2048][16]; extern uint8_t fontdatw[512][32]; extern uint8_t fontdat8x12[256][16]; extern uint8_t fontdat12x18[256][36]; extern dbcs_font_t *fontdatksc5601; extern dbcs_font_t *fontdatksc5601_user; extern uint32_t *video_6to8; extern uint32_t *video_8togs; extern uint32_t *video_8to32; extern uint32_t *video_15to32; extern uint32_t *video_16to32; extern int enable_overscan; extern int force_43; extern int vid_resize; extern int herc_blend; extern int vid_cga_contrast; extern int video_grayscale; extern int video_graytype; extern double cpuclock; extern int emu_fps; extern int frames; extern int readflash; extern int ibm8514_active; extern int xga_active; /* Function handler pointers. */ extern void (*video_recalctimings)(void); extern void video_screenshot_monitor(uint32_t *buf, int start_x, int start_y, int row_len, int monitor_index); extern void video_screenshot(uint32_t *buf, int start_x, int start_y, int row_len); #ifdef _WIN32 extern void * (__cdecl *video_copy)(void *_Dst, const void *_Src, size_t _Size); extern void *__cdecl video_transform_copy(void *_Dst, const void *_Src, size_t _Size); #else extern void *(*video_copy)(void *__restrict _Dst, const void *__restrict _Src, size_t _Size); extern void *video_transform_copy(void *__restrict _Dst, const void *__restrict _Src, size_t _Size); #endif /* Table functions. */ extern int video_card_available(int card); #ifdef EMU_DEVICE_H extern const device_t *video_card_getdevice(int card); #endif extern int video_card_has_config(int card); extern const char *video_get_internal_name(int card); extern int video_get_video_from_internal_name(char *s); extern int video_card_get_flags(int card); extern int video_is_mda(void); extern int video_is_cga(void); extern int video_is_ega_vga(void); extern int video_is_8514(void); extern int video_is_xga(void); extern void video_inform_monitor(int type, const video_timings_t *ptr, int monitor_index); extern int video_get_type_monitor(int monitor_index); extern void video_setblit(void (*blit)(int, int, int, int, int)); extern void video_blend(int x, int y); extern void video_blit_memtoscreen_8(int x, int y, int w, int h); extern void video_blend_monitor(int x, int y, int monitor_index); extern void video_process_8_monitor(int x, int y, int monitor_index); extern void video_blit_memtoscreen_monitor(int x, int y, int w, int h, int monitor_index); extern void video_blit_complete_monitor(int monitor_index); extern void video_wait_for_blit_monitor(int monitor_index); extern void video_wait_for_buffer_monitor(int monitor_index); extern bitmap_t *create_bitmap(int w, int h); extern void destroy_bitmap(bitmap_t *b); extern void cgapal_rebuild_monitor(int monitor_index); extern void hline(bitmap_t *b, int x1, int y, int x2, uint32_t col); extern void updatewindowsize(int x, int y); extern void video_monitor_init(int); extern void video_monitor_close(int); extern void video_init(void); extern void video_close(void); extern void video_reset_close(void); extern void video_pre_reset(int card); extern void video_reset(int card); extern void video_post_reset(void); extern void video_voodoo_init(void); extern uint8_t video_force_resize_get_monitor(int monitor_index); extern void video_force_resize_set_monitor(uint8_t res, int monitor_index); extern void video_update_timing(void); extern void loadfont_ex(char *s, int format, int offset); extern void loadfont(char *s, int format); extern int get_actual_size_x(void); extern int get_actual_size_y(void); extern uint32_t video_color_transform(uint32_t color); #define video_inform(type, video_timings_ptr) video_inform_monitor(type, video_timings_ptr, monitor_index_global) #define video_get_type() video_get_type_monitor(0) #define video_blend(x, y) video_blend_monitor(x, y, monitor_index_global) #define video_blit_memtoscreen(x, y, w, h) video_blit_memtoscreen_monitor(x, y, w, h, monitor_index_global) #define video_process_8(x, y) video_process_8_monitor(x, y, monitor_index_global) #define video_blit_complete() video_blit_complete_monitor(monitor_index_global) #define video_wait_for_blit() video_wait_for_blit_monitor(monitor_index_global) #define video_wait_for_buffer() video_wait_for_buffer_monitor(monitor_index_global) #define cgapal_rebuild() cgapal_rebuild_monitor(monitor_index_global) #define video_force_resize_get() video_force_resize_get_monitor(monitor_index_global) #define video_force_resize_set(val) video_force_resize_set_monitor(val, monitor_index_global) #ifdef __cplusplus } #endif #ifdef EMU_DEVICE_H /* IBM XGA */ extern void xga_device_add(void); /* IBM 8514/A and clones*/ extern void ibm8514_device_add(void); extern const device_t mach8_vga_isa_device; extern const device_t mach32_isa_device; extern const device_t mach32_vlb_device; extern const device_t mach32_mca_device; extern const device_t mach32_pci_device; extern const device_t mach32_onboard_pci_device; /* ATi Mach64 */ extern const device_t mach64gx_isa_device; extern const device_t mach64gx_vlb_device; extern const device_t mach64gx_pci_device; extern const device_t mach64vt2_device; /* ATi 18800 */ extern const device_t ati18800_wonder_device; extern const device_t ati18800_vga88_device; extern const device_t ati18800_device; /* ATi 28800 */ extern const device_t ati28800_device; extern const device_t ati28800k_device; extern const device_t ati28800k_spc4620p_device; extern const device_t ati28800k_spc6033p_device; extern const device_t compaq_ati28800_device; # ifdef USE_XL24 extern const device_t ati28800_wonderxl24_device; # endif /* USE_XL24 */ /* Bochs */ extern const device_t bochs_svga_device; /* Chips & Technologies */ extern const device_t chips_69000_device; extern const device_t chips_69000_onboard_device; /* Cirrus Logic GD54xx */ extern const device_t gd5401_isa_device; extern const device_t gd5402_isa_device; extern const device_t gd5402_onboard_device; extern const device_t gd5420_isa_device; extern const device_t gd5422_isa_device; extern const device_t gd5424_vlb_device; extern const device_t gd5426_isa_device; extern const device_t gd5426_diamond_speedstar_pro_a1_isa_device; extern const device_t gd5426_vlb_device; extern const device_t gd5426_onboard_device; extern const device_t gd5428_isa_device; extern const device_t gd5428_vlb_onboard_device; extern const device_t gd5428_vlb_device; extern const device_t gd5428_diamond_speedstar_pro_b1_vlb_device; extern const device_t gd5428_boca_isa_device; extern const device_t gd5428_mca_device; extern const device_t gd5426_mca_device; extern const device_t gd5428_onboard_device; extern const device_t gd5429_isa_device; extern const device_t gd5429_vlb_device; extern const device_t gd5430_diamond_speedstar_pro_se_a8_vlb_device; extern const device_t gd5430_vlb_device; extern const device_t gd5430_onboard_vlb_device; extern const device_t gd5430_pci_device; extern const device_t gd5430_onboard_pci_device; extern const device_t gd5434_isa_device; extern const device_t gd5434_diamond_speedstar_64_a3_isa_device; extern const device_t gd5434_onboard_pci_device; extern const device_t gd5434_vlb_device; extern const device_t gd5434_pci_device; extern const device_t gd5436_pci_device; extern const device_t gd5436_onboard_pci_device; extern const device_t gd5440_pci_device; extern const device_t gd5440_onboard_pci_device; extern const device_t gd5446_pci_device; extern const device_t gd5446_stb_pci_device; extern const device_t gd5480_pci_device; /* Compaq CGA */ extern const device_t compaq_cga_device; extern const device_t compaq_cga_2_device; /* Olivetti OGC */ extern const device_t ogc_device; extern const device_t ogc_m24_device; /* Chips & Technologies 82C425 */ extern const device_t f82c425_video_device; /* NCR NGA */ extern const device_t nga_device; /* Tseng ET3000AX */ extern const device_t et3000_isa_device; /* Tseng ET4000AX */ extern const device_t et4000_tc6058af_isa_device; extern const device_t et4000_isa_device; extern const device_t et4000k_isa_device; extern const device_t et4000k_tg286_isa_device; extern const device_t et4000_kasan_isa_device; extern const device_t et4000_mca_device; /* Tseng ET4000-W32x */ extern const device_t et4000w32_device; extern const device_t et4000w32_onboard_device; extern const device_t et4000w32i_isa_device; extern const device_t et4000w32i_vlb_device; extern const device_t et4000w32p_videomagic_revb_vlb_device; extern const device_t et4000w32p_videomagic_revb_pci_device; extern const device_t et4000w32p_revc_vlb_device; extern const device_t et4000w32p_revc_pci_device; extern const device_t et4000w32p_vlb_device; extern const device_t et4000w32p_pci_device; extern const device_t et4000w32p_noncardex_vlb_device; extern const device_t et4000w32p_noncardex_pci_device; extern const device_t et4000w32p_cardex_vlb_device; extern const device_t et4000w32p_cardex_pci_device; /* MDSI Genius VHR */ extern const device_t genius_device; /* Hercules */ extern const device_t hercules_device; extern const device_t herculesplus_device; extern const device_t incolor_device; /* Headland GC-2xx/HT-2xx */ extern const device_t g2_gc205_device; extern const device_t v7_vga_1024i_device; extern const device_t radius_svga_multiview_isa_device; extern const device_t radius_svga_multiview_mca_device; extern const device_t ht216_32_pb410a_device; extern const device_t ht216_32_standalone_device; /* Professional Graphics Controller */ extern const device_t im1024_device; extern const device_t pgc_device; /* Matrox MGA */ extern const device_t millennium_device; extern const device_t mystique_device; extern const device_t mystique_220_device; extern const device_t millennium_ii_device; #ifdef USE_G100 extern const device_t productiva_g100_device; #endif /* USE_G100 */ /* Oak OTI-0x7 */ extern const device_t oti037c_device; extern const device_t oti067_device; extern const device_t oti067_acer386_device; extern const device_t oti067_ama932j_device; extern const device_t oti077_acer100t_device; extern const device_t oti077_device; /* Paradise/WD (S)VGA */ extern const device_t paradise_pvga1a_ncr3302_device; extern const device_t paradise_pvga1a_pc2086_device; extern const device_t paradise_pvga1a_pc3086_device; extern const device_t paradise_pvga1a_device; extern const device_t paradise_wd90c11_megapc_device; extern const device_t paradise_wd90c11_device; extern const device_t paradise_wd90c30_device; /* Realtek (S)VGA */ extern const device_t realtek_rtg3105_device; extern const device_t realtek_rtg3106_device; /* S3 9XX/8XX/Vision/Trio */ extern const device_t s3_orchid_86c911_isa_device; extern const device_t s3_diamond_stealth_vram_isa_device; extern const device_t s3_ami_86c924_isa_device; extern const device_t s3_metheus_86c928_isa_device; extern const device_t s3_metheus_86c928_vlb_device; extern const device_t s3_spea_mercury_lite_86c928_pci_device; extern const device_t s3_spea_mirage_86c801_isa_device; extern const device_t s3_86c805_onboard_vlb_device; extern const device_t s3_spea_mirage_86c805_vlb_device; extern const device_t s3_mirocrystal_8s_805_vlb_device; extern const device_t s3_mirocrystal_10sd_805_vlb_device; extern const device_t s3_phoenix_86c801_isa_device; extern const device_t s3_phoenix_86c805_vlb_device; extern const device_t s3_bahamas64_vlb_device; extern const device_t s3_bahamas64_pci_device; extern const device_t s3_9fx_vlb_device; extern const device_t s3_9fx_pci_device; extern const device_t s3_phoenix_trio32_onboard_vlb_device; extern const device_t s3_phoenix_trio32_vlb_device; extern const device_t s3_phoenix_trio32_onboard_pci_device; extern const device_t s3_phoenix_trio32_pci_device; extern const device_t s3_diamond_stealth_se_vlb_device; extern const device_t s3_diamond_stealth_se_pci_device; extern const device_t s3_spea_mirage_p64_vlb_device; extern const device_t s3_phoenix_trio64_vlb_device; extern const device_t s3_phoenix_trio64_onboard_pci_device; extern const device_t s3_phoenix_trio64_pci_device; extern const device_t s3_stb_powergraph_64_video_vlb_device; extern const device_t s3_phoenix_trio64vplus_pci_device; extern const device_t s3_phoenix_trio64vplus_onboard_pci_device; extern const device_t s3_cardex_trio64vplus_pci_device; extern const device_t s3_mirocrystal_20sv_964_vlb_device; extern const device_t s3_mirocrystal_20sv_964_pci_device; extern const device_t s3_mirocrystal_20sd_864_vlb_device; extern const device_t s3_phoenix_vision864_pci_device; extern const device_t s3_phoenix_vision864_vlb_device; extern const device_t s3_9fx_531_pci_device; extern const device_t s3_phoenix_vision868_pci_device; extern const device_t s3_diamond_stealth64_pci_device; extern const device_t s3_diamond_stealth64_vlb_device; extern const device_t s3_diamond_stealth64_964_pci_device; extern const device_t s3_diamond_stealth64_964_vlb_device; extern const device_t s3_diamond_stealth64_968_pci_device; extern const device_t s3_diamond_stealth64_968_vlb_device; extern const device_t s3_mirovideo_40sv_ergo_968_pci_device; extern const device_t s3_9fx_771_pci_device; extern const device_t s3_phoenix_vision968_pci_device; extern const device_t s3_spea_mercury_p64v_pci_device; extern const device_t s3_elsa_winner2000_pro_x_964_pci_device; extern const device_t s3_elsa_winner2000_pro_x_pci_device; extern const device_t s3_trio64v2_dx_pci_device; extern const device_t s3_trio64v2_dx_onboard_pci_device; /* S3 ViRGE */ extern const device_t s3_virge_325_pci_device; extern const device_t s3_diamond_stealth_2000_pci_device; extern const device_t s3_diamond_stealth_3000_pci_device; extern const device_t s3_stb_velocity_3d_pci_device; extern const device_t s3_virge_375_pci_device; extern const device_t s3_virge_375_onboard_pci_device; extern const device_t s3_diamond_stealth_2000pro_pci_device; extern const device_t s3_virge_385_pci_device; extern const device_t s3_virge_357_pci_device; extern const device_t s3_virge_357_agp_device; extern const device_t s3_diamond_stealth_4000_pci_device; extern const device_t s3_diamond_stealth_4000_agp_device; extern const device_t s3_trio3d2x_pci_device; extern const device_t s3_trio3d2x_agp_device; /* Sigma Color 400 */ extern const device_t sigma_device; /* Trident TGUI 94x0 */ extern const device_t tgui9400cxi_device; extern const device_t tgui9440_vlb_device; extern const device_t tgui9440_pci_device; extern const device_t tgui9440_onboard_pci_device; extern const device_t tgui9660_pci_device; extern const device_t tgui9660_onboard_pci_device; extern const device_t tgui9680_pci_device; /* IBM PS/1 (S)VGA */ extern const device_t ibm_ps1_2121_device; /* Trident TVGA 8900 */ extern const device_t tvga8900b_device; extern const device_t tvga8900d_device; extern const device_t tvga8900dr_device; extern const device_t tvga9000b_device; extern const device_t nec_sv9000_device; /* IBM VGA */ extern const device_t vga_device; extern const device_t ps1vga_device; extern const device_t ps1vga_mca_device; /* 3DFX Voodoo Graphics */ extern const device_t voodoo_device; extern const device_t voodoo_banshee_device; extern const device_t creative_voodoo_banshee_device; extern const device_t voodoo_3_1000_device; extern const device_t voodoo_3_1000_agp_device; extern const device_t voodoo_3_2000_device; extern const device_t voodoo_3_2000_agp_device; extern const device_t voodoo_3_2000_agp_onboard_8m_device; extern const device_t voodoo_3_3000_device; extern const device_t voodoo_3_3000_agp_device; extern const device_t voodoo_3_3500_agp_ntsc_device; extern const device_t voodoo_3_3500_agp_pal_device; extern const device_t compaq_voodoo_3_3500_agp_device; extern const device_t voodoo_3_3500_se_agp_device; extern const device_t voodoo_3_3500_si_agp_device; extern const device_t velocity_100_agp_device; extern const device_t velocity_200_agp_device; /* Wyse 700 */ extern const device_t wy700_device; #endif #endif /*EMU_VIDEO_H*/ ```
/content/code_sandbox/src/include/86box/video.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
5,965
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Emulation of the 8514/A-compatible Mach8 and Mach32 graphics * chips from ATI for the ISA/VLB/MCA/PCI buses. * * * * Authors: TheCollector1995. * */ #ifndef VIDEO_ATI_MACH8_H #define VIDEO_ATI_MACH8_H typedef struct mach_t { ati_eeprom_t eeprom; svga_t svga; rom_t bios_rom; rom_t bios_rom2; mem_mapping_t mmio_linear_mapping; int mca_bus; int pci_bus; int vlb_bus; int has_bios; uint8_t regs[256]; uint8_t pci_regs[256]; uint8_t int_line; uint8_t pci_slot; uint8_t irq_state; int index; int ramdac_type; int old_mode; uint32_t memory; uint16_t config1; uint16_t config2; uint8_t pos_regs[8]; uint8_t pci_cntl_reg; uint8_t cursor_col_0; uint8_t cursor_col_1; uint8_t ext_cur_col_0_r; uint8_t ext_cur_col_1_r; uint8_t ext_cur_col_0_g; uint8_t ext_cur_col_1_g; uint16_t cursor_col_0_rg; uint16_t cursor_col_1_rg; uint16_t cursor_col_b; uint16_t cursor_offset_lo; uint16_t cursor_offset_lo_reg; uint16_t cursor_offset_hi; uint16_t cursor_offset_hi_reg; uint16_t cursor_vh_offset; uint16_t cursor_x; uint16_t cursor_y; uint16_t misc; uint16_t memory_aperture; uint16_t local_cntl; uint32_t linear_base; uint8_t ap_size; uint8_t bank_w; uint8_t bank_r; uint16_t shadow_set; uint16_t shadow_cntl; int ext_on[2]; int extended_mode; int compat_mode; struct { uint8_t line_idx; int16_t line_array[6]; uint8_t patt_idx; uint8_t patt_len; uint8_t pix_trans[2]; uint8_t eeprom_control; uint16_t dest_x_end; uint16_t dest_x_start; uint16_t dest_y_end; uint16_t src_x_end; uint16_t src_x_start; uint16_t src_x; uint16_t src_y; int16_t bres_count; uint16_t clock_sel; uint16_t crt_pitch; uint16_t ge_pitch; uint16_t dest_cmp_fn; uint16_t dp_config; uint16_t ext_ge_config; uint16_t ge_offset_lo; uint16_t ge_offset_hi; uint16_t linedraw_opt; uint16_t max_waitstates; uint8_t patt_data_idx; uint8_t patt_data[0x18]; uint16_t scan_to_x; uint16_t scratch0; uint16_t scratch1; uint16_t test; uint16_t pattern; uint16_t test2; int src_y_dir; int cmd_type; int block_write_mono_pattern_enable; int mono_pattern_enable; int16_t cx_end_line; int16_t cy_end_line; int16_t cx; int16_t cx_end; int16_t cy_end; int16_t dx; int16_t dx_end; int16_t dy; int16_t dy_end; int16_t dx_start; int16_t dy_start; int16_t cy; int16_t sx_start; int16_t sx_end; int16_t sx; int16_t x_count; int16_t xx_count; int16_t xxx_count; int16_t sy; int16_t y_count; int16_t err; int16_t width; int16_t src_width; int16_t height; int16_t bleft, bright, btop, bbottom; int poly_src; int temp_cnt; int stepx; int stepy; int src_stepx; uint8_t color_pattern[16]; uint8_t color_pattern_full[32]; uint16_t color_pattern_word[8]; int mono_pattern[8][8]; uint32_t ge_offset; uint32_t crt_offset; uint32_t patt_len_reg; int poly_fill; uint16_t dst_clr_cmp_mask; int clip_overrun; int color_pattern_idx; } accel; atomic_int force_busy; } mach_t; #endif /*VIDEO_ATI_MACH8_H*/ ```
/content/code_sandbox/src/include/86box/vid_ati_mach8.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,170
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of a port 80h POST diagnostic card. * * * * Authors: RichardG, <richardg867@gmail.com> * */ #ifndef POSTCARD_H #define POSTCARD_H #ifdef __cplusplus extern "C" { #endif /* Global variables. */ extern const device_t postcard_device; /* Functions. */ #ifdef __cplusplus } #endif #endif /*POSTCARD_H*/ ```
/content/code_sandbox/src/include/86box/postcard.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
154
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for ISA Plug and Play. * * * * Authors: RichardG, <richardg867@gmail.com> * */ #ifndef EMU_ISAPNP_H #define EMU_ISAPNP_H #include <stdint.h> #define ISAPNP_MEM_DISABLED 0 #define ISAPNP_IO_DISABLED 0 #define ISAPNP_IRQ_DISABLED 0 #define ISAPNP_DMA_DISABLED 4 enum { ISAPNP_CARD_DISABLE = 0, ISAPNP_CARD_ENABLE = 1, ISAPNP_CARD_FORCE_CONFIG = 2, /* cheat code for UMC UM8669F */ ISAPNP_CARD_NO_KEY = 3 /* cheat code for Crystal CS423x */ }; typedef struct isapnp_device_config_t { uint8_t activate; struct pnp_mem_t { uint32_t base : 24; uint32_t size : 24; } mem[4]; struct pnp_mem32_t { uint32_t base; uint32_t size; } mem32[4]; struct pnp_io_t { uint16_t base; } io[8]; struct pnp_irq_t { uint8_t irq : 4; uint8_t level : 1; uint8_t type : 1; } irq[2]; struct pnp_dma_t { uint8_t dma : 3; } dma[2]; } isapnp_device_config_t; extern const uint8_t isapnp_init_key[32]; void *isapnp_add_card(uint8_t *rom, uint16_t rom_size, void (*config_changed)(uint8_t ld, isapnp_device_config_t *config, void *priv), void (*csn_changed)(uint8_t csn, void *priv), uint8_t (*read_vendor_reg)(uint8_t ld, uint8_t reg, void *priv), void (*write_vendor_reg)(uint8_t ld, uint8_t reg, uint8_t val, void *priv), void *priv); void isapnp_update_card_rom(void *priv, uint8_t *rom, uint16_t rom_size); void isapnp_enable_card(void *priv, uint8_t enable); void isapnp_set_csn(void *priv, uint8_t csn); uint8_t isapnp_read_reg(void *priv, uint8_t ldn, uint8_t reg); void isapnp_write_reg(void *priv, uint8_t ldn, uint8_t reg, uint8_t val); void isapnp_set_device_defaults(void *priv, uint8_t ldn, const isapnp_device_config_t *config); void isapnp_reset_card(void *priv); void isapnp_reset_device(void *priv, uint8_t ld); #endif /*EMU_ISAPNP_H*/ ```
/content/code_sandbox/src/include/86box/isapnp.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
686
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * SVGA renderers. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * */ #ifndef VIDEO_SVGA_RENDER_H #define VIDEO_SVGA_RENDER_H extern int firstline_draw; extern int lastline_draw; extern int displine; extern int sc; extern uint32_t ma; extern uint32_t ca; extern int con; extern int cursoron; extern int cgablink; extern int scrollcache; extern uint8_t edatlookup[4][4]; extern uint8_t egaremap2bpp[256]; extern void svga_recalc_remap_func(svga_t *svga); extern void svga_render_null(svga_t *svga); extern void svga_render_blank(svga_t *svga); extern void svga_render_overscan_left(svga_t *svga); extern void svga_render_overscan_right(svga_t *svga); extern void svga_render_text_40(svga_t *svga); extern void svga_render_text_80(svga_t *svga); extern void svga_render_text_80_ksc5601(svga_t *svga); extern void svga_render_2bpp_lowres(svga_t *svga); extern void svga_render_2bpp_highres(svga_t *svga); extern void svga_render_2bpp_s3_lowres(svga_t *svga); extern void svga_render_2bpp_s3_highres(svga_t *svga); extern void svga_render_2bpp_headland_highres(svga_t *svga); extern void svga_render_4bpp_lowres(svga_t *svga); extern void svga_render_4bpp_highres(svga_t *svga); extern void svga_render_8bpp_lowres(svga_t *svga); extern void svga_render_8bpp_highres(svga_t *svga); extern void svga_render_8bpp_clone_highres(svga_t *svga); extern void svga_render_8bpp_tseng_lowres(svga_t *svga); extern void svga_render_8bpp_tseng_highres(svga_t *svga); extern void svga_render_8bpp_gs_lowres(svga_t *svga); extern void svga_render_8bpp_gs_highres(svga_t *svga); extern void svga_render_8bpp_rgb_lowres(svga_t *svga); extern void svga_render_8bpp_rgb_highres(svga_t *svga); extern void svga_render_15bpp_lowres(svga_t *svga); extern void svga_render_15bpp_highres(svga_t *svga); extern void svga_render_15bpp_mix_lowres(svga_t *svga); extern void svga_render_15bpp_mix_highres(svga_t *svga); extern void svga_render_16bpp_lowres(svga_t *svga); extern void svga_render_16bpp_highres(svga_t *svga); extern void svga_render_24bpp_lowres(svga_t *svga); extern void svga_render_24bpp_highres(svga_t *svga); extern void svga_render_32bpp_lowres(svga_t *svga); extern void svga_render_32bpp_highres(svga_t *svga); extern void svga_render_ABGR8888_lowres(svga_t *svga); extern void svga_render_ABGR8888_highres(svga_t *svga); extern void svga_render_RGBA8888_lowres(svga_t *svga); extern void svga_render_RGBA8888_highres(svga_t *svga); extern void ibm8514_render_blank(svga_t *svga); extern void ibm8514_render_8bpp(svga_t *svga); extern void ibm8514_render_15bpp(svga_t *svga); extern void ibm8514_render_16bpp(svga_t *svga); extern void ibm8514_render_24bpp(svga_t *svga); extern void ibm8514_render_BGR(svga_t *svga); extern void ibm8514_render_32bpp(svga_t *svga); extern void ibm8514_render_ABGR8888(svga_t *svga); extern void ibm8514_render_RGBA8888(svga_t *svga); extern void (*svga_render)(svga_t *svga); #endif /*VID_SVGA_RENDER_H*/ ```
/content/code_sandbox/src/include/86box/vid_svga_render.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,029
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the NEC uPD-765 and compatible floppy disk * controller. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_FDC_EXT_H #define EMU_FDC_EXT_H #define FDC_MAX 2 extern int fdc_current[FDC_MAX]; /* Controller types. */ #define FDC_NONE 0 #define FDC_INTERNAL 1 extern const device_t fdc_b215_device; extern const device_t fdc_pii151b_device; extern const device_t fdc_pii158b_device; extern const device_t fdc_monster_device; extern void fdc_card_init(void); extern const char *fdc_card_get_internal_name(int card); extern int fdc_card_get_from_internal_name(char *s); extern const device_t *fdc_card_getdevice(int card); extern int fdc_card_has_config(int card); extern int fdc_card_available(int card); #endif /*EMU_FDC_EXT_H*/ ```
/content/code_sandbox/src/include/86box/fdc_ext.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
308
```objective-c /* * VARCem Virtual ARchaeological Computer EMulator. * An emulator of (mostly) x86-based PC systems and devices, * using the ISA,EISA,VLB,MCA and PCI system buses, roughly * spanning the era between 1981 and 1995. * * Definitions for the network module. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the * following conditions are met: * * 1. Redistributions of source code must retain the entire * above notice, this list of conditions and the following * disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names * of its contributors may be used to endorse or promote * products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef EMU_NETWORK_H #define EMU_NETWORK_H #include <stdint.h> /* Network provider types. */ #define NET_TYPE_NONE 0 /* use the null network driver */ #define NET_TYPE_SLIRP 1 /* use the SLiRP port forwarder */ #define NET_TYPE_PCAP 2 /* use the (Win)Pcap API */ #define NET_TYPE_VDE 3 /* use the VDE plug API */ #define NET_MAX_FRAME 1518 /* Queue size must be a power of 2 */ #define NET_QUEUE_LEN 16 #define NET_QUEUE_LEN_MASK (NET_QUEUE_LEN - 1) #define NET_QUEUE_COUNT 3 #define NET_CARD_MAX 4 #define NET_HOST_INTF_MAX 64 #define NET_PERIOD_10M 0.8 #define NET_PERIOD_100M 0.08 /* Error buffers for network driver init */ #define NET_DRV_ERRBUF_SIZE 384 enum { NET_LINK_DOWN = (1 << 1), NET_LINK_TEMP_DOWN = (1 << 2), NET_LINK_10_HD = (1 << 3), NET_LINK_10_FD = (1 << 4), NET_LINK_100_HD = (1 << 5), NET_LINK_100_FD = (1 << 6), NET_LINK_1000_HD = (1 << 7), NET_LINK_1000_FD = (1 << 8), }; enum { NET_NONE = 0, NET_INTERNAL }; enum { NET_QUEUE_RX = 0, NET_QUEUE_TX_VM = 1, NET_QUEUE_TX_HOST = 2 }; typedef struct netcard_conf_t { uint16_t device_num; int net_type; char host_dev_name[128]; uint32_t link_state; } netcard_conf_t; extern netcard_conf_t net_cards_conf[NET_CARD_MAX]; extern uint16_t net_card_current; typedef int (*NETRXCB)(void *, uint8_t *, int); typedef int (*NETSETLINKSTATE)(void *, uint32_t link_state); typedef struct netpkt { uint8_t *data; int len; } netpkt_t; typedef struct netqueue_t { netpkt_t packets[NET_QUEUE_LEN]; int head; int tail; } netqueue_t; typedef struct _netcard_t netcard_t; typedef struct netdrv_t { void (*notify_in)(void *priv); void *(*init)(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf); void (*close)(void *priv); void *priv; } netdrv_t; extern const netdrv_t net_pcap_drv; extern const netdrv_t net_slirp_drv; extern const netdrv_t net_vde_drv; extern const netdrv_t net_null_drv; struct _netcard_t { const device_t *device; void *card_drv; struct netdrv_t host_drv; NETRXCB rx; NETSETLINKSTATE set_link_state; netqueue_t queues[NET_QUEUE_COUNT]; netpkt_t queued_pkt; mutex_t *tx_mutex; mutex_t *rx_mutex; pc_timer_t timer; uint16_t card_num; double byte_period; uint32_t led_timer; uint32_t led_state; uint32_t link_state; }; typedef struct { char device[128]; char description[128]; } netdev_t; typedef struct { int has_slirp; int has_pcap; int has_vde; } network_devmap_t; #define HAS_NOSLIRP_NET(x) (x.has_pcap || x.has_vde) #ifdef __cplusplus extern "C" { #endif /* Global variables. */ extern int nic_do_log; // config extern network_devmap_t network_devmap; extern int network_ndev; // Number of pcap devices extern network_devmap_t network_devmap; // Bitmap of available network types extern netdev_t network_devs[NET_HOST_INTF_MAX]; /* Function prototypes. */ extern void network_init(void); extern netcard_t *network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_link_state); extern void netcard_close(netcard_t *card); extern void network_close(void); extern void network_reset(void); extern int network_available(void); extern void network_tx(netcard_t *card, uint8_t *, int); extern int net_pcap_prepare(netdev_t *); extern int net_vde_prepare(void); extern void network_connect(int id, int connect); extern int network_is_connected(int id); extern int network_dev_available(int); extern int network_dev_to_id(char *); extern int network_card_available(int); extern int network_card_has_config(int); extern const char *network_card_get_internal_name(int); extern int network_card_get_from_internal_name(char *); #ifdef EMU_DEVICE_H extern const device_t *network_card_getdevice(int); #endif extern int network_tx_pop(netcard_t *card, netpkt_t *out_pkt); extern int network_tx_popv(netcard_t *card, netpkt_t *pkt_vec, int vec_size); extern int network_rx_put(netcard_t *card, uint8_t *bufp, int len); extern int network_rx_put_pkt(netcard_t *card, netpkt_t *pkt); #ifdef EMU_DEVICE_H /* 3Com Etherlink */ extern const device_t threec501_device; extern const device_t threec503_device; /* Novell NE2000 and compatibles */ extern const device_t ne1000_device; extern const device_t ne1000_compat_device; extern const device_t ne2000_device; extern const device_t ne2000_compat_device; extern const device_t ne2000_compat_8bit_device; extern const device_t ethernext_mc_device; extern const device_t rtl8019as_device; extern const device_t de220p_device; extern const device_t rtl8029as_device; /* AMD PCnet*/ extern const device_t pcnet_am79c960_device; extern const device_t pcnet_am79c960_eb_device; extern const device_t pcnet_am79c960_vlb_device; extern const device_t pcnet_am79c961_device; extern const device_t pcnet_am79c970a_device; extern const device_t pcnet_am79c973_device; extern const device_t pcnet_am79c973_onboard_device; /* Modem */ extern const device_t modem_device; /* PLIP */ #ifdef EMU_LPT_H extern const lpt_device_t lpt_plip_device; #endif extern const device_t plip_device; /* Realtek RTL8139C+ */ extern const device_t rtl8139c_plus_device; /* DEC Tulip */ extern const device_t dec_tulip_device; extern const device_t dec_tulip_21140_device; extern const device_t dec_tulip_21140_vpc_device; extern const device_t dec_tulip_21040_device; /* WD 80x3 */ extern const device_t wd8003e_device; extern const device_t wd8003eb_device; extern const device_t wd8013ebt_device; extern const device_t wd8003eta_device; extern const device_t wd8003ea_device; extern const device_t wd8013epa_device; #endif #ifdef __cplusplus } #endif #endif /*EMU_NETWORK_H*/ ```
/content/code_sandbox/src/include/86box/network.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
2,087
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * Emulation of the AMD PCnet LANCE NIC controller for both the ISA * and PCI buses. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * TheCollector1995, <mariogplayer@gmail.com> * Antony T Curtis * */ #ifndef NET_PCNET_H #define NET_PCNET_H enum { DEV_NONE = 0, DEV_AM79C960 = 1, /* PCnet-ISA (ISA, 10 Mbps, NE2100/NE1500T compatible) */ DEV_AM79C960_EB = 2, /* PCnet-ISA (ISA, 10 Mbps, Racal InterLan EtherBlaster compatible) */ DEV_AM79C960_VLB = 3, /* PCnet-VLB (VLB, 10 Mbps, NE2100/NE1500T compatible) */ DEV_AM79C961 = 4, /* PCnet-ISA+ (ISA, 10 Mbps, NE2100/NE1500T compatible, Plug and Play) */ DEV_AM79C970A = 5, /* PCnet-PCI II (PCI, 10 Mbps) */ DEV_AM79C973 = 6 /* PCnet-FAST III (PCI, 10/100 Mbps) */ }; #endif /*NET_PCNET_H*/ ```
/content/code_sandbox/src/include/86box/net_pcnet.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
350
```objective-c #ifndef VIDEO_ATI_EEPROM_H #define VIDEO_ATI_EEPROM_H see COPYING for more details */ enum { EEPROM_IDLE, EEPROM_WAIT, EEPROM_OPCODE, EEPROM_INPUT, EEPROM_OUTPUT }; enum { EEPROM_OP_EW = 4, EEPROM_OP_WRITE = 5, EEPROM_OP_READ = 6, EEPROM_OP_ERASE = 7, EEPROM_OP_WRALMAIN = -1 }; enum { EEPROM_OP_EWDS = 0, EEPROM_OP_WRAL = 1, EEPROM_OP_ERAL = 2, EEPROM_OP_EWEN = 3 }; typedef struct ati_eeprom_t { uint16_t data[256]; int oldclk; int oldena; int opcode; int state; int count; int out; int wp; uint32_t dat; int type; int address; char fn[256]; } ati_eeprom_t; void ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type); void ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn); void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat); int ati_eeprom_read(ati_eeprom_t *eeprom); #endif /*VIDEO_ATI_EEPROM_H*/ ```
/content/code_sandbox/src/include/86box/vid_ati_eeprom.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
314
```objective-c #ifndef EMU_MACHINE_STATUS_H #define EMU_MACHINE_STATUS_H typedef struct dev_status_empty_active_t { atomic_bool_t empty; atomic_bool_t active; } dev_status_empty_active_t; typedef struct dev_status_active_t { atomic_bool_t active; } dev_status_active_t; typedef struct dev_status_empty_t { atomic_bool_t empty; } dev_status_empty_t; typedef struct machine_status_t { dev_status_empty_active_t fdd[FDD_NUM]; dev_status_empty_active_t cdrom[CDROM_NUM]; dev_status_empty_active_t zip[ZIP_NUM]; dev_status_empty_active_t mo[MO_NUM]; dev_status_empty_active_t cassette; dev_status_active_t hdd[HDD_BUS_USB]; dev_status_empty_active_t net[NET_CARD_MAX]; dev_status_empty_t cartridge[2]; } machine_status_t; extern machine_status_t machine_status; extern void machine_status_init(void); #endif /*EMU_MACHINE_STATUS_H*/ ```
/content/code_sandbox/src/include/86box/machine_status.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
202
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Emulation of the 8514/A card from IBM for the MCA bus and * generic ISA bus clones without vendor extensions. * * * * Authors: TheCollector1995 * */ #ifndef VIDEO_8514A_H #define VIDEO_8514A_H typedef struct hwcursor8514_t { int ena; int x; int y; int xoff; int yoff; int cur_xsize; int cur_ysize; int v_acc; int h_acc; uint32_t addr; uint32_t pitch; } hwcursor8514_t; typedef union { uint64_t q; uint32_t d[2]; uint16_t w[4]; uint8_t b[8]; } latch8514_t; typedef struct ibm8514_t { rom_t bios_rom; hwcursor8514_t hwcursor; hwcursor8514_t hwcursor_latch; uint8_t pos_regs[8]; char *rom_path; int force_old_addr; int type; int local; int bpp; int on[2]; int accel_bpp; uint32_t vram_size; uint32_t vram_mask; uint32_t pallook[512]; uint32_t bios_addr; PALETTE vgapal; uint8_t hwcursor_oddeven; uint8_t dac_mask; uint8_t dac_status; uint32_t *map8; int dac_addr; int dac_pos; int dac_r; int dac_g; int dac_b; int internal_pitch; int hwcursor_on; int modechange; uint64_t dispontime; uint64_t dispofftime; struct { uint16_t subsys_cntl; uint16_t setup_md; uint16_t advfunc_cntl; uint16_t cur_y; uint16_t cur_x; int16_t destx; int16_t desty; int16_t desty_axstp; int16_t destx_distp; int16_t err_term; int16_t maj_axis_pcnt; int16_t maj_axis_pcnt_no_limit; uint16_t cmd; uint16_t cmd_back; uint16_t short_stroke; uint16_t bkgd_color; uint16_t frgd_color; uint16_t wrt_mask; uint16_t rd_mask; uint16_t color_cmp; uint16_t bkgd_mix; uint16_t frgd_mix; uint16_t multifunc_cntl; uint16_t multifunc[16]; int16_t clip_left; int16_t clip_top; uint8_t pix_trans[2]; int poly_draw; int ssv_state; int x1; int x2; int x3; int y1; int y2; int sys_cnt; int sys_cnt2; int temp_cnt; int16_t cx; int16_t cx_back; int16_t cy; int16_t oldcx; int16_t oldcy; int16_t sx; int16_t sy; int16_t dx; int16_t dy; int16_t err; uint32_t src; uint32_t dest; uint32_t newsrc_blt; uint32_t newdest_blt; uint32_t newdest_in; uint32_t newdest_out; uint8_t *writemono; uint8_t *nibbleset; int x_count; int xx_count; int y_count; int input; int output; uint16_t cur_x_bit12; uint16_t cur_y_bit12; int ssv_len; uint8_t ssv_dir; uint8_t ssv_draw; int odd_in; int odd_out; uint16_t scratch; int fill_state; int xdir; int ydir; int linedraw; uint32_t ge_offset; } accel; uint16_t test; int vendor_mode[2]; int h_blankstart; int h_blank_end_val; int hblankstart; int hblank_end_val; int hblankend; int hblank_ext; int hblank_sub; int v_total_reg; int v_total; int dispend; int v_sync_start; int v_syncstart; int split; int h_disp; int h_total; int h_sync_width; int h_disp_time; int rowoffset; int dispon; int hdisp_on; int linecountff; int vc; int linepos; int oddeven; int cursoron; int blink; int scrollcache; int firstline; int lastline; int firstline_draw; int lastline_draw; int displine; int fullchange; uint32_t ma; uint32_t maback; uint8_t *vram; uint8_t *changedvram; uint8_t linedbl; uint8_t data_available; uint8_t data_available2; uint8_t rowcount; int hsync_start; int hsync_width; int htotal; int hdisp; int hdisped; int sc; int vsyncstart; int vsyncwidth; int vtotal; int v_disp; int vdisp; int disp_cntl; int interlace; uint8_t subsys_cntl; uint8_t subsys_stat; atomic_int force_busy; atomic_int force_busy2; int blitter_busy; uint64_t blitter_time; uint64_t status_time; int pitch; int ext_pitch; int ext_crt_pitch; int extensions; latch8514_t latch; } ibm8514_t; #endif /*VIDEO_8514A_H*/ ```
/content/code_sandbox/src/include/86box/vid_8514a.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,497
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the AMD PCscsi and Tekram DC-390 SCSI * controllers using the NCR 53c9x series of chips. * * * * * Authors: Fabrice Bellard (QEMU) * Herve Poussineau (QEMU) * TheCollector1995, <mariogplayer@gmail.com> * Miran Grca, <mgrca8@gmail.com> * */ #ifndef SCSI_PCSCSI_H #define SCSI_PCSCSI_H extern const device_t am53c974_pci_device; extern const device_t dc390_pci_device; extern const device_t ncr53c90a_mca_device; #endif /*SCSI_BUSLOGIC_H*/ ```
/content/code_sandbox/src/include/86box/scsi_pcscsi.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
219
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the HxC MFM image format. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_FLOPPY_MFM_H #define EMU_FLOPPY_MFM_H extern void mfm_seek(int drive, int track); extern void mfm_load(int drive, char *fn); extern void mfm_close(int drive); #endif /*EMU_FLOPPY_MFM_H*/ ```
/content/code_sandbox/src/include/86box/fdd_mfm.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
167
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the Toshiba T3100e system. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Miran Grca, <mgrca8@gmail.com> * John Elliott, <jce@seasip.info> * * * This program is free software; you can redistribute it and/or modify * (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 * * along with this program; if not, write to the: * * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307 * USA. */ #ifndef MACHINE_T3100E_H #define MACHINE_T3100E_H extern const device_t t3100e_device; extern void t3100e_notify_set(uint8_t value); extern void t3100e_display_set(uint8_t value); extern uint8_t t3100e_display_get(void); extern uint8_t t3100e_config_get(void); extern void t3100e_turbo_set(uint8_t value); extern uint8_t t3100e_mono_get(void); extern void t3100e_mono_set(uint8_t value); extern void t3100e_video_options_set(uint8_t options); extern void t3100e_display_set(uint8_t internal); #endif /*MACHINE_T3100E_H*/ ```
/content/code_sandbox/src/include/86box/m_at_t3100e.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
421
```objective-c #ifndef VIDEO_COLORPLUS_H #define VIDEO_COLORPLUS_H typedef struct colorplus_t { cga_t cga; uint8_t control; } colorplus_t; void colorplus_init(colorplus_t *colorplus); void colorplus_out(uint16_t addr, uint8_t val, void *priv); uint8_t colorplus_in(uint16_t addr, void *priv); void colorplus_write(uint32_t addr, uint8_t val, void *priv); uint8_t colorplus_read(uint32_t addr, void *priv); void colorplus_recalctimings(colorplus_t *colorplus); void colorplus_poll(void *priv); extern const device_t colorplus_device; #endif /*VIDEO_COLORPLUS_H*/ ```
/content/code_sandbox/src/include/86box/vid_colorplus.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
158
```objective-c #ifndef SOUND_SND_SB_DSP_H #define SOUND_SND_SB_DSP_H #include <86box/fifo.h> /*Sound Blaster Clones, for quirks*/ #define SB_SUBTYPE_DEFAULT 0 /* Handle as a Creative card */ #define SB_SUBTYPE_CLONE_AZT2316A_0X11 1 /* Aztech Sound Galaxy Pro 16 AB, DSP 3.1 - SBPRO2 clone */ #define SB_SUBTYPE_CLONE_AZT1605_0X0C 2 /* Aztech Sound Galaxy Nova 16 Extra / Packard Bell Forte 16, DSP 2.1 - SBPRO2 clone */ #define SB_SUBTYPE_ESS_ES688 3 /* ESS Technology ES688 */ #define SB_SUBTYPE_ESS_ES1688 4 /* ESS Technology ES1688 */ /* ESS-related */ #define IS_ESS(dsp) ((dsp)->sb_subtype >= SB_SUBTYPE_ESS_ES688) /* Check for future ESS cards here */ #define IS_NOT_ESS(dsp) ((dsp)->sb_subtype < SB_SUBTYPE_ESS_ES688) /* Check for future ESS cards here */ /* aztech-related */ #define IS_AZTECH(dsp) ((dsp)->sb_subtype == SB_SUBTYPE_CLONE_AZT2316A_0X11 || (dsp)->sb_subtype == SB_SUBTYPE_CLONE_AZT1605_0X0C) /* check for future AZT cards here */ #define AZTECH_EEPROM_SIZE 16 typedef struct sb_dsp_t { int sb_type; int sb_subtype; /* which clone */ void *parent; /* "sb_t *" if default subtype, "azt2316a_t *" if aztech. */ int sb_8_length; int sb_8_origlength; int sb_8_format; int sb_8_autoinit; int sb_8_pause; int sb_8_enable; int sb_8_autolen; int sb_8_output; int sb_8_dmanum; int sb_16_length; int sb_16_origlength; int sb_16_format; int sb_16_autoinit; int sb_16_pause; int sb_16_enable; int sb_16_autolen; int sb_16_output; int sb_16_dmanum; int sb_16_8_dmanum; int sb_16_dma_enabled; int sb_16_dma_supported; int sb_16_dma_translate; int sb_pausetime; int (*dma_readb)(void *priv); int (*dma_readw)(void *priv); int (*dma_writeb)(void *priv, uint8_t val); int (*dma_writew)(void *priv, uint16_t val); void *dma_priv; uint8_t sb_read_data[256]; uint8_t dma_ff; int dma_data; int sb_read_wp; int sb_read_rp; int sb_speaker; int muted; int sb_data_stat; int midi_in_sysex; int midi_in_poll; int uart_midi; int uart_irq; int onebyte_midi; int midi_in_timestamp; int sb_irqnum; void (*irq_update)(void *priv, int set); void *irq_priv; uint8_t sbe2; int sbe2count; uint8_t sb_data[8]; int sb_freq; int16_t sbdat; int sbdat2; int16_t sbdatl; int16_t sbdatr; uint8_t sbref; int8_t sbstep; uint8_t activity; int sbdacpos; int sbleftright; int sbleftright_default; int sbreset; uint8_t sbreaddat; uint8_t sb_command; uint8_t sb_test; int sb_timei; int sb_timeo; int sb_irq8; int sb_irq16; int sb_irq401; int sb_irqm8; int sb_irqm16; int sb_irqm401; uint8_t sb_has_real_opl; uint8_t sb_asp_regs[256]; uint8_t sb_asp_mode; uint8_t sb_asp_ram[2048]; int sb_asp_ram_index; uint8_t sb_8051_ram[256]; int sbenable; int sb_enable_i; int state; pc_timer_t output_timer; pc_timer_t input_timer; double sblatcho; double sblatchi; uint16_t sb_addr; int stereo; int asp_data_len; pc_timer_t wb_timer; int wb_full; pc_timer_t irq_timer; pc_timer_t irq16_timer; int busy_count; int record_pos_read; int record_pos_write; int16_t record_buffer[0xFFFF]; int16_t buffer[SOUNDBUFLEN * 2]; int pos; uint8_t azt_eeprom[AZTECH_EEPROM_SIZE]; /* the eeprom in the Aztech cards is attached to the DSP */ uint8_t ess_regs[256]; /* ESS registers. */ uint8_t ess_playback_mode; uint8_t ess_extended_mode; uint8_t ess_reload_len; uint32_t ess_dma_counter; /* IRQ status flags (0x22C) */ uint8_t ess_irq_generic; uint8_t ess_irq_dmactr; /* ESPCM */ fifo64_t *espcm_fifo; uint8_t espcm_fifo_reset; uint8_t espcm_mode; /* see ESPCM in "NON-PCM SAMPLE FORMATS" deflist in snd_sb_dsp.c */ uint8_t espcm_sample_idx; uint8_t espcm_range; uint8_t espcm_byte_buffer[4]; uint8_t espcm_code_buffer[19]; /* used for ESPCM_3 and for ESPCM_4 recording */ int8_t espcm_sample_buffer[19]; /* used for ESPCM_4 recording */ uint8_t espcm_table_index; /* used for ESPCM_3 */ uint8_t espcm_last_value; /* used for ESPCM_3 */ mpu_t *mpu; } sb_dsp_t; extern void sb_dsp_input_msg(void *priv, uint8_t *msg, uint32_t len); extern int sb_dsp_input_sysex(void *priv, uint8_t *buffer, uint32_t len, int abort); extern void sb_dsp_set_mpu(sb_dsp_t *dsp, mpu_t *src_mpu); extern void sb_dsp_init(sb_dsp_t *dsp, int type, int subtype, void *parent); extern void sb_dsp_close(sb_dsp_t *dsp); extern void sb_dsp_setirq(sb_dsp_t *dsp, int irq); extern void sb_dsp_setdma8(sb_dsp_t *dsp, int dma); extern void sb_dsp_setdma16(sb_dsp_t *dsp, int dma); extern void sb_dsp_setdma16_8(sb_dsp_t *dsp, int dma); extern void sb_dsp_setdma16_enabled(sb_dsp_t *dsp, int enabled); extern void sb_dsp_setdma16_supported(sb_dsp_t *dsp, int supported); extern void sb_dsp_setdma16_translate(sb_dsp_t *dsp, int translate); extern void sb_dsp_setaddr(sb_dsp_t *dsp, uint16_t addr); extern void sb_dsp_speed_changed(sb_dsp_t *dsp); extern void sb_dsp_poll(sb_dsp_t *dsp, int16_t *l, int16_t *r); extern void sb_dsp_set_real_opl(sb_dsp_t *dsp, uint8_t has_real_opl); extern void sb_dsp_set_stereo(sb_dsp_t *dsp, int stereo); extern void sb_dsp_update(sb_dsp_t *dsp); extern void sb_update_mask(sb_dsp_t *dsp, int irqm8, int irqm16, int irqm401); extern void sb_dsp_irq_attach(sb_dsp_t *dsp, void (*irq_update)(void *priv, int set), void *priv); extern void sb_dsp_dma_attach(sb_dsp_t *dsp, int (*dma_readb)(void *priv), int (*dma_readw)(void *priv), int (*dma_writeb)(void *priv, uint8_t val), int (*dma_writew)(void *priv, uint16_t val), void *priv); #endif /* SOUND_SND_SB_DSP_H */ ```
/content/code_sandbox/src/include/86box/snd_sb_dsp.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,906
```objective-c #ifndef SOUND_AZT2316A_H #define SOUND_AZT2316A_H extern void azt2316a_enable_wss(uint8_t enable, void *priv); #endif /*SOUND_AZT2316A*/ ```
/content/code_sandbox/src/include/86box/snd_azt2316a.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
50
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the NCR 5380 chip made by NCR * and used in various controllers. * * * * Authors: Sarah Walker, <path_to_url * TheCollector1995, <mariogplayer@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef SCSI_NCR5380_H #define SCSI_NCR5380_H #define NCR_CURDATA 0 /* current SCSI data (read only) */ #define NCR_OUTDATA 0 /* output data (write only) */ #define NCR_INITCOMMAND 1 /* initiator command (read/write) */ #define NCR_MODE 2 /* mode (read/write) */ #define NCR_TARGETCMD 3 /* target command (read/write) */ #define NCR_SELENABLE 4 /* select enable (write only) */ #define NCR_BUSSTATUS 4 /* bus status (read only) */ #define NCR_STARTDMA 5 /* start DMA send (write only) */ #define NCR_BUSANDSTAT 5 /* bus and status (read only) */ #define NCR_DMATARGET 6 /* DMA target (write only) */ #define NCR_INPUTDATA 6 /* input data (read only) */ #define NCR_DMAINIRECV 7 /* DMA initiator receive (write only) */ #define NCR_RESETPARITY 7 /* reset parity/interrupt (read only) */ #define ICR_DBP 0x01 #define ICR_ATN 0x02 #define ICR_SEL 0x04 #define ICR_BSY 0x08 #define ICR_ACK 0x10 #define ICR_ARB_LOST 0x20 #define ICR_ARB_IN_PROGRESS 0x40 #define MODE_ARBITRATE 0x01 #define MODE_DMA 0x02 #define MODE_MONITOR_BUSY 0x04 #define MODE_ENA_EOP_INT 0x08 #define STATUS_ACK 0x01 #define STATUS_BUSY_ERROR 0x04 #define STATUS_PHASE_MATCH 0x08 #define STATUS_INT 0x10 #define STATUS_DRQ 0x40 #define STATUS_END_OF_DMA 0x80 #define TCR_IO 0x01 #define TCR_CD 0x02 #define TCR_MSG 0x04 #define TCR_REQ 0x08 #define TCR_LAST_BYTE_SENT 0x80 #define STATE_IDLE 0 #define STATE_COMMAND 1 #define STATE_DATAIN 2 #define STATE_DATAOUT 3 #define STATE_STATUS 4 #define STATE_MESSAGEIN 5 #define STATE_SELECT 6 #define STATE_MESSAGEOUT 7 #define STATE_MESSAGE_ID 8 #define DMA_IDLE 0 #define DMA_SEND 1 #define DMA_INITIATOR_RECEIVE 2 typedef struct ncr_t { uint8_t icr; uint8_t mode; uint8_t tcr; uint8_t data_wait; uint8_t isr; uint8_t output_data; uint8_t target_id; uint8_t tx_data; uint8_t msglun; uint8_t irq_state; uint8_t command[20]; uint8_t msgout[4]; uint8_t bus; int msgout_pos; int is_msgout; int dma_mode; int cur_bus; int bus_in; int new_phase; int state; int clear_req; int wait_data; int wait_complete; int command_pos; int data_pos; int irq; double period; void *priv; void (*dma_mode_ext)(void *priv, void *ext_priv); int (*dma_send_ext)(void *priv, void *ext_priv); int (*dma_initiator_receive_ext)(void *priv, void *ext_priv); void (*timer)(void *ext_priv, double period); } ncr_t; extern int ncr5380_cmd_len[8]; extern void ncr5380_irq(ncr_t *ncr, int set_irq); extern void ncr5380_set_irq(ncr_t *ncr, int irq); extern uint32_t ncr5380_get_bus_host(ncr_t *ncr); extern void ncr5380_bus_read(ncr_t *ncr); extern void ncr5380_bus_update(ncr_t *ncr, int bus); extern void ncr5380_write(uint16_t port, uint8_t val, ncr_t *ncr); extern uint8_t ncr5380_read(uint16_t port, ncr_t *ncr); #ifdef EMU_DEVICE_H extern const device_t scsi_lcs6821n_device; extern const device_t scsi_pas_device; extern const device_t scsi_rt1000b_device; extern const device_t scsi_rt1000mc_device; extern const device_t scsi_t128_device; extern const device_t scsi_t228_device; extern const device_t scsi_t130b_device; extern const device_t scsi_ls2000_device; #endif #endif /*SCSI_NCR5380_H*/ ```
/content/code_sandbox/src/include/86box/scsi_ncr5380.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,215
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the NEC uPD-765 and compatible floppy disk * controller. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_FDC_H #define EMU_FDC_H #define FDC_PRIMARY_ADDR 0x03f0 #define FDC_PRIMARY_IRQ 6 #define FDC_PRIMARY_DMA 2 #define FDC_PRIMARY_PCJR_ADDR 0x00f0 #define FDC_PRIMARY_PCJR_IRQ 6 #define FDC_PRIMARY_PCJR_DMA 2 #define FDC_SECONDARY_ADDR 0x0370 #define FDC_SECONDARY_IRQ 6 #define FDC_SECONDARY_DMA 2 #define FDC_TERTIARY_ADDR 0x0360 #define FDC_TERTIARY_IRQ 6 #define FDC_TERTIARY_DMA 2 #define FDC_QUATERNARY_ADDR 0x03e0 #define FDC_QUATERNARY_IRQ 6 #define FDC_QUATERNARY_DMA 2 #define FDC_FLAG_PCJR 0x01 /* PCjr */ #define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */ #define FDC_FLAG_AT 0x04 /* AT+, PS/x */ #define FDC_FLAG_PS1 0x08 /* PS/1, PS/2 ISA */ #define FDC_FLAG_SUPERIO 0x10 /* Super I/O chips */ #define FDC_FLAG_START_RWC_1 0x20 /* W83877F, W83977F */ #define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */ #define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */ #define FDC_FLAG_TOSHIBA 0x100 /* T1000, T1200 */ #define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */ #define FDC_FLAG_UMC 0x400 /* UMC UM8398 */ #define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */ #define FDC_FLAG_NO_DSR_RESET 0x1000 /* Has no DSR reset */ #define FDC_FLAG_NEC 0x2000 /* Is NEC upd765-compatible */ #define FDC_FLAG_SEC 0x10000 /* Is Secondary */ #define FDC_FLAG_TER 0x20000 /* Is Tertiary */ #define FDC_FLAG_QUA 0x40000 /* Is Quaternary */ typedef struct fdc_t { uint8_t dor; uint8_t stat; uint8_t command; uint8_t processed_cmd; uint8_t dat; uint8_t st0; uint8_t swap; uint8_t dtl; uint8_t swwp; uint8_t disable_write; uint8_t st5; uint8_t st6; uint8_t error; uint8_t config; uint8_t pretrk; uint8_t power_down; uint8_t head; uint8_t lastdrive; uint8_t sector; uint8_t drive; uint8_t rate; uint8_t tc; uint8_t pnum; uint8_t ptot; uint8_t reset_stat; uint8_t seek_dir; uint8_t perp; uint8_t format_state; uint8_t format_n; uint8_t step; uint8_t noprec; uint8_t data_ready; uint8_t paramstogo; uint8_t enh_mode; uint8_t dma; uint8_t densel_polarity; uint8_t densel_force; uint8_t fifo; uint8_t tfifo; uint8_t fifobufpos; uint8_t drv2en; uint8_t gap; uint8_t enable_3f1; uint8_t format_sectors; uint8_t mfm; uint8_t deleted; uint8_t wrong_am; uint8_t sc; uint8_t fintr; uint8_t rw_drive; uint8_t lock; uint8_t dsr; uint8_t params[15]; uint8_t specify[2]; uint8_t res[11]; uint16_t eot[4]; uint8_t rwc[4]; uint16_t pcn[4]; uint16_t base_address; uint16_t rw_track; int bit_rate; /* Should be 250 at start. */ int bitcell_period; int boot_drive; int max_track; int satisfying_sectors; int flags; int interrupt; int irq; /* Should be 6 by default. */ int dma_ch; /* Should be 2 by default. */ int drvrate[4]; void *fifo_p; sector_id_t read_track_sector; sector_id_t format_sector_id; uint64_t watchdog_count; pc_timer_t timer; pc_timer_t watchdog_timer; } fdc_t; extern void fdc_remove(fdc_t *fdc); extern void fdc_poll(fdc_t *fdc); extern void fdc_abort(fdc_t *fdc); extern void fdc_set_dskchg_activelow(fdc_t *fdc); extern void fdc_3f1_enable(fdc_t *fdc, int enable); extern int fdc_get_bit_rate(fdc_t *fdc); extern int fdc_get_bitcell_period(fdc_t *fdc); /* A few functions to communicate between Super I/O chips and the FDC. */ extern void fdc_update_enh_mode(fdc_t *fdc, int enh_mode); extern int fdc_get_rwc(fdc_t *fdc, int drive); extern void fdc_update_rwc(fdc_t *fdc, int drive, int rwc); extern int fdc_get_boot_drive(fdc_t *fdc); extern void fdc_update_boot_drive(fdc_t *fdc, int boot_drive); extern void fdc_update_densel_polarity(fdc_t *fdc, int densel_polarity); extern uint8_t fdc_get_densel_polarity(fdc_t *fdc); extern void fdc_update_densel_force(fdc_t *fdc, int densel_force); extern void fdc_update_drvrate(fdc_t *fdc, int drive, int drvrate); extern void fdc_update_drv2en(fdc_t *fdc, int drv2en); extern void fdc_noidam(fdc_t *fdc); extern void fdc_nosector(fdc_t *fdc); extern void fdc_nodataam(fdc_t *fdc); extern void fdc_cannotformat(fdc_t *fdc); extern void fdc_wrongcylinder(fdc_t *fdc); extern void fdc_badcylinder(fdc_t *fdc); extern void fdc_writeprotect(fdc_t *fdc); extern void fdc_datacrcerror(fdc_t *fdc); extern void fdc_headercrcerror(fdc_t *fdc); extern void fdc_nosector(fdc_t *fdc); extern int real_drive(fdc_t *fdc, int drive); extern sector_id_t fdc_get_read_track_sector(fdc_t *fdc); extern int fdc_get_compare_condition(fdc_t *fdc); extern int fdc_is_deleted(fdc_t *fdc); extern int fdc_is_sk(fdc_t *fdc); extern void fdc_set_wrong_am(fdc_t *fdc); extern void fdc_set_power_down(fdc_t *fdc, uint8_t power_down); extern int fdc_get_drive(fdc_t *fdc); extern int fdc_get_perp(fdc_t *fdc); extern int fdc_get_format_n(fdc_t *fdc); extern int fdc_is_mfm(fdc_t *fdc); extern double fdc_get_hut(fdc_t *fdc); extern double fdc_get_hlt(fdc_t *fdc); extern void fdc_request_next_sector_id(fdc_t *fdc); extern void fdc_stop_id_request(fdc_t *fdc); extern int fdc_get_gap(fdc_t *fdc); extern int fdc_get_gap2(fdc_t *fdc, int drive); extern int fdc_get_dtl(fdc_t *fdc); extern int fdc_get_format_sectors(fdc_t *fdc); extern uint8_t fdc_get_swwp(fdc_t *fdc); extern void fdc_set_swwp(fdc_t *fdc, uint8_t swwp); extern uint8_t fdc_get_diswr(fdc_t *fdc); extern void fdc_set_diswr(fdc_t *fdc, uint8_t diswr); extern uint8_t fdc_get_swap(fdc_t *fdc); extern void fdc_set_swap(fdc_t *fdc, uint8_t swap); extern void fdc_finishcompare(fdc_t *fdc, int satisfying); extern void fdc_finishread(fdc_t *fdc); extern void fdc_sector_finishcompare(fdc_t *fdc, int satisfying); extern void fdc_sector_finishread(fdc_t *fdc); extern void fdc_track_finishread(fdc_t *fdc, int condition); extern int fdc_is_verify(fdc_t *fdc); extern void fdc_overrun(fdc_t *fdc); extern void fdc_set_base(fdc_t *fdc, int base); extern void fdc_set_irq(fdc_t *fdc, int irq); extern void fdc_set_dma_ch(fdc_t *fdc, int dma_ch); extern int fdc_getdata(fdc_t *fdc, int last); extern int fdc_data(fdc_t *fdc, uint8_t data, int last); extern void fdc_sectorid(fdc_t *fdc, uint8_t track, uint8_t side, uint8_t sector, uint8_t size, uint8_t crc1, uint8_t crc2); extern uint8_t fdc_read(uint16_t addr, void *priv); extern void fdc_reset(void *priv); extern uint8_t fdc_get_current_drive(void); #ifdef EMU_DEVICE_H extern const device_t fdc_xt_device; extern const device_t fdc_xt_sec_device; extern const device_t fdc_xt_ter_device; extern const device_t fdc_xt_qua_device; extern const device_t fdc_xt_t1x00_device; extern const device_t fdc_xt_tandy_device; extern const device_t fdc_xt_amstrad_device; extern const device_t fdc_pcjr_device; extern const device_t fdc_at_device; extern const device_t fdc_at_sec_device; extern const device_t fdc_at_ter_device; extern const device_t fdc_at_qua_device; extern const device_t fdc_at_actlow_device; extern const device_t fdc_at_ps1_device; extern const device_t fdc_at_ps1_2121_device; extern const device_t fdc_at_smc_device; extern const device_t fdc_at_ali_device; extern const device_t fdc_at_winbond_device; extern const device_t fdc_at_nsc_device; extern const device_t fdc_dp8473_device; extern const device_t fdc_um8398_device; #endif #endif /*EMU_FDC_H*/ ```
/content/code_sandbox/src/include/86box/fdc.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
2,568
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the generic SCSI device command handler. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef SCSI_DEVICE_H #define SCSI_DEVICE_H /* Configuration. */ #define SCSI_LUN_USE_CDB 0xff #ifdef WALTJE # define SCSI_TIME 50.0 #else # define SCSI_TIME 500.0 #endif /* Bits of 'status' */ #define ERR_STAT 0x01 #define DRQ_STAT 0x08 /* Data request */ #define DSC_STAT 0x10 #define SERVICE_STAT 0x10 #define READY_STAT 0x40 #define BUSY_STAT 0x80 /* Bits of 'error' */ #define ABRT_ERR 0x04 /* Command aborted */ #define MCR_ERR 0x08 /* Media change request */ /* SCSI commands. */ #define GPCMD_TEST_UNIT_READY 0x00 #define GPCMD_REZERO_UNIT 0x01 #define GPCMD_REQUEST_SENSE 0x03 #define GPCMD_FORMAT_UNIT 0x04 #define GPCMD_IOMEGA_SENSE 0x06 #define GPCMD_READ_6 0x08 #define GPCMD_WRITE_6 0x0a #define GPCMD_SEEK_6 0x0b #define GPCMD_IOMEGA_SET_PROTECTION_MODE 0x0c #define GPCMD_IOMEGA_EJECT 0x0d /* ATAPI only? */ #define GPCMD_NO_OPERATION_TOSHIBA 0x0d /* Toshiba Vendor Unique command */ #define GPCMD_NO_OPERATION_NEC 0x0d /* NEC Vendor Unique command */ #define GPCMD_INQUIRY 0x12 #define GPCMD_VERIFY_6 0x13 #define GPCMD_MODE_SELECT_6 0x15 #define GPCMD_SCSI_RESERVE 0x16 #define GPCMD_SCSI_RELEASE 0x17 #define GPCMD_MODE_SENSE_6 0x1a #define GPCMD_START_STOP_UNIT 0x1b #define GPCMD_SEND_DIAGNOSTIC 0x1d #define GPCMD_PREVENT_REMOVAL 0x1e #define GPCMD_READ_FORMAT_CAPACITIES 0x23 #define GPCMD_READ_CDROM_CAPACITY 0x25 #define GPCMD_UNKNOWN_CHINON 0x26 /*Chinon Vendor Unique command*/ #define GPCMD_READ_10 0x28 #define GPCMD_READ_GENERATION 0x29 #define GPCMD_WRITE_10 0x2a #define GPCMD_SEEK_10 0x2b #define GPCMD_ERASE_10 0x2c #define GPCMD_WRITE_AND_VERIFY_10 0x2e #define GPCMD_VERIFY_10 0x2f #define GPCMD_READ_BUFFER 0x3c #define GPCMD_WRITE_SAME_10 0x41 #define GPCMD_READ_SUBCHANNEL 0x42 #define GPCMD_READ_TOC_PMA_ATIP 0x43 #define GPCMD_READ_HEADER 0x44 #define GPCMD_PLAY_AUDIO_10 0x45 #define GPCMD_GET_CONFIGURATION 0x46 #define GPCMD_PLAY_AUDIO_MSF 0x47 #define GPCMD_PLAY_AUDIO_TRACK_INDEX 0x48 #define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10 0x49 #define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a #define GPCMD_PAUSE_RESUME 0x4b #define GPCMD_STOP_PLAY_SCAN 0x4e #define GPCMD_READ_DISC_INFORMATION 0x51 #define GPCMD_READ_TRACK_INFORMATION 0x52 #define GPCMD_MODE_SELECT_10 0x55 #define GPCMD_MODE_SENSE_10 0x5a #define GPCMD_PLAY_AUDIO_12 0xa5 #define GPCMD_READ_12 0xa8 #define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12 0xa9 #define GPCMD_WRITE_12 0xaa #define GPCMD_ERASE_12 0xac #define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */ #define GPCMD_WRITE_AND_VERIFY_12 0xae #define GPCMD_VERIFY_12 0xaf #define GPCMD_PLAY_CD_OLD 0xb4 #define GPCMD_READ_CD_OLD 0xb8 #define GPCMD_READ_CD_MSF 0xb9 #define GPCMD_AUDIO_SCAN 0xba #define GPCMD_SET_SPEED 0xbb #define GPCMD_PLAY_CD 0xbc #define GPCMD_MECHANISM_STATUS 0xbd #define GPCMD_READ_CD 0xbe #define GPCMD_SEND_DVD_STRUCTURE 0xbf /* This is for writing only, irrelevant to 86Box. */ #define GPCMD_EJECT_CHINON 0xc0 /* Chinon Vendor Unique command */ #define GPCMD_AUDIO_TRACK_SEARCH_TOSHIBA 0xc0 /* Toshiba Vendor Unique command */ #define GPCMD_UNKNOWN_SONY 0xc0 /* Sony Vendor Unique command */ #define GPCMD_PLAY_AUDIO_TOSHIBA 0xc1 /* Toshiba Vendor Unique command */ #define GPCMD_READ_TOC_SONY 0xc1 /* Sony Vendor Unique command */ #define GPCMD_PAUSE_RESUME_ALT 0xc2 #define GPCMD_READ_SUBCHANNEL_MATSUSHITA 0xc2 /* Matsushita Vendor Unique command */ #define GPCMD_READ_SUBCHANNEL_SONY 0xc2 /* Sony Vendor Unique command */ #define GPCMD_STILL_TOSHIBA 0xc2 /* Toshiba Vendor Unique command */ #define GPCMD_READ_TOC_MATSUSHITA 0xc3 /* Matsushita Vendor Unique command */ #define GPCMD_READ_HEADER_SONY 0xc3 /* Sony Vendor Unique command */ #define GPCMD_SET_STOP_TIME_TOSHIBA 0xc3 /* Toshiba Vendor Unique command */ #define GPCMD_READ_HEADER_MATSUSHITA 0xc4 /* Matsushita Vendor Unique command */ #define GPCMD_PLAYBACK_STATUS_TOSHIBA 0xc4 /* Sony Vendor Unique command */ #define GPCMD_CADDY_EJECT_TOSHIBA 0xc4 /* Toshiba Vendor Unique command */ #define GPCMD_PAUSE_SONY 0xc5 /* Sony Vendor Unique command */ #define GPCMD_PLAY_AUDIO_MATSUSHITA 0xc5 /* Matsushita Vendor Unique command */ #define GPCMD_STOP_CHINON 0xc6 /* Chinon Vendor Unique command */ #define GPCMD_PLAT_TRACK_SONY 0xc6 /* Sony Vendor Unique command */ #define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_TOSHIBA 0xc6 /* Toshiba Vendor Unique command */ #define GPCMD_PLAY_AUDIO_MSF_MATSUSHITA 0xc7 /* Matsushita Vendor Unique command*/ #define GPCMD_PLAY_MSF_SONY 0xc7 /* Sony Vendor Unique command*/ #define GPCMD_READ_DISC_INFORMATION_TOSHIBA 0xc7 /* Toshiba Vendor Unique command */ #define GPCMD_PLAY_AUDIO_TRACK_INDEX_MATSUSHITA 0xc8 /* Matsushita Vendor Unique command */ #define GPCMD_PLAY_AUDIO_SONY 0xc8 /* Sony Vendor Unique command */ #define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10_MATSUSHITA 0xc9 /*Matsushita Vendor Unique command */ #define GPCMD_PLAYBACK_CONTROL_SONY 0xc9 /* Sony Vendor Unique command */ #define GPCMD_PAUSE_RESUME_MATSUSHITA 0xcb /* Matsushita Vendor Unique command */ #define GPCMD_SCAN_PIONEER 0xcd /* Should be equivalent to 0xba */ #define GPCMD_AUDIO_TRACK_SEARCH_NEC 0xd8 /* NEC Vendor Unique command */ #define GPCMD_PLAY_AUDIO_NEC 0xd9 /* NEC Vendor Unique command */ #define GPCMD_STILL_NEC 0xda /* NEC Vendor Unique command */ #define GPCMD_SET_SPEED_ALT 0xda /* Should be equivalent to 0xbb */ #define GPCMD_SET_STOP_TIME_NEC 0xdb /* NEC Vendor Unique command */ #define GPCMD_CADDY_EJECT_NEC 0xdc /* NEC Vendor Unique command */ #define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_NEC 0xdd /* NEC Vendor Unique command */ #define GPCMD_READ_DISC_INFORMATION_NEC 0xde /* NEC Vendor Unique command */ #define GPCMD_PLAY_AUDIO_12_MATSUSHITA 0xe5 /* Matsushita Vendor Unique command */ #define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12_MATSUSHITA 0xe9 /* Matsushita Vendor Unique command */ /* Mode page codes for mode sense/set */ #define GPMODE_UNIT_ATN_PAGE 0x00 #define GPMODE_R_W_ERROR_PAGE 0x01 #define GPMODE_DISCONNECT_PAGE 0x02 /* Disconnect/reconnect page */ #define GPMODE_FORMAT_DEVICE_PAGE 0x03 #define GPMODE_RIGID_DISK_PAGE 0x04 /* Rigid disk geometry page */ #define GPMODE_FLEXIBLE_DISK_PAGE 0x05 #define GPMODE_CACHING_PAGE 0x08 #define GPMODE_CDROM_PAGE_SONY 0x08 #define GPMODE_CDROM_AUDIO_PAGE_SONY 0x09 #define GPMODE_CDROM_PAGE 0x0d #define GPMODE_CDROM_AUDIO_PAGE 0x0e #define GPMODE_CAPABILITIES_PAGE 0x2a #define GPMODE_IOMEGA_PAGE 0x2f #define GPMODE_UNK_VENDOR_PAGE 0x30 #define GPMODE_ALL_PAGES 0x3f /* Mode page codes for presence */ #define GPMODEP_UNIT_ATN_PAGE 0x0000000000000001LL #define GPMODEP_R_W_ERROR_PAGE 0x0000000000000002LL #define GPMODEP_DISCONNECT_PAGE 0x0000000000000004LL #define GPMODEP_FORMAT_DEVICE_PAGE 0x0000000000000008LL #define GPMODEP_RIGID_DISK_PAGE 0x0000000000000010LL #define GPMODEP_FLEXIBLE_DISK_PAGE 0x0000000000000020LL #define GPMODEP_CACHING_PAGE 0x0000000000000100LL #define GPMODEP_CDROM_PAGE_SONY 0x0000000000000100LL #define GPMODEP_CDROM_AUDIO_PAGE_SONY 0x0000000000000200LL #define GPMODEP_CDROM_PAGE 0x0000000000002000LL #define GPMODEP_CDROM_AUDIO_PAGE 0x0000000000004000LL #define GPMODEP_CAPABILITIES_PAGE 0x0000040000000000LL #define GPMODEP_IOMEGA_PAGE 0x0000800000000000LL #define GPMODEP_UNK_VENDOR_PAGE 0x0001000000000000LL #define GPMODEP_ALL_PAGES 0x8000000000000000LL /* SCSI Status Codes */ #define SCSI_STATUS_OK 0 #define SCSI_STATUS_CHECK_CONDITION 2 /* SCSI Sense Keys */ #define SENSE_NONE 0 #define SENSE_NOT_READY 2 #define SENSE_ILLEGAL_REQUEST 5 #define SENSE_UNIT_ATTENTION 6 /* SCSI Additional Sense Codes */ #define ASC_NONE 0x00 #define ASC_AUDIO_PLAY_OPERATION 0x00 #define ASC_NOT_READY 0x04 #define ASC_ILLEGAL_OPCODE 0x20 #define ASC_LBA_OUT_OF_RANGE 0x21 #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 #define ASC_INV_LUN 0x25 #define ASC_INV_FIELD_IN_PARAMETER_LIST 0x26 #define ASC_WRITE_PROTECTED 0x27 #define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 #define ASC_CAPACITY_DATA_CHANGED 0x2A #define ASC_INCOMPATIBLE_FORMAT 0x30 #define ASC_MEDIUM_NOT_PRESENT 0x3a #define ASC_DATA_PHASE_ERROR 0x4b #define ASC_ILLEGAL_MODE_FOR_THIS_TRACK 0x64 #define ASCQ_NONE 0x00 #define ASCQ_UNIT_IN_PROCESS_OF_BECOMING_READY 0x01 #define ASCQ_INITIALIZING_COMMAND_REQUIRED 0x02 #define ASCQ_CAPACITY_DATA_CHANGED 0x09 #define ASCQ_AUDIO_PLAY_OPERATION_IN_PROGRESS 0x11 #define ASCQ_AUDIO_PLAY_OPERATION_PAUSED 0x12 #define ASCQ_AUDIO_PLAY_OPERATION_COMPLETED 0x13 /* Tell RISC OS that we have a 4x CD-ROM drive (600kb/sec data, 706kb/sec raw). Not that it means anything */ #define CDROM_SPEED 706 /* 0x2C2 */ #define BUFFER_SIZE (256 * 1024) #define RW_DELAY (TIMER_USEC * 500) /* Some generally useful CD-ROM information */ #define CD_MINS 90 /* max. minutes per CD */ #define CD_SECS 60 /* seconds per minute */ #define CD_FRAMES 75 /* frames per second */ #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ #define CD_MAX_BYTES (CD_MINS * CD_SECS * CD_FRAMES * CD_FRAMESIZE) #define CD_MAX_SECTORS (CD_MAX_BYTES / 2048) /* Event notification classes for GET EVENT STATUS NOTIFICATION */ #define GESN_NO_EVENTS 0 #define GESN_OPERATIONAL_CHANGE 1 #define GESN_POWER_MANAGEMENT 2 #define GESN_EXTERNAL_REQUEST 3 #define GESN_MEDIA 4 #define GESN_MULTIPLE_HOSTS 5 #define GESN_DEVICE_BUSY 6 /* Event codes for MEDIA event status notification */ #define MEC_NO_CHANGE 0 #define MEC_EJECT_REQUESTED 1 #define MEC_NEW_MEDIA 2 #define MEC_MEDIA_REMOVAL 3 /* only for media changers */ #define MEC_MEDIA_CHANGED 4 /* only for media changers */ #define MEC_BG_FORMAT_COMPLETED 5 /* MRW or DVD+RW b/g format completed */ #define MEC_BG_FORMAT_RESTARTED 6 /* MRW or DVD+RW b/g format restarted */ #define MS_TRAY_OPEN 1 #define MS_MEDIA_PRESENT 2 /* * The MMC values are not IDE specific and might need to be moved * to a common header if they are also needed for the SCSI emulation */ /* Profile list from MMC-6 revision 1 table 91 */ #define MMC_PROFILE_NONE 0x0000 #define MMC_PROFILE_CD_ROM 0x0008 #define MMC_PROFILE_CD_R 0x0009 #define MMC_PROFILE_CD_RW 0x000A #define MMC_PROFILE_DVD_ROM 0x0010 #define MMC_PROFILE_DVD_R_SR 0x0011 #define MMC_PROFILE_DVD_RAM 0x0012 #define MMC_PROFILE_DVD_RW_RO 0x0013 #define MMC_PROFILE_DVD_RW_SR 0x0014 #define MMC_PROFILE_DVD_R_DL_SR 0x0015 #define MMC_PROFILE_DVD_R_DL_JR 0x0016 #define MMC_PROFILE_DVD_RW_DL 0x0017 #define MMC_PROFILE_DVD_DDR 0x0018 #define MMC_PROFILE_DVD_PLUS_RW 0x001A #define MMC_PROFILE_DVD_PLUS_R 0x001B #define MMC_PROFILE_DVD_PLUS_RW_DL 0x002A #define MMC_PROFILE_DVD_PLUS_R_DL 0x002B #define MMC_PROFILE_BD_ROM 0x0040 #define MMC_PROFILE_BD_R_SRM 0x0041 #define MMC_PROFILE_BD_R_RRM 0x0042 #define MMC_PROFILE_BD_RE 0x0043 #define MMC_PROFILE_HDDVD_ROM 0x0050 #define MMC_PROFILE_HDDVD_R 0x0051 #define MMC_PROFILE_HDDVD_RAM 0x0052 #define MMC_PROFILE_HDDVD_RW 0x0053 #define MMC_PROFILE_HDDVD_R_DL 0x0058 #define MMC_PROFILE_HDDVD_RW_DL 0x005A #define MMC_PROFILE_INVALID 0xFFFF #define EARLY_ONLY 64 #define SCSI_ONLY 32 #define ATAPI_ONLY 16 #define IMPLEMENTED 8 #define NONDATA 4 #define CHECK_READY 2 #define ALLOW_UA 1 #define MSFtoLBA(m, s, f) ((((m * 60) + s) * 75) + f) #define MSG_COMMAND_COMPLETE 0x00 #define BUS_DBP 0x01 #define BUS_SEL 0x02 #define BUS_IO 0x04 #define BUS_CD 0x08 #define BUS_MSG 0x10 #define BUS_REQ 0x20 #define BUS_BSY 0x40 #define BUS_RST 0x80 #define BUS_ACK 0x100 #define BUS_ATN 0x200 #define BUS_ARB 0x8000 #define BUS_SETDATA(val) ((uint32_t) val << 16) #define BUS_GETDATA(val) ((val >> 16) & 0xff) #define BUS_DATAMASK 0xff0000 #define BUS_IDLE (1 << 31) #define PHASE_IDLE 0x00 #define PHASE_COMMAND 0x01 #define PHASE_DATA_IN 0x02 #define PHASE_DATA_OUT 0x03 #define PHASE_DATA_IN_DMA 0x04 #define PHASE_DATA_OUT_DMA 0x05 #define PHASE_COMPLETE 0x06 #define PHASE_ERROR 0x80 #define PHASE_NONE 0xff #define SCSI_PHASE_DATA_OUT 0 #define SCSI_PHASE_DATA_IN BUS_IO #define SCSI_PHASE_COMMAND BUS_CD #define SCSI_PHASE_STATUS (BUS_CD | BUS_IO) #define SCSI_PHASE_MESSAGE_OUT (BUS_MSG | BUS_CD) #define SCSI_PHASE_MESSAGE_IN (BUS_MSG | BUS_CD | BUS_IO) #define MODE_SELECT_PHASE_IDLE 0 #define MODE_SELECT_PHASE_HEADER 1 #define MODE_SELECT_PHASE_BLOCK_DESC 2 #define MODE_SELECT_PHASE_PAGE_HEADER 3 #define MODE_SELECT_PHASE_PAGE 4 typedef struct mode_sense_pages_t { uint8_t pages[0x40][0x40]; } mode_sense_pages_t; /* This is so we can access the common elements to all SCSI device structs without knowing the device type. */ typedef struct scsi_common_s { mode_sense_pages_t ms_pages_saved; void * priv; #ifdef EMU_IDE_H ide_tf_t *tf; #else void * tf; #endif uint8_t *temp_buffer; uint8_t atapi_cdb[16]; /* This is atapi_cdb in ATAPI-supporting devices, and pad in SCSI-only devices. */ uint8_t current_cdb[16]; uint8_t sense[256]; #ifdef ANCIENT_CODE /* Task file. */ uint8_t features; uint8_t phase; uint16_t request_length; uint8_t status; uint8_t error; uint16_t pad; uint32_t pos; #endif uint8_t id; uint8_t cur_lun; uint8_t pad0; uint8_t pad1; uint16_t max_transfer_len; uint16_t pad2; int requested_blocks; int packet_status; int total_length; int do_page_save; int unit_attention; int request_pos; int old_len; int media_status; uint32_t sector_pos; uint32_t sector_len; uint32_t packet_len; double callback; } scsi_common_t; typedef struct scsi_device_t { int32_t buffer_length; uint8_t status; uint8_t phase; uint16_t type; scsi_common_t *sc; void (*command)(scsi_common_t *sc, uint8_t *cdb); void (*request_sense)(scsi_common_t *sc, uint8_t *buffer, uint8_t alloc_length); void (*reset)(scsi_common_t *sc); uint8_t (*phase_data_out)(scsi_common_t *sc); void (*command_stop)(scsi_common_t *sc); } scsi_device_t; /* These are based on the INQUIRY values. */ #define SCSI_NONE 0x0060 #define SCSI_FIXED_DISK 0x0000 #define SCSI_REMOVABLE_DISK 0x8000 #define SCSI_REMOVABLE_CDROM 0x8005 #ifdef EMU_SCSI_H extern scsi_device_t scsi_devices[SCSI_BUS_MAX][SCSI_ID_MAX]; #endif /* EMU_SCSI_H */ extern int cdrom_add_error_and_subchannel(uint8_t *b, int real_sector_type); extern int cdrom_LBAtoMSF_accurate(void); extern int mode_select_init(uint8_t command, uint16_t pl_length, uint8_t do_save); extern int mode_select_terminate(int force); extern int mode_select_write(uint8_t val); extern uint8_t *scsi_device_sense(scsi_device_t *dev); extern double scsi_device_get_callback(scsi_device_t *dev); extern void scsi_device_request_sense(scsi_device_t *dev, uint8_t *buffer, uint8_t alloc_length); extern void scsi_device_reset(scsi_device_t *dev); extern int scsi_device_present(scsi_device_t *dev); extern int scsi_device_valid(scsi_device_t *dev); extern int scsi_device_cdb_length(scsi_device_t *dev); extern void scsi_device_command_phase0(scsi_device_t *dev, uint8_t *cdb); extern void scsi_device_command_phase1(scsi_device_t *dev); extern void scsi_device_command_stop(scsi_device_t *dev); extern void scsi_device_identify(scsi_device_t *dev, uint8_t lun); extern void scsi_device_close_all(void); extern void scsi_device_init(void); extern void scsi_reset(void); extern uint8_t scsi_get_bus(void); extern void scsi_bus_set_speed(uint8_t bus, double speed); extern double scsi_bus_get_speed(uint8_t bus); #endif /*SCSI_DEVICE_H*/ ```
/content/code_sandbox/src/include/86box/scsi_device.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
5,126
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Palette definitions for the PGC core. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * John Elliott, <jce@seasip.info> * */ #ifndef VID_PGC_PALETTE_H #define VID_PGC_PALETTE_H /* Palette 0: Default */ { makecol(0x00, 0x00, 0x00), makecol(0x11, 0x11, 0x11), makecol(0x22, 0x22, 0x22), makecol(0x33, 0x33, 0x33), makecol(0x44, 0x44, 0x44), makecol(0x55, 0x55, 0x55), makecol(0x66, 0x66, 0x66), makecol(0x77, 0x77, 0x77), makecol(0x88, 0x88, 0x88), makecol(0x99, 0x99, 0x99), makecol(0xaa, 0xaa, 0xaa), makecol(0xbb, 0xbb, 0xbb), makecol(0xcc, 0xcc, 0xcc), makecol(0xdd, 0xdd, 0xdd), makecol(0xee, 0xee, 0xee), makecol(0xff, 0xff, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x22, 0x00), makecol(0x00, 0x44, 0x00), makecol(0x00, 0x66, 0x00), makecol(0x00, 0x88, 0x00), makecol(0x00, 0xaa, 0x00), makecol(0x00, 0xcc, 0x00), makecol(0x00, 0xee, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x22, 0xff, 0x22), makecol(0x44, 0xff, 0x44), makecol(0x66, 0xff, 0x66), makecol(0x88, 0xff, 0x88), makecol(0xaa, 0xff, 0xaa), makecol(0xcc, 0xff, 0xcc), makecol(0xee, 0xff, 0xee), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x22, 0x11), makecol(0x00, 0x44, 0x22), makecol(0x00, 0x66, 0x33), makecol(0x00, 0x88, 0x44), makecol(0x00, 0xaa, 0x55), makecol(0x00, 0xcc, 0x66), makecol(0x00, 0xee, 0x77), makecol(0x00, 0xff, 0x88), makecol(0x22, 0xff, 0x99), makecol(0x44, 0xff, 0xaa), makecol(0x66, 0xff, 0xbb), makecol(0x88, 0xff, 0xcc), makecol(0xaa, 0xff, 0xdd), makecol(0xcc, 0xff, 0xee), makecol(0xee, 0xff, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x22, 0x22), makecol(0x00, 0x44, 0x44), makecol(0x00, 0x66, 0x66), makecol(0x00, 0x88, 0x88), makecol(0x00, 0xaa, 0xaa), makecol(0x00, 0xcc, 0xcc), makecol(0x00, 0xee, 0xee), makecol(0x00, 0xff, 0xff), makecol(0x22, 0xff, 0xff), makecol(0x44, 0xff, 0xff), makecol(0x66, 0xff, 0xff), makecol(0x88, 0xff, 0xff), makecol(0xaa, 0xff, 0xff), makecol(0xcc, 0xff, 0xff), makecol(0xee, 0xff, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x11, 0x22), makecol(0x00, 0x22, 0x44), makecol(0x00, 0x33, 0x66), makecol(0x00, 0x44, 0x88), makecol(0x00, 0x55, 0xaa), makecol(0x00, 0x66, 0xcc), makecol(0x00, 0x77, 0xee), makecol(0x00, 0x88, 0xff), makecol(0x22, 0x99, 0xff), makecol(0x44, 0xaa, 0xff), makecol(0x66, 0xbb, 0xff), makecol(0x88, 0xcc, 0xff), makecol(0xaa, 0xdd, 0xff), makecol(0xcc, 0xee, 0xff), makecol(0xee, 0xff, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x22), makecol(0x00, 0x00, 0x44), makecol(0x00, 0x00, 0x66), makecol(0x00, 0x00, 0x88), makecol(0x00, 0x00, 0xaa), makecol(0x00, 0x00, 0xcc), makecol(0x00, 0x00, 0xee), makecol(0x00, 0x00, 0xff), makecol(0x22, 0x22, 0xff), makecol(0x44, 0x44, 0xff), makecol(0x66, 0x66, 0xff), makecol(0x88, 0x88, 0xff), makecol(0xaa, 0xaa, 0xff), makecol(0xcc, 0xcc, 0xff), makecol(0xee, 0xee, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x11, 0x00, 0x22), makecol(0x22, 0x00, 0x44), makecol(0x33, 0x00, 0x66), makecol(0x44, 0x00, 0x88), makecol(0x55, 0x00, 0xaa), makecol(0x66, 0x00, 0xcc), makecol(0x77, 0x00, 0xee), makecol(0x88, 0x00, 0xff), makecol(0x99, 0x22, 0xff), makecol(0xaa, 0x44, 0xff), makecol(0xbb, 0x66, 0xff), makecol(0xcc, 0x88, 0xff), makecol(0xdd, 0xaa, 0xff), makecol(0xee, 0xcc, 0xff), makecol(0xff, 0xee, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x22, 0x00, 0x22), makecol(0x44, 0x00, 0x44), makecol(0x66, 0x00, 0x66), makecol(0x88, 0x00, 0x88), makecol(0xaa, 0x00, 0xaa), makecol(0xcc, 0x00, 0xcc), makecol(0xee, 0x00, 0xee), makecol(0xff, 0x00, 0xff), makecol(0xff, 0x22, 0xff), makecol(0xff, 0x44, 0xff), makecol(0xff, 0x66, 0xff), makecol(0xff, 0x88, 0xff), makecol(0xff, 0xaa, 0xff), makecol(0xff, 0xcc, 0xff), makecol(0xff, 0xee, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x22, 0x00, 0x11), makecol(0x44, 0x00, 0x22), makecol(0x66, 0x00, 0x33), makecol(0x88, 0x00, 0x44), makecol(0xaa, 0x00, 0x55), makecol(0xcc, 0x00, 0x66), makecol(0xee, 0x00, 0x77), makecol(0xff, 0x00, 0x88), makecol(0xff, 0x22, 0x99), makecol(0xff, 0x44, 0xaa), makecol(0xff, 0x66, 0xbb), makecol(0xff, 0x88, 0xcc), makecol(0xff, 0xaa, 0xdd), makecol(0xff, 0xcc, 0xee), makecol(0xff, 0xee, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x22, 0x00, 0x00), makecol(0x44, 0x00, 0x00), makecol(0x66, 0x00, 0x00), makecol(0x88, 0x00, 0x00), makecol(0xaa, 0x00, 0x00), makecol(0xcc, 0x00, 0x00), makecol(0xee, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x22, 0x22), makecol(0xff, 0x44, 0x44), makecol(0xff, 0x66, 0x66), makecol(0xff, 0x88, 0x88), makecol(0xff, 0xaa, 0xaa), makecol(0xff, 0xcc, 0xcc), makecol(0xff, 0xee, 0xee), makecol(0x00, 0x00, 0x00), makecol(0x22, 0x11, 0x00), makecol(0x44, 0x22, 0x00), makecol(0x66, 0x33, 0x00), makecol(0x88, 0x44, 0x00), makecol(0xaa, 0x55, 0x00), makecol(0xcc, 0x66, 0x00), makecol(0xee, 0x77, 0x00), makecol(0xff, 0x88, 0x00), makecol(0xff, 0x99, 0x22), makecol(0xff, 0xaa, 0x44), makecol(0xff, 0xbb, 0x66), makecol(0xff, 0xcc, 0x88), makecol(0xff, 0xdd, 0xaa), makecol(0xff, 0xee, 0xcc), makecol(0xff, 0xff, 0xee), makecol(0x00, 0x00, 0x00), makecol(0x22, 0x22, 0x00), makecol(0x44, 0x44, 0x00), makecol(0x66, 0x66, 0x00), makecol(0x88, 0x88, 0x00), makecol(0xaa, 0xaa, 0x00), makecol(0xcc, 0xcc, 0x00), makecol(0xee, 0xee, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x22), makecol(0xff, 0xff, 0x44), makecol(0xff, 0xff, 0x66), makecol(0xff, 0xff, 0x88), makecol(0xff, 0xff, 0xaa), makecol(0xff, 0xff, 0xcc), makecol(0xff, 0xff, 0xee), makecol(0x00, 0x00, 0x00), makecol(0x11, 0x22, 0x00), makecol(0x22, 0x44, 0x00), makecol(0x33, 0x66, 0x00), makecol(0x44, 0x88, 0x00), makecol(0x55, 0xaa, 0x00), makecol(0x66, 0xcc, 0x00), makecol(0x77, 0xee, 0x00), makecol(0x88, 0xff, 0x00), makecol(0x99, 0xff, 0x22), makecol(0xaa, 0xff, 0x44), makecol(0xbb, 0xff, 0x66), makecol(0xcc, 0xff, 0x88), makecol(0xdd, 0xff, 0xaa), makecol(0xee, 0xff, 0xcc), makecol(0xff, 0xff, 0xee), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x11, 0x00), makecol(0x11, 0x33, 0x11), makecol(0x11, 0x44, 0x11), makecol(0x22, 0x66, 0x22), makecol(0x22, 0x77, 0x22), makecol(0x33, 0x99, 0x33), makecol(0x33, 0xaa, 0x33), makecol(0x44, 0xcc, 0x44), makecol(0x55, 0xcc, 0x55), makecol(0x77, 0xdd, 0x77), makecol(0x88, 0xdd, 0x88), makecol(0xaa, 0xee, 0xaa), makecol(0xbb, 0xee, 0xbb), makecol(0xdd, 0xff, 0xdd), makecol(0xee, 0xff, 0xee), makecol(0x00, 0x00, 0x00), makecol(0x11, 0x00, 0x00), makecol(0x33, 0x11, 0x11), makecol(0x44, 0x11, 0x11), makecol(0x66, 0x22, 0x22), makecol(0x77, 0x22, 0x22), makecol(0x99, 0x33, 0x33), makecol(0xaa, 0x33, 0x33), makecol(0xcc, 0x44, 0x44), makecol(0xcc, 0x55, 0x55), makecol(0xdd, 0x77, 0x77), makecol(0xdd, 0x88, 0x88), makecol(0xee, 0xaa, 0xaa), makecol(0xee, 0xbb, 0xbb), makecol(0xff, 0xdd, 0xdd), makecol(0xff, 0xee, 0xee), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x11), makecol(0x11, 0x11, 0x33), makecol(0x11, 0x11, 0x44), makecol(0x22, 0x22, 0x66), makecol(0x22, 0x22, 0x77), makecol(0x33, 0x33, 0x99), makecol(0x33, 0x33, 0xaa), makecol(0x44, 0x44, 0xcc), makecol(0x55, 0x55, 0xcc), makecol(0x77, 0x77, 0xdd), makecol(0x88, 0x88, 0xdd), makecol(0xaa, 0xaa, 0xee), makecol(0xbb, 0xbb, 0xee), makecol(0xdd, 0xdd, 0xff), makecol(0xee, 0xee, 0xff), }, /* Palette 1: 16-colour palette */ { makecol(0x88, 0x66, 0xdd), makecol(0x00, 0x00, 0x00), makecol(0x44, 0x77, 0x22), makecol(0x77, 0xaa, 0x44), makecol(0x00, 0x77, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x99, 0xee, 0x66), makecol(0x77, 0x77, 0x77), makecol(0xff, 0xff, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x44, 0x77, 0x22), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x77, 0xaa, 0x44), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x77), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x99, 0xee, 0x66), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0x77, 0x77, 0x77), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), makecol(0xff, 0xff, 0xff), }, /* Palette 2: 2-3-3 truecolour */ { makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x33), makecol(0x00, 0x00, 0x55), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x99), makecol(0x00, 0x00, 0xbb), makecol(0x00, 0x00, 0xdd), makecol(0x00, 0x00, 0xff), makecol(0x33, 0x00, 0x00), makecol(0x33, 0x00, 0x33), makecol(0x33, 0x00, 0x55), makecol(0x33, 0x00, 0x77), makecol(0x33, 0x00, 0x99), makecol(0x33, 0x00, 0xbb), makecol(0x33, 0x00, 0xdd), makecol(0x33, 0x00, 0xff), makecol(0x55, 0x00, 0x00), makecol(0x55, 0x00, 0x33), makecol(0x55, 0x00, 0x55), makecol(0x55, 0x00, 0x77), makecol(0x55, 0x00, 0x99), makecol(0x55, 0x00, 0xbb), makecol(0x55, 0x00, 0xdd), makecol(0x55, 0x00, 0xff), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x33), makecol(0x77, 0x00, 0x55), makecol(0x77, 0x00, 0x77), makecol(0x77, 0x00, 0x99), makecol(0x77, 0x00, 0xbb), makecol(0x77, 0x00, 0xdd), makecol(0x77, 0x00, 0xff), makecol(0x99, 0x00, 0x00), makecol(0x99, 0x00, 0x33), makecol(0x99, 0x00, 0x55), makecol(0x99, 0x00, 0x77), makecol(0x99, 0x00, 0x99), makecol(0x99, 0x00, 0xbb), makecol(0x99, 0x00, 0xdd), makecol(0x99, 0x00, 0xff), makecol(0xbb, 0x00, 0x00), makecol(0xbb, 0x00, 0x33), makecol(0xbb, 0x00, 0x55), makecol(0xbb, 0x00, 0x77), makecol(0xbb, 0x00, 0x99), makecol(0xbb, 0x00, 0xbb), makecol(0xbb, 0x00, 0xdd), makecol(0xbb, 0x00, 0xff), makecol(0xdd, 0x00, 0x00), makecol(0xdd, 0x00, 0x33), makecol(0xdd, 0x00, 0x55), makecol(0xdd, 0x00, 0x77), makecol(0xdd, 0x00, 0x99), makecol(0xdd, 0x00, 0xbb), makecol(0xdd, 0x00, 0xdd), makecol(0xdd, 0x00, 0xff), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x33), makecol(0xff, 0x00, 0x55), makecol(0xff, 0x00, 0x77), makecol(0xff, 0x00, 0x99), makecol(0xff, 0x00, 0xbb), makecol(0xff, 0x00, 0xdd), makecol(0xff, 0x00, 0xff), makecol(0x00, 0x55, 0x00), makecol(0x00, 0x55, 0x33), makecol(0x00, 0x55, 0x55), makecol(0x00, 0x55, 0x77), makecol(0x00, 0x55, 0x99), makecol(0x00, 0x55, 0xbb), makecol(0x00, 0x55, 0xdd), makecol(0x00, 0x55, 0xff), makecol(0x33, 0x55, 0x00), makecol(0x33, 0x55, 0x33), makecol(0x33, 0x55, 0x55), makecol(0x33, 0x55, 0x77), makecol(0x33, 0x55, 0x99), makecol(0x33, 0x55, 0xbb), makecol(0x33, 0x55, 0xdd), makecol(0x33, 0x55, 0xff), makecol(0x55, 0x55, 0x00), makecol(0x55, 0x55, 0x33), makecol(0x55, 0x55, 0x55), makecol(0x55, 0x55, 0x77), makecol(0x55, 0x55, 0x99), makecol(0x55, 0x55, 0xbb), makecol(0x55, 0x55, 0xdd), makecol(0x55, 0x55, 0xff), makecol(0x77, 0x55, 0x00), makecol(0x77, 0x55, 0x33), makecol(0x77, 0x55, 0x55), makecol(0x77, 0x55, 0x77), makecol(0x77, 0x55, 0x99), makecol(0x77, 0x55, 0xbb), makecol(0x77, 0x55, 0xdd), makecol(0x77, 0x55, 0xff), makecol(0x99, 0x55, 0x00), makecol(0x99, 0x55, 0x33), makecol(0x99, 0x55, 0x55), makecol(0x99, 0x55, 0x77), makecol(0x99, 0x55, 0x99), makecol(0x99, 0x55, 0xbb), makecol(0x99, 0x55, 0xdd), makecol(0x99, 0x55, 0xff), makecol(0xbb, 0x55, 0x00), makecol(0xbb, 0x55, 0x33), makecol(0xbb, 0x55, 0x55), makecol(0xbb, 0x55, 0x77), makecol(0xbb, 0x55, 0x99), makecol(0xbb, 0x55, 0xbb), makecol(0xbb, 0x55, 0xdd), makecol(0xbb, 0x55, 0xff), makecol(0xdd, 0x55, 0x00), makecol(0xdd, 0x55, 0x33), makecol(0xdd, 0x55, 0x55), makecol(0xdd, 0x55, 0x77), makecol(0xdd, 0x55, 0x99), makecol(0xdd, 0x55, 0xbb), makecol(0xdd, 0x55, 0xdd), makecol(0xdd, 0x55, 0xff), makecol(0xff, 0x55, 0x00), makecol(0xff, 0x55, 0x33), makecol(0xff, 0x55, 0x55), makecol(0xff, 0x55, 0x77), makecol(0xff, 0x55, 0x99), makecol(0xff, 0x55, 0xbb), makecol(0xff, 0x55, 0xdd), makecol(0xff, 0x55, 0xff), makecol(0x00, 0xaa, 0x00), makecol(0x00, 0xaa, 0x33), makecol(0x00, 0xaa, 0x55), makecol(0x00, 0xaa, 0x77), makecol(0x00, 0xaa, 0x99), makecol(0x00, 0xaa, 0xbb), makecol(0x00, 0xaa, 0xdd), makecol(0x00, 0xaa, 0xff), makecol(0x33, 0xaa, 0x00), makecol(0x33, 0xaa, 0x33), makecol(0x33, 0xaa, 0x55), makecol(0x33, 0xaa, 0x77), makecol(0x33, 0xaa, 0x99), makecol(0x33, 0xaa, 0xbb), makecol(0x33, 0xaa, 0xdd), makecol(0x33, 0xaa, 0xff), makecol(0x55, 0xaa, 0x00), makecol(0x55, 0xaa, 0x33), makecol(0x55, 0xaa, 0x55), makecol(0x55, 0xaa, 0x77), makecol(0x55, 0xaa, 0x99), makecol(0x55, 0xaa, 0xbb), makecol(0x55, 0xaa, 0xdd), makecol(0x55, 0xaa, 0xff), makecol(0x77, 0xaa, 0x00), makecol(0x77, 0xaa, 0x33), makecol(0x77, 0xaa, 0x55), makecol(0x77, 0xaa, 0x77), makecol(0x77, 0xaa, 0x99), makecol(0x77, 0xaa, 0xbb), makecol(0x77, 0xaa, 0xdd), makecol(0x77, 0xaa, 0xff), makecol(0x99, 0xaa, 0x00), makecol(0x99, 0xaa, 0x33), makecol(0x99, 0xaa, 0x55), makecol(0x99, 0xaa, 0x77), makecol(0x99, 0xaa, 0x99), makecol(0x99, 0xaa, 0xbb), makecol(0x99, 0xaa, 0xdd), makecol(0x99, 0xaa, 0xff), makecol(0xbb, 0xaa, 0x00), makecol(0xbb, 0xaa, 0x33), makecol(0xbb, 0xaa, 0x55), makecol(0xbb, 0xaa, 0x77), makecol(0xbb, 0xaa, 0x99), makecol(0xbb, 0xaa, 0xbb), makecol(0xbb, 0xaa, 0xdd), makecol(0xbb, 0xaa, 0xff), makecol(0xdd, 0xaa, 0x00), makecol(0xdd, 0xaa, 0x33), makecol(0xdd, 0xaa, 0x55), makecol(0xdd, 0xaa, 0x77), makecol(0xdd, 0xaa, 0x99), makecol(0xdd, 0xaa, 0xbb), makecol(0xdd, 0xaa, 0xdd), makecol(0xdd, 0xaa, 0xff), makecol(0xff, 0xaa, 0x00), makecol(0xff, 0xaa, 0x33), makecol(0xff, 0xaa, 0x55), makecol(0xff, 0xaa, 0x77), makecol(0xff, 0xaa, 0x99), makecol(0xff, 0xaa, 0xbb), makecol(0xff, 0xaa, 0xdd), makecol(0xff, 0xaa, 0xee), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x33), makecol(0x00, 0xff, 0x55), makecol(0x00, 0xff, 0x77), makecol(0x00, 0xff, 0x99), makecol(0x00, 0xff, 0xbb), makecol(0x00, 0xff, 0xdd), makecol(0x00, 0xff, 0xff), makecol(0x33, 0xff, 0x00), makecol(0x33, 0xff, 0x33), makecol(0x33, 0xff, 0x55), makecol(0x33, 0xff, 0x77), makecol(0x33, 0xff, 0x99), makecol(0x33, 0xff, 0xbb), makecol(0x33, 0xff, 0xdd), makecol(0x33, 0xff, 0xff), makecol(0x55, 0xff, 0x00), makecol(0x55, 0xff, 0x33), makecol(0x55, 0xff, 0x55), makecol(0x55, 0xff, 0x77), makecol(0x55, 0xff, 0x99), makecol(0x55, 0xff, 0xbb), makecol(0x55, 0xff, 0xdd), makecol(0x55, 0xff, 0xff), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x33), makecol(0x77, 0xff, 0x55), makecol(0x77, 0xff, 0x77), makecol(0x77, 0xff, 0x99), makecol(0x77, 0xff, 0xbb), makecol(0x77, 0xff, 0xdd), makecol(0x77, 0xff, 0xff), makecol(0x99, 0xff, 0x00), makecol(0x99, 0xff, 0x33), makecol(0x99, 0xff, 0x55), makecol(0x99, 0xff, 0x77), makecol(0x99, 0xff, 0x99), makecol(0x99, 0xff, 0xbb), makecol(0x99, 0xff, 0xdd), makecol(0x99, 0xff, 0xff), makecol(0xbb, 0xff, 0x00), makecol(0xbb, 0xff, 0x33), makecol(0xbb, 0xff, 0x55), makecol(0xbb, 0xff, 0x77), makecol(0xbb, 0xff, 0x99), makecol(0xbb, 0xff, 0xbb), makecol(0xbb, 0xff, 0xdd), makecol(0xbb, 0xff, 0xff), makecol(0xdd, 0xff, 0x00), makecol(0xdd, 0xff, 0x33), makecol(0xdd, 0xff, 0x55), makecol(0xdd, 0xff, 0x77), makecol(0xdd, 0xff, 0x99), makecol(0xdd, 0xff, 0xbb), makecol(0xdd, 0xff, 0xdd), makecol(0xdd, 0xff, 0xff), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x33), makecol(0xff, 0xff, 0x55), makecol(0xff, 0xff, 0x77), makecol(0xff, 0xff, 0x99), makecol(0xff, 0xff, 0xbb), makecol(0xff, 0xff, 0xdd), makecol(0xff, 0xff, 0xff), }, /* Palette 3: 3-2-3 truecolour */ { makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x33), makecol(0x00, 0x00, 0x55), makecol(0x00, 0x00, 0x77), makecol(0x00, 0x00, 0x99), makecol(0x00, 0x00, 0xbb), makecol(0x00, 0x00, 0xdd), makecol(0x00, 0x00, 0xff), makecol(0x55, 0x00, 0x00), makecol(0x55, 0x00, 0x33), makecol(0x55, 0x00, 0x55), makecol(0x55, 0x00, 0x77), makecol(0x55, 0x00, 0x99), makecol(0x55, 0x00, 0xbb), makecol(0x55, 0x00, 0xdd), makecol(0x55, 0x00, 0xff), makecol(0xaa, 0x00, 0x00), makecol(0xaa, 0x00, 0x33), makecol(0xaa, 0x00, 0x55), makecol(0xaa, 0x00, 0x77), makecol(0xaa, 0x00, 0x99), makecol(0xaa, 0x00, 0xbb), makecol(0xaa, 0x00, 0xdd), makecol(0xaa, 0x00, 0xff), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x33), makecol(0xff, 0x00, 0x55), makecol(0xff, 0x00, 0x77), makecol(0xff, 0x00, 0x99), makecol(0xff, 0x00, 0xbb), makecol(0xff, 0x00, 0xdd), makecol(0xff, 0x00, 0xff), makecol(0x00, 0x33, 0x00), makecol(0x00, 0x33, 0x33), makecol(0x00, 0x33, 0x55), makecol(0x00, 0x33, 0x77), makecol(0x00, 0x33, 0x99), makecol(0x00, 0x33, 0xbb), makecol(0x00, 0x33, 0xdd), makecol(0x00, 0x33, 0xff), makecol(0x55, 0x33, 0x00), makecol(0x55, 0x33, 0x33), makecol(0x55, 0x33, 0x55), makecol(0x55, 0x33, 0x77), makecol(0x55, 0x33, 0x99), makecol(0x55, 0x33, 0xbb), makecol(0x55, 0x33, 0xdd), makecol(0x55, 0x33, 0xff), makecol(0xaa, 0x33, 0x00), makecol(0xaa, 0x33, 0x33), makecol(0xaa, 0x33, 0x55), makecol(0xaa, 0x33, 0x77), makecol(0xaa, 0x33, 0x99), makecol(0xaa, 0x33, 0xbb), makecol(0xaa, 0x33, 0xdd), makecol(0xaa, 0x33, 0xff), makecol(0xff, 0x33, 0x00), makecol(0xff, 0x33, 0x33), makecol(0xff, 0x33, 0x55), makecol(0xff, 0x33, 0x77), makecol(0xff, 0x33, 0x99), makecol(0xff, 0x33, 0xbb), makecol(0xff, 0x33, 0xdd), makecol(0xff, 0x33, 0xff), makecol(0x00, 0x55, 0x00), makecol(0x00, 0x55, 0x33), makecol(0x00, 0x55, 0x55), makecol(0x00, 0x55, 0x77), makecol(0x00, 0x55, 0x99), makecol(0x00, 0x55, 0xbb), makecol(0x00, 0x55, 0xdd), makecol(0x00, 0x55, 0xff), makecol(0x55, 0x55, 0x00), makecol(0x55, 0x55, 0x33), makecol(0x55, 0x55, 0x55), makecol(0x55, 0x55, 0x77), makecol(0x55, 0x55, 0x99), makecol(0x55, 0x55, 0xbb), makecol(0x55, 0x55, 0xdd), makecol(0x55, 0x55, 0xff), makecol(0xaa, 0x55, 0x00), makecol(0xaa, 0x55, 0x33), makecol(0xaa, 0x55, 0x55), makecol(0xaa, 0x55, 0x77), makecol(0xaa, 0x55, 0x99), makecol(0xaa, 0x55, 0xbb), makecol(0xaa, 0x55, 0xdd), makecol(0xaa, 0x55, 0xff), makecol(0xff, 0x55, 0x00), makecol(0xff, 0x55, 0x33), makecol(0xff, 0x55, 0x55), makecol(0xff, 0x55, 0x77), makecol(0xff, 0x55, 0x99), makecol(0xff, 0x55, 0xbb), makecol(0xff, 0x55, 0xdd), makecol(0xff, 0x55, 0xff), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x33), makecol(0x00, 0x77, 0x55), makecol(0x00, 0x77, 0x77), makecol(0x00, 0x77, 0x99), makecol(0x00, 0x77, 0xbb), makecol(0x00, 0x77, 0xdd), makecol(0x00, 0x77, 0xff), makecol(0x55, 0x77, 0x00), makecol(0x55, 0x77, 0x33), makecol(0x55, 0x77, 0x55), makecol(0x55, 0x77, 0x77), makecol(0x55, 0x77, 0x99), makecol(0x55, 0x77, 0xbb), makecol(0x55, 0x77, 0xdd), makecol(0x55, 0x77, 0xff), makecol(0xaa, 0x77, 0x00), makecol(0xaa, 0x77, 0x33), makecol(0xaa, 0x77, 0x55), makecol(0xaa, 0x77, 0x77), makecol(0xaa, 0x77, 0x99), makecol(0xaa, 0x77, 0xbb), makecol(0xaa, 0x77, 0xdd), makecol(0xaa, 0x77, 0xff), makecol(0xff, 0x77, 0x00), makecol(0xff, 0x77, 0x33), makecol(0xff, 0x77, 0x55), makecol(0xff, 0x77, 0x77), makecol(0xff, 0x77, 0x99), makecol(0xff, 0x77, 0xbb), makecol(0xff, 0x77, 0xdd), makecol(0xff, 0x77, 0xff), makecol(0x00, 0x99, 0x00), makecol(0x00, 0x99, 0x33), makecol(0x00, 0x99, 0x55), makecol(0x00, 0x99, 0x77), makecol(0x00, 0x99, 0x99), makecol(0x00, 0x99, 0xbb), makecol(0x00, 0x99, 0xdd), makecol(0x00, 0x99, 0xff), makecol(0x55, 0x99, 0x00), makecol(0x55, 0x99, 0x33), makecol(0x55, 0x99, 0x55), makecol(0x55, 0x99, 0x77), makecol(0x55, 0x99, 0x99), makecol(0x55, 0x99, 0xbb), makecol(0x55, 0x99, 0xdd), makecol(0x55, 0x99, 0xff), makecol(0xaa, 0x99, 0x00), makecol(0xaa, 0x99, 0x33), makecol(0xaa, 0x99, 0x55), makecol(0xaa, 0x99, 0x77), makecol(0xaa, 0x99, 0x99), makecol(0xaa, 0x99, 0xbb), makecol(0xaa, 0x99, 0xdd), makecol(0xaa, 0x99, 0xff), makecol(0xff, 0x99, 0x00), makecol(0xff, 0x99, 0x33), makecol(0xff, 0x99, 0x55), makecol(0xff, 0x99, 0x77), makecol(0xff, 0x99, 0x99), makecol(0xff, 0x99, 0xbb), makecol(0xff, 0x99, 0xdd), makecol(0xff, 0x99, 0xff), makecol(0x00, 0xbb, 0x00), makecol(0x00, 0xbb, 0x33), makecol(0x00, 0xbb, 0x55), makecol(0x00, 0xbb, 0x77), makecol(0x00, 0xbb, 0x99), makecol(0x00, 0xbb, 0xbb), makecol(0x00, 0xbb, 0xdd), makecol(0x00, 0xbb, 0xff), makecol(0x55, 0xbb, 0x00), makecol(0x55, 0xbb, 0x33), makecol(0x55, 0xbb, 0x55), makecol(0x55, 0xbb, 0x77), makecol(0x55, 0xbb, 0x99), makecol(0x55, 0xbb, 0xbb), makecol(0x55, 0xbb, 0xdd), makecol(0x55, 0xbb, 0xff), makecol(0xaa, 0xbb, 0x00), makecol(0xaa, 0xbb, 0x33), makecol(0xaa, 0xbb, 0x55), makecol(0xaa, 0xbb, 0x77), makecol(0xaa, 0xbb, 0x99), makecol(0xaa, 0xbb, 0xbb), makecol(0xaa, 0xbb, 0xdd), makecol(0xaa, 0xbb, 0xff), makecol(0xff, 0xbb, 0x00), makecol(0xff, 0xbb, 0x33), makecol(0xff, 0xbb, 0x55), makecol(0xff, 0xbb, 0x77), makecol(0xff, 0xbb, 0x99), makecol(0xff, 0xbb, 0xbb), makecol(0xff, 0xbb, 0xdd), makecol(0xff, 0xbb, 0xff), makecol(0x00, 0xdd, 0x00), makecol(0x00, 0xdd, 0x33), makecol(0x00, 0xdd, 0x55), makecol(0x00, 0xdd, 0x77), makecol(0x00, 0xdd, 0x99), makecol(0x00, 0xdd, 0xbb), makecol(0x00, 0xdd, 0xdd), makecol(0x00, 0xdd, 0xff), makecol(0x55, 0xdd, 0x00), makecol(0x55, 0xdd, 0x33), makecol(0x55, 0xdd, 0x55), makecol(0x55, 0xdd, 0x77), makecol(0x55, 0xdd, 0x99), makecol(0x55, 0xdd, 0xbb), makecol(0x55, 0xdd, 0xdd), makecol(0x55, 0xdd, 0xff), makecol(0xaa, 0xdd, 0x00), makecol(0xaa, 0xdd, 0x33), makecol(0xaa, 0xdd, 0x55), makecol(0xaa, 0xdd, 0x77), makecol(0xaa, 0xdd, 0x99), makecol(0xaa, 0xdd, 0xbb), makecol(0xaa, 0xdd, 0xdd), makecol(0xaa, 0xdd, 0xff), makecol(0xff, 0xdd, 0x00), makecol(0xff, 0xdd, 0x33), makecol(0xff, 0xdd, 0x55), makecol(0xff, 0xdd, 0x77), makecol(0xff, 0xdd, 0x99), makecol(0xff, 0xdd, 0xbb), makecol(0xff, 0xdd, 0xdd), makecol(0xff, 0xdd, 0xff), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x33), makecol(0x00, 0xff, 0x55), makecol(0x00, 0xff, 0x77), makecol(0x00, 0xff, 0x99), makecol(0x00, 0xff, 0xbb), makecol(0x00, 0xff, 0xdd), makecol(0x00, 0xff, 0xff), makecol(0x55, 0xff, 0x00), makecol(0x55, 0xff, 0x33), makecol(0x55, 0xff, 0x55), makecol(0x55, 0xff, 0x77), makecol(0x55, 0xff, 0x99), makecol(0x55, 0xff, 0xbb), makecol(0x55, 0xff, 0xdd), makecol(0x55, 0xff, 0xff), makecol(0xaa, 0xff, 0x00), makecol(0xaa, 0xff, 0x33), makecol(0xaa, 0xff, 0x55), makecol(0xaa, 0xff, 0x77), makecol(0xaa, 0xff, 0x99), makecol(0xaa, 0xff, 0xbb), makecol(0xaa, 0xff, 0xdd), makecol(0xaa, 0xff, 0xff), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x33), makecol(0xff, 0xff, 0x55), makecol(0xff, 0xff, 0x77), makecol(0xff, 0xff, 0x99), makecol(0xff, 0xff, 0xbb), makecol(0xff, 0xff, 0xdd), makecol(0xff, 0xff, 0xff), }, /* Palette 4: 3-3-2 truecolour */ { makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x55), makecol(0x00, 0x00, 0xaa), makecol(0x00, 0x00, 0xff), makecol(0x00, 0x33, 0x00), makecol(0x00, 0x33, 0x55), makecol(0x00, 0x33, 0xaa), makecol(0x00, 0x33, 0xff), makecol(0x00, 0x55, 0x00), makecol(0x00, 0x55, 0x55), makecol(0x00, 0x55, 0xaa), makecol(0x00, 0x55, 0xff), makecol(0x00, 0x77, 0x00), makecol(0x00, 0x77, 0x55), makecol(0x00, 0x77, 0xaa), makecol(0x00, 0x77, 0xff), makecol(0x00, 0x99, 0x00), makecol(0x00, 0x99, 0x55), makecol(0x00, 0x99, 0xaa), makecol(0x00, 0x99, 0xff), makecol(0x00, 0xbb, 0x00), makecol(0x00, 0xbb, 0x55), makecol(0x00, 0xbb, 0xaa), makecol(0x00, 0xbb, 0xff), makecol(0x00, 0xdd, 0x00), makecol(0x00, 0xdd, 0x55), makecol(0x00, 0xdd, 0xaa), makecol(0x00, 0xdd, 0xff), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x55), makecol(0x00, 0xff, 0xaa), makecol(0x00, 0xff, 0xff), makecol(0x33, 0x00, 0x00), makecol(0x33, 0x00, 0x55), makecol(0x33, 0x00, 0xaa), makecol(0x33, 0x00, 0xff), makecol(0x33, 0x33, 0x00), makecol(0x33, 0x33, 0x55), makecol(0x33, 0x33, 0xaa), makecol(0x33, 0x33, 0xff), makecol(0x33, 0x55, 0x00), makecol(0x33, 0x55, 0x55), makecol(0x33, 0x55, 0xaa), makecol(0x33, 0x55, 0xff), makecol(0x33, 0x77, 0x00), makecol(0x33, 0x77, 0x55), makecol(0x33, 0x77, 0xaa), makecol(0x33, 0x77, 0xff), makecol(0x33, 0x99, 0x00), makecol(0x33, 0x99, 0x55), makecol(0x33, 0x99, 0xaa), makecol(0x33, 0x99, 0xff), makecol(0x33, 0xbb, 0x00), makecol(0x33, 0xbb, 0x55), makecol(0x33, 0xbb, 0xaa), makecol(0x33, 0xbb, 0xff), makecol(0x33, 0xdd, 0x00), makecol(0x33, 0xdd, 0x55), makecol(0x33, 0xdd, 0xaa), makecol(0x33, 0xdd, 0xff), makecol(0x33, 0xff, 0x00), makecol(0x33, 0xff, 0x55), makecol(0x33, 0xff, 0xaa), makecol(0x33, 0xff, 0xff), makecol(0x55, 0x00, 0x00), makecol(0x55, 0x00, 0x55), makecol(0x55, 0x00, 0xaa), makecol(0x55, 0x00, 0xff), makecol(0x55, 0x33, 0x00), makecol(0x55, 0x33, 0x55), makecol(0x55, 0x33, 0xaa), makecol(0x55, 0x33, 0xff), makecol(0x55, 0x55, 0x00), makecol(0x55, 0x55, 0x55), makecol(0x55, 0x55, 0xaa), makecol(0x55, 0x55, 0xff), makecol(0x55, 0x77, 0x00), makecol(0x55, 0x77, 0x55), makecol(0x55, 0x77, 0xaa), makecol(0x55, 0x77, 0xff), makecol(0x55, 0x99, 0x00), makecol(0x55, 0x99, 0x55), makecol(0x55, 0x99, 0xaa), makecol(0x55, 0x99, 0xff), makecol(0x55, 0xbb, 0x00), makecol(0x55, 0xbb, 0x55), makecol(0x55, 0xbb, 0xaa), makecol(0x55, 0xbb, 0xff), makecol(0x55, 0xdd, 0x00), makecol(0x55, 0xdd, 0x55), makecol(0x55, 0xdd, 0xaa), makecol(0x55, 0xdd, 0xff), makecol(0x55, 0xff, 0x00), makecol(0x55, 0xff, 0x55), makecol(0x55, 0xff, 0xaa), makecol(0x55, 0xff, 0xff), makecol(0x77, 0x00, 0x00), makecol(0x77, 0x00, 0x55), makecol(0x77, 0x00, 0xaa), makecol(0x77, 0x00, 0xff), makecol(0x77, 0x33, 0x00), makecol(0x77, 0x33, 0x55), makecol(0x77, 0x33, 0xaa), makecol(0x77, 0x33, 0xff), makecol(0x77, 0x55, 0x00), makecol(0x77, 0x55, 0x55), makecol(0x77, 0x55, 0xaa), makecol(0x77, 0x55, 0xff), makecol(0x77, 0x77, 0x00), makecol(0x77, 0x77, 0x55), makecol(0x77, 0x77, 0xaa), makecol(0x77, 0x77, 0xff), makecol(0x77, 0x99, 0x00), makecol(0x77, 0x99, 0x55), makecol(0x77, 0x99, 0xaa), makecol(0x77, 0x99, 0xff), makecol(0x77, 0xbb, 0x00), makecol(0x77, 0xbb, 0x55), makecol(0x77, 0xbb, 0xaa), makecol(0x77, 0xbb, 0xff), makecol(0x77, 0xdd, 0x00), makecol(0x77, 0xdd, 0x55), makecol(0x77, 0xdd, 0xaa), makecol(0x77, 0xdd, 0xff), makecol(0x77, 0xff, 0x00), makecol(0x77, 0xff, 0x55), makecol(0x77, 0xff, 0xaa), makecol(0x77, 0xff, 0xff), makecol(0x99, 0x00, 0x00), makecol(0x99, 0x00, 0x55), makecol(0x99, 0x00, 0xaa), makecol(0x99, 0x00, 0xff), makecol(0x99, 0x33, 0x00), makecol(0x99, 0x33, 0x55), makecol(0x99, 0x33, 0xaa), makecol(0x99, 0x33, 0xff), makecol(0x99, 0x55, 0x00), makecol(0x99, 0x55, 0x55), makecol(0x99, 0x55, 0xaa), makecol(0x99, 0x55, 0xff), makecol(0x99, 0x77, 0x00), makecol(0x99, 0x77, 0x55), makecol(0x99, 0x77, 0xaa), makecol(0x99, 0x77, 0xff), makecol(0x99, 0x99, 0x00), makecol(0x99, 0x99, 0x55), makecol(0x99, 0x99, 0xaa), makecol(0x99, 0x99, 0xff), makecol(0x99, 0xbb, 0x00), makecol(0x99, 0xbb, 0x55), makecol(0x99, 0xbb, 0xaa), makecol(0x99, 0xbb, 0xff), makecol(0x99, 0xdd, 0x00), makecol(0x99, 0xdd, 0x55), makecol(0x99, 0xdd, 0xaa), makecol(0x99, 0xdd, 0xff), makecol(0x99, 0xff, 0x00), makecol(0x99, 0xff, 0x55), makecol(0x99, 0xff, 0xaa), makecol(0x99, 0xff, 0xff), makecol(0xbb, 0x00, 0x00), makecol(0xbb, 0x00, 0x55), makecol(0xbb, 0x00, 0xaa), makecol(0xbb, 0x00, 0xff), makecol(0xbb, 0x33, 0x00), makecol(0xbb, 0x33, 0x55), makecol(0xbb, 0x33, 0xaa), makecol(0xbb, 0x33, 0xff), makecol(0xbb, 0x55, 0x00), makecol(0xbb, 0x55, 0x55), makecol(0xbb, 0x55, 0xaa), makecol(0xbb, 0x55, 0xff), makecol(0xbb, 0x77, 0x00), makecol(0xbb, 0x77, 0x55), makecol(0xbb, 0x77, 0xaa), makecol(0xbb, 0x77, 0xff), makecol(0xbb, 0x99, 0x00), makecol(0xbb, 0x99, 0x55), makecol(0xbb, 0x99, 0xaa), makecol(0xbb, 0x99, 0xff), makecol(0xbb, 0xbb, 0x00), makecol(0xbb, 0xbb, 0x55), makecol(0xbb, 0xbb, 0xaa), makecol(0xbb, 0xbb, 0xff), makecol(0xbb, 0xdd, 0x00), makecol(0xbb, 0xdd, 0x55), makecol(0xbb, 0xdd, 0xaa), makecol(0xbb, 0xdd, 0xff), makecol(0xbb, 0xff, 0x00), makecol(0xbb, 0xff, 0x55), makecol(0xbb, 0xff, 0xaa), makecol(0xbb, 0xff, 0xff), makecol(0xdd, 0x00, 0x00), makecol(0xdd, 0x00, 0x55), makecol(0xdd, 0x00, 0xaa), makecol(0xdd, 0x00, 0xff), makecol(0xdd, 0x33, 0x00), makecol(0xdd, 0x33, 0x55), makecol(0xdd, 0x33, 0xaa), makecol(0xdd, 0x33, 0xff), makecol(0xdd, 0x55, 0x00), makecol(0xdd, 0x55, 0x55), makecol(0xdd, 0x55, 0xaa), makecol(0xdd, 0x55, 0xff), makecol(0xdd, 0x77, 0x00), makecol(0xdd, 0x77, 0x55), makecol(0xdd, 0x77, 0xaa), makecol(0xdd, 0x77, 0xff), makecol(0xdd, 0x99, 0x00), makecol(0xdd, 0x99, 0x55), makecol(0xdd, 0x99, 0xaa), makecol(0xdd, 0x99, 0xff), makecol(0xdd, 0xbb, 0x00), makecol(0xdd, 0xbb, 0x55), makecol(0xdd, 0xbb, 0xaa), makecol(0xdd, 0xbb, 0xff), makecol(0xdd, 0xdd, 0x00), makecol(0xdd, 0xdd, 0x55), makecol(0xdd, 0xdd, 0xaa), makecol(0xdd, 0xdd, 0xff), makecol(0xdd, 0xff, 0x00), makecol(0xdd, 0xff, 0x55), makecol(0xdd, 0xff, 0xaa), makecol(0xdd, 0xff, 0xff), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x55), makecol(0xff, 0x00, 0xaa), makecol(0xff, 0x00, 0xff), makecol(0xff, 0x33, 0x00), makecol(0xff, 0x33, 0x55), makecol(0xff, 0x33, 0xaa), makecol(0xff, 0x33, 0xff), makecol(0xff, 0x55, 0x00), makecol(0xff, 0x55, 0x55), makecol(0xff, 0x55, 0xaa), makecol(0xff, 0x55, 0xff), makecol(0xff, 0x77, 0x00), makecol(0xff, 0x77, 0x55), makecol(0xff, 0x77, 0xaa), makecol(0xff, 0x77, 0xff), makecol(0xff, 0x99, 0x00), makecol(0xff, 0x99, 0x55), makecol(0xff, 0x99, 0xaa), makecol(0xff, 0x99, 0xff), makecol(0xff, 0xbb, 0x00), makecol(0xff, 0xbb, 0x55), makecol(0xff, 0xbb, 0xaa), makecol(0xff, 0xbb, 0xff), makecol(0xff, 0xdd, 0x00), makecol(0xff, 0xdd, 0x55), makecol(0xff, 0xdd, 0xaa), makecol(0xff, 0xdd, 0xff), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x55), makecol(0xff, 0xff, 0xaa), makecol(0xff, 0xff, 0xff), }, /* Palette 5: 6x6x6 colour cube */ { makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x33), makecol(0x00, 0x00, 0x66), makecol(0x00, 0x00, 0x99), makecol(0x00, 0x00, 0xcc), makecol(0x00, 0x00, 0xff), makecol(0x33, 0x00, 0x00), makecol(0x33, 0x00, 0x33), makecol(0x33, 0x00, 0x66), makecol(0x33, 0x00, 0x99), makecol(0x33, 0x00, 0xcc), makecol(0x33, 0x00, 0xff), makecol(0x66, 0x00, 0x00), makecol(0x66, 0x00, 0x33), makecol(0x66, 0x00, 0x66), makecol(0x66, 0x00, 0x99), makecol(0x66, 0x00, 0xcc), makecol(0x66, 0x00, 0xff), makecol(0x99, 0x00, 0x00), makecol(0x99, 0x00, 0x33), makecol(0x99, 0x00, 0x66), makecol(0x99, 0x00, 0x99), makecol(0x99, 0x00, 0xcc), makecol(0x99, 0x00, 0xff), makecol(0xcc, 0x00, 0x00), makecol(0xcc, 0x00, 0x33), makecol(0xcc, 0x00, 0x66), makecol(0xcc, 0x00, 0x99), makecol(0xcc, 0x00, 0xcc), makecol(0xcc, 0x00, 0xff), makecol(0xff, 0x00, 0x00), makecol(0xff, 0x00, 0x33), makecol(0xff, 0x00, 0x66), makecol(0xff, 0x00, 0x99), makecol(0xff, 0x00, 0xcc), makecol(0xff, 0x00, 0xff), makecol(0x00, 0x33, 0x00), makecol(0x00, 0x33, 0x33), makecol(0x00, 0x33, 0x66), makecol(0x00, 0x33, 0x99), makecol(0x00, 0x33, 0xcc), makecol(0x00, 0x33, 0xff), makecol(0x33, 0x33, 0x00), makecol(0x33, 0x33, 0x33), makecol(0x33, 0x33, 0x66), makecol(0x33, 0x33, 0x99), makecol(0x33, 0x33, 0xcc), makecol(0x33, 0x33, 0xff), makecol(0x66, 0x33, 0x00), makecol(0x66, 0x33, 0x33), makecol(0x66, 0x33, 0x66), makecol(0x66, 0x33, 0x99), makecol(0x66, 0x33, 0xcc), makecol(0x66, 0x33, 0xff), makecol(0x99, 0x33, 0x00), makecol(0x99, 0x33, 0x33), makecol(0x99, 0x33, 0x66), makecol(0x99, 0x33, 0x99), makecol(0x99, 0x33, 0xcc), makecol(0x99, 0x33, 0xff), makecol(0xcc, 0x33, 0x00), makecol(0xcc, 0x33, 0x33), makecol(0xcc, 0x33, 0x66), makecol(0xcc, 0x33, 0x99), makecol(0xcc, 0x33, 0xcc), makecol(0xcc, 0x33, 0xff), makecol(0xff, 0x33, 0x00), makecol(0xff, 0x33, 0x33), makecol(0xff, 0x33, 0x66), makecol(0xff, 0x33, 0x99), makecol(0xff, 0x33, 0xcc), makecol(0xff, 0x33, 0xff), makecol(0x00, 0x66, 0x00), makecol(0x00, 0x66, 0x33), makecol(0x00, 0x66, 0x66), makecol(0x00, 0x66, 0x99), makecol(0x00, 0x66, 0xcc), makecol(0x00, 0x66, 0xff), makecol(0x33, 0x66, 0x00), makecol(0x33, 0x66, 0x33), makecol(0x33, 0x66, 0x66), makecol(0x33, 0x66, 0x99), makecol(0x33, 0x66, 0xcc), makecol(0x33, 0x66, 0xff), makecol(0x66, 0x66, 0x00), makecol(0x66, 0x66, 0x33), makecol(0x66, 0x66, 0x66), makecol(0x66, 0x66, 0x99), makecol(0x66, 0x66, 0xcc), makecol(0x66, 0x66, 0xff), makecol(0x99, 0x66, 0x00), makecol(0x99, 0x66, 0x33), makecol(0x99, 0x66, 0x66), makecol(0x99, 0x66, 0x99), makecol(0x99, 0x66, 0xcc), makecol(0x99, 0x66, 0xff), makecol(0xcc, 0x66, 0x00), makecol(0xcc, 0x66, 0x33), makecol(0xcc, 0x66, 0x66), makecol(0xcc, 0x66, 0x99), makecol(0xcc, 0x66, 0xcc), makecol(0xcc, 0x66, 0xff), makecol(0xff, 0x66, 0x00), makecol(0xff, 0x66, 0x33), makecol(0xff, 0x66, 0x66), makecol(0xff, 0x66, 0x99), makecol(0xff, 0x66, 0xcc), makecol(0xff, 0x66, 0xff), makecol(0x00, 0x99, 0x00), makecol(0x00, 0x99, 0x33), makecol(0x00, 0x99, 0x66), makecol(0x00, 0x99, 0x99), makecol(0x00, 0x99, 0xcc), makecol(0x00, 0x99, 0xff), makecol(0x33, 0x99, 0x00), makecol(0x33, 0x99, 0x33), makecol(0x33, 0x99, 0x66), makecol(0x33, 0x99, 0x99), makecol(0x33, 0x99, 0xcc), makecol(0x33, 0x99, 0xff), makecol(0x66, 0x99, 0x00), makecol(0x66, 0x99, 0x33), makecol(0x66, 0x99, 0x66), makecol(0x66, 0x99, 0x99), makecol(0x66, 0x99, 0xcc), makecol(0x66, 0x99, 0xff), makecol(0x99, 0x99, 0x00), makecol(0x99, 0x99, 0x33), makecol(0x99, 0x99, 0x66), makecol(0x99, 0x99, 0x99), makecol(0x99, 0x99, 0xcc), makecol(0x99, 0x99, 0xff), makecol(0xcc, 0x99, 0x00), makecol(0xcc, 0x99, 0x33), makecol(0xcc, 0x99, 0x66), makecol(0xcc, 0x99, 0x99), makecol(0xcc, 0x99, 0xcc), makecol(0xcc, 0x99, 0xff), makecol(0xff, 0x99, 0x00), makecol(0xff, 0x99, 0x33), makecol(0xff, 0x99, 0x66), makecol(0xff, 0x99, 0x99), makecol(0xff, 0x99, 0xcc), makecol(0xff, 0x99, 0xff), makecol(0x00, 0xcc, 0x00), makecol(0x00, 0xcc, 0x33), makecol(0x00, 0xcc, 0x66), makecol(0x00, 0xcc, 0x99), makecol(0x00, 0xcc, 0xcc), makecol(0x00, 0xcc, 0xff), makecol(0x33, 0xcc, 0x00), makecol(0x33, 0xcc, 0x33), makecol(0x33, 0xcc, 0x66), makecol(0x33, 0xcc, 0x99), makecol(0x33, 0xcc, 0xcc), makecol(0x33, 0xcc, 0xff), makecol(0x66, 0xcc, 0x00), makecol(0x66, 0xcc, 0x33), makecol(0x66, 0xcc, 0x66), makecol(0x66, 0xcc, 0x99), makecol(0x66, 0xcc, 0xcc), makecol(0x66, 0xcc, 0xff), makecol(0x99, 0xcc, 0x00), makecol(0x99, 0xcc, 0x33), makecol(0x99, 0xcc, 0x66), makecol(0x99, 0xcc, 0x99), makecol(0x99, 0xcc, 0xcc), makecol(0x99, 0xcc, 0xff), makecol(0xcc, 0xcc, 0x00), makecol(0xcc, 0xcc, 0x33), makecol(0xcc, 0xcc, 0x66), makecol(0xcc, 0xcc, 0x99), makecol(0xcc, 0xcc, 0xcc), makecol(0xcc, 0xcc, 0xff), makecol(0xff, 0xcc, 0x00), makecol(0xff, 0xcc, 0x33), makecol(0xff, 0xcc, 0x66), makecol(0xff, 0xcc, 0x99), makecol(0xff, 0xcc, 0xcc), makecol(0xff, 0xcc, 0xff), makecol(0x00, 0xff, 0x00), makecol(0x00, 0xff, 0x33), makecol(0x00, 0xff, 0x66), makecol(0x00, 0xff, 0x99), makecol(0x00, 0xff, 0xcc), makecol(0x00, 0xff, 0xff), makecol(0x33, 0xff, 0x00), makecol(0x33, 0xff, 0x33), makecol(0x33, 0xff, 0x66), makecol(0x33, 0xff, 0x99), makecol(0x33, 0xff, 0xcc), makecol(0x33, 0xff, 0xff), makecol(0x66, 0xff, 0x00), makecol(0x66, 0xff, 0x33), makecol(0x66, 0xff, 0x66), makecol(0x66, 0xff, 0x99), makecol(0x66, 0xff, 0xcc), makecol(0x66, 0xff, 0xff), makecol(0x99, 0xff, 0x00), makecol(0x99, 0xff, 0x33), makecol(0x99, 0xff, 0x66), makecol(0x99, 0xff, 0x99), makecol(0x99, 0xff, 0xcc), makecol(0x99, 0xff, 0xff), makecol(0xcc, 0xff, 0x00), makecol(0xcc, 0xff, 0x33), makecol(0xcc, 0xff, 0x66), makecol(0xcc, 0xff, 0x99), makecol(0xcc, 0xff, 0xcc), makecol(0xcc, 0xff, 0xff), makecol(0xff, 0xff, 0x00), makecol(0xff, 0xff, 0x33), makecol(0xff, 0xff, 0x66), makecol(0xff, 0xff, 0x99), makecol(0xff, 0xff, 0xcc), makecol(0xff, 0xff, 0xff), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), makecol(0x00, 0x00, 0x00), }, #endif /*VID_PGC_PALETTE_H*/ ```
/content/code_sandbox/src/include/86box/vid_pgc_palette.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
26,195
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Emulation of SPD (Serial Presence Detect) devices. * * * * Authors: RichardG, <richardg867@gmail.com> * */ #ifndef EMU_SPD_H #define EMU_SPD_H #define SPD_BASE_ADDR 0x50 #define SPD_MAX_SLOTS 8 #define SPD_DATA_SIZE 256 #define SPD_TYPE_FPM 0x01 #define SPD_TYPE_EDO 0x02 #define SPD_TYPE_SDRAM 0x04 #define SPD_MIN_SIZE_EDO 8 #define SPD_MIN_SIZE_SDRAM 8 #define SPD_SIGNAL_LVTTL 0x01 #define SPD_REFRESH_NORMAL 0x00 #define SPD_SDR_REFRESH_SELF 0x80 #define SPD_SDR_BURST_PAGE 0x80 #define SPD_SDR_ATTR_BUFFERED 0x01 #define SPD_SDR_ATTR_REGISTERED 0x02 #define SPD_SDR_ATTR_EARLY_RAS 0x01 #define SPD_SDR_ATTR_AUTO_PC 0x02 #define SPD_SDR_ATTR_PC_ALL 0x04 #define SPD_SDR_ATTR_W1R_BURST 0x08 #define SPD_SDR_ATTR_VCC_LOW_5 0x10 #define SPD_SDR_ATTR_VCC_HI_5 0x20 typedef struct spd_edo_t { uint8_t bytes_used; uint8_t spd_size; uint8_t mem_type; uint8_t row_bits; uint8_t col_bits; uint8_t banks; uint8_t data_width_lsb; uint8_t data_width_msb; uint8_t signal_level; uint8_t trac; uint8_t tcac; uint8_t config; uint8_t refresh_rate; uint8_t dram_width; uint8_t ecc_width; uint8_t reserved[47]; uint8_t spd_rev; uint8_t checksum; uint8_t mfg_jedec[8]; uint8_t mfg_loc; char part_no[18]; uint8_t rev_code[2]; uint8_t mfg_year; uint8_t mfg_week; uint8_t serial[4]; uint8_t mfg_specific[27]; uint8_t vendor_specific[2]; uint8_t other_data[127]; uint8_t checksum2; } spd_edo_t; typedef struct spd_sdram_t { uint8_t bytes_used; uint8_t spd_size; uint8_t mem_type; uint8_t row_bits; uint8_t col_bits; uint8_t rows; uint8_t data_width_lsb; uint8_t data_width_msb; uint8_t signal_level; uint8_t tclk; uint8_t tac; uint8_t config; uint8_t refresh_rate; uint8_t sdram_width; uint8_t ecc_width; uint8_t tccd; uint8_t burst; uint8_t banks; uint8_t cas; uint8_t cslat; uint8_t we; uint8_t mod_attr; uint8_t dev_attr; uint8_t tclk2; uint8_t tac2; uint8_t tclk3; uint8_t tac3; uint8_t trp; uint8_t trrd; uint8_t trcd; uint8_t tras; uint8_t bank_density; uint8_t ca_setup; uint8_t ca_hold; uint8_t data_setup; uint8_t data_hold; uint8_t reserved[26]; uint8_t spd_rev, checksum; uint8_t mfg_jedec[8]; uint8_t mfg_loc; char part_no[18]; uint8_t rev_code[2]; uint8_t mfg_year; uint8_t mfg_week; uint8_t serial[4]; uint8_t mfg_specific[27]; uint8_t freq; uint8_t features; uint8_t other_data[127]; uint8_t checksum2; } spd_sdram_t; typedef struct spd_t { uint8_t slot; uint16_t size; uint16_t row1; uint16_t row2; union { uint8_t data[SPD_DATA_SIZE]; spd_edo_t edo_data; spd_sdram_t sdram_data; }; void *eeprom; } spd_t; extern void spd_register(uint8_t ram_type, uint8_t slot_mask, uint16_t max_module_size); extern void spd_write_drbs(uint8_t *regs, uint8_t reg_min, uint8_t reg_max, uint8_t drb_unit); extern void spd_write_drbs_with_ext(uint8_t *regs, uint8_t reg_min, uint8_t reg_max, uint8_t drb_unit); extern void spd_write_drbs_interleaved(uint8_t *regs, uint8_t reg_min, uint8_t reg_max, uint8_t drb_unit); extern void spd_write_drbs_ali1621(uint8_t *regs, uint8_t reg_min, uint8_t reg_max); #endif /*EMU_SPD_H*/ ```
/content/code_sandbox/src/include/86box/spd.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,212
```objective-c #ifndef VIDEO_EGA_RENDER_REMAP_H #define VIDEO_EGA_RENDER_REMAP_H #define VAR_BYTE_MODE (0 << 0) #define VAR_WORD_MODE_MA13 (1 << 0) #define VAR_WORD_MODE_MA15 (2 << 0) #define VAR_DWORD_MODE (3 << 0) #define VAR_MODE_MASK (3 << 0) #define VAR_ROW0_MA13 (1 << 2) #define VAR_ROW1_MA14 (1 << 3) #define ADDRESS_REMAP_FUNC(nr) \ static uint32_t address_remap_func_##nr(ega_t *ega, uint32_t in_addr) \ { \ uint32_t out_addr; \ \ switch (nr & VAR_MODE_MASK) { \ case VAR_BYTE_MODE: \ out_addr = in_addr; \ break; \ \ case VAR_WORD_MODE_MA13: \ out_addr = ((in_addr << 1) & 0x3fff8) | ((in_addr >> 13) & 0x4) | (in_addr & ~0x3ffff); \ break; \ \ case VAR_WORD_MODE_MA15: \ out_addr = ((in_addr << 1) & 0x3fff8) | ((in_addr >> 15) & 0x4) | (in_addr & ~0x3ffff); \ break; \ \ case VAR_DWORD_MODE: \ out_addr = ((in_addr << 2) & 0x3fff0) | ((in_addr >> 14) & 0xc) | (in_addr & ~0x3ffff); \ break; \ } \ \ if (nr & VAR_ROW0_MA13) \ out_addr = (out_addr & ~0x8000) | ((ega->sc & 1) ? 0x8000 : 0); \ if (nr & VAR_ROW1_MA14) \ out_addr = (out_addr & ~0x10000) | ((ega->sc & 2) ? 0x10000 : 0); \ \ return out_addr; \ } ADDRESS_REMAP_FUNC(0) ADDRESS_REMAP_FUNC(1) ADDRESS_REMAP_FUNC(2) ADDRESS_REMAP_FUNC(3) ADDRESS_REMAP_FUNC(4) ADDRESS_REMAP_FUNC(5) ADDRESS_REMAP_FUNC(6) ADDRESS_REMAP_FUNC(7) ADDRESS_REMAP_FUNC(8) ADDRESS_REMAP_FUNC(9) ADDRESS_REMAP_FUNC(10) ADDRESS_REMAP_FUNC(11) ADDRESS_REMAP_FUNC(12) ADDRESS_REMAP_FUNC(13) ADDRESS_REMAP_FUNC(14) ADDRESS_REMAP_FUNC(15) static uint32_t (*address_remap_funcs[16])(ega_t *ega, uint32_t in_addr) = { address_remap_func_0, address_remap_func_1, address_remap_func_2, address_remap_func_3, address_remap_func_4, address_remap_func_5, address_remap_func_6, address_remap_func_7, address_remap_func_8, address_remap_func_9, address_remap_func_10, address_remap_func_11, address_remap_func_12, address_remap_func_13, address_remap_func_14, address_remap_func_15 }; void ega_recalc_remap_func(ega_t *ega) { int func_nr; if (ega->crtc[0x14] & 0x40) func_nr = VAR_DWORD_MODE; else if (ega->crtc[0x17] & 0x40) func_nr = VAR_BYTE_MODE; else if ((ega->crtc[0x17] & 0x20) && ega->vram_limit > 64 * 1024) func_nr = VAR_WORD_MODE_MA15; else func_nr = VAR_WORD_MODE_MA13; if (!(ega->crtc[0x17] & 0x01)) func_nr |= VAR_ROW0_MA13; if (!(ega->crtc[0x17] & 0x02)) func_nr |= VAR_ROW1_MA14; ega->remap_required = (func_nr != 0); ega->remap_func = address_remap_funcs[func_nr]; } #endif /*VIDEO_RENDER_REMAP_H*/ ```
/content/code_sandbox/src/include/86box/vid_ega_render_remap.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
985
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * A better random number generation, used for floppy weak bits * and network MAC address generation. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_RANDOM_H #define EMU_RANDOM_H extern uint8_t random_generate(void); extern void random_init(void); #endif /*EMU_RANDOM_H*/ ```
/content/code_sandbox/src/include/86box/random.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
146
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Main include file for the application. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_LOG_H #define EMU_LOG_H #ifndef RELEASE_BUILD # ifdef __cplusplus extern "C" { # endif /* Function prototypes. */ extern void log_set_suppr_seen(void *priv, int suppr_seen); extern void log_set_dev_name(void *priv, char *dev_name); # ifdef HAVE_STDARG_H extern void log_out(void *priv, const char *fmt, va_list); extern void log_fatal(void *priv, const char *fmt, ...); # endif extern void *log_open(char *dev_name); extern void log_close(void *priv); # ifdef __cplusplus } # endif #else # define log_fatal(priv, fmt, ...) fatal(fmt, ...) #endif /*RELEASE_BUILD*/ #endif /*EMU_LOG_H*/ ```
/content/code_sandbox/src/include/86box/log.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
283
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Debug device for assisting in unit testing. * See doc/specifications/86box-unit-tester.md for more info. * If modifying the protocol, you MUST modify the specification * and increment the version number. * * * * Authors: GreaseMonkey, <thematrixeatsyou+86b@gmail.com> * */ #ifndef UNITTESTER_H #define UNITTESTER_H #ifdef __cplusplus extern "C" { #endif /* Global variables. */ extern const device_t unittester_device; /* Functions. */ #ifdef __cplusplus } #endif #endif /*UNITTESTER_H*/ ```
/content/code_sandbox/src/include/86box/unittester.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
198
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the PCI handler module. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_PCI_H #define EMU_PCI_H #define PCI_REG_VENDOR_ID_L 0x00 #define PCI_REG_VENDOR_ID_H 0x01 #define PCI_REG_DEVICE_ID_L 0x02 #define PCI_REG_DEVICE_ID_H 0x03 #define PCI_REG_COMMAND_L 0x04 #define PCI_REG_COMMAND_H 0x05 #define PCI_REG_STATUS_L 0x06 #define PCI_REG_STATUS_H 0x07 #define PCI_REG_REVISION 0x08 #define PCI_REG_PROG_IF 0x09 #define PCI_REG_SUBCLASS 0x0a #define PCI_REG_CLASS 0x0b #define PCI_REG_CACHELINE_SIZE 0x0c #define PCI_REG_LATENCY_TIMER 0x0d #define PCI_REG_HEADER_TYPE 0x0e #define PCI_REG_BIST 0x0f #define PCI_COMMAND_L_IO 0x01 #define PCI_COMMAND_L_MEM 0x02 #define PCI_COMMAND_L_BM 0x04 #define PCI_COMMAND_L_SPECIAL 0x08 #define PCI_COMMAND_L_MEM_WIEN 0x10 #define PCI_COMMAND_L_VGASNOOP 0x20 #define PCI_COMMAND_L_PARITY 0x40 #define PCI_COMMAND_H_SERR 0x01 #define PCI_COMMAND_H_FAST_B2B 0x02 #define PCI_COMMAND_H_INT_DIS 0x04 #define PCI_STATUS_L_INT 0x08 #define PCI_STATUS_L_CAPAB 0x10 #define PCI_STATUS_L_66MHZ 0x20 #define PCI_STATUS_L_FAST_B2B 0x80 #define PCI_STATUS_H_MDPERR 0x01 /* Master Data Parity Error */ #define PCI_STATUS_H_DEVSEL 0x06 #define PCI_STATUS_H_STA 0x08 /* Signaled Target Abort */ #define PCI_STATUS_H_RTA 0x10 /* Received Target Abort */ #define PCI_STATUS_H_RMA 0x20 /* Received Master Abort */ #define PCI_STATUS_H_SSE 0x40 /* Signaled System Error */ #define PCI_STATUS_H_DPERR 0x80 /* Detected Parity Error */ #define PCI_DEVSEL_FAST 0x00 #define PCI_DEVSEL_MEDIUM 0x02 #define PCI_DEVSEL_SLOW 0x04 #define FLAG_MECHANISM_1 0x00000001 #define FLAG_MECHANISM_2 0x00000002 #define FLAG_MECHANISM_SWITCH 0x00000004 #define FLAG_CONFIG_IO_ON 0x00000008 #define FLAG_CONFIG_DEV0_IO_ON 0x00000010 #define FLAG_CONFIG_M1_IO_ON 0x00000020 #define FLAG_NO_IRQ_STEERING 0x00000040 #define FLAG_NO_BRIDGES 0x00000080 #define FLAG_TRC_CONTROLS_CPURST 0x00000100 #define FLAG_MECHANISM_MASK FLAG_MECHANISM_1 | FLAG_MECHANISM_2 #define FLAG_MASK 0x0000007f #define PCI_INTA 1 #define PCI_INTB 2 #define PCI_INTC 3 #define PCI_INTD 4 #define PCI_MIRQ0 0 #define PCI_MIRQ1 1 #define PCI_MIRQ2 2 #define PCI_MIRQ3 3 #define PCI_MIRQ4 4 #define PCI_MIRQ5 5 #define PCI_MIRQ6 6 #define PCI_MIRQ7 7 #define PCI_IRQ_DISABLED -1 #define PCI_ADD_STRICT 0x40 #define PCI_ADD_MASK (PCI_ADD_STRICT - 1) #define PCI_ADD_VFIO 0x80 #define PCI_ADD_VFIO_MASK (PCI_ADD_VFIO - 1) #define PCI_CARD_VFIO PCI_ADD_VFIO #define PCI_BUS_INVALID 0xff #define PCI_IGNORE_NO_SLOT 0xff /* The number of an invalid PCI card. */ #define PCI_CARD_INVALID 0xef /* PCI cards (currently 32). */ #define PCI_CARDS_NUM 0x20 #define PCI_CARD_MAX (PCI_CARDS_NUM - 1) /* The number of PCI card INT pins - always at 4 per the PCI specification. */ #define PCI_INT_PINS_NUM 4 #define PCI_INT_PINS_MAX (PCI_INT_PINS_NUM - 1) /* The base for MIRQ lines accepted by pci_irq(). */ #define PCI_MIRQ_BASE PCI_CARDS_NUM /* PCI MIRQ lines (currently 8, this many are needed by the ALi M1543(C). */ #define PCI_MIRQS_NUM 8 #define PCI_MIRQ_MAX (PCI_MIRQS_NUM - 1) /* The base for internal IRQ lines accepted by pci_irq(). */ #define PCI_IIRQ_BASE 0x80 /* PCI direct IRQ lines - always at 4 per the PCI specification. */ #define PCI_IIRQS_NUM 4 #define PCI_IIRQ_MAX (PCI_IIRQS_NUM - 1) /* The base for direct IRQ lines accepted by pci_irq(). */ #define PCI_DIRQ_BASE 0xf0 /* PCI direct IRQ lines (currently 16 because we only emulate the legacy PIC). */ #define PCI_DIRQS_NUM 16 #define PCI_DIRQ_MAX (PCI_DIRQS_NUM - 1) /* PCI IRQ routings (currently 16, this many are needed by the OPTi 822). */ #define PCI_IRQS_NUM 16 #define PCI_IRQ_MAX (PCI_IRQS_NUM - 1) /* Legacy flags. */ #define PCI_REG_COMMAND PCI_REG_COMMAND_L #define PCI_COMMAND_IO PCI_COMMAND_L_IO #define PCI_COMMAND_MEM PCI_COMMAND_L_MEM #define PCI_CONFIG_TYPE_1 FLAG_MECHANISM_1 #define PCI_CONFIG_TYPE_2 FLAG_MECHANISM_2 #define PCI_CAN_SWITCH_TYPE FLAG_MECHANISM_SWITCH #define PCI_ALWAYS_EXPOSE_DEV0 FLAG_CONFIG_DEV0_IO_ON #define PCI_NO_IRQ_STEERING FLAG_NO_IRQ_STEERING #define PCI_NO_BRIDGES FLAG_NO_BRIDGES #define PCI_CONFIG_TYPE_MASK FLAG_MECHANISM_MASK #define bar_t pci_bar_t #define trc_init pci_trc_init #define pci_register_slot(card, type, inta, intb, intc, intd) \ pci_register_bus_slot(0, card, type, inta, intb, intc, intd) #define pci_set_mirq(mirq, level, irq_state) \ pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 1, irq_state) #define pci_set_iirq(pci_int, irq_state) \ pci_irq(PCI_IIRQ_BASE | (pci_int), 0, 0, 1, irq_state) #define pci_set_dirq(irq, irq_state) \ pci_irq(PCI_DIRQ_BASE | (irq), 0, 1, 1, irq_state) #define pci_set_irq(slot, pci_int, irq_state) \ pci_irq(slot, pci_int, 0, 1, irq_state) #define pci_clear_mirq(mirq, level, irq_state) \ pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 0, irq_state) #define pci_clear_iirq(pci_int, irq_state) \ pci_irq(PCI_IIRQ_BASE | (pci_int), 0, 0, 0, irq_state) #define pci_clear_dirq(dirq, irq_state) \ pci_irq(PCI_DIRQ_BASE | (irq), 0, 1, 0, irq_state) #define pci_clear_irq(slot, pci_int, irq_state) \ pci_irq(slot, pci_int, 0, 0, irq_state) enum { PCI_CARD_NORTHBRIDGE = 0, PCI_CARD_NORTHBRIDGE_SEC = 1, PCI_CARD_AGPBRIDGE = 2, PCI_CARD_SOUTHBRIDGE = 3, PCI_CARD_SOUTHBRIDGE_IDE = 4, PCI_CARD_SOUTHBRIDGE_PMU = 5, PCI_CARD_SOUTHBRIDGE_USB = 6, PCI_CARD_AGP = 0x0f, PCI_CARD_NORMAL = 0x10, PCI_CARD_VIDEO = 0x11, PCI_CARD_HANGUL = 0x12, PCI_CARD_IDE = 0x13, PCI_CARD_SCSI = 0x14, PCI_CARD_SOUND = 0x15, PCI_CARD_MODEM = 0x16, PCI_CARD_NETWORK = 0x17, PCI_CARD_UART = 0x18, PCI_CARD_USB = 0x19, PCI_CARD_BRIDGE = 0x1a }; enum { PCI_ADD_NORTHBRIDGE = 0, PCI_ADD_NORTHBRIDGE_SEC = 1, PCI_ADD_AGPBRIDGE = 2, PCI_ADD_SOUTHBRIDGE = 3, PCI_ADD_SOUTHBRIDGE_IDE = 4, PCI_ADD_SOUTHBRIDGE_PMU = 5, PCI_ADD_SOUTHBRIDGE_USB = 6, PCI_ADD_AGP = 0x0f, PCI_ADD_NORMAL = 0x10, PCI_ADD_VIDEO = 0x11, PCI_ADD_HANGUL = 0x12, PCI_ADD_IDE = 0x13, PCI_ADD_SCSI = 0x14, PCI_ADD_SOUND = 0x15, PCI_ADD_MODEM = 0x16, PCI_ADD_NETWORK = 0x17, PCI_ADD_UART = 0x18, PCI_ADD_USB = 0x19, PCI_ADD_BRIDGE = 0x1a }; typedef union { uint32_t addr; uint8_t addr_regs[4]; } pci_bar_t; extern int pci_burst_time; extern int agp_burst_time; extern int pci_nonburst_time; extern int agp_nonburst_time; extern int pci_flags; extern uint32_t pci_base; extern uint32_t pci_size; extern void pci_set_irq_routing(int pci_int, int irq); extern void pci_set_irq_level(int pci_int, int level); extern void pci_enable_mirq(int mirq); extern void pci_set_mirq_routing(int mirq, uint8_t irq); extern uint8_t pci_get_mirq_level(int mirq); extern void pci_set_mirq_level(int mirq, uint8_t irq); /* PCI raise IRQ: the first parameter is slot if < PCI_MIRQ_BASE, MIRQ if >= PCI_MIRQ_BASE and < PCI_DIRQ_BASE, and direct IRQ line if >= PCI_DIRQ_BASE (RichardG's hack that may no longer be needed). */ extern void pci_irq(uint8_t slot, uint8_t pci_int, int level, int set, uint8_t *irq_state); extern uint8_t pci_get_int(uint8_t slot, uint8_t pci_int); /* Relocate a PCI device to a new slot, required for the configurable IDSEL's of ALi M1543(c). */ extern void pci_relocate_slot(int type, int new_slot); /* Write PCI enable/disable key, split for the ALi M1435. */ extern void pci_key_write(uint8_t val); /* Set PMC (ie. change PCI configuration mechanism), 0 = #2, 1 = #1. */ extern void pci_set_pmc(uint8_t pmc); extern void pci_pic_reset(void); extern void pci_reset(void); /* Needed for the io.c handling of configuration mechanism #2 ports C000-CFFF. */ extern void pci_write(uint16_t port, uint8_t val, void *priv); extern void pci_writew(uint16_t port, uint16_t val, void *priv); extern void pci_writel(uint16_t port, uint32_t val, void *priv); extern uint8_t pci_read(uint16_t port, void *priv); extern uint16_t pci_readw(uint16_t port, void *priv); extern uint32_t pci_readl(uint16_t port, void *priv); extern uint8_t pci_register_bus(void); extern void pci_remap_bus(uint8_t bus_index, uint8_t bus_number); extern void pci_register_bus_slot(int bus, int card, int type, int inta, int intb, int intc, int intd); /* Add a PCI card. */ extern void pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, uint8_t *slot); /* Add an instance of the PCI bridge. */ extern void pci_add_bridge(uint8_t agp, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, uint8_t *slot); /* Register the cards that have been added into slots. */ extern void pci_register_cards(void); extern void pci_init(int flags); /* PCI bridge stuff. */ extern void pci_bridge_set_ctl(void *priv, uint8_t ctl); #ifdef EMU_DEVICE_H extern const device_t dec21150_device; extern const device_t ali5243_agp_device; extern const device_t ali5247_agp_device; extern const device_t i440lx_agp_device; extern const device_t i440bx_agp_device; extern const device_t i440gx_agp_device; extern const device_t via_vp3_agp_device; extern const device_t via_mvp3_agp_device; extern const device_t via_apro_agp_device; extern const device_t via_vt8601_agp_device; extern const device_t sis_5xxx_agp_device; #endif #endif /*EMU_PCI_H*/ ```
/content/code_sandbox/src/include/86box/pci.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
3,182
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Header of the code common to the AHA-154x series of SCSI * Host Adapters made by Adaptec, Inc. and the BusLogic series * of SCSI Host Adapters made by Mylex. * These controllers were designed for various buses. * * * * Authors: TheCollector1995, <mariogplayer@gmail.com> * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef SCSI_X54X_H #define SCSI_X54X_H #define SCSI_DELAY_TM 1 /* was 50 */ #define ROM_SIZE 16384 /* one ROM is 16K */ #define NVR_SIZE 256 /* size of NVR */ /* EEPROM map and bit definitions. */ #define EE0_HOSTID 0x07 /* EE(0) [2:0] */ #define EE0_ALTFLOP 0x80 /* EE(0) [7] FDC at 370h */ #define EE1_IRQCH 0x07 /* EE(1) [3:0] */ #define EE1_DMACH 0x70 /* EE(1) [7:4] */ #define EE2_RMVOK 0x01 /* EE(2) [0] Support removable disks */ #define EE2_HABIOS 0x02 /* EE(2) [1] HA Bios Space Reserved */ #define EE2_INT19 0x04 /* EE(2) [2] HA Bios Controls INT19 */ #define EE2_DYNSCAN 0x08 /* EE(2) [3] Dynamically scan bus */ #define EE2_TWODRV 0x10 /* EE(2) [4] Allow more than 2 drives */ #define EE2_SEEKRET 0x20 /* EE(2) [5] Immediate return on seek */ #define EE2_EXT1G 0x80 /* EE(2) [7] Extended Translation >1GB */ #define EE3_SPEED 0x00 /* EE(3) [7:0] DMA Speed */ #define SPEED_33 0xFF #define SPEED_50 0x00 #define SPEED_56 0x04 #define SPEED_67 0x01 #define SPEED_80 0x02 #define SPEED_10 0x03 #define EE4_FLOPTOK 0x80 /* EE(4) [7] Support Flopticals */ #define EE6_PARITY 0x01 /* EE(6) [0] parity check enable */ #define EE6_TERM 0x02 /* EE(6) [1] host term enable */ #define EE6_RSTBUS 0x04 /* EE(6) [2] reset SCSI bus on boot */ #define EEE_SYNC 0x01 /* EE(E) [0] Enable Sync Negotiation */ #define EEE_DISCON 0x02 /* EE(E) [1] Enable Disconnection */ #define EEE_FAST 0x04 /* EE(E) [2] Enable FAST SCSI */ #define EEE_START 0x08 /* EE(E) [3] Enable Start Unit */ /* * Host Adapter I/O ports. * * READ Port x+0: STATUS * WRITE Port x+0: CONTROL * * READ Port x+1: DATA * WRITE Port x+1: COMMAND * * READ Port x+2: INTERRUPT STATUS * WRITE Port x+2: (undefined?) * * R/W Port x+3: (undefined) */ /* WRITE CONTROL commands. */ #define CTRL_HRST 0x80 /* Hard reset */ #define CTRL_SRST 0x40 /* Soft reset */ #define CTRL_IRST 0x20 /* interrupt reset */ #define CTRL_SCRST 0x10 /* SCSI bus reset */ /* READ STATUS. */ #define STAT_STST 0x80 /* self-test in progress */ #define STAT_DFAIL 0x40 /* internal diagnostic failure */ #define STAT_INIT 0x20 /* mailbox initialization required */ #define STAT_IDLE 0x10 /* HBA is idle */ #define STAT_CDFULL 0x08 /* Command/Data output port is full */ #define STAT_DFULL 0x04 /* Data input port is full */ #define STAT_INVCMD 0x01 /* Invalid command */ /* READ/WRITE DATA. */ #define CMD_NOP 0x00 /* No operation */ #define CMD_MBINIT 0x01 /* mailbox initialization */ #define CMD_START_SCSI 0x02 /* Start SCSI command */ #define CMD_BIOSCMD 0x03 /* Execute ROM BIOS command */ #define CMD_INQUIRY 0x04 /* Adapter inquiry */ #define CMD_EMBOI 0x05 /* enable Mailbox Out Interrupt */ #define CMD_SELTIMEOUT 0x06 /* Set SEL timeout */ #define CMD_BUSON_TIME 0x07 /* set bus-On time */ #define CMD_BUSOFF_TIME 0x08 /* set bus-off time */ #define CMD_DMASPEED 0x09 /* set ISA DMA speed */ #define CMD_RETDEVS 0x0A /* return installed devices */ #define CMD_RETCONF 0x0B /* return configuration data */ #define CMD_TARGET 0x0C /* set HBA to target mode */ #define CMD_RETSETUP 0x0D /* return setup data */ #define CMD_WRITE_CH2 0x1A /* write channel 2 buffer */ #define CMD_READ_CH2 0x1B /* read channel 2 buffer */ #define CMD_ECHO 0x1F /* ECHO command data */ #define CMD_OPTIONS 0x21 /* set adapter options */ /* READ INTERRUPT STATUS. */ #define INTR_ANY 0x80 /* any interrupt */ #define INTR_SRCD 0x08 /* SCSI reset detected */ #define INTR_HACC 0x04 /* HA command complete */ #define INTR_MBOA 0x02 /* MBO empty */ #define INTR_MBIF 0x01 /* MBI full */ #define ADDR_TO_U32(x) (((x).hi << 16) | ((x).mid << 8) | ((x).lo & 0xFF)) #define U32_TO_ADDR(a, x) \ do { \ (a).hi = (x) >> 16; \ (a).mid = (x) >> 8; \ (a).lo = (x) &0xFF; \ } while (0) /* * Mailbox Definitions. * * Mailbox Out (MBO) command values. */ #define MBO_FREE 0x00 #define MBO_START 0x01 #define MBO_ABORT 0x02 /* Mailbox In (MBI) status values. */ #define MBI_FREE 0x00 #define MBI_SUCCESS 0x01 #define MBI_ABORT 0x02 #define MBI_NOT_FOUND 0x03 #define MBI_ERROR 0x04 /* * * CCB - SCSI Command Control Block * * The CCB is a superset of the CDB (Command Descriptor Block) * and specifies detailed information about a SCSI command. * */ /* Byte 0 Command Control Block Operation Code */ #define SCSI_INITIATOR_COMMAND 0x00 #define TARGET_MODE_COMMAND 0x01 #define SCATTER_GATHER_COMMAND 0x02 #define SCSI_INITIATOR_COMMAND_RES 0x03 #define SCATTER_GATHER_COMMAND_RES 0x04 #define BUS_RESET 0x81 /* Byte 1 Address and Direction Control */ #define CCB_TARGET_ID_SHIFT 0x06 /* CCB Op Code = 00, 02 */ #define CCB_INITIATOR_ID_SHIFT 0x06 /* CCB Op Code = 01 */ #define CCB_DATA_XFER_IN 0x01 #define CCB_DATA_XFER_OUT 0x02 #define CCB_LUN_MASK 0x07 /* Logical Unit Number */ /* Byte 2 SCSI_Command_Length - Length of SCSI CDB Byte 3 Request Sense Allocation Length */ #define FOURTEEN_BYTES 0x00 /* Request Sense Buffer size */ #define NO_AUTO_REQUEST_SENSE 0x01 /* No Request Sense Buffer */ /* Bytes 4, 5 and 6 Data Length - Data transfer byte count */ /* Bytes 7, 8 and 9 Data Pointer - SGD List or Data Buffer */ /* Bytes 10, 11 and 12 Link Pointer - Next CCB in Linked List */ /* Byte 13 Command Link ID - TBD (I don't know yet) */ /* Byte 14 Host Status - Host Adapter status */ #define CCB_COMPLETE 0x00 /* CCB completed without error */ #define CCB_LINKED_COMPLETE 0x0A /* Linked command completed */ #define CCB_LINKED_COMPLETE_INT 0x0B /* Linked complete with intr */ #define CCB_SELECTION_TIMEOUT 0x11 /* Set SCSI selection timed out */ #define CCB_DATA_OVER_UNDER_RUN 0x12 #define CCB_UNEXPECTED_BUS_FREE 0x13 /* Trg dropped SCSI BSY */ #define CCB_PHASE_SEQUENCE_FAIL 0x14 /* Trg bus phase sequence fail */ #define CCB_BAD_MBO_COMMAND 0x15 /* MBO command not 0, 1 or 2 */ #define CCB_INVALID_OP_CODE 0x16 /* CCB invalid operation code */ #define CCB_BAD_LINKED_LUN 0x17 /* Linked CCB LUN diff from 1st */ #define CCB_INVALID_DIRECTION 0x18 /* Invalid target direction */ #define CCB_DUPLICATE_CCB 0x19 /* Duplicate CCB */ #define CCB_INVALID_CCB 0x1A /* Invalid CCB - bad parameter */ #define lba32_blk(p) ((uint32_t) (p->u.lba.lba0 << 24) | (p->u.lba.lba1 << 16) | (p->u.lba.lba2 << 8) | p->u.lba.lba3) /* * * Scatter/Gather Segment List Definitions * * Adapter limits */ #define MAX_SG_DESCRIPTORS 32 /* Always make the array 32 elements long, if less are used, that's not an issue. */ #pragma pack(push, 1) typedef struct addr24_s { uint8_t hi; uint8_t mid; uint8_t lo; } addr24_t; /* Structure for the INQUIRE_SETUP_INFORMATION reply. */ typedef struct ReplyInquireSetupInformationSynchronousValue_t { uint8_t uOffset : 4; uint8_t uTransferPeriod : 3; uint8_t fSynchronous : 1; } ReplyInquireSetupInformationSynchronousValue; typedef struct ReplyInquireSetupInformation_t { uint8_t fSynchronousInitiationEnabled : 1; uint8_t fParityCheckingEnabled : 1; uint8_t uReserved1 : 6; uint8_t uBusTransferRate; uint8_t uPreemptTimeOnBus; uint8_t uTimeOffBus; uint8_t cMailbox; addr24_t MailboxAddress; ReplyInquireSetupInformationSynchronousValue SynchronousValuesId0To7[8]; uint8_t uDisconnectPermittedId0To7; uint8_t VendorSpecificData[28]; } ReplyInquireSetupInformation; typedef struct MailboxInit_t { uint8_t Count; addr24_t Address; } MailboxInit_t; typedef struct Mailbox_t { uint8_t CmdStatus; addr24_t CCBPointer; } Mailbox_t; typedef struct Mailbox32_t { uint32_t CCBPointer; union { struct out_t { uint8_t Reserved[3]; uint8_t ActionCode; } out; struct in_t { uint8_t HostStatus; uint8_t TargetStatus; uint8_t Reserved; uint8_t CompletionCode; } in; } u; } Mailbox32_t; /* Byte 15 Target Status See scsi.h files for these statuses. Bytes 16 and 17 Reserved (must be 0) Bytes 18 through 18+n-1, where n=size of CDB Command Descriptor Block */ typedef struct CCB32_t { uint8_t Opcode; uint8_t Reserved1 : 3; uint8_t ControlByte : 2; uint8_t TagQueued : 1; uint8_t QueueTag : 2; uint8_t CdbLength; uint8_t RequestSenseLength; uint32_t DataLength; uint32_t DataPointer; uint8_t Reserved2[2]; uint8_t HostStatus; uint8_t TargetStatus; uint8_t Id; uint8_t Lun : 5; uint8_t LegacyTagEnable : 1; uint8_t LegacyQueueTag : 2; uint8_t Cdb[12]; uint8_t Reserved3[6]; uint32_t SensePointer; } CCB32; typedef struct CCB_t { uint8_t Opcode; uint8_t Lun : 3; uint8_t ControlByte : 2; uint8_t Id : 3; uint8_t CdbLength; uint8_t RequestSenseLength; addr24_t DataLength; addr24_t DataPointer; addr24_t LinkPointer; uint8_t LinkId; uint8_t HostStatus; uint8_t TargetStatus; uint8_t Reserved[2]; uint8_t Cdb[12]; } CCB; typedef struct CCBC_t { uint8_t Opcode; uint8_t Pad1 : 3; uint8_t ControlByte : 2; uint8_t Pad2 : 3; uint8_t CdbLength; uint8_t RequestSenseLength; uint8_t Pad3[9]; uint8_t CompletionCode; /* Only used by the 1542C/CF(/CP?) BIOS mailboxes */ uint8_t HostStatus; uint8_t TargetStatus; uint8_t Pad4[2]; uint8_t Cdb[12]; } CCBC; typedef union CCBU_t { CCB32 new; CCB old; CCBC common; } CCBU; typedef struct { CCBU CmdBlock; uint8_t *RequestSenseBuffer; uint32_t CCBPointer; int Is24bit; uint8_t TargetID; uint8_t LUN; uint8_t HostStatus; uint8_t TargetStatus; uint8_t MailboxCompletionCode; } Req_t; typedef struct BIOSCMD_t { uint8_t command; uint8_t lun : 3; uint8_t reserved : 2; uint8_t id : 3; union { struct chs_t { uint16_t cyl; uint8_t head; uint8_t sec; } chs; struct lba_t { uint8_t lba0; /* MSB */ uint8_t lba1; uint8_t lba2; uint8_t lba3; /* LSB */ } lba; } u; uint8_t secount; addr24_t dma_address; } BIOSCMD; typedef struct SGE32_t { uint32_t Segment; uint32_t SegmentPointer; } SGE32; typedef struct SGE_t { addr24_t Segment; addr24_t SegmentPointer; } SGE; #pragma pack(pop) #define X54X_CDROM_BOOT 1 #define X54X_32BIT 2 #define X54X_LBA_BIOS 4 #define X54X_INT_GEOM_WRITABLE 8 #define X54X_MBX_24BIT 16 #define X54X_ISAPNP 32 #define X54X_HAS_SIGNATURE 64 typedef struct x54x_t { /* 32 bytes */ char vendor[16]; /* name of device vendor */ char name[16]; /* name of device */ /* 24 bytes */ int8_t type; /* type of device */ int8_t IrqEnabled; int8_t Irq; int8_t DmaChannel; int8_t HostID; uint8_t callback_phase : 4; uint8_t callback_sub_phase : 4; uint8_t scsi_cmd_phase; uint8_t bus; uint8_t sync; uint8_t parity; uint8_t shram_mode; uint8_t Geometry; uint8_t Control; uint8_t Command; uint8_t CmdParam; uint8_t BusOnTime; uint8_t BusOffTime; uint8_t ATBusSpeed; uint8_t setup_info_len; uint8_t max_id; uint8_t pci_slot; uint8_t irq_state; uint8_t pad; uint8_t pad0; uint8_t pad1; uint8_t temp_cdb[12]; /* for multi-threading, keep these volatile */ volatile uint8_t Status; volatile uint8_t Interrupt; volatile uint8_t MailboxIsBIOS; volatile uint8_t ToRaise; volatile uint8_t flags; /* 65928 bytes */ uint8_t pos_regs[8]; /* MCA */ uint8_t CmdBuf[128]; uint8_t DataBuf[65536]; uint8_t shadow_ram[128]; uint8_t dma_buffer[128]; uint8_t cmd_33_buf[4096]; /* 16 bytes */ char *fw_rev; /* The 4 bytes of the revision command information + 2 extra bytes for BusLogic */ uint8_t *rom1; /* main BIOS image */ uint8_t *rom2; /* SCSI-Select image */ uint8_t *nvr; /* EEPROM buffer */ /* 6 words = 12 bytes */ uint16_t DataReply; uint16_t DataReplyLeft; uint16_t rom_ioaddr; /* offset in BIOS of I/O addr */ uint16_t rom_shram; /* index to shared RAM */ uint16_t rom_shramsz; /* size of shared RAM */ uint16_t rom_fwhigh; /* offset in BIOS of ver ID */ uint16_t pnp_len; /* length of the PnP ROM */ uint16_t pnp_offset; /* offset in the microcode ROM of the PnP ROM */ uint16_t cmd_33_len; /* length of the SCSISelect code decompressor program */ uint16_t cmd_33_offset; /* offset in the microcode ROM of the SCSISelect code decompressor program */ /* 16 + 20 + 52 = 88 bytes */ volatile int MailboxOutInterrupts; volatile int PendingInterrupt; volatile int Lock; volatile int target_data_len; volatile int pad2; uint32_t Base; uint32_t fdc_address; uint32_t rom_addr; /* address of BIOS ROM */ uint32_t CmdParamLeft; uint32_t Outgoing; uint32_t transfer_size; volatile uint32_t MailboxInit; volatile uint32_t MailboxCount; volatile uint32_t MailboxOutAddr; volatile uint32_t MailboxOutPosCur; volatile uint32_t MailboxInAddr; volatile uint32_t MailboxInPosCur; volatile uint32_t MailboxReq; volatile uint32_t BIOSMailboxInit; volatile uint32_t BIOSMailboxCount; volatile uint32_t BIOSMailboxOutAddr; volatile uint32_t BIOSMailboxOutPosCur; volatile uint32_t BIOSMailboxReq; volatile uint32_t Residue; volatile uint32_t card_bus; /* Basically a copy of device flags */ /* 8 bytes */ uint64_t temp_period; /* 16 bytes */ double media_period; double ha_bps; /* bytes per second */ /* 8 bytes */ char *bios_path; /* path to BIOS image file */ char *mcode_path; /* path to microcode image file, needed by the AHA-1542CP */ char nvr_path[64]; /* path to NVR image file */ /* 56 bytes */ /* Pointer to a structure of vendor-specific data that only the vendor-specific code can understand */ void *ven_data; /* Pointer to a function that performs vendor-specific operation during the timer callback */ void (*ven_callback)(void *priv); /* Pointer to a function that executes the second parameter phase of the vendor-specific command */ void (*ven_cmd_phase1)(void *priv); /* Pointer to a function that gets the host adapter ID in case it has to be read from a non-standard location */ uint8_t (*ven_get_host_id)(void *priv); /* Pointer to a function that updates the IRQ in the vendor-specific space */ uint8_t (*ven_get_irq)(void *priv); /* Pointer to a function that updates the DMA channel in the vendor-specific space */ uint8_t (*ven_get_dma)(void *priv); /* Pointer to a function that returns whether command is fast */ uint8_t (*ven_cmd_is_fast)(void *priv); /* Pointer to a function that executes vendor-specific fast path commands */ uint8_t (*ven_fast_cmds)(void *priv, uint8_t cmd); /* Pointer to a function that gets the parameter length for vendor-specific commands */ uint8_t (*get_ven_param_len)(void *priv); /* Pointer to a function that executes vendor-specific commands and returns whether or not to suppress the IRQ */ uint8_t (*ven_cmds)(void *priv); /* Pointer to a function that fills in the vendor-specific setup data */ void (*get_ven_data)(void *priv); /* Pointer to a function that determines if the mode is aggressive */ uint8_t (*is_aggressive_mode)(void *priv); /* Pointer to a function that returns interrupt type (0 = edge, 1 = level) */ uint8_t (*interrupt_type)(void *priv); /* Pointer to a function that resets vendor-specific data */ void (*ven_reset)(void *priv); rom_t bios; /* BIOS memory descriptor */ rom_t uppersck; /* BIOS memory descriptor */ mem_mapping_t mmio_mapping; pc_timer_t timer; pc_timer_t ResetCB; Req_t Req; fdc_t *fdc; } x54x_t; extern void x54x_reset_ctrl(x54x_t *dev, uint8_t Reset); extern uint8_t x54x_mbo_process(x54x_t *dev); extern void x54x_wait_for_poll(void); extern void x54x_io_set(x54x_t *dev, uint32_t base, uint8_t len); extern void x54x_io_remove(x54x_t *dev, uint32_t base, uint8_t len); extern void x54x_mem_init(x54x_t *dev, uint32_t addr); extern void x54x_mem_enable(x54x_t *dev); extern void x54x_mem_set_addr(x54x_t *dev, uint32_t base); extern void x54x_mem_disable(x54x_t *dev); extern void *x54x_init(const device_t *info); extern void x54x_close(void *priv); extern void x54x_device_reset(void *priv); #endif ```
/content/code_sandbox/src/include/86box/scsi_x54x.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
5,268
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the common disk controller handler. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_HDC_H #define EMU_HDC_H #define MFM_NUM 2 /* 2 drives per controller supported */ #define ESDI_NUM 2 /* 2 drives per controller supported */ #define XTA_NUM 2 /* 2 drives per controller supported */ #define IDE_NUM 10 /* 8 drives per AT IDE + 2 for XT IDE */ #define ATAPI_NUM 8 /* 8 drives per AT IDE */ #define SCSI_NUM 16 /* theoretically the controller can have at \ * least 7 devices, with each device being \ * able to support 8 units, but hey... */ /* Controller types. */ #define HDC_NONE 0 #define HDC_INTERNAL 1 #define HDC_MAX 2 extern int hdc_current[HDC_MAX]; extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */ extern const device_t st506_xt_wdxt_gen_device; /* st506_xt_wdxt_gen */ extern const device_t st506_xt_dtc5150x_device; /* st506_xt_dtc */ extern const device_t st506_xt_st11_m_device; /* st506_xt_st11_m */ extern const device_t st506_xt_st11_r_device; /* st506_xt_st11_m */ extern const device_t st506_xt_wd1002a_wx1_device; /* st506_xt_wd1002a_wx1 */ extern const device_t st506_xt_wd1002a_wx1_nobios_device; /* st506_xt_wd1002a_wx1 */ extern const device_t st506_xt_wd1002a_27x_device; /* st506_xt_wd1002a_27x */ extern const device_t st506_at_wd1003_device; /* st506_at_wd1003 */ extern const device_t st506_xt_wd1004a_wx1_device; /* st506_xt_wd1004a_wx1 */ extern const device_t st506_xt_wd1004_27x_device; /* st506_xt_wd1004_27x */ extern const device_t st506_xt_wd1004a_27x_device; /* st506_xt_wd1004a_27x */ extern const device_t st506_xt_victor_v86p_device; /* st506_xt_victor_v86p */ extern const device_t st506_xt_toshiba_t1200_device; /* st506_xt_toshiba_t1200 */ extern const device_t esdi_at_wd1007vse1_device; /* esdi_at */ extern const device_t esdi_ps2_device; /* esdi_mca */ extern const device_t ide_isa_device; /* isa_ide */ extern const device_t ide_isa_2ch_device; /* isa_ide_2ch */ extern const device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */ extern const device_t ide_vlb_device; /* vlb_ide */ extern const device_t ide_vlb_2ch_device; /* vlb_ide_2ch */ extern const device_t ide_pci_device; /* pci_ide */ extern const device_t ide_pci_2ch_device; /* pci_ide_2ch */ extern const device_t ide_ali1489_device; /* ALi M1489 */ extern const device_t ide_ali5213_device; /* ALi M5213 */ extern const device_t ide_cmd640_vlb_device; /* CMD PCI-640B VLB */ extern const device_t ide_cmd640_vlb_178_device; /* CMD PCI-640B VLB (Port 178h) */ extern const device_t ide_cmd640_vlb_pri_device; /* CMD PCI-640B VLB (Only primary channel) */ extern const device_t ide_cmd640_vlb_pri_178_device; /* CMD PCI-640B VLB (Only primary channel) (Port 178h) */ extern const device_t ide_cmd640_vlb_sec_device; /* CMD PCI-640B VLB (Only secondary channel) */ extern const device_t ide_cmd640_vlb_sec_178_device; /* CMD PCI-640B VLB (Only secondary channel) (Port 178h) */ extern const device_t ide_cmd640_pci_device; /* CMD PCI-640B PCI */ extern const device_t ide_cmd640_pci_legacy_only_device; /* CMD PCI-640B PCI (Legacy Mode Only) */ extern const device_t ide_cmd640_pci_single_channel_device; /* CMD PCI-640B PCI (Only primary channel) */ extern const device_t ide_cmd640_pci_single_channel_sec_device; /* CMD PCI-640B PCI (Only secondary channel) */ extern const device_t ide_cmd646_device; /* CMD PCI-646 */ extern const device_t ide_cmd646_legacy_only_device; /* CMD PCI-646 (Legacy Mode Only) */ extern const device_t ide_cmd646_single_channel_device; /* CMD PCI-646 (Only primary channel) */ extern const device_t ide_opti611_vlb_device; /* OPTi 82c611/611A VLB */ extern const device_t ide_opti611_vlb_sec_device; /* OPTi 82c611/611A VLB (Secondary channel) */ extern const device_t ide_um8673f_device; /* UMC UM8673F */ extern const device_t ide_um8886af_device; /* UMC UM8886AF */ extern const device_t ide_w83769f_vlb_device; /* Winbond W83769F VLB */ extern const device_t ide_w83769f_vlb_34_device; /* Winbond W83769F VLB (Port 34h) */ extern const device_t ide_w83769f_pci_device; /* Winbond W83769F PCI */ extern const device_t ide_w83769f_pci_34_device; /* Winbond W83769F PCI (Port 34h) */ extern const device_t ide_ter_device; extern const device_t ide_ter_pnp_device; extern const device_t ide_qua_device; extern const device_t ide_qua_pnp_device; extern const device_t mcide_device; extern const device_t xta_wdxt150_device; /* xta_wdxt150 */ extern const device_t xta_hd20_device; /* EuroPC internal */ extern const device_t xtide_device; /* xtide_xt */ extern const device_t xtide_at_device; /* xtide_at */ extern const device_t xtide_acculogic_device; /* xtide_ps2 */ extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */ /* Miscellaneous */ extern const device_t lba_enhancer_device; extern void hdc_init(void); extern void hdc_reset(void); extern const char *hdc_get_internal_name(int hdc); extern int hdc_get_from_internal_name(char *s); extern int hdc_has_config(int hdc); extern const device_t *hdc_get_device(int hdc); extern int hdc_get_flags(int hdc); extern int hdc_available(int hdc); #endif /*EMU_HDC_H*/ ```
/content/code_sandbox/src/include/86box/hdc.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,644
```objective-c see COPYING for more details */ #ifndef VIDEO_MDA_H #define VIDEO_MDA_H typedef struct mda_t { mem_mapping_t mapping; uint8_t crtc[32]; int crtcreg; uint8_t ctrl; uint8_t stat; uint64_t dispontime; uint64_t dispofftime; pc_timer_t timer; int firstline; int lastline; int fontbase; int linepos; int displine; int vc; int sc; uint16_t ma; uint16_t maback; int con; int coff; int cursoron; int dispon; int blink; int vsynctime; int vadj; int monitor_index; int prev_monitor_index; uint8_t *vram; } mda_t; #define VIDEO_MONITOR_PROLOGUE() \ { \ mda->prev_monitor_index = monitor_index_global; \ monitor_index_global = mda->monitor_index; \ } #define VIDEO_MONITOR_EPILOGUE() \ { \ monitor_index_global = mda->prev_monitor_index; \ } void mda_init(mda_t *mda); void mda_setcol(int chr, int blink, int fg, uint8_t cga_ink); void mda_out(uint16_t addr, uint8_t val, void *priv); uint8_t mda_in(uint16_t addr, void *priv); void mda_write(uint32_t addr, uint8_t val, void *priv); uint8_t mda_read(uint32_t addr, void *priv); void mda_recalctimings(mda_t *mda); void mda_poll(void *priv); #ifdef EMU_DEVICE_H extern const device_t mda_device; #endif #endif /*VIDEO_MDA_H*/ ```
/content/code_sandbox/src/include/86box/vid_mda.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
424
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Voodoo Graphics, 2, Banshee, 3 emulation. * * * * Authors: Sarah Walker, <path_to_url * leilei * */ #ifndef VIDEO_VOODOO_REG_H #define VIDEO_VOODOO_REG_H void voodoo_reg_writel(uint32_t addr, uint32_t val, void *priv); #endif /*VIDEO_VOODOO_REG_H*/ ```
/content/code_sandbox/src/include/86box/vid_voodoo_reg.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
154
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the raw sector-based floppy image format, * as well as the Japanese FDI, CopyQM, and FDF formats. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_FLOPPY_IMG_H #define EMU_FLOPPY_IMG_H extern void img_init(void); extern void img_load(int drive, char *fn); extern void img_close(int drive); #endif /*EMU_FLOPPY_IMG_H*/ ```
/content/code_sandbox/src/include/86box/fdd_img.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
201
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Handling of the emulated chipsets. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_CHIPSET_H #define EMU_CHIPSET_H /* ACC */ extern const device_t acc2168_device; /* ALi */ extern const device_t ali1217_device; extern const device_t ali1429_device; extern const device_t ali1429g_device; extern const device_t ali1409_device; extern const device_t ali1435_device; extern const device_t ali1489_device; extern const device_t ali1531_device; extern const device_t ali1541_device; extern const device_t ali1543_device; extern const device_t ali1543c_device; extern const device_t ali1621_device; extern const device_t ali6117d_device; /* AMD */ extern const device_t amd640_device; /* Compaq */ extern const device_t compaq_386_device; extern const device_t compaq_genoa_device; /* Contaq/Cypress */ extern const device_t contaq_82c596a_device; extern const device_t contaq_82c597_device; /* C&T */ extern const device_t ct_82c100_device; extern const device_t neat_device; extern const device_t scat_device; extern const device_t scat_4_device; extern const device_t scat_sx_device; extern const device_t cs8230_device; extern const device_t cs4031_device; /* G2 */ extern const device_t gc100_device; extern const device_t gc100a_device; /* Headland */ extern const device_t headland_gc10x_device; extern const device_t headland_gc113_device; extern const device_t headland_ht18a_device; extern const device_t headland_ht18b_device; extern const device_t headland_ht18c_device; extern const device_t headland_ht21c_d_device; extern const device_t headland_ht21e_device; /* IMS */ extern const device_t ims8848_device; /* Intel */ extern const device_t intel_82335_device; extern const device_t i420ex_device; extern const device_t i420ex_ide_device; extern const device_t i420tx_device; extern const device_t i420zx_device; extern const device_t i430lx_device; extern const device_t i430nx_device; extern const device_t i430fx_device; extern const device_t i430fx_old_device; extern const device_t i430fx_rev02_device; extern const device_t i430hx_device; extern const device_t i430vx_device; extern const device_t i430tx_device; extern const device_t i440fx_device; extern const device_t i440lx_device; extern const device_t i440ex_device; extern const device_t i440bx_device; extern const device_t i440bx_no_agp_device; extern const device_t i440gx_device; extern const device_t i440zx_device; extern const device_t i450kx_device; extern const device_t sio_device; extern const device_t sio_zb_device; extern const device_t piix_device; extern const device_t piix_no_mirq_device; extern const device_t piix_old_device; extern const device_t piix_rev02_device; extern const device_t piix3_device; extern const device_t piix3_ioapic_device; extern const device_t piix4_device; extern const device_t piix4e_device; extern const device_t slc90e66_device; extern const device_t ioapic_device; /* OPTi */ extern const device_t opti283_device; extern const device_t opti291_device; extern const device_t opti381_device; extern const device_t opti391_device; extern const device_t opti481_device; extern const device_t opti493_device; extern const device_t opti495_device; extern const device_t opti499_device; extern const device_t opti601_device; extern const device_t opti602_device; extern const device_t opti802g_device; extern const device_t opti802g_pci_device; extern const device_t opti822_device; extern const device_t opti895_device; extern const device_t opti5x7_device; extern const device_t opti5x7_pci_device; /* SiS */ extern const device_t rabbit_device; extern const device_t sis_85c401_device; extern const device_t sis_85c460_device; extern const device_t sis_85c461_device; extern const device_t sis_85c471_device; extern const device_t sis_85c496_device; extern const device_t sis_85c496_ls486e_device; extern const device_t sis_85c50x_device; extern const device_t sis_550x_85c503_device; extern const device_t sis_85c50x_5503_device; extern const device_t sis_550x_device; extern const device_t sis_5511_device; extern const device_t sis_5571_device; extern const device_t sis_5581_device; extern const device_t sis_5591_1997_device; extern const device_t sis_5591_device; extern const device_t sis_5600_1997_device; extern const device_t sis_5600_device; /* ST */ extern const device_t stpc_client_device; extern const device_t stpc_consumer2_device; extern const device_t stpc_elite_device; extern const device_t stpc_atlas_device; extern const device_t stpc_serial_device; extern const device_t stpc_lpt_device; /* UMC */ extern const device_t umc_8886f_device; extern const device_t umc_8886af_device; extern const device_t umc_8886bf_device; extern const device_t umc_8890_device; extern const device_t umc_hb4_device; /* VIA */ extern const device_t via_vt82c49x_device; extern const device_t via_vt82c49x_pci_device; extern const device_t via_vt82c49x_pci_ide_device; extern const device_t via_vt82c505_device; extern const device_t via_vpx_device; extern const device_t via_vp3_device; extern const device_t via_mvp3_device; extern const device_t via_apro_device; extern const device_t via_apro133_device; extern const device_t via_apro133a_device; extern const device_t via_vt8601_device; extern const device_t via_vt82c586b_device; extern const device_t via_vt82c596a_device; extern const device_t via_vt82c596b_device; extern const device_t via_vt82c686a_device; extern const device_t via_vt82c686b_device; extern const device_t via_vt8231_device; /* VLSI */ extern const device_t vl82c480_device; extern const device_t vl82c486_device; extern const device_t vlsi_scamp_device; /* WD */ extern const device_t wd76c10_device; /* Miscellaneous Hardware */ extern const device_t nec_mate_unk_device; extern const device_t phoenix_486_jumper_device; extern const device_t phoenix_486_jumper_pci_device; #ifdef USE_OLIVETTI extern const device_t olivetti_eva_device; #endif /* USE_OLIVETTI */ #endif /*EMU_CHIPSET_H*/ ```
/content/code_sandbox/src/include/86box/chipset.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,620
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Define the various platform support functions. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_PLAT_UNUSED_H #define EMU_PLAT_UNUSED_H #ifndef EMU_PLAT_H #ifdef _MSC_VER # define UNUSED(arg) arg #else /* A hack (GCC-specific?) to allow us to ignore unused parameters. */ # define UNUSED(arg) __attribute__((unused)) arg #endif #endif #endif /*EMU_PLAT_UNUSED_H*/ ```
/content/code_sandbox/src/include/86box/plat_unused.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
195
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * 8080 CPU emulation (header). * * * * Authors: Cacodemon345 * */ #include <stdint.h> typedef struct i8080 { union { uint16_t af; /* Intended in case we also go for PD9002 emulation, which also has a Z80 emulation mode. */ struct { uint8_t a; uint8_t flags; }; }; union { uint16_t bc; struct { uint8_t b; uint8_t c; }; }; union { uint16_t de; struct { uint8_t d; uint8_t e; }; }; union { uint16_t hl; struct { uint8_t h; uint8_t l; }; }; uint16_t pc; uint16_t sp; uint16_t oldpc; uint16_t ei; uint32_t pmembase; uint32_t dmembase; /* Base from where i8080 starts. */ uint8_t emulated; /* 0 = not emulated, use separate registers, 1 = emulated, use x86 registers. */ uint16_t *cpu_flags; void (*writemembyte)(uint32_t, uint8_t); uint8_t (*readmembyte)(uint32_t); void (*startclock)(void); void (*endclock)(void); void (*checkinterrupts)(void); uint8_t (*fetchinstruction)(void *); } i8080; #define C_FLAG_I8080 (1 << 0) #define P_FLAG_I8080 (1 << 2) #define AC_FLAG_I8080 (1 << 4) #define Z_FLAG_I8080 (1 << 6) #define S_FLAG_I8080 (1 << 7) ```
/content/code_sandbox/src/include/86box/i8080.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
478
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Generic SVGA handling. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * */ #ifndef VIDEO_SVGA_H # define VIDEO_SVGA_H # define FLAG_EXTRA_BANKS 1 # define FLAG_ADDR_BY8 2 # define FLAG_EXT_WRITE 4 # define FLAG_LATCH8 8 # define FLAG_NOSKEW 16 # define FLAG_ADDR_BY16 32 # define FLAG_RAMDAC_SHIFT 64 # define FLAG_ATI 128 # define FLAG_S3_911_16BIT 256 # define FLAG_512K_MASK 512 # define FLAG_NO_SHIFT3 1024 /* Needed for Bochs VBE. */ struct monitor_t; typedef struct hwcursor_t { int ena; int x; int y; int xoff; int yoff; int cur_xsize; int cur_ysize; int v_acc; int h_acc; uint32_t addr; uint32_t pitch; } hwcursor_t; typedef union { uint64_t q; uint32_t d[2]; uint16_t w[4]; uint8_t b[8]; } latch_t; typedef struct svga_t { mem_mapping_t mapping; uint8_t fast; uint8_t chain4; uint8_t chain2_write; uint8_t chain2_read; uint8_t ext_overscan; uint8_t bus_size; uint8_t lowres; uint8_t interlace; uint8_t linedbl; uint8_t rowcount; uint8_t set_reset_disabled; uint8_t bpp; uint8_t ramdac_type; uint8_t fb_only; uint8_t readmode; uint8_t writemode; uint8_t readplane; uint8_t hwcursor_oddeven; uint8_t dac_hwcursor_oddeven; uint8_t overlay_oddeven; uint8_t fcr; uint8_t hblank_overscan; uint8_t vidsys_ena; int dac_addr; int dac_pos; int dac_r; int dac_g; int dac_b; int vtotal; int dispend; int vdisp; int vsyncstart; int split; int vblankstart; int hdisp; int hdisp_old; int htotal; int hdisp_time; int rowoffset; int dispon; int hdisp_on; int vc; int sc; int linepos; int vslines; int linecountff; int oddeven; int con; int cursoron; int blink; int scrollcache; int char_width; int firstline; int lastline; int firstline_draw; int lastline_draw; int displine; int fullchange; int x_add; int y_add; int pan; int vram_display_mask; int vidclock; int dots_per_clock; int hwcursor_on; int dac_hwcursor_on; int overlay_on; int set_override; int hblankstart; int hblankend; int hblank_end_val; int hblank_end_len; int hblank_end_mask; int hblank_sub; int packed_4bpp; int ps_bit_bug; int ati_4color; /*The three variables below allow us to implement memory maps like that seen on a 1MB Trio64 : 0MB-1MB - VRAM 1MB-2MB - VRAM mirror 2MB-4MB - open bus 4MB-xMB - mirror of above For the example memory map, decode_mask would be 4MB-1 (4MB address space), vram_max would be 2MB (present video memory only responds to first 2MB), vram_mask would be 1MB-1 (video memory wraps at 1MB) */ uint32_t decode_mask; uint32_t vram_max; uint32_t vram_mask; uint32_t charseta; uint32_t charsetb; uint32_t adv_flags; uint32_t ma_latch; uint32_t ca_adj; uint32_t ma; uint32_t maback; uint32_t write_bank; uint32_t read_bank; uint32_t extra_banks[2]; uint32_t banked_mask; uint32_t ca; uint32_t overscan_color; uint32_t *map8; uint32_t pallook[512]; PALETTE vgapal; uint64_t dispontime; uint64_t dispofftime; latch_t latch; pc_timer_t timer; pc_timer_t timer8514; double clock; double clock8514; double multiplier; hwcursor_t hwcursor; hwcursor_t hwcursor_latch; hwcursor_t dac_hwcursor; hwcursor_t dac_hwcursor_latch; hwcursor_t overlay; hwcursor_t overlay_latch; void (*render)(struct svga_t *svga); void (*render8514)(struct svga_t *svga); void (*recalctimings_ex)(struct svga_t *svga); void (*video_out)(uint16_t addr, uint8_t val, void *priv); uint8_t (*video_in)(uint16_t addr, void *priv); void (*hwcursor_draw)(struct svga_t *svga, int displine); void (*dac_hwcursor_draw)(struct svga_t *svga, int displine); void (*overlay_draw)(struct svga_t *svga, int displine); void (*vblank_start)(struct svga_t *svga); void (*ven_write)(struct svga_t *svga, uint8_t val, uint32_t addr); float (*getclock)(int clock, void *priv); float (*getclock8514)(int clock, void *priv); /* Called when VC=R18 and friends. If this returns zero then MA resetting is skipped. Matrox Mystique in Power mode reuses this counter for vertical line interrupt*/ int (*line_compare)(struct svga_t *svga); /*Called at the start of vertical sync*/ void (*vsync_callback)(struct svga_t *svga); uint32_t (*translate_address)(uint32_t addr, void *priv); /*If set then another device is driving the monitor output and the SVGA card should not attempt to display anything */ int override; void *priv; uint8_t crtc[256]; uint8_t gdcreg[256]; uint8_t attrregs[32]; uint8_t seqregs[256]; uint8_t egapal[16]; uint8_t *vram; uint8_t *changedvram; uint8_t crtcreg; uint8_t gdcaddr; uint8_t attrff; uint8_t attr_palette_enable; uint8_t attraddr; uint8_t seqaddr; uint8_t miscout; uint8_t cgastat; uint8_t scrblank; uint8_t plane_mask; uint8_t writemask; uint8_t colourcompare; uint8_t colournocare; uint8_t dac_mask; uint8_t dac_status; uint8_t dpms; uint8_t dpms_ui; uint8_t color_2bpp; uint8_t ksc5601_sbyte_mask; uint8_t ksc5601_udc_area_msb[2]; int ksc5601_swap_mode; uint16_t ksc5601_english_font_type; int vertical_linedbl; /*Used to implement CRTC[0x17] bit 2 hsync divisor*/ int hsync_divisor; /*Tseng-style chain4 mode - CRTC dword mode is the same as byte mode, chain4 addresses are shifted to match*/ int packed_chain4; /*Disable 8bpp blink mode - some cards support it, some don't, it's a weird mode If mode 13h appears in a reddish-brown background (0x88) with dark green text (0x8F), you should set this flag when entering that mode*/ int disable_blink; /*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/ int force_dword_mode; int force_old_addr; int remap_required; uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr); void *ramdac; void *clock_gen; /* Monitor Index */ uint8_t monitor_index; /* Pointer to monitor */ monitor_t *monitor; /* Enable LUT mapping of >= 24 bpp modes. */ int lut_map; /* Override the horizontal blanking stuff. */ int hoverride; /* Return a 32 bpp color from a 15/16 bpp color. */ uint32_t (*conv_16to32)(struct svga_t *svga, uint16_t color, uint8_t bpp); void * dev8514; void * ext8514; void * clock_gen8514; void * xga; } svga_t; extern int vga_on; extern void ibm8514_poll(void *priv); extern void ibm8514_recalctimings(svga_t *svga); extern uint8_t ibm8514_ramdac_in(uint16_t port, void *priv); extern void ibm8514_ramdac_out(uint16_t port, uint8_t val, void *priv); extern void ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len); extern void ibm8514_accel_out(uint16_t port, uint32_t val, svga_t *svga, int len); extern uint16_t ibm8514_accel_in_fifo(svga_t *svga, uint16_t port, int len); extern uint8_t ibm8514_accel_in(uint16_t port, svga_t *svga); extern int ibm8514_cpu_src(svga_t *svga); extern int ibm8514_cpu_dest(svga_t *svga); extern void ibm8514_accel_out_pixtrans(svga_t *svga, uint16_t port, uint32_t val, int len); extern void ibm8514_short_stroke_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, uint8_t ssv, int len); extern void ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, int len); #ifdef ATI_8514_ULTRA extern void ati8514_recalctimings(svga_t *svga); extern uint8_t ati8514_mca_read(int port, void *priv); extern void ati8514_mca_write(int port, uint8_t val, void *priv); extern void ati8514_pos_write(uint16_t port, uint8_t val, void *priv); extern void ati8514_init(svga_t *svga, void *ext8514, void *dev8514); #endif extern void xga_poll(void *priv, svga_t *svga); extern void xga_recalctimings(svga_t *svga); extern int svga_init(const device_t *info, svga_t *svga, void *priv, int memsize, void (*recalctimings_ex)(struct svga_t *svga), uint8_t (*video_in)(uint16_t addr, void *priv), void (*video_out)(uint16_t addr, uint8_t val, void *priv), void (*hwcursor_draw)(struct svga_t *svga, int displine), void (*overlay_draw)(struct svga_t *svga, int displine)); extern void svga_recalctimings(svga_t *svga); extern void svga_close(svga_t *svga); uint8_t svga_read(uint32_t addr, void *priv); uint16_t svga_readw(uint32_t addr, void *priv); uint32_t svga_readl(uint32_t addr, void *priv); void svga_write(uint32_t addr, uint8_t val, void *priv); void svga_writew(uint32_t addr, uint16_t val, void *priv); void svga_writel(uint32_t addr, uint32_t val, void *priv); uint8_t svga_read_linear(uint32_t addr, void *priv); uint8_t svga_readb_linear(uint32_t addr, void *priv); uint16_t svga_readw_linear(uint32_t addr, void *priv); uint32_t svga_readl_linear(uint32_t addr, void *priv); void svga_write_linear(uint32_t addr, uint8_t val, void *priv); void svga_writeb_linear(uint32_t addr, uint8_t val, void *priv); void svga_writew_linear(uint32_t addr, uint16_t val, void *priv); void svga_writel_linear(uint32_t addr, uint32_t val, void *priv); void svga_add_status_info(char *s, int max_len, void *priv); extern uint8_t svga_rotate[8][256]; void svga_out(uint16_t addr, uint8_t val, void *priv); uint8_t svga_in(uint16_t addr, void *priv); svga_t *svga_get_pri(void); void svga_set_override(svga_t *svga, int val); void svga_set_ramdac_type(svga_t *svga, int type); void svga_close(svga_t *svga); uint32_t svga_mask_addr(uint32_t addr, svga_t *svga); uint32_t svga_mask_changedaddr(uint32_t addr, svga_t *svga); void svga_doblit(int wx, int wy, svga_t *svga); enum { RAMDAC_6BIT = 0, RAMDAC_8BIT }; uint32_t svga_lookup_lut_ram(svga_t* svga, uint32_t val); /* We need a way to add a device with a pointer to a parent device so it can attach itself to it, and possibly also a second ATi 68860 RAM DAC type that auto-sets SVGA render on RAM DAC render change. */ extern void ati68860_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga); extern uint8_t ati68860_ramdac_in(uint16_t addr, void *priv, svga_t *svga); extern void ati68860_set_ramdac_type(void *priv, int type); extern void ati68860_ramdac_set_render(void *priv, svga_t *svga); extern void ati68860_ramdac_set_pallook(void *priv, int i, uint32_t col); extern void ati68860_hwcursor_draw(svga_t *svga, int displine); extern void ati68875_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *priv, svga_t *svga); extern uint8_t ati68875_ramdac_in(uint16_t addr, int rs2, int rs3, void *priv, svga_t *svga); extern void att49x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga); extern uint8_t att49x_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga); extern void att498_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga); extern uint8_t att498_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga); extern float av9194_getclock(int clock, void *priv); extern void bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *priv, svga_t *svga); extern uint8_t bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *priv, svga_t *svga); extern void bt48x_recalctimings(void *priv, svga_t *svga); extern void bt48x_hwcursor_draw(svga_t *svga, int displine); extern void ibm_rgb528_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga); extern uint8_t ibm_rgb528_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga); extern void ibm_rgb528_recalctimings(void *priv, svga_t *svga); extern void ibm_rgb528_hwcursor_draw(svga_t *svga, int displine); extern void icd2061_write(void *priv, int val); extern float icd2061_getclock(int clock, void *priv); /* The code is the same, the #define's are so that the correct name can be used. */ # define ics9161_write icd2061_write # define ics9161_getclock icd2061_getclock extern float ics2494_getclock(int clock, void *priv); extern void ics2595_write(void *priv, int strobe, int dat); extern double ics2595_getclock(void *priv); extern void ics2595_setclock(void *priv, double clock); extern void sc1148x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga); extern uint8_t sc1148x_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga); extern void sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga); extern uint8_t sc1502x_ramdac_in(uint16_t addr, void *priv, svga_t *svga); extern void sdac_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga); extern uint8_t sdac_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga); extern float sdac_getclock(int clock, void *priv); extern void stg_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga); extern uint8_t stg_ramdac_in(uint16_t addr, void *priv, svga_t *svga); extern float stg_getclock(int clock, void *priv); extern void tkd8001_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga); extern uint8_t tkd8001_ramdac_in(uint16_t addr, void *priv, svga_t *svga); extern void tvp3026_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *priv, svga_t *svga); extern uint8_t tvp3026_ramdac_in(uint16_t addr, int rs2, int rs3, void *priv, svga_t *svga); extern uint32_t tvp3026_conv_16to32(svga_t* svga, uint16_t color, uint8_t bpp); extern void tvp3026_recalctimings(void *priv, svga_t *svga); extern void tvp3026_hwcursor_draw(svga_t *svga, int displine); extern float tvp3026_getclock(int clock, void *priv); extern void tvp3026_gpio(uint8_t (*read)(uint8_t cntl, void *priv), void (*write)(uint8_t cntl, uint8_t data, void *priv), void *cb_priv, void *priv); # ifdef EMU_DEVICE_H extern const device_t ati68860_ramdac_device; extern const device_t ati68875_ramdac_device; extern const device_t att490_ramdac_device; extern const device_t att491_ramdac_device; extern const device_t att492_ramdac_device; extern const device_t att498_ramdac_device; extern const device_t av9194_device; extern const device_t bt484_ramdac_device; extern const device_t att20c504_ramdac_device; extern const device_t bt485_ramdac_device; extern const device_t att20c505_ramdac_device; extern const device_t bt485a_ramdac_device; extern const device_t gendac_ramdac_device; extern const device_t ibm_rgb528_ramdac_device; extern const device_t ics2494an_305_device; extern const device_t ati18810_device; extern const device_t ati18811_0_device; extern const device_t ati18811_1_device; extern const device_t ics2595_device; extern const device_t icd2061_device; extern const device_t ics9161_device; extern const device_t sc11483_ramdac_device; extern const device_t sc11487_ramdac_device; extern const device_t sc11486_ramdac_device; extern const device_t sc11484_nors2_ramdac_device; extern const device_t sc1502x_ramdac_device; extern const device_t sdac_ramdac_device; extern const device_t stg_ramdac_device; extern const device_t tkd8001_ramdac_device; extern const device_t tseng_ics5301_ramdac_device; extern const device_t tseng_ics5341_ramdac_device; extern const device_t tvp3026_ramdac_device; # endif #endif /*VIDEO_SVGA_H*/ ```
/content/code_sandbox/src/include/86box/vid_svga.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
5,023
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * CD-ROM image file handling module header , translated to C * from cdrom_dosbox.h. * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * The DOSBox Team, <unknown> * */ #ifndef CDROM_IMAGE_BACKEND_H #define CDROM_IMAGE_BACKEND_H #define RAW_SECTOR_SIZE 2352 #define COOKED_SECTOR_SIZE 2048 #define DATA_TRACK 0x14 #define AUDIO_TRACK 0x10 #define CD_FPS 75 #define FRAMES_TO_MSF(f, M, S, F) \ { \ uint64_t value = f; \ *(F) = (value % CD_FPS) & 0xff; \ value /= CD_FPS; \ *(S) = (value % 60) & 0xff; \ value /= 60; \ *(M) = value & 0xff; \ } #define MSF_TO_FRAMES(M, S, F) ((M) *60 * CD_FPS + (S) *CD_FPS + (F)) typedef struct SMSF { uint16_t min; uint8_t sec; uint8_t fr; } TMSF; /* Track file struct. */ typedef struct track_file_t { int (*read)(void *priv, uint8_t *buffer, uint64_t seek, size_t count); uint64_t (*get_length)(void *priv); void (*close)(void *priv); char fn[260]; FILE *fp; void *priv; int motorola; } track_file_t; typedef struct track_t { int number; int track_number; int attr; int sector_size; int mode2; int form; int pre; int noskip; /* Do not skip by 8 bytes.*/ uint64_t start; uint64_t length; uint64_t skip; track_file_t *file; } track_t; typedef struct cd_img_t { int tracks_num; track_t *tracks; } cd_img_t; /* Binary file functions. */ extern void cdi_close(cd_img_t *cdi); extern int cdi_set_device(cd_img_t *cdi, const char *path); extern void cdi_get_audio_tracks(cd_img_t *cdi, int *st_track, int *end, TMSF *lead_out); extern void cdi_get_audio_tracks_lba(cd_img_t *cdi, int *st_track, int *end, uint32_t *lead_out); extern int cdi_get_audio_track_pre(cd_img_t *cdi, int track); extern int cdi_get_audio_track_info(cd_img_t *cdi, int end, int track, int *track_num, TMSF *start, uint8_t *attr); extern int cdi_get_audio_track_info_lba(cd_img_t *cdi, int end, int track, int *track_num, uint32_t *start, uint8_t *attr); extern int cdi_get_track(cd_img_t *cdi, uint32_t sector); extern int cdi_get_audio_sub(cd_img_t *cdi, uint32_t sector, uint8_t *attr, uint8_t *track, uint8_t *index, TMSF *rel_pos, TMSF *abs_pos); extern int cdi_read_sector(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector); extern int cdi_read_sectors(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector, uint32_t num); extern int cdi_read_sector_sub(cd_img_t *cdi, uint8_t *buffer, uint32_t sector); extern int cdi_get_sector_size(cd_img_t *cdi, uint32_t sector); extern int cdi_is_mode2(cd_img_t *cdi, uint32_t sector); extern int cdi_get_mode2_form(cd_img_t *cdi, uint32_t sector); extern int cdi_load_iso(cd_img_t *cdi, const char *filename); extern int cdi_load_cue(cd_img_t *cdi, const char *cuefile); extern int cdi_has_data_track(cd_img_t *cdi); extern int cdi_has_audio_track(cd_img_t *cdi); /* Virtual ISO functions. */ extern int viso_read(void *priv, uint8_t *buffer, uint64_t seek, size_t count); extern uint64_t viso_get_length(void *priv); extern void viso_close(void *priv); extern track_file_t *viso_init(const char *dirname, int *error); #endif /*CDROM_IMAGE_BACKEND_H*/ ```
/content/code_sandbox/src/include/86box/cdrom_image_backend.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,125
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Voodoo Banshee and 3 specific emulation. * * * * Authors: Sarah Walker, <path_to_url * */ #ifndef VIDEO_VOODOO_BANSHEE_H #define VIDEO_VOODOO_BANSHEE_H void banshee_set_overlay_addr(void *priv, uint32_t addr); #endif /*VIDEO_VOODOO_BANSHEE_H*/ ```
/content/code_sandbox/src/include/86box/vid_voodoo_banshee.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
148
```objective-c /* * RoboPlay for MSX * * opl4_defines.h * */ #ifndef __OPL4_DEFINES_H #define __OPL4_DEFINES_H /* * Register numbers */ #define OPL4_REG_TEST0 0x00 #define OPL4_REG_TEST1 0x01 #define OPL4_REG_MEMORY_CONFIGURATION 0x02 #define OPL4_MODE_BIT 0x01 #define OPL4_MTYPE_BIT 0x02 #define OPL4_TONE_HEADER_MASK 0x1C #define OPL4_DEVICE_ID_MASK 0xE0 #define OPL4_REG_MEMORY_ADDRESS_HIGH 0x03 #define OPL4_REG_MEMORY_ADDRESS_MID 0x04 #define OPL4_REG_MEMORY_ADDRESS_LOW 0x05 #define OPL4_REG_MEMORY_DATA 0x06 /* * Offsets to the register banks for voices. To get the * register number just add the voice number to the bank offset. * * Wave Table Number low bits (0x08 to 0x1F) */ #define OPL4_REG_TONE_NUMBER 0x08 /* Wave Table Number high bit, F-Number low bits (0x20 to 0x37) */ #define OPL4_REG_F_NUMBER 0x20 #define OPL4_TONE_NUMBER_BIT8 0x01 #define OPL4_F_NUMBER_LOW_MASK 0xFE /* F-Number high bits, Octave, Pseudo-Reverb (0x38 to 0x4F) */ #define OPL4_REG_OCTAVE 0x38 #define OPL4_F_NUMBER_HIGH_MASK 0x07 #define OPL4_BLOCK_MASK 0xF0 #define OPL4_PSEUDO_REVERB_BIT 0x08 /* Total Level, Level Direct (0x50 to 0x67) */ #define OPL4_REG_LEVEL 0x50 #define OPL4_TOTAL_LEVEL_MASK 0xFE #define OPL4_LEVEL_DIRECT_BIT 0x01 /* Key On, Damp, LFO RST, CH, Panpot (0x68 to 0x7F) */ #define OPL4_REG_MISC 0x68 #define OPL4_KEY_ON_BIT 0x80 #define OPL4_DAMP_BIT 0x40 #define OPL4_LFO_RESET_BIT 0x20 #define OPL4_OUTPUT_CHANNEL_BIT 0x10 #define OPL4_PAN_POT_MASK 0x0F /* LFO, VIB (0x80 to 0x97) */ #define OPL4_REG_LFO_VIBRATO 0x80 #define OPL4_LFO_FREQUENCY_MASK 0x38 #define OPL4_VIBRATO_DEPTH_MASK 0x07 #define OPL4_CHORUS_SEND_MASK 0xC0 /* Attack / Decay 1 rate (0x98 to 0xAF) */ #define OPL4_REG_ATTACK_DECAY1 0x98 #define OPL4_ATTACK_RATE_MASK 0xF0 #define OPL4_DECAY1_RATE_MASK 0x0F /* Decay level / 2 rate (0xB0 to 0xC7) */ #define OPL4_REG_LEVEL_DECAY2 0xB0 #define OPL4_DECAY_LEVEL_MASK 0xF0 #define OPL4_DECAY2_RATE_MASK 0x0F /* Release rate / Rate correction (0xC8 to 0xDF) */ #define OPL4_REG_RELEASE_CORRECTION 0xC8 #define OPL4_RELEASE_RATE_MASK 0x0F #define OPL4_RATE_INTERPOLATION_MASK 0xF0 /* AM (0xE0 to 0xF7) */ #define OPL4_REG_TREMOLO 0xE0 #define OPL4_TREMOLO_DEPTH_MASK 0x07 #define OPL4_REVERB_SEND_MASK 0xE0 /* Mixer */ #define OPL4_REG_MIX_CONTROL_FM 0xF8 #define OPL4_REG_MIX_CONTROL_PCM 0xF9 #define OPL4_MIX_LEFT_MASK 0x07 #define OPL4_MIX_RIGHT_MASK 0x38 #define OPL4_REG_ATC 0xFA #define OPL4_ATC_BIT 0x01 /* Bits in the OPL4 Status register */ #define OPL4_STATUS_BUSY 0x01 #define OPL4_STATUS_LOAD 0x02 #endif /* __OPL4_DEFINES_H */ ```
/content/code_sandbox/src/include/86box/opl4_defines.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
998
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the Distributed DMA emulation. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef DDMA_H #define DDMA_H #ifdef __cplusplus extern "C" { #endif typedef struct ddma_channel_t { uint16_t io_base; int channel; int enable; } ddma_channel_t; typedef struct ddma_t { ddma_channel_t channels[8]; } ddma_t; /* Global variables. */ extern const device_t ddma_device; /* Functions. */ extern void ddma_update_io_mapping(ddma_t *dev, int ch, uint8_t base_l, uint8_t base_h, int enable); #ifdef __cplusplus } #endif #endif /*DDMA_H*/ ```
/content/code_sandbox/src/include/86box/ddma.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
232
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for hardware monitoring chips. * * * * Authors: RichardG, <richardg867@gmail.com> * */ #ifndef EMU_HWM_H #define EMU_HWM_H #include <stdint.h> #define RESISTOR_DIVIDER(v, r1, r2) (((v) * (r2)) / ((r1) + (r2))) typedef struct hwm_values_t { uint16_t fans[4]; uint8_t temperatures[4]; uint16_t voltages[13]; } hwm_values_t; typedef struct lm75_t { uint32_t local; hwm_values_t *values; void *as99127f; uint8_t regs[8]; uint8_t addr_register; uint8_t i2c_addr : 7; uint8_t i2c_state : 2; uint8_t i2c_enabled : 1; } lm75_t; /* hwm.c */ extern uint16_t hwm_get_vcore(void); /* hwm_lm75.c */ extern void lm75_remap(lm75_t *dev, uint8_t addr); extern uint8_t lm75_read(lm75_t *dev, uint8_t reg); extern uint8_t lm75_write(lm75_t *dev, uint8_t reg, uint8_t val); /* hwm_lm78.c */ extern uint8_t lm78_as99127f_read(void *priv, uint8_t reg); extern uint8_t lm78_as99127f_write(void *priv, uint8_t reg, uint8_t val); /* hwm_vt82c686.c */ extern void vt82c686_hwm_write(uint8_t addr, uint8_t val, void *priv); /* Refer to specific hardware monitor implementations for the meaning of hwm_values. */ extern hwm_values_t hwm_values; extern const device_t lm75_1_4a_device; extern const device_t lm75_w83781d_device; extern const device_t lm78_device; extern const device_t w83781d_device; extern const device_t w83781d_p5a_device; extern const device_t as99127f_device; extern const device_t as99127f_rev2_device; extern const device_t w83782d_device; extern const device_t gl518sm_2c_device; extern const device_t gl518sm_2d_device; extern const device_t gl520sm_2c_device; extern const device_t gl520sm_2d_device; extern const device_t via_vt82c686_hwm_device; #endif /*EMU_HWM_H*/ ```
/content/code_sandbox/src/include/86box/hwm.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
626
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the NS8250/16450/16550/16650/16750/16850/16950 * UART emulation. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_SERIAL_H #define EMU_SERIAL_H #define SERIAL_8250 0 #define SERIAL_8250_PCJR 1 #define SERIAL_16450 2 #define SERIAL_16550 3 #define SERIAL_16650 4 #define SERIAL_16750 5 #define SERIAL_16850 6 #define SERIAL_16950 7 #define SERIAL_FIFO_SIZE 16 /* Default settings for the standard ports. */ #define COM1_ADDR 0x03f8 #define COM1_IRQ 4 #define COM2_ADDR 0x02f8 #define COM2_IRQ 3 #define COM3_ADDR 0x03e8 #define COM3_IRQ 4 #define COM4_ADDR 0x02e8 #define COM4_IRQ 3 // The following support being assingned IRQ 3, 4, 5, 9, 10, 11, 12 or 15 // There doesn't appear to be any specific standard however // So defaults have been chosen arbitarily // TODO: Allow configuration of the IRQ in the UI //#define COM5_ADDR 0x03f0 //#define COM5_IRQ 3 #define COM5_ADDR 0x02f0 #define COM5_IRQ 11 #define COM6_ADDR 0x03e0 #define COM6_IRQ 10 #define COM7_ADDR 0x02e0 #define COM7_IRQ 9 struct serial_device_s; struct serial_s; typedef struct serial_s { uint8_t lsr; uint8_t thr; uint8_t mctrl; uint8_t rcr; uint8_t iir; uint8_t ier; uint8_t lcr; uint8_t msr; uint8_t dat; uint8_t int_status; uint8_t scratch; uint8_t fcr; uint8_t irq; uint8_t type; uint8_t inst; uint8_t transmit_enabled; uint8_t fifo_enabled; uint8_t bits; uint8_t data_bits; uint8_t baud_cycles; uint8_t txsr; uint8_t txsr_empty; uint8_t msr_set; uint8_t irq_state; uint16_t dlab; uint16_t base_address; uint16_t out_new; uint16_t thr_empty; void *rcvr_fifo; void *xmit_fifo; pc_timer_t transmit_timer; pc_timer_t timeout_timer; pc_timer_t receive_timer; double clock_src; double transmit_period; struct serial_device_s *sd; } serial_t; typedef struct serial_device_s { void (*rcr_callback)(struct serial_s *serial, void *priv); void (*dtr_callback)(struct serial_s *serial, int status, void *priv); void (*dev_write)(struct serial_s *serial, void *priv, uint8_t data); void (*lcr_callback)(struct serial_s *serial, void *priv, uint8_t lcr); void (*transmit_period_callback)(struct serial_s *serial, void *priv, double transmit_period); void *priv; serial_t *serial; } serial_device_t; typedef struct serial_port_s { uint8_t enabled; } serial_port_t; extern serial_port_t com_ports[SERIAL_MAX]; extern serial_t *serial_attach_ex(int port, void (*rcr_callback)(struct serial_s *serial, void *priv), void (*dev_write)(struct serial_s *serial, void *priv, uint8_t data), void (*transmit_period_callback)(struct serial_s *serial, void *priv, double transmit_period), void (*lcr_callback)(struct serial_s *serial, void *priv, uint8_t data_bits), void *priv); extern serial_t *serial_attach_ex_2(int port, void (*rcr_callback)(struct serial_s *serial, void *priv), void (*dev_write)(struct serial_s *serial, void *priv, uint8_t data), void (*dtr_callback)(struct serial_s *serial, int status, void *priv), void *priv); #define serial_attach(port, rcr_callback, dev_write, priv) \ serial_attach_ex(port, rcr_callback, dev_write, NULL, NULL, priv); extern void serial_remove(serial_t *dev); extern void serial_set_type(serial_t *dev, int type); extern void serial_setup(serial_t *dev, uint16_t addr, uint8_t irq); extern void serial_clear_fifo(serial_t *dev); extern void serial_write_fifo(serial_t *dev, uint8_t dat); extern void serial_set_next_inst(int ni); extern void serial_standalone_init(void); extern void serial_set_clock_src(serial_t *dev, double clock_src); extern void serial_reset_port(serial_t *dev); extern uint8_t serial_read(uint16_t addr, void *priv); extern void serial_device_timeout(void *priv); extern void serial_set_cts(serial_t *dev, uint8_t enabled); extern void serial_set_dsr(serial_t *dev, uint8_t enabled); extern void serial_set_dcd(serial_t *dev, uint8_t enabled); extern void serial_set_ri(serial_t *dev, uint8_t enabled); extern int serial_get_ri(serial_t *dev); extern const device_t ns8250_device; extern const device_t ns8250_pcjr_device; extern const device_t ns16450_device; extern const device_t ns16550_device; extern const device_t ns16650_device; extern const device_t ns16750_device; extern const device_t ns16850_device; extern const device_t ns16950_device; #endif /*EMU_SERIAL_H*/ ```
/content/code_sandbox/src/include/86box/serial.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,403
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the Teledisk floppy image format. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_FLOPPY_TD0_H #define EMU_FLOPPY_TD0_H extern void td0_init(void); extern void td0_load(int drive, char *fn); extern void td0_close(int drive); #endif /*EMU_FLOPPY_TD0_H*/ ```
/content/code_sandbox/src/include/86box/fdd_td0.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
179
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the Toshiba T1000/T1200 machines. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Miran Grca, <mgrca8@gmail.com> * John Elliott, <jce@seasip.info> * * * This program is free software; you can redistribute it and/or modify * (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 * * along with this program; if not, write to the: * * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307 * USA. */ #ifndef MACHINE_T1000_H #define MACHINE_T1000_H extern const device_t t1000_video_device; extern const device_t t1200_video_device; extern void t1000_video_options_set(uint8_t options); extern void t1000_video_enable(uint8_t enabled); extern void t1000_display_set(uint8_t internal); extern void t1000_syskey(uint8_t amask, uint8_t omask, uint8_t xmask); extern void t1000_nvr_load(void); extern void t1000_nvr_save(void); extern void t1200_nvr_load(void); extern void t1200_nvr_save(void); #endif /*MACHINE_T1000_H*/ ```
/content/code_sandbox/src/include/86box/m_xt_t1000.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
411
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Handling of the emulated flash devices. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Jasmine Iwanek, <jriwanek@gmail.com> * */ #ifndef EMU_FLASH_H #define EMU_FLASH_H extern const device_t catalyst_flash_device; extern const device_t intel_flash_bxt_ami_device; extern const device_t intel_flash_bxt_device; extern const device_t intel_flash_bxb_device; extern const device_t sst_flash_29ee010_device; extern const device_t sst_flash_29ee020_device; extern const device_t winbond_flash_w29c512_device; extern const device_t winbond_flash_w29c010_device; extern const device_t winbond_flash_w29c020_device; extern const device_t winbond_flash_w29c040_device; extern const device_t sst_flash_39sf512_device; extern const device_t sst_flash_39sf010_device; extern const device_t sst_flash_39sf020_device; extern const device_t sst_flash_39sf040_device; extern const device_t sst_flash_39lf512_device; extern const device_t sst_flash_39lf010_device; extern const device_t sst_flash_39lf020_device; extern const device_t sst_flash_39lf040_device; extern const device_t sst_flash_39lf080_device; extern const device_t sst_flash_39lf016_device; extern const device_t sst_flash_49lf002_device; extern const device_t sst_flash_49lf020_device; extern const device_t sst_flash_49lf020a_device; extern const device_t sst_flash_49lf003_device; extern const device_t sst_flash_49lf030_device; extern const device_t sst_flash_49lf004_device; extern const device_t sst_flash_49lf004c_device; extern const device_t sst_flash_49lf040_device; extern const device_t sst_flash_49lf008_device; extern const device_t sst_flash_49lf008c_device; extern const device_t sst_flash_49lf080_device; extern const device_t sst_flash_49lf016_device; extern const device_t sst_flash_49lf160_device; extern const device_t amd_flash_29f020a_device; #endif /*EMU_FLASH_H*/ ```
/content/code_sandbox/src/include/86box/flash.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
567
```objective-c extern void path_get_dirname(char *dest, const char *path); extern char *path_get_filename(char *s); extern char *path_get_extension(char *s); extern void path_append_filename(char *dest, const char *s1, const char *s2); extern void path_slash(char *path); extern const char *path_get_slash(char *path); extern void path_normalize(char *path); extern int path_abs(char *path); ```
/content/code_sandbox/src/include/86box/path.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
99
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Define the various platform support functions. * * * * Authors: Jasmine Iwanek, <jasmine@iwanek.co.uk> * */ #ifndef EMU_PLAT_FALLTHROUGH_H #define EMU_PLAT_FALLTHROUGH_H #ifndef EMU_PLAT_H #ifdef _MSC_VER # define fallthrough do {} while (0) /* fallthrough */ #else # if __has_attribute(fallthrough) # define fallthrough __attribute__((fallthrough)) # else # if __has_attribute(__fallthrough__) # define fallthrough __attribute__((__fallthrough__)) # endif # define fallthrough do {} while (0) /* fallthrough */ # endif #endif #endif #endif /*EMU_PLAT_FALLTHROUGH_H*/ ```
/content/code_sandbox/src/include/86box/plat_fallthrough.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
232
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the generic game port handlers. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Sarah Walker, <path_to_url * RichardG, <richardg867@gmail.com> * */ #ifndef EMU_GAMEPORT_H #define EMU_GAMEPORT_H #define MAX_PLAT_JOYSTICKS 8 #define MAX_JOYSTICKS 4 #define MAX_JOY_AXES 16 #define MAX_JOY_BUTTONS 32 #define MAX_JOY_POVS 4 #define JS_TYPE_NONE 0 #define JS_TYPE_2AXIS_4BUTTON 1 #define JS_TYPE_2AXIS_6BUTTON 2 #define JS_TYPE_2AXIS_8BUTTON 3 #define JS_TYPE_4AXIS_4BUTTON 4 #define JS_TYPE_CH_FLIGHTSTICK_PRO 5 #define JS_TYPE_SIDEWINDER_PAD 6 #define JS_TYPE_THRUSTMASTER_FCS 7 #define POV_X 0x80000000 #define POV_Y 0x40000000 #define AXIS_NOT_PRESENT -99999 #define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0) #define GAMEPORT_SIO 0x1000000 typedef struct plat_joystick_t { char name[260]; int a[MAX_JOY_AXES]; int b[MAX_JOY_BUTTONS]; int p[MAX_JOY_POVS]; struct { char name[260]; int id; } axis[MAX_JOY_AXES]; struct { char name[260]; int id; } button[MAX_JOY_BUTTONS]; struct { char name[260]; int id; } pov[MAX_JOY_POVS]; int nr_axes; int nr_buttons; int nr_povs; } plat_joystick_t; typedef struct joystick_t { int axis[MAX_JOY_AXES]; int button[MAX_JOY_BUTTONS]; int pov[MAX_JOY_POVS]; int plat_joystick_nr; int axis_mapping[MAX_JOY_AXES]; int button_mapping[MAX_JOY_BUTTONS]; int pov_mapping[MAX_JOY_POVS][2]; } joystick_t; typedef struct joystick_if_t { const char *name; const char *internal_name; void *(*init)(void); void (*close)(void *priv); uint8_t (*read)(void *priv); void (*write)(void *priv); int (*read_axis)(void *priv, int axis); void (*a0_over)(void *priv); int axis_count; int button_count; int pov_count; int max_joysticks; const char *axis_names[MAX_JOY_AXES]; const char *button_names[MAX_JOY_BUTTONS]; const char *pov_names[MAX_JOY_POVS]; } joystick_if_t; #ifdef __cplusplus extern "C" { #endif #ifdef EMU_DEVICE_H extern const device_t gameport_device; extern const device_t gameport_201_device; extern const device_t gameport_203_device; extern const device_t gameport_205_device; extern const device_t gameport_207_device; extern const device_t gameport_208_device; extern const device_t gameport_209_device; extern const device_t gameport_20b_device; extern const device_t gameport_20d_device; extern const device_t gameport_20f_device; extern const device_t gameport_tm_acm_device; extern const device_t gameport_pnp_device; extern const device_t gameport_pnp_6io_device; extern const device_t gameport_sio_device; extern const device_t gameport_sio_1io_device; extern const device_t *standalone_gameport_type; #endif extern int gameport_instance_id; extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS]; extern joystick_t joystick_state[MAX_JOYSTICKS]; extern int joysticks_present; extern int joystick_type; extern void joystick_init(void); extern void joystick_close(void); extern void joystick_process(void); extern const char *joystick_get_name(int js); extern const char *joystick_get_internal_name(int js); extern int joystick_get_from_internal_name(char *s); extern int joystick_get_max_joysticks(int js); extern int joystick_get_axis_count(int js); extern int joystick_get_button_count(int js); extern int joystick_get_pov_count(int js); extern const char *joystick_get_axis_name(int js, int id); extern const char *joystick_get_button_name(int js, int id); extern const char *joystick_get_pov_name(int js, int id); extern void gameport_update_joystick_type(void); extern void gameport_remap(void *priv, uint16_t address); extern void *gameport_add(const device_t *gameport_type); extern const joystick_if_t joystick_2axis_2button; extern const joystick_if_t joystick_2axis_4button; extern const joystick_if_t joystick_3axis_2button; extern const joystick_if_t joystick_3axis_4button; extern const joystick_if_t joystick_4axis_4button; extern const joystick_if_t joystick_2axis_6button; extern const joystick_if_t joystick_2axis_8button; extern const joystick_if_t joystick_ch_flightstick_pro; extern const joystick_if_t joystick_sw_pad; extern const joystick_if_t joystick_tm_fcs; #ifdef __cplusplus } #endif #endif /*EMU_GAMEPORT_H*/ ```
/content/code_sandbox/src/include/86box/gameport.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,266
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Header for the implementation of Port 6x used by various * machines. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_PORT_6X_H #define EMU_PORT_6X_H #ifdef _TIMER_H_ typedef struct port_6x_t { uint8_t refresh; uint8_t flags; pc_timer_t refresh_timer; } port_6x_t; #endif extern const device_t port_6x_device; extern const device_t port_6x_xi8088_device; extern const device_t port_6x_ps2_device; extern const device_t port_6x_olivetti_device; #endif /*EMU_PORT_6X_H*/ ```
/content/code_sandbox/src/include/86box/port_6x.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
228
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the IMD floppy image format. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * * * This program is free software; you can redistribute it and/or modify * (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 * * along with this program; if not, write to the: * * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307 * USA. */ #ifndef EMU_FLOPPY_IMD_H #define EMU_FLOPPY_IMD_H extern void imd_init(void); extern void imd_load(int drive, char *fn); extern void imd_close(int drive); #endif /*EMU_FLOPPY_IMD_H*/ ```
/content/code_sandbox/src/include/86box/fdd_imd.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
308
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Header of the emulation of the PC speaker. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * */ #ifndef SOUND_SPEAKER_H #define SOUND_SPEAKER_H extern int speaker_mute; extern int speaker_gated; extern int speaker_enable; extern int was_speaker_enable; extern void speaker_init(void); extern void speaker_set_count(uint8_t new_m, int new_count); extern void speaker_update(void); #endif /*SOUND_SPEAKER_H*/ ```
/content/code_sandbox/src/include/86box/snd_speaker.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
183
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the Novell NetWare 2.x Key Card, which * was used for anti-piracy protection. * * * Authors: Cacodemon345 * */ #ifndef NOVELL_KEYCARD_H #define NOVELL_KEYCARD_H /* I/O port range used. */ #define NOVELL_KEYCARD_ADDR 0x23a #define NOVELL_KEYCARD_ADDRLEN 6 #ifdef __cplusplus extern "C" { #endif /* Global variables. */ extern const device_t novell_keycard_device; /* Functions. */ #ifdef __cplusplus } #endif #endif /*BUGGER_H*/ ```
/content/code_sandbox/src/include/86box/novell_cardkey.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
204
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the ACPI emulation. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef ACPI_H #define ACPI_H #ifdef __cplusplus #include <atomic> using atomic_int = std::atomic_int; extern "C" { #else #include <stdatomic.h> #endif #define ACPI_TIMER_FREQ 3579545 #define PM_FREQ ACPI_TIMER_FREQ #define RSM_STS (1 << 15) #define PWRBTN_STS (1 << 8) #define GBL_STS (1 << 5) #define BM_STS (1 << 4) #define TMROF_STS (1 << 0) #define RTC_EN (1 << 10) #define PWRBTN_EN (1 << 8) #define GBL_EN (1 << 5) #define TMROF_EN (1 << 0) #define SCI_EN (1 << 0) #define SUS_EN (1 << 13) #define SUS_POWER_OFF (1 << 0) #define SUS_SUSPEND (1 << 1) #define SUS_NVR (1 << 2) #define SUS_RESET_CPU (1 << 3) #define SUS_RESET_CACHE (1 << 4) #define SUS_RESET_PCI (1 << 5) #define ACPI_ENABLE 0xf1 #define ACPI_DISABLE 0xf0 #define VEN_ALI 0x010b9 #define VEN_INTEL 0x08086 #define VEN_SIS_5582 0x01039 #define VEN_SIS_5595_1997 0x11039 #define VEN_SIS_5595 0x21039 #define VEN_SMC 0x01055 #define VEN_VIA 0x01106 #define VEN_VIA_596B 0x11106 typedef struct acpi_regs_t { uint8_t acpitst; uint8_t auxen; uint8_t auxsts; uint8_t plvl2; uint8_t plvl3; uint8_t smicmd; uint8_t gpio_dir; uint8_t gpio_val; uint8_t muxcntrl; uint8_t ali_soft_smi; uint8_t timer32; uint8_t smireg; uint8_t gpireg[3]; uint8_t gporeg[4]; uint8_t extiotrapsts; uint8_t extiotrapen; uint8_t enter_c2_ps; uint8_t enter_c3_ps; uint8_t reg_12; uint8_t reg_13; uint8_t smi_cmd; uint8_t reg_24; uint8_t reg_25; uint8_t reg_26; uint8_t smi_en_val; uint8_t smi_dis_val; uint8_t mail_box; uint8_t reg_2b; uint8_t gp_tmr; uint8_t leg_sts; uint8_t leg_en; uint8_t tst_ctl; uint8_t reg_34; uint8_t index; uint8_t reg_ff; uint16_t pmsts; uint16_t pmen; uint16_t pmcntrl; uint16_t gpsts; uint16_t gpsts1; uint16_t gpen; uint16_t gpen1; uint16_t gpscien; uint16_t gpcntrl; uint16_t gplvl; uint16_t gpmux; uint16_t gpsel; uint16_t gpsmien; uint16_t pscntrl; uint16_t gpscists; uint16_t reg_14; uint16_t reg_16; uint16_t reg_18; uint16_t reg_1a; uint16_t reg_1c; uint16_t gpe_mul; uint16_t gpe_ctl; uint16_t gpe_smi; uint16_t gpe_rl; int smi_lock; int smi_active; uint32_t pcntrl; uint32_t p2cntrl; uint32_t glbsts; uint32_t devsts; uint32_t glben; uint32_t glbctl; uint32_t devctl; uint32_t padsts; uint32_t paden; uint32_t gptren; uint32_t gptimer; uint32_t gpo_val; uint32_t gpi_val; uint32_t extsmi_val; uint32_t reg_0c; uint32_t gpe_sts; uint32_t gpe_en; uint32_t gpe_pin; uint32_t gpe_io; uint32_t gpe_pol; } acpi_regs_t; typedef struct acpi_t { acpi_regs_t regs; uint8_t gpireg2_default; uint8_t irq_state; uint8_t pad[2]; uint8_t gporeg_default[4]; uint8_t suspend_types[8]; uint16_t io_base; uint16_t aux_io_base; int vendor; int slot; int irq_mode; int irq_pin; int irq_line; int mirq_is_level; pc_timer_t timer; pc_timer_t resume_timer; pc_timer_t pwrbtn_timer; pc_timer_t gp_timer; pc_timer_t per_timer; nvr_t *nvr; apm_t *apm; void *i2c; void (*trap_update)(void *priv); void *trap_priv; void *smbus; void *priv; } acpi_t; /* Global variables. */ extern int acpi_rtc_status; extern atomic_int acpi_pwrbut_pressed; extern int acpi_enabled; extern const device_t acpi_ali_device; extern const device_t acpi_intel_device; extern const device_t acpi_smc_device; extern const device_t acpi_via_device; extern const device_t acpi_via_596b_device; extern const device_t acpi_sis_5582_device; extern const device_t acpi_sis_5595_1997_device; extern const device_t acpi_sis_5595_device; /* Functions */ extern void acpi_update_irq(acpi_t *dev); extern void acpi_raise_smi(void *priv, int do_smi); extern void acpi_update_io_mapping(acpi_t *dev, uint32_t base, int chipset_en); extern void acpi_update_aux_io_mapping(acpi_t *dev, uint32_t base, int chipset_en); extern void acpi_init_gporeg(acpi_t *dev, uint8_t val0, uint8_t val1, uint8_t val2, uint8_t val3); extern void acpi_set_timer32(acpi_t *dev, uint8_t timer32); extern void acpi_set_slot(acpi_t *dev, int slot); extern void acpi_set_irq_mode(acpi_t *dev, int irq_mode); extern void acpi_set_irq_pin(acpi_t *dev, int irq_pin); extern void acpi_set_irq_line(acpi_t *dev, int irq_line); extern void acpi_set_mirq_is_level(acpi_t *dev, int mirq_is_level); extern void acpi_set_gpireg2_default(acpi_t *dev, uint8_t gpireg2_default); extern void acpi_set_nvr(acpi_t *dev, nvr_t *nvr); extern void acpi_set_trap_update(acpi_t *dev, void (*update)(void *priv), void *priv); extern uint8_t acpi_ali_soft_smi_status_read(acpi_t *dev); extern void acpi_ali_soft_smi_status_write(acpi_t *dev, uint8_t soft_smi); extern void * acpi_get_smbus(void *priv); extern void acpi_sis5582_pmu_event(void *priv); extern void acpi_sis5595_smi_raise(void *priv); extern void acpi_sis5595_pmu_event(void *priv); extern void acpi_sis5595_smbus_event(void *priv); extern void acpi_sis5595_software_smi(void *priv); #ifdef __cplusplus } #endif #endif /*ACPI_H*/ ```
/content/code_sandbox/src/include/86box/acpi.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,967
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Voodoo Graphics, 2, Banshee, 3 emulation. * * * * Authors: Sarah Walker, <path_to_url * leilei * */ #ifndef VIDEO_VOODOO_TEXTURE_H #define VIDEO_VOODOO_TEXTURE_H static const uint32_t texture_offset[LOD_MAX + 3] = { 0, 256 * 256, 256 * 256 + 128 * 128, 256 * 256 + 128 * 128 + 64 * 64, 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32, 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32 + 16 * 16, 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8, 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4, 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2, 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2 + 1 * 1, 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2 + 1 * 1 + 1 }; void voodoo_recalc_tex12(voodoo_t *voodoo, int tmu); void voodoo_recalc_tex3(voodoo_t *voodoo, int tmu); void voodoo_use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu); void voodoo_tex_writel(uint32_t addr, uint32_t val, void *priv); void flush_texture_cache(voodoo_t *voodoo, uint32_t dirty_addr, int tmu); #endif /* VIDEO_VOODOO_TEXTURE_H*/ ```
/content/code_sandbox/src/include/86box/vid_voodoo_texture.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
593
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Emulation of the old and new IBM CGA graphics cards. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * */ #ifndef VIDEO_CGA_H #define VIDEO_CGA_H typedef struct cga_t { mem_mapping_t mapping; int crtcreg; uint8_t crtc[32]; uint8_t cgastat; uint8_t cgamode; uint8_t cgacol; int fontbase; int linepos; int displine; int sc; int vc; int cgadispon; int con; int coff; int cursoron; int cgablink; int vsynctime; int vadj; uint16_t ma; uint16_t maback; int oddeven; uint64_t dispontime; uint64_t dispofftime; pc_timer_t timer; int firstline; int lastline; int drawcursor; int fullchange; uint8_t *vram; uint8_t charbuffer[256]; int revision; int composite; int snow_enabled; int rgb_type; int double_type; } cga_t; void cga_init(cga_t *cga); void cga_out(uint16_t addr, uint8_t val, void *priv); uint8_t cga_in(uint16_t addr, void *priv); void cga_write(uint32_t addr, uint8_t val, void *priv); uint8_t cga_read(uint32_t addr, void *priv); void cga_recalctimings(cga_t *cga); void cga_poll(void *priv); #ifdef EMU_DEVICE_H extern const device_config_t cga_config[]; extern const device_t cga_device; extern const device_t cga_pravetz_device; #endif #endif /*VIDEO_CGA_H*/ ```
/content/code_sandbox/src/include/86box/vid_cga.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
510
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Main include file for the application. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_86BOX_H #define EMU_86BOX_H /* Configuration values. */ #define GFXCARD_MAX 2 #define SERIAL_MAX 7 #define PARALLEL_MAX 4 #define SCREEN_RES_X 640 #define SCREEN_RES_Y 480 /* Filename and pathname info. */ #define CONFIG_FILE "86box.cfg" #define NVR_PATH "nvr" #define SCREENSHOT_PATH "screenshots" /* Recently used images */ #define MAX_PREV_IMAGES 4 #define MAX_IMAGE_PATH_LEN 2048 /* Max UUID Length */ #define MAX_UUID_LEN 64 /* Default language 0xFFFF = from system, 0x409 = en-US */ #define DEFAULT_LANGUAGE 0x0409 #define POSTCARDS_NUM 4 #define POSTCARD_MASK (POSTCARDS_NUM - 1) #ifdef MIN # undef MIN #endif #ifdef MAX # undef MAX #endif #ifdef ABS # undef ABS #endif #ifdef ABSD # undef ABSD #endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define ABS(x) ((x) > 0 ? (x) : -(x)) #define ABSD(x) ((x) > 0.0 ? (x) : -(x)) #define BCD8(x) ((((x) / 10) << 4) | ((x) % 10)) #define BCD16(x) ((((x) / 1000) << 12) | (((x) / 100) << 8) | BCD8(x)) #define BCD32(x) ((((x) / 10000000) << 28) | (((x) / 1000000) << 24) | (((x) / 100000) << 20) | (((x) / 10000) << 16) | BCD16(x)) #if defined(__GNUC__) || defined(__clang__) # define UNLIKELY(x) __builtin_expect((x), 0) # define LIKELY(x) __builtin_expect((x), 1) #else # define UNLIKELY(x) (x) # define LIKELY(x) (x) #endif #ifdef __cplusplus extern "C" { #endif /* Global variables. */ extern uint32_t lang_sys; /* (-) system language code */ extern int dump_on_exit; /* (O) dump regs on exit*/ extern int start_in_fullscreen; /* (O) start in fullscreen */ #ifdef _WIN32 extern int force_debug; /* (O) force debug output */ #endif #ifdef USE_WX extern int video_fps; /* (O) render speed in fps */ #endif extern int settings_only; /* (O) show only the settings dialog */ extern int confirm_exit_cmdl; /* (O) do not ask for confirmation on quit if set to 0 */ #ifdef _WIN32 extern uint64_t unique_id; extern uint64_t source_hwnd; #endif extern char rom_path[1024]; /* (O) full path to ROMs */ extern char log_path[1024]; /* (O) full path of logfile */ extern char vm_name[1024]; /* (O) display name of the VM */ #ifdef USE_INSTRUMENT extern uint8_t instru_enabled; extern uint64_t instru_run_ms; #endif #define window_x monitor_settings[0].mon_window_x #define window_y monitor_settings[0].mon_window_y #define window_w monitor_settings[0].mon_window_w #define window_h monitor_settings[0].mon_window_h extern int window_remember; extern int vid_resize; /* (C) allow resizing */ extern int invert_display; /* (C) invert the display */ extern int suppress_overscan; /* (C) suppress overscans */ extern uint32_t lang_id; /* (C) language code identifier */ extern char icon_set[256]; /* (C) iconset identifier */ extern int scale; /* (C) screen scale factor */ extern int dpi_scale; /* (C) DPI scaling of the emulated screen */ extern int vid_api; /* (C) video renderer */ extern int vid_cga_contrast; /* (C) video */ extern int video_fullscreen; /* (C) video */ extern int video_fullscreen_first; /* (C) video */ extern int video_fullscreen_scale; /* (C) video */ extern int enable_overscan; /* (C) video */ extern int force_43; /* (C) video */ extern int video_filter_method; /* (C) video */ extern int video_vsync; /* (C) video */ extern int video_framerate; /* (C) video */ extern int gfxcard[GFXCARD_MAX]; /* (C) graphics/video card */ extern char video_shader[512]; /* (C) video */ extern int bugger_enabled; /* (C) enable ISAbugger */ extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */ extern int postcard_enabled; /* (C) enable POST card */ extern int unittester_enabled; /* (C) enable unit tester device */ extern int isamem_type[]; /* (C) enable ISA mem cards */ extern int isartc_type; /* (C) enable ISA RTC card */ extern int sound_is_float; /* (C) sound uses FP values */ extern int voodoo_enabled; /* (C) video option */ extern int ibm8514_standalone_enabled; /* (C) video option */ extern int xga_standalone_enabled; /* (C) video option */ extern uint32_t mem_size; /* (C) memory size (Installed on system board) */ extern uint32_t isa_mem_size; /* (C) memory size (ISA Memory Cards) */ extern int cpu; /* (C) cpu type */ extern int cpu_use_dynarec; /* (C) cpu uses/needs Dyna */ extern int fpu_type; /* (C) fpu type */ extern int fpu_softfloat; /* (C) fpu uses softfloat */ extern int time_sync; /* (C) enable time sync */ extern int hdd_format_type; /* (C) hard disk file format */ extern int lba_enhancer_enabled; /* (C) enable Vision Systems LBA Enhancer */ extern int confirm_reset; /* (C) enable reset confirmation */ extern int confirm_exit; /* (C) enable exit confirmation */ extern int confirm_save; /* (C) enable save confirmation */ extern int enable_discord; /* (C) enable Discord integration */ extern int other_ide_present; /* IDE controllers from non-IDE cards are present */ extern int other_scsi_present; /* SCSI controllers from non-SCSI cards are present */ extern int fixed_size_x; extern int fixed_size_y; extern int do_auto_pause; /* (C) Auto-pause the emulator on focus loss */ extern int auto_paused; extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */ #ifdef _Atomic extern _Atomic double mouse_x_error; /* Mouse error accumulator - Y */ extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */ #endif extern int pit_mode; /* (C) force setting PIT mode */ extern int fm_driver; /* (C) select FM sound driver */ /* Keyboard variables for future key combination redefinition. */ extern uint16_t key_prefix_1_1; extern uint16_t key_prefix_1_2; extern uint16_t key_prefix_2_1; extern uint16_t key_prefix_2_2; extern uint16_t key_uncapture_1; extern uint16_t key_uncapture_2; extern char exe_path[2048]; /* path (dir) of executable */ extern char usr_path[1024]; /* path (dir) of user data */ extern char cfg_path[1024]; /* full path of config file */ extern int open_dir_usr_path; /* default file open dialog directory of usr_path */ extern char uuid[MAX_UUID_LEN]; /* UUID or machine identifier */ #ifndef USE_NEW_DYNAREC extern FILE *stdlog; /* file to log output to */ #endif extern int config_changed; /* config has changed */ /* Function prototypes. */ #ifdef HAVE_STDARG_H extern void pclog_ex(const char *fmt, va_list); extern void fatal_ex(const char *fmt, va_list); #endif extern void pclog_toggle_suppr(void); extern void pclog(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); extern void fatal(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); extern void set_screen_size(int x, int y); extern void set_screen_size_monitor(int x, int y, int monitor_index); extern void reset_screen_size(void); extern void reset_screen_size_monitor(int monitor_index); extern void set_screen_size_natural(void); extern void update_mouse_msg(void); #if 0 extern void pc_reload(wchar_t *fn); #endif extern int pc_init_modules(void); extern int pc_init(int argc, char *argv[]); extern void pc_close(void *threadid); extern void pc_reset_hard_close(void); extern void pc_reset_hard_init(void); extern void pc_reset_hard(void); extern void pc_full_speed(void); extern void pc_speed_changed(void); extern void pc_send_cad(void); extern void pc_send_cae(void); extern void pc_send_cab(void); extern void pc_run(void); extern void pc_start(void); extern void pc_onesec(void); extern uint16_t get_last_addr(void); /* This is for external subtraction of cycles; should be in cpu.c but I put it here to avoid having to include cpu.h everywhere. */ extern void sub_cycles(int c); extern void resub_cycles(int old_cycles); extern void ack_pause(void); extern void do_pause(int p); extern double isa_timing; extern int io_delay; extern int framecountx; extern volatile int cpu_thread_run; extern uint8_t postcard_codes[POSTCARDS_NUM]; #ifdef __cplusplus } #endif #endif /*EMU_86BOX_H*/ ```
/content/code_sandbox/src/include/86box/86box.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
2,379
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Header for the implementation of Port 92 used by PS/2 * machines and 386+ clones. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_PORT_92_H #define EMU_PORT_92_H #ifdef _TIMER_H_ typedef struct port_92_t { uint8_t reg; uint8_t flags; pc_timer_t pulse_timer; uint64_t pulse_period; } port_92_t; #endif extern void port_92_set_period(void *priv, uint64_t pulse_period); extern void port_92_set_features(void *priv, int reset, int a20); extern void port_92_add(void *priv); extern void port_92_remove(void *priv); extern const device_t port_92_device; extern const device_t port_92_key_device; extern const device_t port_92_inv_device; extern const device_t port_92_word_device; extern const device_t port_92_pci_device; #endif /*EMU_PORT_92_H*/ ```
/content/code_sandbox/src/include/86box/port_92.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
290
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for platform specific serial to host passthrough. * * * Authors: Andreas J. Reichel <webmaster@6th-dimension.com>, * Jasmine Iwanek <jasmine@iwanek.co.uk> * */ #ifndef PLAT_CDROM_H #define PLAT_CDROM_H #include <stdint.h> #ifdef __cplusplus extern "C" { #endif #define RAW_SECTOR_SIZE 2352 #define COOKED_SECTOR_SIZE 2048 #define DATA_TRACK 0x14 #define AUDIO_TRACK 0x10 #define CD_FPS 75 #define FRAMES_TO_MSF(f, M, S, F) \ { \ uint64_t value = f; \ *(F) = (value % CD_FPS) & 0xff; \ value /= CD_FPS; \ *(S) = (value % 60) & 0xff; \ value /= 60; \ *(M) = value & 0xff; \ } #define MSF_TO_FRAMES(M, S, F) ((M) *60 * CD_FPS + (S) *CD_FPS + (F)) typedef struct SMSF { uint16_t min; uint8_t sec; uint8_t fr; } TMSF; extern int plat_cdrom_is_track_audio(uint32_t sector); extern int plat_cdrom_is_track_pre(uint32_t sector); extern uint32_t plat_cdrom_get_last_block(void); extern void plat_cdrom_get_audio_tracks(int *st_track, int *end, TMSF *lead_out); extern int plat_cdrom_get_audio_track_info(int end, int track, int *track_num, TMSF *start, uint8_t *attr); extern int plat_cdrom_get_audio_sub(uint32_t sector, uint8_t *attr, uint8_t *track, uint8_t *index, TMSF *rel_pos, TMSF *abs_pos); extern int plat_cdrom_get_sector_size(uint32_t sector); extern int plat_cdrom_read_sector(uint8_t *buffer, int raw, uint32_t sector); extern void plat_cdrom_eject(void); extern void plat_cdrom_close(void); extern int plat_cdrom_set_drive(const char *drv); extern int plat_cdrom_ext_medium_changed(void); extern uint32_t plat_cdrom_get_track_start(uint32_t sector, uint8_t *attr, uint8_t *track); #ifdef __cplusplus } #endif #endif ```
/content/code_sandbox/src/include/86box/plat_cdrom.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
620
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the I/O handler. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_IO_H #define EMU_IO_H extern void io_init(void); extern void io_sethandler_common(uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv, int step); extern void io_removehandler_common(uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv, int step); extern void io_handler_common(int set, uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv, int step); extern void io_sethandler(uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv); extern void io_removehandler(uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv); extern void io_handler(int set, uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv); extern void io_sethandler_interleaved(uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv); extern void io_removehandler_interleaved(uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv); extern void io_handler_interleaved(int set, uint16_t base, int size, uint8_t (*inb)(uint16_t addr, void *priv), uint16_t (*inw)(uint16_t addr, void *priv), uint32_t (*inl)(uint16_t addr, void *priv), void (*outb)(uint16_t addr, uint8_t val, void *priv), void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv); extern uint8_t inb(uint16_t port); extern void outb(uint16_t port, uint8_t val); extern uint16_t inw(uint16_t port); extern void outw(uint16_t port, uint16_t val); extern uint32_t inl(uint16_t port); extern void outl(uint16_t port, uint32_t val); extern void *io_trap_add(void (*func)(int size, uint16_t addr, uint8_t write, uint8_t val, void *priv), void *priv); extern void io_trap_remap(void *handle, int enable, uint16_t addr, uint16_t size); extern void io_trap_remove(void *handle); #endif /*EMU_IO_H*/ ```
/content/code_sandbox/src/include/86box/io.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,491
```objective-c #ifndef _TIMER_H_ #define _TIMER_H_ #include "cpu.h" /* Maximum period, currently 1 second. */ #define MAX_USEC64 1000000ULL #define MAX_USEC 1000000.0 #define TIMER_PROCESS 4 #define TIMER_SPLIT 2 #define TIMER_ENABLED 1 #pragma pack(push, 1) typedef struct ts_struct_t { uint32_t frac; uint32_t integer; } ts_struct_t; #pragma pack(pop) typedef union ts_t { uint64_t ts64; ts_struct_t ts32; } ts_t; /*Timers are based on the CPU Time Stamp Counter. Timer timestamps are in a 32:32 fixed point format, with the integer part compared against the TSC. The fractional part is used when advancing the timestamp to ensure a more accurate period. As the timer only stores 32 bits of integer timestamp, and the TSC is 64 bits, the timer period can only be at most 0x7fffffff CPU cycles. To allow room for (optimistic) CPU frequency growth, timer period must be at most 1 second. When a timer callback is called, the timer has been disabled. If the timer is to repeat, the callback must call timer_advance_u64(). This is a change from the old timer API.*/ typedef struct pc_timer_t { #ifdef USE_PCEM_TIMER uint32_t ts_integer; uint32_t ts_frac; #else ts_t ts; #endif int flags; /* The flags are defined above. */ int in_callback; double period; /* This is used for large period timers to count the microseconds and split the period. */ void (*callback)(void *priv); void *priv; struct pc_timer_t *prev; struct pc_timer_t *next; } pc_timer_t; #ifdef __cplusplus extern "C" { #endif /*Timestamp of nearest enabled timer. CPU emulation must call timer_process() when TSC matches or exceeds this.*/ extern uint32_t timer_target; /*Enable timer, without updating timestamp*/ extern void timer_enable(pc_timer_t *timer); /*Disable timer*/ extern void timer_disable(pc_timer_t *timer); /*Process any pending timers*/ extern void timer_process(void); /*Reset timer system*/ extern void timer_close(void); extern void timer_init(void); /*Add new timer. If start_timer is set, timer will be enabled with a zero timestamp - this is useful for permanently enabled timers*/ extern void timer_add(pc_timer_t *timer, void (*callback)(void *priv), void *priv, int start_timer); /*1us in 32:32 format*/ extern uint64_t TIMER_USEC; /*True if timer a expires before timer b*/ #define TIMER_LESS_THAN(a, b) ((int64_t) ((a)->ts.ts64 - (b)->ts.ts64) <= 0) /*True if timer a expires before 32 bit integer timestamp b*/ #define TIMER_LESS_THAN_VAL(a, b) ((int32_t) ((a)->ts.ts32.integer - (b)) <= 0) /*True if 32 bit integer timestamp a expires before 32 bit integer timestamp b*/ #define TIMER_VAL_LESS_THAN_VAL(a, b) ((int32_t) ((a) - (b)) <= 0) /*Advance timer by delay, specified in 32:32 format. This should be used to resume a recurring timer in a callback routine*/ static __inline void timer_advance_u64(pc_timer_t *timer, uint64_t delay) { timer->ts.ts64 += delay; timer_enable(timer); } /*Set a timer to the given delay, specified in 32:32 format. This should be used when starting a timer*/ static __inline void timer_set_delay_u64(pc_timer_t *timer, uint64_t delay) { timer->ts.ts64 = 0ULL; timer->ts.ts32.integer = tsc; timer->ts.ts64 += delay; timer_enable(timer); } /*True if timer currently enabled*/ static __inline int timer_is_enabled(pc_timer_t *timer) { return !!(timer->flags & TIMER_ENABLED); } /*True if timer currently on*/ static __inline int timer_is_on(pc_timer_t *timer) { return ((timer->flags & TIMER_SPLIT) && (timer->flags & TIMER_ENABLED)); } /*Return integer timestamp of timer*/ static __inline uint32_t timer_get_ts_int(pc_timer_t *timer) { return timer->ts.ts32.integer; } /*Return remaining time before timer expires, in us. If the timer has already expired then return 0*/ static __inline uint32_t timer_get_remaining_us(pc_timer_t *timer) { int64_t remaining; if (timer->flags & TIMER_ENABLED) { remaining = (int64_t) (timer->ts.ts64 - (uint64_t) (tsc << 32)); if (remaining < 0) return 0; return remaining / TIMER_USEC; } return 0; } /*Return remaining time before timer expires, in 32:32 timestamp format. If the timer has already expired then return 0*/ static __inline uint64_t timer_get_remaining_u64(pc_timer_t *timer) { int64_t remaining; if (timer->flags & TIMER_ENABLED) { remaining = (int64_t) (timer->ts.ts64 - (uint64_t) (tsc << 32)); if (remaining < 0) return 0; return remaining; } return 0; } /*Set timer callback function*/ static __inline void timer_set_callback(pc_timer_t *timer, void (*callback)(void *priv)) { timer->callback = callback; } /*Set timer private data*/ static __inline void timer_set_p(pc_timer_t *timer, void *priv) { timer->priv = priv; } /* The API for big timer periods starts here. */ extern void timer_stop(pc_timer_t *timer); extern void timer_on_auto(pc_timer_t *timer, double period); /* Change TSC, taking into account the timers. */ extern void timer_set_new_tsc(uint64_t new_tsc); #ifdef __cplusplus } #endif #endif /*_TIMER_H_*/ ```
/content/code_sandbox/src/include/86box/timer.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,352
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the pcjs v2 floppy image format (read-only) * * Authors: cold-brewed * * * More info: path_to_url * pcjs disk module v2: path_to_url */ #ifndef EMU_FLOPPY_PCJS_H #define EMU_FLOPPY_PCJS_H /* Currently targeting v2 of the spec */ #define PCJS_DISK_SPEC_VERSION 2 #define PCJS_MAX_TRACKS 256 #define PCJS_MAX_SIDES 2 #define PCJS_MAX_SECTORS 256 /* The json keys as defined in each sector array item */ #define PCJS_OBJECT_KEY_CYLINDER "c" #define PCJS_OBJECT_KEY_TRACK PCJS_OBJECT_KEY_CYLINDER #define PCJS_OBJECT_KEY_HEAD "h" #define PCJS_OBJECT_KEY_SECTOR "s" #define PCJS_OBJECT_KEY_LENGTH "l" #define PCJS_OBJECT_KEY_DATA "d" #define PCJS_OBJECT_KEY_FILE "f" #define PCJS_OBJECT_KEY_OFFSET "d" /* The json keys as defined in the fileTable object */ #define PCJS_OBJECT_KEY_FT_HASH "hash" #define PCJS_OBJECT_KEY_FT_PATH "path" #define PCJS_OBJECT_KEY_FT_ATTR "attr" #define PCJS_OBJECT_KEY_FT_DATE "date" #define PCJS_OBJECT_KEY_FT_SIZE "size" /* String length defaults */ #define PCJS_IMAGE_INFO_STRING_LEN 128 #define PCJS_IMAGE_INFO_ARRAY_LEN 128 #define PCJS_FILE_TABLE_STRING_LEN 128 /* Defaults for optional json values */ #define JSON_OPTIONAL_NUMBER_DEFAULT 0 #define JSON_OPTIONAL_STRING_DEFAULT "" /* Structure for each sector */ typedef struct pcjs_sector_t { /* Track number */ uint8_t track; /* Side number */ uint8_t side; /* Sector number */ uint8_t sector; /* Size of the sector */ uint16_t size; /* Encoded size of the sector */ uint16_t encoded_size; /* Pointer the the allocated data for the sector */ uint8_t *data; /* Number of times to repeat the pattern until end of sector */ uint16_t pattern_repeat; /* Last pattern entry to repeat */ int32_t last_entry; /* Maps back to a file entry. -1 if not set */ int32_t file; /* The offset in the mapped file entry. -1 if not set */ int32_t offset; } pcjs_sector_t; /* Cases are mixed here (some camelCase) to match the pcjs values */ typedef struct pcjs_image_info_t { char type[PCJS_IMAGE_INFO_STRING_LEN]; char name[PCJS_IMAGE_INFO_STRING_LEN]; char format[PCJS_IMAGE_INFO_STRING_LEN]; char hash[PCJS_IMAGE_INFO_STRING_LEN]; uint32_t checksum; uint8_t cylinders; uint8_t heads; uint8_t trackDefault; uint16_t sectorDefault; uint32_t diskSize; uint8_t boot_sector[PCJS_IMAGE_INFO_ARRAY_LEN]; uint8_t boot_sector_array_size; char version[PCJS_IMAGE_INFO_STRING_LEN]; char repository[PCJS_IMAGE_INFO_STRING_LEN]; } pcjs_image_info_t; typedef struct pcjs_file_table_entry_t { char hash[PCJS_FILE_TABLE_STRING_LEN]; char path[PCJS_FILE_TABLE_STRING_LEN]; char attr[PCJS_FILE_TABLE_STRING_LEN]; char date[PCJS_FILE_TABLE_STRING_LEN]; uint32_t size; } pcjs_file_table_entry_t ; typedef struct pcjs_file_table_t { pcjs_file_table_entry_t *entries; uint16_t num_entries; } pcjs_file_table_t; typedef struct pcjs_t { /* FILE pointer for the json file */ FILE *fp; /* These values are read in from the metadata */ /* Total number of tracks */ uint8_t total_tracks; /* Total number of sides */ uint8_t total_sides; /* Total number of sectors per track */ uint16_t total_sectors; /* These values are calculated for validation */ /* Calculated number of tracks */ uint8_t calc_total_tracks; /* Calculated number of sides */ uint8_t calc_total_sides; /* Calculated number of sectors per track */ uint16_t calc_total_sectors; /* Number of sectors per track */ uint8_t spt[PCJS_MAX_TRACKS][PCJS_MAX_SIDES]; /* Current track */ uint8_t current_track; /* Current side */ uint8_t current_side; /* Current sector */ uint8_t current_sector[PCJS_MAX_SIDES]; /* Disk is in dmf format? */ uint8_t dmf; uint8_t interleave; uint8_t gap2_len; uint8_t gap3_len; int track_width; /* Flags for the entire disk */ uint16_t disk_flags; /* Flags for the current track */ uint16_t track_flags; uint8_t interleave_ordered[PCJS_MAX_TRACKS][PCJS_MAX_SIDES]; /* The main mapping of all the sectors back to each individual pcjs_sector_t item. */ pcjs_sector_t sectors[PCJS_MAX_TRACKS][PCJS_MAX_SIDES][PCJS_MAX_SECTORS]; /* Disk metadata information contained in each image */ pcjs_image_info_t image_info; /* Optional file table mapping for each sector */ pcjs_file_table_t file_table; } pcjs_t; /* Errors */ enum pcjs_img_error { E_SUCCESS = 0, E_MISSING_KEY = 1, E_UNEXPECTED_VALUE = 2, E_INTEGRITY, E_INVALID_OBJECT, E_ALLOC, E_PARSE, }; typedef enum pcjs_img_error pcjs_error_t; /* Macros */ /* Macro for getting image info metadata: strings */ #define IMAGE_INFO_GET_STRING(type) \ const cJSON * type##_json = cJSON_GetObjectItemCaseSensitive(imageInfo, #type); \ if (cJSON_IsString( type##_json) && type##_json->valuestring != NULL) { \ strncpy(dev->image_info.type, type##_json->valuestring, sizeof(dev->image_info. type) - 1); \ } else { \ pcjs_log("Required string value for \"%s\" missing from imageInfo\n", #type); \ pcjs_error = E_INVALID_OBJECT; \ return 1; \ } /* Macro for getting image info metadata: ints */ #define IMAGE_INFO_GET_NUMBER(type) \ const cJSON * type##_json = cJSON_GetObjectItemCaseSensitive(imageInfo, #type); \ if (cJSON_IsNumber( type##_json)) { \ dev->image_info.type = type##_json->valueint; \ } else { \ pcjs_log("Required number value for \"%s\" missing from imageInfo\n", #type); \ pcjs_error = E_INVALID_OBJECT; \ return 1; \ } /* Macro for getting required object value: number */ #define JSON_GET_OBJECT_NUMBER_REQUIRED(var, json, key) \ const cJSON *var##_json = cJSON_GetObjectItemCaseSensitive(json, key); \ if (!cJSON_IsNumber(var##_json)) { \ pcjs_log("Required number value for \"%s\" missing or invalid\n", key); \ pcjs_error = E_INVALID_OBJECT; \ goto fail; \ } else { \ var = var##_json->valueint; \ } /* Macro for getting optional object value: number * Default value will be used if the number does not exist */ #define JSON_GET_OBJECT_NUMBER_OPTIONAL(var, json, key) \ const cJSON *var##_json = cJSON_GetObjectItemCaseSensitive(json, key); \ if (!cJSON_IsNumber(var##_json)) { \ var = JSON_OPTIONAL_NUMBER_DEFAULT; \ } else { \ var = var##_json->valueint; \ } /* Macro for getting optional object value: number * Provided default value will be used if the number does not exist */ #define JSON_GET_OBJECT_NUMBER_OPTIONAL_DEFAULT(var, json, key, default) \ const cJSON *var##_json = cJSON_GetObjectItemCaseSensitive(json, key); \ if (!cJSON_IsNumber(var##_json)) { \ var = default; \ } else { \ var = var##_json->valueint; \ } /* Macro for getting optional object value: string * Default value will be used if the string does not exist */ #define JSON_GET_OBJECT_STRING_OPTIONAL(var, json, key) \ const cJSON * var##_json = cJSON_GetObjectItemCaseSensitive(json, key); \ if (cJSON_IsString( var##_json) && var##_json->valuestring != NULL) { \ strncpy(var, var##_json->valuestring, sizeof(var) - 1); \ } else { \ strncpy(var, JSON_OPTIONAL_STRING_DEFAULT, sizeof(var) - 1); \ } /* Macro for getting required object value: string */ #define JSON_GET_OBJECT_STRING_REQUIRED(var, json, key) \ const cJSON * var##_json = cJSON_GetObjectItemCaseSensitive(json, key); \ if (cJSON_IsString( var##_json) && var##_json->valuestring != NULL) { \ strncpy(var, var##_json->valuestring, sizeof(var) - 1); \ } else { \ pcjs_error = E_INVALID_OBJECT; \ goto fail; \ } extern void pcjs_init(void); extern void pcjs_load(int drive, char *fn); extern void pcjs_close(int drive); extern const char* pcjs_errmsg(void); #endif ```
/content/code_sandbox/src/include/86box/fdd_pcjs.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
2,138
```objective-c #ifndef EMU_SOUND_RTMIDI_H #define EMU_SOUND_RTMIDI_H #ifdef __cplusplus extern "C" { #endif extern int rtmidi_out_get_num_devs(void); extern void rtmidi_out_get_dev_name(int num, char *s); extern int rtmidi_in_get_num_devs(void); extern void rtmidi_in_get_dev_name(int num, char *s); #ifdef __cplusplus } #endif #endif /*EMU_SOUND_RTMIDI*/ ```
/content/code_sandbox/src/include/86box/midi_rtmidi.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
103
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the following network controllers: * - SMC/WD 8003E (ISA 8-bit); * - SMC/WD 8013EBT (ISA 16-bit); * - SMC/WD 8013EP/A (MCA). * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * TheCollector1995, <mariogplayer@gmail.com> * Miran Grca, <mgrca8@gmail.com> * Peter Grehan, <grehan@iprg.nokia.com> * * * This program is free software; you can redistribute it and/or modify * (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 * * along with this program; if not, write to the: * * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307 * USA. */ #ifndef NET_WD8003_H #define NET_WD8003_H enum { WD_NONE = 0, WD8003E = 1, /* WD8003E : 8-bit ISA, no interface chip */ WD8003EB = 2, /* WD8003EB : 8-bit ISA, 5x3 interface chip */ WD8013EBT = 3, /* WD8013EBT : 16-bit ISA, no interface chip */ WD8003ETA = 4, /* WD8003ET/A: 16-bit MCA, no interface chip */ WD8003EA = 5, /* WD8003E/A : 16-bit MCA, 5x3 interface chip */ WD8013EPA = 6 }; #endif /*NET_WD8003_H*/ ```
/content/code_sandbox/src/include/86box/net_wd8003.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
517
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Voodoo Graphics, 2, Banshee, 3 emulation. * * * * Authors: Sarah Walker, <path_to_url * leilei * */ #ifndef VIDEO_VOODOO_DISPLAY_H #define VIDEO_VOODOO_DISPLAY_H void voodoo_update_ncc(voodoo_t *voodoo, int tmu); void voodoo_pixelclock_update(voodoo_t *voodoo); void voodoo_generate_filter_v1(voodoo_t *voodoo); void voodoo_generate_filter_v2(voodoo_t *voodoo); void voodoo_threshold_check(voodoo_t *voodoo); void voodoo_callback(void *priv); #endif /*VIDEO_VOODOO_DISPLAY_H*/ ```
/content/code_sandbox/src/include/86box/vid_voodoo_display.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
212
```objective-c #ifndef FIFO_H #define FIFO_H /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * FIFO infrastructure header. * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #define FIFO(size) \ typedef struct { \ int start; \ int end; \ int trigger_len; \ int len; \ int empty; \ int overrun; \ int full; \ int ready; \ int d_empty; \ int d_overrun; \ int d_full; \ int d_ready; \ \ void *priv; \ \ void (*d_empty_evt)(void *); \ void (*d_overrun_evt)(void *); \ void (*d_full_evt)(void *); \ void (*d_ready_evt)(void *); \ \ uint8_t buf[size]; \ } fifo## size ##_t; FIFO() FIFO(16) #define fifo16_init() fifo_init(16) FIFO(64) #define fifo64_init() fifo_init(64) extern int fifo_get_count(void *priv); extern void fifo_write(uint8_t val, void *priv); extern void fifo_write_evt(uint8_t val, void *priv); extern uint8_t fifo_read(void *priv); extern uint8_t fifo_read_evt(void *priv); extern void fifo_clear_overrun(void *priv); extern int fifo_get_full(void *priv); extern int fifo_get_d_full(void *priv); extern int fifo_get_empty(void *priv); extern int fifo_get_d_empty(void *priv); extern int fifo_get_overrun(void *priv); extern int fifo_get_d_overrun(void *priv); extern int fifo_get_ready(void *priv); extern int fifo_get_d_ready(void *priv); extern int fifo_get_trigger_len(void *priv); extern void fifo_set_trigger_len(void *priv, int trigger_len); extern void fifo_set_len(void *priv, int len); extern void fifo_set_d_full_evt(void *priv, void (*d_full_evt)(void *)); extern void fifo_set_d_empty_evt(void *priv, void (*d_empty_evt)(void *)); extern void fifo_set_d_overrun_evt(void *priv, void (*d_overrun_evt)(void *)); extern void fifo_set_d_ready_evt(void *priv, void (*d_ready_evt)(void *)); extern void fifo_set_priv(void *priv, void *sub_priv); extern void fifo_reset(void *priv); extern void fifo_reset_evt(void *priv); extern void fifo_close(void *priv); extern void *fifo_init(int len); #endif /*FIFO_H*/ ```
/content/code_sandbox/src/include/86box/fifo.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
660
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Sound emulation core. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_SOUND_H #define EMU_SOUND_H #define SOUND_CARD_MAX 4 /* currently we support up to 4 sound cards and a standalome MPU401 */ extern int sound_gain; #define FREQ_44100 44100 #define FREQ_48000 48000 #define FREQ_49716 49716 #define FREQ_88200 88200 #define FREQ_96000 96000 #define SOUND_FREQ FREQ_48000 #define SOUNDBUFLEN (SOUND_FREQ / 50) #define MUSIC_FREQ FREQ_49716 #define MUSICBUFLEN (MUSIC_FREQ / 36) #define CD_FREQ FREQ_44100 #define CD_BUFLEN (CD_FREQ / 10) #define WT_FREQ FREQ_44100 #define WTBUFLEN (MUSIC_FREQ / 45) enum { SOUND_NONE = 0, SOUND_INTERNAL }; extern int ppispeakon; extern int gated; extern int speakval; extern int speakon; extern int sound_pos_global; extern int music_pos_global; extern int wavetable_pos_global; extern int sound_card_current[SOUND_CARD_MAX]; extern void sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *priv), void *priv); extern void music_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *priv), void *priv); extern void wavetable_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *priv), void *priv); extern void sound_set_cd_audio_filter(void (*filter)(int channel, double *buffer, void *priv), void *priv); extern void sound_set_pc_speaker_filter(void (*filter)(int channel, double *buffer, void *priv), void *priv); extern void (*filter_pc_speaker)(int channel, double *buffer, void *priv); extern void *filter_pc_speaker_p; extern int sound_card_available(int card); #ifdef EMU_DEVICE_H extern const device_t *sound_card_getdevice(int card); #endif extern int sound_card_has_config(int card); extern const char *sound_card_get_internal_name(int card); extern int sound_card_get_from_internal_name(const char *s); extern void sound_card_init(void); extern void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r); extern void sound_speed_changed(void); extern void sound_init(void); extern void sound_reset(void); extern void sound_card_reset(void); extern void sound_cd_thread_end(void); extern void sound_cd_thread_reset(void); extern void closeal(void); extern void inital(void); extern void givealbuffer(const void *buf); extern void givealbuffer_music(const void *buf); extern void givealbuffer_wt(const void *buf); extern void givealbuffer_cd(const void *buf); #define sb_vibra16c_onboard_relocate_base sb_vibra16s_onboard_relocate_base extern void sb_vibra16s_onboard_relocate_base(uint16_t new_addr, void *priv); #ifdef EMU_DEVICE_H /* AdLib and AdLib Gold */ extern const device_t adlib_device; extern const device_t adlib_mca_device; extern const device_t adgold_device; /* Aztech Sound Galaxy 16 */ extern const device_t azt2316a_device; extern const device_t acermagic_s20_device; extern const device_t mirosound_pcm10_device; extern const device_t azt1605_device; /* C-Media CMI8x38 */ extern const device_t cmi8338_device; extern const device_t cmi8338_onboard_device; extern const device_t cmi8738_device; extern const device_t cmi8738_onboard_device; extern const device_t cmi8738_6ch_onboard_device; /* Creative Labs Game Blaster */ extern const device_t cms_device; /* Creative Labs Sound Blaster */ extern const device_t sb_1_device; extern const device_t sb_15_device; extern const device_t sb_mcv_device; extern const device_t sb_2_device; extern const device_t sb_pro_v1_device; extern const device_t sb_pro_v2_device; extern const device_t sb_pro_mcv_device; extern const device_t sb_pro_compat_device; extern const device_t sb_16_device; extern const device_t sb_vibra16s_onboard_device; extern const device_t sb_vibra16s_device; extern const device_t sb_vibra16xv_device; extern const device_t sb_vibra16c_onboard_device; extern const device_t sb_vibra16c_device; extern const device_t sb_16_pnp_device; extern const device_t sb_16_compat_device; extern const device_t sb_16_compat_nompu_device; extern const device_t sb_16_reply_mca_device; extern const device_t sb_32_pnp_device; extern const device_t sb_awe32_device; extern const device_t sb_awe32_pnp_device; extern const device_t sb_awe64_value_device; extern const device_t sb_awe64_device; extern const device_t sb_awe64_gold_device; /* Crystal CS423x */ extern const device_t cs4235_device; extern const device_t cs4235_onboard_device; extern const device_t cs4236b_device; extern const device_t cs4237b_device; extern const device_t cs4238b_device; /* ESS Technology */ extern const device_t ess_688_device; extern const device_t ess_ess0100_pnp_device; extern const device_t ess_1688_device; extern const device_t ess_ess0102_pnp_device; extern const device_t ess_ess0968_pnp_device; extern const device_t ess_soundpiper_16_mca_device; extern const device_t ess_soundpiper_32_mca_device; extern const device_t ess_chipchat_16_mca_device; /* Ensoniq AudioPCI */ extern const device_t es1371_device; extern const device_t es1371_onboard_device; extern const device_t es1373_device; extern const device_t es1373_onboard_device; extern const device_t ct5880_device; extern const device_t ct5880_onboard_device; /* Gravis UltraSound and UltraSound Max */ extern const device_t gus_device; /* IBM PS/1 Audio Card */ extern const device_t ps1snd_device; /* Innovation SSI-2001 */ extern const device_t ssi2001_device; /* Pro Audio Spectrum Plus, 16, and 16D */ extern const device_t pasplus_device; extern const device_t pas16_device; extern const device_t pas16d_device; /* Tandy PSSJ */ extern const device_t pssj_device; extern const device_t pssj_isa_device; /* Tandy PSG */ extern const device_t tndy_device; /* Windows Sound System */ extern const device_t wss_device; extern const device_t ncr_business_audio_device; #endif #endif /*EMU_SOUND_H*/ ```
/content/code_sandbox/src/include/86box/sound.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,596
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> */ #ifndef EMU_IDE_H #define EMU_IDE_H #define IDE_BUS_MAX 4 #define IDE_CHAN_MAX 2 #define HDC_PRIMARY_BASE 0x01F0 #define HDC_PRIMARY_SIDE 0x03F6 #define HDC_PRIMARY_IRQ 14 #define HDC_SECONDARY_BASE 0x0170 #define HDC_SECONDARY_SIDE 0x0376 #define HDC_SECONDARY_IRQ 15 #define HDC_TERTIARY_BASE 0x01E8 #define HDC_TERTIARY_SIDE 0x03EE #define HDC_TERTIARY_IRQ 11 #define HDC_QUATERNARY_BASE 0x0168 #define HDC_QUATERNARY_SIDE 0x036E #define HDC_QUATERNARY_IRQ 10 enum { IDE_NONE = 0, /* Absent master or both. */ IDE_HDD, /* Hard disk. */ IDE_ATAPI, /* ATAPI device. */ IDE_RESERVED, /* Reserved, do not use. */ IDE_SHADOW, /* Shadow flag, do not assign on is own. */ IDE_HDD_SHADOW, /* Shadow of a hard disk. */ IDE_ATAPI_SHADOW /* Shadow of an ATAPI device. */ }; typedef struct ide_tf_s { union { uint8_t cylprecomp; uint8_t features; }; union { uint8_t secount; uint8_t phase; }; union { uint16_t cylinder; uint16_t request_length; }; union { uint8_t atastat; uint8_t status; }; uint8_t error; uint8_t sector; union { uint8_t drvsel; struct { uint8_t head :4; uint8_t pad :2; uint8_t lba :1; uint8_t pad0 :1; }; }; uint32_t pos; } ide_tf_t; #ifdef _TIMER_H_ typedef struct ide_s { /* The rest. */ uint8_t selected; uint8_t command; uint8_t head; uint8_t params_specified; int type; int board; int irqstat; int service; int blocksize; int blockcount; int hdd_num; int channel; int sector_pos; int reset; int mdma_mode; int do_initial_read; uint32_t drive; uint32_t cfg_spt; uint32_t cfg_hpc; uint32_t lba_addr; uint32_t tracks; uint32_t spt; uint32_t hpc; uint16_t *buffer; uint8_t *sector_buffer; pc_timer_t timer; /* Task file. */ ide_tf_t * tf; /* Stuff mostly used by ATAPI */ #ifdef SCSI_DEVICE_H scsi_common_t *sc; #else void * sc; #endif int interrupt_drq; double pending_delay; #ifdef SCSI_DEVICE_H int (*get_max)(int ide_has_dma, int type); int (*get_timings)(int ide_has_dma, int type); void (*identify)(struct ide_s *ide, int ide_has_dma); void (*stop)(scsi_common_t *sc); void (*packet_command)(scsi_common_t *sc, uint8_t *cdb); void (*device_reset)(scsi_common_t *sc); uint8_t (*phase_data_out)(scsi_common_t *sc); void (*command_stop)(scsi_common_t *sc); void (*bus_master_error)(scsi_common_t *sc); #else void * get_max; void * get_timings; void * identify; void * stop; void * device_reset; void * phase_data_out; void * command_stop; void * bus_master_error; #endif } ide_t; #ifdef EMU_HDC_H extern ide_t *ide_drives[IDE_NUM]; #endif #endif /* Type: 0 = PIO, 1 = SDMA, 2 = MDMA, 3 = UDMA Return: -1 = Not supported, Anything else = maximum mode This will eventually be hookable. */ enum { TYPE_PIO = 0, TYPE_SDMA = 1, TYPE_MDMA = 2, TYPE_UDMA = 3 }; /* Return: 0 = Not supported, Anything else = timings This will eventually be hookable. */ enum { TIMINGS_DMA = 0, TIMINGS_PIO = 1, TIMINGS_PIO_FC = 2 }; extern int ide_ter_enabled; extern int ide_qua_enabled; #ifdef SCSI_DEVICE_H extern ide_t *ide_get_drive(int ch); extern void ide_irq(ide_t *ide, int set, int log); extern void ide_allocate_buffer(ide_t *dev); extern void ide_atapi_attach(ide_t *dev); #endif extern void *ide_xtide_init(void); extern void ide_xtide_close(void); extern void ide_drives_set_shadow(void); extern void ide_writew(uint16_t addr, uint16_t val, void *priv); extern void ide_write_devctl(uint16_t addr, uint8_t val, void *priv); extern void ide_writeb(uint16_t addr, uint8_t val, void *priv); extern uint8_t ide_readb(uint16_t addr, void *priv); extern uint8_t ide_read_alt_status(uint16_t addr, void *priv); extern uint16_t ide_readw(uint16_t addr, void *priv); extern void ide_set_bus_master(int board, int (*dma)(uint8_t *data, int transfer_length, int out, void *priv), void (*set_irq)(uint8_t status, void *priv), void *priv); extern void win_cdrom_eject(uint8_t id); extern void win_cdrom_reload(uint8_t id); extern void ide_set_base_addr(int board, int base, uint16_t port); extern void ide_set_irq(int board, int irq); extern void ide_handlers(uint8_t board, int set); extern void ide_board_set_force_ata3(int board, int force_ata3); #ifdef EMU_ISAPNP_H extern void ide_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv); extern void ide_pnp_config_changed_1addr(uint8_t ld, isapnp_device_config_t *config, void *priv); #endif extern double ide_atapi_get_period(uint8_t channel); #ifdef SCSI_DEVICE_H extern void ide_set_callback(ide_t *ide, double callback); #endif extern void ide_set_board_callback(uint8_t board, double callback); extern void ide_padstr(char *str, const char *src, int len); extern void ide_padstr8(uint8_t *buf, int buf_size, const char *src); extern uint8_t ide_read_ali_75(void); extern uint8_t ide_read_ali_76(void); /* Legacy #define's. */ #define ide_irq_raise(ide) ide_irq(ide, 1, 1) #define ide_irq_lower(ide) ide_irq(ide, 0, 1) #define ide_set_base(board, port) ide_set_base_addr(board, 0, port) #define ide_set_side(board, port) ide_set_base_addr(board, 1, port) #define ide_pri_enable() ide_handlers(0, 1) #define ide_pri_disable() ide_handlers(0, 0) #define ide_sec_enable() ide_handlers(1, 1) #define ide_sec_disable() ide_handlers(1, 0) #define ide_set_handlers(board) ide_handlers(board, 1) #define ide_remove_handlers(board) ide_handlers(board, 0) #endif /*EMU_IDE_H*/ ```
/content/code_sandbox/src/include/86box/hdc_ide.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,867
```objective-c #ifndef EMU_FIFO8_H #define EMU_FIFO8_H typedef struct Fifo8 { /* All fields are private */ uint8_t *data; uint32_t capacity; uint32_t head; uint32_t num; } Fifo8; /** * fifo8_create: * @fifo: struct Fifo8 to initialise with new FIFO * @capacity: capacity of the newly created FIFO * * Create a FIFO of the specified size. Clients should call fifo8_destroy() * when finished using the fifo. The FIFO is initially empty. */ extern void fifo8_create(Fifo8 *fifo, uint32_t capacity); /** * fifo8_destroy: * @fifo: FIFO to cleanup * * Cleanup a FIFO created with fifo8_create(). Frees memory created for FIFO *storage. The FIFO is no longer usable after this has been called. */ extern void fifo8_destroy(Fifo8 *fifo); /** * fifo8_push: * @fifo: FIFO to push to * @data: data byte to push * * Push a data byte to the FIFO. Behaviour is undefined if the FIFO is full. * Clients are responsible for checking for fullness using fifo8_is_full(). */ extern void fifo8_push(Fifo8 *fifo, uint8_t data); /** * fifo8_push_all: * @fifo: FIFO to push to * @data: data to push * @size: number of bytes to push * * Push a byte array to the FIFO. Behaviour is undefined if the FIFO is full. * Clients are responsible for checking the space left in the FIFO using * fifo8_num_free(). */ extern void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num); /** * fifo8_pop: * @fifo: fifo to pop from * * Pop a data byte from the FIFO. Behaviour is undefined if the FIFO is empty. * Clients are responsible for checking for emptyness using fifo8_is_empty(). * * Returns: The popped data byte. */ extern uint8_t fifo8_pop(Fifo8 *fifo); /** * fifo8_pop_buf: * @fifo: FIFO to pop from * @dest: the buffer to write the data into (can be NULL) * @destlen: size of @dest and maximum number of bytes to pop * * Pop a number of elements from the FIFO up to a maximum of @destlen. * The popped data is copied into the @dest buffer. * Care is taken when the data wraps around in the ring buffer. * * Returns: number of bytes popped. */ extern uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen); /** * fifo8_pop_bufptr: * @fifo: FIFO to pop from * @max: maximum number of bytes to pop * @numptr: pointer filled with number of bytes returned (can be NULL) * * New code should prefer to use fifo8_pop_buf() instead of fifo8_pop_bufptr(). * * Pop a number of elements from the FIFO up to a maximum of @max. The buffer * containing the popped data is returned. This buffer points directly into * the internal FIFO backing store and data (without checking for overflow!) * and is invalidated once any of the fifo8_* APIs are called on the FIFO. * * The function may return fewer bytes than requested when the data wraps * around in the ring buffer; in this case only a contiguous part of the data * is returned. * * The number of valid bytes returned is populated in *@numptr; will always * return at least 1 byte. max must not be 0 or greater than the number of * bytes in the FIFO. * * Clients are responsible for checking the availability of requested data * using fifo8_num_used(). * * Returns: A pointer to popped data. */ extern const uint8_t *fifo8_pop_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr); /** * fifo8_peek_bufptr: read upto max bytes from the fifo * @fifo: FIFO to read from * @max: maximum number of bytes to peek * @numptr: pointer filled with number of bytes returned (can be NULL) * * Peek into a number of elements from the FIFO up to a maximum of @max. * The buffer containing the data peeked into is returned. This buffer points * directly into the FIFO backing store. Since data is invalidated once any * of the fifo8_* APIs are called on the FIFO, it is the caller responsibility * to access it before doing further API calls. * * The function may return fewer bytes than requested when the data wraps * around in the ring buffer; in this case only a contiguous part of the data * is returned. * * The number of valid bytes returned is populated in *@numptr; will always * return at least 1 byte. max must not be 0 or greater than the number of * bytes in the FIFO. * * Clients are responsible for checking the availability of requested data * using fifo8_num_used(). * * Returns: A pointer to peekable data. */ extern const uint8_t *fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr); /** * fifo8_drop: * @fifo: FIFO to drop bytes * @len: number of bytes to drop * * Drop (consume) bytes from a FIFO. */ extern void fifo8_drop(Fifo8 *fifo, uint32_t len); /** * fifo8_reset: * @fifo: FIFO to reset * * Reset a FIFO. All data is discarded and the FIFO is emptied. */ extern void fifo8_reset(Fifo8 *fifo); /** * fifo8_is_empty: * @fifo: FIFO to check * * Check if a FIFO is empty. * * Returns: True if the fifo is empty, false otherwise. */ extern int fifo8_is_empty(Fifo8 *fifo); /** * fifo8_is_full: * @fifo: FIFO to check * * Check if a FIFO is full. * * Returns: True if the fifo is full, false otherwise. */ extern int fifo8_is_full(Fifo8 *fifo); /** * fifo8_num_free: * @fifo: FIFO to check * * Return the number of free bytes in the FIFO. * * Returns: Number of free bytes. */ extern uint32_t fifo8_num_free(Fifo8 *fifo); /** * fifo8_num_used: * @fifo: FIFO to check * * Return the number of used bytes in the FIFO. * * Returns: Number of used bytes. */ extern uint32_t fifo8_num_used(Fifo8 *fifo); #endif /* EMU_FIFO8_H */ ```
/content/code_sandbox/src/include/86box/fifo8.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,435
```objective-c /* * VARCem Virtual ARchaeological Computer EMulator. * An emulator of (mostly) x86-based PC systems and devices, * using the ISA,EISA,VLB,MCA and PCI system buses, roughly * spanning the era between 1981 and 1995. * * Definitions for the generic NVRAM/CMOS driver. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com>, * David Hrdlika, <hrdlickadavid@outlook.com> * * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the * following conditions are met: * * 1. Redistributions of source code must retain the entire * above notice, this list of conditions and the following * disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names * of its contributors may be used to endorse or promote * products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef EMU_NVR_H #define EMU_NVR_H #define NVR_MAXSIZE 512 /* max size of NVR data */ /* Conversion from BCD to Binary and vice versa. */ #define RTC_BCD(x) (((x) % 10) | (((x) / 10) << 4)) #define RTC_DCB(x) ((((x) &0xf0) >> 4) * 10 + ((x) &0x0f)) #define RTC_BCDINC(x, y) RTC_BCD(RTC_DCB(x) + y) /* Time sync options */ #define TIME_SYNC_DISABLED 0 #define TIME_SYNC_ENABLED 1 #define TIME_SYNC_UTC 2 /* Define a generic RTC/NVRAM device. */ typedef struct _nvr_ { char *fn; /* pathname of image file */ uint16_t size; /* device configuration */ int8_t irq; int8_t is_new; uint8_t onesec_cnt; pc_timer_t onesec_time; void *data; /* local data */ /* Hooks to device functions. */ void (*reset)(struct _nvr_ *); void (*start)(struct _nvr_ *); void (*tick)(struct _nvr_ *); void (*ven_save)(void); uint8_t regs[NVR_MAXSIZE]; /* these are the registers */ } nvr_t; extern int nvr_dosave; #ifdef EMU_DEVICE_H extern const device_t at_nvr_old_device; extern const device_t at_nvr_device; extern const device_t at_mb_nvr_device; extern const device_t ps_nvr_device; extern const device_t amstrad_nvr_device; extern const device_t amstrad_megapc_nvr_device; extern const device_t ibmat_nvr_device; extern const device_t piix4_nvr_device; extern const device_t ps_no_nmi_nvr_device; extern const device_t amstrad_no_nmi_nvr_device; extern const device_t ami_1992_nvr_device; extern const device_t ami_1994_nvr_device; extern const device_t ami_1995_nvr_device; extern const device_t via_nvr_device; extern const device_t p6rp4_nvr_device; extern const device_t elt_nvr_device; #endif extern void rtc_tick(void); extern void nvr_init(nvr_t *); extern char *nvr_path(char *str); extern FILE *nvr_fopen(char *str, char *mode); extern int nvr_load(void); extern void nvr_close(void); extern void nvr_set_ven_save(void (*ven_save)(void)); extern int nvr_save(void); extern int nvr_is_leap(int year); extern int nvr_get_days(int month, int year); extern void nvr_time_sync(void); extern void nvr_time_get(struct tm *); extern void nvr_time_set(struct tm *); extern void nvr_reg_write(uint16_t reg, uint8_t val, void *priv); extern void nvr_at_handler(int set, uint16_t base, nvr_t *nvr); extern void nvr_at_sec_handler(int set, uint16_t base, nvr_t *nvr); extern void nvr_at_index_read_handler(int set, uint16_t base, nvr_t *nvr); extern void nvr_read_addr_set(int set, nvr_t *nvr); extern uint8_t nvr_get_index(void *priv, uint8_t addr_id); extern void nvr_at_data_port(int set, nvr_t *nvr); extern void nvr_wp_set(int set, int h, nvr_t *nvr); extern void nvr_via_wp_set(int set, int reg, nvr_t *nvr); extern void nvr_bank_set(int base, uint8_t bank, nvr_t *nvr); extern void nvr_lock_set(int base, int size, int lock, nvr_t *nvr); extern void nvr_irq_set(int irq, nvr_t *nvr); extern void nvr_smi_enable(int enable, nvr_t *nvr); extern uint8_t nvr_smi_status(nvr_t *nvr); extern void nvr_smi_status_clear(nvr_t *nvr); #endif /*EMU_NVR_H*/ ```
/content/code_sandbox/src/include/86box/nvr.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,410
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Voodoo Graphics and 2 specific emulation. * * * * Authors: Sarah Walker, <path_to_url * leilei * */ #ifndef VIDEO_VOODOO_DITHER_H #define VIDEO_VOODOO_DITHER_H static const uint8_t dither_rb[256][4][4] = { { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {0, 0, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 0}, {1, 0, 0, 0}, }, { {0, 0, 0, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}, {1, 0, 1, 0}, }, { {0, 0, 0, 1}, {1, 0, 1, 0}, {0, 1, 0, 0}, {1, 0, 1, 0}, }, { {0, 1, 0, 1}, {1, 0, 1, 0}, {0, 1, 0, 1}, {1, 0, 1, 0}, }, { {0, 1, 0, 1}, {1, 0, 1, 1}, {0, 1, 0, 1}, {1, 1, 1, 0}, }, { {0, 1, 0, 1}, {1, 1, 1, 1}, {0, 1, 0, 1}, {1, 1, 1, 1}, }, { {0, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 0, 1}, {1, 1, 1, 1}, }, { {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, }, { {1, 1, 1, 1}, {1, 1, 2, 1}, {1, 1, 1, 1}, {2, 1, 1, 1}, }, { {1, 1, 1, 1}, {2, 1, 2, 1}, {1, 1, 1, 1}, {2, 1, 2, 1}, }, { {1, 1, 1, 2}, {2, 1, 2, 1}, {1, 2, 1, 1}, {2, 1, 2, 1}, }, { {1, 2, 1, 2}, {2, 1, 2, 1}, {1, 2, 1, 2}, {2, 1, 2, 1}, }, { {1, 2, 1, 2}, {2, 1, 2, 2}, {1, 2, 1, 2}, {2, 2, 2, 1}, }, { {1, 2, 1, 2}, {2, 2, 2, 2}, {1, 2, 1, 2}, {2, 2, 2, 2}, }, { {1, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 1, 2}, {2, 2, 2, 2}, }, { {1, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, }, { {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {3, 2, 2, 2}, }, { {2, 2, 2, 2}, {2, 2, 3, 2}, {2, 2, 2, 2}, {3, 2, 3, 2}, }, { {2, 2, 2, 2}, {3, 2, 3, 2}, {2, 3, 2, 2}, {3, 2, 3, 2}, }, { {2, 2, 2, 3}, {3, 2, 3, 2}, {2, 3, 2, 3}, {3, 2, 3, 2}, }, { {2, 3, 2, 3}, {3, 2, 3, 2}, {2, 3, 2, 3}, {3, 3, 3, 2}, }, { {2, 3, 2, 3}, {3, 2, 3, 3}, {2, 3, 2, 3}, {3, 3, 3, 3}, }, { {2, 3, 2, 3}, {3, 3, 3, 3}, {3, 3, 2, 3}, {3, 3, 3, 3}, }, { {2, 3, 3, 3}, {3, 3, 3, 3}, {3, 3, 3, 3}, {3, 3, 3, 3}, }, { {3, 3, 3, 3}, {3, 3, 3, 3}, {3, 3, 3, 3}, {4, 3, 3, 3}, }, { {3, 3, 3, 3}, {3, 3, 4, 3}, {3, 3, 3, 3}, {4, 3, 4, 3}, }, { {3, 3, 3, 3}, {4, 3, 4, 3}, {3, 4, 3, 3}, {4, 3, 4, 3}, }, { {3, 3, 3, 4}, {4, 3, 4, 3}, {3, 4, 3, 4}, {4, 3, 4, 3}, }, { {3, 4, 3, 4}, {4, 3, 4, 3}, {3, 4, 3, 4}, {4, 4, 4, 3}, }, { {3, 4, 3, 4}, {4, 3, 4, 4}, {3, 4, 3, 4}, {4, 4, 4, 4}, }, { {3, 4, 3, 4}, {4, 4, 4, 4}, {4, 4, 3, 4}, {4, 4, 4, 4}, }, { {3, 4, 4, 4}, {4, 4, 4, 4}, {4, 4, 3, 4}, {4, 4, 4, 4}, }, { {4, 4, 4, 4}, {4, 4, 4, 4}, {4, 4, 4, 4}, {4, 4, 4, 4}, }, { {4, 4, 4, 4}, {4, 4, 5, 4}, {4, 4, 4, 4}, {5, 4, 4, 4}, }, { {4, 4, 4, 4}, {5, 4, 5, 4}, {4, 4, 4, 4}, {5, 4, 5, 4}, }, { {4, 4, 4, 5}, {5, 4, 5, 4}, {4, 5, 4, 4}, {5, 4, 5, 4}, }, { {4, 5, 4, 5}, {5, 4, 5, 4}, {4, 5, 4, 5}, {5, 4, 5, 4}, }, { {4, 5, 4, 5}, {5, 4, 5, 5}, {4, 5, 4, 5}, {5, 5, 5, 4}, }, { {4, 5, 4, 5}, {5, 5, 5, 5}, {4, 5, 4, 5}, {5, 5, 5, 5}, }, { {4, 5, 5, 5}, {5, 5, 5, 5}, {5, 5, 4, 5}, {5, 5, 5, 5}, }, { {5, 5, 5, 5}, {5, 5, 5, 5}, {5, 5, 5, 5}, {5, 5, 5, 5}, }, { {5, 5, 5, 5}, {5, 5, 6, 5}, {5, 5, 5, 5}, {6, 5, 5, 5}, }, { {5, 5, 5, 5}, {6, 5, 6, 5}, {5, 5, 5, 5}, {6, 5, 6, 5}, }, { {5, 5, 5, 6}, {6, 5, 6, 5}, {5, 6, 5, 5}, {6, 5, 6, 5}, }, { {5, 6, 5, 6}, {6, 5, 6, 5}, {5, 6, 5, 6}, {6, 5, 6, 5}, }, { {5, 6, 5, 6}, {6, 5, 6, 6}, {5, 6, 5, 6}, {6, 6, 6, 5}, }, { {5, 6, 5, 6}, {6, 6, 6, 6}, {5, 6, 5, 6}, {6, 6, 6, 6}, }, { {5, 6, 5, 6}, {6, 6, 6, 6}, {6, 6, 5, 6}, {6, 6, 6, 6}, }, { {5, 6, 6, 6}, {6, 6, 6, 6}, {6, 6, 6, 6}, {6, 6, 6, 6}, }, { {6, 6, 6, 6}, {6, 6, 6, 6}, {6, 6, 6, 6}, {7, 6, 6, 6}, }, { {6, 6, 6, 6}, {6, 6, 7, 6}, {6, 6, 6, 6}, {7, 6, 7, 6}, }, { {6, 6, 6, 6}, {7, 6, 7, 6}, {6, 7, 6, 6}, {7, 6, 7, 6}, }, { {6, 6, 6, 7}, {7, 6, 7, 6}, {6, 7, 6, 7}, {7, 6, 7, 6}, }, { {6, 7, 6, 7}, {7, 6, 7, 6}, {6, 7, 6, 7}, {7, 7, 7, 6}, }, { {6, 7, 6, 7}, {7, 6, 7, 7}, {6, 7, 6, 7}, {7, 7, 7, 7}, }, { {6, 7, 6, 7}, {7, 7, 7, 7}, {7, 7, 6, 7}, {7, 7, 7, 7}, }, { {6, 7, 7, 7}, {7, 7, 7, 7}, {7, 7, 7, 7}, {7, 7, 7, 7}, }, { {7, 7, 7, 7}, {7, 7, 7, 7}, {7, 7, 7, 7}, {8, 7, 7, 7}, }, { {7, 7, 7, 7}, {7, 7, 8, 7}, {7, 7, 7, 7}, {8, 7, 8, 7}, }, { {7, 7, 7, 7}, {8, 7, 8, 7}, {7, 8, 7, 7}, {8, 7, 8, 7}, }, { {7, 7, 7, 8}, {8, 7, 8, 7}, {7, 8, 7, 8}, {8, 7, 8, 7}, }, { {7, 8, 7, 8}, {8, 7, 8, 7}, {7, 8, 7, 8}, {8, 8, 8, 7}, }, { {7, 8, 7, 8}, {8, 7, 8, 8}, {7, 8, 7, 8}, {8, 8, 8, 8}, }, { {7, 8, 7, 8}, {8, 8, 8, 8}, {7, 8, 7, 8}, {8, 8, 8, 8}, }, { {7, 8, 8, 8}, {8, 8, 8, 8}, {8, 8, 7, 8}, {8, 8, 8, 8}, }, { {8, 8, 8, 8}, {8, 8, 8, 8}, {8, 8, 8, 8}, {8, 8, 8, 8}, }, { {8, 8, 8, 8}, {8, 8, 9, 8}, {8, 8, 8, 8}, {9, 8, 8, 8}, }, { {8, 8, 8, 8}, {9, 8, 9, 8}, {8, 8, 8, 8}, {9, 8, 9, 8}, }, { {8, 8, 8, 9}, {9, 8, 9, 8}, {8, 9, 8, 8}, {9, 8, 9, 8}, }, { {8, 9, 8, 9}, {9, 8, 9, 8}, {8, 9, 8, 9}, {9, 8, 9, 8}, }, { {8, 9, 8, 9}, {9, 8, 9, 9}, {8, 9, 8, 9}, {9, 9, 9, 8}, }, { {8, 9, 8, 9}, {9, 9, 9, 9}, {8, 9, 8, 9}, {9, 9, 9, 9}, }, { {8, 9, 9, 9}, {9, 9, 9, 9}, {9, 9, 8, 9}, {9, 9, 9, 9}, }, { {9, 9, 9, 9}, {9, 9, 9, 9}, {9, 9, 9, 9}, {9, 9, 9, 9}, }, { {9, 9, 9, 9}, {9, 9, 10, 9}, {9, 9, 9, 9}, {10, 9, 9, 9}, }, { {9, 9, 9, 9}, {10, 9, 10, 9}, {9, 9, 9, 9}, {10, 9, 10, 9}, }, { {9, 9, 9, 10}, {10, 9, 10, 9}, {9, 10, 9, 9}, {10, 9, 10, 9}, }, { {9, 10, 9, 10}, {10, 9, 10, 9}, {9, 10, 9, 10}, {10, 9, 10, 9}, }, { {9, 10, 9, 10}, {10, 9, 10, 10}, {9, 10, 9, 10}, {10, 10, 10, 9}, }, { {9, 10, 9, 10}, {10, 9, 10, 10}, {9, 10, 9, 10}, {10, 10, 10, 10}, }, { {9, 10, 9, 10}, {10, 10, 10, 10}, {10, 10, 9, 10}, {10, 10, 10, 10}, }, { {9, 10, 10, 10}, {10, 10, 10, 10}, {10, 10, 10, 10}, {10, 10, 10, 10}, }, { {10, 10, 10, 10}, {10, 10, 10, 10}, {10, 10, 10, 10}, {11, 10, 10, 10}, }, { {10, 10, 10, 10}, {10, 10, 11, 10}, {10, 10, 10, 10}, {11, 10, 11, 10}, }, { {10, 10, 10, 10}, {11, 10, 11, 10}, {10, 11, 10, 10}, {11, 10, 11, 10}, }, { {10, 10, 10, 11}, {11, 10, 11, 10}, {10, 11, 10, 11}, {11, 10, 11, 10}, }, { {10, 11, 10, 11}, {11, 10, 11, 10}, {10, 11, 10, 11}, {11, 11, 11, 10}, }, { {10, 11, 10, 11}, {11, 10, 11, 11}, {10, 11, 10, 11}, {11, 11, 11, 11}, }, { {10, 11, 10, 11}, {11, 11, 11, 11}, {11, 11, 10, 11}, {11, 11, 11, 11}, }, { {10, 11, 11, 11}, {11, 11, 11, 11}, {11, 11, 11, 11}, {11, 11, 11, 11}, }, { {11, 11, 11, 11}, {11, 11, 11, 11}, {11, 11, 11, 11}, {12, 11, 11, 11}, }, { {11, 11, 11, 11}, {11, 11, 12, 11}, {11, 11, 11, 11}, {12, 11, 12, 11}, }, { {11, 11, 11, 11}, {12, 11, 12, 11}, {11, 12, 11, 11}, {12, 11, 12, 11}, }, { {11, 11, 11, 12}, {12, 11, 12, 11}, {11, 12, 11, 12}, {12, 11, 12, 11}, }, { {11, 12, 11, 12}, {12, 11, 12, 11}, {11, 12, 11, 12}, {12, 12, 12, 11}, }, { {11, 12, 11, 12}, {12, 11, 12, 12}, {11, 12, 11, 12}, {12, 12, 12, 11}, }, { {11, 12, 11, 12}, {12, 12, 12, 12}, {11, 12, 11, 12}, {12, 12, 12, 12}, }, { {11, 12, 12, 12}, {12, 12, 12, 12}, {12, 12, 11, 12}, {12, 12, 12, 12}, }, { {12, 12, 12, 12}, {12, 12, 12, 12}, {12, 12, 12, 12}, {12, 12, 12, 12}, }, { {12, 12, 12, 12}, {12, 12, 13, 12}, {12, 12, 12, 12}, {13, 12, 12, 12}, }, { {12, 12, 12, 12}, {13, 12, 13, 12}, {12, 12, 12, 12}, {13, 12, 13, 12}, }, { {12, 12, 12, 13}, {13, 12, 13, 12}, {12, 13, 12, 12}, {13, 12, 13, 12}, }, { {12, 13, 12, 13}, {13, 12, 13, 12}, {12, 13, 12, 13}, {13, 12, 13, 12}, }, { {12, 13, 12, 13}, {13, 12, 13, 13}, {12, 13, 12, 13}, {13, 13, 13, 12}, }, { {12, 13, 12, 13}, {13, 13, 13, 13}, {12, 13, 12, 13}, {13, 13, 13, 13}, }, { {12, 13, 13, 13}, {13, 13, 13, 13}, {13, 13, 12, 13}, {13, 13, 13, 13}, }, { {13, 13, 13, 13}, {13, 13, 13, 13}, {13, 13, 13, 13}, {13, 13, 13, 13}, }, { {13, 13, 13, 13}, {13, 13, 14, 13}, {13, 13, 13, 13}, {14, 13, 13, 13}, }, { {13, 13, 13, 13}, {14, 13, 14, 13}, {13, 13, 13, 13}, {14, 13, 14, 13}, }, { {13, 13, 13, 14}, {14, 13, 14, 13}, {13, 14, 13, 13}, {14, 13, 14, 13}, }, { {13, 14, 13, 14}, {14, 13, 14, 13}, {13, 14, 13, 14}, {14, 13, 14, 13}, }, { {13, 14, 13, 14}, {14, 13, 14, 13}, {13, 14, 13, 14}, {14, 14, 14, 13}, }, { {13, 14, 13, 14}, {14, 13, 14, 14}, {13, 14, 13, 14}, {14, 14, 14, 14}, }, { {13, 14, 13, 14}, {14, 14, 14, 14}, {14, 14, 13, 14}, {14, 14, 14, 14}, }, { {13, 14, 14, 14}, {14, 14, 14, 14}, {14, 14, 14, 14}, {14, 14, 14, 14}, }, { {14, 14, 14, 14}, {14, 14, 14, 14}, {14, 14, 14, 14}, {15, 14, 14, 14}, }, { {14, 14, 14, 14}, {14, 14, 15, 14}, {14, 14, 14, 14}, {15, 14, 15, 14}, }, { {14, 14, 14, 14}, {15, 14, 15, 14}, {14, 15, 14, 14}, {15, 14, 15, 14}, }, { {14, 14, 14, 15}, {15, 14, 15, 14}, {14, 15, 14, 15}, {15, 14, 15, 14}, }, { {14, 15, 14, 15}, {15, 14, 15, 14}, {14, 15, 14, 15}, {15, 15, 15, 14}, }, { {14, 15, 14, 15}, {15, 14, 15, 15}, {14, 15, 14, 15}, {15, 15, 15, 15}, }, { {14, 15, 14, 15}, {15, 15, 15, 15}, {15, 15, 14, 15}, {15, 15, 15, 15}, }, { {14, 15, 15, 15}, {15, 15, 15, 15}, {15, 15, 15, 15}, {15, 15, 15, 15}, }, { {15, 15, 15, 15}, {15, 15, 15, 15}, {15, 15, 15, 15}, {16, 15, 15, 15}, }, { {15, 15, 15, 15}, {15, 15, 16, 15}, {15, 15, 15, 15}, {16, 15, 16, 15}, }, { {15, 15, 15, 15}, {16, 15, 16, 15}, {15, 16, 15, 15}, {16, 15, 16, 15}, }, { {15, 15, 15, 16}, {16, 15, 16, 15}, {15, 16, 15, 16}, {16, 15, 16, 15}, }, { {15, 16, 15, 16}, {16, 15, 16, 15}, {15, 16, 15, 16}, {16, 16, 16, 15}, }, { {15, 16, 15, 16}, {16, 15, 16, 16}, {15, 16, 15, 16}, {16, 16, 16, 16}, }, { {15, 16, 15, 16}, {16, 16, 16, 16}, {16, 16, 15, 16}, {16, 16, 16, 16}, }, { {15, 16, 16, 16}, {16, 16, 16, 16}, {16, 16, 16, 16}, {16, 16, 16, 16}, }, { {16, 16, 16, 16}, {16, 16, 16, 16}, {16, 16, 16, 16}, {17, 16, 16, 16}, }, { {16, 16, 16, 16}, {16, 16, 17, 16}, {16, 16, 16, 16}, {17, 16, 17, 16}, }, { {16, 16, 16, 16}, {17, 16, 17, 16}, {16, 17, 16, 16}, {17, 16, 17, 16}, }, { {16, 16, 16, 17}, {17, 16, 17, 16}, {16, 17, 16, 17}, {17, 16, 17, 16}, }, { {16, 17, 16, 17}, {17, 16, 17, 16}, {16, 17, 16, 17}, {17, 17, 17, 16}, }, { {16, 17, 16, 17}, {17, 16, 17, 17}, {16, 17, 16, 17}, {17, 17, 17, 17}, }, { {16, 17, 16, 17}, {17, 17, 17, 17}, {17, 17, 16, 17}, {17, 17, 17, 17}, }, { {16, 17, 17, 17}, {17, 17, 17, 17}, {17, 17, 17, 17}, {17, 17, 17, 17}, }, { {17, 17, 17, 17}, {17, 17, 17, 17}, {17, 17, 17, 17}, {18, 17, 17, 17}, }, { {17, 17, 17, 17}, {17, 17, 18, 17}, {17, 17, 17, 17}, {18, 17, 18, 17}, }, { {17, 17, 17, 17}, {18, 17, 18, 17}, {17, 18, 17, 17}, {18, 17, 18, 17}, }, { {17, 17, 17, 18}, {18, 17, 18, 17}, {17, 18, 17, 18}, {18, 17, 18, 17}, }, { {17, 18, 17, 18}, {18, 17, 18, 17}, {17, 18, 17, 18}, {18, 17, 18, 17}, }, { {17, 18, 17, 18}, {18, 17, 18, 18}, {17, 18, 17, 18}, {18, 18, 18, 17}, }, { {17, 18, 17, 18}, {18, 18, 18, 18}, {17, 18, 17, 18}, {18, 18, 18, 18}, }, { {17, 18, 18, 18}, {18, 18, 18, 18}, {18, 18, 17, 18}, {18, 18, 18, 18}, }, { {18, 18, 18, 18}, {18, 18, 18, 18}, {18, 18, 18, 18}, {18, 18, 18, 18}, }, { {18, 18, 18, 18}, {18, 18, 19, 18}, {18, 18, 18, 18}, {19, 18, 18, 18}, }, { {18, 18, 18, 18}, {19, 18, 19, 18}, {18, 18, 18, 18}, {19, 18, 19, 18}, }, { {18, 18, 18, 19}, {19, 18, 19, 18}, {18, 19, 18, 18}, {19, 18, 19, 18}, }, { {18, 19, 18, 19}, {19, 18, 19, 18}, {18, 19, 18, 19}, {19, 18, 19, 18}, }, { {18, 19, 18, 19}, {19, 18, 19, 19}, {18, 19, 18, 19}, {19, 19, 19, 18}, }, { {18, 19, 18, 19}, {19, 19, 19, 19}, {18, 19, 18, 19}, {19, 19, 19, 19}, }, { {18, 19, 19, 19}, {19, 19, 19, 19}, {19, 19, 18, 19}, {19, 19, 19, 19}, }, { {19, 19, 19, 19}, {19, 19, 19, 19}, {19, 19, 19, 19}, {19, 19, 19, 19}, }, { {19, 19, 19, 19}, {19, 19, 20, 19}, {19, 19, 19, 19}, {20, 19, 19, 19}, }, { {19, 19, 19, 19}, {20, 19, 20, 19}, {19, 19, 19, 19}, {20, 19, 20, 19}, }, { {19, 19, 19, 20}, {20, 19, 20, 19}, {19, 20, 19, 19}, {20, 19, 20, 19}, }, { {19, 19, 19, 20}, {20, 19, 20, 19}, {19, 20, 19, 20}, {20, 19, 20, 19}, }, { {19, 20, 19, 20}, {20, 19, 20, 19}, {19, 20, 19, 20}, {20, 20, 20, 19}, }, { {19, 20, 19, 20}, {20, 19, 20, 20}, {19, 20, 19, 20}, {20, 20, 20, 20}, }, { {19, 20, 19, 20}, {20, 20, 20, 20}, {20, 20, 19, 20}, {20, 20, 20, 20}, }, { {19, 20, 20, 20}, {20, 20, 20, 20}, {20, 20, 20, 20}, {20, 20, 20, 20}, }, { {20, 20, 20, 20}, {20, 20, 20, 20}, {20, 20, 20, 20}, {21, 20, 20, 20}, }, { {20, 20, 20, 20}, {20, 20, 21, 20}, {20, 20, 20, 20}, {21, 20, 21, 20}, }, { {20, 20, 20, 20}, {21, 20, 21, 20}, {20, 21, 20, 20}, {21, 20, 21, 20}, }, { {20, 20, 20, 21}, {21, 20, 21, 20}, {20, 21, 20, 21}, {21, 20, 21, 20}, }, { {20, 21, 20, 21}, {21, 20, 21, 20}, {20, 21, 20, 21}, {21, 21, 21, 20}, }, { {20, 21, 20, 21}, {21, 20, 21, 21}, {20, 21, 20, 21}, {21, 21, 21, 21}, }, { {20, 21, 20, 21}, {21, 21, 21, 21}, {21, 21, 20, 21}, {21, 21, 21, 21}, }, { {20, 21, 21, 21}, {21, 21, 21, 21}, {21, 21, 21, 21}, {21, 21, 21, 21}, }, { {21, 21, 21, 21}, {21, 21, 21, 21}, {21, 21, 21, 21}, {22, 21, 21, 21}, }, { {21, 21, 21, 21}, {21, 21, 22, 21}, {21, 21, 21, 21}, {22, 21, 22, 21}, }, { {21, 21, 21, 21}, {22, 21, 22, 21}, {21, 22, 21, 21}, {22, 21, 22, 21}, }, { {21, 21, 21, 22}, {22, 21, 22, 21}, {21, 22, 21, 21}, {22, 21, 22, 21}, }, { {21, 22, 21, 22}, {22, 21, 22, 21}, {21, 22, 21, 22}, {22, 21, 22, 21}, }, { {21, 22, 21, 22}, {22, 21, 22, 22}, {21, 22, 21, 22}, {22, 22, 22, 21}, }, { {21, 22, 21, 22}, {22, 22, 22, 22}, {21, 22, 21, 22}, {22, 22, 22, 22}, }, { {21, 22, 22, 22}, {22, 22, 22, 22}, {22, 22, 21, 22}, {22, 22, 22, 22}, }, { {22, 22, 22, 22}, {22, 22, 22, 22}, {22, 22, 22, 22}, {22, 22, 22, 22}, }, { {22, 22, 22, 22}, {22, 22, 23, 22}, {22, 22, 22, 22}, {23, 22, 22, 22}, }, { {22, 22, 22, 22}, {23, 22, 23, 22}, {22, 22, 22, 22}, {23, 22, 23, 22}, }, { {22, 22, 22, 23}, {23, 22, 23, 22}, {22, 23, 22, 22}, {23, 22, 23, 22}, }, { {22, 23, 22, 23}, {23, 22, 23, 22}, {22, 23, 22, 23}, {23, 22, 23, 22}, }, { {22, 23, 22, 23}, {23, 22, 23, 23}, {22, 23, 22, 23}, {23, 23, 23, 22}, }, { {22, 23, 22, 23}, {23, 23, 23, 23}, {22, 23, 22, 23}, {23, 23, 23, 23}, }, { {22, 23, 23, 23}, {23, 23, 23, 23}, {23, 23, 22, 23}, {23, 23, 23, 23}, }, { {23, 23, 23, 23}, {23, 23, 23, 23}, {23, 23, 23, 23}, {23, 23, 23, 23}, }, { {23, 23, 23, 23}, {23, 23, 24, 23}, {23, 23, 23, 23}, {24, 23, 23, 23}, }, { {23, 23, 23, 23}, {24, 23, 24, 23}, {23, 23, 23, 23}, {24, 23, 24, 23}, }, { {23, 23, 23, 23}, {24, 23, 24, 23}, {23, 24, 23, 23}, {24, 23, 24, 23}, }, { {23, 23, 23, 24}, {24, 23, 24, 23}, {23, 24, 23, 24}, {24, 23, 24, 23}, }, { {23, 24, 23, 24}, {24, 23, 24, 23}, {23, 24, 23, 24}, {24, 24, 24, 23}, }, { {23, 24, 23, 24}, {24, 23, 24, 24}, {23, 24, 23, 24}, {24, 24, 24, 24}, }, { {23, 24, 23, 24}, {24, 24, 24, 24}, {24, 24, 23, 24}, {24, 24, 24, 24}, }, { {23, 24, 24, 24}, {24, 24, 24, 24}, {24, 24, 24, 24}, {24, 24, 24, 24}, }, { {24, 24, 24, 24}, {24, 24, 24, 24}, {24, 24, 24, 24}, {25, 24, 24, 24}, }, { {24, 24, 24, 24}, {24, 24, 25, 24}, {24, 24, 24, 24}, {25, 24, 25, 24}, }, { {24, 24, 24, 24}, {25, 24, 25, 24}, {24, 25, 24, 24}, {25, 24, 25, 24}, }, { {24, 24, 24, 25}, {25, 24, 25, 24}, {24, 25, 24, 25}, {25, 24, 25, 24}, }, { {24, 25, 24, 25}, {25, 24, 25, 24}, {24, 25, 24, 25}, {25, 25, 25, 24}, }, { {24, 25, 24, 25}, {25, 24, 25, 25}, {24, 25, 24, 25}, {25, 25, 25, 25}, }, { {24, 25, 24, 25}, {25, 25, 25, 25}, {25, 25, 24, 25}, {25, 25, 25, 25}, }, { {24, 25, 25, 25}, {25, 25, 25, 25}, {25, 25, 25, 25}, {25, 25, 25, 25}, }, { {25, 25, 25, 25}, {25, 25, 25, 25}, {25, 25, 25, 25}, {26, 25, 25, 25}, }, { {25, 25, 25, 25}, {25, 25, 26, 25}, {25, 25, 25, 25}, {26, 25, 26, 25}, }, { {25, 25, 25, 25}, {26, 25, 26, 25}, {25, 25, 25, 25}, {26, 25, 26, 25}, }, { {25, 25, 25, 26}, {26, 25, 26, 25}, {25, 26, 25, 25}, {26, 25, 26, 25}, }, { {25, 26, 25, 26}, {26, 25, 26, 25}, {25, 26, 25, 26}, {26, 25, 26, 25}, }, { {25, 26, 25, 26}, {26, 25, 26, 26}, {25, 26, 25, 26}, {26, 26, 26, 25}, }, { {25, 26, 25, 26}, {26, 26, 26, 26}, {25, 26, 25, 26}, {26, 26, 26, 26}, }, { {25, 26, 26, 26}, {26, 26, 26, 26}, {26, 26, 25, 26}, {26, 26, 26, 26}, }, { {26, 26, 26, 26}, {26, 26, 26, 26}, {26, 26, 26, 26}, {26, 26, 26, 26}, }, { {26, 26, 26, 26}, {26, 26, 27, 26}, {26, 26, 26, 26}, {27, 26, 26, 26}, }, { {26, 26, 26, 26}, {27, 26, 27, 26}, {26, 26, 26, 26}, {27, 26, 27, 26}, }, { {26, 26, 26, 27}, {27, 26, 27, 26}, {26, 27, 26, 26}, {27, 26, 27, 26}, }, { {26, 27, 26, 27}, {27, 26, 27, 26}, {26, 27, 26, 27}, {27, 26, 27, 26}, }, { {26, 27, 26, 27}, {27, 26, 27, 27}, {26, 27, 26, 27}, {27, 27, 27, 26}, }, { {26, 27, 26, 27}, {27, 27, 27, 27}, {26, 27, 26, 27}, {27, 27, 27, 27}, }, { {26, 27, 27, 27}, {27, 27, 27, 27}, {27, 27, 26, 27}, {27, 27, 27, 27}, }, { {27, 27, 27, 27}, {27, 27, 27, 27}, {27, 27, 27, 27}, {27, 27, 27, 27}, }, { {27, 27, 27, 27}, {27, 27, 28, 27}, {27, 27, 27, 27}, {28, 27, 27, 27}, }, { {27, 27, 27, 27}, {27, 27, 28, 27}, {27, 27, 27, 27}, {28, 27, 28, 27}, }, { {27, 27, 27, 27}, {28, 27, 28, 27}, {27, 28, 27, 27}, {28, 27, 28, 27}, }, { {27, 27, 27, 28}, {28, 27, 28, 27}, {27, 28, 27, 28}, {28, 27, 28, 27}, }, { {27, 28, 27, 28}, {28, 27, 28, 27}, {27, 28, 27, 28}, {28, 28, 28, 27}, }, { {27, 28, 27, 28}, {28, 27, 28, 28}, {27, 28, 27, 28}, {28, 28, 28, 28}, }, { {27, 28, 27, 28}, {28, 28, 28, 28}, {28, 28, 27, 28}, {28, 28, 28, 28}, }, { {27, 28, 28, 28}, {28, 28, 28, 28}, {28, 28, 28, 28}, {28, 28, 28, 28}, }, { {28, 28, 28, 28}, {28, 28, 28, 28}, {28, 28, 28, 28}, {29, 28, 28, 28}, }, { {28, 28, 28, 28}, {28, 28, 29, 28}, {28, 28, 28, 28}, {29, 28, 29, 28}, }, { {28, 28, 28, 28}, {29, 28, 29, 28}, {28, 29, 28, 28}, {29, 28, 29, 28}, }, { {28, 28, 28, 29}, {29, 28, 29, 28}, {28, 29, 28, 29}, {29, 28, 29, 28}, }, { {28, 29, 28, 29}, {29, 28, 29, 28}, {28, 29, 28, 29}, {29, 29, 29, 28}, }, { {28, 29, 28, 29}, {29, 28, 29, 29}, {28, 29, 28, 29}, {29, 29, 29, 29}, }, { {28, 29, 28, 29}, {29, 29, 29, 29}, {29, 29, 28, 29}, {29, 29, 29, 29}, }, { {28, 29, 29, 29}, {29, 29, 29, 29}, {29, 29, 29, 29}, {29, 29, 29, 29}, }, { {29, 29, 29, 29}, {29, 29, 29, 29}, {29, 29, 29, 29}, {30, 29, 29, 29}, }, { {29, 29, 29, 29}, {29, 29, 30, 29}, {29, 29, 29, 29}, {30, 29, 29, 29}, }, { {29, 29, 29, 29}, {30, 29, 30, 29}, {29, 29, 29, 29}, {30, 29, 30, 29}, }, { {29, 29, 29, 30}, {30, 29, 30, 29}, {29, 30, 29, 29}, {30, 29, 30, 29}, }, { {29, 30, 29, 30}, {30, 29, 30, 29}, {29, 30, 29, 30}, {30, 29, 30, 29}, }, { {29, 30, 29, 30}, {30, 29, 30, 30}, {29, 30, 29, 30}, {30, 30, 30, 29}, }, { {29, 30, 29, 30}, {30, 30, 30, 30}, {29, 30, 29, 30}, {30, 30, 30, 30}, }, { {29, 30, 30, 30}, {30, 30, 30, 30}, {30, 30, 29, 30}, {30, 30, 30, 30}, }, { {30, 30, 30, 30}, {30, 30, 30, 30}, {30, 30, 30, 30}, {30, 30, 30, 30}, }, { {30, 30, 30, 30}, {30, 30, 31, 30}, {30, 30, 30, 30}, {31, 30, 30, 30}, }, { {30, 30, 30, 30}, {31, 30, 31, 30}, {30, 30, 30, 30}, {31, 30, 31, 30}, }, { {30, 30, 30, 31}, {31, 30, 31, 30}, {30, 31, 30, 30}, {31, 30, 31, 30}, }, { {30, 31, 30, 31}, {31, 30, 31, 30}, {30, 31, 30, 31}, {31, 30, 31, 30}, }, { {30, 31, 30, 31}, {31, 30, 31, 31}, {30, 31, 30, 31}, {31, 31, 31, 30}, }, { {30, 31, 30, 31}, {31, 31, 31, 31}, {30, 31, 30, 31}, {31, 31, 31, 31}, }, { {30, 31, 31, 31}, {31, 31, 31, 31}, {31, 31, 30, 31}, {31, 31, 31, 31}, }, { {31, 31, 31, 31}, {31, 31, 31, 31}, {31, 31, 31, 31}, {31, 31, 31, 31}, }, }; static const uint8_t dither_g[256][4][4] = { { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {0, 0, 0, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}, {1, 0, 1, 0}, }, { {0, 1, 0, 1}, {1, 0, 1, 0}, {0, 1, 0, 1}, {1, 0, 1, 0}, }, { {0, 1, 0, 1}, {1, 1, 1, 1}, {0, 1, 0, 1}, {1, 1, 1, 1}, }, { {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, }, { {1, 1, 1, 1}, {2, 1, 2, 1}, {1, 1, 1, 1}, {2, 1, 2, 1}, }, { {1, 2, 1, 2}, {2, 1, 2, 1}, {1, 2, 1, 2}, {2, 1, 2, 1}, }, { {1, 2, 1, 2}, {2, 2, 2, 2}, {1, 2, 1, 2}, {2, 2, 2, 2}, }, { {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, }, { {2, 2, 2, 2}, {3, 2, 3, 2}, {2, 2, 2, 2}, {3, 2, 3, 2}, }, { {2, 3, 2, 3}, {3, 2, 3, 2}, {2, 3, 2, 3}, {3, 2, 3, 2}, }, { {2, 3, 2, 3}, {3, 3, 3, 3}, {2, 3, 2, 3}, {3, 3, 3, 3}, }, { {3, 3, 3, 3}, {3, 3, 3, 3}, {3, 3, 3, 3}, {3, 3, 3, 3}, }, { {3, 3, 3, 3}, {4, 3, 4, 3}, {3, 3, 3, 3}, {4, 3, 4, 3}, }, { {3, 4, 3, 4}, {4, 3, 4, 3}, {3, 4, 3, 4}, {4, 3, 4, 3}, }, { {3, 4, 3, 4}, {4, 4, 4, 4}, {3, 4, 3, 4}, {4, 4, 4, 4}, }, { {3, 4, 4, 4}, {4, 4, 4, 4}, {4, 4, 4, 4}, {4, 4, 4, 4}, }, { {4, 4, 4, 4}, {4, 4, 5, 4}, {4, 4, 4, 4}, {5, 4, 5, 4}, }, { {4, 4, 4, 5}, {5, 4, 5, 4}, {4, 5, 4, 5}, {5, 4, 5, 4}, }, { {4, 5, 4, 5}, {5, 4, 5, 5}, {4, 5, 4, 5}, {5, 5, 5, 5}, }, { {4, 5, 5, 5}, {5, 5, 5, 5}, {5, 5, 5, 5}, {5, 5, 5, 5}, }, { {5, 5, 5, 5}, {5, 5, 6, 5}, {5, 5, 5, 5}, {6, 5, 6, 5}, }, { {5, 5, 5, 6}, {6, 5, 6, 5}, {5, 6, 5, 6}, {6, 5, 6, 5}, }, { {5, 6, 5, 6}, {6, 5, 6, 6}, {5, 6, 5, 6}, {6, 6, 6, 6}, }, { {5, 6, 6, 6}, {6, 6, 6, 6}, {6, 6, 6, 6}, {6, 6, 6, 6}, }, { {6, 6, 6, 6}, {6, 6, 7, 6}, {6, 6, 6, 6}, {7, 6, 7, 6}, }, { {6, 6, 6, 7}, {7, 6, 7, 6}, {6, 7, 6, 7}, {7, 6, 7, 6}, }, { {6, 7, 6, 7}, {7, 6, 7, 7}, {6, 7, 6, 7}, {7, 7, 7, 7}, }, { {6, 7, 7, 7}, {7, 7, 7, 7}, {7, 7, 7, 7}, {7, 7, 7, 7}, }, { {7, 7, 7, 7}, {7, 7, 8, 7}, {7, 7, 7, 7}, {8, 7, 8, 7}, }, { {7, 7, 7, 8}, {8, 7, 8, 7}, {7, 8, 7, 8}, {8, 7, 8, 7}, }, { {7, 8, 7, 8}, {8, 7, 8, 8}, {7, 8, 7, 8}, {8, 8, 8, 8}, }, { {7, 8, 8, 8}, {8, 8, 8, 8}, {8, 8, 7, 8}, {8, 8, 8, 8}, }, { {8, 8, 8, 8}, {8, 8, 9, 8}, {8, 8, 8, 8}, {9, 8, 8, 8}, }, { {8, 8, 8, 9}, {9, 8, 9, 8}, {8, 9, 8, 8}, {9, 8, 9, 8}, }, { {8, 9, 8, 9}, {9, 8, 9, 9}, {8, 9, 8, 9}, {9, 9, 9, 8}, }, { {8, 9, 9, 9}, {9, 9, 9, 9}, {9, 9, 8, 9}, {9, 9, 9, 9}, }, { {9, 9, 9, 9}, {9, 9, 10, 9}, {9, 9, 9, 9}, {10, 9, 9, 9}, }, { {9, 9, 9, 10}, {10, 9, 10, 9}, {9, 10, 9, 9}, {10, 9, 10, 9}, }, { {9, 10, 9, 10}, {10, 9, 10, 10}, {9, 10, 9, 10}, {10, 10, 10, 9}, }, { {9, 10, 10, 10}, {10, 10, 10, 10}, {10, 10, 9, 10}, {10, 10, 10, 10}, }, { {10, 10, 10, 10}, {10, 10, 11, 10}, {10, 10, 10, 10}, {11, 10, 10, 10}, }, { {10, 10, 10, 11}, {11, 10, 11, 10}, {10, 11, 10, 10}, {11, 10, 11, 10}, }, { {10, 11, 10, 11}, {11, 10, 11, 11}, {10, 11, 10, 11}, {11, 11, 11, 10}, }, { {10, 11, 11, 11}, {11, 11, 11, 11}, {11, 11, 10, 11}, {11, 11, 11, 11}, }, { {11, 11, 11, 11}, {11, 11, 12, 11}, {11, 11, 11, 11}, {12, 11, 11, 11}, }, { {11, 11, 11, 12}, {12, 11, 12, 11}, {11, 12, 11, 11}, {12, 11, 12, 11}, }, { {11, 12, 11, 12}, {12, 11, 12, 12}, {11, 12, 11, 12}, {12, 12, 12, 11}, }, { {11, 12, 11, 12}, {12, 12, 12, 12}, {12, 12, 11, 12}, {12, 12, 12, 12}, }, { {12, 12, 12, 12}, {12, 12, 12, 12}, {12, 12, 12, 12}, {13, 12, 12, 12}, }, { {12, 12, 12, 12}, {13, 12, 13, 12}, {12, 13, 12, 12}, {13, 12, 13, 12}, }, { {12, 13, 12, 13}, {13, 12, 13, 12}, {12, 13, 12, 13}, {13, 13, 13, 12}, }, { {12, 13, 12, 13}, {13, 13, 13, 13}, {13, 13, 12, 13}, {13, 13, 13, 13}, }, { {13, 13, 13, 13}, {13, 13, 13, 13}, {13, 13, 13, 13}, {14, 13, 13, 13}, }, { {13, 13, 13, 13}, {14, 13, 14, 13}, {13, 14, 13, 13}, {14, 13, 14, 13}, }, { {13, 14, 13, 14}, {14, 13, 14, 13}, {13, 14, 13, 14}, {14, 14, 14, 13}, }, { {13, 14, 13, 14}, {14, 14, 14, 14}, {14, 14, 13, 14}, {14, 14, 14, 14}, }, { {14, 14, 14, 14}, {14, 14, 14, 14}, {14, 14, 14, 14}, {15, 14, 14, 14}, }, { {14, 14, 14, 14}, {15, 14, 15, 14}, {14, 15, 14, 14}, {15, 14, 15, 14}, }, { {14, 15, 14, 15}, {15, 14, 15, 14}, {14, 15, 14, 15}, {15, 15, 15, 14}, }, { {14, 15, 14, 15}, {15, 15, 15, 15}, {15, 15, 14, 15}, {15, 15, 15, 15}, }, { {15, 15, 15, 15}, {15, 15, 15, 15}, {15, 15, 15, 15}, {16, 15, 15, 15}, }, { {15, 15, 15, 15}, {16, 15, 16, 15}, {15, 16, 15, 15}, {16, 15, 16, 15}, }, { {15, 16, 15, 16}, {16, 15, 16, 15}, {15, 16, 15, 16}, {16, 16, 16, 15}, }, { {15, 16, 15, 16}, {16, 16, 16, 16}, {16, 16, 15, 16}, {16, 16, 16, 16}, }, { {16, 16, 16, 16}, {16, 16, 16, 16}, {16, 16, 16, 16}, {17, 16, 16, 16}, }, { {16, 16, 16, 16}, {17, 16, 17, 16}, {16, 17, 16, 16}, {17, 16, 17, 16}, }, { {16, 17, 16, 17}, {17, 16, 17, 16}, {16, 17, 16, 17}, {17, 17, 17, 16}, }, { {16, 17, 16, 17}, {17, 17, 17, 17}, {17, 17, 16, 17}, {17, 17, 17, 17}, }, { {17, 17, 17, 17}, {17, 17, 17, 17}, {17, 17, 17, 17}, {18, 17, 17, 17}, }, { {17, 17, 17, 17}, {18, 17, 18, 17}, {17, 18, 17, 17}, {18, 17, 18, 17}, }, { {17, 18, 17, 18}, {18, 17, 18, 17}, {17, 18, 17, 18}, {18, 18, 18, 17}, }, { {17, 18, 17, 18}, {18, 18, 18, 18}, {18, 18, 17, 18}, {18, 18, 18, 18}, }, { {18, 18, 18, 18}, {18, 18, 18, 18}, {18, 18, 18, 18}, {19, 18, 18, 18}, }, { {18, 18, 18, 18}, {19, 18, 19, 18}, {18, 19, 18, 18}, {19, 18, 19, 18}, }, { {18, 19, 18, 19}, {19, 18, 19, 18}, {18, 19, 18, 19}, {19, 19, 19, 18}, }, { {18, 19, 18, 19}, {19, 19, 19, 19}, {19, 19, 18, 19}, {19, 19, 19, 19}, }, { {19, 19, 19, 19}, {19, 19, 19, 19}, {19, 19, 19, 19}, {20, 19, 19, 19}, }, { {19, 19, 19, 19}, {20, 19, 20, 19}, {19, 20, 19, 19}, {20, 19, 20, 19}, }, { {19, 20, 19, 20}, {20, 19, 20, 19}, {19, 20, 19, 20}, {20, 20, 20, 19}, }, { {19, 20, 19, 20}, {20, 20, 20, 20}, {19, 20, 19, 20}, {20, 20, 20, 20}, }, { {20, 20, 20, 20}, {20, 20, 20, 20}, {20, 20, 20, 20}, {20, 20, 20, 20}, }, { {20, 20, 20, 20}, {21, 20, 21, 20}, {20, 20, 20, 20}, {21, 20, 21, 20}, }, { {20, 21, 20, 21}, {21, 20, 21, 20}, {20, 21, 20, 21}, {21, 20, 21, 20}, }, { {20, 21, 20, 21}, {21, 21, 21, 21}, {20, 21, 20, 21}, {21, 21, 21, 21}, }, { {21, 21, 21, 21}, {21, 21, 21, 21}, {21, 21, 21, 21}, {21, 21, 21, 21}, }, { {21, 21, 21, 21}, {22, 21, 22, 21}, {21, 21, 21, 21}, {22, 21, 22, 21}, }, { {21, 22, 21, 22}, {22, 21, 22, 21}, {21, 22, 21, 22}, {22, 21, 22, 21}, }, { {21, 22, 21, 22}, {22, 22, 22, 22}, {21, 22, 21, 22}, {22, 22, 22, 22}, }, { {22, 22, 22, 22}, {22, 22, 22, 22}, {22, 22, 22, 22}, {22, 22, 22, 22}, }, { {22, 22, 22, 22}, {23, 22, 23, 22}, {22, 22, 22, 22}, {23, 22, 23, 22}, }, { {22, 23, 22, 23}, {23, 22, 23, 22}, {22, 23, 22, 23}, {23, 22, 23, 22}, }, { {22, 23, 22, 23}, {23, 23, 23, 23}, {22, 23, 22, 23}, {23, 23, 23, 23}, }, { {23, 23, 23, 23}, {23, 23, 23, 23}, {23, 23, 23, 23}, {23, 23, 23, 23}, }, { {23, 23, 23, 23}, {24, 23, 24, 23}, {23, 23, 23, 23}, {24, 23, 24, 23}, }, { {23, 24, 23, 24}, {24, 23, 24, 23}, {23, 24, 23, 24}, {24, 23, 24, 23}, }, { {23, 24, 23, 24}, {24, 23, 24, 24}, {23, 24, 23, 24}, {24, 24, 24, 24}, }, { {23, 24, 24, 24}, {24, 24, 24, 24}, {24, 24, 24, 24}, {24, 24, 24, 24}, }, { {24, 24, 24, 24}, {24, 24, 25, 24}, {24, 24, 24, 24}, {25, 24, 25, 24}, }, { {24, 24, 24, 25}, {25, 24, 25, 24}, {24, 25, 24, 25}, {25, 24, 25, 24}, }, { {24, 25, 24, 25}, {25, 24, 25, 25}, {24, 25, 24, 25}, {25, 25, 25, 25}, }, { {24, 25, 25, 25}, {25, 25, 25, 25}, {25, 25, 25, 25}, {25, 25, 25, 25}, }, { {25, 25, 25, 25}, {25, 25, 26, 25}, {25, 25, 25, 25}, {26, 25, 26, 25}, }, { {25, 25, 25, 26}, {26, 25, 26, 25}, {25, 26, 25, 26}, {26, 25, 26, 25}, }, { {25, 26, 25, 26}, {26, 25, 26, 26}, {25, 26, 25, 26}, {26, 26, 26, 26}, }, { {25, 26, 26, 26}, {26, 26, 26, 26}, {26, 26, 26, 26}, {26, 26, 26, 26}, }, { {26, 26, 26, 26}, {26, 26, 27, 26}, {26, 26, 26, 26}, {27, 26, 27, 26}, }, { {26, 26, 26, 27}, {27, 26, 27, 26}, {26, 27, 26, 27}, {27, 26, 27, 26}, }, { {26, 27, 26, 27}, {27, 26, 27, 27}, {26, 27, 26, 27}, {27, 27, 27, 27}, }, { {26, 27, 27, 27}, {27, 27, 27, 27}, {27, 27, 27, 27}, {27, 27, 27, 27}, }, { {27, 27, 27, 27}, {27, 27, 28, 27}, {27, 27, 27, 27}, {28, 27, 28, 27}, }, { {27, 27, 27, 28}, {28, 27, 28, 27}, {27, 28, 27, 28}, {28, 27, 28, 27}, }, { {27, 28, 27, 28}, {28, 27, 28, 28}, {27, 28, 27, 28}, {28, 28, 28, 27}, }, { {27, 28, 28, 28}, {28, 28, 28, 28}, {28, 28, 27, 28}, {28, 28, 28, 28}, }, { {28, 28, 28, 28}, {28, 28, 29, 28}, {28, 28, 28, 28}, {29, 28, 28, 28}, }, { {28, 28, 28, 29}, {29, 28, 29, 28}, {28, 29, 28, 28}, {29, 28, 29, 28}, }, { {28, 29, 28, 29}, {29, 28, 29, 29}, {28, 29, 28, 29}, {29, 29, 29, 28}, }, { {28, 29, 29, 29}, {29, 29, 29, 29}, {29, 29, 28, 29}, {29, 29, 29, 29}, }, { {29, 29, 29, 29}, {29, 29, 30, 29}, {29, 29, 29, 29}, {30, 29, 29, 29}, }, { {29, 29, 29, 30}, {30, 29, 30, 29}, {29, 30, 29, 29}, {30, 29, 30, 29}, }, { {29, 30, 29, 30}, {30, 29, 30, 30}, {29, 30, 29, 30}, {30, 30, 30, 29}, }, { {29, 30, 30, 30}, {30, 30, 30, 30}, {30, 30, 29, 30}, {30, 30, 30, 30}, }, { {30, 30, 30, 30}, {30, 30, 31, 30}, {30, 30, 30, 30}, {31, 30, 30, 30}, }, { {30, 30, 30, 31}, {31, 30, 31, 30}, {30, 31, 30, 30}, {31, 30, 31, 30}, }, { {30, 31, 30, 31}, {31, 30, 31, 31}, {30, 31, 30, 31}, {31, 31, 31, 30}, }, { {30, 31, 31, 31}, {31, 31, 31, 31}, {31, 31, 30, 31}, {31, 31, 31, 31}, }, { {31, 31, 31, 31}, {31, 31, 32, 31}, {31, 31, 31, 31}, {32, 31, 31, 31}, }, { {31, 31, 31, 32}, {32, 31, 32, 31}, {31, 32, 31, 31}, {32, 31, 32, 31}, }, { {31, 32, 31, 32}, {32, 31, 32, 32}, {31, 32, 31, 32}, {32, 32, 32, 31}, }, { {31, 32, 32, 32}, {32, 32, 32, 32}, {32, 32, 31, 32}, {32, 32, 32, 32}, }, { {32, 32, 32, 32}, {32, 32, 33, 32}, {32, 32, 32, 32}, {33, 32, 32, 32}, }, { {32, 32, 32, 33}, {33, 32, 33, 32}, {32, 33, 32, 32}, {33, 32, 33, 32}, }, { {32, 33, 32, 33}, {33, 32, 33, 33}, {32, 33, 32, 33}, {33, 33, 33, 32}, }, { {32, 33, 33, 33}, {33, 33, 33, 33}, {33, 33, 32, 33}, {33, 33, 33, 33}, }, { {33, 33, 33, 33}, {33, 33, 34, 33}, {33, 33, 33, 33}, {34, 33, 33, 33}, }, { {33, 33, 33, 34}, {34, 33, 34, 33}, {33, 34, 33, 33}, {34, 33, 34, 33}, }, { {33, 34, 33, 34}, {34, 33, 34, 34}, {33, 34, 33, 34}, {34, 34, 34, 33}, }, { {33, 34, 34, 34}, {34, 34, 34, 34}, {34, 34, 33, 34}, {34, 34, 34, 34}, }, { {34, 34, 34, 34}, {34, 34, 35, 34}, {34, 34, 34, 34}, {35, 34, 34, 34}, }, { {34, 34, 34, 35}, {35, 34, 35, 34}, {34, 35, 34, 34}, {35, 34, 35, 34}, }, { {34, 35, 34, 35}, {35, 34, 35, 35}, {34, 35, 34, 35}, {35, 35, 35, 34}, }, { {34, 35, 35, 35}, {35, 35, 35, 35}, {35, 35, 34, 35}, {35, 35, 35, 35}, }, { {35, 35, 35, 35}, {35, 35, 36, 35}, {35, 35, 35, 35}, {36, 35, 35, 35}, }, { {35, 35, 35, 36}, {36, 35, 36, 35}, {35, 36, 35, 35}, {36, 35, 36, 35}, }, { {35, 36, 35, 36}, {36, 35, 36, 35}, {35, 36, 35, 36}, {36, 36, 36, 35}, }, { {35, 36, 35, 36}, {36, 36, 36, 36}, {36, 36, 35, 36}, {36, 36, 36, 36}, }, { {36, 36, 36, 36}, {36, 36, 36, 36}, {36, 36, 36, 36}, {37, 36, 36, 36}, }, { {36, 36, 36, 36}, {37, 36, 37, 36}, {36, 37, 36, 36}, {37, 36, 37, 36}, }, { {36, 37, 36, 37}, {37, 36, 37, 36}, {36, 37, 36, 37}, {37, 37, 37, 36}, }, { {36, 37, 36, 37}, {37, 37, 37, 37}, {37, 37, 36, 37}, {37, 37, 37, 37}, }, { {37, 37, 37, 37}, {37, 37, 37, 37}, {37, 37, 37, 37}, {38, 37, 37, 37}, }, { {37, 37, 37, 37}, {38, 37, 38, 37}, {37, 38, 37, 37}, {38, 37, 38, 37}, }, { {37, 38, 37, 38}, {38, 37, 38, 37}, {37, 38, 37, 38}, {38, 38, 38, 37}, }, { {37, 38, 37, 38}, {38, 38, 38, 38}, {38, 38, 37, 38}, {38, 38, 38, 38}, }, { {38, 38, 38, 38}, {38, 38, 38, 38}, {38, 38, 38, 38}, {39, 38, 38, 38}, }, { {38, 38, 38, 38}, {39, 38, 39, 38}, {38, 39, 38, 38}, {39, 38, 39, 38}, }, { {38, 39, 38, 39}, {39, 38, 39, 38}, {38, 39, 38, 39}, {39, 39, 39, 38}, }, { {38, 39, 38, 39}, {39, 39, 39, 39}, {39, 39, 38, 39}, {39, 39, 39, 39}, }, { {39, 39, 39, 39}, {39, 39, 39, 39}, {39, 39, 39, 39}, {40, 39, 39, 39}, }, { {39, 39, 39, 39}, {40, 39, 40, 39}, {39, 40, 39, 39}, {40, 39, 40, 39}, }, { {39, 40, 39, 40}, {40, 39, 40, 39}, {39, 40, 39, 40}, {40, 39, 40, 39}, }, { {39, 40, 39, 40}, {40, 40, 40, 40}, {39, 40, 39, 40}, {40, 40, 40, 40}, }, { {40, 40, 40, 40}, {40, 40, 40, 40}, {40, 40, 40, 40}, {40, 40, 40, 40}, }, { {40, 40, 40, 40}, {41, 40, 41, 40}, {40, 40, 40, 40}, {41, 40, 41, 40}, }, { {40, 41, 40, 41}, {41, 40, 41, 40}, {40, 41, 40, 41}, {41, 40, 41, 40}, }, { {40, 41, 40, 41}, {41, 41, 41, 41}, {40, 41, 40, 41}, {41, 41, 41, 41}, }, { {41, 41, 41, 41}, {41, 41, 41, 41}, {41, 41, 41, 41}, {41, 41, 41, 41}, }, { {41, 41, 41, 41}, {42, 41, 42, 41}, {41, 41, 41, 41}, {42, 41, 42, 41}, }, { {41, 42, 41, 42}, {42, 41, 42, 41}, {41, 42, 41, 42}, {42, 41, 42, 41}, }, { {41, 42, 41, 42}, {42, 42, 42, 42}, {41, 42, 41, 42}, {42, 42, 42, 42}, }, { {42, 42, 42, 42}, {42, 42, 42, 42}, {42, 42, 42, 42}, {42, 42, 42, 42}, }, { {42, 42, 42, 42}, {43, 42, 43, 42}, {42, 42, 42, 42}, {43, 42, 43, 42}, }, { {42, 43, 42, 43}, {43, 42, 43, 42}, {42, 43, 42, 43}, {43, 42, 43, 42}, }, { {42, 43, 42, 43}, {43, 43, 43, 43}, {42, 43, 42, 43}, {43, 43, 43, 43}, }, { {43, 43, 43, 43}, {43, 43, 43, 43}, {43, 43, 43, 43}, {43, 43, 43, 43}, }, { {43, 43, 43, 43}, {44, 43, 44, 43}, {43, 43, 43, 43}, {44, 43, 44, 43}, }, { {43, 43, 43, 44}, {44, 43, 44, 43}, {43, 44, 43, 44}, {44, 43, 44, 43}, }, { {43, 44, 43, 44}, {44, 43, 44, 44}, {43, 44, 43, 44}, {44, 44, 44, 44}, }, { {43, 44, 44, 44}, {44, 44, 44, 44}, {44, 44, 44, 44}, {44, 44, 44, 44}, }, { {44, 44, 44, 44}, {44, 44, 45, 44}, {44, 44, 44, 44}, {45, 44, 45, 44}, }, { {44, 44, 44, 45}, {45, 44, 45, 44}, {44, 45, 44, 45}, {45, 44, 45, 44}, }, { {44, 45, 44, 45}, {45, 44, 45, 45}, {44, 45, 44, 45}, {45, 45, 45, 45}, }, { {44, 45, 45, 45}, {45, 45, 45, 45}, {45, 45, 45, 45}, {45, 45, 45, 45}, }, { {45, 45, 45, 45}, {45, 45, 46, 45}, {45, 45, 45, 45}, {46, 45, 46, 45}, }, { {45, 45, 45, 46}, {46, 45, 46, 45}, {45, 46, 45, 46}, {46, 45, 46, 45}, }, { {45, 46, 45, 46}, {46, 45, 46, 46}, {45, 46, 45, 46}, {46, 46, 46, 46}, }, { {45, 46, 46, 46}, {46, 46, 46, 46}, {46, 46, 46, 46}, {46, 46, 46, 46}, }, { {46, 46, 46, 46}, {46, 46, 47, 46}, {46, 46, 46, 46}, {47, 46, 47, 46}, }, { {46, 46, 46, 47}, {47, 46, 47, 46}, {46, 47, 46, 47}, {47, 46, 47, 46}, }, { {46, 47, 46, 47}, {47, 46, 47, 47}, {46, 47, 46, 47}, {47, 47, 47, 47}, }, { {46, 47, 47, 47}, {47, 47, 47, 47}, {47, 47, 47, 47}, {47, 47, 47, 47}, }, { {47, 47, 47, 47}, {47, 47, 48, 47}, {47, 47, 47, 47}, {48, 47, 48, 47}, }, { {47, 47, 47, 48}, {48, 47, 48, 47}, {47, 48, 47, 48}, {48, 47, 48, 47}, }, { {47, 48, 47, 48}, {48, 47, 48, 48}, {47, 48, 47, 48}, {48, 48, 48, 48}, }, { {47, 48, 48, 48}, {48, 48, 48, 48}, {48, 48, 48, 48}, {48, 48, 48, 48}, }, { {48, 48, 48, 48}, {48, 48, 49, 48}, {48, 48, 48, 48}, {49, 48, 49, 48}, }, { {48, 48, 48, 49}, {49, 48, 49, 48}, {48, 49, 48, 49}, {49, 48, 49, 48}, }, { {48, 49, 48, 49}, {49, 48, 49, 49}, {48, 49, 48, 49}, {49, 49, 49, 49}, }, { {48, 49, 49, 49}, {49, 49, 49, 49}, {49, 49, 49, 49}, {49, 49, 49, 49}, }, { {49, 49, 49, 49}, {49, 49, 50, 49}, {49, 49, 49, 49}, {50, 49, 50, 49}, }, { {49, 49, 49, 50}, {50, 49, 50, 49}, {49, 50, 49, 50}, {50, 49, 50, 49}, }, { {49, 50, 49, 50}, {50, 49, 50, 50}, {49, 50, 49, 50}, {50, 50, 50, 50}, }, { {49, 50, 50, 50}, {50, 50, 50, 50}, {50, 50, 50, 50}, {50, 50, 50, 50}, }, { {50, 50, 50, 50}, {50, 50, 51, 50}, {50, 50, 50, 50}, {51, 50, 51, 50}, }, { {50, 50, 50, 51}, {51, 50, 51, 50}, {50, 51, 50, 51}, {51, 50, 51, 50}, }, { {50, 51, 50, 51}, {51, 50, 51, 51}, {50, 51, 50, 51}, {51, 51, 51, 51}, }, { {50, 51, 51, 51}, {51, 51, 51, 51}, {51, 51, 51, 51}, {51, 51, 51, 51}, }, { {51, 51, 51, 51}, {51, 51, 52, 51}, {51, 51, 51, 51}, {52, 51, 52, 51}, }, { {51, 51, 51, 52}, {52, 51, 52, 51}, {51, 52, 51, 51}, {52, 51, 52, 51}, }, { {51, 52, 51, 52}, {52, 51, 52, 52}, {51, 52, 51, 52}, {52, 52, 52, 51}, }, { {51, 52, 52, 52}, {52, 52, 52, 52}, {52, 52, 51, 52}, {52, 52, 52, 52}, }, { {52, 52, 52, 52}, {52, 52, 53, 52}, {52, 52, 52, 52}, {53, 52, 52, 52}, }, { {52, 52, 52, 53}, {53, 52, 53, 52}, {52, 53, 52, 52}, {53, 52, 53, 52}, }, { {52, 53, 52, 53}, {53, 52, 53, 53}, {52, 53, 52, 53}, {53, 53, 53, 52}, }, { {52, 53, 53, 53}, {53, 53, 53, 53}, {53, 53, 52, 53}, {53, 53, 53, 53}, }, { {53, 53, 53, 53}, {53, 53, 54, 53}, {53, 53, 53, 53}, {54, 53, 53, 53}, }, { {53, 53, 53, 54}, {54, 53, 54, 53}, {53, 54, 53, 53}, {54, 53, 54, 53}, }, { {53, 54, 53, 54}, {54, 53, 54, 54}, {53, 54, 53, 54}, {54, 54, 54, 53}, }, { {53, 54, 54, 54}, {54, 54, 54, 54}, {54, 54, 53, 54}, {54, 54, 54, 54}, }, { {54, 54, 54, 54}, {54, 54, 55, 54}, {54, 54, 54, 54}, {55, 54, 54, 54}, }, { {54, 54, 54, 55}, {55, 54, 55, 54}, {54, 55, 54, 54}, {55, 54, 55, 54}, }, { {54, 55, 54, 55}, {55, 54, 55, 55}, {54, 55, 54, 55}, {55, 55, 55, 54}, }, { {54, 55, 55, 55}, {55, 55, 55, 55}, {55, 55, 54, 55}, {55, 55, 55, 55}, }, { {55, 55, 55, 55}, {55, 55, 56, 55}, {55, 55, 55, 55}, {56, 55, 55, 55}, }, { {55, 55, 55, 55}, {56, 55, 56, 55}, {55, 56, 55, 55}, {56, 55, 56, 55}, }, { {55, 56, 55, 56}, {56, 55, 56, 55}, {55, 56, 55, 56}, {56, 56, 56, 55}, }, { {55, 56, 55, 56}, {56, 56, 56, 56}, {56, 56, 55, 56}, {56, 56, 56, 56}, }, { {56, 56, 56, 56}, {56, 56, 56, 56}, {56, 56, 56, 56}, {57, 56, 56, 56}, }, { {56, 56, 56, 56}, {57, 56, 57, 56}, {56, 57, 56, 56}, {57, 56, 57, 56}, }, { {56, 57, 56, 57}, {57, 56, 57, 56}, {56, 57, 56, 57}, {57, 57, 57, 56}, }, { {56, 57, 56, 57}, {57, 57, 57, 57}, {57, 57, 56, 57}, {57, 57, 57, 57}, }, { {57, 57, 57, 57}, {57, 57, 57, 57}, {57, 57, 57, 57}, {58, 57, 57, 57}, }, { {57, 57, 57, 57}, {58, 57, 58, 57}, {57, 58, 57, 57}, {58, 57, 58, 57}, }, { {57, 58, 57, 58}, {58, 57, 58, 57}, {57, 58, 57, 58}, {58, 58, 58, 57}, }, { {57, 58, 57, 58}, {58, 58, 58, 58}, {58, 58, 57, 58}, {58, 58, 58, 58}, }, { {58, 58, 58, 58}, {58, 58, 58, 58}, {58, 58, 58, 58}, {59, 58, 58, 58}, }, { {58, 58, 58, 58}, {59, 58, 59, 58}, {58, 59, 58, 58}, {59, 58, 59, 58}, }, { {58, 59, 58, 59}, {59, 58, 59, 58}, {58, 59, 58, 59}, {59, 59, 59, 58}, }, { {58, 59, 58, 59}, {59, 59, 59, 59}, {59, 59, 58, 59}, {59, 59, 59, 59}, }, { {59, 59, 59, 59}, {59, 59, 59, 59}, {59, 59, 59, 59}, {60, 59, 59, 59}, }, { {59, 59, 59, 59}, {60, 59, 60, 59}, {59, 59, 59, 59}, {60, 59, 60, 59}, }, { {59, 60, 59, 60}, {60, 59, 60, 59}, {59, 60, 59, 60}, {60, 59, 60, 59}, }, { {59, 60, 59, 60}, {60, 60, 60, 60}, {59, 60, 59, 60}, {60, 60, 60, 60}, }, { {60, 60, 60, 60}, {60, 60, 60, 60}, {60, 60, 60, 60}, {60, 60, 60, 60}, }, { {60, 60, 60, 60}, {61, 60, 61, 60}, {60, 60, 60, 60}, {61, 60, 61, 60}, }, { {60, 61, 60, 61}, {61, 60, 61, 60}, {60, 61, 60, 61}, {61, 60, 61, 60}, }, { {60, 61, 60, 61}, {61, 61, 61, 61}, {60, 61, 60, 61}, {61, 61, 61, 61}, }, { {61, 61, 61, 61}, {61, 61, 61, 61}, {61, 61, 61, 61}, {61, 61, 61, 61}, }, { {61, 61, 61, 61}, {62, 61, 62, 61}, {61, 61, 61, 61}, {62, 61, 62, 61}, }, { {61, 62, 61, 62}, {62, 61, 62, 61}, {61, 62, 61, 62}, {62, 61, 62, 61}, }, { {61, 62, 61, 62}, {62, 62, 62, 62}, {61, 62, 61, 62}, {62, 62, 62, 62}, }, { {62, 62, 62, 62}, {62, 62, 62, 62}, {62, 62, 62, 62}, {62, 62, 62, 62}, }, { {62, 62, 62, 62}, {63, 62, 63, 62}, {62, 62, 62, 62}, {63, 62, 63, 62}, }, { {62, 63, 62, 63}, {63, 62, 63, 62}, {62, 63, 62, 63}, {63, 62, 63, 62}, }, { {62, 63, 62, 63}, {63, 63, 63, 63}, {62, 63, 62, 63}, {63, 63, 63, 63}, }, { {63, 63, 63, 63}, {63, 63, 63, 63}, {63, 63, 63, 63}, {63, 63, 63, 63}, }, }; static const uint8_t dither_rb2x2[256][2][2] = { { {0, 0}, {0, 0}, }, { {0, 0}, {1, 0}, }, { {0, 0}, {1, 0}, }, { {0, 1}, {1, 0}, }, { {0, 1}, {1, 0}, }, { {0, 1}, {1, 1}, }, { {0, 1}, {1, 1}, }, { {1, 1}, {1, 1}, }, { {1, 1}, {1, 1}, }, { {1, 1}, {2, 1}, }, { {1, 1}, {2, 1}, }, { {1, 2}, {2, 1}, }, { {1, 2}, {2, 1}, }, { {1, 2}, {2, 2}, }, { {1, 2}, {2, 2}, }, { {2, 2}, {2, 2}, }, { {2, 2}, {2, 2}, }, { {2, 2}, {2, 2}, }, { {2, 2}, {3, 2}, }, { {2, 2}, {3, 2}, }, { {2, 3}, {3, 2}, }, { {2, 3}, {3, 2}, }, { {2, 3}, {3, 3}, }, { {2, 3}, {3, 3}, }, { {3, 3}, {3, 3}, }, { {3, 3}, {3, 3}, }, { {3, 3}, {4, 3}, }, { {3, 3}, {4, 3}, }, { {3, 4}, {4, 3}, }, { {3, 4}, {4, 3}, }, { {3, 4}, {4, 4}, }, { {3, 4}, {4, 4}, }, { {4, 4}, {4, 4}, }, { {4, 4}, {4, 4}, }, { {4, 4}, {5, 4}, }, { {4, 4}, {5, 4}, }, { {4, 5}, {5, 4}, }, { {4, 5}, {5, 4}, }, { {4, 5}, {5, 5}, }, { {4, 5}, {5, 5}, }, { {5, 5}, {5, 5}, }, { {5, 5}, {5, 5}, }, { {5, 5}, {6, 5}, }, { {5, 5}, {6, 5}, }, { {5, 6}, {6, 5}, }, { {5, 6}, {6, 5}, }, { {5, 6}, {6, 6}, }, { {5, 6}, {6, 6}, }, { {5, 6}, {6, 6}, }, { {6, 6}, {6, 6}, }, { {6, 6}, {6, 6}, }, { {6, 6}, {7, 6}, }, { {6, 6}, {7, 6}, }, { {6, 7}, {7, 6}, }, { {6, 7}, {7, 6}, }, { {6, 7}, {7, 7}, }, { {6, 7}, {7, 7}, }, { {7, 7}, {7, 7}, }, { {7, 7}, {7, 7}, }, { {7, 7}, {8, 7}, }, { {7, 7}, {8, 7}, }, { {7, 8}, {8, 7}, }, { {7, 8}, {8, 7}, }, { {7, 8}, {8, 8}, }, { {7, 8}, {8, 8}, }, { {8, 8}, {8, 8}, }, { {8, 8}, {8, 8}, }, { {8, 8}, {9, 8}, }, { {8, 8}, {9, 8}, }, { {8, 9}, {9, 8}, }, { {8, 9}, {9, 8}, }, { {8, 9}, {9, 9}, }, { {8, 9}, {9, 9}, }, { {9, 9}, {9, 9}, }, { {9, 9}, {9, 9}, }, { {9, 9}, {10, 9}, }, { {9, 9}, {10, 9}, }, { {9, 10}, {10, 9}, }, { {9, 10}, {10, 9}, }, { {9, 10}, {10, 10}, }, { {9, 10}, {10, 10}, }, { {9, 10}, {10, 10}, }, { {10, 10}, {10, 10}, }, { {10, 10}, {10, 10}, }, { {10, 10}, {11, 10}, }, { {10, 10}, {11, 10}, }, { {10, 11}, {11, 10}, }, { {10, 11}, {11, 10}, }, { {10, 11}, {11, 11}, }, { {10, 11}, {11, 11}, }, { {11, 11}, {11, 11}, }, { {11, 11}, {11, 11}, }, { {11, 11}, {12, 11}, }, { {11, 11}, {12, 11}, }, { {11, 12}, {12, 11}, }, { {11, 12}, {12, 11}, }, { {11, 12}, {12, 12}, }, { {11, 12}, {12, 12}, }, { {12, 12}, {12, 12}, }, { {12, 12}, {12, 12}, }, { {12, 12}, {13, 12}, }, { {12, 12}, {13, 12}, }, { {12, 13}, {13, 12}, }, { {12, 13}, {13, 12}, }, { {12, 13}, {13, 13}, }, { {12, 13}, {13, 13}, }, { {13, 13}, {13, 13}, }, { {13, 13}, {13, 13}, }, { {13, 13}, {14, 13}, }, { {13, 13}, {14, 13}, }, { {13, 14}, {14, 13}, }, { {13, 14}, {14, 13}, }, { {13, 14}, {14, 13}, }, { {13, 14}, {14, 14}, }, { {13, 14}, {14, 14}, }, { {14, 14}, {14, 14}, }, { {14, 14}, {14, 14}, }, { {14, 14}, {15, 14}, }, { {14, 14}, {15, 14}, }, { {14, 15}, {15, 14}, }, { {14, 15}, {15, 14}, }, { {14, 15}, {15, 15}, }, { {14, 15}, {15, 15}, }, { {15, 15}, {15, 15}, }, { {15, 15}, {15, 15}, }, { {15, 15}, {16, 15}, }, { {15, 15}, {16, 15}, }, { {15, 16}, {16, 15}, }, { {15, 16}, {16, 15}, }, { {15, 16}, {16, 16}, }, { {15, 16}, {16, 16}, }, { {16, 16}, {16, 16}, }, { {16, 16}, {16, 16}, }, { {16, 16}, {17, 16}, }, { {16, 16}, {17, 16}, }, { {16, 17}, {17, 16}, }, { {16, 17}, {17, 16}, }, { {16, 17}, {17, 17}, }, { {16, 17}, {17, 17}, }, { {17, 17}, {17, 17}, }, { {17, 17}, {17, 17}, }, { {17, 17}, {18, 17}, }, { {17, 17}, {18, 17}, }, { {17, 18}, {18, 17}, }, { {17, 18}, {18, 17}, }, { {17, 18}, {18, 18}, }, { {17, 18}, {18, 18}, }, { {18, 18}, {18, 18}, }, { {18, 18}, {18, 18}, }, { {18, 18}, {19, 18}, }, { {18, 18}, {19, 18}, }, { {18, 19}, {19, 18}, }, { {18, 19}, {19, 18}, }, { {18, 19}, {19, 19}, }, { {18, 19}, {19, 19}, }, { {19, 19}, {19, 19}, }, { {19, 19}, {19, 19}, }, { {19, 19}, {20, 19}, }, { {19, 19}, {20, 19}, }, { {19, 20}, {20, 19}, }, { {19, 20}, {20, 19}, }, { {19, 20}, {20, 19}, }, { {19, 20}, {20, 20}, }, { {19, 20}, {20, 20}, }, { {20, 20}, {20, 20}, }, { {20, 20}, {20, 20}, }, { {20, 20}, {21, 20}, }, { {20, 20}, {21, 20}, }, { {20, 21}, {21, 20}, }, { {20, 21}, {21, 20}, }, { {20, 21}, {21, 21}, }, { {20, 21}, {21, 21}, }, { {21, 21}, {21, 21}, }, { {21, 21}, {21, 21}, }, { {21, 21}, {22, 21}, }, { {21, 21}, {22, 21}, }, { {21, 22}, {22, 21}, }, { {21, 22}, {22, 21}, }, { {21, 22}, {22, 22}, }, { {21, 22}, {22, 22}, }, { {22, 22}, {22, 22}, }, { {22, 22}, {22, 22}, }, { {22, 22}, {23, 22}, }, { {22, 22}, {23, 22}, }, { {22, 23}, {23, 22}, }, { {22, 23}, {23, 22}, }, { {22, 23}, {23, 23}, }, { {22, 23}, {23, 23}, }, { {23, 23}, {23, 23}, }, { {23, 23}, {23, 23}, }, { {23, 23}, {24, 23}, }, { {23, 23}, {24, 23}, }, { {23, 23}, {24, 23}, }, { {23, 24}, {24, 23}, }, { {23, 24}, {24, 23}, }, { {23, 24}, {24, 24}, }, { {23, 24}, {24, 24}, }, { {24, 24}, {24, 24}, }, { {24, 24}, {24, 24}, }, { {24, 24}, {25, 24}, }, { {24, 24}, {25, 24}, }, { {24, 25}, {25, 24}, }, { {24, 25}, {25, 24}, }, { {24, 25}, {25, 25}, }, { {24, 25}, {25, 25}, }, { {25, 25}, {25, 25}, }, { {25, 25}, {25, 25}, }, { {25, 25}, {26, 25}, }, { {25, 25}, {26, 25}, }, { {25, 26}, {26, 25}, }, { {25, 26}, {26, 25}, }, { {25, 26}, {26, 26}, }, { {25, 26}, {26, 26}, }, { {26, 26}, {26, 26}, }, { {26, 26}, {26, 26}, }, { {26, 26}, {27, 26}, }, { {26, 26}, {27, 26}, }, { {26, 27}, {27, 26}, }, { {26, 27}, {27, 26}, }, { {26, 27}, {27, 27}, }, { {26, 27}, {27, 27}, }, { {27, 27}, {27, 27}, }, { {27, 27}, {27, 27}, }, { {27, 27}, {28, 27}, }, { {27, 27}, {28, 27}, }, { {27, 27}, {28, 27}, }, { {27, 28}, {28, 27}, }, { {27, 28}, {28, 27}, }, { {27, 28}, {28, 28}, }, { {27, 28}, {28, 28}, }, { {28, 28}, {28, 28}, }, { {28, 28}, {28, 28}, }, { {28, 28}, {29, 28}, }, { {28, 28}, {29, 28}, }, { {28, 29}, {29, 28}, }, { {28, 29}, {29, 28}, }, { {28, 29}, {29, 29}, }, { {28, 29}, {29, 29}, }, { {29, 29}, {29, 29}, }, { {29, 29}, {29, 29}, }, { {29, 29}, {30, 29}, }, { {29, 29}, {30, 29}, }, { {29, 30}, {30, 29}, }, { {29, 30}, {30, 29}, }, { {29, 30}, {30, 30}, }, { {29, 30}, {30, 30}, }, { {30, 30}, {30, 30}, }, { {30, 30}, {30, 30}, }, { {30, 30}, {31, 30}, }, { {30, 30}, {31, 30}, }, { {30, 31}, {31, 30}, }, { {30, 31}, {31, 30}, }, { {30, 31}, {31, 31}, }, { {30, 31}, {31, 31}, }, { {31, 31}, {31, 31}, }, { {31, 31}, {31, 31}, }, }; static const uint8_t dither_g2x2[256][2][2] = { { {0, 0}, {0, 0}, }, { {0, 0}, {1, 0}, }, { {0, 1}, {1, 0}, }, { {0, 1}, {1, 1}, }, { {1, 1}, {1, 1}, }, { {1, 1}, {2, 1}, }, { {1, 2}, {2, 1}, }, { {1, 2}, {2, 2}, }, { {2, 2}, {2, 2}, }, { {2, 2}, {3, 2}, }, { {2, 3}, {3, 2}, }, { {2, 3}, {3, 3}, }, { {3, 3}, {3, 3}, }, { {3, 3}, {4, 3}, }, { {3, 4}, {4, 3}, }, { {3, 4}, {4, 4}, }, { {4, 4}, {4, 4}, }, { {4, 4}, {5, 4}, }, { {4, 5}, {5, 4}, }, { {4, 5}, {5, 5}, }, { {5, 5}, {5, 5}, }, { {5, 5}, {6, 5}, }, { {5, 6}, {6, 5}, }, { {5, 6}, {6, 6}, }, { {6, 6}, {6, 6}, }, { {6, 6}, {7, 6}, }, { {6, 7}, {7, 6}, }, { {6, 7}, {7, 7}, }, { {7, 7}, {7, 7}, }, { {7, 7}, {8, 7}, }, { {7, 8}, {8, 7}, }, { {7, 8}, {8, 8}, }, { {8, 8}, {8, 8}, }, { {8, 8}, {9, 8}, }, { {8, 9}, {9, 8}, }, { {8, 9}, {9, 9}, }, { {9, 9}, {9, 9}, }, { {9, 9}, {10, 9}, }, { {9, 10}, {10, 9}, }, { {9, 10}, {10, 10}, }, { {10, 10}, {10, 10}, }, { {10, 10}, {11, 10}, }, { {10, 11}, {11, 10}, }, { {10, 11}, {11, 11}, }, { {11, 11}, {11, 11}, }, { {11, 11}, {12, 11}, }, { {11, 12}, {12, 11}, }, { {11, 12}, {12, 12}, }, { {11, 12}, {12, 12}, }, { {12, 12}, {12, 12}, }, { {12, 12}, {13, 12}, }, { {12, 13}, {13, 12}, }, { {12, 13}, {13, 13}, }, { {13, 13}, {13, 13}, }, { {13, 13}, {14, 13}, }, { {13, 14}, {14, 13}, }, { {13, 14}, {14, 14}, }, { {14, 14}, {14, 14}, }, { {14, 14}, {15, 14}, }, { {14, 15}, {15, 14}, }, { {14, 15}, {15, 15}, }, { {15, 15}, {15, 15}, }, { {15, 15}, {16, 15}, }, { {15, 16}, {16, 15}, }, { {15, 16}, {16, 16}, }, { {16, 16}, {16, 16}, }, { {16, 16}, {17, 16}, }, { {16, 17}, {17, 16}, }, { {16, 17}, {17, 17}, }, { {17, 17}, {17, 17}, }, { {17, 17}, {18, 17}, }, { {17, 18}, {18, 17}, }, { {17, 18}, {18, 18}, }, { {18, 18}, {18, 18}, }, { {18, 18}, {19, 18}, }, { {18, 19}, {19, 18}, }, { {18, 19}, {19, 19}, }, { {19, 19}, {19, 19}, }, { {19, 19}, {20, 19}, }, { {19, 20}, {20, 19}, }, { {19, 20}, {20, 20}, }, { {20, 20}, {20, 20}, }, { {20, 20}, {21, 20}, }, { {20, 21}, {21, 20}, }, { {20, 21}, {21, 21}, }, { {21, 21}, {21, 21}, }, { {21, 21}, {22, 21}, }, { {21, 22}, {22, 21}, }, { {21, 22}, {22, 22}, }, { {22, 22}, {22, 22}, }, { {22, 22}, {23, 22}, }, { {22, 23}, {23, 22}, }, { {22, 23}, {23, 23}, }, { {23, 23}, {23, 23}, }, { {23, 23}, {24, 23}, }, { {23, 24}, {24, 23}, }, { {23, 24}, {24, 24}, }, { {24, 24}, {24, 24}, }, { {24, 24}, {25, 24}, }, { {24, 25}, {25, 24}, }, { {24, 25}, {25, 25}, }, { {25, 25}, {25, 25}, }, { {25, 25}, {26, 25}, }, { {25, 26}, {26, 25}, }, { {25, 26}, {26, 26}, }, { {26, 26}, {26, 26}, }, { {26, 26}, {27, 26}, }, { {26, 27}, {27, 26}, }, { {26, 27}, {27, 27}, }, { {27, 27}, {27, 27}, }, { {27, 27}, {28, 27}, }, { {27, 28}, {28, 27}, }, { {27, 28}, {28, 28}, }, { {28, 28}, {28, 28}, }, { {28, 28}, {29, 28}, }, { {28, 29}, {29, 28}, }, { {28, 29}, {29, 29}, }, { {29, 29}, {29, 29}, }, { {29, 29}, {30, 29}, }, { {29, 30}, {30, 29}, }, { {29, 30}, {30, 30}, }, { {30, 30}, {30, 30}, }, { {30, 30}, {31, 30}, }, { {30, 31}, {31, 30}, }, { {30, 31}, {31, 31}, }, { {31, 31}, {31, 31}, }, { {31, 31}, {32, 31}, }, { {31, 32}, {32, 31}, }, { {31, 32}, {32, 32}, }, { {32, 32}, {32, 32}, }, { {32, 32}, {33, 32}, }, { {32, 33}, {33, 32}, }, { {32, 33}, {33, 33}, }, { {33, 33}, {33, 33}, }, { {33, 33}, {34, 33}, }, { {33, 34}, {34, 33}, }, { {33, 34}, {34, 34}, }, { {34, 34}, {34, 34}, }, { {34, 34}, {35, 34}, }, { {34, 35}, {35, 34}, }, { {34, 35}, {35, 35}, }, { {35, 35}, {35, 35}, }, { {35, 35}, {36, 35}, }, { {35, 36}, {36, 35}, }, { {35, 36}, {36, 35}, }, { {35, 36}, {36, 36}, }, { {36, 36}, {36, 36}, }, { {36, 36}, {37, 36}, }, { {36, 37}, {37, 36}, }, { {36, 37}, {37, 37}, }, { {37, 37}, {37, 37}, }, { {37, 37}, {38, 37}, }, { {37, 38}, {38, 37}, }, { {37, 38}, {38, 38}, }, { {38, 38}, {38, 38}, }, { {38, 38}, {39, 38}, }, { {38, 39}, {39, 38}, }, { {38, 39}, {39, 39}, }, { {39, 39}, {39, 39}, }, { {39, 39}, {40, 39}, }, { {39, 40}, {40, 39}, }, { {39, 40}, {40, 40}, }, { {40, 40}, {40, 40}, }, { {40, 40}, {41, 40}, }, { {40, 41}, {41, 40}, }, { {40, 41}, {41, 41}, }, { {41, 41}, {41, 41}, }, { {41, 41}, {42, 41}, }, { {41, 42}, {42, 41}, }, { {41, 42}, {42, 42}, }, { {42, 42}, {42, 42}, }, { {42, 42}, {43, 42}, }, { {42, 43}, {43, 42}, }, { {42, 43}, {43, 43}, }, { {43, 43}, {43, 43}, }, { {43, 43}, {44, 43}, }, { {43, 44}, {44, 43}, }, { {43, 44}, {44, 44}, }, { {44, 44}, {44, 44}, }, { {44, 44}, {45, 44}, }, { {44, 45}, {45, 44}, }, { {44, 45}, {45, 45}, }, { {45, 45}, {45, 45}, }, { {45, 45}, {46, 45}, }, { {45, 46}, {46, 45}, }, { {45, 46}, {46, 46}, }, { {46, 46}, {46, 46}, }, { {46, 46}, {47, 46}, }, { {46, 47}, {47, 46}, }, { {46, 47}, {47, 47}, }, { {47, 47}, {47, 47}, }, { {47, 47}, {48, 47}, }, { {47, 48}, {48, 47}, }, { {47, 48}, {48, 48}, }, { {48, 48}, {48, 48}, }, { {48, 48}, {49, 48}, }, { {48, 49}, {49, 48}, }, { {48, 49}, {49, 49}, }, { {49, 49}, {49, 49}, }, { {49, 49}, {50, 49}, }, { {49, 50}, {50, 49}, }, { {49, 50}, {50, 50}, }, { {50, 50}, {50, 50}, }, { {50, 50}, {51, 50}, }, { {50, 51}, {51, 50}, }, { {50, 51}, {51, 51}, }, { {51, 51}, {51, 51}, }, { {51, 51}, {52, 51}, }, { {51, 52}, {52, 51}, }, { {51, 52}, {52, 52}, }, { {52, 52}, {52, 52}, }, { {52, 52}, {53, 52}, }, { {52, 53}, {53, 52}, }, { {52, 53}, {53, 53}, }, { {53, 53}, {53, 53}, }, { {53, 53}, {54, 53}, }, { {53, 54}, {54, 53}, }, { {53, 54}, {54, 54}, }, { {54, 54}, {54, 54}, }, { {54, 54}, {55, 54}, }, { {54, 55}, {55, 54}, }, { {54, 55}, {55, 55}, }, { {55, 55}, {55, 55}, }, { {55, 55}, {56, 55}, }, { {55, 55}, {56, 55}, }, { {55, 56}, {56, 55}, }, { {55, 56}, {56, 56}, }, { {56, 56}, {56, 56}, }, { {56, 56}, {57, 56}, }, { {56, 57}, {57, 56}, }, { {56, 57}, {57, 57}, }, { {57, 57}, {57, 57}, }, { {57, 57}, {58, 57}, }, { {57, 58}, {58, 57}, }, { {57, 58}, {58, 58}, }, { {58, 58}, {58, 58}, }, { {58, 58}, {59, 58}, }, { {58, 59}, {59, 58}, }, { {58, 59}, {59, 59}, }, { {59, 59}, {59, 59}, }, { {59, 59}, {60, 59}, }, { {59, 60}, {60, 59}, }, { {59, 60}, {60, 60}, }, { {60, 60}, {60, 60}, }, { {60, 60}, {61, 60}, }, { {60, 61}, {61, 60}, }, { {60, 61}, {61, 61}, }, { {61, 61}, {61, 61}, }, { {61, 61}, {62, 61}, }, { {61, 62}, {62, 61}, }, { {61, 62}, {62, 62}, }, { {62, 62}, {62, 62}, }, { {62, 62}, {63, 62}, }, { {62, 63}, {63, 62}, }, { {62, 63}, {63, 63}, }, { {63, 63}, {63, 63}, }, }; /* Dither subtraction */ static const uint8_t dithersub_rb[256][4][4] = { { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {9, 5, 8, 4}, {3, 7, 2, 6}, {7, 3, 8, 4}, {1, 5, 2, 6}, }, { {10, 6, 9, 5}, {4, 8, 3, 7}, {8, 4, 9, 5}, {2, 6, 3, 7}, }, { {11, 7, 10, 6}, {5, 9, 4, 8}, {9, 5, 10, 6}, {3, 7, 4, 8}, }, { {12, 8, 11, 7}, {6, 10, 5, 9}, {10, 6, 11, 7}, {4, 8, 5, 9}, }, { {13, 9, 12, 8}, {7, 11, 6, 10}, {11, 7, 12, 8}, {5, 9, 6, 10}, }, { {14, 10, 13, 9}, {8, 12, 7, 11}, {12, 8, 13, 9}, {6, 10, 7, 11}, }, { {15, 11, 14, 10}, {9, 13, 8, 12}, {13, 9, 14, 10}, {7, 11, 8, 12}, }, { {16, 12, 15, 11}, {10, 14, 9, 13}, {14, 10, 15, 11}, {8, 12, 9, 13}, }, { {17, 13, 16, 12}, {11, 15, 10, 14}, {15, 11, 16, 12}, {9, 13, 10, 14}, }, { {18, 14, 17, 13}, {12, 16, 11, 15}, {16, 12, 17, 13}, {10, 14, 11, 15}, }, { {19, 15, 18, 14}, {13, 17, 12, 16}, {17, 13, 18, 14}, {11, 15, 12, 16}, }, { {20, 16, 19, 15}, {14, 18, 13, 17}, {18, 14, 19, 15}, {12, 16, 13, 17}, }, { {21, 17, 20, 16}, {15, 19, 14, 18}, {19, 15, 20, 16}, {13, 17, 14, 18}, }, { {22, 18, 21, 17}, {16, 20, 15, 19}, {20, 16, 21, 17}, {14, 18, 15, 19}, }, { {23, 19, 22, 18}, {17, 21, 16, 20}, {21, 17, 22, 18}, {15, 19, 16, 20}, }, { {24, 20, 23, 19}, {18, 22, 17, 21}, {22, 18, 23, 19}, {16, 20, 17, 21}, }, { {25, 21, 24, 20}, {19, 23, 18, 22}, {23, 19, 24, 20}, {17, 21, 18, 22}, }, { {26, 22, 25, 21}, {20, 24, 19, 23}, {24, 20, 25, 21}, {18, 22, 19, 23}, }, { {27, 23, 26, 22}, {21, 25, 20, 24}, {25, 21, 26, 22}, {19, 23, 20, 24}, }, { {28, 24, 27, 23}, {22, 26, 21, 25}, {26, 22, 27, 23}, {20, 24, 21, 25}, }, { {29, 25, 28, 24}, {23, 27, 22, 26}, {27, 23, 28, 24}, {21, 25, 22, 26}, }, { {30, 26, 29, 25}, {24, 28, 23, 27}, {28, 24, 29, 25}, {22, 26, 23, 27}, }, { {31, 27, 30, 26}, {25, 29, 24, 28}, {29, 25, 30, 26}, {23, 27, 24, 28}, }, { {32, 28, 31, 27}, {26, 30, 25, 29}, {30, 26, 31, 27}, {24, 28, 25, 29}, }, { {33, 29, 32, 28}, {27, 31, 26, 30}, {31, 27, 32, 28}, {25, 29, 26, 30}, }, { {34, 30, 33, 29}, {28, 32, 27, 31}, {32, 28, 33, 29}, {26, 30, 27, 31}, }, { {35, 31, 34, 30}, {29, 33, 28, 32}, {33, 29, 34, 30}, {27, 31, 28, 32}, }, { {36, 32, 35, 31}, {30, 34, 29, 33}, {34, 30, 35, 31}, {28, 32, 29, 33}, }, { {37, 33, 36, 32}, {31, 35, 30, 34}, {35, 31, 36, 32}, {29, 33, 30, 34}, }, { {38, 34, 37, 33}, {32, 36, 31, 35}, {36, 32, 37, 33}, {30, 34, 31, 35}, }, { {39, 35, 38, 34}, {33, 37, 32, 36}, {37, 33, 38, 34}, {31, 35, 32, 36}, }, { {40, 36, 39, 35}, {34, 38, 33, 37}, {38, 34, 39, 35}, {32, 36, 33, 37}, }, { {41, 37, 40, 36}, {35, 39, 34, 38}, {39, 35, 40, 36}, {33, 37, 34, 38}, }, { {42, 38, 41, 37}, {36, 40, 35, 39}, {40, 36, 41, 37}, {34, 38, 35, 39}, }, { {43, 39, 42, 38}, {37, 41, 36, 40}, {41, 37, 42, 38}, {35, 39, 36, 40}, }, { {44, 40, 43, 39}, {38, 42, 37, 41}, {42, 38, 43, 39}, {36, 40, 37, 41}, }, { {45, 41, 44, 40}, {39, 43, 38, 42}, {43, 39, 44, 40}, {37, 41, 38, 42}, }, { {46, 42, 45, 41}, {40, 44, 39, 43}, {44, 40, 45, 41}, {38, 42, 39, 43}, }, { {47, 43, 46, 42}, {41, 45, 40, 44}, {45, 41, 46, 42}, {39, 43, 40, 44}, }, { {48, 44, 47, 43}, {42, 46, 41, 45}, {46, 42, 47, 43}, {40, 44, 41, 45}, }, { {49, 45, 48, 44}, {43, 47, 42, 46}, {47, 43, 48, 44}, {41, 45, 42, 46}, }, { {50, 46, 49, 45}, {44, 48, 43, 47}, {48, 44, 49, 45}, {42, 46, 43, 47}, }, { {51, 47, 50, 46}, {45, 49, 44, 48}, {49, 45, 50, 46}, {43, 47, 44, 48}, }, { {52, 48, 51, 47}, {46, 50, 45, 49}, {50, 46, 51, 47}, {44, 48, 45, 49}, }, { {53, 49, 52, 48}, {47, 51, 46, 50}, {51, 47, 52, 48}, {45, 49, 46, 50}, }, { {54, 50, 53, 49}, {48, 52, 47, 51}, {52, 48, 53, 49}, {46, 50, 47, 51}, }, { {55, 51, 54, 50}, {49, 53, 48, 52}, {53, 49, 54, 50}, {47, 51, 48, 52}, }, { {56, 52, 55, 51}, {50, 54, 49, 53}, {54, 50, 55, 51}, {48, 52, 49, 53}, }, { {57, 53, 56, 52}, {51, 55, 50, 54}, {55, 51, 56, 52}, {49, 53, 50, 54}, }, { {58, 54, 57, 53}, {52, 56, 51, 55}, {56, 52, 57, 53}, {50, 54, 51, 55}, }, { {59, 55, 58, 54}, {53, 57, 52, 56}, {57, 53, 58, 54}, {51, 55, 52, 56}, }, { {60, 56, 59, 55}, {54, 58, 53, 57}, {58, 54, 59, 55}, {52, 56, 53, 57}, }, { {61, 57, 60, 56}, {55, 59, 54, 58}, {59, 55, 60, 56}, {53, 57, 54, 58}, }, { {62, 58, 61, 57}, {56, 60, 55, 59}, {60, 56, 61, 57}, {54, 58, 55, 59}, }, { {63, 59, 62, 58}, {57, 61, 56, 60}, {61, 57, 62, 58}, {55, 59, 56, 60}, }, { {64, 60, 63, 59}, {58, 62, 57, 61}, {62, 58, 63, 59}, {56, 60, 57, 61}, }, { {65, 61, 64, 60}, {59, 63, 58, 62}, {63, 59, 64, 60}, {57, 61, 58, 62}, }, { {66, 62, 65, 61}, {60, 64, 59, 63}, {64, 60, 65, 61}, {58, 62, 59, 63}, }, { {67, 63, 66, 62}, {61, 65, 60, 64}, {65, 61, 66, 62}, {59, 63, 60, 64}, }, { {68, 64, 67, 63}, {62, 66, 61, 65}, {66, 62, 67, 63}, {60, 64, 61, 65}, }, { {69, 65, 68, 64}, {63, 67, 62, 66}, {67, 63, 68, 64}, {61, 65, 62, 66}, }, { {70, 66, 69, 65}, {64, 68, 63, 67}, {68, 64, 69, 65}, {62, 66, 63, 67}, }, { {71, 67, 70, 66}, {65, 69, 64, 68}, {69, 65, 70, 66}, {63, 67, 64, 68}, }, { {72, 68, 71, 67}, {66, 70, 65, 69}, {70, 66, 71, 67}, {64, 68, 65, 69}, }, { {73, 69, 72, 68}, {67, 71, 66, 70}, {71, 67, 72, 68}, {65, 69, 66, 70}, }, { {74, 70, 73, 69}, {68, 72, 67, 71}, {72, 68, 73, 69}, {66, 70, 67, 71}, }, { {75, 71, 74, 70}, {69, 73, 68, 72}, {73, 69, 74, 70}, {67, 71, 68, 72}, }, { {76, 72, 75, 71}, {70, 74, 69, 73}, {74, 70, 75, 71}, {68, 72, 69, 73}, }, { {77, 73, 76, 72}, {71, 75, 70, 74}, {75, 71, 76, 72}, {69, 73, 70, 74}, }, { {78, 74, 77, 73}, {72, 76, 71, 75}, {76, 72, 77, 73}, {70, 74, 71, 75}, }, { {79, 75, 78, 74}, {73, 77, 72, 76}, {77, 73, 78, 74}, {71, 75, 72, 76}, }, { {80, 76, 79, 75}, {74, 78, 73, 77}, {78, 74, 79, 75}, {72, 76, 73, 77}, }, { {81, 77, 80, 76}, {75, 79, 74, 78}, {79, 75, 80, 76}, {73, 77, 74, 78}, }, { {82, 78, 81, 77}, {76, 80, 75, 79}, {80, 76, 81, 77}, {74, 78, 75, 79}, }, { {83, 79, 82, 78}, {77, 81, 76, 80}, {81, 77, 82, 78}, {75, 79, 76, 80}, }, { {84, 80, 83, 79}, {78, 82, 77, 81}, {82, 78, 83, 79}, {76, 80, 77, 81}, }, { {85, 81, 84, 80}, {79, 83, 78, 82}, {83, 79, 84, 80}, {77, 81, 78, 82}, }, { {86, 82, 85, 81}, {80, 84, 79, 83}, {84, 80, 85, 81}, {78, 82, 79, 83}, }, { {87, 83, 86, 82}, {81, 85, 80, 84}, {85, 81, 86, 82}, {79, 83, 80, 84}, }, { {88, 84, 87, 83}, {82, 86, 81, 85}, {86, 82, 87, 83}, {80, 84, 81, 85}, }, { {89, 85, 88, 84}, {83, 87, 82, 86}, {87, 83, 88, 84}, {81, 85, 82, 86}, }, { {90, 86, 89, 85}, {84, 88, 83, 87}, {88, 84, 89, 85}, {82, 86, 83, 87}, }, { {91, 87, 90, 86}, {85, 89, 84, 88}, {89, 85, 90, 86}, {83, 87, 84, 88}, }, { {92, 88, 91, 87}, {86, 90, 85, 89}, {90, 86, 91, 87}, {84, 88, 85, 89}, }, { {93, 89, 92, 88}, {87, 91, 86, 90}, {91, 87, 92, 88}, {85, 89, 86, 90}, }, { {94, 90, 93, 89}, {88, 92, 87, 91}, {92, 88, 93, 89}, {86, 90, 87, 91}, }, { {95, 91, 94, 90}, {89, 93, 88, 92}, {93, 89, 94, 90}, {87, 91, 88, 92}, }, { {96, 92, 95, 91}, {90, 94, 89, 93}, {94, 90, 95, 91}, {88, 92, 89, 93}, }, { {97, 93, 96, 92}, {91, 95, 90, 94}, {95, 91, 96, 92}, {89, 93, 90, 94}, }, { {98, 94, 97, 93}, {92, 96, 91, 95}, {96, 92, 97, 93}, {90, 94, 91, 95}, }, { {99, 95, 98, 94}, {93, 97, 92, 96}, {97, 93, 98, 94}, {91, 95, 92, 96}, }, { {100, 96, 99, 95}, {94, 98, 93, 97}, {98, 94, 99, 95}, {92, 96, 93, 97}, }, { {101, 97, 100, 96}, {95, 99, 94, 98}, {99, 95, 100, 96}, {93, 97, 94, 98}, }, { {102, 98, 101, 97}, {96, 100, 95, 99}, {100, 96, 101, 97}, {94, 98, 95, 99}, }, { {103, 99, 102, 98}, {97, 101, 96, 100}, {101, 97, 102, 98}, {95, 99, 96, 100}, }, { {104, 100, 103, 99}, {98, 102, 97, 101}, {102, 98, 103, 99}, {96, 100, 97, 101}, }, { {105, 101, 104, 100}, {99, 103, 98, 102}, {103, 99, 104, 100}, {97, 101, 98, 102}, }, { {106, 102, 105, 101}, {100, 104, 99, 103}, {104, 100, 105, 101}, {98, 102, 99, 103}, }, { {107, 103, 106, 102}, {101, 105, 100, 104}, {105, 101, 106, 102}, {99, 103, 100, 104}, }, { {108, 104, 107, 103}, {102, 106, 101, 105}, {106, 102, 107, 103}, {100, 104, 101, 105}, }, { {109, 105, 108, 104}, {103, 107, 102, 106}, {107, 103, 108, 104}, {101, 105, 102, 106}, }, { {110, 106, 109, 105}, {104, 108, 103, 107}, {108, 104, 109, 105}, {102, 106, 103, 107}, }, { {111, 107, 110, 106}, {105, 109, 104, 108}, {109, 105, 110, 106}, {103, 107, 104, 108}, }, { {112, 108, 111, 107}, {106, 110, 105, 109}, {110, 106, 111, 107}, {104, 108, 105, 109}, }, { {113, 109, 112, 108}, {107, 111, 106, 110}, {111, 107, 112, 108}, {105, 109, 106, 110}, }, { {114, 110, 113, 109}, {108, 112, 107, 111}, {112, 108, 113, 109}, {106, 110, 107, 111}, }, { {115, 111, 114, 110}, {109, 113, 108, 112}, {113, 109, 114, 110}, {107, 111, 108, 112}, }, { {116, 112, 115, 111}, {110, 114, 109, 113}, {114, 110, 115, 111}, {108, 112, 109, 113}, }, { {117, 113, 116, 112}, {111, 115, 110, 114}, {115, 111, 116, 112}, {109, 113, 110, 114}, }, { {118, 114, 117, 113}, {112, 116, 111, 115}, {116, 112, 117, 113}, {110, 114, 111, 115}, }, { {119, 115, 118, 114}, {113, 117, 112, 116}, {117, 113, 118, 114}, {111, 115, 112, 116}, }, { {120, 116, 119, 115}, {114, 118, 113, 117}, {118, 114, 119, 115}, {112, 116, 113, 117}, }, { {121, 117, 120, 116}, {115, 119, 114, 118}, {119, 115, 120, 116}, {113, 117, 114, 118}, }, { {122, 118, 121, 117}, {116, 120, 115, 119}, {120, 116, 121, 117}, {114, 118, 115, 119}, }, { {123, 119, 122, 118}, {117, 121, 116, 120}, {121, 117, 122, 118}, {115, 119, 116, 120}, }, { {124, 120, 123, 119}, {118, 122, 117, 121}, {122, 118, 123, 119}, {116, 120, 117, 121}, }, { {125, 121, 124, 120}, {119, 123, 118, 122}, {123, 119, 124, 120}, {117, 121, 118, 122}, }, { {126, 122, 125, 121}, {120, 124, 119, 123}, {124, 120, 125, 121}, {118, 122, 119, 123}, }, { {127, 123, 126, 122}, {121, 125, 120, 124}, {125, 121, 126, 122}, {119, 123, 120, 124}, }, { {128, 124, 127, 123}, {122, 126, 121, 125}, {126, 122, 127, 123}, {120, 124, 121, 125}, }, { {129, 125, 128, 124}, {123, 127, 122, 126}, {127, 123, 128, 124}, {121, 125, 122, 126}, }, { {130, 126, 129, 125}, {124, 128, 123, 127}, {128, 124, 129, 125}, {122, 126, 123, 127}, }, { {131, 127, 130, 126}, {125, 129, 124, 128}, {129, 125, 130, 126}, {123, 127, 124, 128}, }, { {132, 128, 131, 127}, {126, 130, 125, 129}, {130, 126, 131, 127}, {124, 128, 125, 129}, }, { {133, 129, 132, 128}, {127, 131, 126, 130}, {131, 127, 132, 128}, {125, 129, 126, 130}, }, { {134, 130, 133, 129}, {128, 132, 127, 131}, {132, 128, 133, 129}, {126, 130, 127, 131}, }, { {135, 131, 134, 130}, {129, 133, 128, 132}, {133, 129, 134, 130}, {127, 131, 128, 132}, }, { {136, 132, 135, 131}, {130, 134, 129, 133}, {134, 130, 135, 131}, {128, 132, 129, 133}, }, { {137, 133, 136, 132}, {131, 135, 130, 134}, {135, 131, 136, 132}, {129, 133, 130, 134}, }, { {138, 134, 137, 133}, {132, 136, 131, 135}, {136, 132, 137, 133}, {130, 134, 131, 135}, }, { {139, 135, 138, 134}, {133, 137, 132, 136}, {137, 133, 138, 134}, {131, 135, 132, 136}, }, { {140, 136, 139, 135}, {134, 138, 133, 137}, {138, 134, 139, 135}, {132, 136, 133, 137}, }, { {141, 137, 140, 136}, {135, 139, 134, 138}, {139, 135, 140, 136}, {133, 137, 134, 138}, }, { {142, 138, 141, 137}, {136, 140, 135, 139}, {140, 136, 141, 137}, {134, 138, 135, 139}, }, { {143, 139, 142, 138}, {137, 141, 136, 140}, {141, 137, 142, 138}, {135, 139, 136, 140}, }, { {144, 140, 143, 139}, {138, 142, 137, 141}, {142, 138, 143, 139}, {136, 140, 137, 141}, }, { {145, 141, 144, 140}, {139, 143, 138, 142}, {143, 139, 144, 140}, {137, 141, 138, 142}, }, { {146, 142, 145, 141}, {140, 144, 139, 143}, {144, 140, 145, 141}, {138, 142, 139, 143}, }, { {147, 143, 146, 142}, {141, 145, 140, 144}, {145, 141, 146, 142}, {139, 143, 140, 144}, }, { {148, 144, 147, 143}, {142, 146, 141, 145}, {146, 142, 147, 143}, {140, 144, 141, 145}, }, { {149, 145, 148, 144}, {143, 147, 142, 146}, {147, 143, 148, 144}, {141, 145, 142, 146}, }, { {150, 146, 149, 145}, {144, 148, 143, 147}, {148, 144, 149, 145}, {142, 146, 143, 147}, }, { {151, 147, 150, 146}, {145, 149, 144, 148}, {149, 145, 150, 146}, {143, 147, 144, 148}, }, { {152, 148, 151, 147}, {146, 150, 145, 149}, {150, 146, 151, 147}, {144, 148, 145, 149}, }, { {153, 149, 152, 148}, {147, 151, 146, 150}, {151, 147, 152, 148}, {145, 149, 146, 150}, }, { {154, 150, 153, 149}, {148, 152, 147, 151}, {152, 148, 153, 149}, {146, 150, 147, 151}, }, { {155, 151, 154, 150}, {149, 153, 148, 152}, {153, 149, 154, 150}, {147, 151, 148, 152}, }, { {156, 152, 155, 151}, {150, 154, 149, 153}, {154, 150, 155, 151}, {148, 152, 149, 153}, }, { {157, 153, 156, 152}, {151, 155, 150, 154}, {155, 151, 156, 152}, {149, 153, 150, 154}, }, { {158, 154, 157, 153}, {152, 156, 151, 155}, {156, 152, 157, 153}, {150, 154, 151, 155}, }, { {159, 155, 158, 154}, {153, 157, 152, 156}, {157, 153, 158, 154}, {151, 155, 152, 156}, }, { {160, 156, 159, 155}, {154, 158, 153, 157}, {158, 154, 159, 155}, {152, 156, 153, 157}, }, { {161, 157, 160, 156}, {155, 159, 154, 158}, {159, 155, 160, 156}, {153, 157, 154, 158}, }, { {162, 158, 161, 157}, {156, 160, 155, 159}, {160, 156, 161, 157}, {154, 158, 155, 159}, }, { {163, 159, 162, 158}, {157, 161, 156, 160}, {161, 157, 162, 158}, {155, 159, 156, 160}, }, { {164, 160, 163, 159}, {158, 162, 157, 161}, {162, 158, 163, 159}, {156, 160, 157, 161}, }, { {165, 161, 164, 160}, {159, 163, 158, 162}, {163, 159, 164, 160}, {157, 161, 158, 162}, }, { {166, 162, 165, 161}, {160, 164, 159, 163}, {164, 160, 165, 161}, {158, 162, 159, 163}, }, { {167, 163, 166, 162}, {161, 165, 160, 164}, {165, 161, 166, 162}, {159, 163, 160, 164}, }, { {168, 164, 167, 163}, {162, 166, 161, 165}, {166, 162, 167, 163}, {160, 164, 161, 165}, }, { {169, 165, 168, 164}, {163, 167, 162, 166}, {167, 163, 168, 164}, {161, 165, 162, 166}, }, { {170, 166, 169, 165}, {164, 168, 163, 167}, {168, 164, 169, 165}, {162, 166, 163, 167}, }, { {171, 167, 170, 166}, {165, 169, 164, 168}, {169, 165, 170, 166}, {163, 167, 164, 168}, }, { {172, 168, 171, 167}, {166, 170, 165, 169}, {170, 166, 171, 167}, {164, 168, 165, 169}, }, { {173, 169, 172, 168}, {167, 171, 166, 170}, {171, 167, 172, 168}, {165, 169, 166, 170}, }, { {174, 170, 173, 169}, {168, 172, 167, 171}, {172, 168, 173, 169}, {166, 170, 167, 171}, }, { {175, 171, 174, 170}, {169, 173, 168, 172}, {173, 169, 174, 170}, {167, 171, 168, 172}, }, { {176, 172, 175, 171}, {170, 174, 169, 173}, {174, 170, 175, 171}, {168, 172, 169, 173}, }, { {177, 173, 176, 172}, {171, 175, 170, 174}, {175, 171, 176, 172}, {169, 173, 170, 174}, }, { {178, 174, 177, 173}, {172, 176, 171, 175}, {176, 172, 177, 173}, {170, 174, 171, 175}, }, { {179, 175, 178, 174}, {173, 177, 172, 176}, {177, 173, 178, 174}, {171, 175, 172, 176}, }, { {180, 176, 179, 175}, {174, 178, 173, 177}, {178, 174, 179, 175}, {172, 176, 173, 177}, }, { {181, 177, 180, 176}, {175, 179, 174, 178}, {179, 175, 180, 176}, {173, 177, 174, 178}, }, { {182, 178, 181, 177}, {176, 180, 175, 179}, {180, 176, 181, 177}, {174, 178, 175, 179}, }, { {183, 179, 182, 178}, {177, 181, 176, 180}, {181, 177, 182, 178}, {175, 179, 176, 180}, }, { {184, 180, 183, 179}, {178, 182, 177, 181}, {182, 178, 183, 179}, {176, 180, 177, 181}, }, { {185, 181, 184, 180}, {179, 183, 178, 182}, {183, 179, 184, 180}, {177, 181, 178, 182}, }, { {186, 182, 185, 181}, {180, 184, 179, 183}, {184, 180, 185, 181}, {178, 182, 179, 183}, }, { {187, 183, 186, 182}, {181, 185, 180, 184}, {185, 181, 186, 182}, {179, 183, 180, 184}, }, { {188, 184, 187, 183}, {182, 186, 181, 185}, {186, 182, 187, 183}, {180, 184, 181, 185}, }, { {189, 185, 188, 184}, {183, 187, 182, 186}, {187, 183, 188, 184}, {181, 185, 182, 186}, }, { {190, 186, 189, 185}, {184, 188, 183, 187}, {188, 184, 189, 185}, {182, 186, 183, 187}, }, { {191, 187, 190, 186}, {185, 189, 184, 188}, {189, 185, 190, 186}, {183, 187, 184, 188}, }, { {192, 188, 191, 187}, {186, 190, 185, 189}, {190, 186, 191, 187}, {184, 188, 185, 189}, }, { {193, 189, 192, 188}, {187, 191, 186, 190}, {191, 187, 192, 188}, {185, 189, 186, 190}, }, { {194, 190, 193, 189}, {188, 192, 187, 191}, {192, 188, 193, 189}, {186, 190, 187, 191}, }, { {195, 191, 194, 190}, {189, 193, 188, 192}, {193, 189, 194, 190}, {187, 191, 188, 192}, }, { {196, 192, 195, 191}, {190, 194, 189, 193}, {194, 190, 195, 191}, {188, 192, 189, 193}, }, { {197, 193, 196, 192}, {191, 195, 190, 194}, {195, 191, 196, 192}, {189, 193, 190, 194}, }, { {198, 194, 197, 193}, {192, 196, 191, 195}, {196, 192, 197, 193}, {190, 194, 191, 195}, }, { {199, 195, 198, 194}, {193, 197, 192, 196}, {197, 193, 198, 194}, {191, 195, 192, 196}, }, { {200, 196, 199, 195}, {194, 198, 193, 197}, {198, 194, 199, 195}, {192, 196, 193, 197}, }, { {201, 197, 200, 196}, {195, 199, 194, 198}, {199, 195, 200, 196}, {193, 197, 194, 198}, }, { {202, 198, 201, 197}, {196, 200, 195, 199}, {200, 196, 201, 197}, {194, 198, 195, 199}, }, { {203, 199, 202, 198}, {197, 201, 196, 200}, {201, 197, 202, 198}, {195, 199, 196, 200}, }, { {204, 200, 203, 199}, {198, 202, 197, 201}, {202, 198, 203, 199}, {196, 200, 197, 201}, }, { {205, 201, 204, 200}, {199, 203, 198, 202}, {203, 199, 204, 200}, {197, 201, 198, 202}, }, { {206, 202, 205, 201}, {200, 204, 199, 203}, {204, 200, 205, 201}, {198, 202, 199, 203}, }, { {207, 203, 206, 202}, {201, 205, 200, 204}, {205, 201, 206, 202}, {199, 203, 200, 204}, }, { {208, 204, 207, 203}, {202, 206, 201, 205}, {206, 202, 207, 203}, {200, 204, 201, 205}, }, { {209, 205, 208, 204}, {203, 207, 202, 206}, {207, 203, 208, 204}, {201, 205, 202, 206}, }, { {210, 206, 209, 205}, {204, 208, 203, 207}, {208, 204, 209, 205}, {202, 206, 203, 207}, }, { {211, 207, 210, 206}, {205, 209, 204, 208}, {209, 205, 210, 206}, {203, 207, 204, 208}, }, { {212, 208, 211, 207}, {206, 210, 205, 209}, {210, 206, 211, 207}, {204, 208, 205, 209}, }, { {213, 209, 212, 208}, {207, 211, 206, 210}, {211, 207, 212, 208}, {205, 209, 206, 210}, }, { {214, 210, 213, 209}, {208, 212, 207, 211}, {212, 208, 213, 209}, {206, 210, 207, 211}, }, { {215, 211, 214, 210}, {209, 213, 208, 212}, {213, 209, 214, 210}, {207, 211, 208, 212}, }, { {216, 212, 215, 211}, {210, 214, 209, 213}, {214, 210, 215, 211}, {208, 212, 209, 213}, }, { {217, 213, 216, 212}, {211, 215, 210, 214}, {215, 211, 216, 212}, {209, 213, 210, 214}, }, { {218, 214, 217, 213}, {212, 216, 211, 215}, {216, 212, 217, 213}, {210, 214, 211, 215}, }, { {219, 215, 218, 214}, {213, 217, 212, 216}, {217, 213, 218, 214}, {211, 215, 212, 216}, }, { {220, 216, 219, 215}, {214, 218, 213, 217}, {218, 214, 219, 215}, {212, 216, 213, 217}, }, { {221, 217, 220, 216}, {215, 219, 214, 218}, {219, 215, 220, 216}, {213, 217, 214, 218}, }, { {222, 218, 221, 217}, {216, 220, 215, 219}, {220, 216, 221, 217}, {214, 218, 215, 219}, }, { {223, 219, 222, 218}, {217, 221, 216, 220}, {221, 217, 222, 218}, {215, 219, 216, 220}, }, { {224, 220, 223, 219}, {218, 222, 217, 221}, {222, 218, 223, 219}, {216, 220, 217, 221}, }, { {225, 221, 224, 220}, {219, 223, 218, 222}, {223, 219, 224, 220}, {217, 221, 218, 222}, }, { {226, 222, 225, 221}, {220, 224, 219, 223}, {224, 220, 225, 221}, {218, 222, 219, 223}, }, { {227, 223, 226, 222}, {221, 225, 220, 224}, {225, 221, 226, 222}, {219, 223, 220, 224}, }, { {228, 224, 227, 223}, {222, 226, 221, 225}, {226, 222, 227, 223}, {220, 224, 221, 225}, }, { {229, 225, 228, 224}, {223, 227, 222, 226}, {227, 223, 228, 224}, {221, 225, 222, 226}, }, { {230, 226, 229, 225}, {224, 228, 223, 227}, {228, 224, 229, 225}, {222, 226, 223, 227}, }, { {231, 227, 230, 226}, {225, 229, 224, 228}, {229, 225, 230, 226}, {223, 227, 224, 228}, }, { {232, 228, 231, 227}, {226, 230, 225, 229}, {230, 226, 231, 227}, {224, 228, 225, 229}, }, { {233, 229, 232, 228}, {227, 231, 226, 230}, {231, 227, 232, 228}, {225, 229, 226, 230}, }, { {234, 230, 233, 229}, {228, 232, 227, 231}, {232, 228, 233, 229}, {226, 230, 227, 231}, }, { {235, 231, 234, 230}, {229, 233, 228, 232}, {233, 229, 234, 230}, {227, 231, 228, 232}, }, { {236, 232, 235, 231}, {230, 234, 229, 233}, {234, 230, 235, 231}, {228, 232, 229, 233}, }, { {237, 233, 236, 232}, {231, 235, 230, 234}, {235, 231, 236, 232}, {229, 233, 230, 234}, }, { {238, 234, 237, 233}, {232, 236, 231, 235}, {236, 232, 237, 233}, {230, 234, 231, 235}, }, { {239, 235, 238, 234}, {233, 237, 232, 236}, {237, 233, 238, 234}, {231, 235, 232, 236}, }, { {240, 236, 239, 235}, {234, 238, 233, 237}, {238, 234, 239, 235}, {232, 236, 233, 237}, }, { {241, 237, 240, 236}, {235, 239, 234, 238}, {239, 235, 240, 236}, {233, 237, 234, 238}, }, { {242, 238, 241, 237}, {236, 240, 235, 239}, {240, 236, 241, 237}, {234, 238, 235, 239}, }, { {243, 239, 242, 238}, {237, 241, 236, 240}, {241, 237, 242, 238}, {235, 239, 236, 240}, }, { {244, 240, 243, 239}, {238, 242, 237, 241}, {242, 238, 243, 239}, {236, 240, 237, 241}, }, { {245, 241, 244, 240}, {239, 243, 238, 242}, {243, 239, 244, 240}, {237, 241, 238, 242}, }, { {246, 242, 245, 241}, {240, 244, 239, 243}, {244, 240, 245, 241}, {238, 242, 239, 243}, }, { {247, 243, 246, 242}, {241, 245, 240, 244}, {245, 241, 246, 242}, {239, 243, 240, 244}, }, { {248, 244, 247, 243}, {242, 246, 241, 245}, {246, 242, 247, 243}, {240, 244, 241, 245}, }, { {249, 245, 248, 244}, {243, 247, 242, 246}, {247, 243, 248, 244}, {241, 245, 242, 246}, }, { {250, 246, 249, 245}, {244, 248, 243, 247}, {248, 244, 249, 245}, {242, 246, 243, 247}, }, { {251, 247, 250, 246}, {245, 249, 244, 248}, {249, 245, 250, 246}, {243, 247, 244, 248}, }, { {252, 248, 251, 247}, {246, 250, 245, 249}, {250, 246, 251, 247}, {244, 248, 245, 249}, }, { {253, 249, 252, 248}, {247, 251, 246, 250}, {251, 247, 252, 248}, {245, 249, 246, 250}, }, { {254, 250, 253, 249}, {248, 252, 247, 251}, {252, 248, 253, 249}, {246, 250, 247, 251}, }, { {255, 251, 254, 250}, {249, 253, 248, 252}, {253, 249, 254, 250}, {247, 251, 248, 252}, }, { {255, 252, 255, 251}, {250, 254, 249, 253}, {254, 250, 255, 251}, {248, 252, 249, 253}, }, { {255, 253, 255, 252}, {251, 255, 250, 254}, {255, 251, 255, 252}, {249, 253, 250, 254}, }, { {255, 254, 255, 253}, {252, 255, 251, 255}, {255, 252, 255, 253}, {250, 254, 251, 255}, }, { {255, 255, 255, 254}, {253, 255, 252, 255}, {255, 253, 255, 254}, {251, 255, 252, 255}, }, { {255, 255, 255, 255}, {254, 255, 253, 255}, {255, 254, 255, 255}, {252, 255, 253, 255}, }, }; static const uint8_t dithersub_g[256][4][4] = { { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }, { {5, 3, 4, 2}, {2, 4, 1, 3}, {4, 2, 4, 2}, {1, 3, 1, 3}, }, { {6, 4, 5, 3}, {3, 5, 2, 4}, {5, 3, 5, 3}, {2, 4, 2, 4}, }, { {7, 5, 6, 4}, {4, 6, 3, 5}, {6, 4, 6, 4}, {3, 5, 3, 5}, }, { {8, 6, 7, 5}, {5, 7, 4, 6}, {7, 5, 7, 5}, {4, 6, 4, 6}, }, { {9, 7, 8, 6}, {6, 8, 5, 7}, {8, 6, 8, 6}, {5, 7, 5, 7}, }, { {10, 8, 9, 7}, {7, 9, 6, 8}, {9, 7, 9, 7}, {6, 8, 6, 8}, }, { {11, 9, 10, 8}, {8, 10, 7, 9}, {10, 8, 10, 8}, {7, 9, 7, 9}, }, { {12, 10, 11, 9}, {9, 11, 8, 10}, {11, 9, 11, 9}, {8, 10, 8, 10}, }, { {13, 11, 12, 10}, {10, 12, 9, 11}, {12, 10, 12, 10}, {9, 11, 9, 11}, }, { {14, 12, 13, 11}, {11, 13, 10, 12}, {13, 11, 13, 11}, {10, 12, 10, 12}, }, { {15, 13, 14, 12}, {12, 14, 11, 13}, {14, 12, 14, 12}, {11, 13, 11, 13}, }, { {16, 14, 15, 13}, {13, 15, 12, 14}, {15, 13, 15, 13}, {12, 14, 12, 14}, }, { {17, 15, 16, 14}, {14, 16, 13, 15}, {16, 14, 16, 14}, {13, 15, 13, 15}, }, { {18, 16, 17, 15}, {15, 17, 14, 16}, {17, 15, 17, 15}, {14, 16, 14, 16}, }, { {19, 17, 18, 16}, {16, 18, 15, 17}, {18, 16, 18, 16}, {15, 17, 15, 17}, }, { {20, 18, 19, 17}, {17, 19, 16, 18}, {19, 17, 19, 17}, {16, 18, 16, 18}, }, { {21, 19, 20, 18}, {18, 20, 17, 19}, {20, 18, 20, 18}, {17, 19, 17, 19}, }, { {22, 20, 21, 19}, {19, 21, 18, 20}, {21, 19, 21, 19}, {18, 20, 18, 20}, }, { {23, 21, 22, 20}, {20, 22, 19, 21}, {22, 20, 22, 20}, {19, 21, 19, 21}, }, { {24, 22, 23, 21}, {21, 23, 20, 22}, {23, 21, 23, 21}, {20, 22, 20, 22}, }, { {25, 23, 24, 22}, {22, 24, 21, 23}, {24, 22, 24, 22}, {21, 23, 21, 23}, }, { {26, 24, 25, 23}, {23, 25, 22, 24}, {25, 23, 25, 23}, {22, 24, 22, 24}, }, { {27, 25, 26, 24}, {24, 26, 23, 25}, {26, 24, 26, 24}, {23, 25, 23, 25}, }, { {28, 26, 27, 25}, {25, 27, 24, 26}, {27, 25, 27, 25}, {24, 26, 24, 26}, }, { {29, 27, 28, 26}, {26, 28, 25, 27}, {28, 26, 28, 26}, {25, 27, 25, 27}, }, { {30, 28, 29, 27}, {27, 29, 26, 28}, {29, 27, 29, 27}, {26, 28, 26, 28}, }, { {31, 29, 30, 28}, {28, 30, 27, 29}, {30, 28, 30, 28}, {27, 29, 27, 29}, }, { {32, 30, 31, 29}, {29, 31, 28, 30}, {31, 29, 31, 29}, {28, 30, 28, 30}, }, { {33, 31, 32, 30}, {30, 32, 29, 31}, {32, 30, 32, 30}, {29, 31, 29, 31}, }, { {34, 32, 33, 31}, {31, 33, 30, 32}, {33, 31, 33, 31}, {30, 32, 30, 32}, }, { {35, 33, 34, 32}, {32, 34, 31, 33}, {34, 32, 34, 32}, {31, 33, 31, 33}, }, { {36, 34, 35, 33}, {33, 35, 32, 34}, {35, 33, 35, 33}, {32, 34, 32, 34}, }, { {37, 35, 36, 34}, {34, 36, 33, 35}, {36, 34, 36, 34}, {33, 35, 33, 35}, }, { {38, 36, 37, 35}, {35, 37, 34, 36}, {37, 35, 37, 35}, {34, 36, 34, 36}, }, { {39, 37, 38, 36}, {36, 38, 35, 37}, {38, 36, 38, 36}, {35, 37, 35, 37}, }, { {40, 38, 39, 37}, {37, 39, 36, 38}, {39, 37, 39, 37}, {36, 38, 36, 38}, }, { {41, 39, 40, 38}, {38, 40, 37, 39}, {40, 38, 40, 38}, {37, 39, 37, 39}, }, { {42, 40, 41, 39}, {39, 41, 38, 40}, {41, 39, 41, 39}, {38, 40, 38, 40}, }, { {43, 41, 42, 40}, {40, 42, 39, 41}, {42, 40, 42, 40}, {39, 41, 39, 41}, }, { {44, 42, 43, 41}, {41, 43, 40, 42}, {43, 41, 43, 41}, {40, 42, 40, 42}, }, { {45, 43, 44, 42}, {42, 44, 41, 43}, {44, 42, 44, 42}, {41, 43, 41, 43}, }, { {46, 44, 45, 43}, {43, 45, 42, 44}, {45, 43, 45, 43}, {42, 44, 42, 44}, }, { {47, 45, 46, 44}, {44, 46, 43, 45}, {46, 44, 46, 44}, {43, 45, 43, 45}, }, { {48, 46, 47, 45}, {45, 47, 44, 46}, {47, 45, 47, 45}, {44, 46, 44, 46}, }, { {49, 47, 48, 46}, {46, 48, 45, 47}, {48, 46, 48, 46}, {45, 47, 45, 47}, }, { {50, 48, 49, 47}, {47, 49, 46, 48}, {49, 47, 49, 47}, {46, 48, 46, 48}, }, { {51, 49, 50, 48}, {48, 50, 47, 49}, {50, 48, 50, 48}, {47, 49, 47, 49}, }, { {52, 50, 51, 49}, {49, 51, 48, 50}, {51, 49, 51, 49}, {48, 50, 48, 50}, }, { {53, 51, 52, 50}, {50, 52, 49, 51}, {52, 50, 52, 50}, {49, 51, 49, 51}, }, { {54, 52, 53, 51}, {51, 53, 50, 52}, {53, 51, 53, 51}, {50, 52, 50, 52}, }, { {55, 53, 54, 52}, {52, 54, 51, 53}, {54, 52, 54, 52}, {51, 53, 51, 53}, }, { {56, 54, 55, 53}, {53, 55, 52, 54}, {55, 53, 55, 53}, {52, 54, 52, 54}, }, { {57, 55, 56, 54}, {54, 56, 53, 55}, {56, 54, 56, 54}, {53, 55, 53, 55}, }, { {58, 56, 57, 55}, {55, 57, 54, 56}, {57, 55, 57, 55}, {54, 56, 54, 56}, }, { {59, 57, 58, 56}, {56, 58, 55, 57}, {58, 56, 58, 56}, {55, 57, 55, 57}, }, { {60, 58, 59, 57}, {57, 59, 56, 58}, {59, 57, 59, 57}, {56, 58, 56, 58}, }, { {61, 59, 60, 58}, {58, 60, 57, 59}, {60, 58, 60, 58}, {57, 59, 57, 59}, }, { {62, 60, 61, 59}, {59, 61, 58, 60}, {61, 59, 61, 59}, {58, 60, 58, 60}, }, { {63, 61, 62, 60}, {60, 62, 59, 61}, {62, 60, 62, 60}, {59, 61, 59, 61}, }, { {64, 62, 63, 61}, {61, 63, 60, 62}, {63, 61, 63, 61}, {60, 62, 60, 62}, }, { {65, 63, 64, 62}, {62, 64, 61, 63}, {64, 62, 64, 62}, {61, 63, 61, 63}, }, { {66, 64, 65, 63}, {63, 65, 62, 64}, {65, 63, 65, 63}, {62, 64, 62, 64}, }, { {67, 65, 66, 64}, {64, 66, 63, 65}, {66, 64, 66, 64}, {63, 65, 63, 65}, }, { {68, 66, 67, 65}, {65, 67, 64, 66}, {67, 65, 67, 65}, {64, 66, 64, 66}, }, { {69, 67, 68, 66}, {66, 68, 65, 67}, {68, 66, 68, 66}, {65, 67, 65, 67}, }, { {70, 68, 69, 67}, {67, 69, 66, 68}, {69, 67, 69, 67}, {66, 68, 66, 68}, }, { {71, 69, 70, 68}, {68, 70, 67, 69}, {70, 68, 70, 68}, {67, 69, 67, 69}, }, { {72, 70, 71, 69}, {69, 71, 68, 70}, {71, 69, 71, 69}, {68, 70, 68, 70}, }, { {73, 71, 72, 70}, {70, 72, 69, 71}, {72, 70, 72, 70}, {69, 71, 69, 71}, }, { {74, 72, 73, 71}, {71, 73, 70, 72}, {73, 71, 73, 71}, {70, 72, 70, 72}, }, { {75, 73, 74, 72}, {72, 74, 71, 73}, {74, 72, 74, 72}, {71, 73, 71, 73}, }, { {76, 74, 75, 73}, {73, 75, 72, 74}, {75, 73, 75, 73}, {72, 74, 72, 74}, }, { {77, 75, 76, 74}, {74, 76, 73, 75}, {76, 74, 76, 74}, {73, 75, 73, 75}, }, { {78, 76, 77, 75}, {75, 77, 74, 76}, {77, 75, 77, 75}, {74, 76, 74, 76}, }, { {79, 77, 78, 76}, {76, 78, 75, 77}, {78, 76, 78, 76}, {75, 77, 75, 77}, }, { {80, 78, 79, 77}, {77, 79, 76, 78}, {79, 77, 79, 77}, {76, 78, 76, 78}, }, { {81, 79, 80, 78}, {78, 80, 77, 79}, {80, 78, 80, 78}, {77, 79, 77, 79}, }, { {82, 80, 81, 79}, {79, 81, 78, 80}, {81, 79, 81, 79}, {78, 80, 78, 80}, }, { {83, 81, 82, 80}, {80, 82, 79, 81}, {82, 80, 82, 80}, {79, 81, 79, 81}, }, { {84, 82, 83, 81}, {81, 83, 80, 82}, {83, 81, 83, 81}, {80, 82, 80, 82}, }, { {85, 83, 84, 82}, {82, 84, 81, 83}, {84, 82, 84, 82}, {81, 83, 81, 83}, }, { {86, 84, 85, 83}, {83, 85, 82, 84}, {85, 83, 85, 83}, {82, 84, 82, 84}, }, { {87, 85, 86, 84}, {84, 86, 83, 85}, {86, 84, 86, 84}, {83, 85, 83, 85}, }, { {88, 86, 87, 85}, {85, 87, 84, 86}, {87, 85, 87, 85}, {84, 86, 84, 86}, }, { {89, 87, 88, 86}, {86, 88, 85, 87}, {88, 86, 88, 86}, {85, 87, 85, 87}, }, { {90, 88, 89, 87}, {87, 89, 86, 88}, {89, 87, 89, 87}, {86, 88, 86, 88}, }, { {91, 89, 90, 88}, {88, 90, 87, 89}, {90, 88, 90, 88}, {87, 89, 87, 89}, }, { {92, 90, 91, 89}, {89, 91, 88, 90}, {91, 89, 91, 89}, {88, 90, 88, 90}, }, { {93, 91, 92, 90}, {90, 92, 89, 91}, {92, 90, 92, 90}, {89, 91, 89, 91}, }, { {94, 92, 93, 91}, {91, 93, 90, 92}, {93, 91, 93, 91}, {90, 92, 90, 92}, }, { {95, 93, 94, 92}, {92, 94, 91, 93}, {94, 92, 94, 92}, {91, 93, 91, 93}, }, { {96, 94, 95, 93}, {93, 95, 92, 94}, {95, 93, 95, 93}, {92, 94, 92, 94}, }, { {97, 95, 96, 94}, {94, 96, 93, 95}, {96, 94, 96, 94}, {93, 95, 93, 95}, }, { {98, 96, 97, 95}, {95, 97, 94, 96}, {97, 95, 97, 95}, {94, 96, 94, 96}, }, { {99, 97, 98, 96}, {96, 98, 95, 97}, {98, 96, 98, 96}, {95, 97, 95, 97}, }, { {100, 98, 99, 97}, {97, 99, 96, 98}, {99, 97, 99, 97}, {96, 98, 96, 98}, }, { {101, 99, 100, 98}, {98, 100, 97, 99}, {100, 98, 100, 98}, {97, 99, 97, 99}, }, { {102, 100, 101, 99}, {99, 101, 98, 100}, {101, 99, 101, 99}, {98, 100, 98, 100}, }, { {103, 101, 102, 100}, {100, 102, 99, 101}, {102, 100, 102, 100}, {99, 101, 99, 101}, }, { {104, 102, 103, 101}, {101, 103, 100, 102}, {103, 101, 103, 101}, {100, 102, 100, 102}, }, { {105, 103, 104, 102}, {102, 104, 101, 103}, {104, 102, 104, 102}, {101, 103, 101, 103}, }, { {106, 104, 105, 103}, {103, 105, 102, 104}, {105, 103, 105, 103}, {102, 104, 102, 104}, }, { {107, 105, 106, 104}, {104, 106, 103, 105}, {106, 104, 106, 104}, {103, 105, 103, 105}, }, { {108, 106, 107, 105}, {105, 107, 104, 106}, {107, 105, 107, 105}, {104, 106, 104, 106}, }, { {109, 107, 108, 106}, {106, 108, 105, 107}, {108, 106, 108, 106}, {105, 107, 105, 107}, }, { {110, 108, 109, 107}, {107, 109, 106, 108}, {109, 107, 109, 107}, {106, 108, 106, 108}, }, { {111, 109, 110, 108}, {108, 110, 107, 109}, {110, 108, 110, 108}, {107, 109, 107, 109}, }, { {112, 110, 111, 109}, {109, 111, 108, 110}, {111, 109, 111, 109}, {108, 110, 108, 110}, }, { {113, 111, 112, 110}, {110, 112, 109, 111}, {112, 110, 112, 110}, {109, 111, 109, 111}, }, { {114, 112, 113, 111}, {111, 113, 110, 112}, {113, 111, 113, 111}, {110, 112, 110, 112}, }, { {115, 113, 114, 112}, {112, 114, 111, 113}, {114, 112, 114, 112}, {111, 113, 111, 113}, }, { {116, 114, 115, 113}, {113, 115, 112, 114}, {115, 113, 115, 113}, {112, 114, 112, 114}, }, { {117, 115, 116, 114}, {114, 116, 113, 115}, {116, 114, 116, 114}, {113, 115, 113, 115}, }, { {118, 116, 117, 115}, {115, 117, 114, 116}, {117, 115, 117, 115}, {114, 116, 114, 116}, }, { {119, 117, 118, 116}, {116, 118, 115, 117}, {118, 116, 118, 116}, {115, 117, 115, 117}, }, { {120, 118, 119, 117}, {117, 119, 116, 118}, {119, 117, 119, 117}, {116, 118, 116, 118}, }, { {121, 119, 120, 118}, {118, 120, 117, 119}, {120, 118, 120, 118}, {117, 119, 117, 119}, }, { {122, 120, 121, 119}, {119, 121, 118, 120}, {121, 119, 121, 119}, {118, 120, 118, 120}, }, { {123, 121, 122, 120}, {120, 122, 119, 121}, {122, 120, 122, 120}, {119, 121, 119, 121}, }, { {124, 122, 123, 121}, {121, 123, 120, 122}, {123, 121, 123, 121}, {120, 122, 120, 122}, }, { {125, 123, 124, 122}, {122, 124, 121, 123}, {124, 122, 124, 122}, {121, 123, 121, 123}, }, { {126, 124, 125, 123}, {123, 125, 122, 124}, {125, 123, 125, 123}, {122, 124, 122, 124}, }, { {127, 125, 126, 124}, {124, 126, 123, 125}, {126, 124, 126, 124}, {123, 125, 123, 125}, }, { {128, 126, 127, 125}, {125, 127, 124, 126}, {127, 125, 127, 125}, {124, 126, 124, 126}, }, { {129, 127, 128, 126}, {126, 128, 125, 127}, {128, 126, 128, 126}, {125, 127, 125, 127}, }, { {130, 128, 129, 127}, {127, 129, 126, 128}, {129, 127, 129, 127}, {126, 128, 126, 128}, }, { {131, 129, 130, 128}, {128, 130, 127, 129}, {130, 128, 130, 128}, {127, 129, 127, 129}, }, { {132, 130, 131, 129}, {129, 131, 128, 130}, {131, 129, 131, 129}, {128, 130, 128, 130}, }, { {133, 131, 132, 130}, {130, 132, 129, 131}, {132, 130, 132, 130}, {129, 131, 129, 131}, }, { {134, 132, 133, 131}, {131, 133, 130, 132}, {133, 131, 133, 131}, {130, 132, 130, 132}, }, { {135, 133, 134, 132}, {132, 134, 131, 133}, {134, 132, 134, 132}, {131, 133, 131, 133}, }, { {136, 134, 135, 133}, {133, 135, 132, 134}, {135, 133, 135, 133}, {132, 134, 132, 134}, }, { {137, 135, 136, 134}, {134, 136, 133, 135}, {136, 134, 136, 134}, {133, 135, 133, 135}, }, { {138, 136, 137, 135}, {135, 137, 134, 136}, {137, 135, 137, 135}, {134, 136, 134, 136}, }, { {139, 137, 138, 136}, {136, 138, 135, 137}, {138, 136, 138, 136}, {135, 137, 135, 137}, }, { {140, 138, 139, 137}, {137, 139, 136, 138}, {139, 137, 139, 137}, {136, 138, 136, 138}, }, { {141, 139, 140, 138}, {138, 140, 137, 139}, {140, 138, 140, 138}, {137, 139, 137, 139}, }, { {142, 140, 141, 139}, {139, 141, 138, 140}, {141, 139, 141, 139}, {138, 140, 138, 140}, }, { {143, 141, 142, 140}, {140, 142, 139, 141}, {142, 140, 142, 140}, {139, 141, 139, 141}, }, { {144, 142, 143, 141}, {141, 143, 140, 142}, {143, 141, 143, 141}, {140, 142, 140, 142}, }, { {145, 143, 144, 142}, {142, 144, 141, 143}, {144, 142, 144, 142}, {141, 143, 141, 143}, }, { {146, 144, 145, 143}, {143, 145, 142, 144}, {145, 143, 145, 143}, {142, 144, 142, 144}, }, { {147, 145, 146, 144}, {144, 146, 143, 145}, {146, 144, 146, 144}, {143, 145, 143, 145}, }, { {148, 146, 147, 145}, {145, 147, 144, 146}, {147, 145, 147, 145}, {144, 146, 144, 146}, }, { {149, 147, 148, 146}, {146, 148, 145, 147}, {148, 146, 148, 146}, {145, 147, 145, 147}, }, { {150, 148, 149, 147}, {147, 149, 146, 148}, {149, 147, 149, 147}, {146, 148, 146, 148}, }, { {151, 149, 150, 148}, {148, 150, 147, 149}, {150, 148, 150, 148}, {147, 149, 147, 149}, }, { {152, 150, 151, 149}, {149, 151, 148, 150}, {151, 149, 151, 149}, {148, 150, 148, 150}, }, { {153, 151, 152, 150}, {150, 152, 149, 151}, {152, 150, 152, 150}, {149, 151, 149, 151}, }, { {154, 152, 153, 151}, {151, 153, 150, 152}, {153, 151, 153, 151}, {150, 152, 150, 152}, }, { {155, 153, 154, 152}, {152, 154, 151, 153}, {154, 152, 154, 152}, {151, 153, 151, 153}, }, { {156, 154, 155, 153}, {153, 155, 152, 154}, {155, 153, 155, 153}, {152, 154, 152, 154}, }, { {157, 155, 156, 154}, {154, 156, 153, 155}, {156, 154, 156, 154}, {153, 155, 153, 155}, }, { {158, 156, 157, 155}, {155, 157, 154, 156}, {157, 155, 157, 155}, {154, 156, 154, 156}, }, { {159, 157, 158, 156}, {156, 158, 155, 157}, {158, 156, 158, 156}, {155, 157, 155, 157}, }, { {160, 158, 159, 157}, {157, 159, 156, 158}, {159, 157, 159, 157}, {156, 158, 156, 158}, }, { {161, 159, 160, 158}, {158, 160, 157, 159}, {160, 158, 160, 158}, {157, 159, 157, 159}, }, { {162, 160, 161, 159}, {159, 161, 158, 160}, {161, 159, 161, 159}, {158, 160, 158, 160}, }, { {163, 161, 162, 160}, {160, 162, 159, 161}, {162, 160, 162, 160}, {159, 161, 159, 161}, }, { {164, 162, 163, 161}, {161, 163, 160, 162}, {163, 161, 163, 161}, {160, 162, 160, 162}, }, { {165, 163, 164, 162}, {162, 164, 161, 163}, {164, 162, 164, 162}, {161, 163, 161, 163}, }, { {166, 164, 165, 163}, {163, 165, 162, 164}, {165, 163, 165, 163}, {162, 164, 162, 164}, }, { {167, 165, 166, 164}, {164, 166, 163, 165}, {166, 164, 166, 164}, {163, 165, 163, 165}, }, { {168, 166, 167, 165}, {165, 167, 164, 166}, {167, 165, 167, 165}, {164, 166, 164, 166}, }, { {169, 167, 168, 166}, {166, 168, 165, 167}, {168, 166, 168, 166}, {165, 167, 165, 167}, }, { {170, 168, 169, 167}, {167, 169, 166, 168}, {169, 167, 169, 167}, {166, 168, 166, 168}, }, { {171, 169, 170, 168}, {168, 170, 167, 169}, {170, 168, 170, 168}, {167, 169, 167, 169}, }, { {172, 170, 171, 169}, {169, 171, 168, 170}, {171, 169, 171, 169}, {168, 170, 168, 170}, }, { {173, 171, 172, 170}, {170, 172, 169, 171}, {172, 170, 172, 170}, {169, 171, 169, 171}, }, { {174, 172, 173, 171}, {171, 173, 170, 172}, {173, 171, 173, 171}, {170, 172, 170, 172}, }, { {175, 173, 174, 172}, {172, 174, 171, 173}, {174, 172, 174, 172}, {171, 173, 171, 173}, }, { {176, 174, 175, 173}, {173, 175, 172, 174}, {175, 173, 175, 173}, {172, 174, 172, 174}, }, { {177, 175, 176, 174}, {174, 176, 173, 175}, {176, 174, 176, 174}, {173, 175, 173, 175}, }, { {178, 176, 177, 175}, {175, 177, 174, 176}, {177, 175, 177, 175}, {174, 176, 174, 176}, }, { {179, 177, 178, 176}, {176, 178, 175, 177}, {178, 176, 178, 176}, {175, 177, 175, 177}, }, { {180, 178, 179, 177}, {177, 179, 176, 178}, {179, 177, 179, 177}, {176, 178, 176, 178}, }, { {181, 179, 180, 178}, {178, 180, 177, 179}, {180, 178, 180, 178}, {177, 179, 177, 179}, }, { {182, 180, 181, 179}, {179, 181, 178, 180}, {181, 179, 181, 179}, {178, 180, 178, 180}, }, { {183, 181, 182, 180}, {180, 182, 179, 181}, {182, 180, 182, 180}, {179, 181, 179, 181}, }, { {184, 182, 183, 181}, {181, 183, 180, 182}, {183, 181, 183, 181}, {180, 182, 180, 182}, }, { {185, 183, 184, 182}, {182, 184, 181, 183}, {184, 182, 184, 182}, {181, 183, 181, 183}, }, { {186, 184, 185, 183}, {183, 185, 182, 184}, {185, 183, 185, 183}, {182, 184, 182, 184}, }, { {187, 185, 186, 184}, {184, 186, 183, 185}, {186, 184, 186, 184}, {183, 185, 183, 185}, }, { {188, 186, 187, 185}, {185, 187, 184, 186}, {187, 185, 187, 185}, {184, 186, 184, 186}, }, { {189, 187, 188, 186}, {186, 188, 185, 187}, {188, 186, 188, 186}, {185, 187, 185, 187}, }, { {190, 188, 189, 187}, {187, 189, 186, 188}, {189, 187, 189, 187}, {186, 188, 186, 188}, }, { {191, 189, 190, 188}, {188, 190, 187, 189}, {190, 188, 190, 188}, {187, 189, 187, 189}, }, { {192, 190, 191, 189}, {189, 191, 188, 190}, {191, 189, 191, 189}, {188, 190, 188, 190}, }, { {193, 191, 192, 190}, {190, 192, 189, 191}, {192, 190, 192, 190}, {189, 191, 189, 191}, }, { {194, 192, 193, 191}, {191, 193, 190, 192}, {193, 191, 193, 191}, {190, 192, 190, 192}, }, { {195, 193, 194, 192}, {192, 194, 191, 193}, {194, 192, 194, 192}, {191, 193, 191, 193}, }, { {196, 194, 195, 193}, {193, 195, 192, 194}, {195, 193, 195, 193}, {192, 194, 192, 194}, }, { {197, 195, 196, 194}, {194, 196, 193, 195}, {196, 194, 196, 194}, {193, 195, 193, 195}, }, { {198, 196, 197, 195}, {195, 197, 194, 196}, {197, 195, 197, 195}, {194, 196, 194, 196}, }, { {199, 197, 198, 196}, {196, 198, 195, 197}, {198, 196, 198, 196}, {195, 197, 195, 197}, }, { {200, 198, 199, 197}, {197, 199, 196, 198}, {199, 197, 199, 197}, {196, 198, 196, 198}, }, { {201, 199, 200, 198}, {198, 200, 197, 199}, {200, 198, 200, 198}, {197, 199, 197, 199}, }, { {202, 200, 201, 199}, {199, 201, 198, 200}, {201, 199, 201, 199}, {198, 200, 198, 200}, }, { {203, 201, 202, 200}, {200, 202, 199, 201}, {202, 200, 202, 200}, {199, 201, 199, 201}, }, { {204, 202, 203, 201}, {201, 203, 200, 202}, {203, 201, 203, 201}, {200, 202, 200, 202}, }, { {205, 203, 204, 202}, {202, 204, 201, 203}, {204, 202, 204, 202}, {201, 203, 201, 203}, }, { {206, 204, 205, 203}, {203, 205, 202, 204}, {205, 203, 205, 203}, {202, 204, 202, 204}, }, { {207, 205, 206, 204}, {204, 206, 203, 205}, {206, 204, 206, 204}, {203, 205, 203, 205}, }, { {208, 206, 207, 205}, {205, 207, 204, 206}, {207, 205, 207, 205}, {204, 206, 204, 206}, }, { {209, 207, 208, 206}, {206, 208, 205, 207}, {208, 206, 208, 206}, {205, 207, 205, 207}, }, { {210, 208, 209, 207}, {207, 209, 206, 208}, {209, 207, 209, 207}, {206, 208, 206, 208}, }, { {211, 209, 210, 208}, {208, 210, 207, 209}, {210, 208, 210, 208}, {207, 209, 207, 209}, }, { {212, 210, 211, 209}, {209, 211, 208, 210}, {211, 209, 211, 209}, {208, 210, 208, 210}, }, { {213, 211, 212, 210}, {210, 212, 209, 211}, {212, 210, 212, 210}, {209, 211, 209, 211}, }, { {214, 212, 213, 211}, {211, 213, 210, 212}, {213, 211, 213, 211}, {210, 212, 210, 212}, }, { {215, 213, 214, 212}, {212, 214, 211, 213}, {214, 212, 214, 212}, {211, 213, 211, 213}, }, { {216, 214, 215, 213}, {213, 215, 212, 214}, {215, 213, 215, 213}, {212, 214, 212, 214}, }, { {217, 215, 216, 214}, {214, 216, 213, 215}, {216, 214, 216, 214}, {213, 215, 213, 215}, }, { {218, 216, 217, 215}, {215, 217, 214, 216}, {217, 215, 217, 215}, {214, 216, 214, 216}, }, { {219, 217, 218, 216}, {216, 218, 215, 217}, {218, 216, 218, 216}, {215, 217, 215, 217}, }, { {220, 218, 219, 217}, {217, 219, 216, 218}, {219, 217, 219, 217}, {216, 218, 216, 218}, }, { {221, 219, 220, 218}, {218, 220, 217, 219}, {220, 218, 220, 218}, {217, 219, 217, 219}, }, { {222, 220, 221, 219}, {219, 221, 218, 220}, {221, 219, 221, 219}, {218, 220, 218, 220}, }, { {223, 221, 222, 220}, {220, 222, 219, 221}, {222, 220, 222, 220}, {219, 221, 219, 221}, }, { {224, 222, 223, 221}, {221, 223, 220, 222}, {223, 221, 223, 221}, {220, 222, 220, 222}, }, { {225, 223, 224, 222}, {222, 224, 221, 223}, {224, 222, 224, 222}, {221, 223, 221, 223}, }, { {226, 224, 225, 223}, {223, 225, 222, 224}, {225, 223, 225, 223}, {222, 224, 222, 224}, }, { {227, 225, 226, 224}, {224, 226, 223, 225}, {226, 224, 226, 224}, {223, 225, 223, 225}, }, { {228, 226, 227, 225}, {225, 227, 224, 226}, {227, 225, 227, 225}, {224, 226, 224, 226}, }, { {229, 227, 228, 226}, {226, 228, 225, 227}, {228, 226, 228, 226}, {225, 227, 225, 227}, }, { {230, 228, 229, 227}, {227, 229, 226, 228}, {229, 227, 229, 227}, {226, 228, 226, 228}, }, { {231, 229, 230, 228}, {228, 230, 227, 229}, {230, 228, 230, 228}, {227, 229, 227, 229}, }, { {232, 230, 231, 229}, {229, 231, 228, 230}, {231, 229, 231, 229}, {228, 230, 228, 230}, }, { {233, 231, 232, 230}, {230, 232, 229, 231}, {232, 230, 232, 230}, {229, 231, 229, 231}, }, { {234, 232, 233, 231}, {231, 233, 230, 232}, {233, 231, 233, 231}, {230, 232, 230, 232}, }, { {235, 233, 234, 232}, {232, 234, 231, 233}, {234, 232, 234, 232}, {231, 233, 231, 233}, }, { {236, 234, 235, 233}, {233, 235, 232, 234}, {235, 233, 235, 233}, {232, 234, 232, 234}, }, { {237, 235, 236, 234}, {234, 236, 233, 235}, {236, 234, 236, 234}, {233, 235, 233, 235}, }, { {238, 236, 237, 235}, {235, 237, 234, 236}, {237, 235, 237, 235}, {234, 236, 234, 236}, }, { {239, 237, 238, 236}, {236, 238, 235, 237}, {238, 236, 238, 236}, {235, 237, 235, 237}, }, { {240, 238, 239, 237}, {237, 239, 236, 238}, {239, 237, 239, 237}, {236, 238, 236, 238}, }, { {241, 239, 240, 238}, {238, 240, 237, 239}, {240, 238, 240, 238}, {237, 239, 237, 239}, }, { {242, 240, 241, 239}, {239, 241, 238, 240}, {241, 239, 241, 239}, {238, 240, 238, 240}, }, { {243, 241, 242, 240}, {240, 242, 239, 241}, {242, 240, 242, 240}, {239, 241, 239, 241}, }, { {244, 242, 243, 241}, {241, 243, 240, 242}, {243, 241, 243, 241}, {240, 242, 240, 242}, }, { {245, 243, 244, 242}, {242, 244, 241, 243}, {244, 242, 244, 242}, {241, 243, 241, 243}, }, { {246, 244, 245, 243}, {243, 245, 242, 244}, {245, 243, 245, 243}, {242, 244, 242, 244}, }, { {247, 245, 246, 244}, {244, 246, 243, 245}, {246, 244, 246, 244}, {243, 245, 243, 245}, }, { {248, 246, 247, 245}, {245, 247, 244, 246}, {247, 245, 247, 245}, {244, 246, 244, 246}, }, { {249, 247, 248, 246}, {246, 248, 245, 247}, {248, 246, 248, 246}, {245, 247, 245, 247}, }, { {250, 248, 249, 247}, {247, 249, 246, 248}, {249, 247, 249, 247}, {246, 248, 246, 248}, }, { {251, 249, 250, 248}, {248, 250, 247, 249}, {250, 248, 250, 248}, {247, 249, 247, 249}, }, { {252, 250, 251, 249}, {249, 251, 248, 250}, {251, 249, 251, 249}, {248, 250, 248, 250}, }, { {253, 251, 252, 250}, {250, 252, 249, 251}, {252, 250, 252, 250}, {249, 251, 249, 251}, }, { {254, 252, 253, 251}, {251, 253, 250, 252}, {253, 251, 253, 251}, {250, 252, 250, 252}, }, { {255, 253, 254, 252}, {252, 254, 251, 253}, {254, 252, 254, 252}, {251, 253, 251, 253}, }, { {255, 254, 255, 253}, {253, 255, 252, 254}, {255, 253, 255, 253}, {252, 254, 252, 254}, }, { {255, 255, 255, 254}, {254, 255, 253, 255}, {255, 254, 255, 254}, {253, 255, 253, 255}, }, { {255, 255, 255, 255}, {255, 255, 254, 255}, {255, 255, 255, 255}, {254, 255, 254, 255}, }, }; static const uint8_t dithersub_g2x2[256][2][2] = { { {0, 0}, {0, 0}, }, { {0, 0}, {0, 0}, }, { {4, 2}, {1, 3}, }, { {5, 3}, {2, 4}, }, { {6, 4}, {3, 5}, }, { {7, 5}, {4, 6}, }, { {8, 6}, {5, 7}, }, { {9, 7}, {6, 8}, }, { {10, 8}, {7, 9}, }, { {11, 9}, {8, 10}, }, { {12, 10}, {9, 11}, }, { {13, 11}, {10, 12}, }, { {14, 12}, {11, 13}, }, { {15, 13}, {12, 14}, }, { {16, 14}, {13, 15}, }, { {17, 15}, {14, 16}, }, { {18, 16}, {15, 17}, }, { {19, 17}, {16, 18}, }, { {20, 18}, {17, 19}, }, { {21, 19}, {18, 20}, }, { {22, 20}, {19, 21}, }, { {23, 21}, {20, 22}, }, { {24, 22}, {21, 23}, }, { {25, 23}, {22, 24}, }, { {26, 24}, {23, 25}, }, { {27, 25}, {24, 26}, }, { {28, 26}, {25, 27}, }, { {29, 27}, {26, 28}, }, { {30, 28}, {27, 29}, }, { {31, 29}, {28, 30}, }, { {32, 30}, {29, 31}, }, { {33, 31}, {30, 32}, }, { {34, 32}, {31, 33}, }, { {35, 33}, {32, 34}, }, { {36, 34}, {33, 35}, }, { {37, 35}, {34, 36}, }, { {38, 36}, {35, 37}, }, { {39, 37}, {36, 38}, }, { {40, 38}, {37, 39}, }, { {41, 39}, {38, 40}, }, { {42, 40}, {39, 41}, }, { {43, 41}, {40, 42}, }, { {44, 42}, {41, 43}, }, { {45, 43}, {42, 44}, }, { {46, 44}, {43, 45}, }, { {47, 45}, {44, 46}, }, { {48, 46}, {45, 47}, }, { {49, 47}, {46, 48}, }, { {50, 48}, {47, 49}, }, { {51, 49}, {48, 50}, }, { {52, 50}, {49, 51}, }, { {53, 51}, {50, 52}, }, { {54, 52}, {51, 53}, }, { {55, 53}, {52, 54}, }, { {56, 54}, {53, 55}, }, { {57, 55}, {54, 56}, }, { {58, 56}, {55, 57}, }, { {59, 57}, {56, 58}, }, { {60, 58}, {57, 59}, }, { {61, 59}, {58, 60}, }, { {62, 60}, {59, 61}, }, { {63, 61}, {60, 62}, }, { {64, 62}, {61, 63}, }, { {65, 63}, {62, 64}, }, { {66, 64}, {63, 65}, }, { {67, 65}, {64, 66}, }, { {68, 66}, {65, 67}, }, { {69, 67}, {66, 68}, }, { {70, 68}, {67, 69}, }, { {71, 69}, {68, 70}, }, { {72, 70}, {69, 71}, }, { {73, 71}, {70, 72}, }, { {74, 72}, {71, 73}, }, { {75, 73}, {72, 74}, }, { {76, 74}, {73, 75}, }, { {77, 75}, {74, 76}, }, { {78, 76}, {75, 77}, }, { {79, 77}, {76, 78}, }, { {80, 78}, {77, 79}, }, { {81, 79}, {78, 80}, }, { {82, 80}, {79, 81}, }, { {83, 81}, {80, 82}, }, { {84, 82}, {81, 83}, }, { {85, 83}, {82, 84}, }, { {86, 84}, {83, 85}, }, { {87, 85}, {84, 86}, }, { {88, 86}, {85, 87}, }, { {89, 87}, {86, 88}, }, { {90, 88}, {87, 89}, }, { {91, 89}, {88, 90}, }, { {92, 90}, {89, 91}, }, { {93, 91}, {90, 92}, }, { {94, 92}, {91, 93}, }, { {95, 93}, {92, 94}, }, { {96, 94}, {93, 95}, }, { {97, 95}, {94, 96}, }, { {98, 96}, {95, 97}, }, { {99, 97}, {96, 98}, }, { {100, 98}, {97, 99}, }, { {101, 99}, {98, 100}, }, { {102, 100}, {99, 101}, }, { {103, 101}, {100, 102}, }, { {104, 102}, {101, 103}, }, { {105, 103}, {102, 104}, }, { {106, 104}, {103, 105}, }, { {107, 105}, {104, 106}, }, { {108, 106}, {105, 107}, }, { {109, 107}, {106, 108}, }, { {110, 108}, {107, 109}, }, { {111, 109}, {108, 110}, }, { {112, 110}, {109, 111}, }, { {113, 111}, {110, 112}, }, { {114, 112}, {111, 113}, }, { {115, 113}, {112, 114}, }, { {116, 114}, {113, 115}, }, { {117, 115}, {114, 116}, }, { {118, 116}, {115, 117}, }, { {119, 117}, {116, 118}, }, { {120, 118}, {117, 119}, }, { {121, 119}, {118, 120}, }, { {122, 120}, {119, 121}, }, { {123, 121}, {120, 122}, }, { {124, 122}, {121, 123}, }, { {125, 123}, {122, 124}, }, { {126, 124}, {123, 125}, }, { {127, 125}, {124, 126}, }, { {128, 126}, {125, 127}, }, { {129, 127}, {126, 128}, }, { {130, 128}, {127, 129}, }, { {131, 129}, {128, 130}, }, { {132, 130}, {129, 131}, }, { {133, 131}, {130, 132}, }, { {134, 132}, {131, 133}, }, { {135, 133}, {132, 134}, }, { {136, 134}, {133, 135}, }, { {137, 135}, {134, 136}, }, { {138, 136}, {135, 137}, }, { {139, 137}, {136, 138}, }, { {140, 138}, {137, 139}, }, { {141, 139}, {138, 140}, }, { {142, 140}, {139, 141}, }, { {143, 141}, {140, 142}, }, { {144, 142}, {141, 143}, }, { {145, 143}, {142, 144}, }, { {146, 144}, {143, 145}, }, { {147, 145}, {144, 146}, }, { {148, 146}, {145, 147}, }, { {149, 147}, {146, 148}, }, { {150, 148}, {147, 149}, }, { {151, 149}, {148, 150}, }, { {152, 150}, {149, 151}, }, { {153, 151}, {150, 152}, }, { {154, 152}, {151, 153}, }, { {155, 153}, {152, 154}, }, { {156, 154}, {153, 155}, }, { {157, 155}, {154, 156}, }, { {158, 156}, {155, 157}, }, { {159, 157}, {156, 158}, }, { {160, 158}, {157, 159}, }, { {161, 159}, {158, 160}, }, { {162, 160}, {159, 161}, }, { {163, 161}, {160, 162}, }, { {164, 162}, {161, 163}, }, { {165, 163}, {162, 164}, }, { {166, 164}, {163, 165}, }, { {167, 165}, {164, 166}, }, { {168, 166}, {165, 167}, }, { {169, 167}, {166, 168}, }, { {170, 168}, {167, 169}, }, { {171, 169}, {168, 170}, }, { {172, 170}, {169, 171}, }, { {173, 171}, {170, 172}, }, { {174, 172}, {171, 173}, }, { {175, 173}, {172, 174}, }, { {176, 174}, {173, 175}, }, { {177, 175}, {174, 176}, }, { {178, 176}, {175, 177}, }, { {179, 177}, {176, 178}, }, { {180, 178}, {177, 179}, }, { {181, 179}, {178, 180}, }, { {182, 180}, {179, 181}, }, { {183, 181}, {180, 182}, }, { {184, 182}, {181, 183}, }, { {185, 183}, {182, 184}, }, { {186, 184}, {183, 185}, }, { {187, 185}, {184, 186}, }, { {188, 186}, {185, 187}, }, { {189, 187}, {186, 188}, }, { {190, 188}, {187, 189}, }, { {191, 189}, {188, 190}, }, { {192, 190}, {189, 191}, }, { {193, 191}, {190, 192}, }, { {194, 192}, {191, 193}, }, { {195, 193}, {192, 194}, }, { {196, 194}, {193, 195}, }, { {197, 195}, {194, 196}, }, { {198, 196}, {195, 197}, }, { {199, 197}, {196, 198}, }, { {200, 198}, {197, 199}, }, { {201, 199}, {198, 200}, }, { {202, 200}, {199, 201}, }, { {203, 201}, {200, 202}, }, { {204, 202}, {201, 203}, }, { {205, 203}, {202, 204}, }, { {206, 204}, {203, 205}, }, { {207, 205}, {204, 206}, }, { {208, 206}, {205, 207}, }, { {209, 207}, {206, 208}, }, { {210, 208}, {207, 209}, }, { {211, 209}, {208, 210}, }, { {212, 210}, {209, 211}, }, { {213, 211}, {210, 212}, }, { {214, 212}, {211, 213}, }, { {215, 213}, {212, 214}, }, { {216, 214}, {213, 215}, }, { {217, 215}, {214, 216}, }, { {218, 216}, {215, 217}, }, { {219, 217}, {216, 218}, }, { {220, 218}, {217, 219}, }, { {221, 219}, {218, 220}, }, { {222, 220}, {219, 221}, }, { {223, 221}, {220, 222}, }, { {224, 222}, {221, 223}, }, { {225, 223}, {222, 224}, }, { {226, 224}, {223, 225}, }, { {227, 225}, {224, 226}, }, { {228, 226}, {225, 227}, }, { {229, 227}, {226, 228}, }, { {230, 228}, {227, 229}, }, { {231, 229}, {228, 230}, }, { {232, 230}, {229, 231}, }, { {233, 231}, {230, 232}, }, { {234, 232}, {231, 233}, }, { {235, 233}, {232, 234}, }, { {236, 234}, {233, 235}, }, { {237, 235}, {234, 236}, }, { {238, 236}, {235, 237}, }, { {239, 237}, {236, 238}, }, { {240, 238}, {237, 239}, }, { {241, 239}, {238, 240}, }, { {242, 240}, {239, 241}, }, { {243, 241}, {240, 242}, }, { {244, 242}, {241, 243}, }, { {245, 243}, {242, 244}, }, { {246, 244}, {243, 245}, }, { {247, 245}, {244, 246}, }, { {248, 246}, {245, 247}, }, { {249, 247}, {246, 248}, }, { {250, 248}, {247, 249}, }, { {251, 249}, {248, 250}, }, { {252, 250}, {249, 251}, }, { {253, 251}, {250, 252}, }, { {254, 252}, {251, 253}, }, { {255, 253}, {252, 254}, }, { {255, 254}, {253, 255}, }, { {255, 255}, {254, 255}, }, }; static const uint8_t dithersub_rb2x2[256][2][2] = { { {0, 0}, {0, 0}, }, { {0, 0}, {0, 0}, }, { {0, 0}, {0, 0}, }, { {0, 0}, {0, 0}, }, { {8, 4}, {2, 6}, }, { {9, 5}, {3, 7}, }, { {10, 6}, {4, 8}, }, { {11, 7}, {5, 9}, }, { {12, 8}, {6, 10}, }, { {13, 9}, {7, 11}, }, { {14, 10}, {8, 12}, }, { {15, 11}, {9, 13}, }, { {16, 12}, {10, 14}, }, { {17, 13}, {11, 15}, }, { {18, 14}, {12, 16}, }, { {19, 15}, {13, 17}, }, { {20, 16}, {14, 18}, }, { {21, 17}, {15, 19}, }, { {22, 18}, {16, 20}, }, { {23, 19}, {17, 21}, }, { {24, 20}, {18, 22}, }, { {25, 21}, {19, 23}, }, { {26, 22}, {20, 24}, }, { {27, 23}, {21, 25}, }, { {28, 24}, {22, 26}, }, { {29, 25}, {23, 27}, }, { {30, 26}, {24, 28}, }, { {31, 27}, {25, 29}, }, { {32, 28}, {26, 30}, }, { {33, 29}, {27, 31}, }, { {34, 30}, {28, 32}, }, { {35, 31}, {29, 33}, }, { {36, 32}, {30, 34}, }, { {37, 33}, {31, 35}, }, { {38, 34}, {32, 36}, }, { {39, 35}, {33, 37}, }, { {40, 36}, {34, 38}, }, { {41, 37}, {35, 39}, }, { {42, 38}, {36, 40}, }, { {43, 39}, {37, 41}, }, { {44, 40}, {38, 42}, }, { {45, 41}, {39, 43}, }, { {46, 42}, {40, 44}, }, { {47, 43}, {41, 45}, }, { {48, 44}, {42, 46}, }, { {49, 45}, {43, 47}, }, { {50, 46}, {44, 48}, }, { {51, 47}, {45, 49}, }, { {52, 48}, {46, 50}, }, { {53, 49}, {47, 51}, }, { {54, 50}, {48, 52}, }, { {55, 51}, {49, 53}, }, { {56, 52}, {50, 54}, }, { {57, 53}, {51, 55}, }, { {58, 54}, {52, 56}, }, { {59, 55}, {53, 57}, }, { {60, 56}, {54, 58}, }, { {61, 57}, {55, 59}, }, { {62, 58}, {56, 60}, }, { {63, 59}, {57, 61}, }, { {64, 60}, {58, 62}, }, { {65, 61}, {59, 63}, }, { {66, 62}, {60, 64}, }, { {67, 63}, {61, 65}, }, { {68, 64}, {62, 66}, }, { {69, 65}, {63, 67}, }, { {70, 66}, {64, 68}, }, { {71, 67}, {65, 69}, }, { {72, 68}, {66, 70}, }, { {73, 69}, {67, 71}, }, { {74, 70}, {68, 72}, }, { {75, 71}, {69, 73}, }, { {76, 72}, {70, 74}, }, { {77, 73}, {71, 75}, }, { {78, 74}, {72, 76}, }, { {79, 75}, {73, 77}, }, { {80, 76}, {74, 78}, }, { {81, 77}, {75, 79}, }, { {82, 78}, {76, 80}, }, { {83, 79}, {77, 81}, }, { {84, 80}, {78, 82}, }, { {85, 81}, {79, 83}, }, { {86, 82}, {80, 84}, }, { {87, 83}, {81, 85}, }, { {88, 84}, {82, 86}, }, { {89, 85}, {83, 87}, }, { {90, 86}, {84, 88}, }, { {91, 87}, {85, 89}, }, { {92, 88}, {86, 90}, }, { {93, 89}, {87, 91}, }, { {94, 90}, {88, 92}, }, { {95, 91}, {89, 93}, }, { {96, 92}, {90, 94}, }, { {97, 93}, {91, 95}, }, { {98, 94}, {92, 96}, }, { {99, 95}, {93, 97}, }, { {100, 96}, {94, 98}, }, { {101, 97}, {95, 99}, }, { {102, 98}, {96, 100}, }, { {103, 99}, {97, 101}, }, { {104, 100}, {98, 102}, }, { {105, 101}, {99, 103}, }, { {106, 102}, {100, 104}, }, { {107, 103}, {101, 105}, }, { {108, 104}, {102, 106}, }, { {109, 105}, {103, 107}, }, { {110, 106}, {104, 108}, }, { {111, 107}, {105, 109}, }, { {112, 108}, {106, 110}, }, { {113, 109}, {107, 111}, }, { {114, 110}, {108, 112}, }, { {115, 111}, {109, 113}, }, { {116, 112}, {110, 114}, }, { {117, 113}, {111, 115}, }, { {118, 114}, {112, 116}, }, { {119, 115}, {113, 117}, }, { {120, 116}, {114, 118}, }, { {121, 117}, {115, 119}, }, { {122, 118}, {116, 120}, }, { {123, 119}, {117, 121}, }, { {124, 120}, {118, 122}, }, { {125, 121}, {119, 123}, }, { {126, 122}, {120, 124}, }, { {127, 123}, {121, 125}, }, { {128, 124}, {122, 126}, }, { {129, 125}, {123, 127}, }, { {130, 126}, {124, 128}, }, { {131, 127}, {125, 129}, }, { {132, 128}, {126, 130}, }, { {133, 129}, {127, 131}, }, { {134, 130}, {128, 132}, }, { {135, 131}, {129, 133}, }, { {136, 132}, {130, 134}, }, { {137, 133}, {131, 135}, }, { {138, 134}, {132, 136}, }, { {139, 135}, {133, 137}, }, { {140, 136}, {134, 138}, }, { {141, 137}, {135, 139}, }, { {142, 138}, {136, 140}, }, { {143, 139}, {137, 141}, }, { {144, 140}, {138, 142}, }, { {145, 141}, {139, 143}, }, { {146, 142}, {140, 144}, }, { {147, 143}, {141, 145}, }, { {148, 144}, {142, 146}, }, { {149, 145}, {143, 147}, }, { {150, 146}, {144, 148}, }, { {151, 147}, {145, 149}, }, { {152, 148}, {146, 150}, }, { {153, 149}, {147, 151}, }, { {154, 150}, {148, 152}, }, { {155, 151}, {149, 153}, }, { {156, 152}, {150, 154}, }, { {157, 153}, {151, 155}, }, { {158, 154}, {152, 156}, }, { {159, 155}, {153, 157}, }, { {160, 156}, {154, 158}, }, { {161, 157}, {155, 159}, }, { {162, 158}, {156, 160}, }, { {163, 159}, {157, 161}, }, { {164, 160}, {158, 162}, }, { {165, 161}, {159, 163}, }, { {166, 162}, {160, 164}, }, { {167, 163}, {161, 165}, }, { {168, 164}, {162, 166}, }, { {169, 165}, {163, 167}, }, { {170, 166}, {164, 168}, }, { {171, 167}, {165, 169}, }, { {172, 168}, {166, 170}, }, { {173, 169}, {167, 171}, }, { {174, 170}, {168, 172}, }, { {175, 171}, {169, 173}, }, { {176, 172}, {170, 174}, }, { {177, 173}, {171, 175}, }, { {178, 174}, {172, 176}, }, { {179, 175}, {173, 177}, }, { {180, 176}, {174, 178}, }, { {181, 177}, {175, 179}, }, { {182, 178}, {176, 180}, }, { {183, 179}, {177, 181}, }, { {184, 180}, {178, 182}, }, { {185, 181}, {179, 183}, }, { {186, 182}, {180, 184}, }, { {187, 183}, {181, 185}, }, { {188, 184}, {182, 186}, }, { {189, 185}, {183, 187}, }, { {190, 186}, {184, 188}, }, { {191, 187}, {185, 189}, }, { {192, 188}, {186, 190}, }, { {193, 189}, {187, 191}, }, { {194, 190}, {188, 192}, }, { {195, 191}, {189, 193}, }, { {196, 192}, {190, 194}, }, { {197, 193}, {191, 195}, }, { {198, 194}, {192, 196}, }, { {199, 195}, {193, 197}, }, { {200, 196}, {194, 198}, }, { {201, 197}, {195, 199}, }, { {202, 198}, {196, 200}, }, { {203, 199}, {197, 201}, }, { {204, 200}, {198, 202}, }, { {205, 201}, {199, 203}, }, { {206, 202}, {200, 204}, }, { {207, 203}, {201, 205}, }, { {208, 204}, {202, 206}, }, { {209, 205}, {203, 207}, }, { {210, 206}, {204, 208}, }, { {211, 207}, {205, 209}, }, { {212, 208}, {206, 210}, }, { {213, 209}, {207, 211}, }, { {214, 210}, {208, 212}, }, { {215, 211}, {209, 213}, }, { {216, 212}, {210, 214}, }, { {217, 213}, {211, 215}, }, { {218, 214}, {212, 216}, }, { {219, 215}, {213, 217}, }, { {220, 216}, {214, 218}, }, { {221, 217}, {215, 219}, }, { {222, 218}, {216, 220}, }, { {223, 219}, {217, 221}, }, { {224, 220}, {218, 222}, }, { {225, 221}, {219, 223}, }, { {226, 222}, {220, 224}, }, { {227, 223}, {221, 225}, }, { {228, 224}, {222, 226}, }, { {229, 225}, {223, 227}, }, { {230, 226}, {224, 228}, }, { {231, 227}, {225, 229}, }, { {232, 228}, {226, 230}, }, { {233, 229}, {227, 231}, }, { {234, 230}, {228, 232}, }, { {235, 231}, {229, 233}, }, { {236, 232}, {230, 234}, }, { {237, 233}, {231, 235}, }, { {238, 234}, {232, 236}, }, { {239, 235}, {233, 237}, }, { {240, 236}, {234, 238}, }, { {241, 237}, {235, 239}, }, { {242, 238}, {236, 240}, }, { {243, 239}, {237, 241}, }, { {244, 240}, {238, 242}, }, { {245, 241}, {239, 243}, }, { {246, 242}, {240, 244}, }, { {247, 243}, {241, 245}, }, { {248, 244}, {242, 246}, }, { {249, 245}, {243, 247}, }, { {250, 246}, {244, 248}, }, { {251, 247}, {245, 249}, }, { {252, 248}, {246, 250}, }, { {253, 249}, {247, 251}, }, { {254, 250}, {248, 252}, }, { {255, 251}, {249, 253}, }, { {255, 252}, {250, 254}, }, { {255, 253}, {251, 255}, }, { {255, 254}, {252, 255}, }, { {255, 255}, {253, 255}, }, }; #endif /* VIDEO_VOODOO_DITHER_H*/ ```
/content/code_sandbox/src/include/86box/vid_voodoo_dither.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
76,077
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Header of the implementation of the Intel 8253/8254 * Programmable Interval Timer. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_PIT_H #define EMU_PIT_H #define NUM_COUNTERS 3 typedef struct ctr_t { uint8_t m; uint8_t ctrl; uint8_t read_status; uint8_t latch; uint8_t s1_det; uint8_t l_det; uint8_t bcd; uint8_t incomplete; uint16_t rl; int rm; int wm; int gate; int out; int newcount; int clock; int using_timer; int latched; int state; int null_count; int do_read_status; int enable; union { int32_t count; struct { int32_t units : 4; int32_t tens : 4; int32_t hundreds : 4; int32_t thousands : 4; int32_t myriads : 4; }; }; uint32_t l; uint32_t lback; uint32_t lback2; void (*load_func)(uint8_t new_m, int new_count); void (*out_func)(int new_out, int old_out, void *priv); } ctr_t; typedef struct PIT { int flags; int clock; pc_timer_t callback_timer; ctr_t counters[NUM_COUNTERS]; uint8_t ctrl; uint64_t pit_const; void *dev_priv; } pit_t; extern pit_t *ext_pit; enum { PIT_8253 = 0, PIT_8254 = 1, PIT_8253_FAST = 2, PIT_8254_FAST = 3 }; typedef struct pit_intf_t { uint8_t (*read)(uint16_t addr, void *priv); void (*write)(uint16_t addr, uint8_t val, void *priv); /* Gets a counter's count. */ uint16_t (*get_count)(void *data, int counter_id); /* Sets a counter's GATE input. */ void (*set_gate)(void *data, int counter_id, int gate); /* Sets if a counter's CLOCK input is from the timer or not - used by PCjr. */ void (*set_using_timer)(void *data, int counter_id, int using_timer); /* Sets a counter's OUT output handler. */ void (*set_out_func)(void *data, int counter_id, void (*func)(int new_out, int old_out, void *priv)); /* Sets a counter's load count handler. */ void (*set_load_func)(void *data, int counter_id, void (*func)(uint8_t new_m, int new_count)); void (*ctr_clock)(void *data, int counter_id); void (*set_pit_const)(void *data, uint64_t pit_const); void *data; } pit_intf_t; extern pit_intf_t pit_devs[2]; extern const pit_intf_t pit_classic_intf; extern double SYSCLK; extern double PCICLK; extern double AGPCLK; extern uint64_t PITCONST; extern uint64_t PAS16CONST; extern uint64_t PAS16CONST2; extern uint64_t PASSCSICONST; extern uint64_t ISACONST; extern uint64_t CGACONST; extern uint64_t MDACONST; extern uint64_t HERCCONST; extern uint64_t VGACONST1; extern uint64_t VGACONST2; extern uint64_t RTCCONST; extern int refresh_at_enable; extern void pit_device_reset(pit_t *dev); extern void pit_change_pas16_consts(double prescale); extern void pit_set_pit_const(void *data, uint64_t pit_const); extern void ctr_clock(void *data, int counter_id); /* Sets a counter's CLOCK input. */ extern void pit_ctr_set_clock(ctr_t *ctr, int clock, void *priv); extern void pit_ctr_set_gate(void *data, int counter_id, int gate); extern void pit_ctr_set_out_func(void *data, int counter_id, void (*func)(int new_out, int old_out, void *priv)); extern void pit_ctr_set_using_timer(void *data, int counter_id, int using_timer); extern pit_t *pit_common_init(int type, void (*out0)(int new_out, int old_out, void *priv), void (*out1)(int new_out, int old_out, void *priv)); extern pit_t *pit_ps2_init(int type); extern void pit_reset(pit_t *dev); extern void pit_irq0_timer_ps2(int new_out, int old_out, void *priv); extern void pit_refresh_timer_xt(int new_out, int old_out, void *priv); extern void pit_refresh_timer_at(int new_out, int old_out, void *priv); extern void pit_speaker_timer(int new_out, int old_out, void *priv); extern void pit_nmi_timer_ps2(int new_out, int old_out, void *priv); extern void pit_set_clock(uint32_t clock); extern void pit_handler(int set, uint16_t base, int size, void *priv); extern uint8_t pit_read_reg(void *priv, uint8_t reg); #ifdef EMU_DEVICE_H extern const device_t i8253_device; extern const device_t i8253_ext_io_device; extern const device_t i8254_device; extern const device_t i8254_sec_device; extern const device_t i8254_ext_io_device; extern const device_t i8254_ps2_device; #endif #endif /*EMU_PIT_H*/ ```
/content/code_sandbox/src/include/86box/pit.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,311
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for platform specific serial to host passthrough. * * * Authors: Andreas J. Reichel <webmaster@6th-dimension.com>, * Jasmine Iwanek <jasmine@iwanek.co.uk> * */ #ifndef PLAT_SERIAL_PASSTHROUGH_H #define PLAT_SERIAL_PASSTHROUGH_H #include <stdint.h> #ifdef __cplusplus extern "C" { #endif extern void plat_serpt_write(void *priv, uint8_t data); extern int plat_serpt_read(void *priv, uint8_t *data); extern int plat_serpt_open_device(void *priv); extern void plat_serpt_close(void *priv); extern void plat_serpt_set_params(void *priv); #ifdef __cplusplus } #endif #endif ```
/content/code_sandbox/src/include/86box/plat_serial_passthrough.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
234
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the GDB stub server. * * * * Authors: RichardG, <richardg867@gmail.com> * */ #ifndef EMU_GDBSTUB_H #define EMU_GDBSTUB_H #include <stdint.h> #include <86box/mem.h> #define GDBSTUB_MEM_READ 0 #define GDBSTUB_MEM_WRITE 16 #define GDBSTUB_MEM_AWATCH 32 enum { GDBSTUB_EXEC = 0, GDBSTUB_SSTEP = 1, GDBSTUB_BREAK = 2, GDBSTUB_BREAK_SW = 3, GDBSTUB_BREAK_HW = 4, GDBSTUB_BREAK_RWATCH = 5, GDBSTUB_BREAK_WWATCH = 6, GDBSTUB_BREAK_AWATCH = 7 }; #ifdef USE_GDBSTUB # define GDBSTUB_MEM_ACCESS(addr, access, width) \ uint32_t gdbstub_page = (addr) >> MEM_GRANULARITY_BITS; \ if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) { \ uint32_t gdbstub_addrs[(width)]; \ for (int gdbstub_i = 0; gdbstub_i < (width); gdbstub_i++) \ gdbstub_addrs[gdbstub_i] = (addr) + gdbstub_i; \ gdbstub_mem_access(gdbstub_addrs, (access) | (width)); \ } # define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width) \ uint32_t gdbstub_page = (addrs)[0] >> MEM_GRANULARITY_BITS; \ if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) \ gdbstub_mem_access((addrs), (access) | (width)); extern int gdbstub_step, gdbstub_next_asap; extern uint64_t gdbstub_watch_pages[(((uint32_t) -1) >> (MEM_GRANULARITY_BITS + 6)) + 1]; extern void gdbstub_cpu_init(void); extern int gdbstub_instruction(void); extern int gdbstub_int3(void); extern void gdbstub_mem_access(uint32_t *addrs, int access); extern void gdbstub_init(void); extern void gdbstub_close(void); #else # define GDBSTUB_MEM_ACCESS(addr, access, width) # define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width) # define gdbstub_step 0 # define gdbstub_next_asap 0 # define gdbstub_cpu_init() # define gdbstub_instruction() 0 # define gdbstub_int3() 0 # define gdbstub_init() # define gdbstub_close() #endif #endif ```
/content/code_sandbox/src/include/86box/gdbstub.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
712
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Shared code for all the floppy modules. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef FDD_COMMON_H #define FDD_COMMON_H extern const uint8_t fdd_holes[6]; extern const uint8_t fdd_rates[6]; extern const double fdd_bit_rates_300[6]; extern const uint8_t fdd_max_sectors[8][6]; extern const uint8_t fdd_dmf_r[21]; extern int fdd_get_gap3_size(int rate, int size, int sector); extern uint8_t fdd_sector_size_code(int size); extern int fdd_sector_code_size(uint8_t code); extern int fdd_bps_valid(uint16_t bps); extern int fdd_interleave(int sector, int skew, int spt); #endif /*FDD_COMMON_H*/ ```
/content/code_sandbox/src/include/86box/fdd_common.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
260
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Roland MPU-401 emulation. * * * * Authors: Sarah Walker, <path_to_url * DOSBox Team, * Miran Grca, <mgrca8@gmail.com> * TheCollector1995, <mariogplayer@gmail.com> * */ #ifndef SOUND_MPU401_H #define SOUND_MPU401_H #define MPU401_VERSION 0x15 #define MPU401_REVISION 0x01 #define MPU401_QUEUE 32 #define MPU401_INPUT_QUEUE 1024 #define MPU401_TIMECONSTANT (60000000.0 / 1000.0) #define MPU401_RESETBUSY 27.0f /*helpers*/ #define M_GETKEY key[key / 32] & (1 << (key % 32)) #define M_SETKEY key[key / 32] |= (1 << (key % 32)) #define M_DELKEY key[key / 32] &= ~(1 << (key % 32)) typedef enum MpuMode { M_UART, M_INTELLIGENT } MpuMode; #define M_MCA 0x10 typedef enum MpuDataType { T_OVERFLOW, T_MARK, T_MIDI_SYS, T_MIDI_NORM, T_COMMAND } MpuDataType; typedef enum RecState { M_RECOFF, M_RECSTB, M_RECON } RecState; /* Messages sent to MPU-401 from host */ #define MSG_EOX 0xf7 #define MSG_OVERFLOW 0xf8 #define MSG_MARK 0xfc /* Messages sent to host from MPU-401 */ #define MSG_MPU_OVERFLOW 0xf8 #define MSG_MPU_COMMAND_REQ 0xf9 #define MSG_MPU_END 0xfc #define MSG_MPU_CLOCK 0xfd #define MSG_MPU_ACK 0xfe typedef struct mpu_t { uint16_t addr; int uart_mode; int intelligent; int irq; int midi_thru; int queue_pos; int queue_used; uint8_t rx_data; uint8_t is_mca; uint8_t status; uint8_t queue[MPU401_QUEUE]; uint8_t pos_regs[8]; MpuMode mode; uint8_t rec_queue[MPU401_INPUT_QUEUE]; int rec_queue_pos; int rec_queue_used; uint32_t ch_toref[16]; struct track { int counter; uint8_t value[8]; uint8_t sys_val; uint8_t vlength; uint8_t length; MpuDataType type; } playbuf[8], condbuf; struct { int conductor; int cond_req; int cond_set; int block_ack; int playing; int reset; int wsd; int wsm; int wsd_start; int run_irq; int track_req; int send_now; int eoi_scheduled; int data_onoff; int clock_to_host; int sync_in; int sysex_in_finished; int rec_copy; RecState rec; uint8_t irq_pending; uint8_t tmask; uint8_t cmask; uint8_t amask; uint8_t queued_eois; uint8_t last_rtcmd; uint16_t midi_mask; uint16_t req_mask; uint32_t command_byte; uint32_t cmd_pending; uint32_t track; uint32_t old_track; } state; struct { uint8_t timebase; uint8_t old_timebase; uint8_t tempo; uint8_t old_tempo; uint8_t tempo_rel; uint8_t old_tempo_rel; uint8_t tempo_grad; uint8_t cth_rate[4]; uint8_t cth_mode; uint8_t midimetro; uint8_t metromeas; uint32_t cth_counter; uint32_t cth_old; uint32_t rec_counter; int32_t measure_counter; int32_t meas_old; int32_t freq; int ticks_in; int active; float freq_mod; } clock; struct { int all_thru; int midi_thru; int sysex_thru; int commonmsgs_thru; int modemsgs_in; int commonmsgs_in; int bender_in; int sysex_in; int allnotesoff_out; int rt_affection; int rt_out; int rt_in; int timing_in_stop; int data_in_stop; int rec_measure_end; uint8_t prchg_buf[16]; uint16_t prchg_mask; } filter; struct { int on; uint8_t chan; uint8_t trmask; uint32_t key[4]; } chanref[5], inputref[16]; pc_timer_t mpu401_event_callback; pc_timer_t mpu401_eoi_callback; pc_timer_t mpu401_reset_callback; void (*ext_irq_update)(void *priv, int set); int (*ext_irq_pending)(void *priv); void *priv; } mpu_t; extern int mpu401_standalone_enable; extern int mpu401_already_loaded; extern const device_t mpu401_device; extern const device_t mpu401_mca_device; extern uint8_t MPU401_ReadData(mpu_t *mpu); extern void mpu401_write(uint16_t addr, uint8_t val, void *priv); extern uint8_t mpu401_read(uint16_t addr, void *priv); extern void mpu401_setirq(mpu_t *mpu, int irq); extern void mpu401_change_addr(mpu_t *mpu, uint16_t addr); extern void mpu401_init(mpu_t *mpu, uint16_t addr, int irq, int mode, int receive_input); extern void mpu401_device_add(void); extern void mpu401_irq_attach(mpu_t *mpu, void (*ext_irq_update)(void *priv, int set), int (*ext_irq_pending)(void *priv), void *priv); extern int MPU401_InputSysex(void *priv, uint8_t *buffer, uint32_t len, int abort); extern void MPU401_InputMsg(void *priv, uint8_t *msg, uint32_t len); #endif /*SOUND_MPU401_H*/ ```
/content/code_sandbox/src/include/86box/snd_mpu401.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,557
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * 3DFX Voodoo emulation. * * * * Authors: Sarah Walker, <path_to_url * */ #ifndef VIDEO_VOODOO_BLITTER_H #define VIDEO_VOODOO_BLITTER_H void voodoo_v2_blit_start(voodoo_t *voodoo); void voodoo_v2_blit_data(voodoo_t *voodoo, uint32_t data); void voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params); #endif /*VIDEO_VOODOO_BLITTER_H*/ ```
/content/code_sandbox/src/include/86box/vid_voodoo_blitter.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
179
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Emulation of the Olivetti OGC 8-bit ISA (GO708) and * M21/M24/M28 16-bit bus (GO317/318/380/709) video cards. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * EngiNerd, <webmaster.crrc@yahoo.it> * */ #ifndef VIDEO_NGA_H #define VIDEO_NGA_H typedef struct nga_t { cga_t cga; /* unused in OGC, required for M19 video card structure idiom */ uint32_t base; int lineff; int page; uint8_t *vram_64k; mem_mapping_t mapping_64k; } nga_t; void nga_recalctimings(nga_t *ogc); void nga_out(uint16_t addr, uint8_t val, void *priv); uint8_t nga_in(uint16_t addr, void *priv); void nga_write(uint32_t addr, uint8_t val, void *priv); uint8_t nga_read(uint32_t addr, void *priv); void nga_poll(void *priv); void nga_close(void *priv); void nga_mdaattr_rebuild(void); #ifdef EMU_DEVICE_H extern const device_config_t nga_config[]; extern const device_t nga_device; #endif #endif /*VIDEO_NGA_H*/ ```
/content/code_sandbox/src/include/86box/vid_nga.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
372
```objective-c #ifndef EMU_MCA_H #define EMU_MCA_H extern void mca_init(int nr_cards); extern void mca_add(uint8_t (*read)(int addr, void *priv), void (*write)(int addr, uint8_t val, void *priv), uint8_t (*feedb)(void *priv), void (*reset)(void *priv), void *priv); extern void mca_set_index(int index); extern uint8_t mca_read(uint16_t port); extern uint8_t mca_read_index(uint16_t port, int index); extern void mca_write(uint16_t port, uint8_t val); extern uint8_t mca_feedb(void); extern int mca_get_nr_cards(void); extern void mca_reset(void); extern void ps2_cache_clean(void); #endif /*EMU_MCA_H*/ ```
/content/code_sandbox/src/include/86box/mca.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
180
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Define the Dynamic Module Loader interface. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef PLAT_DYNLD_H #define PLAT_DYNLD_H typedef struct dllimp_t { const char *name; void *func; } dllimp_t; #ifdef __cplusplus extern "C" { #endif extern void *dynld_module(const char *, dllimp_t *); extern void dynld_close(void *); #ifdef __cplusplus } #endif #endif /*PLAT_DYNLD_H*/ ```
/content/code_sandbox/src/include/86box/plat_dynld.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
189
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * CD-ROM image file handling module header, translated to C * from cdrom_dosbox.h. * * Authors: RichardG, * Miran Grca, <mgrca8@gmail.com> * */ #ifndef CDROM_IOCTL_H #define CDROM_IOCTL_H /* this header file lists the functions provided by various platform specific cdrom-ioctl files */ #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /*CDROM_IOCTL_H*/ ```
/content/code_sandbox/src/include/86box/cdrom_ioctl.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
175
```objective-c #ifndef EMU_LPT_H #define EMU_LPT_H #define LPT1_ADDR 0x0378 #define LPT1_IRQ 7 #define LPT2_ADDR 0x0278 #define LPT2_IRQ 5 // LPT 1 on machines when installed #define LPT_MDA_ADDR 0x03bc #define LPT_MDA_IRQ 7 #define LPT4_ADDR 0x0268 #define LPT4_IRQ 5 #if 0 #define LPT5_ADDR 0x027c #define LPT5_IRQ 7 #define LPT6_ADDR 0x026c #define LPT6_IRQ 5 #endif typedef struct lpt_device_t { const char *name; const char *internal_name; void *(*init)(void *lpt); void (*close)(void *priv); void (*write_data)(uint8_t val, void *priv); void (*write_ctrl)(uint8_t val, void *priv); uint8_t (*read_data)(void *priv); uint8_t (*read_status)(void *priv); uint8_t (*read_ctrl)(void *priv); } lpt_device_t; extern void lpt_init(void); extern void lpt_port_init(int i, uint16_t port); extern void lpt_port_irq(int i, uint8_t irq); extern void lpt_port_remove(int i); extern void lpt1_remove_ams(void); #define lpt1_init(a) lpt_port_init(0, a) #define lpt1_irq(a) lpt_port_irq(0, a) #define lpt1_remove() lpt_port_remove(0) #define lpt2_init(a) lpt_port_init(1, a) #define lpt2_irq(a) lpt_port_irq(1, a) #define lpt2_remove() lpt_port_remove(1) #define lpt3_init(a) lpt_port_init(2, a) #define lpt3_irq(a) lpt_port_irq(2, a) #define lpt3_remove() lpt_port_remove(2) #define lpt4_init(a) lpt_port_init(3, a) #define lpt4_irq(a) lpt_port_irq(3, a) #define lpt4_remove() lpt_port_remove(3) #if 0 #define lpt5_init(a) lpt_port_init(4, a) #define lpt5_irq(a) lpt_port_irq(4, a) #define lpt5_remove() lpt_port_remove(4) #define lpt6_init(a) lpt_port_init(5, a) #define lpt6_irq(a) lpt_port_irq(5, a) #define lpt6_remove() lpt_port_remove(5) #endif void lpt_devices_init(void); void lpt_devices_close(void); typedef struct lpt_port_t { uint8_t enabled; uint8_t irq; uint8_t dat; uint8_t ctrl; uint16_t addr; uint16_t pad0; int device; int enable_irq; lpt_device_t *dt; void *priv; } lpt_port_t; extern lpt_port_t lpt_ports[PARALLEL_MAX]; extern void lpt_write(uint16_t port, uint8_t val, void *priv); extern uint8_t lpt_read(uint16_t port, void *priv); extern uint8_t lpt_read_port(int port, uint16_t reg); extern uint8_t lpt_read_status(int port); extern void lpt_irq(void *priv, int raise); extern const char *lpt_device_get_name(int id); extern const char *lpt_device_get_internal_name(int id); extern int lpt_device_get_from_internal_name(char *s); extern const lpt_device_t lpt_dac_device; extern const lpt_device_t lpt_dac_stereo_device; extern const lpt_device_t dss_device; extern const lpt_device_t lpt_hasp_savquest_device; #endif /*EMU_LPT_H*/ ```
/content/code_sandbox/src/include/86box/lpt.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
891
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the Super I/O chips. * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_SIO_H #define EMU_SIO_H extern void vt82c686_sio_write(uint8_t addr, uint8_t val, void *priv); extern const device_t acc3221_device; extern const device_t ali5105_device; extern const device_t ali5123_device; extern const device_t f82c710_device; extern const device_t f82c606_device; extern const device_t fdc37c651_device; extern const device_t fdc37c651_ide_device; extern const device_t fdc37c661_device; extern const device_t fdc37c661_ide_device; extern const device_t fdc37c661_ide_sec_device; extern const device_t fdc37c663_device; extern const device_t fdc37c663_ide_device; extern const device_t fdc37c665_device; extern const device_t fdc37c665_ide_device; extern const device_t fdc37c665_ide_pri_device; extern const device_t fdc37c665_ide_sec_device; extern const device_t fdc37c666_device; extern const device_t fdc37c67x_device; extern const device_t fdc37c669_device; extern const device_t fdc37c669_370_device; extern const device_t fdc37c931apm_device; extern const device_t fdc37c931apm_compaq_device; extern const device_t fdc37c932fr_device; extern const device_t fdc37c932qf_device; extern const device_t fdc37c932_device; extern const device_t fdc37c935_device; extern const device_t fdc37c935_370_device; extern const device_t fdc37c935_no_nvr_device; extern const device_t fdc37m60x_device; extern const device_t fdc37m60x_370_device; extern const device_t it8661f_device; extern const device_t it8671f_device; extern const device_t i82091aa_device; extern const device_t i82091aa_398_device; extern const device_t i82091aa_ide_pri_device; extern const device_t i82091aa_ide_device; extern const device_t pc87306_device; extern const device_t pc87307_device; extern const device_t pc87307_15c_device; extern const device_t pc87307_both_device; extern const device_t pc87309_device; extern const device_t pc87309_15c_device; extern const device_t pc87310_device; extern const device_t pc87310_ide_device; extern const device_t pc87311_device; extern const device_t pc87311_ide_device; extern const device_t pc87332_device; extern const device_t pc87332_398_device; extern const device_t pc87332_398_ide_device; extern const device_t pc87332_398_ide_sec_device; extern const device_t pc87332_398_ide_fdcon_device; extern const device_t pc97307_device; extern const device_t prime3b_device; extern const device_t prime3b_ide_device; extern const device_t prime3c_device; extern const device_t prime3c_ide_device; extern const device_t ps1_m2133_sio; #ifdef USE_SIO_DETECT extern const device_t sio_detect_device; #endif /* USE_SIO_DETECT */ extern const device_t um8663af_device; extern const device_t um8663af_ide_device; extern const device_t um8663af_sec_device; extern const device_t um8663bf_device; extern const device_t um8663bf_ide_device; extern const device_t um8663bf_sec_device; extern const device_t um8669f_device; extern const device_t um8669f_ide_device; extern const device_t um8669f_ide_sec_device; extern const device_t via_vt82c686_sio_device; extern const device_t vl82c113_device; extern const device_t w83787f_88h_device; extern const device_t w83787f_device; extern const device_t w83787f_ide_device; extern const device_t w83787f_ide_en_device; extern const device_t w83787f_ide_sec_device; extern const device_t w83877f_device; extern const device_t w83877f_president_device; extern const device_t w83877tf_device; extern const device_t w83877tf_acorp_device; extern const device_t w83977f_device; extern const device_t w83977f_370_device; extern const device_t w83977tf_device; extern const device_t w83977ef_device; extern const device_t w83977ef_370_device; #endif /*EMU_SIO_H*/ ```
/content/code_sandbox/src/include/86box/sio.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,103
```objective-c #ifndef EMU_NET_EVENT_H #define EMU_NET_EVENT_H typedef struct net_evt_t { #ifdef _WIN32 HANDLE handle; #else int fds[2]; #endif } net_evt_t; extern void net_event_init(net_evt_t *event); extern void net_event_set(net_evt_t *event); extern void net_event_clear(net_evt_t *event); extern void net_event_close(net_evt_t *event); #ifdef _WIN32 extern HANDLE net_event_get_handle(net_evt_t *event); #else extern int net_event_get_fd(net_evt_t *event); #endif #endif ```
/content/code_sandbox/src/include/86box/net_event.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
123
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * IBM CGA composite filter, borrowed from reenigne's DOSBox * patch and ported to C. * * * * Authors: reenigne, * Miran Grca, <mgrca8@gmail.com> * */ #ifndef VIDEO_CGA_COMP_H #define VIDEO_CGA_COMP_H #define Bitu unsigned int #define bool uint8_t void update_cga16_color(uint8_t cgamode); void cga_comp_init(int revision); uint32_t *Composite_Process(uint8_t cgamode, uint8_t border, uint32_t blocks /*, bool doublewidth*/, uint32_t *TempLine); #endif /*VIDEO_CGA_COMP_H*/ ```
/content/code_sandbox/src/include/86box/vid_cga_comp.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
215
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for clock generator chips. * * * * Authors: RichardG, <richardg867@gmail.com> * */ #ifndef EMU_CLOCK_H #define EMU_CLOCK_H /* clock_ics9xxx.c */ enum { ICS9xxx_xx, ICS9150_08, ICS9248_39, ICS9248_81, ICS9248_95, ICS9248_98, ICS9248_101, ICS9248_103, ICS9248_107, ICS9248_112, ICS9248_138, ICS9248_141, ICS9248_143, ICS9248_151, ICS9248_192, ICS9250_08, ICS9250_10, ICS9250_13, ICS9250_14, ICS9250_16, ICS9250_18, ICS9250_19, ICS9250_23, ICS9250_25, ICS9250_26, ICS9250_27, ICS9250_28, ICS9250_29, ICS9250_30, ICS9250_32, ICS9250_38, ICS9250_50, ICS9xxx_MAX }; /* clock_ics9xxx.c */ extern device_t *ics9xxx_get(uint8_t model); #endif /*EMU_CLOCK_H*/ ```
/content/code_sandbox/src/include/86box/clock.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
410
```objective-c /* * VARCem Virtual ARchaeological Computer EMulator. * An emulator of (mostly) x86-based PC systems and devices, * using the ISA,EISA,VLB,MCA and PCI system buses, roughly * spanning the era between 1981 and 1995. * * Definitions for the ISARTC cards. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the * following conditions are met: * * 1. Redistributions of source code must retain the entire * above notice, this list of conditions and the following * disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names * of its contributors may be used to endorse or promote * products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef EMU_ISARTC_H #define EMU_ISARTC_H #ifdef __cplusplus extern "C" { #endif /* Global variables. */ /* Functions. */ extern void isartc_reset(void); extern const char *isartc_get_internal_name(int t); extern int isartc_get_from_internal_name(char *s); extern const device_t *isartc_get_device(int t); extern int isartc_has_config(int board); #ifdef __cplusplus } #endif #endif /*EMU_ISARTC_H*/ ```
/content/code_sandbox/src/include/86box/isartc.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
582
```objective-c #ifndef EMU_SOUND_MIDI_H #define EMU_SOUND_MIDI_H #define SYSEX_SIZE 8192 extern uint8_t MIDI_InSysexBuf[SYSEX_SIZE]; extern uint8_t MIDI_evt_len[256]; extern int midi_output_device_current; extern int midi_input_device_current; extern void (*input_msg)(void *priv, uint8_t *msg, uint32_t len); extern int (*input_sysex)(void *priv, uint8_t *buf, uint32_t len, int abort); extern void *midi_in_p; extern int midi_out_device_available(int card); extern int midi_in_device_available(int card); #ifdef EMU_DEVICE_H const device_t *midi_out_device_getdevice(int card); const device_t *midi_in_device_getdevice(int card); #endif extern int midi_out_device_has_config(int card); extern int midi_in_device_has_config(int card); extern const char *midi_out_device_get_internal_name(int card); extern const char *midi_in_device_get_internal_name(int card); extern int midi_out_device_get_from_internal_name(char *s); extern int midi_in_device_get_from_internal_name(char *s); extern void midi_out_device_init(void); extern void midi_in_device_init(void); typedef struct midi_device_t { void (*play_sysex)(uint8_t *sysex, unsigned int len); void (*play_msg)(uint8_t *msg); void (*poll)(void); void (*reset)(void); int (*write)(uint8_t val); } midi_device_t; typedef struct midi_in_handler_t { uint8_t *buf; int cnt; uint32_t len; void (*msg)(void *priv, uint8_t *msg, uint32_t len); int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort); struct midi_in_handler_t *priv; struct midi_in_handler_t *prev; struct midi_in_handler_t *next; } midi_in_handler_t; typedef struct midi_t { uint8_t midi_rt_buf[8]; uint8_t midi_cmd_buf[8]; uint8_t midi_status; uint8_t midi_sysex_data[SYSEX_SIZE]; int midi_cmd_pos; int midi_cmd_len; int midi_cmd_r; int midi_realtime; int thruchan; int midi_clockout; unsigned int midi_sysex_start; unsigned int midi_sysex_delay; unsigned int midi_pos; midi_device_t *m_out_device; midi_device_t *m_in_device; } midi_t; extern midi_t *midi_out; extern midi_t *midi_in; extern void midi_out_init(midi_device_t *device); extern void midi_in_init(midi_device_t *device, midi_t **mididev); extern void midi_out_close(void); extern void midi_in_close(void); extern void midi_raw_out_rt_byte(uint8_t val); extern void midi_raw_out_thru_rt_byte(uint8_t val); extern void midi_raw_out_byte(uint8_t val); extern void midi_clear_buffer(void); extern void midi_poll(void); extern void midi_reset(void); extern void midi_in_handler(int set, void (*msg)(void *priv, uint8_t *msg, uint32_t len), int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort), void *priv); extern void midi_in_handlers_clear(void); extern void midi_in_msg(uint8_t *msg, uint32_t len); extern void midi_in_sysex(uint8_t *buffer, uint32_t len); #if 0 # ifdef _WIN32 # define SYSTEM_MIDI_NAME "Windows MIDI" # define SYSTEM_MIDI_INTERNAL_NAME "windows_midi" # else # define SYSTEM_MIDI_NAME "System MIDI" # define SYSTEM_MIDI_INTERNAL_NAME "system_midi" # endif #else # define SYSTEM_MIDI_NAME "System MIDI" # define SYSTEM_MIDI_INTERNAL_NAME "system_midi" #endif #define MIDI_INPUT_NAME "MIDI Input Device" #define MIDI_INPUT_INTERNAL_NAME "midi_in" #ifdef EMU_DEVICE_H extern const device_t rtmidi_output_device; extern const device_t rtmidi_input_device; # ifdef USE_OPL4ML extern const device_t opl4_midi_device; # endif /* USE_OPL4ML */ # ifdef USE_FLUIDSYNTH extern const device_t fluidsynth_device; # endif /* USE_FLUIDSYNTH */ # ifdef USE_MUNT extern const device_t mt32_old_device; extern const device_t mt32_new_device; extern const device_t cm32l_device; extern const device_t cm32ln_device; # endif /* USE_MUNT */ #endif #endif /*EMU_SOUND_MIDI_H*/ ```
/content/code_sandbox/src/include/86box/midi.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
1,040
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * SCSI controller handler header. * * * * Authors: TheCollector1995, <mariogplayer@gmail.com> * Miran Grca, <mgrca8@gmail.com> * Fred N. van Kempen, <decwiz@yahoo.com> * */ #ifndef EMU_SCSI_H #define EMU_SCSI_H /* Configuration. */ #define SCSI_CARD_MAX 4 #define SCSI_BUS_MAX 9 /* currently we support up to 9 controllers: up to 1 on-board + up to 4x pas plus/16 + up to 4 scsi controllers */ #define SCSI_ID_MAX 16 /* 16 on wide buses */ #define SCSI_LUN_MAX 8 /* always 8 */ extern int scsi_card_current[SCSI_CARD_MAX]; extern int scsi_card_available(int card); #ifdef EMU_DEVICE_H extern const device_t *scsi_card_getdevice(int card); #endif extern int scsi_card_has_config(int card); extern const char *scsi_card_get_internal_name(int card); extern int scsi_card_get_from_internal_name(char *s); extern void scsi_card_init(void); #endif /*EMU_SCSI_H*/ ```
/content/code_sandbox/src/include/86box/scsi.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
321
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Implementation of the CD-ROM drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_SCSI_CDROM_H #define EMU_SCSI_CDROM_H #define CDROM_TIME 10.0 #ifdef SCSI_DEVICE_H typedef struct scsi_cdrom_t { /* Common block. */ mode_sense_pages_t ms_pages_saved; cdrom_t * drv; #ifdef EMU_IDE_H ide_tf_t *tf; #else void * tf; #endif uint8_t *buffer; uint8_t atapi_cdb[16]; uint8_t current_cdb[16]; uint8_t sense[256]; #ifdef ANCIENT_CODE /* Task file. */ uint8_t features; uint8_t phase; uint16_t request_length; uint8_t status; uint8_t error; uint16_t pad; uint32_t pos; #endif uint8_t id; uint8_t cur_lun; uint8_t early; uint8_t pad1; uint16_t max_transfer_len; uint16_t pad2; int requested_blocks; int packet_status; int total_length; int do_page_save; int unit_attention; int request_pos; int old_len; int media_status; uint32_t sector_pos; uint32_t sector_len; uint32_t packet_len; double callback; mode_sense_pages_t ms_pages_saved_sony; mode_sense_pages_t ms_drive_status_pages_saved; int sony_vendor; } scsi_cdrom_t; #endif extern scsi_cdrom_t *scsi_cdrom[CDROM_NUM]; #define scsi_cdrom_sense_error dev->sense[0] #define scsi_cdrom_sense_key dev->sense[2] #define scsi_cdrom_asc dev->sense[12] #define scsi_cdrom_ascq dev->sense[13] #define scsi_cdrom_drive cdrom_drives[id].host_drive extern void scsi_cdrom_reset(scsi_common_t *sc); #endif /*EMU_SCSI_CDROM_H*/ ```
/content/code_sandbox/src/include/86box/scsi_cdrom.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
554
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definition of Serial passthrough device. * * * Authors: Andreas J. Reichel <webmaster@6th-dimension.com>, * Jasmine Iwanek <jasmine@iwanek.co.uk> * */ #ifndef SERIAL_PASSTHROUGH_H #define SERIAL_PASSTHROUGH_H #include <stdint.h> #include <stdbool.h> #include <86box/86box.h> #include <86box/device.h> #include <86box/timer.h> #include <86box/serial.h> enum serial_passthrough_mode { SERPT_MODE_VCON, /*Named Pipe (Server) / Pseudo Terminal/Virtual Console */ SERPT_MODE_TCPSRV, /* TCP Server (TODO) */ SERPT_MODE_TCPCLNT, /* TCP Client (TODO) */ SERPT_MODE_HOSTSER, /* Host Serial Passthrough */ SERPT_MODES_MAX, }; extern const char *serpt_mode_names[SERPT_MODES_MAX]; typedef struct serial_passthrough_s { enum serial_passthrough_mode mode; pc_timer_t host_to_serial_timer; pc_timer_t serial_to_host_timer; serial_t *serial; double baudrate; uint8_t bits; uint8_t data_bits; uint8_t port; uint8_t data; char slave_pt[32]; /* used for pseudo term name of slave side */ intptr_t master_fd; /* file desc for master pseudo terminal or * socket or alike */ char host_serial_path[1024]; /* Path to TTY/host serial port on the host */ char named_pipe[1024]; /* (Windows only) Name of the pipe. */ void *backend_priv; /* Private platform backend data */ } serial_passthrough_t; extern bool serial_passthrough_enabled[SERIAL_MAX]; extern const device_t serial_passthrough_device; extern void serial_passthrough_init(void); #endif ```
/content/code_sandbox/src/include/86box/serial_passthrough.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
486
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Emulation of the Hercules graphics cards. * * * * Authors: Sarah Walker, <path_to_url * Miran Grca, <mgrca8@gmail.com> * Jasmine Iwanek, <jriwanek@gmail.com> * */ #ifndef VIDEO_HERCULES_H #define VIDEO_HERCULES_H typedef struct { mem_mapping_t mapping; uint8_t crtc[32]; uint8_t charbuffer[4096]; int crtcreg; uint8_t ctrl; uint8_t ctrl2; uint8_t stat; uint64_t dispontime; uint64_t dispofftime; pc_timer_t timer; int firstline; int lastline; int linepos; int displine; int vc; int sc; uint16_t ma; uint16_t maback; int con; int coff; int cursoron; int dispon; int blink; int vsynctime; int vadj; int lp_ff; int fullchange; int cols[256][2][2]; uint8_t *vram; int monitor_index; int prev_monitor_index; } hercules_t; #define VIDEO_MONITOR_PROLOGUE() \ { \ dev->prev_monitor_index = monitor_index_global; \ monitor_index_global = dev->monitor_index; \ } #define VIDEO_MONITOR_EPILOGUE() \ { \ monitor_index_global = dev->prev_monitor_index; \ } static void *hercules_init(const device_t *info); #endif /*VIDEO_HERCULES_H*/ ```
/content/code_sandbox/src/include/86box/vid_hercules.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
442
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the SMRAM interface. * * * * Authors: Miran Grca, <mgrca8@gmail.com> * */ #ifndef EMU_SMRAM_H #define EMU_SMRAM_H typedef struct _smram_ { struct _smram_ *prev; struct _smram_ *next; mem_mapping_t mapping; uint32_t host_base; uint32_t ram_base; uint32_t size; uint32_t old_host_base; uint32_t old_size; } smram_t; /* Make a backup copy of host_base and size of all the SMRAM structs, needed so that if the SMRAM mappings change while in SMM, they will be recalculated on return. */ extern void smram_backup_all(void); /* Recalculate any mappings, including the backup if returning from SMM. */ extern void smram_recalc_all(int ret); /* Delete a SMRAM mapping. */ extern void smram_del(smram_t *smr); /* Add a SMRAM mapping. */ extern smram_t *smram_add(void); /* Set memory state in the specified model (normal or SMM) according to the specified flags, separately for bus and CPU. */ extern void smram_map_ex(int bus, int smm, uint32_t addr, uint32_t size, int is_smram); /* Set memory state in the specified model (normal or SMM) according to the specified flags. */ extern void smram_map(int smm, uint32_t addr, uint32_t size, int is_smram); /* Disable a specific SMRAM mapping. */ extern void smram_disable(smram_t *smr); /* Disable all SMRAM mappings. */ extern void smram_disable_all(void); /* Enable SMRAM mappings according to flags for both normal and SMM modes, separately for bus and CPU. */ extern void smram_enable_ex(smram_t *smr, uint32_t host_base, uint32_t ram_base, uint32_t size, int flags_normal, int flags_normal_bus, int flags_smm, int flags_smm_bus); /* Enable SMRAM mappings according to flags for both normal and SMM modes. */ extern void smram_enable(smram_t *smr, uint32_t host_base, uint32_t ram_base, uint32_t size, int flags_normal, int flags_smm); /* Checks if a SMRAM mapping is enabled or not. */ extern int smram_enabled(smram_t *smr); /* Changes the SMRAM state. */ extern void smram_state_change(smram_t *smr, int smm, int flags); /* Enables or disables the use of a separate SMRAM for addresses below A0000. */ extern void smram_set_separate_smram(uint8_t set); #endif /*EMU_SMRAM_H*/ ```
/content/code_sandbox/src/include/86box/smram.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
665
```objective-c /* * VARCem Virtual ARchaeological Computer EMulator. * An emulator of (mostly) x86-based PC systems and devices, * using the ISA,EISA,VLB,MCA and PCI system buses, roughly * spanning the era between 1981 and 1995. * * Definitions for the ISAMEM cards. * * * * Authors: Fred N. van Kempen, <decwiz@yahoo.com> * * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the * following conditions are met: * * 1. Redistributions of source code must retain the entire * above notice, this list of conditions and the following * disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names * of its contributors may be used to endorse or promote * products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef EMU_ISAMEM_H #define EMU_ISAMEM_H #define ISAMEM_MAX 4 /* max #cards in system */ #ifdef __cplusplus extern "C" { #endif /* Global variables. */ extern const device_t isamem_device; extern const device_t isamem_brat80_device; extern const device_t isamem_ev159_device; /* Functions. */ extern void isamem_reset(void); extern const char *isamem_get_name(int t); extern const char *isamem_get_internal_name(int t); extern int isamem_get_from_internal_name(const char *s); extern const device_t *isamem_get_device(int t); extern int isamem_has_config(int board); #ifdef __cplusplus } #endif #endif /*EMU_ISAMEM_H*/ ```
/content/code_sandbox/src/include/86box/isamem.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
642
```objective-c /* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent * system designs based on the PCI bus. * * This file is part of the 86Box distribution. * * Definitions for the SMBus host controllers. * * * * Authors: RichardG, <richardg867@gmail.com> * */ #ifndef EMU_SMBUS_H #define EMU_SMBUS_H #define SMBUS_PIIX4_BLOCK_DATA_SIZE 32 #define SMBUS_PIIX4_BLOCK_DATA_MASK (SMBUS_PIIX4_BLOCK_DATA_SIZE - 1) #define SMBUS_ALI7101_BLOCK_DATA_SIZE 32 #define SMBUS_ALI7101_BLOCK_DATA_MASK (SMBUS_ALI7101_BLOCK_DATA_SIZE - 1) #define SMBUS_SIS5595_BLOCK_DATA_SIZE 32 #define SMBUS_SIS5595_BLOCK_DATA_MASK (SMBUS_ALI7101_BLOCK_DATA_SIZE - 1) enum { SMBUS_PIIX4 = 0, SMBUS_VIA = 1 }; typedef struct smbus_piix4_t { uint32_t local; uint16_t io_base; int clock; double bit_period; uint8_t stat; uint8_t next_stat; uint8_t ctl; uint8_t cmd; uint8_t addr; uint8_t data0; uint8_t data1; uint8_t index; uint8_t data[SMBUS_PIIX4_BLOCK_DATA_SIZE]; pc_timer_t response_timer; void *i2c; } smbus_piix4_t; typedef struct smbus_ali7101_t { uint32_t local; uint16_t io_base; uint8_t stat; uint8_t next_stat; uint8_t ctl; uint8_t cmd; uint8_t addr; uint8_t data0; uint8_t data1; uint8_t index; uint8_t data[SMBUS_ALI7101_BLOCK_DATA_SIZE]; pc_timer_t response_timer; void *i2c; } smbus_ali7101_t; typedef struct smbus_sis5595_t { uint32_t local; uint16_t stat; uint16_t next_stat; uint16_t ctl; uint8_t cmd; uint8_t addr; uint8_t saved_addr; uint8_t block_ptr; uint8_t count; uint8_t data0; uint8_t data1; uint8_t alias; uint8_t reg_ff; uint8_t index; uint8_t irq_enable; uint8_t irq_state; uint8_t data[SMBUS_SIS5595_BLOCK_DATA_SIZE]; pc_timer_t response_timer; void *i2c; } smbus_sis5595_t; extern void smbus_piix4_remap(smbus_piix4_t *dev, uint16_t new_io_base, uint8_t enable); extern void smbus_piix4_setclock(smbus_piix4_t *dev, int clock); extern void smbus_ali7101_remap(smbus_ali7101_t *dev, uint16_t new_io_base, uint8_t enable); extern void smbus_sis5595_irq_enable(void *priv, uint8_t enable); extern uint8_t smbus_sis5595_read_index(void *priv); extern uint8_t smbus_sis5595_read_data(void *priv); extern void smbus_sis5595_write_index(void *priv, uint8_t val); extern void smbus_sis5595_write_data(void *priv, uint8_t val); #ifdef EMU_DEVICE_H extern const device_t piix4_smbus_device; extern const device_t via_smbus_device; extern const device_t ali7101_smbus_device; extern const device_t sis5595_smbus_device; #endif #endif /*EMU_SMBUS_H*/ ```
/content/code_sandbox/src/include/86box/smbus.h
objective-c
2016-06-25T22:29:10
2024-08-16T19:09:21
86Box
86Box/86Box
2,616
924