22 #ifndef BACKENDS_GRAPHICS_ATARI_SUPERVIDEL_H 23 #define BACKENDS_GRAPHICS_ATARI_SUPERVIDEL_H 27 #include "backends/graphics/atari/atari-graphics.h" 29 #include <mint/osbind.h> 32 #include <mint/trap14.h> 33 #define ct60_vm(mode, value) (long)trap_14_wwl((short)0xc60e, (short)(mode), (long)(value)) 34 #define ct60_vmalloc(value) ct60_vm(0, value) 35 #define ct60_vmfree(value) ct60_vm(1, value) 37 #include "backends/platform/atari/dlmalloc.h" 38 extern mspace g_mspace;
41 #include "backends/graphics/atari/atari-graphics-superblitter.h" 42 #include "backends/platform/atari/atari-debug.h" 43 #include "common/scummsys.h" 47 AtariSuperVidelManager() {
49 atari_debug(
"SuperVidel FW Revision: %d, using %s", superVidelFwVersion, superVidelFwVersion >= 9
50 ?
"fast async FIFO" :
"slower sync blitting");
52 atari_debug(
"SuperVidel FW Revision: %d, SuperBlitter not used", superVidelFwVersion);
54 if (Supexec(hasSvRamBoosted))
55 atari_debug(
"SV_XBIOS has the pmmu boost enabled");
57 atari_warning(
"SV_XBIOS has the pmmu boost disabled, set 'pmmu_boost = true' in C:\\SV.INF");
60 size_t vramSize = ct60_vmalloc(-1) - (16 * 1024 * 1024);
61 _vramBase = vramSize > 0 ? (
void *)ct60_vmalloc(vramSize) : nullptr;
63 g_mspace = create_mspace_with_base(_vramBase, vramSize, 0);
64 atari_debug(
"Allocated VRAM at %p (%ld bytes)", _vramBase, vramSize);
68 atari_warning(
"VRAM allocation failed");
74 ~AtariSuperVidelManager() {
80 destroy_mspace(g_mspace);
83 ct60_vmfree(_vramBase);
90 AtariMemAlloc getStRamAllocFunc()
const override {
91 return [](
size_t bytes) {
92 uintptr ptr = Mxalloc(bytes, MX_STRAM);
100 AtariMemFree getStRamFreeFunc()
const override {
101 return [](
void *ptr) { Mfree((uintptr)ptr & 0x00FFFFFF); };
106 int destX,
int destY,
108 assert(dstBitsPerPixel == 8);
109 assert(subRect.
width() % 16 == 0);
110 assert(subRect.
width() == srcSurface.
w);
112 const byte *src = (
const byte *)srcSurface.
getBasePtr(subRect.
left, subRect.top);
113 const uint16 *mask = (
const uint16 *)srcMask.
getBasePtr(subRect.
left, subRect.top);
114 byte *dst = (byte *)dstSurface.
getBasePtr(destX, destY);
116 const int h = subRect.
height();
117 const int w = subRect.
width();
118 const int dstOffset = dstSurface.
pitch - w;
120 for (
int j = 0; j < h; ++j) {
121 for (
int i = 0; i < w; i += 16, mask++) {
122 const uint16 m = *mask;
131 for (
int k = 0; k < 16; ++k) {
132 const uint16 bit = 1 << (15 - k);
148 Common::Rect alignRect(
int x,
int y,
int w,
int h)
const override {
152 static long hasSvRamBoosted() {
153 register long ret __asm__ (
"d0") = 0;
156 "\tmovec %%itt0,%%d1\n" 157 "\tcmp.l #0xA007E060,%%d1\n" 160 "\tmovec %%dtt0,%%d1\n" 161 "\tcmp.l #0xA007E060,%%d1\n" 169 : __CLOBBER_RETURN(
"d0")
"d1",
"cc" 175 #ifdef USE_SV_BLITTER 176 void *_vramBase =
nullptr;
180 #endif // USE_SUPERVIDEL int32 pitch
Definition: surface.h:83
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
int16 width() const
Definition: rect.h:192
int16 left
Definition: rect.h:145
int16 w
Definition: surface.h:71
Definition: atari-graphics.h:40
int16 height() const
Definition: rect.h:193