mirror of
https://github.com/sheumann/VNCviewGS.git
synced 2024-11-21 10:33:40 +00:00
Statically allocate space for color tables in an assembly file.
This is a prelude to rewriting the raw decoding logic in more efficient assembly code.
This commit is contained in:
parent
b9699111da
commit
b8bdc81eda
@ -2,10 +2,7 @@
|
||||
|
||||
#include <types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
unsigned char *bigcoltab640a = NULL;
|
||||
unsigned char *bigcoltab640b = NULL;
|
||||
unsigned char *bigcoltab320 = NULL;
|
||||
#include "colortables.h"
|
||||
|
||||
const unsigned char coltab320[] = {
|
||||
/* bbgggrrr - incoming pixel data */
|
||||
@ -81,18 +78,6 @@ const unsigned char coltab640[] = {
|
||||
/* 11111 */ 0xAA,0xAA,0xAA,0xAA,0xFF,0xFF,0xFF,0xFF
|
||||
};
|
||||
|
||||
BOOLEAN AllocateBigColorTables (void)
|
||||
{
|
||||
bigcoltab640a = malloc(65536);
|
||||
bigcoltab640b = malloc(65536);
|
||||
bigcoltab320 = malloc(65536);
|
||||
|
||||
if (bigcoltab640a==NULL || bigcoltab640b==NULL || bigcoltab320==NULL)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* iters = number of iterations to do (must be > 0) */
|
||||
BOOLEAN MakeBigColorTables (unsigned int iters)
|
||||
{
|
||||
|
@ -5,5 +5,4 @@ extern unsigned char *bigcoltab640a;
|
||||
extern unsigned char *bigcoltab640b;
|
||||
extern unsigned char *bigcoltab320;
|
||||
|
||||
BOOLEAN AllocateBigColorTables(void);
|
||||
BOOLEAN MakeBigColorTables(unsigned int);
|
||||
|
12
make
12
make
@ -26,6 +26,16 @@ for file in vncview vncsession vncdisplay colortables \
|
||||
end
|
||||
end
|
||||
|
||||
for file in tables
|
||||
unset exit
|
||||
newer {file}.a {file}.asm
|
||||
if {status} != 0
|
||||
set exit on
|
||||
assemble {file}.asm keep={file}
|
||||
set link true
|
||||
end
|
||||
end
|
||||
|
||||
unset exit
|
||||
newer vncview.rezfork vncview.rez
|
||||
if {status} != 0
|
||||
@ -35,7 +45,7 @@ if {status} != 0
|
||||
end
|
||||
|
||||
if {link} == true
|
||||
link vncview vncsession vncdisplay colortables \
|
||||
link vncview vncsession vncdisplay colortables tables \
|
||||
desktopsize mouse keyboard copyrect raw hextile clipboard \
|
||||
keep=VNCview.GS
|
||||
filetype VNCview.GS S16 $DB03
|
||||
|
32
tables.asm
Normal file
32
tables.asm
Normal file
@ -0,0 +1,32 @@
|
||||
case on
|
||||
|
||||
* Color tables
|
||||
* 64k each, each in its own segment
|
||||
|
||||
BCT640A data COLTAB640A
|
||||
ds $10000
|
||||
end
|
||||
|
||||
BCT640B data COLTAB640B
|
||||
ds $10000
|
||||
end
|
||||
|
||||
BCT320 data COLTAB320
|
||||
ds $10000
|
||||
end
|
||||
|
||||
* Pointers to color tables, used for accessing them from C
|
||||
* These must be in the blank load segment so they can be accessed as C globals
|
||||
* (in the small memory model).
|
||||
|
||||
bigcoltab640a data
|
||||
dc i4'BCT640A'
|
||||
end
|
||||
|
||||
bigcoltab640b data
|
||||
dc i4'BCT640B'
|
||||
end
|
||||
|
||||
bigcoltab320 data
|
||||
dc i4'BCT320'
|
||||
end
|
13
vncview.cc
13
vncview.cc
@ -355,12 +355,6 @@ void Quit (void) {
|
||||
if (readBufferHndl)
|
||||
DisposeHandle(readBufferHndl); /* Get rid of TCPIP read buffer hndl */
|
||||
|
||||
if (bigcoltab320)
|
||||
free(bigcoltab320);
|
||||
if (bigcoltab640a)
|
||||
free(bigcoltab640a);
|
||||
if (bigcoltab640b)
|
||||
free(bigcoltab640b);
|
||||
if (cursor)
|
||||
free(cursor);
|
||||
|
||||
@ -421,13 +415,6 @@ int main (void) {
|
||||
Quit();
|
||||
}
|
||||
|
||||
if (!AllocateBigColorTables()) {
|
||||
SysBeep();
|
||||
InitCursor();
|
||||
AlertWindow(awResource, NULL, outOfMemoryError);
|
||||
Quit();
|
||||
}
|
||||
|
||||
InitScreen(); /* Set up color tables */
|
||||
|
||||
LoadScrap(); /* put scrap in memory */
|
||||
|
Loading…
Reference in New Issue
Block a user