feat(inventory): Phase 1 - scan and validate UPC barcodes #1
+1189
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,411 @@
|
|||||||
|
/*
|
||||||
|
A4TEST.C - Testing the functionality ASIC4 Example
|
||||||
|
Interface Board device driver A4Exif.ldd
|
||||||
|
A comprehensive test program which checks
|
||||||
|
I/O request functionality of A4Exif.ldd
|
||||||
|
|
||||||
|
Written by Mal, January 31, 1995
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <p_keyb.h>
|
||||||
|
|
||||||
|
#define BUFLEN 1
|
||||||
|
#define MAXBUF 8
|
||||||
|
#define SERREAD_TIMEOUT 20L
|
||||||
|
#define FLASH_TIME 1L
|
||||||
|
|
||||||
|
GLREF_D TEXT *DatCommandPtr;
|
||||||
|
GLREF_D VOID *winHandle;
|
||||||
|
LOCAL_D VOID *serH; /* serial channel handle */
|
||||||
|
LOCAL_D VOID *timH; /* timer channel handle */
|
||||||
|
LOCAL_D WORD serReadStat; /* serial channel status word */
|
||||||
|
LOCAL_D WORD timStat; /* timer channel status word */
|
||||||
|
LOCAL_D WORD keyStat; /* console channel status word */
|
||||||
|
LOCAL_D P_CON_KBREC kbrec;
|
||||||
|
LOCAL_D TEXT buf[40];
|
||||||
|
LOCAL_D UBYTE wowbuf[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
|
||||||
|
LOCAL_D TEXT *head="LED: ";
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_C VOID PrintHeader(VOID)
|
||||||
|
/* Prints the title at the start of the program */
|
||||||
|
{
|
||||||
|
p_printf("*********************");
|
||||||
|
p_printf("Welcome to the ASIC 4");
|
||||||
|
p_printf("Example IF board test");
|
||||||
|
p_printf("program");
|
||||||
|
p_printf("*********************");
|
||||||
|
p_printf(".....\n");
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID PrintInstructions(VOID)
|
||||||
|
{
|
||||||
|
p_printf("Type in the test number");
|
||||||
|
p_printf(" 0 => Alternate flash");
|
||||||
|
p_printf(" 1 => Asynchronous read");
|
||||||
|
p_printf(" 2 => Sense");
|
||||||
|
p_printf(" 3 => Set");
|
||||||
|
p_printf(" 4 => Memory");
|
||||||
|
p_printf(" q => Quit");
|
||||||
|
p_printf(" .....");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID LoadLdd(VOID)
|
||||||
|
/* Loads the LDD A4Exif.ldd from anywhere and exits on failure */
|
||||||
|
{
|
||||||
|
TEXT filename[128];
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
p_printf("\nLOADLDD=>");
|
||||||
|
p_fparse("A4EXIF.LDD",DatCommandPtr,&filename[0],NULL);
|
||||||
|
if ((ret=p_loadldd(&filename[0]))<0)
|
||||||
|
{
|
||||||
|
p_printf("A4Exif.ldd failed to load");
|
||||||
|
if (ret==E_FILE_NXIST)
|
||||||
|
{
|
||||||
|
p_printf("Device does not exist");
|
||||||
|
p_getch();
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
else if (ret==E_FILE_EXIST)
|
||||||
|
{
|
||||||
|
p_printf("Device is already loaded");
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
else if (ret==E_GEN_NOMEMORY)
|
||||||
|
{
|
||||||
|
p_printf("Not enough memory available");
|
||||||
|
p_getch();
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_printf("Unknown error %d on p_loadldd",ret);
|
||||||
|
p_getch();
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_printf("Successfully loaded A4Exif.ldd\n");
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID UnloadLdd(VOID)
|
||||||
|
/* Removes the LDD A4Exif.ldd */
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
p_printf("\nUNLOADLDD=>");
|
||||||
|
if ((ret=p_devdel("LED",E_LDD))!=0)
|
||||||
|
{
|
||||||
|
p_printf("A4Exif.ldd failed to unload");
|
||||||
|
if (ret==E_FILE_DEVICE)
|
||||||
|
p_printf("The device driver is not loaded");
|
||||||
|
else if (ret==E_GEN_INUSE)
|
||||||
|
p_printf("Driver is open and cannot be deleted");
|
||||||
|
else
|
||||||
|
p_printf("Unknown error %d on p_devdel",ret);
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_printf("Successfully deleted A4Exif.ldd");
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenPort(VOID)
|
||||||
|
/*Opens a serial port of the A4Example IF on the host machine*/
|
||||||
|
{
|
||||||
|
INT ret, seropen;
|
||||||
|
|
||||||
|
p_printf("\nOPENPORT=>");
|
||||||
|
DoAgain:
|
||||||
|
p_printf("Type in the serial\r\nport to open");
|
||||||
|
p_printf("eg A => port A");
|
||||||
|
p_printf(".....\n");
|
||||||
|
ret=p_toupper(p_getch());
|
||||||
|
*(head+4)=ret;
|
||||||
|
p_printf("%s",head);
|
||||||
|
p_sleep(5L);
|
||||||
|
if ((seropen=p_open(&serH,head,-1))<0)
|
||||||
|
{/* Failed to open */
|
||||||
|
p_atos(&buf[0],"p_open on port %c has failed",ret);
|
||||||
|
p_printf("%s\n<p_open ret=%d>",&buf[0],seropen);
|
||||||
|
p_errs(buf,seropen);
|
||||||
|
p_printf("%s\n",&buf[0]);
|
||||||
|
p_getch();
|
||||||
|
goto DoAgain;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{/* Succeeded in opening */
|
||||||
|
p_atos(&buf[0],"Successfully opened port %c",ret);
|
||||||
|
p_printf("%s",&buf[0]);
|
||||||
|
p_printf(".....\n");
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ClosePort(VOID)
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
p_printf("\nCLOSEPORT=>");
|
||||||
|
if ((ret=p_close(serH))!=0)
|
||||||
|
p_printf("Error in closing port");
|
||||||
|
else
|
||||||
|
p_printf("Successfully closed port");
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SensePort(VOID)
|
||||||
|
{
|
||||||
|
UBYTE A1,A2;
|
||||||
|
|
||||||
|
p_printf("\nSENSEPORT=>");
|
||||||
|
p_iow(serH,P_FSENSE,&A1,&A2);
|
||||||
|
p_printf("Status byte: 0x%x",A1);
|
||||||
|
p_printf("LED byte: 0x%x",A2);
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT SetPort(VOID)
|
||||||
|
{
|
||||||
|
UBYTE key;
|
||||||
|
|
||||||
|
p_printf("\nSETPORT=>");
|
||||||
|
p_printf("Type a key");
|
||||||
|
p_printf("ESCAPE to exit\r\n");
|
||||||
|
if ((key=p_getch())==E_KEY_ESCAPE)
|
||||||
|
{
|
||||||
|
key=0x00;
|
||||||
|
p_iow(serH,P_FSET,&key);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_printf("Output byte is 0x%x",key);
|
||||||
|
p_iow(serH,P_FSET,&key);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenTimer(VOID)
|
||||||
|
{
|
||||||
|
if (p_open(&timH,"TIM:",-1)<0)
|
||||||
|
{/* Error in opening timer */
|
||||||
|
p_printf("Cannot open timer channel\n");
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueTimer(ULONG timeouttime)
|
||||||
|
{
|
||||||
|
p_ioc4(timH,P_FRELATIVE,&timStat,&timeouttime);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CancelTimer(VOID)
|
||||||
|
{
|
||||||
|
p_iow(timH,P_FCANCEL);
|
||||||
|
p_waitstat(&timStat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueSerRead(UBYTE *statusptr,UBYTE *ledptr)
|
||||||
|
{
|
||||||
|
p_ioc5(serH,P_FREAD,&serReadStat,statusptr,ledptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CancelSerRead(VOID)
|
||||||
|
{
|
||||||
|
p_iow(serH,P_FCANCEL);
|
||||||
|
p_waitstat(&serReadStat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueKeypress(P_CON_KBREC *keybrec)
|
||||||
|
{
|
||||||
|
p_ioc4(winHandle,P_FREAD,&keyStat,keybrec);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID AsynchRead(VOID)
|
||||||
|
{
|
||||||
|
UBYTE b_led;
|
||||||
|
UBYTE b_status;
|
||||||
|
|
||||||
|
p_printf("ASYNCH READ\r\n");
|
||||||
|
OpenTimer();
|
||||||
|
QueueTimer(SERREAD_TIMEOUT);
|
||||||
|
QueueSerRead(&b_status,&b_led);
|
||||||
|
QueueKeypress(&kbrec);
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
p_iowait();
|
||||||
|
if (keyStat!=E_FILE_PENDING)
|
||||||
|
{/* Keypress received */
|
||||||
|
p_printf("KEYPRESS");
|
||||||
|
if (kbrec.keycode==E_KEY_ESCAPE)
|
||||||
|
{
|
||||||
|
CancelSerRead();
|
||||||
|
CancelTimer();
|
||||||
|
b_led=0x00;
|
||||||
|
p_iow(serH,P_FWRITE,&b_led);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Do nothing - requeue keypress */
|
||||||
|
QueueKeypress(&kbrec);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (serReadStat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
p_printf("SERIAL READ COMPLETED");
|
||||||
|
CancelTimer();
|
||||||
|
p_printf("Status byte is => 0x%x",b_status);
|
||||||
|
p_printf("LED byte is => 0x%x",b_led);
|
||||||
|
QueueTimer(SERREAD_TIMEOUT);
|
||||||
|
QueueSerRead(&b_status,&b_led);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (timStat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
p_printf("TIMEOUT");
|
||||||
|
CancelSerRead();
|
||||||
|
QueueSerRead(&b_status,&b_led);
|
||||||
|
QueueTimer(SERREAD_TIMEOUT);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{/* Error - missing status word so fatal error */
|
||||||
|
p_printf("***Stray status word***");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p_close(timH);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID AlternateFlash(VOID)
|
||||||
|
{
|
||||||
|
UBYTE b_led;
|
||||||
|
INT i=0;
|
||||||
|
|
||||||
|
p_printf("ALTERNATE FLASH\r\n");
|
||||||
|
p_printf("Hit ESCAPE to exit");
|
||||||
|
OpenTimer();
|
||||||
|
QueueTimer(FLASH_TIME);
|
||||||
|
QueueKeypress(&kbrec);
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
p_iowait();
|
||||||
|
if (keyStat!=E_FILE_PENDING)
|
||||||
|
{/* Keypress received */
|
||||||
|
if (kbrec.keycode==E_KEY_ESCAPE)
|
||||||
|
{
|
||||||
|
CancelTimer();
|
||||||
|
b_led=0x00;
|
||||||
|
p_iow(serH,P_FWRITE,&b_led);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Do nothing - requeue keypress */
|
||||||
|
QueueKeypress(&kbrec);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (timStat!=E_FILE_PENDING)
|
||||||
|
{/* Timer finished */
|
||||||
|
if (i<MAXBUF)
|
||||||
|
{
|
||||||
|
p_iow(serH,P_FSET,&wowbuf[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i=0;
|
||||||
|
p_iow(serH,P_FSET,&wowbuf[i]);
|
||||||
|
}
|
||||||
|
QueueTimer(FLASH_TIME);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{/* Missing status word so fatal error */
|
||||||
|
p_printf("***Stray status error***");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p_close(timH);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CheckMemory(TEXT *str)
|
||||||
|
{
|
||||||
|
VOID *Heap;
|
||||||
|
INT fbytes;
|
||||||
|
|
||||||
|
fbytes=p_allspc(&Heap);
|
||||||
|
p_print("\n\t%s\r\n",str);
|
||||||
|
p_print("Free Heap Memory =>\r\n\t%x bytes\r\n",fbytes);
|
||||||
|
p_print("Free Segments =>\r\n\t%d\r\n",p_sgfree());
|
||||||
|
p_getch();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID MemoryTest(VOID)
|
||||||
|
{
|
||||||
|
CheckMemory("OpenPort");
|
||||||
|
ClosePort();
|
||||||
|
CheckMemory("ClosedPort");
|
||||||
|
UnloadLdd();
|
||||||
|
CheckMemory("UnoadedLdd");
|
||||||
|
LoadLdd();
|
||||||
|
CheckMemory("LoadLdd");
|
||||||
|
OpenPort();
|
||||||
|
CheckMemory("OpenPort");
|
||||||
|
p_printf("End of Memory Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
INT ret,set=0;
|
||||||
|
|
||||||
|
PrintHeader();
|
||||||
|
LoadLdd();
|
||||||
|
OpenPort();
|
||||||
|
Start:
|
||||||
|
PrintInstructions();
|
||||||
|
if ((ret=p_getch())=='0')
|
||||||
|
AlternateFlash();
|
||||||
|
else if (ret=='1')
|
||||||
|
AsynchRead();
|
||||||
|
else if (ret=='2')
|
||||||
|
SensePort();
|
||||||
|
else if (ret=='3')
|
||||||
|
{
|
||||||
|
while (set>=0)
|
||||||
|
set=SetPort();
|
||||||
|
set=0;
|
||||||
|
}
|
||||||
|
else if (ret=='4')
|
||||||
|
MemoryTest();
|
||||||
|
else if (ret=='q')
|
||||||
|
{
|
||||||
|
ClosePort();
|
||||||
|
UnloadLdd();
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
goto Start;
|
||||||
|
goto Start;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#system epoc img
|
||||||
|
#set epocinit=iplib
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#compile a4test
|
||||||
|
#link a4test
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
.xlist
|
||||||
|
; Include file - EPOC.INC
|
||||||
|
; Epoc/Os standard include file
|
||||||
|
; Copyright (c) Psion PLC 1989-90.
|
||||||
|
;
|
||||||
|
; VER DATE BY DESCRIPTION
|
||||||
|
; ----- -------- ---- -----------
|
||||||
|
; 2.00F 30/09/90 NSM Final release
|
||||||
|
;
|
||||||
|
EPOC_INC equ 1
|
||||||
|
;
|
||||||
|
include ..\inc\epocdef.inc
|
||||||
|
include ..\inc\epocmac.inc
|
||||||
|
include ..\inc\epocpan.inc
|
||||||
|
.list
|
||||||
@@ -0,0 +1,284 @@
|
|||||||
|
.xlist
|
||||||
|
; Include file - EPOCLIB.INC
|
||||||
|
; Epoc/Os plib standard include file.
|
||||||
|
; Copyright (c) Psion PLC 1989-90.
|
||||||
|
;
|
||||||
|
; VER DATE BY DESCRIPTION
|
||||||
|
; ----- -------- ---- -----------
|
||||||
|
; 2.00F 30/09/90 NSM Final release
|
||||||
|
;
|
||||||
|
EPOCLIB_INC equ 1
|
||||||
|
;
|
||||||
|
_TANDW = 0
|
||||||
|
ifdef LATTICE
|
||||||
|
CodeSeg macro
|
||||||
|
pgroup group prog
|
||||||
|
PGROUP equ <pgroup>
|
||||||
|
prog segment byte public 'prog'
|
||||||
|
assume cs:pgroup
|
||||||
|
endm
|
||||||
|
EndCodeSeg macro
|
||||||
|
prog ends
|
||||||
|
endm
|
||||||
|
DataSeg macro
|
||||||
|
dgroup group data,udata
|
||||||
|
DGROUP equ <dgroup>
|
||||||
|
data segment word public 'data'
|
||||||
|
assume ds:dgroup,es:dgroup,ss:dgroup
|
||||||
|
endm
|
||||||
|
EndDataSeg macro
|
||||||
|
data ends
|
||||||
|
endm
|
||||||
|
UDataSeg macro
|
||||||
|
udata segment word public 'data'
|
||||||
|
endm
|
||||||
|
EndUDataSeg macro
|
||||||
|
udata ends
|
||||||
|
endm
|
||||||
|
GLREF_D MACRO NAME,TYPE
|
||||||
|
EXTRN NAME:TYPE
|
||||||
|
ENDM
|
||||||
|
GLDEF_D MACRO NAME,TYPE
|
||||||
|
PUBLIC NAME
|
||||||
|
NAME label TYPE
|
||||||
|
ENDM
|
||||||
|
GLREF_C MACRO NAME
|
||||||
|
EXTRN NAME:NEAR
|
||||||
|
ENDM
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
ifdef TURBOC
|
||||||
|
_TANDW = 1
|
||||||
|
CodeSeg macro
|
||||||
|
PGROUP group _TEXT
|
||||||
|
pgroup equ <PGROUP>
|
||||||
|
_TEXT segment byte public 'CODE'
|
||||||
|
assume cs:PGROUP
|
||||||
|
endm
|
||||||
|
EndCodeSeg macro
|
||||||
|
_TEXT ends
|
||||||
|
endm
|
||||||
|
DataSeg macro
|
||||||
|
DGROUP group _DATA,_BSS
|
||||||
|
dgroup equ <DGROUP>
|
||||||
|
_DATA segment word public 'DATA'
|
||||||
|
assume ds:DGROUP,es:DGROUP,ss:DGROUP
|
||||||
|
endm
|
||||||
|
EndDataSeg macro
|
||||||
|
_DATA ends
|
||||||
|
endm
|
||||||
|
UDataSeg macro
|
||||||
|
_BSS segment word public 'BSS'
|
||||||
|
endm
|
||||||
|
EndUDataSeg macro
|
||||||
|
_BSS ends
|
||||||
|
endm
|
||||||
|
GLREF_D MACRO NAME,TYPE
|
||||||
|
EXTRN _&NAME:TYPE
|
||||||
|
NAME EQU _&NAME
|
||||||
|
ENDM
|
||||||
|
GLDEF_D MACRO NAME,TYPE
|
||||||
|
PUBLIC _&NAME
|
||||||
|
_&NAME label TYPE
|
||||||
|
NAME EQU _&NAME
|
||||||
|
ENDM
|
||||||
|
GLREF_C MACRO NAME
|
||||||
|
EXTRN _&NAME:NEAR
|
||||||
|
NAME EQU _&NAME
|
||||||
|
ENDM
|
||||||
|
endif
|
||||||
|
ifdef WATCOMC
|
||||||
|
REG_PARAM equ 1
|
||||||
|
ifdef _MSC
|
||||||
|
_TANDW = 1
|
||||||
|
endif
|
||||||
|
CodeSeg macro
|
||||||
|
PGROUP group _TEXT
|
||||||
|
pgroup equ <PGROUP>
|
||||||
|
_TEXT segment byte public 'CODE'
|
||||||
|
assume cs:PGROUP
|
||||||
|
endm
|
||||||
|
EndCodeSeg macro
|
||||||
|
_TEXT ends
|
||||||
|
endm
|
||||||
|
DataSeg macro
|
||||||
|
DGROUP group _DATA,_BSS
|
||||||
|
dgroup equ <DGROUP>
|
||||||
|
_DATA segment word public 'DATA'
|
||||||
|
assume ds:DGROUP,es:DGROUP,ss:DGROUP
|
||||||
|
endm
|
||||||
|
EndDataSeg macro
|
||||||
|
_DATA ends
|
||||||
|
endm
|
||||||
|
UDataSeg macro
|
||||||
|
_BSS segment word public 'BSS'
|
||||||
|
endm
|
||||||
|
EndUDataSeg macro
|
||||||
|
_BSS ends
|
||||||
|
endm
|
||||||
|
GLREF_D MACRO NAME,TYPE
|
||||||
|
EXTRN NAME&_:TYPE
|
||||||
|
NAME EQU NAME&_
|
||||||
|
ENDM
|
||||||
|
GLDEF_D MACRO NAME,TYPE
|
||||||
|
PUBLIC NAME&_
|
||||||
|
NAME&_ label TYPE
|
||||||
|
NAME EQU NAME&_
|
||||||
|
ENDM
|
||||||
|
GLREF_C MACRO NAME
|
||||||
|
EXTRN NAME&_:NEAR
|
||||||
|
NAME EQU NAME&_
|
||||||
|
ENDM
|
||||||
|
endif
|
||||||
|
ifdef JPIC
|
||||||
|
REG_PARAM equ 1
|
||||||
|
ifdef _MSC
|
||||||
|
_TANDW = 1
|
||||||
|
endif
|
||||||
|
CodeSeg macro
|
||||||
|
_TEXT segment byte public 'CODE'
|
||||||
|
assume cs:_TEXT
|
||||||
|
endm
|
||||||
|
EndCodeSeg macro
|
||||||
|
_TEXT ends
|
||||||
|
endm
|
||||||
|
DataSeg macro
|
||||||
|
DGROUP group _DATA,_BSS
|
||||||
|
dgroup equ <DGROUP>
|
||||||
|
_DATA segment word public 'DATA'
|
||||||
|
assume ds:DGROUP,es:DGROUP,ss:DGROUP
|
||||||
|
endm
|
||||||
|
EndDataSeg macro
|
||||||
|
_DATA ends
|
||||||
|
endm
|
||||||
|
UDataSeg macro
|
||||||
|
_BSS segment word public 'BSS'
|
||||||
|
endm
|
||||||
|
EndUDataSeg macro
|
||||||
|
_BSS ends
|
||||||
|
endm
|
||||||
|
GLREF_D MACRO NAME,TYPE
|
||||||
|
EXTRN _&NAME:TYPE
|
||||||
|
NAME EQU _&NAME
|
||||||
|
ENDM
|
||||||
|
GLDEF_D MACRO NAME,TYPE
|
||||||
|
PUBLIC _&NAME
|
||||||
|
_&NAME label TYPE
|
||||||
|
NAME EQU _&NAME
|
||||||
|
ENDM
|
||||||
|
GLREF_C MACRO NAME
|
||||||
|
EXTRN _&NAME:NEAR
|
||||||
|
NAME EQU _&NAME
|
||||||
|
ENDM
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
LOCAL_D MACRO NAME,TYPE
|
||||||
|
NAME label TYPE
|
||||||
|
ENDM
|
||||||
|
;
|
||||||
|
ProcBegin macro _Name,_Type,_Registers
|
||||||
|
ifdef TURBOC
|
||||||
|
ProcBeginBody _&_Name,_Type,_Registers
|
||||||
|
endif
|
||||||
|
ifdef JPIC
|
||||||
|
ProcBeginBody _&_Name,_Type,_Registers
|
||||||
|
endif
|
||||||
|
ifdef WATCOMC
|
||||||
|
ProcBeginBody _Name&_,_Type,_Registers
|
||||||
|
_Name EQU _Name&_
|
||||||
|
endif
|
||||||
|
ifdef LATTICE
|
||||||
|
ProcBeginBody _Name,_Type,_Registers
|
||||||
|
endif
|
||||||
|
endm
|
||||||
|
ProcBegin@ macro _Name,_Type,_Registers
|
||||||
|
ProcBeginBody _Name,_Type,_Registers
|
||||||
|
endm
|
||||||
|
ProcBeginBody macro _Name,_Type,_Registers
|
||||||
|
_DI = 0
|
||||||
|
_SI = 0
|
||||||
|
if _TANDW
|
||||||
|
ifnb <_Registers>
|
||||||
|
irpc _flags,_Registers
|
||||||
|
ifidni <_flags>,<D>
|
||||||
|
_DI = 1
|
||||||
|
endif
|
||||||
|
ifidni <_flags>,<S>
|
||||||
|
_SI = 1
|
||||||
|
endif
|
||||||
|
endm
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
ProcEnd macro _flag
|
||||||
|
ifb <_flag>
|
||||||
|
if _DI
|
||||||
|
pop di
|
||||||
|
endif
|
||||||
|
if _SI
|
||||||
|
pop si
|
||||||
|
endif
|
||||||
|
if _TANDW
|
||||||
|
ifidni <_Type>,<bp>
|
||||||
|
pop bp
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifdef LATTICE
|
||||||
|
ifidni <_Type>,<bp>
|
||||||
|
pop bp
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ret
|
||||||
|
endif
|
||||||
|
&_Name endp
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
public _Name
|
||||||
|
ifidni <_Type>,<far>
|
||||||
|
_Name proc far
|
||||||
|
else
|
||||||
|
_Name proc near
|
||||||
|
endif
|
||||||
|
ifidni <_Type>,<bp>
|
||||||
|
if _TANDW
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
endif
|
||||||
|
ifdef LATTICE
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
endif
|
||||||
|
Arg1 equ <[bp+4]>
|
||||||
|
Arg2 equ <[bp+6]>
|
||||||
|
Arg3 equ <[bp+8]>
|
||||||
|
Arg4 equ <[bp+10]>
|
||||||
|
Arg5 equ <[bp+12]>
|
||||||
|
Arg6 equ <[bp+14]>
|
||||||
|
Arg7 equ <[bp+16]>
|
||||||
|
Arg8 equ <[bp+18]>
|
||||||
|
endif
|
||||||
|
ifidni <_Type>,<bx>
|
||||||
|
if _TANDW
|
||||||
|
mov bx, sp
|
||||||
|
endif
|
||||||
|
ifdef LATTICE
|
||||||
|
mov bx, sp
|
||||||
|
endif
|
||||||
|
Arg1 equ <[bx+2]>
|
||||||
|
Arg2 equ <[bx+4]>
|
||||||
|
Arg3 equ <[bx+6]>
|
||||||
|
Arg4 equ <[bx+8]>
|
||||||
|
Arg5 equ <[bx+10]>
|
||||||
|
Arg6 equ <[bx+12]>
|
||||||
|
Arg7 equ <[bx+14]>
|
||||||
|
Arg8 equ <[bx+16]>
|
||||||
|
endif
|
||||||
|
if _SI
|
||||||
|
push si
|
||||||
|
endif
|
||||||
|
if _DI
|
||||||
|
push di
|
||||||
|
endif
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
.list
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
.xlist
|
||||||
|
; Include file - EPOCSER.INC
|
||||||
|
; Epoc/Os standard Serial Driver defines
|
||||||
|
; Copyright (c) Psion PLC 1989-90.
|
||||||
|
;
|
||||||
|
; VER DATE BY DESCRIPTION
|
||||||
|
; ----- -------- ---- -----------
|
||||||
|
; 2.00F 30/09/90 JH Final release
|
||||||
|
; 2.01F 05/10/90 JH Added a define for Constant speed DTE modems
|
||||||
|
;
|
||||||
|
EPOCSER_INC equ 1
|
||||||
|
; Serial port characteristics
|
||||||
|
SerialCharEnt struc
|
||||||
|
SerialCharTbaud db ? ; transmit Baud rate selector
|
||||||
|
SerialCharRbaud db ? ; receive Baud rate selector
|
||||||
|
SerialCharFrame db ? ; number of data, parity and stop bits
|
||||||
|
SerialCharParity db ? ; parity selector
|
||||||
|
SerialCharHandshake db ? ; handshake flags
|
||||||
|
SerialCharXon db ? ; XON character
|
||||||
|
SerialCharXoff db ? ; XOFF character
|
||||||
|
SerialCharFlags db ? ; control flags
|
||||||
|
SerialCharTmask dd ? ; terminator mask
|
||||||
|
SerialCharEnt ends
|
||||||
|
|
||||||
|
; Function numbers to use to call PDD functions
|
||||||
|
SerPDDFuncOpen equ 0
|
||||||
|
SerPDDFuncClose equ 2
|
||||||
|
SerPDDFuncStart equ 4
|
||||||
|
SerPDDFuncStop equ 6
|
||||||
|
SerPDDFuncSet equ 8
|
||||||
|
SerPDDFuncSense equ 10
|
||||||
|
SerPDDFuncControl equ 12
|
||||||
|
SerPDDFuncEnquire equ 14
|
||||||
|
SerPDDFuncEnable equ 16
|
||||||
|
SerPDDFuncSetHandlerCS equ 18
|
||||||
|
|
||||||
|
;
|
||||||
|
SERPARITY_ERR equ 0ffh
|
||||||
|
SERFRAME_ERR equ 0feh
|
||||||
|
SEROVERRUN_ERR equ 0fdh
|
||||||
|
|
||||||
|
SERNOCHAR equ 0ffffh
|
||||||
|
|
||||||
|
; Baud rates
|
||||||
|
P_BAUD_50 equ 01h
|
||||||
|
P_BAUD_75 equ 02h
|
||||||
|
P_BAUD_110 equ 03h
|
||||||
|
P_BAUD_134 equ 04h
|
||||||
|
P_BAUD_150 equ 05h
|
||||||
|
P_BAUD_300 equ 06h
|
||||||
|
P_BAUD_600 equ 07h
|
||||||
|
P_BAUD_1200 equ 08h
|
||||||
|
P_BAUD_1800 equ 09h
|
||||||
|
P_BAUD_2000 equ 0Ah
|
||||||
|
P_BAUD_2400 equ 0Bh
|
||||||
|
P_BAUD_3600 equ 0Ch
|
||||||
|
P_BAUD_4800 equ 0Dh
|
||||||
|
P_BAUD_7200 equ 0Eh
|
||||||
|
P_BAUD_9600 equ 0Fh
|
||||||
|
P_BAUD_19200 equ 10h
|
||||||
|
P_BAUD_38400 equ 11h
|
||||||
|
P_BAUD_56000 equ 12h
|
||||||
|
|
||||||
|
; allocation of frame bits
|
||||||
|
P_DATA_FRM equ 0fh ; number of data bits mask
|
||||||
|
P_DATA_5 equ 0h ; 5 data bits
|
||||||
|
P_DATA_6 equ 1h ; 6 data bits
|
||||||
|
P_DATA_7 equ 2h ; 7 data bits
|
||||||
|
P_DATA_8 equ 3h ; 8 data bits
|
||||||
|
P_TWOSTOP equ 10h ; 2 stop bits if set, 1 if clear
|
||||||
|
P_PARITY equ 20h ; 1 parity bit if set, 0 if clear
|
||||||
|
|
||||||
|
; parity - ignored unless P_PARITY is set
|
||||||
|
P_PAR_EVEN equ 1h ; even parity
|
||||||
|
P_PAR_ODD equ 2h ; odd parity
|
||||||
|
P_PAR_MARK equ 3h ; mark parity
|
||||||
|
P_PAR_SPACE equ 4h ; space parity
|
||||||
|
|
||||||
|
; handshaking control
|
||||||
|
P_OBEY_XOFF equ 01h ; respond to received XOFF (and XON) if set
|
||||||
|
P_SEND_XOFF equ 02h ; send XOFF/XON to control receive buf if set
|
||||||
|
P_IGN_CTS equ 04h ; ignore the state of CTS if set
|
||||||
|
P_OBEY_DSR equ 08h ; obey the state of DSR if set
|
||||||
|
P_FAIL_DSR equ 10h ; fail if DSR goes OFF if set
|
||||||
|
P_OBEY_DCD equ 20h ; obey the state of DCD if set
|
||||||
|
P_FAIL_DCD equ 40h ; fail if DCD goes OFF if set
|
||||||
|
|
||||||
|
; flags control
|
||||||
|
P_IGNORE_PARITY equ 01h ; ignore parity errors
|
||||||
|
|
||||||
|
; For P_FCTRL function
|
||||||
|
P_SRCTRL_CTS equ 01h
|
||||||
|
P_SRCTRL_DSR equ 02h
|
||||||
|
P_SRCTRL_DCD equ 04h
|
||||||
|
P_SRCTRL_DTR equ 08h
|
||||||
|
P_SRCTRL_RTS equ 10h
|
||||||
|
|
||||||
|
P_SRDTR_ON equ 1h ; to set DTR to MARK
|
||||||
|
P_SRDTR_OFF equ 2h ; to set DTR to SPACE
|
||||||
|
|
||||||
|
; Bit masks for P_FINQ function
|
||||||
|
P_SRINQ_50 equ 0001h
|
||||||
|
P_SRINQ_75 equ 0002h
|
||||||
|
P_SRINQ_110 equ 0004h
|
||||||
|
P_SRINQ_134 equ 0008h
|
||||||
|
P_SRINQ_150 equ 0010h
|
||||||
|
P_SRINQ_300 equ 0020h
|
||||||
|
P_SRINQ_600 equ 0040h
|
||||||
|
P_SRINQ_1200 equ 0080h
|
||||||
|
P_SRINQ_1800 equ 0100h
|
||||||
|
P_SRINQ_2000 equ 0200h
|
||||||
|
P_SRINQ_2400 equ 0400h
|
||||||
|
P_SRINQ_3600 equ 0800h
|
||||||
|
P_SRINQ_4800 equ 1000h
|
||||||
|
P_SRINQ_7200 equ 2000h
|
||||||
|
P_SRINQ_9600 equ 4000h
|
||||||
|
P_SRINQ_19200 equ 8000h
|
||||||
|
; second baud rate word
|
||||||
|
P_SRINQ_38400 equ 0001h
|
||||||
|
P_SRINQ_56000 equ 0002h
|
||||||
|
|
||||||
|
; 2nd set of info
|
||||||
|
P_SRINQ_DATA5 equ 0001h ; supports 5 data bits
|
||||||
|
P_SRINQ_DATA6 equ 0002h ; supports 6 data bits
|
||||||
|
P_SRINQ_DATA7 equ 0004h ; supports 7 data bits
|
||||||
|
P_SRINQ_DATA8 equ 0008h ; supports 8 data bits
|
||||||
|
P_SRINQ_STOP2 equ 0010h ; supports 2 stop bits (as well as 1)
|
||||||
|
P_SRINQ_PAREVEN equ 0020h ; supports even parity
|
||||||
|
P_SRINQ_PARODD equ 0040h ; supports odd parity
|
||||||
|
P_SRINQ_PARMARK equ 0080h ; supports mark parity
|
||||||
|
P_SRINQ_PARSPACE equ 0100h ; supports space parity
|
||||||
|
P_SRINQ_SETDTR equ 0200h ; can set DTR
|
||||||
|
P_SRINQ_SPLIT equ 0400h ; supports split Baud rates
|
||||||
|
P_SRINQ_XONXOFF equ 0800h ; Supports soft xon/xoff characters
|
||||||
|
|
||||||
|
; CRC generator section
|
||||||
|
; The Low and High bytes of the 16 bit CRC
|
||||||
|
CrcEnt struc
|
||||||
|
CrcLow db ? ; CRC low byte
|
||||||
|
CrcHigh db ? ; CRC high byte
|
||||||
|
CrcEnt ends
|
||||||
|
|
||||||
|
;Serial Driver Media Access Control section (LLMAC)
|
||||||
|
;
|
||||||
|
P_MAXILEN equ 300 ; maximum length of information field
|
||||||
|
|
||||||
|
;Frame type codes
|
||||||
|
LA_LPDU equ 0 ; The Link Acknowledge PDU
|
||||||
|
LD_LPDU equ 1 ; The Link disconnect PDU
|
||||||
|
LR_LPDU equ 2 ; The Link Request PDU
|
||||||
|
LT_LPDU equ 3 ; The Link Data PDU
|
||||||
|
P_FRM_BROKEN equ 4 ; A broken frame
|
||||||
|
|
||||||
|
FrameEnt struc
|
||||||
|
FrameType db ? ; frame type
|
||||||
|
FrameSeq db ? ; frame sequence
|
||||||
|
FrameLen dw ? ; length of information field
|
||||||
|
FramePbuf dw ? ; ptr to data buffer
|
||||||
|
FrameEnt ends
|
||||||
|
|
||||||
|
; LLMAC layer characteristics
|
||||||
|
LlmacEnt struc
|
||||||
|
LlmacIlen dw ? ; maximum information field length
|
||||||
|
LlmacSpeed dw ? ; nominal speed in characters per second
|
||||||
|
LlmacRtint dw ? ; suggested retransmission interval
|
||||||
|
LlmacEnt ends
|
||||||
|
|
||||||
|
; LINK layer structures and defines
|
||||||
|
; IoFuncConnect service connection modes */
|
||||||
|
P_LINK_ACCP equ 0 ; want link as acceptor
|
||||||
|
P_LINK_INIT equ 1 ; want link as initiator
|
||||||
|
|
||||||
|
; Link layer states
|
||||||
|
P_LINK_IDLE equ 0 ; no connection - idle
|
||||||
|
P_LINK_IDLE_LR equ 1 ; no connection - awaiting LR
|
||||||
|
P_LINK_DATA_IDLE equ 2 ; connected - idle
|
||||||
|
P_LINK_DATA_LA equ 3 ; connected - awaiting LA
|
||||||
|
P_LINK_IDLE_LA equ 4 ; not connected - awaiting LA (or LT) to LR
|
||||||
|
|
||||||
|
;State and event log record
|
||||||
|
LinkLogEnt struc
|
||||||
|
LinkLogState db ? ; Link layer state (as defined above)
|
||||||
|
LinkLogEvent db ? ; Event that occured
|
||||||
|
LinkLogEnt ends
|
||||||
|
|
||||||
|
P_LINK_NLOG equ 32 ; Max number of debug events,states we record
|
||||||
|
P_LINK_LOG_MASK equ 0C0h
|
||||||
|
P_LINK_LOG_PANIC equ 0C0h ; panic number
|
||||||
|
P_LINK_LOG_MAC equ 0 ; MAC request or timer
|
||||||
|
P_LINK_LOG_REQ equ 80h ; User request
|
||||||
|
P_LINK_LOG_COMP equ 40h ; User completion
|
||||||
|
|
||||||
|
LinkDataEnt struc
|
||||||
|
LinkDataLlmac LlmacEnt <>
|
||||||
|
LinkDataBrokenCount dw ? ; count of broken frames
|
||||||
|
LinkDataRetranCount dw ? ; re-transmission count
|
||||||
|
LinkDataEnt ends
|
||||||
|
|
||||||
|
; Comms I/O drivers shared code header structs
|
||||||
|
; Flag defines
|
||||||
|
RQ_TIMER equ 01h ; a timer has been started
|
||||||
|
RQ_SUPER equ 02h ; a supervisory read has been started
|
||||||
|
RQ_WRITE equ 04h ; a write has been started
|
||||||
|
RQ_READ equ 08h ; a data read has been started
|
||||||
|
RQ_DISABLE_HANDLER equ 10h ; set to disable handers
|
||||||
|
RQ_ANY equ (RQ_TIMER or RQ_SUPER or RQ_WRITE or RQ_READ)
|
||||||
|
|
||||||
|
;Flag bits to indicate various features of the link layer event.
|
||||||
|
QUEUE_XMIT_LA equ 20h ; queue an LA when the transmit completes
|
||||||
|
LINK_ACTIVE equ 40h ; set between a P_FCONNECT and a disconnect
|
||||||
|
USER_DATA_PENDING equ 80h
|
||||||
|
|
||||||
|
; DONT CHANGE THE ORDER OF THIS !!
|
||||||
|
IoRequestEnt struc
|
||||||
|
IoRequestChan ChanEnt <> ; I/O control block
|
||||||
|
IoRequestWaitHandler dw ? ; wait handler vector number
|
||||||
|
IoRequestRqRead RqEnt <> ; Read request packet
|
||||||
|
IoRequestRqWrite RqEnt <> ; Write request packet
|
||||||
|
IoRequestRqSuper RqEnt <> ; Supervisorry request packet
|
||||||
|
IoRequestTimerPcb dw ? ; open Timer cb
|
||||||
|
IoRequestTimerStat dw ? ; timer completion status
|
||||||
|
IoRequestReadStat dw ? ; read completion status
|
||||||
|
IoRequestWriteStat dw ? ; write completion status
|
||||||
|
IoRequestSuperStat dw ? ; supervisory completion status
|
||||||
|
IoRequestFlags db ? ; controlling flags
|
||||||
|
IoRequestState db ? ; current internal state
|
||||||
|
IoRequestEnt ends
|
||||||
|
|
||||||
|
LnkEnt struc
|
||||||
|
LnkIoRequest IoRequestEnt <> ; I/O header
|
||||||
|
LnkLinkData LinkDataEnt <> ; Link layer data
|
||||||
|
LnkNumberLog dw ? ; current log table event no.
|
||||||
|
LnkLogTable db (size LinkLogEnt)*P_LINK_NLOG dup (?)
|
||||||
|
LnkEnt ends
|
||||||
|
|
||||||
|
; XMODEM structures and defines
|
||||||
|
; IoFuncConnect service connection modes */
|
||||||
|
P_XMDM_ACCP equ 0 ; want link as acceptor
|
||||||
|
P_XMDM_INIT equ 1 ; want link as initiator
|
||||||
|
|
||||||
|
; Xmodem link types
|
||||||
|
P_XMDM_CRCORCHECKSUM equ 0
|
||||||
|
P_XMDM_CRCMODE equ 1
|
||||||
|
P_XMDM_CHECKSUMMODE equ 2
|
||||||
|
P_YMODEM_MODE equ 3
|
||||||
|
P_YMODEM_G_MODE equ 4
|
||||||
|
P_XMDM_ONE_K equ 8000h
|
||||||
|
|
||||||
|
;Xmodem/Ymodem supported flags
|
||||||
|
P_FXMDM_SENSE equ 0ffh ; I/O function number
|
||||||
|
P_XSUP_XMODEM equ 01h ; original Xmodem checksum
|
||||||
|
P_XSUP_XMODEM_CRC equ 02h ; Xmodem with CRC
|
||||||
|
P_XSUP_ONE_K_OPTION equ 04h ; 1k frames
|
||||||
|
P_XSUP_YMODEM equ 08h ; Ymodem
|
||||||
|
P_XSUP_YMODEM_G equ 10h ; Ymodem-G
|
||||||
|
|
||||||
|
; Xmodem State defines
|
||||||
|
P_XMDM_IDLE equ P_LINK_IDLE ; idle state (no connection)
|
||||||
|
P_XMDM_CONNECT_RECEIVE equ 1 ; receive connect state
|
||||||
|
P_XMDM_CONNECT_TRANSMIT equ 2 ; Transmit connect state
|
||||||
|
P_XMDM_DATA_RECEIVE equ 3 ; receive data state
|
||||||
|
P_XMDM_DATA_TRANSMIT equ 4 ; transmit data state
|
||||||
|
P_XMDM_DATA_TRANSMIT_ACK equ 5 ; awaiting ACK to transmitted data
|
||||||
|
|
||||||
|
;State and event log record
|
||||||
|
XmdmLogEnt struc
|
||||||
|
LinkLogEnt <>
|
||||||
|
XmdmLogEnt ends
|
||||||
|
|
||||||
|
P_XMDM_NLOG equ P_LINK_NLOG ; Max number of debug events,states we record
|
||||||
|
P_XMDM_LOG_MASK equ P_LINK_LOG_MASK
|
||||||
|
P_XMDM_LOG_PANIC equ P_LINK_LOG_PANIC ; panic number
|
||||||
|
P_XMDM_LOG_REQ equ P_LINK_LOG_REQ ; User request
|
||||||
|
P_XMDM_LOG_COMP equ P_LINK_LOG_COMP ; User completion
|
||||||
|
|
||||||
|
; Modem driver info
|
||||||
|
; what options are selected
|
||||||
|
P_MDM_TONE equ 01h
|
||||||
|
P_MDM_BELL equ 02h
|
||||||
|
P_MDM_NO_MODULATION equ 04h
|
||||||
|
P_MDM_CONSTANT_SPEED equ 08h ; modem provides constant speed interface if set
|
||||||
|
|
||||||
|
; error correction types
|
||||||
|
P_MDM_ERRCORRECT_NONE equ 00h
|
||||||
|
P_MDM_ERRCORRECT equ 01h
|
||||||
|
P_MDM_ERRCORRECT_MNP equ 02h
|
||||||
|
P_MDM_ERRCORRECT_V42 equ 03h
|
||||||
|
|
||||||
|
ModemCharEnt struc
|
||||||
|
ModemCharSupport dw ? ; flags saying what supported
|
||||||
|
ModemCharOptions dw ? ; Selected options
|
||||||
|
ModemCharBaudRate dw ? ; Baud rate running at
|
||||||
|
ModemCharConnHand db ? ; Connected handshaking
|
||||||
|
ModemCharCallHand db ? ; Wait for call handshaking
|
||||||
|
ModemCharEnt ends
|
||||||
|
|
||||||
|
.list
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
.xlist
|
||||||
|
; Include file - EPOCSIBO.INC
|
||||||
|
; Epoc/Os SIBO specific include file
|
||||||
|
; Copyright (c) Psion PLC 1989-90.
|
||||||
|
;
|
||||||
|
; VER DATE BY DESCRIPTION
|
||||||
|
; ----- -------- ---- -----------
|
||||||
|
; 2.00F 30/09/90 NSM Final release
|
||||||
|
;
|
||||||
|
EPOCSIBO_INC equ 1
|
||||||
|
;
|
||||||
|
SupplyEnt struc
|
||||||
|
MainBatteryReading dw ?
|
||||||
|
LithiumBatteryReading dw ?
|
||||||
|
MainsPresent dw ?
|
||||||
|
SupplyEnt ends
|
||||||
|
;
|
||||||
|
SupplyWarningsEnt struc
|
||||||
|
MainBatteryWarning dw ?
|
||||||
|
LithiumBatteryWarning dw ?
|
||||||
|
MainBatteryMaxValue dw ?
|
||||||
|
LithiumBatteryMaxValue dw ?
|
||||||
|
SupplyWarningsEnt ends
|
||||||
|
;
|
||||||
|
MainBatZero equ 0
|
||||||
|
MainBatVeryLow equ 1
|
||||||
|
MainBatLow equ 2
|
||||||
|
MainBatGood equ 3
|
||||||
|
;
|
||||||
|
SupplySoundWarning equ 0001h
|
||||||
|
SupplyFlashWarning equ 0002h
|
||||||
|
SupplySystemTimeChanged equ 0004h
|
||||||
|
;
|
||||||
|
SupplyInfoEnt struc
|
||||||
|
SuMainBatLevel db ?
|
||||||
|
SuMainBatStatus db ?
|
||||||
|
SuBackupBatLevel db ?
|
||||||
|
SuDcLevel db ?
|
||||||
|
SuWarningFlags dw ?
|
||||||
|
SuInsertionDate dd ?
|
||||||
|
SuTicksInUseBattery dd ?
|
||||||
|
SuTicksInUseDc dd ?
|
||||||
|
SuMilliampTicks dd ?
|
||||||
|
SupplyInfoEnt ends
|
||||||
|
;
|
||||||
|
SsdUnitInfo struc
|
||||||
|
SsdUnitStatus db ?
|
||||||
|
SsdUnitType db ?
|
||||||
|
SsdUnitDevices db ?
|
||||||
|
SsdUnitAsicType db ?
|
||||||
|
SsdUnitChanged db ?
|
||||||
|
SsdUnitReadCmd db ?
|
||||||
|
SsdUnitTotalSectors dw ?
|
||||||
|
SsdUnitMask dw ?
|
||||||
|
SsdUnitSectorsPerDevice dw ?
|
||||||
|
SsdUnitSpare db ?
|
||||||
|
SsdUnitShift db ?
|
||||||
|
SsdUnitDoReadCmd dw ?
|
||||||
|
SsdUnitInfo ends
|
||||||
|
;
|
||||||
|
SsdData struc
|
||||||
|
SsdUnitInfoBuffer SsdUnitInfo 4 dup(<>)
|
||||||
|
SsdDoorStatus db ?
|
||||||
|
SsdDoorDelay db ?
|
||||||
|
SsdPakCritical db ?
|
||||||
|
SsdDoorOpened db ?
|
||||||
|
SsdOldFrcVector dd ?
|
||||||
|
SsdFrcFlag dw ?
|
||||||
|
SsdPakChannel db ?
|
||||||
|
SsdWriteFlag db ?
|
||||||
|
SsdFlashCount dw ?
|
||||||
|
SsdFlashVector dw ?
|
||||||
|
SsdFlashAddress dw ?
|
||||||
|
SsdFlashOffset dw ?
|
||||||
|
SsdFlashMaxProgramPulses dw ?
|
||||||
|
SsdSaveStack dw ?
|
||||||
|
SsdNeedSerialResume db ?
|
||||||
|
SsdBackTo4 db ?
|
||||||
|
SsdA9DoorNmiEnabled db ?
|
||||||
|
SsdSpare db ?
|
||||||
|
SsdFlashProgram dw ?
|
||||||
|
SsdNewPddSpareBuffer db 400h dup (?)
|
||||||
|
SsdData ends
|
||||||
|
;
|
||||||
|
.list
|
||||||
|
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
.xlist
|
||||||
|
; Include file - OSPACK.INC
|
||||||
|
; Epoc/Os Sibo packs include file.
|
||||||
|
; Copyright (c) Psion PLC 1989-90.
|
||||||
|
;
|
||||||
|
; VER DATE BY DESCRIPTION
|
||||||
|
; ----- -------- ---- -----------
|
||||||
|
; 2.00F 30/09/90 CJ Final release
|
||||||
|
; 2.50A 24/01/93 NSM Changed to support S3B/C
|
||||||
|
;
|
||||||
|
DoorOpen equ 001h
|
||||||
|
DoorClosed equ 000h
|
||||||
|
;
|
||||||
|
; ASIC4 STRUCTURES AND REGISTER BITS
|
||||||
|
; ==================================
|
||||||
|
;
|
||||||
|
ASIC5TYPE equ 0
|
||||||
|
ASIC4TYPE equ 1
|
||||||
|
;
|
||||||
|
ASIC4R struc
|
||||||
|
A4Data db ?
|
||||||
|
A4Portb db ?
|
||||||
|
A4IncAddress db ?
|
||||||
|
A4Address db ?
|
||||||
|
A4Dum4 db ?
|
||||||
|
A4Dum5 db ?
|
||||||
|
A4Dum6 db ?
|
||||||
|
A4Control db ?
|
||||||
|
ASIC4R ends
|
||||||
|
;
|
||||||
|
A4PortbMode equ A4IncAddress
|
||||||
|
A4InfoR equ A4Portb
|
||||||
|
A4CsSetupW equ A4Portb
|
||||||
|
A4XInfo record A4MXPeriph:1,A4MXType:1,A4MXDevices:1,A4MXBlocks:1, \
|
||||||
|
A4MXCheat:1,A4MXExtra:2,A4MXLowBat:1
|
||||||
|
;
|
||||||
|
A4SpecialMode equ 2
|
||||||
|
A4NormalMode equ 0
|
||||||
|
;
|
||||||
|
A4LBO equ 080h ; Enable low battery check
|
||||||
|
SetVppOn equ 010h ; Enable VPP bit in A4CONTROL
|
||||||
|
SetVppOff equ 000h ; Disable VPP
|
||||||
|
VppOnDelay equ 5 ; i.e. 5ms.
|
||||||
|
BatteryDelay equ 1 ; 1 ms
|
||||||
|
;
|
||||||
|
; INTEL FLASH EPROM COMMANDS
|
||||||
|
; ==========================
|
||||||
|
;
|
||||||
|
ReadCmd equ 0 ; Set into read mode when VPP is on
|
||||||
|
EraseCmd equ 020h ; Start erase cycle
|
||||||
|
EraseVerifyCmd equ 0a0h ; Erase verify byte
|
||||||
|
ProgramCmd equ 040h ; Start program cycle
|
||||||
|
ProgramVerifyCmd equ 0c0h ; Program verify byte
|
||||||
|
MaxProgramPulses equ 25 ; Number of programs per byte
|
||||||
|
MaxErasePulses equ 1000 ; Number of erase cycles
|
||||||
|
EraseDelay equ 10 ; Erase program delay 10mS
|
||||||
|
;
|
||||||
|
; INTEL TYPE2 FLASH EPROM COMMANDS
|
||||||
|
; ================================
|
||||||
|
;
|
||||||
|
Type2ReadCmd equ 0FFh ; Read byte with VPP on
|
||||||
|
Type2EraseCmd equ 0D0h ; Start erase cycle
|
||||||
|
Type2EraseSetup equ 020h ; Erase verify byte
|
||||||
|
Type2ProgramCmd equ 040h ; Start program cycle
|
||||||
|
Type2ClearStatus equ 050h ; Clear status byte
|
||||||
|
Type2ReadStatus equ 070h ; Read status byte
|
||||||
|
Type2MaxProgramPulses equ 1 ; Number of programs per byte
|
||||||
|
Type2ProgramTimeout equ 150 ; 150 frames at 3.2 us is >450 us.
|
||||||
|
Type2EraseTimeout equ 321 ; 320 ticks is 10 seconds.
|
||||||
|
; Status Register Format
|
||||||
|
Type2StatusBusy equ 80h
|
||||||
|
Type2EraseSuspended equ 40h
|
||||||
|
Type2EraseSuccess equ 20h
|
||||||
|
Type2WriteSuccess equ 10h
|
||||||
|
Type2VPPFail equ 08h
|
||||||
|
;
|
||||||
|
if HandHeld
|
||||||
|
if Corporate or S3c
|
||||||
|
Max01Units equ 2
|
||||||
|
else
|
||||||
|
Max01Units equ 3
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
Max01Units equ 4
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
; DATA STRUCTURES
|
||||||
|
; ===============
|
||||||
|
;
|
||||||
|
InfoRec record PackType:3,NumberOfChips:2,BlocksPerChip:3
|
||||||
|
;
|
||||||
|
TypeRam equ 0
|
||||||
|
TypeIntelFlash equ 1
|
||||||
|
Type2IntelFlash equ 2
|
||||||
|
TypeUnknown equ 3
|
||||||
|
TypeRom equ 6
|
||||||
|
TypeWriteProtected equ 7
|
||||||
|
;
|
||||||
|
UnitShiftNumber equ 4 ; 2^UnitShift must equal size of UnitInfo
|
||||||
|
;
|
||||||
|
UnitInfo struc ; This must be an whole power of 2
|
||||||
|
UnitStatus db ?
|
||||||
|
UnitType db ?
|
||||||
|
UnitDevices db ?
|
||||||
|
UnitAsicType db ?
|
||||||
|
UnitChanged db ?
|
||||||
|
UnitReadCmd db ?
|
||||||
|
UnitTotalSectors dw ?
|
||||||
|
UnitMask dw ?
|
||||||
|
UnitSectorsPerDevice dw ?
|
||||||
|
UnitSpare db ?
|
||||||
|
UnitShift db ?
|
||||||
|
UnitDoReadCmd dw ?
|
||||||
|
UnitInfo ends
|
||||||
|
;
|
||||||
|
UnitBufferInBxFromBl macro
|
||||||
|
xor bh, bh
|
||||||
|
rept UnitShiftNumber
|
||||||
|
shl bx, 1
|
||||||
|
endm
|
||||||
|
add bx, offset OsDataGroup:OsUnitInfoBuffer
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
.list
|
||||||
|
|
||||||
@@ -0,0 +1,620 @@
|
|||||||
|
.xlist
|
||||||
|
; Include file - OSSIBO.INC
|
||||||
|
; Epoc/Os Sibo include file.
|
||||||
|
; Copyright (c) Psion PLC 1989-90.
|
||||||
|
;
|
||||||
|
; VER DATE BY DESCRIPTION
|
||||||
|
; ----- -------- ---- -----------
|
||||||
|
; 2.00F 30/09/90 NSM Final release
|
||||||
|
;
|
||||||
|
NoNullFrames equ 1
|
||||||
|
;
|
||||||
|
if Asic1
|
||||||
|
A1Ent struc
|
||||||
|
A1Dummy dw ?
|
||||||
|
A1Control dw ?
|
||||||
|
A1LcdSize dw ?
|
||||||
|
A1LcdControl dw ?
|
||||||
|
A1InterruptMask dw ?
|
||||||
|
A1NonSpecificEoi dw ?
|
||||||
|
A1TimerEoi dw ?
|
||||||
|
A1FrcEoi dw ?
|
||||||
|
A1ResetWatchDog dw ?
|
||||||
|
A1FrcControl dw ?
|
||||||
|
A1ProtectionOn dw ?
|
||||||
|
A1ProtectionUpper dw ?
|
||||||
|
A1ProtectionLower dw ?
|
||||||
|
A1SoundLsw dw ?
|
||||||
|
A1SoundMsw dw ?
|
||||||
|
A1SoundControl dw ?
|
||||||
|
A1Ent ends
|
||||||
|
;
|
||||||
|
A1Status equ A1Control
|
||||||
|
A1ProtectionOff equ A1ProtectionOn
|
||||||
|
A1InterruptStatus equ A1LcdControl
|
||||||
|
;
|
||||||
|
A1StatusR record LcdData:2,Rtc4Hz:1,SldMsw:1,ComboBusy:1,Rtc32Hz:1,ExternalNmi:1,WatchDogNmi:1,SldTx:1,A1SldEnable:1,LcdEnable:1,Ram512:1,Ram128:1,FrcSource:1,TickRate:1,FrcMode:1
|
||||||
|
A1LcdSizeR record LcdMLineEnable:1,LcdNumberOfPixels:5,LcdEndOfFrame:10
|
||||||
|
A1LcdControlR record LcdMode:2,LcdMLineRate:5,LcdRate:5
|
||||||
|
A1InterruptMaskR record SldTransmit:1,SldReceive:1,FrcExpired:1,Asic2Int:1,ExpIntLeftA:1,ExpIntRightB:1,Mains:1,Timer:1
|
||||||
|
ExpAddressLeftA equ 0200h
|
||||||
|
ExpAddressRightB equ 0100h
|
||||||
|
ExpChannelLeftA equ SelectChannel6
|
||||||
|
ExpChannelRightB equ SelectChannel5
|
||||||
|
;
|
||||||
|
; Asic1 dependent constants
|
||||||
|
;
|
||||||
|
ResetWatchDog equ A1ResetWatchDog
|
||||||
|
;
|
||||||
|
A2Ent struc
|
||||||
|
A2Dummy db 080h dup(?)
|
||||||
|
A2Index dw ?
|
||||||
|
A2Control dw ?
|
||||||
|
A2Control1 dw ?
|
||||||
|
A2Control2 dw ?
|
||||||
|
A2Control3 dw ?
|
||||||
|
A2SerialData dw ?
|
||||||
|
A2SerialControl dw ?
|
||||||
|
A2ChannelControl dw ?
|
||||||
|
A2Ent ends
|
||||||
|
;
|
||||||
|
A2External equ A2Control1
|
||||||
|
A2InterruptStatus equ A2Control2
|
||||||
|
A2Status equ A2Control3
|
||||||
|
A2KeyData equ A2SerialControl
|
||||||
|
A2SlaveData equ A2ChannelControl
|
||||||
|
A2IControl0 equ 0
|
||||||
|
A2IControl1 equ 1
|
||||||
|
A2IWrite equ 2
|
||||||
|
A2IDDR equ 3
|
||||||
|
;
|
||||||
|
A2InterruptStatusR record SlaveDataOverrun:1,SlaveDataControl:1,SlaveDataValid:1,ExpansionInterrupt:1,DoorInterrupt:1
|
||||||
|
A2StatusR record A2RevId:1,A2XExt:1,A2Sdis:1,SerialBusy:1,SerialClockState:1,A1ResetFlag:1,WakeUp:1,A1OnKey:1
|
||||||
|
A2Control1R record SerialClockRate:2,KeyScan:4
|
||||||
|
A2Control2R record ClockEnable7:1,ClockEnable6:1,ClockEnable5:1,BuzzerMode:1,BuzzerVolume:1,BuzzerToggle:1,XySwitch:1,DigitizerEnable:1
|
||||||
|
A2Control3R record ElEnable:1,VhControl:1,ExpansionEnable:1,DoorEnable:1,SerialEnable:1,A2SldEnable:1,Ps34Acknowledge:1,SerialNull:1
|
||||||
|
A2ChannelControlR record MultiplexEnable:1,ChannelSelect:3,Pack4Enable:1,Pack3Enable:1,Pack2Enable:1,Pack1Enable:1
|
||||||
|
;
|
||||||
|
ClockRateSlow equ 2
|
||||||
|
ClockRateMedium equ 0
|
||||||
|
ClockRateFast equ 3
|
||||||
|
SelectChannel0 equ (4 shl ChannelSelect)
|
||||||
|
SelectChannel1 equ (mask Pack1Enable)
|
||||||
|
SelectChannel2 equ (mask Pack2Enable)
|
||||||
|
SelectChannel3 equ (mask Pack3Enable)
|
||||||
|
SelectChannel4 equ (mask Pack4Enable)
|
||||||
|
SelectChannel5 equ (5 shl ChannelSelect)
|
||||||
|
SelectChannel6 equ (6 shl ChannelSelect)
|
||||||
|
SelectChannel7 equ (7 shl ChannelSelect)
|
||||||
|
;
|
||||||
|
SCONTOUT macro
|
||||||
|
out A2SerialControl, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SDATAOUT macro
|
||||||
|
out A2SerialData, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SDATAIN macro
|
||||||
|
in al, A2SerialData
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SBUSY macro
|
||||||
|
wait
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SREAD macro _REG
|
||||||
|
mov al, SerialReadSingle or _REG
|
||||||
|
out A2SerialControl, al
|
||||||
|
nop
|
||||||
|
SBUSY
|
||||||
|
in al, A2SerialData
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SREADM macro _REG
|
||||||
|
mov al, SerialReadMulti or _REG
|
||||||
|
out A2SerialControl, al
|
||||||
|
nop
|
||||||
|
SBUSY
|
||||||
|
in al, A2SerialData
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SWRITE macro _REG,_VAL
|
||||||
|
mov al, SerialWriteSingle or _REG
|
||||||
|
out A2SerialControl, al
|
||||||
|
SBUSY
|
||||||
|
mov al, _VAL
|
||||||
|
out A2SerialData, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SWRITEM macro _REG,_VAL
|
||||||
|
mov al, SerialWriteMulti or _REG
|
||||||
|
out A2SerialControl, al
|
||||||
|
SBUSY
|
||||||
|
mov al, _VAL
|
||||||
|
out A2SerialData, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SETSPEED macro _SPEED
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
mov al, OsA2Control1
|
||||||
|
and al, not mask SerialClockRate
|
||||||
|
ifidni <_SPEED>,<FAST>
|
||||||
|
or al, ClockRateFast shl SerialClockRate
|
||||||
|
endif
|
||||||
|
ifidni <_SPEED>,<NORMAL>
|
||||||
|
or al, ClockRateMedium shl SerialClockRate
|
||||||
|
endif
|
||||||
|
ifidni <_SPEED>,<SLOW>
|
||||||
|
or al, ClockRateSlow shl SerialClockRate
|
||||||
|
endif
|
||||||
|
mov OsA2Control1, al
|
||||||
|
out A2Control1, al
|
||||||
|
popf
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
if LapTop
|
||||||
|
XPUSHFCLI macro
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
endm
|
||||||
|
XPOPF macro
|
||||||
|
popf
|
||||||
|
endm
|
||||||
|
else
|
||||||
|
XPUSHFCLI macro
|
||||||
|
endm
|
||||||
|
XPOPF macro
|
||||||
|
endm
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
XNOP macro
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
@HwNullFrame macro
|
||||||
|
call OsHwNullFrame
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
A3Ent struc
|
||||||
|
A3Adc db ?
|
||||||
|
A3Control1 db ?
|
||||||
|
A3Setup db ?
|
||||||
|
A3Control2 db ?
|
||||||
|
A3Dummy1 db 3 dup (?)
|
||||||
|
A3Control3 db ?
|
||||||
|
A3Dummy2 db 5 dup (?)
|
||||||
|
A3Status db ?
|
||||||
|
A3Dummy3 db ?
|
||||||
|
A3Ent ends
|
||||||
|
;
|
||||||
|
A3AdcLsbR record InvertedBit:1,OtherBits:7
|
||||||
|
A3AdcMsbR record Polarity:1,Overrange:1,AdcBits:4
|
||||||
|
A3Control1R record Vcc5Enable:1,Vcc4Enable:1,Vcc3Enable:1,DtoaBits:5
|
||||||
|
A3Control2R record AnalogueMultiplex:2,VhSoftStart:1,Vee2SoftStart:1,Vee1SoftStart:1,VhEnable:1,Vee2Enable:1,Vee1Enable:1
|
||||||
|
A3Control3R record AdcReadHighEnable:1,OffEnable:1,xDummy1:1
|
||||||
|
Ps34ControlR record Ps34Vcc3:1,xDummy2:1,Ps34Vcc4:1,xDummy3:1,Ps34Vcc5:1,xDummy4:3
|
||||||
|
;
|
||||||
|
AdcDigitizer equ 0
|
||||||
|
AdcVh equ 1
|
||||||
|
AdcMainBattery equ 2
|
||||||
|
AdcLithiumBattery equ 3
|
||||||
|
A3SetupValue equ 2
|
||||||
|
A3SelectId equ (SerialSelect or Asic5NormalId)
|
||||||
|
A3InfoByte equ 080h
|
||||||
|
;
|
||||||
|
Vee1SoftStartDelay equ (30*128)
|
||||||
|
Vee2SoftStartDelay equ (30*128)
|
||||||
|
VhSoftStartDelay equ (100*128)
|
||||||
|
Vee1OffDelay equ (100*128)
|
||||||
|
Vee2OffDelay equ (100*128)
|
||||||
|
VhOffDelay equ (100*128)
|
||||||
|
Vcc3Delay equ (25*128)
|
||||||
|
Vcc4Delay equ (25*128)
|
||||||
|
Vcc5Delay equ (25*128)
|
||||||
|
Vcc4OffFrames equ (25)
|
||||||
|
Vcc1_4To5Delay equ (3) ; Pan only in ms.
|
||||||
|
Vcc1_4to5OffFrames equ (20) ; Gives 392 frames = 6.0 ms
|
||||||
|
Vcc1_4to5OnTime equ 4 ; Gives 4 ms
|
||||||
|
;
|
||||||
|
PS34R_ADC equ 0
|
||||||
|
PS34R_STATUS equ 1
|
||||||
|
PS34W_CONTROL equ 0
|
||||||
|
PS34W_DTOA equ 1
|
||||||
|
PS34W_OFF equ 0eh
|
||||||
|
;
|
||||||
|
PS34STATR record pPowerFail:1,pColdStart:1,pVhready:1,pPenup:1,pNc:1,pAdmsb:3
|
||||||
|
PS34CONTR record pVcc3:1,pVee1:1,pVcc4:1,pVee2:1,pVcc5:1,pVh:1,pVhpower:2
|
||||||
|
PS34DTOAR record pNcc:1,pAdcsel:2,pDac:5
|
||||||
|
;
|
||||||
|
ADCSEL_ADCIN equ 0
|
||||||
|
ADCSEL_VIN equ 1
|
||||||
|
ADCSEL_VH equ 2
|
||||||
|
ADCSEL_VBATT equ 3
|
||||||
|
;
|
||||||
|
VHP1TO8 equ 0
|
||||||
|
VHP1TO4 equ 1
|
||||||
|
VHP1TO2 equ 2
|
||||||
|
VHP1TO1 equ 3
|
||||||
|
;
|
||||||
|
PPowerControl equ 0100h
|
||||||
|
PPowerControlR record PVcc5Enable:1,PSoundEnable:1,PVee1Enable:1,PDropVoltage:1,PDac:4
|
||||||
|
PPia record PSoundVol:2,PClearCold:1,PDcPresent:1,PColdFlag:1,PLithiumWarn:1,PVinWarn:1
|
||||||
|
PSoundControl equ 0200h
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
A3StatusR record PowerFail:1,ColdStart:1
|
||||||
|
AIntfR record ResetFlag:1,DummyWakeUp:1,OnKey:1
|
||||||
|
if Asic1
|
||||||
|
if ((mask ResetFlag) ne (mask A1ResetFlag)) or \
|
||||||
|
((mask OnKey) ne (mask A1OnKey))
|
||||||
|
.err Reset or OnKey flags are not equal
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
SerialWriteSingle equ 10000000b
|
||||||
|
SerialWriteMulti equ 10010000b
|
||||||
|
SerialReadSingle equ 11000000b
|
||||||
|
SerialReadMulti equ 11010000b
|
||||||
|
SerialReset equ 00000000b
|
||||||
|
SerialSelect equ 01000000b
|
||||||
|
;
|
||||||
|
Asic4Id equ 006h
|
||||||
|
Asic5PackId equ 002h
|
||||||
|
Asic5NormalId equ 003h
|
||||||
|
Asic6Id equ 004h
|
||||||
|
Asic8Id equ 005h
|
||||||
|
Asic2SlaveId equ 01fh
|
||||||
|
;
|
||||||
|
; Asic5 info byte structure
|
||||||
|
;
|
||||||
|
A5InfoByteR record A5TTL:1,A5Modem:1,A5MultiDrop:1,A5Barcode:1,A5Other:2,A5Parallel:1,A5Rs232:1
|
||||||
|
A5OtherRom equ (1 shl A5Other)
|
||||||
|
A5OtherMCRTTL equ (3 shl A5Other)
|
||||||
|
A5MCR equ (2 shl A5Other)
|
||||||
|
;
|
||||||
|
if Consumer
|
||||||
|
if S3b
|
||||||
|
DefaultLcdContrast equ 9
|
||||||
|
else
|
||||||
|
DefaultLcdContrast equ 7
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if S3c
|
||||||
|
DefaultLcdContrast equ 9
|
||||||
|
else
|
||||||
|
DefaultLcdContrast equ 15
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
InterruptBase equ 078h
|
||||||
|
;
|
||||||
|
if Asic9
|
||||||
|
KeyPollColumns equ 8
|
||||||
|
else
|
||||||
|
KeyPollColumns equ 10
|
||||||
|
endif
|
||||||
|
KeyInitialDelay equ 24
|
||||||
|
if Consumer or S3c
|
||||||
|
KeyRepeatDelay equ 2
|
||||||
|
else
|
||||||
|
KeyRepeatDelay equ 4
|
||||||
|
endif
|
||||||
|
PenUpDelay equ 16
|
||||||
|
MouseDownDelay equ 8
|
||||||
|
KeySettleDelay equ 24
|
||||||
|
KeyCntrlMask equ 00000001b
|
||||||
|
KeyLeftShiftMask equ 00000010b
|
||||||
|
KeyPsionMask equ 00000100b
|
||||||
|
KeyCapsMask equ 00001000b
|
||||||
|
KeyRightShiftMask equ 00010000b
|
||||||
|
DigitizerRowMask equ 00010000b
|
||||||
|
PsionScanCode equ 6
|
||||||
|
CapsScanCode equ 5
|
||||||
|
PsionUpScanCode equ 65
|
||||||
|
;
|
||||||
|
PostRomTest equ 010h
|
||||||
|
PostSystemRamTest equ 020h
|
||||||
|
PostVideoRamTest equ 030h
|
||||||
|
PostComplete equ 0f0h
|
||||||
|
if Consumer or S3c
|
||||||
|
PostPort equ 0h
|
||||||
|
else
|
||||||
|
PostPort equ 01ffh
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
if HandHeld
|
||||||
|
VideoRamSegment equ 00040h
|
||||||
|
VideoRamBase equ 00000h
|
||||||
|
if Corporate
|
||||||
|
VideoRamWords equ 00320h
|
||||||
|
else
|
||||||
|
if S3b
|
||||||
|
VideoRamWords equ 02580h
|
||||||
|
else
|
||||||
|
if S3c
|
||||||
|
VideoRamWords equ 00C80h
|
||||||
|
else
|
||||||
|
VideoRamWords equ 00500h
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
VideoRamSegment equ 0b800h
|
||||||
|
VideoRamBase equ 00000h
|
||||||
|
VideoRamWords equ 04000h
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
CalSeg equ 0fffeh
|
||||||
|
CalEnt struc
|
||||||
|
CalVsupCLsw dw ?
|
||||||
|
CalVsupCMsw dw ?
|
||||||
|
CalVsupM dw ?
|
||||||
|
CalVlthCLsw dw ?
|
||||||
|
CalVlthCMsw dw ?
|
||||||
|
CalVlthM dw ?
|
||||||
|
CalType dw ?
|
||||||
|
CalEnt ends
|
||||||
|
;
|
||||||
|
CHKeyDataR record CHInSled:1,CHMains:1,CHDummy:2
|
||||||
|
;
|
||||||
|
IntBXHw equ -2
|
||||||
|
;
|
||||||
|
if Asic9
|
||||||
|
A9WControlRW equ 0002h
|
||||||
|
A9RControl record A9MFrc2Is512KHzOr1KHz:1,A9MFrc2PreScale:1,\
|
||||||
|
A9MFrc1Is512KHzOr1Hz:1,A9MFrc1PreScale:1,\
|
||||||
|
A9MSoundEnable:1,A9MLcdEnable:1,\
|
||||||
|
A9MLowBatNMIEnable:1,A9MDoorNMIEnable:1,\
|
||||||
|
A9MZeroIsGrayMode:1,A9MArmStandBy:1,\
|
||||||
|
A9MDisableDMADivide:1,A9MRamDeviceSize:2,\
|
||||||
|
A9MDisableMemWait:1,A9MDisableIoWait:1,\
|
||||||
|
A9MDisableClockDivide:1
|
||||||
|
A9VRam256KBits equ (0 shl A9MRamDeviceSize)
|
||||||
|
A9VRam1MBits equ (1 shl A9MRamDeviceSize)
|
||||||
|
A9VRam4MBits equ (2 shl A9MRamDeviceSize)
|
||||||
|
A9VRam16MBits equ (3 shl A9MRamDeviceSize)
|
||||||
|
A9XRamDeviceSizeMask equ (3 shl A9MRamDeviceSize)
|
||||||
|
A9WStatusR equ 0004h
|
||||||
|
A9RStatus record A9MCold:1,A9MPowerFail:1,\
|
||||||
|
A9MReset:1,A9MNoBattery:1,\
|
||||||
|
A9MFifoFull:1,A9MSlaveOverrun:1,\
|
||||||
|
A9MSlaveControlFrame:1,A9MSlaveDataValid:1,\
|
||||||
|
A9MKeyboard:1,A9MSlaveClock:1,\
|
||||||
|
A9MMainsPresent:1,A9MDoorSwitch:1,\
|
||||||
|
A9MLowBatNMI:1,A9MDoorNMI:1,\
|
||||||
|
A9MProtectedModeNMI:1,A9MWatchDogNMI:1
|
||||||
|
A9MLcdType equ 8
|
||||||
|
A9XLcdType equ 0000111100000000b
|
||||||
|
A9WLcdSizeW equ 0004h
|
||||||
|
A9RLcdSize record A9MLcdLineLength:5,A9MLcdNumberOfPixels:11
|
||||||
|
A9WLcdControlW equ 0006h
|
||||||
|
A9RLcdControl record A9MLcdMode:2,A9MLcdACLineRate:5,A9MLcdPixelRate:5
|
||||||
|
A9VSinglePage1 equ (0 shl A9MLcdMode)
|
||||||
|
A9VSinglePage2 equ (1 shl A9MLcdMode)
|
||||||
|
A9VSinglePage1And2 equ (2 shl A9MLcdMode)
|
||||||
|
A9VDualPage1And2 equ (3 shl A9MLcdMode)
|
||||||
|
A9BInterruptStatusR equ 0006h
|
||||||
|
A9BInterruptMaskRW equ 0008h
|
||||||
|
A9RInterrupts record A9MFrc2:1,A9MFrc1:1,\
|
||||||
|
A9MExpIntB:1,A9MExpIntA:1,A9MExpIntC:1,\
|
||||||
|
A9MSlave:1,A9MTimer:1,A9MSound:1
|
||||||
|
A9BNmiClearW equ 0009h
|
||||||
|
A9BNonSpecificEoiW equ 000ah
|
||||||
|
A9BStartFlagClearW equ 000bh
|
||||||
|
A9BTimerEoiW equ 000ch
|
||||||
|
A9BSerialSlaveEoiW equ 000dh
|
||||||
|
A9BFrc1EoiW equ 000eh
|
||||||
|
A9BFrc2EoiW equ 000fh
|
||||||
|
A9WResetWatchDogW equ 0010h
|
||||||
|
A9WFrc1DataRW equ 0012h
|
||||||
|
A9BProtectionOnW equ 0014h
|
||||||
|
A9BProtectionOffR equ 0014h
|
||||||
|
A9BProtectionOffW equ 0015h
|
||||||
|
A9WProtectionUpperW equ 0016h
|
||||||
|
A9WProtectionLowerW equ 0018h
|
||||||
|
A9BSoundDataRW equ 001ah
|
||||||
|
A9BSoundEoiW equ 001ch
|
||||||
|
A9WFrc2DataRW equ 001eh
|
||||||
|
A9WPortABDataRW equ 0020h
|
||||||
|
if S3b
|
||||||
|
A9RPortABData record A9MKeyId0:1,A9MSleepDoorNmiDisabled:1,\
|
||||||
|
A9MBatLevel2:1,A9MBatLevel1:1,A9MLiBatLevel:1,\
|
||||||
|
A9MKeyRow:11
|
||||||
|
endif
|
||||||
|
if S3c
|
||||||
|
A9RPortABData record A9MKeyIdX2:1,A9MNiCdDetect:1,\
|
||||||
|
A9MBatLevel2:1,A9MBatLevel1:1,A9MLiBatLevel:1,\
|
||||||
|
A9MKeyIdX1:1,A9MKeyIdX0:0,A9MKeyRowX8:1,\
|
||||||
|
A9MCradle:1,A9MKeyRowX:7
|
||||||
|
endif
|
||||||
|
A9BPortADataRW equ 0020h
|
||||||
|
A9BPortBDataRW equ 0021h
|
||||||
|
A9WPortABDDRRW equ 0022h
|
||||||
|
A9VPortABDDR equ 0000000000000000b
|
||||||
|
A9BPortADDRRW equ 0022h
|
||||||
|
A9BPortBDDRRW equ 0023h
|
||||||
|
A9WPortCDDataRW equ 0024h
|
||||||
|
if S3b
|
||||||
|
A9RPortCDData record A9MVccPacksEnable:1,A9MCodecEnable:1,\
|
||||||
|
A9MVccLcdEnable:1,A9MLcdPanelEnable:1,\
|
||||||
|
A9MLcdContrast:4,A9MVolume:2,\
|
||||||
|
A9MReproEnable:1,A9MAltDoorNMIEnable:1,\
|
||||||
|
A9MAmplifierEnable:1,A9MKeyIdEnable:1,\
|
||||||
|
A9MKeyId2:1,A9MKeyId1:1
|
||||||
|
A9VVolumeLow equ (mask A9MVolume)
|
||||||
|
A9VPortCDData equ 0000111100000000b
|
||||||
|
A9VPortCDDDR equ not (1111000011111100b)
|
||||||
|
endif
|
||||||
|
if S3c
|
||||||
|
A9RPortCDData record A9MVccPacksEnable:1,A9MCodecEnable:1,\
|
||||||
|
A9MVccLcdEnable:1,A9MLcdPanelEnable:1,\
|
||||||
|
A9MLcdContrast:4,A9MVolume:2,\
|
||||||
|
A9MReproEnable:1,A9MAltDoorNMIEnable:1,\
|
||||||
|
A9MAmplifierEnable:1,A9MKeyIdEnable:1,\
|
||||||
|
A9MBuzVolX:1,A9MBacklightEnableX:1
|
||||||
|
A9VVolumeLow equ (mask A9MVolume)
|
||||||
|
A9VPortCDData equ 0000111100000000b
|
||||||
|
A9VPortCDDDR equ not (1111000011111111b)
|
||||||
|
endif
|
||||||
|
A9BPortCDataRW equ 0024h
|
||||||
|
A9BPortDDataRW equ 0025h
|
||||||
|
A9WPortCDDDRRW equ 0026h
|
||||||
|
A9BPortCDDRRW equ 0026h
|
||||||
|
A9BPortDDDRRW equ 0027h
|
||||||
|
A9BPageSelect6000RW equ 0028h
|
||||||
|
A9BPageSelect7000RW equ 0029h
|
||||||
|
A9BPageSelect8000RW equ 002ah
|
||||||
|
A9BPageSelect9000RW equ 002bh
|
||||||
|
A9WControlExtraRW equ 002ch
|
||||||
|
A9RControlExtraRW record A9MSlaveIntEnable:1,A9MClkDiv:2,\
|
||||||
|
A9MClockEnable5:1,A9MClockEnable4:1,\
|
||||||
|
A9MClockEnable3:1,A9MClockEnable2:1,\
|
||||||
|
A9MClockEnable1:1,A9MSoundDir:1,\
|
||||||
|
A9MExonDisable:1,A9MBuzzFromFrc1OrTog:1,\
|
||||||
|
A9MBuzzTog:1,A9MKeyCol:4
|
||||||
|
A9VKeyColHigh equ 0
|
||||||
|
A9VKeyColLow equ 1
|
||||||
|
A9VKeyCol0 equ 8
|
||||||
|
A9VClkDiv1 equ (3 shl A9MClkDiv)
|
||||||
|
A9VClkDiv2 equ (2 shl A9MClkDiv)
|
||||||
|
A9VClkDiv3 equ (1 shl A9MClkDiv)
|
||||||
|
A9VClkDiv4 equ (0 shl A9MClkDiv)
|
||||||
|
A9WPumpControlRW equ 002eh
|
||||||
|
A9RPumpControl record A9MVhPumpDc:4,A9MVhPumpBat:4,\
|
||||||
|
A9MLcdPump:4,A9MPump2:4
|
||||||
|
A9VVhPumpBat equ (14 shl A9MVhPumpBat)
|
||||||
|
A9VVhPumpBatSoft equ (4 shl A9MVhPumpBat)
|
||||||
|
A9VVhPumpBatMedium equ (8 shl A9MVhPumpBat)
|
||||||
|
A9VVhPumpDC equ (2 shl A9MVhPumpDc)
|
||||||
|
A9VVhPumpDCSoft equ (1 shl A9MVhPumpDc)
|
||||||
|
A9VLcdPump equ (7 shl A9MLcdPump)
|
||||||
|
A9VLcdPumpSoft equ (1 shl A9MLcdPump)
|
||||||
|
A9VPacksPumpSoft equ (15 shl A9MPump2)
|
||||||
|
A9VVhPumpDelay equ 100 ; Milliseconds
|
||||||
|
A9VLcdPumpDelay equ 5 ; Milliseconds
|
||||||
|
A9VCC3OnDelay equ 1 ; Milliseconds
|
||||||
|
A9VCCPacksDelay equ 20 ; Milliseconds
|
||||||
|
A9VCC2Delay equ 10 ; Milliseconds
|
||||||
|
A9WRtcLSWRW equ 0080h
|
||||||
|
A9WRtcMSWRW equ 0082h
|
||||||
|
A9WNullFrameW equ 0084h
|
||||||
|
A9BSlaveDataR equ 0088h
|
||||||
|
A9BSerialDataRW equ 008ah
|
||||||
|
A9BSerialControlW equ 008ch
|
||||||
|
A9BChannelSelectRW equ 008eh
|
||||||
|
A9RChannelSelect record A9MMultiplexEnable:1,A9MSerialClockRate:2,\
|
||||||
|
A9MPack5Enable:1,A9MPack4Enable:1,\
|
||||||
|
A9MPack3Enable:1,A9MPack2Enable:1,\
|
||||||
|
A9MPack1Enable:1
|
||||||
|
A9VSClkRateMedium equ (0 shl A9MSerialClockRate)
|
||||||
|
A9VSClkRateSpecial equ (1 shl A9MSerialClockRate)
|
||||||
|
A9VSClkRateSlow equ (2 shl A9MSerialClockRate)
|
||||||
|
A9VSClkRateFast equ (3 shl A9MSerialClockRate)
|
||||||
|
;
|
||||||
|
; Asic9 Dependent constants
|
||||||
|
;
|
||||||
|
ResetWatchDog equ A9WResetWatchDogW
|
||||||
|
SelectChannel1 equ (mask A9MPack1Enable)
|
||||||
|
SelectChannel2 equ (mask A9MPack2Enable)
|
||||||
|
SelectChannel3 equ (mask A9MPack3Enable)
|
||||||
|
SelectChannel4 equ (mask A9MPack4Enable)
|
||||||
|
SelectChannel5 equ (mask A9MPack5Enable)
|
||||||
|
;
|
||||||
|
; Current usage values
|
||||||
|
;
|
||||||
|
IdleCurrent equ 23
|
||||||
|
RunCurrent equ 51
|
||||||
|
Asic5SerialCurrent equ 54
|
||||||
|
Flash1ProgramCurrent equ 76
|
||||||
|
Flash2ProgramCurrent equ 99
|
||||||
|
Flash1EraseCurrent equ 94
|
||||||
|
Flash2EraseCurrent equ 129
|
||||||
|
;
|
||||||
|
; We add 26 because most of the work is under the NULL process.
|
||||||
|
; The value is 26 and not 28 because 10% of the time we are
|
||||||
|
; under the sound server.
|
||||||
|
;
|
||||||
|
SoundCurrentPlayV3 equ (25+20)
|
||||||
|
SoundCurrentPlayV2 equ (30+20)
|
||||||
|
SoundCurrentPlayV1 equ (55+20)
|
||||||
|
SoundCurrentPlayV0 equ (120+20)
|
||||||
|
;
|
||||||
|
; The value here must never equal one of the play values.
|
||||||
|
; It won't anyway in practise so this is not a big deal.
|
||||||
|
;
|
||||||
|
SoundCurrentRecord equ 5
|
||||||
|
;
|
||||||
|
SCONTOUT macro
|
||||||
|
out A9BSerialControlW, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SDATAOUT macro
|
||||||
|
out A9BSerialDataRW, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SDATAIN macro
|
||||||
|
in al, A9BSerialDataRW
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SBUSY macro
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SREAD macro _REG
|
||||||
|
mov al, SerialReadSingle or _REG
|
||||||
|
out A9BSerialControlW, al
|
||||||
|
in al, A9BSerialDataRW
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SREADM macro _REG
|
||||||
|
mov al, SerialReadMulti or _REG
|
||||||
|
out A9BSerialControlW, al
|
||||||
|
in al, A9BSerialDataRW
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SWRITE macro _REG,_VAL
|
||||||
|
mov al, SerialWriteSingle or _REG
|
||||||
|
out A9BSerialControlW, al
|
||||||
|
mov al, _VAL
|
||||||
|
out A9BSerialDataRW, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SWRITEM macro _REG,_VAL
|
||||||
|
mov al, SerialWriteMulti or _REG
|
||||||
|
out A9BSerialControlW, al
|
||||||
|
mov al, _VAL
|
||||||
|
out A9BSerialDataRW, al
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
SETSPEED macro _SPEED
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
in al, A9BChannelSelectRW
|
||||||
|
and al, not (mask A9MSerialClockRate)
|
||||||
|
ifidni <_SPEED>,<FAST>
|
||||||
|
or al, A9VSClkRateFast
|
||||||
|
endif
|
||||||
|
ifidni <_SPEED>,<NORMAL>
|
||||||
|
or al, A9VSClkRateMedium
|
||||||
|
endif
|
||||||
|
ifidni <_SPEED>,<SLOW>
|
||||||
|
or al, A9VSClkRateSlow
|
||||||
|
endif
|
||||||
|
out A9BChannelSelectRW, al
|
||||||
|
popf
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
XPUSHFCLI macro
|
||||||
|
endm
|
||||||
|
XPOPF macro
|
||||||
|
endm
|
||||||
|
XNOP macro
|
||||||
|
endm
|
||||||
|
;
|
||||||
|
@HwNullFrame macro
|
||||||
|
out A9WNullFrameW, ax
|
||||||
|
endm
|
||||||
|
endif
|
||||||
|
;
|
||||||
|
.list
|
||||||
|
|
||||||
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
+10692
File diff suppressed because it is too large
Load Diff
+74702
File diff suppressed because it is too large
Load Diff
+72601
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,834 @@
|
|||||||
|
{
|
||||||
|
"identifier": "psion-sibo-c-sdk",
|
||||||
|
"format-version": "2",
|
||||||
|
"archive-hocr-tools-version": "1.1.54",
|
||||||
|
"confidence": 87,
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"leafNum": 0,
|
||||||
|
"confidence": null,
|
||||||
|
"pageNumber": "",
|
||||||
|
"pageProb": null,
|
||||||
|
"wordConf": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 1,
|
||||||
|
"confidence": null,
|
||||||
|
"pageNumber": "",
|
||||||
|
"pageProb": null,
|
||||||
|
"wordConf": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 2,
|
||||||
|
"confidence": null,
|
||||||
|
"pageNumber": "",
|
||||||
|
"pageProb": null,
|
||||||
|
"wordConf": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 3,
|
||||||
|
"confidence": null,
|
||||||
|
"pageNumber": "",
|
||||||
|
"pageProb": null,
|
||||||
|
"wordConf": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 4,
|
||||||
|
"confidence": 81,
|
||||||
|
"pageNumber": "2",
|
||||||
|
"pageProb": 71,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 5,
|
||||||
|
"confidence": 97,
|
||||||
|
"pageNumber": "3",
|
||||||
|
"pageProb": 87,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 6,
|
||||||
|
"confidence": 81,
|
||||||
|
"pageNumber": "4",
|
||||||
|
"pageProb": 71,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 7,
|
||||||
|
"confidence": 97,
|
||||||
|
"pageNumber": "5",
|
||||||
|
"pageProb": 87,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 8,
|
||||||
|
"confidence": 81,
|
||||||
|
"pageNumber": "6",
|
||||||
|
"pageProb": 71,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 9,
|
||||||
|
"confidence": 97,
|
||||||
|
"pageNumber": "7",
|
||||||
|
"pageProb": 87,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 10,
|
||||||
|
"confidence": 81,
|
||||||
|
"pageNumber": "8",
|
||||||
|
"pageProb": 71,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 11,
|
||||||
|
"confidence": 97,
|
||||||
|
"pageNumber": "9",
|
||||||
|
"pageProb": 87,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 12,
|
||||||
|
"confidence": 79,
|
||||||
|
"pageNumber": "10",
|
||||||
|
"pageProb": 69,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 13,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "11",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 87
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 14,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "12",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 15,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "13",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 16,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "14",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 17,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "15",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 93
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 18,
|
||||||
|
"confidence": 87,
|
||||||
|
"pageNumber": "16",
|
||||||
|
"pageProb": 77,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 19,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "17",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 20,
|
||||||
|
"confidence": 79,
|
||||||
|
"pageNumber": "18",
|
||||||
|
"pageProb": 69,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 21,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "19",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 97
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 22,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "20",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 23,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "21",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 24,
|
||||||
|
"confidence": 86,
|
||||||
|
"pageNumber": "22",
|
||||||
|
"pageProb": 76,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 25,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "23",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 26,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "24",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 27,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "25",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 28,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "26",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 29,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "27",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 30,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "28",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 31,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "29",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 32,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "30",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 33,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "31",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 34,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "32",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 97
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 35,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "33",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 36,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "34",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 37,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "35",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 38,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "36",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 39,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "37",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 40,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "38",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 41,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "39",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 42,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "40",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 43,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "41",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 44,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "42",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 45,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "43",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 46,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "44",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 47,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "45",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 48,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "46",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 49,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "47",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 50,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "48",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 51,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "49",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 52,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "50",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 53,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "51",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 54,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "52",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 55,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "53",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 56,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "54",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 57,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "55",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 58,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "56",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 59,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "57",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 60,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "58",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 61,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "59",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 62,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "60",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 63,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "61",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 64,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "62",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 97
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 65,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "63",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 66,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "64",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 67,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "65",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 68,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "66",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 69,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "67",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 70,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "68",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 71,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "69",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 72,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "70",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 73,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "71",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 74,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "72",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 75,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "73",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 76,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "74",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 77,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "75",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 78,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "76",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 79,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "77",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 80,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "78",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 81,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "79",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 82,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "80",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 83,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "81",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 84,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "82",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 85,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "83",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 86,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "84",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 87,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "85",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 88,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "86",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 89,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "87",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 90,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "88",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 91,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "89",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 92,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "90",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 93,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "91",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 94,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "92",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 95,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "93",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 96,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "94",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 97,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "95",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 98,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "96",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 99,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "97",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 100,
|
||||||
|
"confidence": 78,
|
||||||
|
"pageNumber": "98",
|
||||||
|
"pageProb": 68,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 101,
|
||||||
|
"confidence": 96,
|
||||||
|
"pageNumber": "99",
|
||||||
|
"pageProb": 86,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 102,
|
||||||
|
"confidence": 76,
|
||||||
|
"pageNumber": "100",
|
||||||
|
"pageProb": 66,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 103,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "101",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 104,
|
||||||
|
"confidence": 76,
|
||||||
|
"pageNumber": "102",
|
||||||
|
"pageProb": 66,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 105,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "103",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 106,
|
||||||
|
"confidence": 76,
|
||||||
|
"pageNumber": "104",
|
||||||
|
"pageProb": 66,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 107,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "105",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 108,
|
||||||
|
"confidence": 76,
|
||||||
|
"pageNumber": "106",
|
||||||
|
"pageProb": 66,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 109,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "107",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 110,
|
||||||
|
"confidence": 76,
|
||||||
|
"pageNumber": "108",
|
||||||
|
"pageProb": 66,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 111,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "109",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 112,
|
||||||
|
"confidence": 76,
|
||||||
|
"pageNumber": "110",
|
||||||
|
"pageProb": 66,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 113,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "111",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 114,
|
||||||
|
"confidence": 76,
|
||||||
|
"pageNumber": "112",
|
||||||
|
"pageProb": 66,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 115,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "113",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 116,
|
||||||
|
"confidence": 75,
|
||||||
|
"pageNumber": "114",
|
||||||
|
"pageProb": 65,
|
||||||
|
"wordConf": 95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leafNum": 117,
|
||||||
|
"confidence": 95,
|
||||||
|
"pageNumber": "115",
|
||||||
|
"pageProb": 85,
|
||||||
|
"wordConf": 95
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+1660
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
Copyright (c) Psion PLC (1995)
|
||||||
|
|
||||||
|
26th May 1995
|
||||||
|
|
||||||
|
CONTENTS OF FILES ON DISK
|
||||||
|
=========================
|
||||||
|
|
||||||
|
readme.txt
|
||||||
|
|
||||||
|
ASSEMBLER INCLUDE FILES
|
||||||
|
epoc.inc
|
||||||
|
epocser.inc
|
||||||
|
epoclib.inc
|
||||||
|
epocsibo.inc
|
||||||
|
ossibo.inc
|
||||||
|
ospack.inc
|
||||||
|
|
||||||
|
C FILES
|
||||||
|
a4test.c ;Fully comprehensive test program for A4EXIF.LDD
|
||||||
|
a4test.pr ;TopSpeed Project file for the above test program
|
||||||
|
|
||||||
|
ASM FILES
|
||||||
|
a4exif.asm ;Source code file for A4EXIF.LDD
|
||||||
|
sys$as5.asm ;Source code file for SYS$AS5.PDD
|
||||||
|
tmpsaldd.asm ;Standard stand-alone LDD template
|
||||||
|
tmpa4ldd.asm ;Template LDD for ASIC4/5-based peripherals
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,808 @@
|
|||||||
|
title NAME.LDD device driver for S3/S3a/S3c/S3../HC
|
||||||
|
subttl Copyright PSION PLC November 1995
|
||||||
|
name NAME
|
||||||
|
|
||||||
|
; VERSION DATE DESCRIPTION
|
||||||
|
; ------- -------- ---------------
|
||||||
|
; 1.0 12/01/95 Template Asic4/5 LDD
|
||||||
|
|
||||||
|
; Written by Jason Robinson January 1995
|
||||||
|
|
||||||
|
BUILDSB equ 1
|
||||||
|
Asic4Type =0
|
||||||
|
Asic5Type =0
|
||||||
|
NeedTheInterrupt =0
|
||||||
|
NeedClocking =0
|
||||||
|
StartChannelInOpen =0
|
||||||
|
|
||||||
|
include ..\inc\epoc.inc
|
||||||
|
include ..\inc\epocser.inc
|
||||||
|
include ..\inc\epoclib.inc
|
||||||
|
include ..\inc\epocsibo.inc
|
||||||
|
include ..\srcs\ossibo.inc
|
||||||
|
include ..\srcs\ospack.inc
|
||||||
|
|
||||||
|
WeSupportS3Only equ Lcd240X80
|
||||||
|
WeSupportS3aOnly equ Lcd480X160
|
||||||
|
WeSupportS3cOnly equ Lcd240X100
|
||||||
|
WeSupportHCOnly equ Lcd160X80
|
||||||
|
if Consumer
|
||||||
|
NumberOfChannels equ 1
|
||||||
|
if Asic9
|
||||||
|
TheMachineWeSupport equ WeSupportS3aOnly
|
||||||
|
else
|
||||||
|
TheMachineWeSupport equ WeSupportS3Only
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
NumberOfChannels equ 3
|
||||||
|
if Asic9
|
||||||
|
TheMachineWeSupport equ WeSupportS3cOnly
|
||||||
|
else
|
||||||
|
TheMachineWeSupport equ WeSupportHCOnly
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
A4PERIPH_MASK equ 0f0h
|
||||||
|
TheInfoByteThatWeWant equ 1
|
||||||
|
|
||||||
|
TmpltEnt struc
|
||||||
|
TmpltEntOpen db ? ; Channel open flag
|
||||||
|
TmpltChannelStarted db ? ; Channel should be running
|
||||||
|
TmpltHwChannel dw ? ; The harware we want
|
||||||
|
TmpltStructPtr dw ? ; Ptr to CB in Apps DS
|
||||||
|
TmpltTckHandle dw ? ; Tick Handle
|
||||||
|
TmpltChannelRunning db ? ; Can channel really run
|
||||||
|
TmpltInterruptMask db ? ; InterruptMask
|
||||||
|
TmpltChannel db ? ; Channel
|
||||||
|
if NeedTheInterrupt
|
||||||
|
TmpltInterruptNumber db ? ; Interrupt Number
|
||||||
|
TmpltInterruptVector dw ? ; Were to Jump To
|
||||||
|
if Asic5Type and NeedClocking
|
||||||
|
TmpltA5Clocking db ? ; Asic5 baud rate clocking
|
||||||
|
TmpltSpare db ?
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
TmpltSpare db ?
|
||||||
|
endif
|
||||||
|
|
||||||
|
TmpltEnt ends
|
||||||
|
|
||||||
|
TmpltStruct struc
|
||||||
|
Tmpltblk ChanEnt <> ; I/O control block
|
||||||
|
TmpltEntPtr dw ? ; Ptr to our CS CB
|
||||||
|
TmpltStruct ends
|
||||||
|
|
||||||
|
dgroup group stack
|
||||||
|
assume ds:dgroup,es:dgroup,ss:dgroup
|
||||||
|
|
||||||
|
CodeSeg
|
||||||
|
|
||||||
|
ProcBegin@ TmpltLDD
|
||||||
|
; ===================
|
||||||
|
|
||||||
|
dw LDDSignature
|
||||||
|
db 'HSB',0,0,0,0,0
|
||||||
|
dw (TableEnd-TableStart)/2
|
||||||
|
TableStart:
|
||||||
|
dw TmpltInstall
|
||||||
|
dw TmpltRemove
|
||||||
|
dw TmpltHold
|
||||||
|
dw TmpltResume
|
||||||
|
dw TmpltReset
|
||||||
|
dw TmpltUnits
|
||||||
|
dw TmpltOpen
|
||||||
|
dw TmpltStrategy
|
||||||
|
MonitorVector:
|
||||||
|
dw MonitorInt
|
||||||
|
TableEnd:
|
||||||
|
|
||||||
|
if Consumer
|
||||||
|
if Asic9
|
||||||
|
SetupTable db mask A9MSlave,SelectChannel5
|
||||||
|
db (mask A9MClockEnable5 shr 8),HwIrq2Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt0
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
SetupTable db mask Asic2Int,SelectChannel7
|
||||||
|
db (mask ClockEnable7 shr 8),HwIrq4Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if Asic9
|
||||||
|
SetupTable db mask A9MExpIntA,SelectChannel3
|
||||||
|
db (mask A9MClockEnable3 shr 8),HwIrq4Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt0
|
||||||
|
endif
|
||||||
|
db mask A9MExpIntB,SelectChannel4
|
||||||
|
db (mask A9MClockEnable4 shr 8),HwIrq5Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt1
|
||||||
|
endif
|
||||||
|
db mask A9MSlave,SelectChannel5
|
||||||
|
db (mask A9MClockEnable5 shr 8),HwIrq2Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt2
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
SetupTable db mask ExpIntLeftA,ExpChannelLeftA
|
||||||
|
db (mask ClockEnable6 shr 8),HwIrq3Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt0
|
||||||
|
endif
|
||||||
|
db mask ExpIntRightB,ExpChannelRightB
|
||||||
|
db (mask ClockEnable5 shr 8),HwIrq2Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt1
|
||||||
|
endif
|
||||||
|
db mask Asic2Int,SelectChannel7
|
||||||
|
db (mask ClockEnable7 shr 8),HwIrq4Revector
|
||||||
|
if NeedTheInterrupt
|
||||||
|
dw offset Interrupt2
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
CsHeldFlag db 0 ; Ldd under a hold?
|
||||||
|
MachineType db 0
|
||||||
|
if Consumer
|
||||||
|
Channel0 TmpltEnt <>
|
||||||
|
else
|
||||||
|
Channel0 TmpltEnt <>
|
||||||
|
Channel1 TmpltEnt <>
|
||||||
|
Channel2 TmpltEnt <>
|
||||||
|
endif
|
||||||
|
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltInstall,far
|
||||||
|
; ===========================
|
||||||
|
|
||||||
|
; Install the driver
|
||||||
|
; Exit with carry clear for okay
|
||||||
|
|
||||||
|
GenLcdType ; Do we only run on
|
||||||
|
mov MachineType,al ; particular machines?
|
||||||
|
cmp al,TheMachineWeSupport
|
||||||
|
jne CannotInstallOnThisMachine
|
||||||
|
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
push ds
|
||||||
|
mov ax, cs
|
||||||
|
mov ds, ax
|
||||||
|
mov CsHeldFlag, 0 ; Initialise all
|
||||||
|
mov cx, NumberOfChannels ; the variables
|
||||||
|
mov di, offset Channel0
|
||||||
|
mov si, offset SetupTable
|
||||||
|
ResetAllChannelsLoop:
|
||||||
|
mov [di].TmpltEntOpen, 0
|
||||||
|
lodsb
|
||||||
|
mov [di].TmpltInterruptMask, al
|
||||||
|
lodsb
|
||||||
|
mov [di].TmpltChannel, al
|
||||||
|
lodsb
|
||||||
|
if NeedClocking
|
||||||
|
mov [di].TmpltA5Clocking, al
|
||||||
|
endif
|
||||||
|
lodsb
|
||||||
|
if NeedTheInterrupt
|
||||||
|
mov [di].TmpltInterruptNumber, al
|
||||||
|
lodsw
|
||||||
|
mov [di].TmpltInterruptVector, ax
|
||||||
|
endif
|
||||||
|
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop ResetAllChannelsLoop
|
||||||
|
pop ds
|
||||||
|
popf
|
||||||
|
FinishedOkay:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
CannotInstallOnThisMachine:
|
||||||
|
mov ax,NotSupportedErr
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltRemove,far
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
; Remove the driver
|
||||||
|
; Exit with carry clear for okay
|
||||||
|
; Exit with carry set if channel still open
|
||||||
|
|
||||||
|
mov cx,NumberOfChannels
|
||||||
|
mov di,offset Channel0
|
||||||
|
xor ax,ax
|
||||||
|
CheckAllChannelsClosedLoop:
|
||||||
|
cmp cs:[di].TmpltEntOpen,al
|
||||||
|
jne WeHaveAnOpenChannelSoFail
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop CheckAllChannelsClosedLoop
|
||||||
|
jmp FinishedOkay
|
||||||
|
WeHaveAnOpenChannelSoFail:
|
||||||
|
mov ax,InUseErr
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltUnits,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Return the Number of channels that can be opened in AX
|
||||||
|
|
||||||
|
mov ax,NumberOfChannels ; We have ? channels
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltReset,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Reset the open channel
|
||||||
|
|
||||||
|
mov di,cx
|
||||||
|
cmp cs:[di].TmpltEntOpen,0 ; Somethings gone
|
||||||
|
je NotOpenToReset ; wrong with the
|
||||||
|
mov ah,DevHoldPowerDown ; application that
|
||||||
|
call StopTheChannel ; opened us.
|
||||||
|
call FreeHardware ; Stop interupts and
|
||||||
|
mov cs:[di].TmpltEntOpen,0 ; free the channel
|
||||||
|
NotOpenToReset:
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltHold,far
|
||||||
|
; ========================
|
||||||
|
|
||||||
|
; Hold the channels
|
||||||
|
; Hold reason in AH
|
||||||
|
|
||||||
|
mov cx,1
|
||||||
|
xchg cl,CsHeldFlag ; Stop any interrupts
|
||||||
|
cmp cl,0 ; Mark channel as
|
||||||
|
jne AlreadyHeld ; under a normal hold
|
||||||
|
DoHold:
|
||||||
|
mov cx,NumberOfChannels
|
||||||
|
mov di,offset Channel0
|
||||||
|
HoldAllTheChannelsLoop:
|
||||||
|
cmp cs:[di].TmpltEntOpen,0
|
||||||
|
je DontHoldBecauseNotOpen
|
||||||
|
cmp cs:[di].TmpltChannelStarted,0
|
||||||
|
je DontHoldBecauseNotOpen
|
||||||
|
push ax
|
||||||
|
push cx
|
||||||
|
call StopTheChannel
|
||||||
|
pop cx
|
||||||
|
pop ax
|
||||||
|
DontHoldBecauseNotOpen:
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop HoldAllTheChannelsLoop
|
||||||
|
AlreadyHeld:
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltResume,far
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
; Resume the channel
|
||||||
|
|
||||||
|
xor cx,cx ; Be warned during an
|
||||||
|
xchg cl,CsHeldFlag ; on/off the power to
|
||||||
|
cmp cl,0 ; ASIC4 is not restored
|
||||||
|
je AlreadyResumed ; until after this
|
||||||
|
GenDataSegment ; A resume is pointless
|
||||||
|
HwGetSsdData ; if there is still no
|
||||||
|
mov bx,ax ; power to the port
|
||||||
|
cmp es:[bx].SsdDoorStatus,DoorOpen ; Leave the resume
|
||||||
|
je DoorsAreOpen ; to the tick
|
||||||
|
DoResume:
|
||||||
|
mov cx,NumberOfChannels
|
||||||
|
mov di,offset Channel0 ; Right hardware?
|
||||||
|
ResumeAllTheChannelsLoop: ; Else restart
|
||||||
|
cmp cs:[di].TmpltEntOpen,0 ; interrupts
|
||||||
|
je DontResumeBecauseNotOpen
|
||||||
|
cmp cs:[di].TmpltChannelStarted,0
|
||||||
|
je DontResumeBecauseNotOpen
|
||||||
|
push cx
|
||||||
|
call StartTheChannel
|
||||||
|
pop cx
|
||||||
|
DontResumeBecauseNotOpen:
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop ResumeAllTheChannelsLoop
|
||||||
|
AlreadyResumed:
|
||||||
|
ret
|
||||||
|
DoorsAreOpen:
|
||||||
|
mov CsHeldFlag,2
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltOpen,far
|
||||||
|
; ========================
|
||||||
|
|
||||||
|
; Open the channel
|
||||||
|
; DS,ES,SS Applications data space
|
||||||
|
; Handle in DX
|
||||||
|
|
||||||
|
cld
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
call FindFreeChannel
|
||||||
|
jnc GotFreeChannel
|
||||||
|
popf
|
||||||
|
LockedError:
|
||||||
|
mov ax,LockedErr
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
AllErrorsExitHere:
|
||||||
|
push ax
|
||||||
|
HeapFreeCell
|
||||||
|
pop ax
|
||||||
|
FreeTckAndChannel:
|
||||||
|
push ax
|
||||||
|
call FreeHardware
|
||||||
|
pop ax
|
||||||
|
FreeTckAndExit:
|
||||||
|
push ax
|
||||||
|
mov bx,cs:[di].TmpltTckHandle
|
||||||
|
IoClose
|
||||||
|
pop ax
|
||||||
|
CloseThenFree:
|
||||||
|
mov cs:[di].TmpltEntOpen,0
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
GotFreeChannel:
|
||||||
|
mov cs:[di].TmpltEntOpen,1
|
||||||
|
mov cs:[di].TmpltChannelStarted,0
|
||||||
|
mov cs:[di].TmpltChannelRunning,0
|
||||||
|
popf
|
||||||
|
xor ax,ax
|
||||||
|
push ax
|
||||||
|
mov ax,((':' shl 8)+'K')
|
||||||
|
push ax
|
||||||
|
mov ax,(('C' shl 8)+'T')
|
||||||
|
push ax
|
||||||
|
mov bx,sp
|
||||||
|
IoOpen
|
||||||
|
jnc GotATickChannel
|
||||||
|
add sp,6
|
||||||
|
mov ax,LockedErr
|
||||||
|
jmp CloseThenFree
|
||||||
|
GotATickChannel:
|
||||||
|
add sp,6
|
||||||
|
mov cs:[di].TmpltTckHandle,ax
|
||||||
|
push dx
|
||||||
|
mov bx,ax
|
||||||
|
mov ax,IoFuncStart
|
||||||
|
mov cx,1
|
||||||
|
push cx ; Frequency 1 tick
|
||||||
|
push di ; Data is our CS CB
|
||||||
|
push dx ; Our device handle
|
||||||
|
mov cx,(MonitorVector-TableStart)/2 ; Vector to call
|
||||||
|
push cx
|
||||||
|
mov cx,sp
|
||||||
|
IoWithWait
|
||||||
|
add sp,8
|
||||||
|
pop dx
|
||||||
|
call GetHardware
|
||||||
|
jc FreeTckAndExit
|
||||||
|
|
||||||
|
mov cx,(size TmpltStruct) ; Get ourselfs a CB
|
||||||
|
HeapAllocateCell ; In the applications
|
||||||
|
jc FreeTckAndChannel ; Data space
|
||||||
|
|
||||||
|
mov bx,ax
|
||||||
|
mov [bx].Tmpltblk.ChanNext,bx
|
||||||
|
mov [bx].Tmpltblk.ChanSignature,IoChanSignature
|
||||||
|
mov [bx].Tmpltblk.ChanLibHandle,dx
|
||||||
|
mov [bx].TmpltEntPtr,di
|
||||||
|
push bx
|
||||||
|
mov bx,dx
|
||||||
|
mov cx,di
|
||||||
|
IoRequestReset
|
||||||
|
pop bx
|
||||||
|
if StartChannelInOpen
|
||||||
|
call StartChannelFromOpen
|
||||||
|
endif
|
||||||
|
xor ax,ax
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
StrategyVectorTable label word
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset TmpltClose
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
|
||||||
|
ProcBegin@ TmpltStrategy,far
|
||||||
|
; ============================
|
||||||
|
|
||||||
|
; BX is our control block
|
||||||
|
; SI points to the parameters
|
||||||
|
; DS,ES Applications data space
|
||||||
|
|
||||||
|
mov ax,[si].RqFunction
|
||||||
|
mov dx,[si].RqA1Ptr
|
||||||
|
cmp ax,IoFuncSuperFrame
|
||||||
|
ja StrategyDefault
|
||||||
|
shl ax,1
|
||||||
|
mov di,ax
|
||||||
|
push StrategyVectorTable[di]
|
||||||
|
mov di,[bx].TmpltEntPtr
|
||||||
|
retn
|
||||||
|
StrategyDefault:
|
||||||
|
IoRoot
|
||||||
|
ret
|
||||||
|
ExitStrategyOkay:
|
||||||
|
xor ax,ax
|
||||||
|
ExitStrategy:
|
||||||
|
mov di,[si].RqStatusPtr
|
||||||
|
mov word ptr [di],ax
|
||||||
|
cmp ax,PendingErr
|
||||||
|
je JustExit
|
||||||
|
IoSignal
|
||||||
|
JustExit:
|
||||||
|
xor ax,ax
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltClose,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Close a channel
|
||||||
|
; DI CS control block
|
||||||
|
; BX DS control block
|
||||||
|
; SI points to aurguments on stack
|
||||||
|
; DX Argument one pointer
|
||||||
|
|
||||||
|
mov ah,DevHoldPowerDown
|
||||||
|
call StopTheChannel
|
||||||
|
call FreeHardware
|
||||||
|
mov cs:[di].TmpltChannelStarted,0
|
||||||
|
push bx
|
||||||
|
mov bx,[bx].Tmpltblk.ChanLibHandle
|
||||||
|
mov cx,di
|
||||||
|
IoRequestResetCancel
|
||||||
|
pop bx
|
||||||
|
HeapFreeCell
|
||||||
|
mov bx,cs:[di].TmpltTckHandle
|
||||||
|
IoClose
|
||||||
|
mov cs:[di].TmpltEntOpen,0
|
||||||
|
jmp short ExitStrategyOkay
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ StartTheChannel
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
; Start the Channel Running
|
||||||
|
; Assume channel set up and interrupts off
|
||||||
|
|
||||||
|
cmp cs:[di].TmpltChannelRunning,0
|
||||||
|
jne ChannelAlreadyRunning
|
||||||
|
|
||||||
|
if Asic5Type and NeedClocking
|
||||||
|
if Asic9
|
||||||
|
in ax, A9WControlExtraRW ; Start the S3s clock
|
||||||
|
or ah, [bx].TmpltA5Clocking ; Generator
|
||||||
|
out A9WControlExtraRW, ax
|
||||||
|
else
|
||||||
|
mov al, [bx].TmpltA5Clocking
|
||||||
|
HwSetA2Control2Bits
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if NeedTheInterrupt
|
||||||
|
mov al, cs:[di].TmpltInterruptNumber ; Load the address of
|
||||||
|
mov cx, cs ; the appropriate
|
||||||
|
mov bx, cs:[di].TmpltInterruptVector ; interrupt routine
|
||||||
|
GenSetRevector ; into the correct vector
|
||||||
|
if Asic9
|
||||||
|
in al,A9BInterruptMaskRW ; Set the mask
|
||||||
|
or al,cs:[di].TmpltInterruptMask ; to enable Interrupts
|
||||||
|
out A9BInterruptMaskRW,al
|
||||||
|
else
|
||||||
|
in al, A1InterruptMask
|
||||||
|
or al,cs:[di].TmpltInterruptMask
|
||||||
|
out A1InterruptMask, al
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
mov cs:[di].TmpltChannelRunning,1
|
||||||
|
ChannelAlreadyRunning:
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ StopTheChannel
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Stop the Channel Running
|
||||||
|
; Assume channel set up and interrupts off
|
||||||
|
; Stop reason in AH
|
||||||
|
|
||||||
|
cmp byte ptr cs:[di].TmpltChannelRunning,0
|
||||||
|
je ChannelAlreadyStopped
|
||||||
|
if NeedTheInterrupt
|
||||||
|
mov ah,cs:[di].TmpltInterruptMask
|
||||||
|
not ah
|
||||||
|
if Asic9
|
||||||
|
in al,A9BInterruptMaskRW ; Stop Interrupts
|
||||||
|
and al,ah ; By clearing the
|
||||||
|
out A9BInterruptMaskRW,al ; Mask and resetting
|
||||||
|
else ; The Vector
|
||||||
|
in al, A1InterruptMask
|
||||||
|
and al,ah
|
||||||
|
out A1InterruptMask, al
|
||||||
|
endif
|
||||||
|
mov al, cs:[di].TmpltInterruptNumber
|
||||||
|
GenResetRevector
|
||||||
|
endif
|
||||||
|
if Asic5Type and NeedClocking
|
||||||
|
if Asic9
|
||||||
|
mov cl, [bx].TmpltA5Clocking ; Turn off baud rate
|
||||||
|
not cl ; clocking from the
|
||||||
|
in ax, A9WControlExtraRW ; S3/3a
|
||||||
|
and ah, cl
|
||||||
|
out A9WControlExtraRW, ax
|
||||||
|
else
|
||||||
|
mov al, [bx].TmpltA5Clocking
|
||||||
|
HwClearA2Control2Bits
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
mov cs:[di].TmpltChannelRunning,0
|
||||||
|
ChannelAlreadyStopped:
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
if StartChannelInOpen
|
||||||
|
ProcBegin@ StartChannelFromOpen
|
||||||
|
; ===============================
|
||||||
|
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
mov cs:[di].TmpltChannelStarted,1
|
||||||
|
mov al,cs:[di].TmpltChannel
|
||||||
|
HwSelectChannel
|
||||||
|
push ax
|
||||||
|
call StartTheChannel
|
||||||
|
pop ax
|
||||||
|
HwSelectChannel
|
||||||
|
popf
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
endif
|
||||||
|
ProcBegin@ GetHardware
|
||||||
|
; ======================
|
||||||
|
|
||||||
|
mov al, cs:[di].TmpltInterruptMask
|
||||||
|
HwGetChannel
|
||||||
|
jc ChannelNotAvailable
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
mov al,cs:[di].TmpltChannel
|
||||||
|
HwSelectChannel
|
||||||
|
push ax
|
||||||
|
call CheckForHardware
|
||||||
|
pop ax
|
||||||
|
jc NoHardwareFreeTheChannel
|
||||||
|
HwSelectChannel
|
||||||
|
popf
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
NoHardwareFreeTheChannel:
|
||||||
|
HwSelectChannel
|
||||||
|
popf
|
||||||
|
mov al, cs:[di].TmpltInterruptMask
|
||||||
|
HwFreeChannel
|
||||||
|
ChannelNotAvailable:
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ FreeHardware
|
||||||
|
; =======================
|
||||||
|
|
||||||
|
mov al, cs:[di].TmpltInterruptMask
|
||||||
|
HwFreeChannel
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ FindFreeChannel
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
mov si,[si].OpenNamePtr
|
||||||
|
mov al,[si+1]
|
||||||
|
CharToFoldedChar
|
||||||
|
cmp al,'A'
|
||||||
|
jb CantGetThatChannel
|
||||||
|
sub al,'A'
|
||||||
|
cmp al,NumberOfChannels
|
||||||
|
jae CantGetThatChannel
|
||||||
|
xor ah,ah
|
||||||
|
push dx
|
||||||
|
mov dx,size TmpltEnt
|
||||||
|
mul dx
|
||||||
|
pop dx
|
||||||
|
mov di,ax
|
||||||
|
add di,offset Channel0
|
||||||
|
cmp cs:[di].TmpltEntOpen,0
|
||||||
|
je FoundAFreeChannel
|
||||||
|
CantGetThatChannel:
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
FoundAFreeChannel:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ CheckForHardware
|
||||||
|
; ===========================
|
||||||
|
|
||||||
|
; Assume Interrupts are off
|
||||||
|
; Correct channel should be selected
|
||||||
|
; Out: clc - got correct hardware
|
||||||
|
; stc - wrong or no hardware
|
||||||
|
|
||||||
|
if Asic5Type
|
||||||
|
HwNullFrame ; Check that the
|
||||||
|
mov al,(SerialSelect or Asic5NormalId) ; Harware is there
|
||||||
|
SBUSY ; And that it is what
|
||||||
|
SCONTOUT ; It should be
|
||||||
|
XNOP ; First look for An
|
||||||
|
SBUSY ; ASIC5 at the other
|
||||||
|
SDATAIN ; End of the link
|
||||||
|
test al,al
|
||||||
|
je ConnectionFailed
|
||||||
|
GotConnection:
|
||||||
|
popf
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ConnectionFailed:
|
||||||
|
mov al, SerialSelect or Asic4Id ; Asic4 Id
|
||||||
|
SBUSY
|
||||||
|
SCONTOUT
|
||||||
|
XNOP
|
||||||
|
SBUSY
|
||||||
|
SDATAIN
|
||||||
|
test al, al
|
||||||
|
jne ConnectionFailedExit
|
||||||
|
else
|
||||||
|
HwNullFrame
|
||||||
|
mov al,(SerialSelect or Asic4Id)
|
||||||
|
SBUSY ; First look for An
|
||||||
|
SCONTOUT ; ASIC4 at the other
|
||||||
|
XNOP ; End of the link
|
||||||
|
SBUSY
|
||||||
|
SDATAIN
|
||||||
|
test al, al
|
||||||
|
je ConnectionFailed
|
||||||
|
mov al,SerialReadSingle or A4InfoR ; Now see if we have
|
||||||
|
SBUSY ; The right card
|
||||||
|
SCONTOUT
|
||||||
|
XNOP ; Allows the busy signal to come through for the wait
|
||||||
|
SBUSY
|
||||||
|
SDATAIN
|
||||||
|
and al,A4PERIPH_MASK
|
||||||
|
cmp al,TheInfoByteThatWeWant
|
||||||
|
jne ConnectionFailedExit
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ConnectionFailed:
|
||||||
|
mov al,(SerialSelect or Asic5NormalId) ; Select as an
|
||||||
|
SBUSY ; Asic5 peripheral
|
||||||
|
SCONTOUT
|
||||||
|
XNOP
|
||||||
|
SDATAIN
|
||||||
|
test al,al
|
||||||
|
jne ConnectionFailedExit
|
||||||
|
endif
|
||||||
|
mov al, SerialSelect or Asic8Id ; Modem chip Id
|
||||||
|
SBUSY
|
||||||
|
SCONTOUT
|
||||||
|
XNOP
|
||||||
|
SBUSY
|
||||||
|
SDATAIN
|
||||||
|
test al, al
|
||||||
|
jne ConnectionFailedExit
|
||||||
|
mov al, SerialSelect or Asic5PackId ; Asic5pack Id
|
||||||
|
SBUSY
|
||||||
|
SCONTOUT
|
||||||
|
XNOP
|
||||||
|
SBUSY
|
||||||
|
SDATAIN
|
||||||
|
ConnectionFailedExit:
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ MonitorInt,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Called on every tick
|
||||||
|
; Issues pack door hold and resumes
|
||||||
|
; In: Door state in SI
|
||||||
|
|
||||||
|
cmp si,DoorOpen
|
||||||
|
je TheDoorIsOpenSoCantDoAnything
|
||||||
|
cmp CsHeldFlag,2
|
||||||
|
je NeedToDoTheResume
|
||||||
|
ret
|
||||||
|
NeedToDoTheResume:
|
||||||
|
mov CsHeldFlag,0
|
||||||
|
jmp DoResume
|
||||||
|
TheDoorIsOpenSoCantDoAnything:
|
||||||
|
cmp CsHeldFlag,0
|
||||||
|
jne DontNeedToHold
|
||||||
|
mov CsHeldFlag,2
|
||||||
|
mov ah,DevHoldPowerFail
|
||||||
|
jmp DoHold
|
||||||
|
DontNeedToHold:
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
if NeedTheInterrupt
|
||||||
|
ife Consumer
|
||||||
|
ProcBegin@ Interrupt2,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
mov di,offset Channel2
|
||||||
|
mov ax,PortCActive
|
||||||
|
jmp ComInt
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ Interrupt1,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
mov di,offset Channel1
|
||||||
|
mov ax,PortBActive
|
||||||
|
jmp ComInt
|
||||||
|
ProcEnd noret
|
||||||
|
endif
|
||||||
|
|
||||||
|
ProcBegin@ Interrupt0,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
mov di,offset Channel0
|
||||||
|
mov ax,PortAActive
|
||||||
|
; FALLTHROUGH to ComInt
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ ComInt,far
|
||||||
|
; =====================
|
||||||
|
|
||||||
|
if Asic9
|
||||||
|
out A9BNonSpecificEoiW,al
|
||||||
|
else
|
||||||
|
out A1NonSpecificEoi, al
|
||||||
|
endif
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
EndCodeSeg
|
||||||
|
stack segment stack para 'data'
|
||||||
|
stack ends
|
||||||
|
end TmpltLDD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,531 @@
|
|||||||
|
title NAME.LDD device driver for S3/S3a/S3c/S3../HC
|
||||||
|
subttl Copyright PSION PLC November 1995
|
||||||
|
name NAME
|
||||||
|
|
||||||
|
; VERSION DATE DESCRIPTION
|
||||||
|
; ------- -------- ---------------
|
||||||
|
; 1.0 12/01/95 Template LDD
|
||||||
|
|
||||||
|
; Written by Jason Robinson January 1995
|
||||||
|
|
||||||
|
BUILDSB equ 1
|
||||||
|
|
||||||
|
include ..\inc\epoc.inc
|
||||||
|
include ..\inc\epocser.inc
|
||||||
|
include ..\inc\epoclib.inc
|
||||||
|
include ..\inc\epocsibo.inc
|
||||||
|
include ..\srcs\ossibo.inc
|
||||||
|
include ..\srcs\ospack.inc
|
||||||
|
|
||||||
|
OpenSpecificChannel =0
|
||||||
|
MachineSpecific =0
|
||||||
|
PeripheralTypeDriver =0
|
||||||
|
TickRequired =0
|
||||||
|
|
||||||
|
NumberOfChannels equ 1
|
||||||
|
WeSupportS3Only equ Lcd240X80
|
||||||
|
WeSupportS3aOnly equ Lcd480X160
|
||||||
|
WeSupportS3cOnly equ Lcd240X100
|
||||||
|
WeSupportHCOnly equ Lcd160X80
|
||||||
|
TheMachineWeSupport equ WeSupportS3aOnly
|
||||||
|
|
||||||
|
TmpltEnt struc
|
||||||
|
TmpltEntOpen db ? ; Channel open flag
|
||||||
|
TmpltChannelStarted db ? ; Channel should be running
|
||||||
|
TmpltChannelRunning db ? ; Can channel really run
|
||||||
|
TmpltSpare db ?
|
||||||
|
TmpltHwChannel dw ? ; The harware we want
|
||||||
|
TmpltStructPtr dw ? ; Ptr to CB in Apps DS
|
||||||
|
if PeripheralTypeDriver or TickRequired
|
||||||
|
TmpltTckHandle dw ? ; Tick Handle
|
||||||
|
endif
|
||||||
|
TmpltEnt ends
|
||||||
|
|
||||||
|
TmpltStruct struc
|
||||||
|
Tmpltblk ChanEnt <> ; I/O control block
|
||||||
|
TmpltEntPtr dw ? ; Ptr to our CS CB
|
||||||
|
TmpltStruct ends
|
||||||
|
|
||||||
|
dgroup group stack
|
||||||
|
assume ds:dgroup,es:dgroup,ss:dgroup
|
||||||
|
|
||||||
|
CodeSeg
|
||||||
|
|
||||||
|
ProcBegin@ TmpltLDD
|
||||||
|
; ===================
|
||||||
|
|
||||||
|
dw LDDSignature
|
||||||
|
db 'HSB',0,0,0,0,0
|
||||||
|
dw (TableEnd-TableStart)/2
|
||||||
|
TableStart:
|
||||||
|
dw TmpltInstall
|
||||||
|
dw TmpltRemove
|
||||||
|
dw TmpltHold
|
||||||
|
dw TmpltResume
|
||||||
|
dw TmpltReset
|
||||||
|
dw TmpltUnits
|
||||||
|
dw TmpltOpen
|
||||||
|
dw TmpltStrategy
|
||||||
|
if PeripheralTypeDriver or TickRequired
|
||||||
|
MonitorVector:
|
||||||
|
dw MonitorInt
|
||||||
|
endif
|
||||||
|
TableEnd:
|
||||||
|
|
||||||
|
CsHeldFlag db 0 ; Ldd under a hold?
|
||||||
|
MachineType db 0
|
||||||
|
|
||||||
|
Channel0 TmpltEnt <>
|
||||||
|
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltInstall,far
|
||||||
|
; ===========================
|
||||||
|
|
||||||
|
; Install the driver
|
||||||
|
; Exit with carry clear for okay
|
||||||
|
|
||||||
|
if MachineSpecific
|
||||||
|
GenLcdType ; Do we only run on
|
||||||
|
mov MachineType,al ; particular machines?
|
||||||
|
cmp al,TheMachineWeSupport
|
||||||
|
jne CannotInstallOnThisMachine
|
||||||
|
endif
|
||||||
|
mov CsHeldFlag,0 ; Initialise all
|
||||||
|
mov cx,NumberOfChannels ; the variables
|
||||||
|
mov di,offset Channel0
|
||||||
|
xor ax,ax
|
||||||
|
ResetAllChannelsLoop:
|
||||||
|
mov cs:[di].TmpltEntOpen,al
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop ResetAllChannelsLoop
|
||||||
|
FinishedOkay:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
CannotInstallOnThisMachine:
|
||||||
|
mov ax,NotSupportedErr
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltRemove,far
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
; Remove the driver
|
||||||
|
; Exit with carry clear for okay
|
||||||
|
; Exit with carry set if channel still open
|
||||||
|
|
||||||
|
mov cx,NumberOfChannels
|
||||||
|
mov di,offset Channel0
|
||||||
|
xor ax,ax
|
||||||
|
CheckAllChannelsClosedLoop:
|
||||||
|
cmp cs:[di].TmpltEntOpen,al
|
||||||
|
jne WeHaveAnOpenChannelSoFail
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop CheckAllChannelsClosedLoop
|
||||||
|
jmp FinishedOkay
|
||||||
|
WeHaveAnOpenChannelSoFail:
|
||||||
|
mov ax,InUseErr
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltUnits,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Return the Number of channels that can be opened in AX
|
||||||
|
|
||||||
|
mov ax,NumberOfChannels ; We have ? channels
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltReset,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Reset the open channel
|
||||||
|
|
||||||
|
mov di,cx
|
||||||
|
cmp cs:[di].TmpltEntOpen,0 ; Somethings gone
|
||||||
|
je NotOpenToReset ; wrong with the
|
||||||
|
mov ah,DevHoldPowerDown ; application that
|
||||||
|
call StopTheChannel ; opened us.
|
||||||
|
call FreeHardware ; Stop interupts and
|
||||||
|
mov cs:[di].TmpltEntOpen,0 ; free the channel
|
||||||
|
NotOpenToReset:
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltHold,far
|
||||||
|
; ========================
|
||||||
|
|
||||||
|
; Hold the channels
|
||||||
|
; Hold reason in AH
|
||||||
|
|
||||||
|
mov cx,1
|
||||||
|
xchg cl,CsHeldFlag ; Stop any interrupts
|
||||||
|
cmp cl,0 ; Mark channel as
|
||||||
|
jne AlreadyHeld ; under a normal hold
|
||||||
|
DoHold:
|
||||||
|
mov cx,NumberOfChannels
|
||||||
|
mov di,offset Channel0
|
||||||
|
HoldAllTheChannelsLoop:
|
||||||
|
cmp cs:[di].TmpltEntOpen,0
|
||||||
|
je DontHoldBecauseNotOpen
|
||||||
|
cmp cs:[di].TmpltChannelStarted,0
|
||||||
|
je DontHoldBecauseNotOpen
|
||||||
|
push ax
|
||||||
|
push cx
|
||||||
|
call StopTheChannel
|
||||||
|
pop cx
|
||||||
|
pop ax
|
||||||
|
DontHoldBecauseNotOpen:
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop HoldAllTheChannelsLoop
|
||||||
|
AlreadyHeld:
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltResume,far
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
; Resume the channel
|
||||||
|
|
||||||
|
xor cx,cx ; Be warned during an
|
||||||
|
xchg cl,CsHeldFlag ; on/off the power to
|
||||||
|
cmp cl,0 ; ASIC4 is not restored
|
||||||
|
je AlreadyResumed ; until after this
|
||||||
|
if PeripheralTypeDriver
|
||||||
|
GenDataSegment ; A resume is pointless
|
||||||
|
HwGetSsdData ; if there is still no
|
||||||
|
mov bx,ax ; power to the port
|
||||||
|
cmp es:[bx].SsdDoorStatus,DoorOpen ; Leave the resume
|
||||||
|
je DoorsAreOpen ; to the tick
|
||||||
|
endif
|
||||||
|
DoResume:
|
||||||
|
mov cx,NumberOfChannels
|
||||||
|
mov di,offset Channel0 ; Right hardware?
|
||||||
|
ResumeAllTheChannelsLoop: ; Else restart
|
||||||
|
cmp cs:[di].TmpltEntOpen,0 ; interrupts
|
||||||
|
je DontResumeBecauseNotOpen
|
||||||
|
cmp cs:[di].TmpltChannelStarted,0
|
||||||
|
je DontResumeBecauseNotOpen
|
||||||
|
push cx
|
||||||
|
call StartTheChannel
|
||||||
|
pop cx
|
||||||
|
DontResumeBecauseNotOpen:
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop ResumeAllTheChannelsLoop
|
||||||
|
AlreadyResumed:
|
||||||
|
ret
|
||||||
|
if PeripheralTypeDriver
|
||||||
|
DoorsAreOpen:
|
||||||
|
mov CsHeldFlag,2
|
||||||
|
ret
|
||||||
|
endif
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltOpen,far
|
||||||
|
; ========================
|
||||||
|
|
||||||
|
; Open the channel
|
||||||
|
; DS,ES,SS Applications data space
|
||||||
|
; Handle in DX
|
||||||
|
|
||||||
|
cld
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
call FindFreeChannel
|
||||||
|
jnc GotFreeChannel
|
||||||
|
popf
|
||||||
|
LockedError:
|
||||||
|
mov ax,LockedErr
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
AllErrorsExitHere:
|
||||||
|
push ax
|
||||||
|
HeapFreeCell
|
||||||
|
pop ax
|
||||||
|
FreeTckAndChannel:
|
||||||
|
push ax
|
||||||
|
call FreeHardware
|
||||||
|
pop ax
|
||||||
|
FreeTckAndExit:
|
||||||
|
if PeripheralTypeDriver or TickRequired
|
||||||
|
push ax
|
||||||
|
mov bx,cs:[di].TmpltTckHandle
|
||||||
|
IoClose
|
||||||
|
pop ax
|
||||||
|
endif
|
||||||
|
CloseThenFree:
|
||||||
|
mov cs:[di].TmpltEntOpen,0
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
GotFreeChannel:
|
||||||
|
mov cs:[di].TmpltEntOpen,1
|
||||||
|
mov cs:[di].TmpltChannelStarted,0
|
||||||
|
mov cs:[di].TmpltChannelRunning,0
|
||||||
|
popf
|
||||||
|
if PeripheralTypeDriver or TickRequired
|
||||||
|
xor ax,ax
|
||||||
|
push ax
|
||||||
|
mov ax,((':' shl 8)+'K')
|
||||||
|
push ax
|
||||||
|
mov ax,(('C' shl 8)+'T')
|
||||||
|
push ax
|
||||||
|
mov bx,sp
|
||||||
|
IoOpen
|
||||||
|
jnc GotATickChannel
|
||||||
|
add sp,6
|
||||||
|
mov ax,LockedErr
|
||||||
|
jmp CloseThenFree
|
||||||
|
GotATickChannel:
|
||||||
|
add sp,6
|
||||||
|
mov cs:[di].TmpltTckHandle,ax
|
||||||
|
push dx
|
||||||
|
mov bx,ax
|
||||||
|
mov ax,IoFuncStart
|
||||||
|
mov cx,1
|
||||||
|
push cx ; Frequency 1 tick
|
||||||
|
push di ; Data is our CS CB
|
||||||
|
push dx ; Our device handle
|
||||||
|
mov cx,(MonitorVector-TableStart)/2 ; Vector to call
|
||||||
|
push cx
|
||||||
|
mov cx,sp
|
||||||
|
IoWithWait
|
||||||
|
add sp,8
|
||||||
|
pop dx
|
||||||
|
endif
|
||||||
|
call GetHardware
|
||||||
|
jc FreeTckAndExit
|
||||||
|
|
||||||
|
mov cx,(size TmpltStruct) ; Get ourselfs a CB
|
||||||
|
HeapAllocateCell ; In the applications
|
||||||
|
jc FreeTckAndChannel ; Data space
|
||||||
|
|
||||||
|
mov bx,ax
|
||||||
|
mov [bx].Tmpltblk.ChanNext,bx
|
||||||
|
mov [bx].Tmpltblk.ChanSignature,IoChanSignature
|
||||||
|
mov [bx].Tmpltblk.ChanLibHandle,dx
|
||||||
|
mov [bx].TmpltEntPtr,di
|
||||||
|
push bx
|
||||||
|
mov bx,dx
|
||||||
|
mov cx,di
|
||||||
|
IoRequestReset
|
||||||
|
pop bx
|
||||||
|
xor ax,ax
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
StrategyVectorTable label word
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset TmpltClose
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
dw offset StrategyDefault
|
||||||
|
|
||||||
|
ProcBegin@ TmpltStrategy,far
|
||||||
|
; ============================
|
||||||
|
|
||||||
|
; BX is our control block
|
||||||
|
; SI points to the parameters
|
||||||
|
; DS,ES Applications data space
|
||||||
|
|
||||||
|
mov ax,[si].RqFunction
|
||||||
|
mov dx,[si].RqA1Ptr
|
||||||
|
cmp ax,IoFuncSuperFrame
|
||||||
|
ja StrategyDefault
|
||||||
|
shl ax,1
|
||||||
|
mov di,ax
|
||||||
|
push StrategyVectorTable[di]
|
||||||
|
mov di,[bx].TmpltEntPtr
|
||||||
|
retn
|
||||||
|
StrategyDefault:
|
||||||
|
IoRoot
|
||||||
|
ret
|
||||||
|
ExitStrategyOkay:
|
||||||
|
xor ax,ax
|
||||||
|
ExitStrategy:
|
||||||
|
mov di,[si].RqStatusPtr
|
||||||
|
mov word ptr [di],ax
|
||||||
|
cmp ax,PendingErr
|
||||||
|
je JustExit
|
||||||
|
IoSignal
|
||||||
|
JustExit:
|
||||||
|
xor ax,ax
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ TmpltClose,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Close a channel
|
||||||
|
; DI CS control block
|
||||||
|
; BX DS control block
|
||||||
|
; SI points to aurguments on stack
|
||||||
|
; DX Argument one pointer
|
||||||
|
|
||||||
|
mov ah,DevHoldPowerDown
|
||||||
|
call StopTheChannel
|
||||||
|
call FreeHardware
|
||||||
|
push bx
|
||||||
|
mov bx,[bx].Tmpltblk.ChanLibHandle
|
||||||
|
mov cx,di
|
||||||
|
IoRequestResetCancel
|
||||||
|
pop bx
|
||||||
|
HeapFreeCell
|
||||||
|
if PeripheralTypeDriver or TickRequired
|
||||||
|
mov bx,cs:[di].TmpltTckHandle
|
||||||
|
IoClose
|
||||||
|
endif
|
||||||
|
mov cs:[di].TmpltEntOpen,0
|
||||||
|
jmp short ExitStrategyOkay
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ StartTheChannel
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
; Start the Channel Running
|
||||||
|
|
||||||
|
cmp byte ptr cs:[di].TmpltChannelRunning,0
|
||||||
|
jne ChannelAlreadyRunning
|
||||||
|
|
||||||
|
mov cs:[di].TmpltChannelRunning,1
|
||||||
|
ChannelAlreadyRunning:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ StopTheChannel
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
; Stop the Channel Running
|
||||||
|
|
||||||
|
cmp byte ptr cs:[di].TmpltChannelRunning,0
|
||||||
|
je ChannelAlreadyStopped
|
||||||
|
|
||||||
|
mov cs:[di].TmpltChannelRunning,0
|
||||||
|
ChannelAlreadyStopped:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ GetHardware
|
||||||
|
; ======================
|
||||||
|
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
ProcBegin@ FreeHardware
|
||||||
|
; =======================
|
||||||
|
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
|
||||||
|
If OpenSpecificChannel
|
||||||
|
ProcBegin@ FindFreeChannel
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
; Called from Open
|
||||||
|
; Must preserve DX,SI
|
||||||
|
; Channel out in DI or carry set if failure
|
||||||
|
|
||||||
|
mov si,[si].OpenNamePtr
|
||||||
|
mov al,[si+1]
|
||||||
|
CharToFoldedChar
|
||||||
|
cmp al,'A'
|
||||||
|
jb CantGetThatChannel
|
||||||
|
sub al,'A'
|
||||||
|
cmp al,NumberOfChannels
|
||||||
|
jae CantGetThatChannel
|
||||||
|
xor ah,ah
|
||||||
|
push dx
|
||||||
|
mov dx,size TmpltEnt
|
||||||
|
mul dx
|
||||||
|
pop dx
|
||||||
|
mov di,ax
|
||||||
|
add di,offset Channel0
|
||||||
|
cmp cs:[di].TmpltEntOpen,0
|
||||||
|
je FoundAFreeChannel
|
||||||
|
CantGetThatChannel:
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
FoundAFreeChannel:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
else
|
||||||
|
ProcBegin@ FindFreeChannel
|
||||||
|
; ==========================
|
||||||
|
|
||||||
|
mov cx,NumberOfChannels
|
||||||
|
mov di,offset Channel0
|
||||||
|
HuntAllChannelsLoop:
|
||||||
|
cmp cs:[di].TmpltEntOpen,0
|
||||||
|
je FoundAFreeChannel
|
||||||
|
add di,size TmpltEnt
|
||||||
|
loop HuntAllChannelsLoop
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
FoundAFreeChannel:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
endif
|
||||||
|
|
||||||
|
if PeripheralTypeDriver or TickRequired
|
||||||
|
ProcBegin@ MonitorInt,far
|
||||||
|
; =========================
|
||||||
|
|
||||||
|
if PeripheralTypeDriver
|
||||||
|
; Called on every tick
|
||||||
|
; Issues pack door hold and resumes
|
||||||
|
; In: Door state in SI
|
||||||
|
|
||||||
|
cmp si,DoorOpen
|
||||||
|
je TheDoorIsOpenSoCantDoAnything
|
||||||
|
cmp CsHeldFlag,2
|
||||||
|
je NeedToDoTheResume
|
||||||
|
ret
|
||||||
|
NeedToDoTheResume:
|
||||||
|
mov CsHeldFlag,0
|
||||||
|
jmp DoResume
|
||||||
|
TheDoorIsOpenSoCantDoAnything:
|
||||||
|
cmp CsHeldFlag,0
|
||||||
|
jne DontNeedToHold
|
||||||
|
mov CsHeldFlag,2
|
||||||
|
mov ah,DevHoldPowerFail
|
||||||
|
jmp DoHold
|
||||||
|
DontNeedToHold:
|
||||||
|
endif
|
||||||
|
ret
|
||||||
|
ProcEnd noret
|
||||||
|
endif
|
||||||
|
|
||||||
|
EndCodeSeg
|
||||||
|
stack segment stack para 'data'
|
||||||
|
stack ends
|
||||||
|
end TmpltLDD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@if not "%jpivid%"=="v2" set jpivid=v0
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
kats.pic
|
||||||
|
kats.rsc
|
||||||
@@ -0,0 +1,498 @@
|
|||||||
|
/*
|
||||||
|
File: KATS.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ats.h>
|
||||||
|
#include <p_gen.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
#include <olib.g>
|
||||||
|
#include <appman.g>
|
||||||
|
#include <gate.g>
|
||||||
|
#include <kats.rsg>
|
||||||
|
|
||||||
|
#define KATS_MODS (W_CTRL_MODIFIER|W_PSION_MODIFIER)
|
||||||
|
#define KATS_RECORD 0x20
|
||||||
|
#define KATS_PLAYBACK W_KEY_RETURN
|
||||||
|
#define KATS_PLAYBACK2 W_KEY_TAB
|
||||||
|
#define KATS_SAVE W_KEY_DIAMOND
|
||||||
|
|
||||||
|
#define MAX_NUM_KEYS 128 /* maximum number of keys per macro */
|
||||||
|
#define MACRO_NAME_LEN 24 /* includes zero terminator */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
TEXT name[MACRO_NAME_LEN];
|
||||||
|
WORD num_keys;
|
||||||
|
ATS_KEY_DEF keys[MAX_NUM_KEYS];
|
||||||
|
} KATS_MACRO;
|
||||||
|
|
||||||
|
GLREF_D VOID *DatCommandPtr;
|
||||||
|
GLREF_D VOID *DatGate;
|
||||||
|
|
||||||
|
LOCAL_D HANDLE olib;
|
||||||
|
|
||||||
|
LOCAL_D VOID *vaxvar;
|
||||||
|
LOCAL_D UWORD nmacros;
|
||||||
|
|
||||||
|
LOCAL_D KATS_MACRO mac_rec; /* macro being recorded */
|
||||||
|
LOCAL_D ATS_KEY full_key; /* key being recorded */
|
||||||
|
|
||||||
|
LOCAL_D KATS_MACRO *mac_play; /* macro being played back */
|
||||||
|
LOCAL_D INT play_keys;
|
||||||
|
|
||||||
|
LOCAL_D INT changed;
|
||||||
|
|
||||||
|
LOCAL_D INT pid;
|
||||||
|
|
||||||
|
LOCAL_D INT record;
|
||||||
|
LOCAL_D INT playback;
|
||||||
|
|
||||||
|
LOCAL_D WS_EV event;
|
||||||
|
LOCAL_D WORD rec_stat;
|
||||||
|
LOCAL_D WORD rec_active;
|
||||||
|
LOCAL_D WORD play_stat;
|
||||||
|
LOCAL_D WORD play_active;
|
||||||
|
|
||||||
|
LOCAL_D TEXT *pmac_name;
|
||||||
|
LOCAL_D ATS_DIAL_DEF dl_edit;
|
||||||
|
LOCAL_D ATS_DIAL_DEF dl_choose;
|
||||||
|
LOCAL_D ATS_DIAL_DEF dl_confirm;
|
||||||
|
LOCAL_D ATS_DIAL_DEF dl_save;
|
||||||
|
|
||||||
|
LOCAL_C INT GetForegroundClient(VOID)
|
||||||
|
{
|
||||||
|
UWORD pids[WS_MAX_CLIENTS+1];
|
||||||
|
|
||||||
|
wGetProcessList(&pids[0]);
|
||||||
|
return(pids[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT GetTestForegroundClient(VOID)
|
||||||
|
{
|
||||||
|
INT pid;
|
||||||
|
|
||||||
|
pid=GetForegroundClient();
|
||||||
|
if (!p_send3(DatGate,O_GT_CHECK_ATS_ON,pid))
|
||||||
|
return(pid); /* okay */
|
||||||
|
p_sound(5,320);
|
||||||
|
p_sound(5,280);
|
||||||
|
p_sound(5,240);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ForegroundAtsWait(INT type,ATS_MESS_BODY *pu)
|
||||||
|
{
|
||||||
|
INT pid;
|
||||||
|
|
||||||
|
pid=GetTestForegroundClient();
|
||||||
|
if (pid)
|
||||||
|
p_msendreceivew(pid,type,pu);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Message(TEXT *msg)
|
||||||
|
{
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
|
||||||
|
u.offs=msg;
|
||||||
|
ForegroundAtsWait(TY_ATS_MESSAGE,&u);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID TellErr(INT err)
|
||||||
|
{
|
||||||
|
TEXT buf[64];
|
||||||
|
|
||||||
|
if (err==E_GEN_FAIL)
|
||||||
|
return;
|
||||||
|
p_errs(&buf[0],err);
|
||||||
|
Message(&buf[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID TellOom(VOID)
|
||||||
|
{
|
||||||
|
TellErr(E_GEN_NOMEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID PlayNextKey(VOID)
|
||||||
|
{
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
|
||||||
|
u.k=mac_play->keys[play_keys];
|
||||||
|
play_active=TRUE;
|
||||||
|
p_msendreceivea(pid,TY_ATS_KEY,&u,&play_stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID RequestNextKey(VOID)
|
||||||
|
{
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
|
||||||
|
u.offs=(&full_key);
|
||||||
|
rec_active=TRUE;
|
||||||
|
p_msendreceivea(pid,TY_ATS_GET_KEY,&u,&rec_stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID TransmitRecordState(VOID)
|
||||||
|
{
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
|
||||||
|
u.par=record;
|
||||||
|
p_msendreceivew(pid,TY_ATS_RECORD,&u);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C KATS_MACRO *FindMacro(INT i)
|
||||||
|
{
|
||||||
|
return((KATS_MACRO *)p_send(vaxvar,O_VA_PBUF,i));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DeleteMacro(INT i)
|
||||||
|
{
|
||||||
|
p_send3(vaxvar,O_VA_DELETE,i);
|
||||||
|
nmacros--;
|
||||||
|
changed=TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT QueryOverwrite(VOID)
|
||||||
|
{
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
|
||||||
|
u.d=dl_confirm;
|
||||||
|
return(p_msendreceivew(pid,TY_ATS_DIALOG,&u));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SaveIfConfirmed(VOID)
|
||||||
|
{
|
||||||
|
INT pid;
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
|
||||||
|
pid=GetTestForegroundClient();
|
||||||
|
if (!pid)
|
||||||
|
return;
|
||||||
|
u.d=dl_save;
|
||||||
|
if (p_msendreceivew(pid,TY_ATS_DIALOG,&u)==W_KEY_RETURN)
|
||||||
|
{
|
||||||
|
Message("Should save now!");
|
||||||
|
changed=FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT CheckNotMatching(VOID)
|
||||||
|
{
|
||||||
|
INT i;
|
||||||
|
KATS_MACRO *pmac;
|
||||||
|
INT key;
|
||||||
|
|
||||||
|
for (i=0; i<nmacros; i++)
|
||||||
|
{
|
||||||
|
pmac=FindMacro(i);
|
||||||
|
if (p_scmpi(&pmac->name[0],&mac_rec.name[0]))
|
||||||
|
continue;
|
||||||
|
key=QueryOverwrite();
|
||||||
|
if (key==W_KEY_ESCAPE)
|
||||||
|
return(FALSE);
|
||||||
|
DeleteMacro(i);
|
||||||
|
return(key==' ');
|
||||||
|
}
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT GetMacroName(VOID)
|
||||||
|
{
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
u.d=dl_edit;
|
||||||
|
ret=p_msendreceivew(pid,TY_ATS_DIALOG,&u);
|
||||||
|
if (ret<0)
|
||||||
|
{
|
||||||
|
TellErr(ret);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(CheckNotMatching());
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID StartRecording(VOID)
|
||||||
|
{
|
||||||
|
pid=GetTestForegroundClient();
|
||||||
|
if (!pid)
|
||||||
|
return;
|
||||||
|
if (GetMacroName())
|
||||||
|
{
|
||||||
|
record=TRUE;
|
||||||
|
TransmitRecordState();
|
||||||
|
Message("Recording...");
|
||||||
|
mac_rec.num_keys=0;
|
||||||
|
RequestNextKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma save,ENTER_CALL
|
||||||
|
|
||||||
|
LOCAL_C INT AppendMacro(VOID)
|
||||||
|
{
|
||||||
|
RC_VAXVAR rcv;
|
||||||
|
|
||||||
|
rcv.buf=(UBYTE *)(&mac_rec);
|
||||||
|
rcv.len=MACRO_NAME_LEN+sizeof(WORD)+mac_rec.num_keys*sizeof(ATS_KEY_DEF);
|
||||||
|
p_send3(vaxvar,O_VA_APPEND,&rcv);
|
||||||
|
nmacros++;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma restore
|
||||||
|
|
||||||
|
LOCAL_C VOID StopRecording(VOID)
|
||||||
|
{
|
||||||
|
record=FALSE;
|
||||||
|
TransmitRecordState();
|
||||||
|
if (!mac_rec.num_keys)
|
||||||
|
{
|
||||||
|
Message("Recording cancelled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (p_enter1(AppendMacro)<0)
|
||||||
|
TellOom();
|
||||||
|
else if (mac_rec.num_keys==MAX_NUM_KEYS)
|
||||||
|
Message("Maximum number of keystrokes reached");
|
||||||
|
else
|
||||||
|
Message("Finished recording");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID BuildNameList(VOID)
|
||||||
|
{
|
||||||
|
UBYTE *pb;
|
||||||
|
UBYTE *new_pb;
|
||||||
|
INT i;
|
||||||
|
INT size;
|
||||||
|
INT this_size;
|
||||||
|
KATS_MACRO *pmac;
|
||||||
|
|
||||||
|
pb=p_alloc(1);
|
||||||
|
if (!pb)
|
||||||
|
return;
|
||||||
|
size=1;
|
||||||
|
*pb=0;
|
||||||
|
for (i=0; i<nmacros; i++)
|
||||||
|
{
|
||||||
|
pmac=FindMacro(i);
|
||||||
|
this_size=p_slen(&pmac->name[0])+2; /* include LBC and ZTS */
|
||||||
|
new_pb=p_realloc(pb,size+this_size);
|
||||||
|
if (!new_pb)
|
||||||
|
{
|
||||||
|
p_free(pb);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pb=new_pb;
|
||||||
|
*(pb+size)=this_size-1; /* leading byte count */
|
||||||
|
p_scpy(pb+size+1,&pmac->name[0]);
|
||||||
|
size+=this_size;
|
||||||
|
}
|
||||||
|
*pb=i;
|
||||||
|
dl_choose.buts=(UWORD)pb;
|
||||||
|
dl_choose.butslen=size;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID FreeNameList(VOID)
|
||||||
|
{
|
||||||
|
p_free((VOID *)dl_choose.buts);
|
||||||
|
dl_choose.buts=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID StartPlayback(VOID)
|
||||||
|
{
|
||||||
|
ATS_MESS_BODY u;
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
pid=GetTestForegroundClient();
|
||||||
|
if (!pid)
|
||||||
|
return;
|
||||||
|
BuildNameList();
|
||||||
|
if (!dl_choose.buts)
|
||||||
|
{
|
||||||
|
TellOom();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
u.d=dl_choose;
|
||||||
|
ret=p_msendreceivew(pid,TY_ATS_DIALOG,&u);
|
||||||
|
FreeNameList();
|
||||||
|
if (ret<0)
|
||||||
|
{
|
||||||
|
TellErr(ret);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mac_play=FindMacro(ret);
|
||||||
|
play_keys=0;
|
||||||
|
playback=TRUE;
|
||||||
|
PlayNextKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID StopPlayback(VOID)
|
||||||
|
{
|
||||||
|
playback=FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID NextStageInRecord(VOID)
|
||||||
|
{
|
||||||
|
ATS_KEY_DEF *short_key;
|
||||||
|
|
||||||
|
short_key=(&mac_rec.keys[mac_rec.num_keys++]);
|
||||||
|
short_key->key=full_key.keycode;
|
||||||
|
short_key->mod=full_key.modifiers;
|
||||||
|
changed=TRUE;
|
||||||
|
if (mac_rec.num_keys==MAX_NUM_KEYS)
|
||||||
|
StopRecording();
|
||||||
|
else
|
||||||
|
RequestNextKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID NextStageInPlayback(VOID)
|
||||||
|
{
|
||||||
|
play_keys++;
|
||||||
|
if (play_keys==mac_play->num_keys)
|
||||||
|
{
|
||||||
|
StopPlayback();
|
||||||
|
Message("Playback complete");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PlayNextKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID MainLoop(VOID)
|
||||||
|
{
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
wGetEvent(&event);
|
||||||
|
wait:
|
||||||
|
p_iowait();
|
||||||
|
switch (event.type)
|
||||||
|
{
|
||||||
|
case E_FILE_PENDING:
|
||||||
|
if (rec_active && rec_stat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
rec_active=FALSE;
|
||||||
|
if (record) /* else recording cancelled */
|
||||||
|
NextStageInRecord();
|
||||||
|
}
|
||||||
|
else if (play_active && play_stat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
play_active=FALSE;
|
||||||
|
if (playback) /* else playback cancelled */
|
||||||
|
NextStageInPlayback();
|
||||||
|
}
|
||||||
|
goto wait;
|
||||||
|
case WM_FOREGROUND:
|
||||||
|
wClientPosition(WS_LAST_CLIENT_POSITION,0);
|
||||||
|
break;
|
||||||
|
case WM_KEY:
|
||||||
|
switch (event.p.key.keycode)
|
||||||
|
{
|
||||||
|
case KATS_SAVE:
|
||||||
|
if (record)
|
||||||
|
Message("Can't save macros while recording");
|
||||||
|
else if (playback)
|
||||||
|
Message("Can't save macros while playing back");
|
||||||
|
else if (!changed)
|
||||||
|
Message("No macro changes to save");
|
||||||
|
else
|
||||||
|
SaveIfConfirmed();
|
||||||
|
break;
|
||||||
|
case KATS_RECORD:
|
||||||
|
if (record)
|
||||||
|
StopRecording();
|
||||||
|
else if (playback)
|
||||||
|
Message("Can't record while playing back");
|
||||||
|
else
|
||||||
|
StartRecording();
|
||||||
|
break;
|
||||||
|
case KATS_PLAYBACK:
|
||||||
|
case KATS_PLAYBACK2:
|
||||||
|
if (playback)
|
||||||
|
{
|
||||||
|
Message("Playback terminated");
|
||||||
|
StopPlayback();
|
||||||
|
}
|
||||||
|
else if (record)
|
||||||
|
Message("Can't play back while recording");
|
||||||
|
else if (!nmacros)
|
||||||
|
Message("Nothing to play back");
|
||||||
|
else
|
||||||
|
StartPlayback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID FindOlib(VOID)
|
||||||
|
{
|
||||||
|
p_findlib("OLIB.DYL",&olib);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CreateGate(VOID)
|
||||||
|
{
|
||||||
|
HANDLE hwim;
|
||||||
|
|
||||||
|
p_findlib("HWIM.DYL",&hwim);
|
||||||
|
DatGate=f_newlibh(hwim,C_GATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID LoadDialogData(VOID)
|
||||||
|
{
|
||||||
|
VOID *rcb;
|
||||||
|
|
||||||
|
rcb=f_newlibhsend(olib,C_RSCFILE,O_RS_INIT,DatCommandPtr);
|
||||||
|
dl_edit.mainlen=p_send4(rcb,O_RS_READ,KATS_DL_MAC_NAME,&dl_edit.main);
|
||||||
|
dl_choose.mainlen=p_send4(rcb,O_RS_READ,KATS_DL_PLAYBACK,&dl_choose.main);
|
||||||
|
dl_confirm.mainlen=p_send4(rcb,O_RS_READ,
|
||||||
|
KATS_DL_CONFIRM,&dl_confirm.main);
|
||||||
|
dl_confirm.butslen=p_send4(rcb,O_RS_READ,
|
||||||
|
KATS_AC_CONFIRM,&dl_confirm.buts);
|
||||||
|
dl_save.mainlen=p_send4(rcb,O_RS_READ,KATS_DL_SAVE,&dl_save.main);
|
||||||
|
dl_save.butslen=p_send4(rcb,O_RS_READ,KATS_AC_SAVE,&dl_save.buts);
|
||||||
|
p_send2(rcb,O_DESTROY);
|
||||||
|
dl_edit.butslen=(-2);
|
||||||
|
dl_edit.buts=(UWORD)(&pmac_name);
|
||||||
|
pmac_name=(&mac_rec.name[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CreateMacroStorage(VOID)
|
||||||
|
{
|
||||||
|
vaxvar=f_newlibhsend(olib,C_VAXVAR,O_VA_INIT,48);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ConnectToWindowServer(VOID)
|
||||||
|
{
|
||||||
|
wConnect(f_alloc(sizeof(WSERV_SPEC)),0,W_CONNECT_AT_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CaptureKeys(VOID)
|
||||||
|
{
|
||||||
|
wCaptureKey(KATS_RECORD,KATS_MODS,KATS_MODS);
|
||||||
|
wCaptureKey(KATS_PLAYBACK,KATS_MODS,KATS_MODS);
|
||||||
|
wCaptureKey(KATS_PLAYBACK2,KATS_MODS,KATS_MODS);
|
||||||
|
wCaptureKey(KATS_SAVE,KATS_MODS,KATS_MODS);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma save,ENTER_CALL
|
||||||
|
|
||||||
|
LOCAL_C INT Initialise(VOID)
|
||||||
|
{
|
||||||
|
FindOlib();
|
||||||
|
CreateGate();
|
||||||
|
LoadDialogData();
|
||||||
|
CreateMacroStorage();
|
||||||
|
ConnectToWindowServer();
|
||||||
|
CaptureKeys();
|
||||||
|
Message("Keyboard macro support loaded");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma restore
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
ret=p_enter1(Initialise);
|
||||||
|
if (!ret)
|
||||||
|
MainLoop();
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
|||||||
|
#system epoc img
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#if (%main.rsg #older %main.rss) #or (%main.rsc #older %main.rss) #then
|
||||||
|
#run "rs %main" no_window no_abort
|
||||||
|
#endif
|
||||||
|
#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then
|
||||||
|
#file delete %main.img
|
||||||
|
#endif
|
||||||
|
#compile %main
|
||||||
|
#link %main
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
#include <hwim.rh>
|
||||||
|
#include <hwim.rg>
|
||||||
|
|
||||||
|
RESOURCE DIALOG kats_dl_mac_name
|
||||||
|
{
|
||||||
|
title="Record keyboard macro";
|
||||||
|
flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED;
|
||||||
|
controls=
|
||||||
|
{
|
||||||
|
CONTROL
|
||||||
|
{
|
||||||
|
class=C_EDWIN;
|
||||||
|
prompt="Name for macro";
|
||||||
|
info=EDWIN
|
||||||
|
{
|
||||||
|
flags=IN_EDWIN_VULEN_CHARACTERS;
|
||||||
|
vulen=16;
|
||||||
|
maxlen=23;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE DIALOG kats_dl_playback
|
||||||
|
{
|
||||||
|
title="Playback keyboard macro";
|
||||||
|
flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED;
|
||||||
|
controls=
|
||||||
|
{
|
||||||
|
CONTROL
|
||||||
|
{
|
||||||
|
class=C_CHLIST;
|
||||||
|
prompt="Macro name";
|
||||||
|
info=CHLIST { };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE ACLIST_ARRAY kats_ac_confirm
|
||||||
|
{
|
||||||
|
button =
|
||||||
|
{
|
||||||
|
PUSH_BUT
|
||||||
|
{
|
||||||
|
keycode=W_KEY_ESCAPE;
|
||||||
|
str="Cancel";
|
||||||
|
},
|
||||||
|
PUSH_BUT
|
||||||
|
{
|
||||||
|
keycode=W_KEY_SPACE;
|
||||||
|
str="Overwrite";
|
||||||
|
},
|
||||||
|
PUSH_BUT
|
||||||
|
{
|
||||||
|
keycode=W_KEY_DELETE_LEFT;
|
||||||
|
str="Delete";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE DIALOG kats_dl_confirm
|
||||||
|
{
|
||||||
|
title="Name already exists";
|
||||||
|
controls=
|
||||||
|
{
|
||||||
|
CONTROL
|
||||||
|
{
|
||||||
|
class=C_ACLIST;
|
||||||
|
info=ACLIST { rid=kats_ac_confirm; };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE ACLIST_ARRAY kats_ac_save
|
||||||
|
{
|
||||||
|
button =
|
||||||
|
{
|
||||||
|
PUSH_BUT
|
||||||
|
{
|
||||||
|
keycode=W_KEY_ESCAPE;
|
||||||
|
str="Cancel";
|
||||||
|
},
|
||||||
|
PUSH_BUT
|
||||||
|
{
|
||||||
|
keycode=W_KEY_RETURN;
|
||||||
|
str="Confirm";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE DIALOG kats_dl_save
|
||||||
|
{
|
||||||
|
title="Save macros to file";
|
||||||
|
controls=
|
||||||
|
{
|
||||||
|
CONTROL
|
||||||
|
{
|
||||||
|
class=C_ACLIST;
|
||||||
|
info=ACLIST { rid=kats_ac_save; };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@echo off
|
||||||
|
call checkvid
|
||||||
|
if not exist %1.pr goto error
|
||||||
|
tscx /m %1 /%jpivid%
|
||||||
|
tscx /m %1 /%jpivid%
|
||||||
|
goto end
|
||||||
|
:error
|
||||||
|
echo Project file %1.pr does not exist
|
||||||
|
:end
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
@echo off
|
||||||
|
goto X%1X
|
||||||
|
:Xv0X
|
||||||
|
:XoffX
|
||||||
|
set jpivid=v0
|
||||||
|
echo VID is now OFF
|
||||||
|
goto :end
|
||||||
|
:Xv2X
|
||||||
|
:XonX
|
||||||
|
set jpivid=v2
|
||||||
|
echo VID is now ON
|
||||||
|
goto :end
|
||||||
|
:XX
|
||||||
|
call checkvid
|
||||||
|
goto %jpivid%
|
||||||
|
:v0
|
||||||
|
echo VID is OFF
|
||||||
|
goto end
|
||||||
|
:v2
|
||||||
|
echo VID is ON
|
||||||
|
:end
|
||||||
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
GLREF_D TEXT *DatStatusNamePtr;
|
||||||
|
|
||||||
|
LOCAL_D WSERV_SPEC wSpec;
|
||||||
|
|
||||||
|
LOCAL_C VOID CDECL Alert3(TEXT *m1,TEXT *m2,TEXT *m3)
|
||||||
|
{
|
||||||
|
TEXT *pt;
|
||||||
|
TEXT **pps;
|
||||||
|
DESC *pd,*pdend;
|
||||||
|
struct {
|
||||||
|
WORD zero;
|
||||||
|
DESC line[3];
|
||||||
|
TEXT buf[W_ALERT_TEXT_MAX_LEN];
|
||||||
|
} al;
|
||||||
|
|
||||||
|
al.zero=0;
|
||||||
|
pt=&al.buf[0];
|
||||||
|
pps=&m1;
|
||||||
|
for (pd=&al.line[0],pdend=pd+3;pd<pdend;pd++)
|
||||||
|
{
|
||||||
|
pd->hposition=0xff;
|
||||||
|
pd->length=p_slen(*pps);
|
||||||
|
pd->offset=pt-(TEXT *)&al;
|
||||||
|
pt=(TEXT *)p_bcpy(pt,*pps++,pd->length);
|
||||||
|
}
|
||||||
|
wsAlertW(WS_ALERT_CLIENT,(TEXT *)&al,NULL,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID AlertErr(INT err,TEXT *msg)
|
||||||
|
{
|
||||||
|
TEXT bb[3];
|
||||||
|
|
||||||
|
bb[0]=0;
|
||||||
|
bb[1]=0xfe;
|
||||||
|
bb[2]=err;
|
||||||
|
wsAlertW(WS_ALERT_CLIENT,msg,&bb[0],NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
DatStatusNamePtr="Sample";
|
||||||
|
wConnect(&wSpec,0,W_CONNECT_PRIORITY);
|
||||||
|
wsAlertW(WS_ALERT_CLIENT,"Hello World",NULL,NULL);
|
||||||
|
AlertErr(E_GEN_NOMEMORY,"Failed to save");
|
||||||
|
Alert3("Line 1","Line 2","Line 3");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
CALL MAKE HELLO
|
||||||
|
CALL MAKE P_HELLO
|
||||||
|
CALL MAKE P_COMP
|
||||||
|
CALL MAKE P_DLIST
|
||||||
|
CALL MAKE P_PRNDIR
|
||||||
|
CALL MAKE P_SEARCH
|
||||||
|
CALL MAKE EVENTS
|
||||||
|
CALL MAKE SUBPROC
|
||||||
|
CALL MAKE EVENTS2
|
||||||
|
CALL MAKE EVENTS3
|
||||||
|
CALL MAKE EVENTS4
|
||||||
|
CALL MAKE W_HELLO
|
||||||
|
CALL MAKE GAUGE
|
||||||
|
CALL MAKE LINED
|
||||||
|
CALL MAKE SCAPT
|
||||||
|
CALL MAKE FONTS
|
||||||
|
CALL MAKE HCSHELL
|
||||||
|
CALL MAKE LKSHELL
|
||||||
|
CALL MAKE ALERT
|
||||||
|
CALL MAKE CLOCK
|
||||||
|
CALL MAKE BUTTON
|
||||||
|
CALL MAKE SOUND
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
BUTTON.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
LOCAL_D WSERV_SPEC wSpec;
|
||||||
|
LOCAL_D UINT wMainWid;
|
||||||
|
LOCAL_D UINT FontID;
|
||||||
|
LOCAL_D UINT FontStyle;
|
||||||
|
LOCAL_D G_FONT_INFO FontInfo;
|
||||||
|
|
||||||
|
LOCAL_C VOID SetFont(INT fid,INT style)
|
||||||
|
{
|
||||||
|
gFontInfo(FontID=fid,FontStyle=style,&FontInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetGC(VOID)
|
||||||
|
{
|
||||||
|
G_GC gc;
|
||||||
|
|
||||||
|
gc.font=FontID;
|
||||||
|
gc.style=FontStyle;
|
||||||
|
gSetGC(0,G_GC_MASK_FONT|G_GC_MASK_STYLE,&gc);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawButton(INT state)
|
||||||
|
{
|
||||||
|
P_RECT rect;
|
||||||
|
|
||||||
|
rect.tl.x=20;
|
||||||
|
rect.tl.y=(40-2)-FontInfo.height;
|
||||||
|
rect.br.x=140;
|
||||||
|
rect.br.y=(40+2)+FontInfo.height;
|
||||||
|
wDrawButton(&rect,"Press any key",state);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID MainEventLoop(VOID)
|
||||||
|
{
|
||||||
|
WS_EV event;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wGetEventWait(&event);
|
||||||
|
if (event.type==WM_REDRAW)
|
||||||
|
{
|
||||||
|
wBeginRedrawWinGC0(wMainWid);
|
||||||
|
gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON);
|
||||||
|
SetGC();
|
||||||
|
DrawButton(FALSE);
|
||||||
|
wEndRedraw();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (event.type==WM_KEY)
|
||||||
|
{
|
||||||
|
gCreateTempGC0(wMainWid);
|
||||||
|
SetGC();
|
||||||
|
DrawButton(TRUE);
|
||||||
|
wFlush();
|
||||||
|
p_sleep(5l);
|
||||||
|
DrawButton(FALSE);
|
||||||
|
gFreeTempGC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
wConnect(&wSpec,0,W_CONNECT_PRIORITY);
|
||||||
|
wMainWid=wCreateWindow(0,0,0,1);
|
||||||
|
wInitialiseWindowTree(wMainWid);
|
||||||
|
SetFont(WS_FONT_SYSTEM,G_STY_BOLD);
|
||||||
|
MainEventLoop();
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@echo off
|
||||||
|
call checkvid
|
||||||
|
if exist %1.pr goto custom
|
||||||
|
tsc %1.c /fpunnamed /%jpivid%
|
||||||
|
goto end
|
||||||
|
:custom
|
||||||
|
tsc %1.c /fp%1 /%jpivid%
|
||||||
|
:end
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@if not "%jpivid%"=="v2" set jpivid=v0
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
CLOCK.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
LOCAL_D WSERV_SPEC wSpec;
|
||||||
|
LOCAL_D UINT wMainWid;
|
||||||
|
|
||||||
|
LOCAL_C VOID MainEventLoop(VOID)
|
||||||
|
{
|
||||||
|
WS_EV event;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wGetEventWait(&event);
|
||||||
|
if (event.type==WM_REDRAW)
|
||||||
|
{
|
||||||
|
wBeginRedrawWinGC0(wMainWid);
|
||||||
|
gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON);
|
||||||
|
wEndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
wConnect(&wSpec,0,W_CONNECT_PRIORITY);
|
||||||
|
wMainWid=wCreateWindow(0,0,0,1);
|
||||||
|
wsCreateClock(wMainWid,WS_CLOCK_LARGE_ANALOG|WS_CLOCK_WITH_SECONDS,4,4,0);
|
||||||
|
wsCreateClock(wMainWid,WS_CLOCK_MEDIUM|WS_CLOCK_FORCE_DIGITAL|
|
||||||
|
WS_CLOCK_WITH_DATE,4+66+6,4,0);
|
||||||
|
wsCreateClock(wMainWid,WS_CLOCK_MEDIUM|WS_CLOCK_FORCE_ANALOG|
|
||||||
|
WS_CLOCK_WITH_DATE,4+66+6+36+6,4,0);
|
||||||
|
wsCreateClock(wMainWid,WS_CLOCK_SMALL_DIGITAL|WS_CLOCK_WITH_DATE|
|
||||||
|
WS_CLOCK_WITH_SECONDS,104,66,0);
|
||||||
|
wInitialiseWindowTree(wMainWid);
|
||||||
|
MainEventLoop();
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
DEMO.PRJ ! This file
|
||||||
|
READ.ME ! About the \sibosdk\demo directory
|
||||||
|
BLDALL.BAT ! Build everything in this directory
|
||||||
|
!
|
||||||
|
! ==========================
|
||||||
|
! General Programming Manual
|
||||||
|
!
|
||||||
|
! Building An Application
|
||||||
|
HELLO.C ! A first example application (using CLIB)
|
||||||
|
HELLO.PR ! Jpi project file for the above
|
||||||
|
P_HELLO.C ! A PLIB version of Hello World
|
||||||
|
P_HELLO.PR ! Jpi project file for the above
|
||||||
|
!
|
||||||
|
! Housekeeping batch files and re-using project files
|
||||||
|
UNNAMED.PR ! General (single source file) project file for Plib
|
||||||
|
CC.BAT ! For Brief-style test compiles
|
||||||
|
MAKE.BAT ! Intelligent make batch file
|
||||||
|
VID.BAT ! Sets/senses JPIVID environment variable
|
||||||
|
CHECKVID.BAT ! Used in above batch files
|
||||||
|
!
|
||||||
|
! Fundamental Programming Guidelines
|
||||||
|
EVENTS.C ! First version of Events
|
||||||
|
SUBPROC.H ! Header file for SUBPROC
|
||||||
|
SUBPROC.C ! Program launched as a subprocess
|
||||||
|
EVENTS2.C ! Second version of Events
|
||||||
|
EVENTS3.C ! Third version of Events
|
||||||
|
EVENTS4.C ! Fourth version of Events
|
||||||
|
!
|
||||||
|
! ====================
|
||||||
|
! HC Programming Guide
|
||||||
|
!
|
||||||
|
! Writing Software for the HC: Example programs
|
||||||
|
W_HELLO.C ! A graphics version of Hello World
|
||||||
|
GAUGE.C ! Graphics and timers illustrated
|
||||||
|
LINED.C ! Line editor code and test code
|
||||||
|
LINED.H ! Line editor header file
|
||||||
|
!
|
||||||
|
! ==========================
|
||||||
|
! Series 3/3a Programming Guide
|
||||||
|
!
|
||||||
|
! Enhanced Sound Output
|
||||||
|
SOUND.C ! Using the SND: device driver on the Series 3a
|
||||||
|
!
|
||||||
|
! =============================
|
||||||
|
! Additional System Information
|
||||||
|
!
|
||||||
|
! Resource Files
|
||||||
|
READRSC.C ! Reading the contents of a resource file
|
||||||
|
!
|
||||||
|
! ==============
|
||||||
|
! PLIB Reference
|
||||||
|
!
|
||||||
|
! Files
|
||||||
|
P_DLIST.C ! Using p_dinfo to list devices
|
||||||
|
P_PRNDIR.C ! Using p_open(P_FDIR) to list a directory
|
||||||
|
P_COMP.C ! Binary file access (comparing two files)
|
||||||
|
P_SEARCH.C ! Text file access (p_read to search a text file)
|
||||||
|
!
|
||||||
|
! =======================
|
||||||
|
! Window Server Reference
|
||||||
|
!
|
||||||
|
! Introduction: Bitmaps
|
||||||
|
PCXSAVE.C ! Capturing the screen directly to a PCX file
|
||||||
|
SCAPT.C ! Screen capture program using MCLINK RUN
|
||||||
|
SCAPT.PR ! Jpi project file for the above
|
||||||
|
!
|
||||||
|
! Introduction: Text fonts
|
||||||
|
FONTS.C ! The program that generated the font pictures
|
||||||
|
!
|
||||||
|
! Introduction: System start-up: Replacing the shell on the HC
|
||||||
|
HCSHELL.C ! Sample shell/application
|
||||||
|
LKSHELL.C ! Minimal shell for remote debugging on the HC
|
||||||
|
LKSHELL.PR ! Defines small stack
|
||||||
|
!
|
||||||
|
! General window server functions: wsAlertW
|
||||||
|
ALERT.C ! Alert3 example of calling wsAlertW
|
||||||
|
!
|
||||||
|
! Windows: Clocks
|
||||||
|
CLOCK.C ! Clocks demonstration for the HC
|
||||||
|
!
|
||||||
|
! Graphics output: wDrawButton
|
||||||
|
BUTTON.C ! Intended use of wDrawButton
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
/* EVENTS.C */
|
||||||
|
|
||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <p_cons.h>
|
||||||
|
#include <epoc.h>
|
||||||
|
#include <wskeys.h>
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_D VOID *timH;
|
||||||
|
LOCAL_D WORD timstat;
|
||||||
|
LOCAL_D WORD counter;
|
||||||
|
LOCAL_D ULONG timint;
|
||||||
|
|
||||||
|
LOCAL_D VOID *conH;
|
||||||
|
LOCAL_D WORD keystat;
|
||||||
|
LOCAL_D P_CON_KBREC key;
|
||||||
|
|
||||||
|
#define MAX_COUNT 100
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueKey(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(conH,P_FREAD,&keystat,&key);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueTimer(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(timH,P_FRELATIVE,&timstat,&timint);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CancelTimer(VOID)
|
||||||
|
{
|
||||||
|
p_iow2(timH,P_FCANCEL);
|
||||||
|
p_waitstat(&timstat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Check(INT val,TEXT *msg)
|
||||||
|
{
|
||||||
|
TEXT buf[30];
|
||||||
|
|
||||||
|
if (!val)
|
||||||
|
return;
|
||||||
|
p_atos(&buf[0],"Failed to open %s",msg);
|
||||||
|
p_notifyerr(val,&buf[0],0,0,0);
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenTimer(VOID)
|
||||||
|
{
|
||||||
|
Check(p_open(&timH,"TIM:",-1),"timer");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenConsole(VOID)
|
||||||
|
{
|
||||||
|
P_RECT rect;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
Check(p_open(&conH,"CON:",-1),"console");
|
||||||
|
rect.tl.x=rect.tl.y=0;
|
||||||
|
rect.br.x=25;
|
||||||
|
rect.br.y=9;
|
||||||
|
func=P_SCR_WSET;
|
||||||
|
Check(p_iow4(conH,P_FSET,&func,&rect),"console");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetTimInt(INT new)
|
||||||
|
{
|
||||||
|
CancelTimer();
|
||||||
|
timint=new;
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len)
|
||||||
|
{
|
||||||
|
P_POINT pos;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
pos.x=x;
|
||||||
|
pos.y=y;
|
||||||
|
func=P_SCR_POSA;
|
||||||
|
p_iow4(conH,P_FSET,&func,&pos);
|
||||||
|
p_write(conH,pb,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplayCount(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[4];
|
||||||
|
|
||||||
|
p_atos(&buf[0],"%3d",counter);
|
||||||
|
Write(10,2,&buf[0],3);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawBorder(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[26];
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
p_bfil(&buf[0],26,'*');
|
||||||
|
Write(0,0,&buf[0],25);
|
||||||
|
for (i=1; i<8; i++)
|
||||||
|
{
|
||||||
|
Write(0,i,&buf[0],1);
|
||||||
|
Write(24,i,&buf[0],1);
|
||||||
|
}
|
||||||
|
Write(0,8,&buf[0],25);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
OpenConsole();
|
||||||
|
DrawBorder();
|
||||||
|
OpenTimer();
|
||||||
|
timint=10;
|
||||||
|
QueueTimer();
|
||||||
|
QueueKey();
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
p_iowait();
|
||||||
|
if (keystat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (key.keycode==W_KEY_ESCAPE)
|
||||||
|
p_exit(0);
|
||||||
|
if (key.keycode>='1' && key.keycode<='9')
|
||||||
|
SetTimInt(2*(key.keycode-'0'));
|
||||||
|
QueueKey();
|
||||||
|
}
|
||||||
|
else if (timstat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (counter++==MAX_COUNT)
|
||||||
|
counter=1;
|
||||||
|
DisplayCount();
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
/* EVENTS2.C */
|
||||||
|
|
||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <p_cons.h>
|
||||||
|
#include <epoc.h>
|
||||||
|
#include <wskeys.h>
|
||||||
|
#include "subproc.h"
|
||||||
|
|
||||||
|
|
||||||
|
GLREF_C TEXT *DatCommandPtr;
|
||||||
|
|
||||||
|
LOCAL_D VOID *timH;
|
||||||
|
LOCAL_D WORD timstat;
|
||||||
|
LOCAL_D WORD counter;
|
||||||
|
LOCAL_D ULONG timint;
|
||||||
|
|
||||||
|
LOCAL_D VOID *conH;
|
||||||
|
LOCAL_D WORD keystat;
|
||||||
|
LOCAL_D P_CON_KBREC key;
|
||||||
|
|
||||||
|
LOCAL_D WORD subexist;
|
||||||
|
LOCAL_D WORD substat;
|
||||||
|
LOCAL_D WORD answer;
|
||||||
|
|
||||||
|
#define MAX_COUNT 100
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueKey(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(conH,P_FREAD,&keystat,&key);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueTimer(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(timH,P_FRELATIVE,&timstat,&timint);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CancelTimer(VOID)
|
||||||
|
{
|
||||||
|
p_iow2(timH,P_FCANCEL);
|
||||||
|
p_waitstat(&timstat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Check(INT val,TEXT *msg)
|
||||||
|
{
|
||||||
|
TEXT buf[30];
|
||||||
|
|
||||||
|
if (!val)
|
||||||
|
return;
|
||||||
|
p_atos(&buf[0],"Failed to open %s",msg);
|
||||||
|
p_notifyerr(val,&buf[0],0,0,0);
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenTimer(VOID)
|
||||||
|
{
|
||||||
|
Check(p_open(&timH,"TIM:",-1),"timer");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenConsole(VOID)
|
||||||
|
{
|
||||||
|
P_RECT rect;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
Check(p_open(&conH,"CON:",-1),"console");
|
||||||
|
rect.tl.x=rect.tl.y=0;
|
||||||
|
rect.br.x=25;
|
||||||
|
rect.br.y=9;
|
||||||
|
func=P_SCR_WSET;
|
||||||
|
Check(p_iow4(conH,P_FSET,&func,&rect),"console");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetTimInt(INT new)
|
||||||
|
{
|
||||||
|
CancelTimer();
|
||||||
|
timint=new;
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len)
|
||||||
|
{
|
||||||
|
P_POINT pos;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
pos.x=x;
|
||||||
|
pos.y=y;
|
||||||
|
func=P_SCR_POSA;
|
||||||
|
p_iow4(conH,P_FSET,&func,&pos);
|
||||||
|
p_write(conH,pb,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplayCount(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[4];
|
||||||
|
|
||||||
|
p_atos(&buf[0],"%3d",counter);
|
||||||
|
Write(10,2,&buf[0],3);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawBorder(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[26];
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
p_bfil(&buf[0],26,'*');
|
||||||
|
Write(0,0,&buf[0],25);
|
||||||
|
for (i=1; i<8; i++)
|
||||||
|
{
|
||||||
|
Write(0,i,&buf[0],1);
|
||||||
|
Write(24,i,&buf[0],1);
|
||||||
|
}
|
||||||
|
Write(0,8,&buf[0],25);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Message(TEXT *pb)
|
||||||
|
{
|
||||||
|
TEXT buf[22];
|
||||||
|
INT len;
|
||||||
|
|
||||||
|
p_bfil(&buf[0],22,' ');
|
||||||
|
len=p_slen(pb);
|
||||||
|
p_bcpy(&buf[10-len/2],pb,len);
|
||||||
|
Write(2,6,&buf[0],21);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID LaunchSub(VOID)
|
||||||
|
{
|
||||||
|
HANDLE pid;
|
||||||
|
SUBPROC_CL cl;
|
||||||
|
TEXT subname[P_FNAMESIZE];
|
||||||
|
|
||||||
|
if (subexist)
|
||||||
|
{
|
||||||
|
p_sound(-5,320);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p_fparse("subproc.img",DatCommandPtr,&subname[0],0);
|
||||||
|
cl.pid=p_getpid();
|
||||||
|
cl.poff=(&answer);
|
||||||
|
cl.data=p_date();
|
||||||
|
if ((pid=p_execc(&subname[0],&cl,sizeof(cl)))<0)
|
||||||
|
{
|
||||||
|
p_notifyerr(pid,"Failed to launch subprocess",0,0,0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p_logona(pid,&substat);
|
||||||
|
subexist=TRUE;
|
||||||
|
Message("Subp launched");
|
||||||
|
p_presume(pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ReportSub(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[22];
|
||||||
|
|
||||||
|
subexist=FALSE;
|
||||||
|
if (substat)
|
||||||
|
Message("Subp abnormal exit");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_atos(&buf[0],"Subp slept %d ticks",answer);
|
||||||
|
Message(&buf[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
p_unmarka();
|
||||||
|
OpenConsole();
|
||||||
|
DrawBorder();
|
||||||
|
OpenTimer();
|
||||||
|
timint=10;
|
||||||
|
QueueTimer();
|
||||||
|
QueueKey();
|
||||||
|
LaunchSub();
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
p_iowait();
|
||||||
|
if (keystat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (key.keycode==W_KEY_ESCAPE)
|
||||||
|
p_exit(0);
|
||||||
|
if (key.keycode==W_KEY_RETURN)
|
||||||
|
LaunchSub();
|
||||||
|
else if (key.keycode>='1' && key.keycode<='9')
|
||||||
|
SetTimInt(2*(key.keycode-'0'));
|
||||||
|
QueueKey();
|
||||||
|
}
|
||||||
|
else if (timstat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (counter++==MAX_COUNT)
|
||||||
|
counter=1;
|
||||||
|
DisplayCount();
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
else if (substat!=E_FILE_PENDING)
|
||||||
|
ReportSub();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
/* EVENTS3.C */
|
||||||
|
|
||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <p_cons.h>
|
||||||
|
#include <epoc.h>
|
||||||
|
#include <wskeys.h>
|
||||||
|
#include "subproc.h"
|
||||||
|
|
||||||
|
|
||||||
|
GLREF_C TEXT *DatCommandPtr;
|
||||||
|
|
||||||
|
LOCAL_D VOID *timH;
|
||||||
|
LOCAL_D WORD timstat;
|
||||||
|
LOCAL_D WORD counter;
|
||||||
|
LOCAL_D ULONG timint;
|
||||||
|
|
||||||
|
LOCAL_D VOID *conH;
|
||||||
|
LOCAL_D WORD keystat;
|
||||||
|
LOCAL_D P_CON_KBREC key;
|
||||||
|
|
||||||
|
LOCAL_D WORD subexist;
|
||||||
|
LOCAL_D WORD substat;
|
||||||
|
LOCAL_D WORD answer;
|
||||||
|
|
||||||
|
LOCAL_D VOID *serH;
|
||||||
|
LOCAL_D WORD serstat;
|
||||||
|
LOCAL_D WORD serlen;
|
||||||
|
LOCAL_D TEXT serbuf[2];
|
||||||
|
LOCAL_D WORD serpos;
|
||||||
|
|
||||||
|
#define MAX_COUNT 100
|
||||||
|
#define MAX_SERPOS 11
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueKey(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(conH,P_FREAD,&keystat,&key);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueTimer(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(timH,P_FRELATIVE,&timstat,&timint);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CancelTimer(VOID)
|
||||||
|
{
|
||||||
|
p_iow2(timH,P_FCANCEL);
|
||||||
|
p_waitstat(&timstat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Check(INT val,TEXT *msg)
|
||||||
|
{
|
||||||
|
TEXT buf[30];
|
||||||
|
|
||||||
|
if (!val)
|
||||||
|
return;
|
||||||
|
p_atos(&buf[0],"Failed to open %s",msg);
|
||||||
|
p_notifyerr(val,&buf[0],0,0,0);
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenTimer(VOID)
|
||||||
|
{
|
||||||
|
Check(p_open(&timH,"TIM:",-1),"timer");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenConsole(VOID)
|
||||||
|
{
|
||||||
|
P_RECT rect;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
Check(p_open(&conH,"CON:",-1),"console");
|
||||||
|
rect.tl.x=rect.tl.y=0;
|
||||||
|
rect.br.x=25;
|
||||||
|
rect.br.y=9;
|
||||||
|
func=P_SCR_WSET;
|
||||||
|
Check(p_iow4(conH,P_FSET,&func,&rect),"console");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetTimInt(INT new)
|
||||||
|
{
|
||||||
|
CancelTimer();
|
||||||
|
timint=new;
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len)
|
||||||
|
{
|
||||||
|
P_POINT pos;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
pos.x=x;
|
||||||
|
pos.y=y;
|
||||||
|
func=P_SCR_POSA;
|
||||||
|
p_iow4(conH,P_FSET,&func,&pos);
|
||||||
|
p_write(conH,pb,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplayCount(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[4];
|
||||||
|
|
||||||
|
p_atos(&buf[0],"%3d",counter);
|
||||||
|
Write(10,2,&buf[0],3);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawBorder(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[26];
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
p_bfil(&buf[0],26,'*');
|
||||||
|
Write(0,0,&buf[0],25);
|
||||||
|
for (i=1; i<8; i++)
|
||||||
|
{
|
||||||
|
Write(0,i,&buf[0],1);
|
||||||
|
Write(24,i,&buf[0],1);
|
||||||
|
}
|
||||||
|
Write(0,8,&buf[0],25);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Message(TEXT *pb)
|
||||||
|
{
|
||||||
|
TEXT buf[22];
|
||||||
|
INT len;
|
||||||
|
|
||||||
|
p_bfil(&buf[0],22,' ');
|
||||||
|
len=p_slen(pb);
|
||||||
|
p_bcpy(&buf[10-len/2],pb,len);
|
||||||
|
Write(2,6,&buf[0],21);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID LaunchSub(VOID)
|
||||||
|
{
|
||||||
|
HANDLE pid;
|
||||||
|
SUBPROC_CL cl;
|
||||||
|
TEXT subname[P_FNAMESIZE];
|
||||||
|
|
||||||
|
if (subexist)
|
||||||
|
{
|
||||||
|
p_sound(-5,320);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p_fparse("subproc.img",DatCommandPtr,&subname[0],0);
|
||||||
|
cl.pid=p_getpid();
|
||||||
|
cl.poff=(&answer);
|
||||||
|
cl.data=p_date();
|
||||||
|
if ((pid=p_execc(&subname[0],&cl,sizeof(cl)))<0)
|
||||||
|
{
|
||||||
|
p_notifyerr(pid,"Failed to launch subprocess",0,0,0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p_logona(pid,&substat);
|
||||||
|
subexist=TRUE;
|
||||||
|
Message("Subp launched");
|
||||||
|
p_presume(pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ReportSub(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[22];
|
||||||
|
|
||||||
|
subexist=FALSE;
|
||||||
|
if (substat)
|
||||||
|
Message("Subp abnormal exit");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_atos(&buf[0],"Subp slept %d ticks",answer);
|
||||||
|
Message(&buf[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueSer()
|
||||||
|
{
|
||||||
|
if (!serH)
|
||||||
|
return;
|
||||||
|
serlen=1;
|
||||||
|
p_ioa5(serH,P_FREAD,&serstat,&serbuf[0],&serlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenSer()
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
ret=p_open(&serH,"TTY:B",-1);
|
||||||
|
if (ret<0)
|
||||||
|
ret=p_open(&serH,"TTY:A",-1);
|
||||||
|
if (ret<0)
|
||||||
|
{
|
||||||
|
p_notifyerr(ret,"Opening serial port",0,0,0);
|
||||||
|
serH=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplaySerChar(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[12];
|
||||||
|
|
||||||
|
if (!serlen || !p_isprint(serbuf[0]))
|
||||||
|
return;
|
||||||
|
if (serpos++==MAX_SERPOS)
|
||||||
|
{
|
||||||
|
serpos=1;
|
||||||
|
p_bfil(&buf[0],12,' ');
|
||||||
|
Write(7,4,&buf[0],11);
|
||||||
|
}
|
||||||
|
Write(6+serpos,4,&serbuf[0],1);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
p_unmarka();
|
||||||
|
OpenConsole();
|
||||||
|
DrawBorder();
|
||||||
|
OpenTimer();
|
||||||
|
timint=10;
|
||||||
|
QueueTimer();
|
||||||
|
QueueKey();
|
||||||
|
LaunchSub();
|
||||||
|
OpenSer();
|
||||||
|
QueueSer();
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
p_iowait();
|
||||||
|
if (keystat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (key.keycode==W_KEY_ESCAPE)
|
||||||
|
p_exit(0);
|
||||||
|
if (key.keycode==W_KEY_RETURN)
|
||||||
|
LaunchSub();
|
||||||
|
else if (key.keycode>='1' && key.keycode<='9')
|
||||||
|
SetTimInt(2*(key.keycode-'0'));
|
||||||
|
QueueKey();
|
||||||
|
}
|
||||||
|
else if (timstat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (counter++==MAX_COUNT)
|
||||||
|
counter=1;
|
||||||
|
DisplayCount();
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
else if (subexist && substat!=E_FILE_PENDING)
|
||||||
|
ReportSub();
|
||||||
|
else if (serH && serstat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
p_tickle();
|
||||||
|
DisplaySerChar();
|
||||||
|
QueueSer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
/* EVENTS4.C */
|
||||||
|
|
||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <p_cons.h>
|
||||||
|
#include <epoc.h>
|
||||||
|
#include <wskeys.h>
|
||||||
|
#include "subproc.h"
|
||||||
|
|
||||||
|
|
||||||
|
GLREF_C TEXT *DatCommandPtr;
|
||||||
|
|
||||||
|
LOCAL_D VOID *timH;
|
||||||
|
LOCAL_D WORD timstat;
|
||||||
|
LOCAL_D WORD counter;
|
||||||
|
LOCAL_D ULONG timint;
|
||||||
|
|
||||||
|
LOCAL_D VOID *conH;
|
||||||
|
LOCAL_D WORD keystat;
|
||||||
|
LOCAL_D P_CON_KBREC key;
|
||||||
|
|
||||||
|
LOCAL_D WORD subexist;
|
||||||
|
LOCAL_D WORD substat;
|
||||||
|
LOCAL_D WORD answer;
|
||||||
|
|
||||||
|
LOCAL_D VOID *serH;
|
||||||
|
LOCAL_D WORD serstat;
|
||||||
|
LOCAL_D WORD serlen;
|
||||||
|
LOCAL_D TEXT serbuf[2];
|
||||||
|
LOCAL_D WORD serpos;
|
||||||
|
|
||||||
|
LOCAL_D WORD thinkcount;
|
||||||
|
LOCAL_D TEXT thinkchar[4]={'-','\\','|','/'};
|
||||||
|
|
||||||
|
#define MAX_COUNT 100
|
||||||
|
#define MAX_SERPOS 11
|
||||||
|
#define MAX_THINK 20
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueKey(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(conH,P_FREAD,&keystat,&key);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueTimer(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(timH,P_FRELATIVE,&timstat,&timint);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CancelTimer(VOID)
|
||||||
|
{
|
||||||
|
p_iow2(timH,P_FCANCEL);
|
||||||
|
p_waitstat(&timstat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Check(INT val,TEXT *msg)
|
||||||
|
{
|
||||||
|
TEXT buf[30];
|
||||||
|
|
||||||
|
if (!val)
|
||||||
|
return;
|
||||||
|
p_atos(&buf[0],"Failed to open %s",msg);
|
||||||
|
p_notifyerr(val,&buf[0],0,0,0);
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenTimer(VOID)
|
||||||
|
{
|
||||||
|
Check(p_open(&timH,"TIM:",-1),"timer");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenConsole(VOID)
|
||||||
|
{
|
||||||
|
P_RECT rect;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
Check(p_open(&conH,"CON:",-1),"console");
|
||||||
|
rect.tl.x=rect.tl.y=0;
|
||||||
|
rect.br.x=25;
|
||||||
|
rect.br.y=9;
|
||||||
|
func=P_SCR_WSET;
|
||||||
|
Check(p_iow4(conH,P_FSET,&func,&rect),"console");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetTimInt(INT new)
|
||||||
|
{
|
||||||
|
CancelTimer();
|
||||||
|
timint=new;
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len)
|
||||||
|
{
|
||||||
|
P_POINT pos;
|
||||||
|
WORD func;
|
||||||
|
|
||||||
|
pos.x=x;
|
||||||
|
pos.y=y;
|
||||||
|
func=P_SCR_POSA;
|
||||||
|
p_iow4(conH,P_FSET,&func,&pos);
|
||||||
|
p_write(conH,pb,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplayCount(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[4];
|
||||||
|
|
||||||
|
p_atos(&buf[0],"%3d",counter);
|
||||||
|
Write(10,2,&buf[0],3);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawBorder(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[26];
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
p_bfil(&buf[0],26,'*');
|
||||||
|
Write(0,0,&buf[0],25);
|
||||||
|
for (i=1; i<8; i++)
|
||||||
|
{
|
||||||
|
Write(0,i,&buf[0],1);
|
||||||
|
Write(24,i,&buf[0],1);
|
||||||
|
}
|
||||||
|
Write(0,8,&buf[0],25);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Message(TEXT *pb)
|
||||||
|
{
|
||||||
|
TEXT buf[22];
|
||||||
|
INT len;
|
||||||
|
|
||||||
|
p_bfil(&buf[0],22,' ');
|
||||||
|
len=p_slen(pb);
|
||||||
|
p_bcpy(&buf[10-len/2],pb,len);
|
||||||
|
Write(2,6,&buf[0],21);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID LaunchSub(VOID)
|
||||||
|
{
|
||||||
|
HANDLE pid;
|
||||||
|
SUBPROC_CL cl;
|
||||||
|
TEXT subname[P_FNAMESIZE];
|
||||||
|
|
||||||
|
if (subexist)
|
||||||
|
{
|
||||||
|
p_sound(-5,320);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p_fparse("subproc.img",DatCommandPtr,&subname[0],0);
|
||||||
|
cl.pid=p_getpid();
|
||||||
|
cl.poff=(&answer);
|
||||||
|
cl.data=p_date();
|
||||||
|
if ((pid=p_execc(&subname[0],&cl,sizeof(cl)))<0)
|
||||||
|
{
|
||||||
|
p_notifyerr(pid,"Failed to launch subprocess",0,0,0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p_logona(pid,&substat);
|
||||||
|
subexist=TRUE;
|
||||||
|
Message("Subp launched");
|
||||||
|
p_presume(pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ReportSub(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[22];
|
||||||
|
|
||||||
|
subexist=FALSE;
|
||||||
|
if (substat)
|
||||||
|
Message("Subp abnormal exit");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_atos(&buf[0],"Subp slept %d ticks",answer);
|
||||||
|
Message(&buf[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueSer()
|
||||||
|
{
|
||||||
|
if (!serH)
|
||||||
|
return;
|
||||||
|
serlen=1;
|
||||||
|
p_ioa5(serH,P_FREAD,&serstat,&serbuf[0],&serlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenSer()
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
ret=p_open(&serH,"TTY:B",-1);
|
||||||
|
if (ret<0)
|
||||||
|
ret=p_open(&serH,"TTY:A",-1);
|
||||||
|
if (ret<0)
|
||||||
|
{
|
||||||
|
p_notifyerr(ret,"Opening serial port",0,0,0);
|
||||||
|
serH=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplaySerChar(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[12];
|
||||||
|
|
||||||
|
if (!serlen || !p_isprint(serbuf[0]))
|
||||||
|
return;
|
||||||
|
if (serpos++==MAX_SERPOS)
|
||||||
|
{
|
||||||
|
serpos=1;
|
||||||
|
p_bfil(&buf[0],12,' ');
|
||||||
|
Write(7,4,&buf[0],11);
|
||||||
|
}
|
||||||
|
Write(6+serpos,4,&serbuf[0],1);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Think(VOID)
|
||||||
|
{
|
||||||
|
TEXT *pb;
|
||||||
|
|
||||||
|
if (thinkcount++==MAX_THINK)
|
||||||
|
thinkcount=0;
|
||||||
|
pb=(&thinkchar[thinkcount/5]);
|
||||||
|
Write(0,4,pb,1);
|
||||||
|
Write(25,4,pb,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueThink(VOID)
|
||||||
|
{
|
||||||
|
p_iosignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
p_unmarka();
|
||||||
|
OpenConsole();
|
||||||
|
DrawBorder();
|
||||||
|
OpenTimer();
|
||||||
|
timint=10;
|
||||||
|
QueueTimer();
|
||||||
|
QueueKey();
|
||||||
|
LaunchSub();
|
||||||
|
OpenSer();
|
||||||
|
QueueSer();
|
||||||
|
QueueThink();
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
p_iowait();
|
||||||
|
if (keystat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (key.keycode==W_KEY_ESCAPE)
|
||||||
|
p_exit(0);
|
||||||
|
if (key.keycode==W_KEY_RETURN)
|
||||||
|
LaunchSub();
|
||||||
|
else if (key.keycode>='1' && key.keycode<='9')
|
||||||
|
SetTimInt(2*(key.keycode-'0'));
|
||||||
|
QueueKey();
|
||||||
|
}
|
||||||
|
else if (timstat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (counter++==MAX_COUNT)
|
||||||
|
counter=1;
|
||||||
|
DisplayCount();
|
||||||
|
QueueTimer();
|
||||||
|
}
|
||||||
|
else if (subexist && substat!=E_FILE_PENDING)
|
||||||
|
ReportSub();
|
||||||
|
else if (serH && serstat!=E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
p_tickle();
|
||||||
|
DisplaySerChar();
|
||||||
|
QueueSer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Think();
|
||||||
|
QueueThink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
FONTS.C - Display fonts
|
||||||
|
|
||||||
|
This program was used to produce the font displays in the Window Server
|
||||||
|
Reference manual.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
#define MINX 2
|
||||||
|
#define MINY 2
|
||||||
|
#define WIDTH 160
|
||||||
|
|
||||||
|
LOCAL_D INT FontID;
|
||||||
|
LOCAL_D INT CurrentY,CurrentX;
|
||||||
|
LOCAL_D G_FONT_INFO FontInfo;
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawSideLines(INT y1,INT dy)
|
||||||
|
{
|
||||||
|
gDrawLine(0,y1,0,y1+dy+1);
|
||||||
|
gDrawLine(WIDTH-1,y1,WIDTH-1,y1+dy+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID PrintHexNumber(INT x,INT y,UINT n)
|
||||||
|
{
|
||||||
|
TEXT buf[5];
|
||||||
|
|
||||||
|
gPrintText(x,y,&buf[0],p_gtob(&buf[0],n,16));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CDECL PrintLine(INT style,INT final,TEXT *fmt,...)
|
||||||
|
{
|
||||||
|
INT height,ascent,len;
|
||||||
|
P_RECT box;
|
||||||
|
G_GC gc;
|
||||||
|
TEXT b[80];
|
||||||
|
|
||||||
|
height=FontInfo.height;
|
||||||
|
ascent=FontInfo.ascent;
|
||||||
|
if (style&G_STY_DOUBLE)
|
||||||
|
{
|
||||||
|
height<<=1;
|
||||||
|
ascent<<=1;
|
||||||
|
}
|
||||||
|
if (CurrentX==MINX)
|
||||||
|
DrawSideLines(CurrentY,height+1);
|
||||||
|
gc.font=FontID;
|
||||||
|
gc.style=style;
|
||||||
|
gSetGC(0,G_GC_MASK_FONT|G_GC_MASK_STYLE,&gc);
|
||||||
|
len=p_atob(&b[0],fmt,&fmt+1);
|
||||||
|
box.tl.x=CurrentX;
|
||||||
|
box.br.x=WIDTH-MINX;
|
||||||
|
box.tl.y=CurrentY;
|
||||||
|
box.br.y=box.tl.y+height;
|
||||||
|
if (box.br.x>box.tl.x)
|
||||||
|
gPrintBoxText(&box,ascent,G_TEXT_ALIGN_LEFT,0,&b[0],len);
|
||||||
|
if (final)
|
||||||
|
{
|
||||||
|
CurrentY+=height+1;
|
||||||
|
CurrentX=MINX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CurrentX+=gTextWidth(FontID,style,&b[0],len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SaveFontCodes(VOID)
|
||||||
|
{
|
||||||
|
INT x,y,dx,dy,xo,yo,yy;
|
||||||
|
INT bitmap;
|
||||||
|
W_OPEN_BIT_SEG bit;
|
||||||
|
G_GC gc;
|
||||||
|
P_RECT rect;
|
||||||
|
TEXT name[32];
|
||||||
|
|
||||||
|
dx=18;
|
||||||
|
dy=FontInfo.height+1;
|
||||||
|
xo=FontInfo.numeric_width+(MINX+5);
|
||||||
|
yo=FontInfo.ascent+(MINY+3);
|
||||||
|
bit.size.x=dx*16+xo+MINX;
|
||||||
|
bit.size.y=dy*16+yo+MINY;
|
||||||
|
bitmap=gCreateBit(0,&bit);
|
||||||
|
gCreateTempGC0(bitmap);
|
||||||
|
gc.font=FontID;
|
||||||
|
gSetGC(0,G_GC_MASK_FONT,&gc);
|
||||||
|
rect.tl.x=rect.tl.y=0;
|
||||||
|
rect.br=bit.size;
|
||||||
|
gClrRect(&rect,G_TRMODE_CLR);
|
||||||
|
gDrawBox(&rect);
|
||||||
|
rect.tl.x=xo-2;
|
||||||
|
rect.tl.y=yo-2;
|
||||||
|
gDrawBox(&rect);
|
||||||
|
for (x=0;x<16;x++)
|
||||||
|
PrintHexNumber(x*dx+xo,FontInfo.ascent+1,x);
|
||||||
|
name[0]=0;
|
||||||
|
for (y=0;y<16;y++)
|
||||||
|
{
|
||||||
|
PrintHexNumber(3,yy=y*dy+yo+FontInfo.ascent,y);
|
||||||
|
for (x=0;x<16;x++)
|
||||||
|
{
|
||||||
|
gPrintText(x*dx+xo,yy,&name[0],1);
|
||||||
|
name[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gFreeTempGC();
|
||||||
|
p_atos(&name[0],"rem::fcode%d.pic",FontID-WS_FONT_BASE);
|
||||||
|
gSaveBit(&name[0],bitmap);
|
||||||
|
wFree(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawFontStyles(VOID)
|
||||||
|
{
|
||||||
|
P_RECT rect;
|
||||||
|
|
||||||
|
CurrentY=MINY;
|
||||||
|
CurrentX=MINX;
|
||||||
|
rect.tl.x=rect.tl.y=0;
|
||||||
|
rect.br.x=WIDTH;
|
||||||
|
rect.br.y=1000;
|
||||||
|
gClrRect(&rect,G_TRMODE_CLR);
|
||||||
|
gDrawLine(0,0,WIDTH,0);
|
||||||
|
DrawSideLines(0,MINY);
|
||||||
|
PrintLine(G_STY_NORMAL,FALSE,"Normal text (%d) ",FontInfo.height);
|
||||||
|
PrintLine(G_STY_BOLD,TRUE,"Bold text");
|
||||||
|
PrintLine(G_STY_ITALIC,FALSE,"Italic text ");
|
||||||
|
PrintLine(G_STY_MONO,TRUE,"Mono text");
|
||||||
|
PrintLine(G_STY_DOUBLE,FALSE,"Double height ");
|
||||||
|
PrintLine(G_STY_DOUBLE|G_STY_BOLD,TRUE,"Double bold");
|
||||||
|
gDrawLine(0,CurrentY,WIDTH,CurrentY);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SaveFontStyles(VOID)
|
||||||
|
{
|
||||||
|
INT bitmap;
|
||||||
|
W_OPEN_BIT_SEG bit;
|
||||||
|
TEXT name[32];
|
||||||
|
|
||||||
|
bit.size.x=WIDTH;
|
||||||
|
bit.size.y=CurrentY+1;
|
||||||
|
bitmap=gCreateBit(0,&bit);
|
||||||
|
gCreateTempGC0(bitmap);
|
||||||
|
DrawFontStyles();
|
||||||
|
gFreeTempGC();
|
||||||
|
p_atos(&name[0],"rem::font%d.pic",FontID-WS_FONT_BASE);
|
||||||
|
gSaveBit(&name[0],bitmap);
|
||||||
|
wFree(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetFont(INT fid)
|
||||||
|
{
|
||||||
|
gFontInfo(FontID=fid,0,&FontInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID HandleKeyPress(INT code)
|
||||||
|
{
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
if (code=='\r')
|
||||||
|
p_exit(0);
|
||||||
|
if ('0'<=code && code<'6')
|
||||||
|
{
|
||||||
|
SetFont(code-'0'+WS_FONT_BASE);
|
||||||
|
DrawFontStyles();
|
||||||
|
}
|
||||||
|
if (code=='s')
|
||||||
|
{
|
||||||
|
wSetBusyMsg("Saving",W_CORNER_TOP_LEFT);
|
||||||
|
SaveFontStyles();
|
||||||
|
wCancelBusyMsg();
|
||||||
|
wInfoMsg("Styles bitmap saved");
|
||||||
|
}
|
||||||
|
if (code=='a')
|
||||||
|
{
|
||||||
|
wSetBusyMsg("Saving",W_CORNER_TOP_LEFT);
|
||||||
|
for (i=0;i<6;i++)
|
||||||
|
{
|
||||||
|
SetFont(i+WS_FONT_BASE);
|
||||||
|
DrawFontStyles();
|
||||||
|
SaveFontStyles();
|
||||||
|
}
|
||||||
|
wCancelBusyMsg();
|
||||||
|
wInfoMsg("Bitmaps saved");
|
||||||
|
}
|
||||||
|
if (code=='c')
|
||||||
|
{
|
||||||
|
wSetBusyMsg("Saving",W_CORNER_TOP_LEFT);
|
||||||
|
SaveFontCodes();
|
||||||
|
wCancelBusyMsg();
|
||||||
|
wInfoMsg("Codes bitmap saved");
|
||||||
|
}
|
||||||
|
if (code=='z')
|
||||||
|
{
|
||||||
|
wSetBusyMsg("Saving",W_CORNER_TOP_LEFT);
|
||||||
|
for (i=0;i<6;i++)
|
||||||
|
{
|
||||||
|
SetFont(i+WS_FONT_BASE);
|
||||||
|
SaveFontCodes();
|
||||||
|
}
|
||||||
|
wCancelBusyMsg();
|
||||||
|
wInfoMsg("Bitmaps saved");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
WS_EV event;
|
||||||
|
|
||||||
|
wStartup();
|
||||||
|
SetFont(WS_FONT_BASE);
|
||||||
|
DrawFontStyles();
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wGetEventWait(&event);
|
||||||
|
if (event.type==WM_KEY)
|
||||||
|
HandleKeyPress(event.p.key.keycode);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
LOCAL_D VOID *timH;
|
||||||
|
LOCAL_D WORD timstat;
|
||||||
|
LOCAL_D WORD counter;
|
||||||
|
LOCAL_D ULONG timint;
|
||||||
|
|
||||||
|
#define NUM_STEPS 9
|
||||||
|
#define STEP_WIDTH 16
|
||||||
|
#define BAR_LEFT 8
|
||||||
|
#define BAR_WIDTH 144
|
||||||
|
|
||||||
|
LOCAL_C VOID GetBarChartRect(P_RECT *pbox)
|
||||||
|
{
|
||||||
|
pbox->tl.x=BAR_LEFT;
|
||||||
|
pbox->br.x=BAR_LEFT+BAR_WIDTH;
|
||||||
|
pbox->br.y=80-4-1;
|
||||||
|
pbox->tl.y=80-4-1-6;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID QueueTimer(VOID)
|
||||||
|
{
|
||||||
|
p_ioa4(timH,P_FRELATIVE,&timstat,&timint);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CancelTimer(VOID)
|
||||||
|
{
|
||||||
|
p_iow2(timH,P_FCANCEL);
|
||||||
|
p_waitstat(&timstat);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CentrePrint(INT y1,INT y2,INT ascent,TEXT *pb)
|
||||||
|
{
|
||||||
|
P_RECT box;
|
||||||
|
|
||||||
|
box.tl.x=4;
|
||||||
|
box.br.x=160-4;
|
||||||
|
box.tl.y=y1;
|
||||||
|
box.br.y=y2;
|
||||||
|
gPrintBoxText(&box,ascent,G_TEXT_ALIGN_CENTRE,0,pb,p_slen(pb));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetFont(INT font)
|
||||||
|
{
|
||||||
|
G_GC gc;
|
||||||
|
|
||||||
|
gc.font=font;
|
||||||
|
gSetGC(0,G_GC_MASK_FONT,&gc);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID SetStyle(INT style)
|
||||||
|
{
|
||||||
|
G_GC gc;
|
||||||
|
|
||||||
|
gc.style=style;
|
||||||
|
gSetGC(0,G_GC_MASK_STYLE,&gc);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID TellCounter(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[10];
|
||||||
|
|
||||||
|
p_atos(&buf[0],"%d",counter);
|
||||||
|
SetStyle(G_STY_DOUBLE|G_STY_BOLD);
|
||||||
|
CentrePrint(46,64,16,&buf[0]);
|
||||||
|
SetStyle(G_STY_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawBar(VOID)
|
||||||
|
{
|
||||||
|
P_RECT box;
|
||||||
|
|
||||||
|
GetBarChartRect(&box);
|
||||||
|
if (!counter)
|
||||||
|
gClrRect(&box,G_TRMODE_CLR);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
box.br.x=BAR_LEFT+counter*STEP_WIDTH;
|
||||||
|
gFillPattern(&box,WS_BITMAP_GREY,G_TRMODE_REPL);
|
||||||
|
}
|
||||||
|
TellCounter();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID TellTimint(VOID)
|
||||||
|
{
|
||||||
|
TEXT buf[30];
|
||||||
|
|
||||||
|
p_atos(&buf[0],"Ticking every %d secs/10",(INT)timint);
|
||||||
|
CentrePrint(4,12,7,&buf[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
TEXT *msg;
|
||||||
|
WORD x;
|
||||||
|
WORD y;
|
||||||
|
} CHOICE;
|
||||||
|
|
||||||
|
LOCAL_D CHOICE ch[4]=
|
||||||
|
{
|
||||||
|
"(F) Faster",12,20,
|
||||||
|
"(S) Slower",12,30,
|
||||||
|
"(Z) Zero",88,20,
|
||||||
|
"(X) Exit",88,30
|
||||||
|
};
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplayChoice(INT i)
|
||||||
|
{
|
||||||
|
P_RECT box;
|
||||||
|
TEXT *pb;
|
||||||
|
|
||||||
|
box.tl.x=ch[i].x;
|
||||||
|
box.tl.y=ch[i].y;
|
||||||
|
box.br.x=box.tl.x+65;
|
||||||
|
box.br.y=box.tl.y+8;
|
||||||
|
pb=ch[i].msg;
|
||||||
|
gPrintBoxText(&box,7,G_TEXT_ALIGN_LEFT,0,pb,p_slen(pb));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplayChoices(VOID)
|
||||||
|
{
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
for (i=0; i<4; i++)
|
||||||
|
DisplayChoice(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define S3_FONT WS_FONT_BASE+4
|
||||||
|
|
||||||
|
LOCAL_C VOID Flash(INT i)
|
||||||
|
{
|
||||||
|
P_EXTENT ext;
|
||||||
|
|
||||||
|
ext.tl.x=ch[i].x-1;
|
||||||
|
ext.tl.y=ch[i].y-1;
|
||||||
|
ext.width=gTextWidth(S3_FONT,G_STY_NORMAL,ch[i].msg,3)+1;
|
||||||
|
ext.height=9;
|
||||||
|
gInvObloid(&ext);
|
||||||
|
wFlush();
|
||||||
|
p_sleep(2);
|
||||||
|
gInvObloid(&ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
WS_EV event;
|
||||||
|
P_RECT box;
|
||||||
|
WORD wactive;
|
||||||
|
|
||||||
|
wStartup();
|
||||||
|
gBorder(W_BORD_CORNER_4);
|
||||||
|
GetBarChartRect(&box);
|
||||||
|
p_insrec(&box,-1,-1);
|
||||||
|
gBorderRect(&box,W_BORD_CORNER_1);
|
||||||
|
SetFont(S3_FONT);
|
||||||
|
DisplayChoices();
|
||||||
|
p_open(&timH,"TIM:",-1);
|
||||||
|
timint=10;
|
||||||
|
TellTimint();
|
||||||
|
QueueTimer();
|
||||||
|
wactive=FALSE;
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
if (wactive)
|
||||||
|
wFlush();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wGetEvent(&event);
|
||||||
|
wactive=TRUE;
|
||||||
|
}
|
||||||
|
p_iowait();
|
||||||
|
if (event.type==E_FILE_PENDING)
|
||||||
|
{
|
||||||
|
if (counter++==NUM_STEPS)
|
||||||
|
counter=0;
|
||||||
|
DrawBar();
|
||||||
|
QueueTimer();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
wactive=FALSE;
|
||||||
|
if (event.type==WM_KEY)
|
||||||
|
{
|
||||||
|
switch (event.p.key.keycode)
|
||||||
|
{
|
||||||
|
case 'x':
|
||||||
|
Flash(3);
|
||||||
|
p_exit(0);
|
||||||
|
case 'z':
|
||||||
|
Flash(2);
|
||||||
|
CancelTimer();
|
||||||
|
counter=0;
|
||||||
|
DrawBar();
|
||||||
|
QueueTimer();
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
Flash(0);
|
||||||
|
if (timint!=1)
|
||||||
|
{
|
||||||
|
timint--;
|
||||||
|
TellTimint();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
Flash(1);
|
||||||
|
timint++;
|
||||||
|
TellTimint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
HCSHELL.C - Sample shell for the HC
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
GLREF_D UINT wMainGc;
|
||||||
|
GLREF_D WSERV_SPEC wSpec;
|
||||||
|
|
||||||
|
LOCAL_D INT FontHeight;
|
||||||
|
LOCAL_D INT FontAscent;
|
||||||
|
|
||||||
|
LOCAL_C VOID SetFontHeight(VOID)
|
||||||
|
{
|
||||||
|
G_FONT_INFO info;
|
||||||
|
|
||||||
|
gFontInfo(WS_FONT_SYSTEM,0,&info);
|
||||||
|
FontHeight=info.height;
|
||||||
|
FontAscent=info.ascent;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CDECL PrintLine(INT line,INT align,TEXT *fmt,...)
|
||||||
|
{
|
||||||
|
INT len;
|
||||||
|
P_RECT box;
|
||||||
|
TEXT b[80];
|
||||||
|
|
||||||
|
box.tl.x=4;
|
||||||
|
box.br.x=wSpec.conn.info.pixels.x-4;
|
||||||
|
box.tl.y=FontHeight*line+4;
|
||||||
|
box.br.y=box.tl.y+FontHeight;
|
||||||
|
len=p_atob(&b[0],fmt,&fmt+1);
|
||||||
|
gPrintBoxText(&box,FontAscent,align,0,&b[0],len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID HandleKeyPress(WMSG_KEY *pk)
|
||||||
|
{
|
||||||
|
PrintLine(2,G_TEXT_ALIGN_CENTRE,"code:%02x mod:%02x count:%02x",
|
||||||
|
pk->keycode,pk->modifiers,pk->count);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID MainEventLoop(VOID)
|
||||||
|
{
|
||||||
|
WS_EV event;
|
||||||
|
|
||||||
|
SetFontHeight();
|
||||||
|
gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON);
|
||||||
|
PrintLine(0,G_TEXT_ALIGN_LEFT,"Free memory: %dKbytes",p_sgfree()>>6);
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wGetEventWait(&event);
|
||||||
|
if (event.type==WM_KEY)
|
||||||
|
HandleKeyPress(&event.p.key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
INT NotifierPid;
|
||||||
|
|
||||||
|
wStartup();
|
||||||
|
wSystem(WSERV_FLAG_NO_NOTIFIER_REBOOT,0xffff);
|
||||||
|
if ((NotifierPid=p_pidfind("SYS$NTFY.*"))>0)
|
||||||
|
p_pterminate(NotifierPid,0);
|
||||||
|
wSystem(WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW,
|
||||||
|
WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW);
|
||||||
|
MainEventLoop();
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
HELLO.C
|
||||||
|
|
||||||
|
CLIB Hello World application
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(VOID)
|
||||||
|
{
|
||||||
|
printf("Hello World");
|
||||||
|
getchar();
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#system epoc img
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#compile hello
|
||||||
|
#link hello
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,396 @@
|
|||||||
|
#include <p_std.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
#include "lined.h"
|
||||||
|
|
||||||
|
|
||||||
|
GLREF_D UINT wMainWid;
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_C INT CreateGC(LINED *ed)
|
||||||
|
{
|
||||||
|
G_GC gc;
|
||||||
|
|
||||||
|
if (ed->gc)
|
||||||
|
return(FALSE);
|
||||||
|
gc.font=ed->i.font;
|
||||||
|
gc.style=ed->i.style;
|
||||||
|
gCreateTempGC(ed->i.winid,G_GC_MASK_FONT|G_GC_MASK_STYLE,&gc);
|
||||||
|
ed->gc=TRUE;
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID FreeGC(LINED *ed,INT gc)
|
||||||
|
{
|
||||||
|
if (!gc)
|
||||||
|
return;
|
||||||
|
ed->gc=FALSE;
|
||||||
|
gFreeTempGC();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT WidthTo(LINED *ed,INT blen)
|
||||||
|
{
|
||||||
|
return(gTextWidth(ed->i.font,ed->i.style,ed->pb,blen));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID GetBox(LINED *ed,P_RECT *pbox)
|
||||||
|
{
|
||||||
|
pbox->tl.x=ed->i.xoff;
|
||||||
|
pbox->tl.y=ed->i.yoff;
|
||||||
|
pbox->br.x=pbox->tl.x+ed->i.width;
|
||||||
|
pbox->br.y=pbox->tl.y+ed->i.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawCursor(LINED *ed)
|
||||||
|
{
|
||||||
|
W_CURSOR flash;
|
||||||
|
|
||||||
|
flash.pos.x=ed->i.xoff+ed->marg+WidthTo(ed,ed->cur);
|
||||||
|
flash.pos.y=ed->i.yoff+ed->i.asc;
|
||||||
|
flash.height=ed->i.height;
|
||||||
|
flash.ascent=ed->i.asc;
|
||||||
|
flash.width=ed->cwidth;
|
||||||
|
flash.flags=0;
|
||||||
|
wTextCursor(ed->i.winid,&flash);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ToggleHighlight(LINED *ed)
|
||||||
|
{
|
||||||
|
P_RECT box;
|
||||||
|
INT gc;
|
||||||
|
|
||||||
|
if (ed->select)
|
||||||
|
{
|
||||||
|
gc=CreateGC(ed);
|
||||||
|
GetBox(ed,&box);
|
||||||
|
box.br.x=box.tl.x+ed->marg+WidthTo(ed,ed->blen);
|
||||||
|
gClrRect(&box,G_TRMODE_INV);
|
||||||
|
FreeGC(ed,gc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DrawAll(LINED *ed)
|
||||||
|
{
|
||||||
|
P_RECT box;
|
||||||
|
INT gc;
|
||||||
|
|
||||||
|
GetBox(ed,&box);
|
||||||
|
gc=CreateGC(ed);
|
||||||
|
gPrintBoxText(&box,ed->i.asc,G_TEXT_ALIGN_LEFT,ed->marg,ed->pb,ed->blen);
|
||||||
|
if (ed->emph)
|
||||||
|
{
|
||||||
|
DrawCursor(ed);
|
||||||
|
ToggleHighlight(ed);
|
||||||
|
}
|
||||||
|
FreeGC(ed,gc);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID le_destroy(LINED *ed)
|
||||||
|
{
|
||||||
|
p_free(ed->pb);
|
||||||
|
p_free(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C LINED *le_init(IN_LINED *pin)
|
||||||
|
{
|
||||||
|
LINED *ed;
|
||||||
|
|
||||||
|
ed=p_alloc(sizeof(LINED));
|
||||||
|
if (!ed)
|
||||||
|
return(NULL);
|
||||||
|
p_bfil(ed,sizeof(LINED),0);
|
||||||
|
ed->cwidth=2;
|
||||||
|
ed->pb=p_alloc(pin->maxchars+1);
|
||||||
|
if (!ed->pb)
|
||||||
|
{
|
||||||
|
p_free(ed);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
ed->i=(*pin);
|
||||||
|
ed->lmarg=ed->i.width/4;
|
||||||
|
return(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ScrollForCursor(LINED *ed,INT draw)
|
||||||
|
{
|
||||||
|
INT oldmarg;
|
||||||
|
INT curx;
|
||||||
|
INT exx;
|
||||||
|
INT exl;
|
||||||
|
INT exr;
|
||||||
|
|
||||||
|
oldmarg=ed->marg;
|
||||||
|
curx=WidthTo(ed,ed->cur);
|
||||||
|
exx=curx+ed->marg;
|
||||||
|
exl=exx-ed->lmarg;
|
||||||
|
exr=exx+ed->cwidth-ed->i.width;
|
||||||
|
if (exl<0 && ed->marg)
|
||||||
|
{
|
||||||
|
ed->marg-=exl-ed->scrollx;
|
||||||
|
if (ed->marg>0)
|
||||||
|
ed->marg=0;
|
||||||
|
}
|
||||||
|
else if (exr>0)
|
||||||
|
ed->marg-=exr+ed->scrollx;
|
||||||
|
if (ed->marg!=oldmarg && draw)
|
||||||
|
DrawAll(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID le_set_text(LINED *ed,INT blen,TEXT *pb)
|
||||||
|
{
|
||||||
|
*(p_bcpy(ed->pb,pb,blen))=0;
|
||||||
|
ed->blen=blen;
|
||||||
|
ed->marg=0;
|
||||||
|
ed->select=FALSE;
|
||||||
|
ed->cur=0;
|
||||||
|
if (ed->i.autoselect && blen)
|
||||||
|
{
|
||||||
|
ed->cur=blen;
|
||||||
|
ed->select=TRUE;
|
||||||
|
ScrollForCursor(ed,FALSE);
|
||||||
|
}
|
||||||
|
if (ed->visible)
|
||||||
|
DrawAll(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DelSelRange(LINED *ed)
|
||||||
|
{
|
||||||
|
ed->select=FALSE;
|
||||||
|
ed->cur=0;
|
||||||
|
ed->marg=0;
|
||||||
|
ed->blen=0;
|
||||||
|
*ed->pb=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DoDelete(LINED *ed,INT modifier)
|
||||||
|
{
|
||||||
|
INT start;
|
||||||
|
INT finish;
|
||||||
|
|
||||||
|
if (ed->select)
|
||||||
|
DelSelRange(ed);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (modifier&W_SHIFT_MODIFIER)
|
||||||
|
{
|
||||||
|
if (ed->cur==ed->blen)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!ed->cur)
|
||||||
|
return;
|
||||||
|
start=finish=ed->cur;
|
||||||
|
switch (modifier)
|
||||||
|
{
|
||||||
|
case W_SHIFT_MODIFIER:
|
||||||
|
finish++;
|
||||||
|
break;
|
||||||
|
case W_PSION_MODIFIER:
|
||||||
|
finish=ed->blen;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
start--;
|
||||||
|
}
|
||||||
|
p_bcpy(ed->pb+start,ed->pb+finish,ed->blen+1-finish);
|
||||||
|
ed->blen-=finish-start;
|
||||||
|
ed->cur=start;
|
||||||
|
ScrollForCursor(ed,FALSE);
|
||||||
|
}
|
||||||
|
DrawAll(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID LoseHighlight(LINED *ed)
|
||||||
|
{
|
||||||
|
ToggleHighlight(ed);
|
||||||
|
ed->select=FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID DisplayCursor(LINED *ed)
|
||||||
|
{
|
||||||
|
ScrollForCursor(ed,TRUE);
|
||||||
|
DrawCursor(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT le_key(LINED *ed,INT keycode,INT modifier)
|
||||||
|
{
|
||||||
|
TEXT *pb;
|
||||||
|
|
||||||
|
if (keycode<0x100 && p_isprint(keycode))
|
||||||
|
{
|
||||||
|
if (ed->select)
|
||||||
|
DelSelRange(ed);
|
||||||
|
if (ed->blen==ed->i.maxchars)
|
||||||
|
{
|
||||||
|
p_sound(-5,320);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
pb=ed->pb+ed->cur;
|
||||||
|
p_bcpy(pb+1,pb,ed->blen+1-ed->cur);
|
||||||
|
*pb=keycode;
|
||||||
|
(ed->blen)++;
|
||||||
|
(ed->cur)++;
|
||||||
|
ScrollForCursor(ed,FALSE);
|
||||||
|
DrawAll(ed);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if (keycode==W_KEY_DELETE_LEFT || keycode==W_KEY_DELETE_RIGHT)
|
||||||
|
DoDelete(ed,modifier);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (keycode)
|
||||||
|
{
|
||||||
|
case W_KEY_LEFT:
|
||||||
|
if (ed->select)
|
||||||
|
{
|
||||||
|
LoseHighlight(ed);
|
||||||
|
ed->cur=0;
|
||||||
|
}
|
||||||
|
else if (!ed->cur)
|
||||||
|
return(0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (modifier&W_PSION_MODIFIER)
|
||||||
|
ed->cur=0;
|
||||||
|
else
|
||||||
|
(ed->cur)--;
|
||||||
|
}
|
||||||
|
DisplayCursor(ed);
|
||||||
|
break;
|
||||||
|
case W_KEY_RIGHT:
|
||||||
|
if (ed->select)
|
||||||
|
{
|
||||||
|
LoseHighlight(ed);
|
||||||
|
ed->cur=ed->blen;
|
||||||
|
}
|
||||||
|
else if (ed->cur==ed->blen)
|
||||||
|
return(0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (modifier&W_PSION_MODIFIER)
|
||||||
|
ed->cur=ed->blen;
|
||||||
|
else
|
||||||
|
(ed->cur)++;
|
||||||
|
}
|
||||||
|
DisplayCursor(ed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID le_emphasise(LINED *ed,INT emph)
|
||||||
|
{
|
||||||
|
if (emph)
|
||||||
|
emph=TRUE;
|
||||||
|
if (ed->emph==emph)
|
||||||
|
return;
|
||||||
|
ed->emph=emph;
|
||||||
|
if (!ed->visible)
|
||||||
|
return;
|
||||||
|
DrawAll(ed);
|
||||||
|
if (!emph)
|
||||||
|
wEraseTextCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID le_set_cwidth(LINED *ed,INT cwidth)
|
||||||
|
{
|
||||||
|
ed->cwidth=cwidth;
|
||||||
|
if (ed->visible && ed->emph)
|
||||||
|
{
|
||||||
|
if (cwidth)
|
||||||
|
DrawCursor(ed);
|
||||||
|
else
|
||||||
|
wEraseTextCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID le_visible(LINED *ed,INT visible)
|
||||||
|
{
|
||||||
|
P_RECT box;
|
||||||
|
INT gc;
|
||||||
|
|
||||||
|
if (visible)
|
||||||
|
visible=TRUE;
|
||||||
|
if (ed->visible==visible)
|
||||||
|
return;
|
||||||
|
ed->visible=visible;
|
||||||
|
if (visible)
|
||||||
|
DrawAll(ed);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetBox(ed,&box);
|
||||||
|
gc=CreateGC(ed);
|
||||||
|
gClrRect(&box,G_TRMODE_CLR);
|
||||||
|
FreeGC(ed,gc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/************************** TEST CODE FOLLOWS ***********************/
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL_C LINED *CreateLined(INT yoff,TEXT *msg,INT emph)
|
||||||
|
{
|
||||||
|
IN_LINED init;
|
||||||
|
LINED *ed;
|
||||||
|
|
||||||
|
init.maxchars=20;
|
||||||
|
init.winid=wMainWid;
|
||||||
|
init.xoff=10;
|
||||||
|
init.yoff=yoff;
|
||||||
|
init.width=80;
|
||||||
|
init.height=10;
|
||||||
|
init.asc=8;
|
||||||
|
init.font=WS_FONT_BASE+4;
|
||||||
|
init.style=0;
|
||||||
|
init.autoselect=TRUE;
|
||||||
|
ed=le_init(&init);
|
||||||
|
le_set_text(ed,p_slen(msg),msg);
|
||||||
|
le_emphasise(ed,emph);
|
||||||
|
le_visible(ed,TRUE);
|
||||||
|
return(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
LINED *ed[3];
|
||||||
|
INT which;
|
||||||
|
WS_EV event;
|
||||||
|
INT keycode;
|
||||||
|
|
||||||
|
wStartup();
|
||||||
|
gBorder(W_BORD_CORNER_4);
|
||||||
|
ed[0]=CreateLined(10,"One",TRUE);
|
||||||
|
ed[1]=CreateLined(30,"Two",FALSE);
|
||||||
|
ed[2]=CreateLined(50,"Three",FALSE);
|
||||||
|
which=0;
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
wGetEventWait(&event);
|
||||||
|
} while (event.type!=WM_KEY);
|
||||||
|
keycode=event.p.key.keycode&(~W_SPECIAL_KEY);
|
||||||
|
switch (keycode)
|
||||||
|
{
|
||||||
|
case W_KEY_ESCAPE:
|
||||||
|
if (event.p.key.modifiers==W_PSION_MODIFIER)
|
||||||
|
p_exit(0);
|
||||||
|
case W_KEY_UP:
|
||||||
|
if (which)
|
||||||
|
{
|
||||||
|
le_emphasise(ed[which--],FALSE);
|
||||||
|
le_emphasise(ed[which],TRUE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case W_KEY_DOWN:
|
||||||
|
if (which<2)
|
||||||
|
{
|
||||||
|
le_emphasise(ed[which++],FALSE);
|
||||||
|
le_emphasise(ed[which],TRUE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
le_key(ed[which],keycode,event.p.key.modifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#define LINED_H
|
||||||
|
|
||||||
|
#ifndef P_STD_H
|
||||||
|
#include <p_std.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
WORD maxchars;
|
||||||
|
WORD winid;
|
||||||
|
WORD xoff;
|
||||||
|
WORD yoff;
|
||||||
|
WORD width;
|
||||||
|
WORD height;
|
||||||
|
WORD asc;
|
||||||
|
WORD font;
|
||||||
|
WORD style;
|
||||||
|
WORD autoselect;
|
||||||
|
} IN_LINED;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
WORD blen;
|
||||||
|
TEXT *pb;
|
||||||
|
WORD select;
|
||||||
|
WORD emph;
|
||||||
|
WORD cur;
|
||||||
|
WORD marg;
|
||||||
|
WORD cwidth;
|
||||||
|
WORD visible;
|
||||||
|
WORD gc;
|
||||||
|
WORD scrollx;
|
||||||
|
WORD lmarg;
|
||||||
|
IN_LINED i;
|
||||||
|
} LINED;
|
||||||
|
|
||||||
|
GLREF_C LINED *le_init(IN_LINED *pin);
|
||||||
|
GLREF_C VOID le_set_text(LINED *ed,INT blen,TEXT *pb);
|
||||||
|
GLREF_C VOID le_emphasise(LINED *ed,INT emph);
|
||||||
|
GLREF_C VOID le_set_cwidth(LINED *ed,INT cwidth);
|
||||||
|
GLREF_C VOID le_visible(LINED *ed,INT visible);
|
||||||
|
GLREF_C INT le_key(LINED *ed,INT keycode,INT modifier);
|
||||||
|
GLREF_C VOID le_destroy(LINED *ed);
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
LKSHELL.C - Just starts up the link
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
LOCAL_D WSERV_SPEC wSpec;
|
||||||
|
LOCAL_D UINT wMainGc;
|
||||||
|
LOCAL_D UINT wMainWid;
|
||||||
|
LOCAL_D INT FontHeight;
|
||||||
|
LOCAL_D INT FontAscent;
|
||||||
|
|
||||||
|
LOCAL_C VOID SetFontHeight(VOID)
|
||||||
|
{
|
||||||
|
G_FONT_INFO info;
|
||||||
|
|
||||||
|
gFontInfo(WS_FONT_SYSTEM,0,&info);
|
||||||
|
FontHeight=info.height;
|
||||||
|
FontAscent=info.ascent;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CDECL PrintLine(INT line,INT align,TEXT *fmt,...)
|
||||||
|
{
|
||||||
|
INT len;
|
||||||
|
P_RECT box;
|
||||||
|
TEXT b[80];
|
||||||
|
|
||||||
|
box.tl.x=4;
|
||||||
|
box.br.x=wSpec.conn.info.pixels.x-4;
|
||||||
|
box.tl.y=FontHeight*line+4;
|
||||||
|
box.br.y=box.tl.y+FontHeight;
|
||||||
|
len=p_atob(&b[0],fmt,&fmt+1);
|
||||||
|
gPrintBoxText(&box,FontAscent,align,0,&b[0],len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID MainEventLoop(VOID)
|
||||||
|
{
|
||||||
|
WS_EV event;
|
||||||
|
|
||||||
|
SetFontHeight();
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wGetEventWait(&event);
|
||||||
|
if (event.type==WM_REDRAW)
|
||||||
|
{
|
||||||
|
wValidateWin(wMainWid);
|
||||||
|
gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON);
|
||||||
|
PrintLine(0,G_TEXT_ALIGN_LEFT,"Free memory: %dKbytes",p_sgfree()>>6);
|
||||||
|
}
|
||||||
|
else if (event.type==WM_KEY && event.p.key.keycode=='\r')
|
||||||
|
wInvalidateWin(wMainWid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
INT NotifierPid;
|
||||||
|
WORD stat;
|
||||||
|
|
||||||
|
p_setonevent(TRUE);
|
||||||
|
wConnect(&wSpec,0,W_CONNECT_PRIORITY);
|
||||||
|
wSystem(WSERV_FLAG_NO_NOTIFIER_REBOOT,WSERV_FLAG_NO_NOTIFIER_REBOOT);
|
||||||
|
if ((NotifierPid=p_pidfind("SYS$NTFY.*"))>0)
|
||||||
|
{
|
||||||
|
p_logona(NotifierPid,&stat);
|
||||||
|
p_pterminate(NotifierPid,0);
|
||||||
|
p_waitstat(&stat);
|
||||||
|
}
|
||||||
|
wSystem(WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW,
|
||||||
|
WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW);
|
||||||
|
if (p_pidfind("SYS$NCP.*")<0)
|
||||||
|
p_presume(p_execc("ROM::LINK",NULL,0));
|
||||||
|
wMainWid=wCreateWindow(0,0,0,1);
|
||||||
|
wsCreateClock(wMainWid,WS_CLOCK_WITH_DATE|WS_CLOCK_WITH_SECONDS,104,66,0);
|
||||||
|
wInitialiseWindowTree(wMainWid);
|
||||||
|
wMainGc=gCreateGC0(wMainWid);
|
||||||
|
MainEventLoop();
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#system epoc img
|
||||||
|
#set epocinit=iplib2
|
||||||
|
#model small jpi
|
||||||
|
#compile lkshell
|
||||||
|
#link lkshell
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@echo off
|
||||||
|
call checkvid
|
||||||
|
if exist %1.pr goto custom
|
||||||
|
tsc /m unnamed.pr /smain=%1 /%jpivid%
|
||||||
|
goto end
|
||||||
|
:custom
|
||||||
|
tsc /m %1.pr /smain=%1 /%jpivid%
|
||||||
|
:end
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
P_COMP.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
VOID *chan;
|
||||||
|
LONG len;
|
||||||
|
TEXT name[P_FNAMESIZE];
|
||||||
|
UBYTE buf[P_FBLKSIZE];
|
||||||
|
} FILE_DATA;
|
||||||
|
|
||||||
|
LOCAL_D FILE_DATA f1={0,NULL};
|
||||||
|
LOCAL_D FILE_DATA f2={0,NULL};
|
||||||
|
|
||||||
|
LOCAL_C VOID CleanUp(TEXT *msg, FILE_DATA *pf)
|
||||||
|
{
|
||||||
|
TEXT bb[E_MAX_ERROR_TEXT_SIZE];
|
||||||
|
|
||||||
|
p_close(pf->chan);
|
||||||
|
pf->chan=NULL;
|
||||||
|
if (pf->ret<0)
|
||||||
|
{
|
||||||
|
p_errs(&bb[0],pf->ret);
|
||||||
|
p_printf("Failed to %s %s\n\r%s)",msg,&pf->name[0],&bb[0]);
|
||||||
|
pf->ret=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID Exit(TEXT *msg)
|
||||||
|
{
|
||||||
|
if (f1.ret>=0 && f2.ret>=0)
|
||||||
|
p_printf(msg);
|
||||||
|
CleanUp(msg,&f1);
|
||||||
|
CleanUp(msg,&f2);
|
||||||
|
p_leave(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID OpenFile(FILE_DATA *pf, TEXT *name, TEXT *related)
|
||||||
|
{
|
||||||
|
LONG pos;
|
||||||
|
|
||||||
|
if ((pf->ret=p_fparse(name,related,&pf->name[0],NULL))<0)
|
||||||
|
Exit("parse");
|
||||||
|
if ((pf->ret=p_open(&pf->chan,&pf->name[0],P_FSTREAM|P_FSHARE|P_FRANDOM))<0)
|
||||||
|
Exit("open");
|
||||||
|
pf->len=0L; p_seek(pf->chan,P_FEND,&pf->len);
|
||||||
|
pos=0; p_seek(pf->chan,P_FABS,&pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ReadFile(FILE_DATA *pf)
|
||||||
|
{
|
||||||
|
pf->ret=p_read(pf->chan,&pf->buf[0],sizeof(pf->buf));
|
||||||
|
if (pf->ret!=E_FILE_EOF && pf->ret<0)
|
||||||
|
Exit("read");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID CDECL CompareFiles(TEXT *file1, TEXT *file2)
|
||||||
|
{
|
||||||
|
OpenFile(&f1,file1,NULL);
|
||||||
|
OpenFile(&f2,file2,&f1.name[0]);
|
||||||
|
p_printf("Compare %s (%ld)",&f1.name[0],f1.len);
|
||||||
|
p_printf(" with %s (%ld)",&f2.name[0],f2.len);
|
||||||
|
if (f1.len!=f2.len)
|
||||||
|
Exit("Files are of different length");
|
||||||
|
FOREVER
|
||||||
|
{
|
||||||
|
ReadFile(&f1);
|
||||||
|
ReadFile(&f2);
|
||||||
|
if (f1.ret==E_FILE_EOF && f2.ret==E_FILE_EOF)
|
||||||
|
{
|
||||||
|
f1.ret=f2.ret=0;
|
||||||
|
Exit("Files are identical");
|
||||||
|
}
|
||||||
|
if (p_bcmp(&f1.buf[0],f1.ret,&f2.buf[0],f2.ret))
|
||||||
|
Exit("Files are different");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
TEXT *p;
|
||||||
|
TEXT bb[P_FNAMESIZE];
|
||||||
|
|
||||||
|
while (p_getl("Enter <file1> <file2>?\r\n",&bb[0],P_FNAMESIZE))
|
||||||
|
{
|
||||||
|
p=p_skipch(&bb[0]);
|
||||||
|
if (*p)
|
||||||
|
*p++=0;
|
||||||
|
p_enter((VOID *)CompareFiles,&bb[0],p_skipwh(p));
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
P_DLIST.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
|
||||||
|
LOCAL_C TEXT *GetTypeText(UINT type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case P_FMEDIA_FLOPPY:
|
||||||
|
return "Floppy";
|
||||||
|
case P_FMEDIA_HARDDISK:
|
||||||
|
return "Hard";
|
||||||
|
case P_FMEDIA_FLASH:
|
||||||
|
return "Flash";
|
||||||
|
case P_FMEDIA_RAM:
|
||||||
|
return "RAM";
|
||||||
|
case P_FMEDIA_ROM:
|
||||||
|
return "ROM";
|
||||||
|
case P_FMEDIA_WRITEPROTECTED:
|
||||||
|
return "Protected";
|
||||||
|
}
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ListDevices(VOID)
|
||||||
|
{
|
||||||
|
VOID *ncb,*dcb;
|
||||||
|
INT ret;
|
||||||
|
TEXT device[P_FNAMESIZE];
|
||||||
|
TEXT bb[E_MAX_ERROR_TEXT_SIZE];
|
||||||
|
P_DINFO dinfo;
|
||||||
|
|
||||||
|
p_printf(" Device Name Type Size Free");
|
||||||
|
p_printf("=========== ========== ========== ======== ========");
|
||||||
|
p_open(&ncb,"FIL:",P_FNODE);
|
||||||
|
while (!p_iow(ncb,P_FREAD,&device[0],NULL))
|
||||||
|
{
|
||||||
|
p_scat(&device[0],"a:\\");
|
||||||
|
if (p_open(&dcb,&device[0],P_FDEVICE))
|
||||||
|
continue;
|
||||||
|
while (!p_read(dcb,&device[P_FSYSNAMESIZE],0))
|
||||||
|
{
|
||||||
|
if ((ret=p_dinfo(&device[0],&dinfo))<0)
|
||||||
|
{
|
||||||
|
p_errs(&bb[0],ret);
|
||||||
|
p_printf("%- 12s %- 12s<%s>",&device[0],"**Failed**",&bb[0]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
p_printf("%- 12s %- 12s%- 11s %7ldK %7ldK",
|
||||||
|
&device[0],&dinfo.name[0],GetTypeText(dinfo.mediatype&0xff),
|
||||||
|
(dinfo.size+512)>>10,(dinfo.free+512)>>10);
|
||||||
|
}
|
||||||
|
p_close(dcb);
|
||||||
|
}
|
||||||
|
p_close(ncb);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
ListDevices();
|
||||||
|
p_getch();
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
P_HELLO.C
|
||||||
|
|
||||||
|
PLIB Hello World application
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
p_printf("Hello World");
|
||||||
|
p_getch();
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#system epoc img
|
||||||
|
#set epocinit=iplib
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#compile p_hello
|
||||||
|
#link p_hello
|
||||||
|
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
P_PRNDIR.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
|
||||||
|
LOCAL_D VOID *dcb=NULL;
|
||||||
|
|
||||||
|
LOCAL_C VOID panic(TEXT *msg, INT errno)
|
||||||
|
{
|
||||||
|
TEXT bb[E_MAX_ERROR_TEXT_SIZE];
|
||||||
|
|
||||||
|
p_close(dcb); dcb=NULL;
|
||||||
|
p_errs(&bb[0],errno);
|
||||||
|
p_printf("%s: %s",msg,&bb[0]);
|
||||||
|
p_leave(errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID PrintDirLine(TEXT *name, P_INFO *pinfo)
|
||||||
|
{
|
||||||
|
P_DAYSEC ds;
|
||||||
|
P_DATE dt;
|
||||||
|
TEXT *p,b[40];
|
||||||
|
|
||||||
|
p=&b[0];
|
||||||
|
if (pinfo->status&P_FAVOLUME)
|
||||||
|
p=p_scpy(p,"Vol,");
|
||||||
|
if (pinfo->status&P_FADIR)
|
||||||
|
p=p_scpy(p,"Dir,");
|
||||||
|
if (pinfo->status&P_FAMOD)
|
||||||
|
p=p_scpy(p,"Mod,");
|
||||||
|
if (!(pinfo->status&P_FAWRITE))
|
||||||
|
p=p_scpy(p,"Read,");
|
||||||
|
if (pinfo->status&P_FASYSTEM)
|
||||||
|
p=p_scpy(p,"Sys,");
|
||||||
|
if (pinfo->status&P_FAHIDDEN)
|
||||||
|
p=p_scpy(p,"Hid,");
|
||||||
|
if (*(p-1)==',')
|
||||||
|
*--p=0;
|
||||||
|
p_sttods(&pinfo->modst,&ds);
|
||||||
|
p_dstodt(&ds,&dt);
|
||||||
|
p_printf("%- 12s %8lu %02u-%02u-%02u %02u:%02u %s",
|
||||||
|
name,pinfo->size,dt.day+1,dt.month+1,dt.year,dt.hour,dt.minute,&b[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT CDECL PrintDirList(TEXT *dir)
|
||||||
|
{
|
||||||
|
INT ret,NoFiles;
|
||||||
|
P_INFO info;
|
||||||
|
TEXT name[P_FNAMESIZE];
|
||||||
|
|
||||||
|
if ((ret=p_open(&dcb,dir,P_FDIR))!=0)
|
||||||
|
panic("Failed to open directory file",ret);
|
||||||
|
NoFiles=TRUE;
|
||||||
|
while (!(ret=p_iow(dcb,P_FREAD,&name[0],&info)))
|
||||||
|
{
|
||||||
|
NoFiles=FALSE;
|
||||||
|
PrintDirLine(&name[0],&info);
|
||||||
|
}
|
||||||
|
p_close(dcb); dcb=NULL;
|
||||||
|
if (ret!=E_FILE_EOF)
|
||||||
|
panic("Failed to read directory",ret);
|
||||||
|
if (NoFiles)
|
||||||
|
p_printf("No files found");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
TEXT name[P_FNAMESIZE];
|
||||||
|
|
||||||
|
while (p_getl(">",&name[0],P_FNAMESIZE))
|
||||||
|
p_enter((VOID *)PrintDirList,&name[0]);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
P_SEARCH.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
|
||||||
|
LOCAL_D VOID *fcb=NULL;
|
||||||
|
|
||||||
|
LOCAL_C VOID panic(TEXT *msg, INT errno)
|
||||||
|
{
|
||||||
|
TEXT bb[E_MAX_ERROR_TEXT_SIZE];
|
||||||
|
|
||||||
|
p_errs(&bb[0],errno);
|
||||||
|
p_printf("%s: %s",msg,&bb[0]);
|
||||||
|
p_leave(errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma save
|
||||||
|
#pragma ENTER_CALL
|
||||||
|
|
||||||
|
LOCAL_C INT CDECL SearchFile(TEXT *file, TEXT *pattern)
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
TEXT line[P_FMAXRSIZE];
|
||||||
|
|
||||||
|
if ((ret=p_open(&fcb,file,P_FTEXT))<0)
|
||||||
|
panic("Failed to open file",ret);
|
||||||
|
while ((ret=p_read(fcb,&line[0],sizeof(line)))>=0)
|
||||||
|
{
|
||||||
|
line[ret]=0;
|
||||||
|
if (ret && p_ssubi(&line[0],pattern)>=0)
|
||||||
|
p_printf(&line[0]);
|
||||||
|
}
|
||||||
|
p_close(fcb);
|
||||||
|
if (ret!=E_FILE_EOF)
|
||||||
|
panic("Failed to read file",ret);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma restore
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
TEXT *p;
|
||||||
|
TEXT bb[P_FNAMESIZE];
|
||||||
|
|
||||||
|
while (p_getl(">",&bb[0],P_FNAMESIZE))
|
||||||
|
{
|
||||||
|
p=p_skipch(&bb[0]);
|
||||||
|
*p++=0;
|
||||||
|
p=p_skipwh(p);
|
||||||
|
p_printf("Searching %s for %s",&bb[0],p);
|
||||||
|
p_enter3(SearchFile,&bb[0],p);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
Save the screen to PCX file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
#define BUFLEN 256
|
||||||
|
|
||||||
|
GLREF_D WSERV_SPEC *wserv_channel;
|
||||||
|
|
||||||
|
LOCAL_D VOID *fcb;
|
||||||
|
LOCAL_D UBYTE *pbuf;
|
||||||
|
LOCAL_D UBYTE *pobuf;
|
||||||
|
LOCAL_D UBYTE obuf[BUFLEN];
|
||||||
|
|
||||||
|
LOCAL_C VOID FlushBuffer(VOID)
|
||||||
|
{
|
||||||
|
f_write(fcb,&obuf[0],pobuf-&obuf[0]);
|
||||||
|
pobuf=&obuf[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID putb(INT b)
|
||||||
|
{
|
||||||
|
*pobuf++=b;
|
||||||
|
if (pobuf==&obuf[BUFLEN])
|
||||||
|
FlushBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C INT rev(INT dat)
|
||||||
|
{
|
||||||
|
INT i;
|
||||||
|
INT rdat;
|
||||||
|
|
||||||
|
rdat=0;
|
||||||
|
for (i=0;i<8;i++)
|
||||||
|
rdat|=((dat>>i)&1)<<(7-i);
|
||||||
|
return(rdat^0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID WritePCXLine(UBYTE *buf,UINT len)
|
||||||
|
{
|
||||||
|
UBYTE *p;
|
||||||
|
UINT end;
|
||||||
|
UINT count;
|
||||||
|
INT byte;
|
||||||
|
|
||||||
|
p=buf;
|
||||||
|
byte=*p++;
|
||||||
|
count=1;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
end=(p==(&buf[0]+len));
|
||||||
|
if (byte==*p && count<0x3f && !end)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
byte=rev(byte);
|
||||||
|
if (count>1 || (byte&0xC0)==0xC0)
|
||||||
|
putb(count+0xC0);
|
||||||
|
putb(byte);
|
||||||
|
byte=*p++;
|
||||||
|
count=1;
|
||||||
|
}
|
||||||
|
} while (!end);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID WriteHeader(TEXT *name,UINT width,UINT height,UINT bytewid)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
UBYTE manuf;
|
||||||
|
UBYTE hard;
|
||||||
|
UBYTE encod;
|
||||||
|
UBYTE bitpx;
|
||||||
|
P_RECT rect;
|
||||||
|
WORD hres;
|
||||||
|
WORD vres;
|
||||||
|
UBYTE clrma[48];
|
||||||
|
UBYTE vmode;
|
||||||
|
UBYTE nplanes;
|
||||||
|
WORD bplin;
|
||||||
|
UBYTE padding[60];
|
||||||
|
} header;
|
||||||
|
|
||||||
|
f_open(&fcb,name,P_FREPLACE|P_FSTREAM|P_FUPDATE);
|
||||||
|
p_bfil(&header,sizeof(header),0);
|
||||||
|
header.manuf=10;
|
||||||
|
header.hard=3;
|
||||||
|
header.encod=TRUE;
|
||||||
|
header.bitpx=1;
|
||||||
|
header.rect.br.x=width-1;
|
||||||
|
header.rect.br.y=height-1;
|
||||||
|
header.hres=640;
|
||||||
|
header.vres=480;
|
||||||
|
header.nplanes=1;
|
||||||
|
header.bplin=bytewid;
|
||||||
|
f_write(fcb,&header,sizeof(header));
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma save, ENTER_CALL
|
||||||
|
|
||||||
|
LOCAL_C INT WritePCXFile(TEXT *name)
|
||||||
|
{
|
||||||
|
UINT len;
|
||||||
|
P_POINT size;
|
||||||
|
P_POINT line;
|
||||||
|
|
||||||
|
size=wserv_channel->conn.info.pixels;
|
||||||
|
len=((size.x+15)>>3)&~1;
|
||||||
|
WriteHeader(name,size.x,size.y,len);
|
||||||
|
pbuf=f_alloc(len);
|
||||||
|
line.x=0;
|
||||||
|
for (line.y=0;line.y<size.y;line.y++)
|
||||||
|
{
|
||||||
|
gPeekBit(0,&line,size.x,pbuf);
|
||||||
|
WritePCXLine(pbuf,len);
|
||||||
|
}
|
||||||
|
FlushBuffer();
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma restore
|
||||||
|
|
||||||
|
GLDEF_C INT pcxScreenSave(TEXT *name)
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
fcb=NULL;
|
||||||
|
pbuf=NULL;
|
||||||
|
pobuf=&obuf[0];
|
||||||
|
ret=p_enter2((VOID *)WritePCXFile,name);
|
||||||
|
p_free(pbuf);
|
||||||
|
p_close(fcb);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
This directory contains demonstration files that are associated with
|
||||||
|
the following manuals:
|
||||||
|
|
||||||
|
General Programming Manual
|
||||||
|
HC Programming Guide
|
||||||
|
Series 3/3a Programming Guide
|
||||||
|
Additional System Information
|
||||||
|
PLIB Reference
|
||||||
|
Window Server Reference
|
||||||
|
|
||||||
|
This directory also contains the necessary files to build programs
|
||||||
|
from the source files.
|
||||||
|
|
||||||
|
For example, you can check your installation by making \sibosdk\demo
|
||||||
|
the current directory and entering:
|
||||||
|
MAKE HELLO
|
||||||
|
to produce a HELLO.IMG that can then be run on a Series3, HC or MC.
|
||||||
|
|
||||||
|
If you wish to debug at the source code level, enter:
|
||||||
|
VID ON
|
||||||
|
before making a program (as described in the General Programming Manual).
|
||||||
|
|
||||||
|
If you move the contents of this directory to other than a
|
||||||
|
subdirectory of \sibosdk\ then you will need a different TS.RED (such
|
||||||
|
as the one in \sibosdk\sys).
|
||||||
|
|
||||||
|
See DEMO.PRJ (a plain text file) for an annotated list of the files
|
||||||
|
in this directory.
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <p_sys.h>
|
||||||
|
#include <epoc.h>
|
||||||
|
|
||||||
|
GLREF_D VOID *DatCommandPtr;
|
||||||
|
|
||||||
|
LOCAL_D VOID *fcb; /* handle of resource file */
|
||||||
|
LOCAL_D UWORD resoff; /* offset to resource file within .img file */
|
||||||
|
LOCAL_D UWORD ixpos; /* offset to index table within resource file */
|
||||||
|
|
||||||
|
LOCAL_D TEXT buf[80]; /* scratch buffer used for resources loaded */
|
||||||
|
|
||||||
|
LOCAL_C VOID SeekToPos(UWORD roff)
|
||||||
|
/*
|
||||||
|
Position to offset roff within the resource file
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
LONG ioff; /* offset within image file */
|
||||||
|
|
||||||
|
ioff=resoff+roff;
|
||||||
|
p_seek(fcb,P_FABS,&ioff);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID InitRsc(VOID)
|
||||||
|
/*
|
||||||
|
Open resource file at add-file slot 2 inside own .img file.
|
||||||
|
Set up the values of fcb, resoff, and ixpos
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
ImgHeader head;
|
||||||
|
|
||||||
|
p_open(&fcb,DatCommandPtr,P_FRANDOM|P_FSTREAM|P_FSHARE);
|
||||||
|
p_read(fcb,&head,sizeof(head));
|
||||||
|
resoff=head.Add[1].offset;
|
||||||
|
SeekToPos(0);
|
||||||
|
p_read(fcb,&ixpos,2);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C TEXT *ReadRsc(INT i)
|
||||||
|
/*
|
||||||
|
Returns pointer to buffer containing resource i.
|
||||||
|
Note that the static buffer buf[] is used in every case.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
UWORD tmp[2]; /* section of index table */
|
||||||
|
|
||||||
|
SeekToPos(ixpos+((i-1)*2)); /* position into index table */
|
||||||
|
p_read(fcb,&tmp[0],4);
|
||||||
|
SeekToPos(tmp[0]);
|
||||||
|
p_read(fcb,&buf[0],tmp[1]-tmp[0]);
|
||||||
|
return(&buf[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
InitRsc();
|
||||||
|
p_printf("Resource 1 is %s",ReadRsc(1));
|
||||||
|
p_printf("Resource 2 is %s",ReadRsc(2));
|
||||||
|
p_printf("Press any key to exit");
|
||||||
|
p_getch();
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
SCAPT.C - Capture the screen to a file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <plib.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
GLREF_D TEXT *DatCommandPtr;
|
||||||
|
|
||||||
|
GLREF_C INT pcxScreenSave(TEXT *name);
|
||||||
|
|
||||||
|
LOCAL_D WSERV_SPEC wSpec;
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
INT ret;
|
||||||
|
TEXT *pc;
|
||||||
|
TEXT name[P_FNAMESIZE];
|
||||||
|
|
||||||
|
pc=p_skipch(DatCommandPtr)+1;
|
||||||
|
if (*pc)
|
||||||
|
pc=p_skipwh(pc+1);
|
||||||
|
ret=p_fparse(pc,"REM::SCREEN.PCX",&name[0],NULL);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
wConnect(&wSpec,0,W_CONNECT_AT_BACK);
|
||||||
|
ret=pcxScreenSave(&name[0]);
|
||||||
|
p_sound(1,512);
|
||||||
|
}
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#system epoc img
|
||||||
|
#set epocinit=iplib2
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#compile scapt
|
||||||
|
#compile pcxsave
|
||||||
|
#link scapt
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <epoc.h>
|
||||||
|
|
||||||
|
/* Sound demo: plays the ice cream van tune at various
|
||||||
|
beat per minute ... */
|
||||||
|
|
||||||
|
GLDEF_C VOID waitstat2(WORD *pstat1, WORD *pstat2)
|
||||||
|
/*
|
||||||
|
Wait for *pstat!=E_FILE_PENDING and *pstat2 != E_FILE_PENDING
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
i = -1;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
p_iowait();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while (*pstat1 == E_FILE_PENDING && *pstat2 == E_FILE_PENDING);
|
||||||
|
|
||||||
|
if (*pstat2 == E_FILE_PENDING)
|
||||||
|
pstat1 = pstat2;
|
||||||
|
p_waitstat(pstat1);
|
||||||
|
|
||||||
|
while (i--)
|
||||||
|
p_iosignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GLDEF_C VOID play_notes(WORD *buf1, WORD *buf2, WORD l1, WORD l2, INT volume, INT beatsPerMinute)
|
||||||
|
{
|
||||||
|
VOID *pcb;
|
||||||
|
WORD sndstat1,sndstat2;
|
||||||
|
E_SOUND sound;
|
||||||
|
INT err;
|
||||||
|
|
||||||
|
if ((err=p_open(&pcb,"SND:",-1)) < 0)
|
||||||
|
{
|
||||||
|
p_close(pcb);
|
||||||
|
p_exit(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err=p_iow3(pcb,P_FSENSE,&sound)) < 0)
|
||||||
|
{
|
||||||
|
p_close(pcb);
|
||||||
|
p_exit(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beatsPerMinute >= 0)
|
||||||
|
sound.beatsPerMinute = (UBYTE) beatsPerMinute;
|
||||||
|
|
||||||
|
if (volume >= 0)
|
||||||
|
sound.volume = (UBYTE) volume;
|
||||||
|
|
||||||
|
if ((err=p_iow3(pcb,P_FSET,&sound)) < 0)
|
||||||
|
{
|
||||||
|
p_close(pcb);
|
||||||
|
p_exit(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
p_ioc5(pcb,E_FSSOUNDCHANNEL1,&sndstat1,&buf1[0],&l1);
|
||||||
|
p_ioc5(pcb,E_FSSOUNDCHANNEL2,&sndstat2,&buf2[0],&l2);
|
||||||
|
waitstat2(&sndstat1,&sndstat2);
|
||||||
|
|
||||||
|
p_close(pcb);
|
||||||
|
|
||||||
|
if (sndstat1 != 0 || sndstat1 != 0)
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
WORD notes1[] = {1048,24,524,12};
|
||||||
|
WORD notes2[] = {1048,4,1320,4,1568,4,2092,4,1568,4,1320,4,1048,12};
|
||||||
|
WORD len1 = sizeof(notes1)/4,len2 = sizeof(notes2)/4;
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
for (i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
play_notes(¬es1[0],¬es2[0],len1,len2,i,-1);
|
||||||
|
p_sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
play_notes(¬es1[0],¬es2[0],len1,len2,-1,140+i*20);
|
||||||
|
p_sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/* SUBPROC.C */
|
||||||
|
|
||||||
|
#include <p_std.h>
|
||||||
|
#include <p_gen.h>
|
||||||
|
#include <p_math.h>
|
||||||
|
#include <epoc.h>
|
||||||
|
#include "subproc.h"
|
||||||
|
|
||||||
|
GLREF_C TEXT *DatCommandPtr;
|
||||||
|
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
TEXT *pb;
|
||||||
|
SUBPROC_CL *pcl;
|
||||||
|
UWORD answer;
|
||||||
|
WORD logstat;
|
||||||
|
|
||||||
|
pb=DatCommandPtr+p_slen(DatCommandPtr)+1;
|
||||||
|
if (*pb!=sizeof(SUBPROC_CL))
|
||||||
|
return(E_GEN_ARG);
|
||||||
|
pcl=(SUBPROC_CL *)(pb+1);
|
||||||
|
if (!p_logona(pcl->pid,&logstat))
|
||||||
|
{
|
||||||
|
answer=(UWORD)(p_randl(&pcl->data)%(2*60*32));
|
||||||
|
p_sleept(answer);
|
||||||
|
if (logstat<0)
|
||||||
|
p_pcpyto(pcl->pid,pcl->poff,&answer,sizeof(UWORD));
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
HANDLE pid;
|
||||||
|
VOID *poff;
|
||||||
|
ULONG data;
|
||||||
|
} SUBPROC_CL;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#system epoc img
|
||||||
|
#set epocinit=iplib
|
||||||
|
#model small jpi
|
||||||
|
#compile %main
|
||||||
|
#link %main
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
@echo off
|
||||||
|
goto X%1X
|
||||||
|
:Xv0X
|
||||||
|
:XoffX
|
||||||
|
set jpivid=v0
|
||||||
|
echo VID is now OFF
|
||||||
|
goto :end
|
||||||
|
:Xv2X
|
||||||
|
:XonX
|
||||||
|
set jpivid=v2
|
||||||
|
echo VID is now ON
|
||||||
|
goto :end
|
||||||
|
:XX
|
||||||
|
call checkvid
|
||||||
|
goto %jpivid%
|
||||||
|
:v0
|
||||||
|
echo VID is OFF
|
||||||
|
goto end
|
||||||
|
:v2
|
||||||
|
echo VID is ON
|
||||||
|
:end
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include <p_std.h>
|
||||||
|
#include <wlib.h>
|
||||||
|
|
||||||
|
GLDEF_C INT main(VOID)
|
||||||
|
{
|
||||||
|
WS_EV event;
|
||||||
|
|
||||||
|
wStartup();
|
||||||
|
gBorder(W_BORD_CORNER_4);
|
||||||
|
wSetBusyMsg("Hello world",W_CORNER_BOTTOM_LEFT);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
wGetEventWait(&event);
|
||||||
|
} while (event.type!=WM_KEY || event.p.key.keycode!=W_KEY_ESCAPE);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/* EHBWIN.C */
|
||||||
|
|
||||||
|
#include <ehello.g>
|
||||||
|
#include <ehello.rsg>
|
||||||
|
#include <hwim.h>
|
||||||
|
|
||||||
|
LOCAL_C VOID LaunchDialog(INT class,INT resid,VOID *rbuf)
|
||||||
|
{
|
||||||
|
DL_DATA dld;
|
||||||
|
|
||||||
|
dld.id=resid;
|
||||||
|
dld.rbuf=rbuf;
|
||||||
|
dld.pdlg=NULL;
|
||||||
|
hLaunchDial(CAT_EHELLO_EHELLO,class,&dld);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma METHOD_CALL
|
||||||
|
|
||||||
|
METHOD VOID ehbwin_wn_init(PR_EHBWIN *self)
|
||||||
|
{
|
||||||
|
W_WINDATA wd;
|
||||||
|
IN_EDWIN_X initx;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
IN_EDWIN e;
|
||||||
|
TEXT rest[21];
|
||||||
|
} init;
|
||||||
|
|
||||||
|
wd.extent.width=240-50; /* extent calculation presupposes S3 screen */
|
||||||
|
wd.extent.height=3+10+5; /* matches flags set for bwin below */
|
||||||
|
wd.extent.tl.x=0;
|
||||||
|
wd.extent.tl.y=31; /* centred vertically */
|
||||||
|
p_send5(self,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd);
|
||||||
|
hLoadResBuf(EHSTR_INIT,&init.e.contents[0]);
|
||||||
|
init.e.vulen=240-50-3-1-5-1; /* one extra pixel clearance each end */
|
||||||
|
init.e.maxlen=50;
|
||||||
|
init.e.flags=IN_EDWIN_VULEN_PIXELS|IN_EDWIN_POSITION_SUPPLIED;
|
||||||
|
initx.pos.x=3+1;
|
||||||
|
initx.pos.y=3;
|
||||||
|
self->ehbwin.edwin=f_newsend(CAT_EHELLO_HWIM,C_EDWIN,O_WN_INIT,
|
||||||
|
&init,self,&initx);
|
||||||
|
self->win.flags=IN_BWIN_SHADOW_2|IN_BWIN_CUSHION;
|
||||||
|
p_send3(self,O_WN_EMPHASISE,TRUE);
|
||||||
|
hInitVis(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD VOID ehbwin_wn_emphasise(PR_EHBWIN *self,INT flag)
|
||||||
|
{
|
||||||
|
p_supersend3(self,O_WN_EMPHASISE,flag);
|
||||||
|
p_send3(self->ehbwin.edwin,O_WN_EMPHASISE,flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD VOID ehbwin_wn_draw(PR_EHBWIN *self)
|
||||||
|
{
|
||||||
|
p_supersend2(self,O_WN_DRAW);
|
||||||
|
p_send2(self->ehbwin.edwin,O_WN_DRAW);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD VOID ehbwin_wn_key(PR_EHBWIN *self,INT keycode,INT mods)
|
||||||
|
{
|
||||||
|
SE_EDWIN sense;
|
||||||
|
|
||||||
|
if (keycode!=W_KEY_RETURN)
|
||||||
|
p_send4(self->ehbwin.edwin,O_WN_KEY,keycode,mods);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p_send3(self->ehbwin.edwin,O_WN_SENSE,&sense);
|
||||||
|
LaunchDialog(C_EHDLG,EHDLG,sense.buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/* EHDLG.C */
|
||||||
|
|
||||||
|
#include <ehello.g>
|
||||||
|
#include <hwim.h>
|
||||||
|
|
||||||
|
#pragma METHOD_CALL
|
||||||
|
|
||||||
|
METHOD VOID ehdlg_dl_dyn_init(PR_DLGBOX *self)
|
||||||
|
{
|
||||||
|
hDlgSetText(1,self->dlgbox.rbuf);
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ehello.pic
|
||||||
|
ehello.rzc
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
IMAGE ehello
|
||||||
|
|
||||||
|
EXTERNAL olib
|
||||||
|
EXTERNAL hwim
|
||||||
|
|
||||||
|
INCLUDE hwimman.g
|
||||||
|
INCLUDE edwin.g
|
||||||
|
|
||||||
|
CLASS ehwserv wserv
|
||||||
|
{
|
||||||
|
REPLACE ws_dyn_init
|
||||||
|
}
|
||||||
|
|
||||||
|
CLASS ehbwin bwin
|
||||||
|
{
|
||||||
|
REPLACE wn_init
|
||||||
|
REPLACE wn_emphasise
|
||||||
|
REPLACE wn_key
|
||||||
|
REPLACE wn_draw
|
||||||
|
PROPERTY
|
||||||
|
{
|
||||||
|
PR_EDWIN *edwin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CLASS ehdlg dlgbox
|
||||||
|
{
|
||||||
|
REPLACE dl_dyn_init
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
|||||||
|
#system epoc img
|
||||||
|
#set epocinit=iplib
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#compile ehello.cat
|
||||||
|
|
||||||
|
#if %remake #or (ehello.rg #older ehello.re) #or (ehello.rg #older ehello.g) #then
|
||||||
|
#run "re ehello" no_window no_abort
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (ehello.rsg #older ehello.rss) #or (ehello.rsg #older ehello.rg) #then
|
||||||
|
#run "rs ehello" no_window no_abort
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ehello.rzc #older ehello.rsg #then
|
||||||
|
#run "rch ehello" no_window no_abort
|
||||||
|
#file delete ehello.img
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#compile ehmain.c
|
||||||
|
#compile ehwserv.c
|
||||||
|
#compile ehbwin.c
|
||||||
|
#compile ehdlg.c
|
||||||
|
|
||||||
|
#if (ehello.img #older ehello.afl) #or (ehello.img #older ehello.pic) #then
|
||||||
|
#file delete ehello.img
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma link(hwim.lib)
|
||||||
|
|
||||||
|
#link ehello.img
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#include <comman.g>
|
||||||
|
|
||||||
|
_O_COM_EXIT
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/* EHELLO.RSS */
|
||||||
|
|
||||||
|
#include <hwim.rh>
|
||||||
|
#include <hwim.rg>
|
||||||
|
#include <ehello.rg>
|
||||||
|
|
||||||
|
RESOURCE WSERV_INFO ehello_accs
|
||||||
|
{
|
||||||
|
menbar_id=ehello_mbar;
|
||||||
|
first_com=O_COM_EXIT;
|
||||||
|
accel={'x'};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE MENU_BAR ehello_mbar
|
||||||
|
{
|
||||||
|
items =
|
||||||
|
{
|
||||||
|
MENU_BAR_ITEM
|
||||||
|
{
|
||||||
|
menu_id=special_menu;
|
||||||
|
mb_item="Special";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE MENU special_menu
|
||||||
|
{
|
||||||
|
items =
|
||||||
|
{
|
||||||
|
MENU_ITEM
|
||||||
|
{
|
||||||
|
com_id=O_COM_EXIT;
|
||||||
|
mn_item="Exit";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE DIALOG ehdlg
|
||||||
|
{
|
||||||
|
title="Edit window";
|
||||||
|
flags=DLGBOX_RBUF_FILLED;
|
||||||
|
controls=
|
||||||
|
{
|
||||||
|
CONTROL
|
||||||
|
{
|
||||||
|
class=C_TEXTWIN;
|
||||||
|
flags=DLGBOX_ITEM_DEAD;
|
||||||
|
prompt="Current text";
|
||||||
|
info=TXTMESS { str="*";}; /* placeholder */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCE STRING ehstr_init { str="Hello world"; }
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/* EHMAIN.C */
|
||||||
|
|
||||||
|
#include <ehello.g>
|
||||||
|
|
||||||
|
GLDEF_C VOID main(VOID)
|
||||||
|
{
|
||||||
|
IN_HWIMMAN app;
|
||||||
|
IN_WSERV wserv;
|
||||||
|
|
||||||
|
p_linklib(0);
|
||||||
|
app.flags=FLG_APPMAN_RSCFILE|FLG_APPMAN_SRSCFILE|FLG_APPMAN_CLEAN;
|
||||||
|
app.wserv_cat=p_getlibh(CAT_EHELLO_EHELLO);
|
||||||
|
app.wserv_class=C_EHWSERV;
|
||||||
|
wserv.com_cat=p_getlibh(CAT_EHELLO_HWIM);
|
||||||
|
wserv.com_class=C_COMMAN;
|
||||||
|
p_send4(p_new(CAT_EHELLO_HWIM,C_HWIMMAN),O_AM_INIT,&app,&wserv);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
ehrel.prj ! releases source files
|
||||||
|
ehello.pr ! TS project file
|
||||||
|
make.bat ! makes EHELLO.IMG
|
||||||
|
!
|
||||||
|
ehello.cat ! category file
|
||||||
|
ehello.re ! resource externals file
|
||||||
|
ehello.rss ! resource script
|
||||||
|
!
|
||||||
|
ehbwin.c ! client window
|
||||||
|
ehdlg.c ! dialog
|
||||||
|
ehmain.c ! main
|
||||||
|
ehwserv.c ! window server subclass
|
||||||
|
!
|
||||||
|
ehello.afl ! add file list
|
||||||
|
ehello.pic ! icon
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/* EHWSERV.C */
|
||||||
|
|
||||||
|
#include <ehello.g>
|
||||||
|
|
||||||
|
#pragma METHOD_CALL
|
||||||
|
|
||||||
|
METHOD VOID ehwserv_ws_dyn_init(PR_EHWSERV *self)
|
||||||
|
{
|
||||||
|
wsEnable();
|
||||||
|
self->wserv.cli=f_newsend(CAT_EHELLO_EHELLO,C_EHBWIN,O_WN_INIT);
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
tscx /m ehello
|
||||||
|
tscx /m ehello
|
||||||
Binary file not shown.
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
TXTREAD.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <wl$txt.g>
|
||||||
|
#include "wpfconv.h"
|
||||||
|
|
||||||
|
GLREF_D VOID *DatApp5; /* used for file conversion DYLs... */
|
||||||
|
#define FileName DatApp5 /* ...to point to the source file's name */
|
||||||
|
|
||||||
|
LOCAL_C VOID InsertBuf(PR_TXTREAD *self, TEXT *buf, UINT len)
|
||||||
|
{
|
||||||
|
InsertText(self->txtread.pos,buf,len);
|
||||||
|
self->txtread.pos+=len;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ApplyPlainStyle(PR_TXTREAD *self)
|
||||||
|
{
|
||||||
|
PARA_STYLE *para;
|
||||||
|
EMPH_STYLE *emph;
|
||||||
|
TEXT paracode[2];
|
||||||
|
TEXT emphcode[2];
|
||||||
|
|
||||||
|
*(WORD *)¶code[0]='B'+('T'<<8);
|
||||||
|
para=SenseParaStyleBySC(¶code[0]);
|
||||||
|
DoApplyParaStyle(self->txtread.lastpos,self->txtread.pos,para);
|
||||||
|
*(WORD *)&emphcode[0]='N'+('N'<<8);
|
||||||
|
emph=(EMPH_STYLE *)SenseEmphStyleBySC(&emphcode[0]);
|
||||||
|
DoApplyEmphasis(self->txtread.lastpos,self->txtread.pos,emph);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma METHOD_CALL
|
||||||
|
|
||||||
|
METHOD VOID txtread_ao_init(PR_TXTREAD *self)
|
||||||
|
/*
|
||||||
|
Keep the supplied filename extension.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
f_open((VOID **)&self->active.pcb,FileName,P_FOPEN|P_FTEXT);
|
||||||
|
CloseCurrentFile();
|
||||||
|
SetDefaultStyles(4,6);
|
||||||
|
StartActive(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD VOID txtread_ao_queue(PR_TXTREAD *self)
|
||||||
|
{
|
||||||
|
self->active.isactive=TRUE;
|
||||||
|
self->txtread.len=TXTREAD_BUFLEN;
|
||||||
|
p_ioc5(self->active.pcb,P_FREAD,&self->active.stat,&self->txtread.buf[0],
|
||||||
|
&self->txtread.len);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD INT txtread_ao_run(PR_TXTREAD *self)
|
||||||
|
{
|
||||||
|
if (self->active.stat==E_FILE_EOF)
|
||||||
|
{
|
||||||
|
ApplyPlainStyle(self); /* apply style to final paragraph */
|
||||||
|
SwitchToNewFile(FileName);
|
||||||
|
p_send2(self,O_DESTROY);
|
||||||
|
return(RUN_ACTIVE_USED);
|
||||||
|
}
|
||||||
|
f_leave(self->active.stat);
|
||||||
|
|
||||||
|
if (self->txtread.pos)
|
||||||
|
{
|
||||||
|
ApplyPlainStyle(self); /* range does not include the terminating NULL */
|
||||||
|
InsertBuf(self,&self->txtread.eopara,1);
|
||||||
|
self->txtread.lastpos=self->txtread.pos;
|
||||||
|
}
|
||||||
|
InsertBuf(self,&self->txtread.buf[0],self->txtread.len); /* add text of next paragraph */
|
||||||
|
|
||||||
|
p_send2(self,O_AO_QUEUE);
|
||||||
|
return(RUN_ACTIVE_USED);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD VOID txtread_ao_abrun(PR_TXTREAD *self)
|
||||||
|
/*
|
||||||
|
The application is shut down after reporting any error on loading.
|
||||||
|
No data is ever lost by doing this, since any previous file will
|
||||||
|
already have been saved.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
StopActive();
|
||||||
|
p_supersend2(self,O_AO_ABRUN);
|
||||||
|
p_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD VOID txtread_destroy(PR_TXTREAD *self)
|
||||||
|
{
|
||||||
|
StopActive();
|
||||||
|
p_supersend2(self,O_DESTROY);
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
TXTWRITE.C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <p_std.h>
|
||||||
|
#include <p_file.h>
|
||||||
|
#include <ws$txt.g>
|
||||||
|
#include "wpfconv.h"
|
||||||
|
|
||||||
|
GLREF_D VOID *DatApp5;
|
||||||
|
|
||||||
|
LOCAL_C INT OpenFile(PR_TXTSAVE *self)
|
||||||
|
/* forces .TXT extension */
|
||||||
|
{
|
||||||
|
TEXT extension[6];
|
||||||
|
P_INFO info;
|
||||||
|
TEXT name[P_FNAMESIZE];
|
||||||
|
|
||||||
|
*((UWORD *)&extension[0])='.'+('T'<<8);
|
||||||
|
*((UWORD *)&extension[2])='X'+('T'<<8);
|
||||||
|
extension[4]=0;
|
||||||
|
f_fparse(&extension[0],DatApp5,&name[0],NULL);
|
||||||
|
if (!p_finfo(&name[0],&info))
|
||||||
|
{
|
||||||
|
if (!DoConfirmOverwrite())
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
f_open(&self->active.pcb,&name[0],P_FUPDATE|P_FREPLACE|P_FSTREAM_TEXT);
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCAL_C VOID ReplaceNulls(TEXT *p,UINT len)
|
||||||
|
{
|
||||||
|
TEXT *pe;
|
||||||
|
|
||||||
|
for (pe=p+len;p<pe;p++)
|
||||||
|
{
|
||||||
|
if (!*p)
|
||||||
|
*p=CHAR_CR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma METHOD_CALL
|
||||||
|
|
||||||
|
METHOD VOID txtsave_ao_init(PR_TXTSAVE *self)
|
||||||
|
{
|
||||||
|
OpenFile(self);
|
||||||
|
self->txtsave.ntags=CountTags();
|
||||||
|
StartActive(self);
|
||||||
|
}
|
||||||
|
METHOD VOID txtsave_ao_queue(PR_TXTSAVE *self)
|
||||||
|
{
|
||||||
|
self->active.isactive=TRUE;
|
||||||
|
p_iosignal();
|
||||||
|
}
|
||||||
|
METHOD INT txtsave_ao_run(PR_TXTSAVE *self)
|
||||||
|
{
|
||||||
|
PARA_STYLE style;
|
||||||
|
EMPH_STYLE emphasis;
|
||||||
|
UINT taglen,txtlen;
|
||||||
|
|
||||||
|
taglen=SenseTagItem(self->txtsave.curtag++,&style,&emphasis);
|
||||||
|
while (taglen)
|
||||||
|
{
|
||||||
|
txtlen=taglen>TXTSAVE_BUFFER_LEN ? TXTSAVE_BUFFER_LEN : taglen;
|
||||||
|
ExtractText(self->txtsave.pos,&self->txtsave.buf[0],txtlen);
|
||||||
|
ReplaceNulls(&self->txtsave.buf[0],txtlen);
|
||||||
|
f_write(self->active.pcb,&self->txtsave.buf[0],txtlen);
|
||||||
|
self->txtsave.pos+=txtlen;
|
||||||
|
taglen-=txtlen;
|
||||||
|
}
|
||||||
|
if (self->txtsave.curtag<self->txtsave.ntags)
|
||||||
|
p_send2(self,O_AO_QUEUE);
|
||||||
|
else
|
||||||
|
p_send2(self,O_DESTROY);
|
||||||
|
return(RUN_ACTIVE_USED);
|
||||||
|
}
|
||||||
|
METHOD VOID txtsave_ao_abrun(PR_TXTSAVE *self)
|
||||||
|
{
|
||||||
|
p_close(self->active.pcb);
|
||||||
|
StopActive();
|
||||||
|
p_supersend2(self,O_AO_ABRUN);
|
||||||
|
p_supersend2(self,O_DESTROY);
|
||||||
|
}
|
||||||
|
METHOD VOID txtsave_destroy(PR_TXTSAVE *self)
|
||||||
|
{
|
||||||
|
StopActive();
|
||||||
|
p_supersend2(self,O_DESTROY);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
LIBRARY wl$txt
|
||||||
|
|
||||||
|
EXTERNAL olib
|
||||||
|
|
||||||
|
INCLUDE p_std.h
|
||||||
|
INCLUDE p_object.h
|
||||||
|
INCLUDE olib.g
|
||||||
|
INCLUDE appman.g
|
||||||
|
|
||||||
|
CLASS txtread active
|
||||||
|
NB Must be first class in DYL
|
||||||
|
{
|
||||||
|
REPLACE destroy
|
||||||
|
REPLACE ao_init
|
||||||
|
REPLACE ao_queue
|
||||||
|
REPLACE ao_run
|
||||||
|
REPLACE ao_abrun
|
||||||
|
CONSTANTS
|
||||||
|
{
|
||||||
|
TXTREAD_BUFLEN 256
|
||||||
|
}
|
||||||
|
PROPERTY
|
||||||
|
{
|
||||||
|
UWORD pos; current document character content offset
|
||||||
|
UWORD lastpos; start of previous paragraph
|
||||||
|
TEXT eopara; end of para marker
|
||||||
|
TEXT dummy;
|
||||||
|
UWORD len; length of text in buf[]
|
||||||
|
TEXT buf[TXTREAD_BUFLEN]; input text buffer
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
|||||||
|
#system epoc dyl
|
||||||
|
#set epocinit=iplib
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#abort on
|
||||||
|
|
||||||
|
#set version=0x320F
|
||||||
|
|
||||||
|
#compile %main.cat
|
||||||
|
|
||||||
|
#compile txtread.c
|
||||||
|
|
||||||
|
#pragma link(s3fconv.lib)
|
||||||
|
#pragma link(olib.lib)
|
||||||
|
#pragma link(hwim.lib)
|
||||||
|
|
||||||
|
#link %main
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
WPFCONV.H
|
||||||
|
|
||||||
|
Public word processor structures and prototypes for file conversion DYL code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SCRLAY_G
|
||||||
|
#include <scrlay.g>
|
||||||
|
#endif
|
||||||
|
#ifndef PRINTER_G
|
||||||
|
#include <printer.g>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SCRLAY_FONT sf;
|
||||||
|
UWORD inherit;
|
||||||
|
} WP_FONT;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
TEXT sc[2];
|
||||||
|
TEXT tag_name[16];
|
||||||
|
UWORD sflags;
|
||||||
|
WP_FONT font;
|
||||||
|
} EMPH_DATA; /* saved emphasis style structure */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SCRLAY_MARGINS marg;
|
||||||
|
SCRLAY_SPACING spc;
|
||||||
|
UWORD olevel;
|
||||||
|
SCRLAY_TABS tabs;
|
||||||
|
} PARA_DATA; /* saved paragraph style structure */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
VOID *next; /* style queue header - written by system code */
|
||||||
|
EMPH_DATA ph;
|
||||||
|
} EMPH_STYLE; /* in-memory emphasis style structure */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
VOID *next; /* style queue header - written by system code */
|
||||||
|
EMPH_DATA ph;
|
||||||
|
PARA_DATA pa;
|
||||||
|
SCRLAY_MARGINS prn_mar; /* printer margin positions */
|
||||||
|
SCRLAY_MARGINS scr_mar; /* screen margin positions */
|
||||||
|
SCRLAY_SPACING prn_spc; /* printer vertical spacing data */
|
||||||
|
SCRLAY_TABS *pts; /* screen tabs data */
|
||||||
|
SCRLAY_TABS *ptp; /* printer tabs data */
|
||||||
|
} PARA_STYLE; /* in-memory paragraph style structure */
|
||||||
|
|
||||||
|
/*
|
||||||
|
Prototypes for file conversion DYL interface.
|
||||||
|
*/
|
||||||
|
GLREF_C INT CountParaStyles(VOID);
|
||||||
|
GLREF_C INT CountEmphStyles(VOID);
|
||||||
|
GLREF_C PARA_STYLE *SenseParaStyleByIndex(INT);
|
||||||
|
GLREF_C EMPH_STYLE *SenseEmphStyleByIndex(INT);
|
||||||
|
GLREF_C PARA_STYLE *SenseParaStyleBySC(TEXT *);
|
||||||
|
GLREF_C EMPH_STYLE *SenseEmphStyleBySC(TEXT *);
|
||||||
|
GLREF_C PARA_STYLE *AppendParaStyle(PARA_STYLE *);
|
||||||
|
GLREF_C EMPH_STYLE *AppendEmphStyle(EMPH_STYLE *);
|
||||||
|
GLREF_C VOID DoApplyParaStyle(UINT,UINT,PARA_STYLE *);
|
||||||
|
GLREF_C VOID DoApplyEmphasis(UINT,UINT,EMPH_STYLE *);
|
||||||
|
GLREF_C VOID SetDefaultStyles(UINT,UINT);
|
||||||
|
GLREF_C VOID SetBusyStatus(INT);
|
||||||
|
GLREF_C INT DoConfirmOverwrite(VOID);
|
||||||
|
GLREF_C PRINTER_PARAMS *SensePrinterParams(VOID **);
|
||||||
|
GLREF_C WDR_MODEL *SensePrinterModel(VOID);
|
||||||
|
GLREF_C VOID *SenseWDR(VOID);
|
||||||
|
GLREF_C VOID SetFileErr(INT);
|
||||||
|
GLREF_C VOID StartActive(VOID *);
|
||||||
|
GLREF_C VOID StopActive(VOID);
|
||||||
|
GLREF_C VOID CloseCurrentFile(VOID);
|
||||||
|
GLREF_C VOID SwitchToNewFile(TEXT *);
|
||||||
|
GLREF_C VOID InsertText(UINT,TEXT *,UINT);
|
||||||
|
GLREF_C VOID DeleteText(UINT,UINT);
|
||||||
|
GLREF_C VOID ExtractText(UINT,TEXT *,UINT);
|
||||||
|
GLREF_C UINT CountTags(VOID);
|
||||||
|
GLREF_C UINT SenseTagItem(UINT,PARA_STYLE *,EMPH_STYLE *);
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
LIBRARY ws$txt
|
||||||
|
|
||||||
|
EXTERNAL olib
|
||||||
|
|
||||||
|
INCLUDE p_std.h
|
||||||
|
INCLUDE p_object.h
|
||||||
|
INCLUDE olib.g
|
||||||
|
INCLUDE appman.g
|
||||||
|
|
||||||
|
CLASS txtsave active
|
||||||
|
NB Must be first class in DYL
|
||||||
|
{
|
||||||
|
REPLACE destroy
|
||||||
|
REPLACE ao_init
|
||||||
|
REPLACE ao_queue
|
||||||
|
REPLACE ao_run
|
||||||
|
REPLACE ao_abrun
|
||||||
|
CONSTANTS
|
||||||
|
{
|
||||||
|
CHAR_CR 13
|
||||||
|
TXTSAVE_BUFFER_LEN 256
|
||||||
|
}
|
||||||
|
PROPERTY
|
||||||
|
{
|
||||||
|
UINT ntags;
|
||||||
|
UINT curtag;
|
||||||
|
UINT pos;
|
||||||
|
TEXT buf[TXTSAVE_BUFFER_LEN];
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
|||||||
|
#system epoc dyl
|
||||||
|
#set epocinit=iplib
|
||||||
|
#model small jpi
|
||||||
|
|
||||||
|
#abort on
|
||||||
|
|
||||||
|
#set version=0x320F
|
||||||
|
|
||||||
|
#compile %main.cat
|
||||||
|
|
||||||
|
#compile txtwrite.c
|
||||||
|
|
||||||
|
#pragma link(s3fconv.lib)
|
||||||
|
#pragma link(olib.lib)
|
||||||
|
#pragma link(hwim.lib)
|
||||||
|
|
||||||
|
#link %main
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,158 @@
|
|||||||
|
*name Diary
|
||||||
|
*descent 0
|
||||||
|
*height 9
|
||||||
|
*maxwid 8
|
||||||
|
|
||||||
|
*char 0
|
||||||
|
|
||||||
|
00000000000 ! DY_SYMBOL_ARROW_TAIL
|
||||||
|
00011100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
|
||||||
|
00010100000 ! DY_SYMBOL_ARROW_MIDDLE
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
|
||||||
|
00000000000 ! DY_SYMBOL_ARROW_HEAD_CLOSED
|
||||||
|
00011100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
01110111000
|
||||||
|
00100010000
|
||||||
|
00010100000
|
||||||
|
00001000000
|
||||||
|
00000000000
|
||||||
|
|
||||||
|
00010100000 ! DY_SYMBOL_ARROW_HEAD_OPEN
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
00010100000
|
||||||
|
01110111000
|
||||||
|
00100010000
|
||||||
|
00010100000
|
||||||
|
00001000000
|
||||||
|
00000000000
|
||||||
|
|
||||||
|
1 ! DY_SYMBOL_VERTICAL_BAR
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
|
||||||
|
00000000 ! Numeric space
|
||||||
|
00000000
|
||||||
|
00000000
|
||||||
|
00000000
|
||||||
|
00000000
|
||||||
|
00000000
|
||||||
|
00000000
|
||||||
|
00000000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_ONE
|
||||||
|
00111000
|
||||||
|
01101100
|
||||||
|
11001110
|
||||||
|
11101110
|
||||||
|
11101110
|
||||||
|
01101100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_TWO
|
||||||
|
00111000
|
||||||
|
01000100
|
||||||
|
11110110
|
||||||
|
11101110
|
||||||
|
11011110
|
||||||
|
01000100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_THREE
|
||||||
|
00111000
|
||||||
|
01000100
|
||||||
|
11110110
|
||||||
|
11100110
|
||||||
|
11110110
|
||||||
|
01000100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_FOUR
|
||||||
|
00111000
|
||||||
|
01011100
|
||||||
|
11011110
|
||||||
|
11010110
|
||||||
|
11000110
|
||||||
|
01110100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_FIVE
|
||||||
|
00111000
|
||||||
|
01000100
|
||||||
|
11011110
|
||||||
|
11000110
|
||||||
|
11110110
|
||||||
|
01000100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_SIX
|
||||||
|
00111000
|
||||||
|
01000100
|
||||||
|
11011110
|
||||||
|
11000110
|
||||||
|
11010110
|
||||||
|
01000100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_SEVEN
|
||||||
|
00111000
|
||||||
|
01000100
|
||||||
|
11110110
|
||||||
|
11110110
|
||||||
|
11101110
|
||||||
|
01101100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_EIGHT
|
||||||
|
00111000
|
||||||
|
01000100
|
||||||
|
11010110
|
||||||
|
11000110
|
||||||
|
11010110
|
||||||
|
01000100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
00000000 ! DY_SYMBOL_TODO_PRIORITY_NINE
|
||||||
|
00111000
|
||||||
|
01000100
|
||||||
|
11010110
|
||||||
|
11000110
|
||||||
|
11110110
|
||||||
|
01110100
|
||||||
|
00111000
|
||||||
|
00000000
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
*name Sys$digt
|
||||||
|
*descent 1
|
||||||
|
*height 6
|
||||||
|
*max_width 6
|
||||||
|
|
||||||
|
*char 31
|
||||||
|
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
000000
|
||||||
|
|
||||||
|
*char 48
|
||||||
|
|
||||||
|
011100
|
||||||
|
100010
|
||||||
|
100010
|
||||||
|
100010
|
||||||
|
011100
|
||||||
|
000000
|
||||||
|
|
||||||
|
001000
|
||||||
|
011000
|
||||||
|
001000
|
||||||
|
001000
|
||||||
|
011100
|
||||||
|
000000
|
||||||
|
|
||||||
|
011100
|
||||||
|
100010
|
||||||
|
001100
|
||||||
|
010000
|
||||||
|
111110
|
||||||
|
000000
|
||||||
|
|
||||||
|
011100
|
||||||
|
100010
|
||||||
|
001100
|
||||||
|
100010
|
||||||
|
011100
|
||||||
|
000000
|
||||||
|
|
||||||
|
000100
|
||||||
|
001100
|
||||||
|
010100
|
||||||
|
111110
|
||||||
|
000100
|
||||||
|
000000
|
||||||
|
|
||||||
|
111110
|
||||||
|
100000
|
||||||
|
111100
|
||||||
|
000010
|
||||||
|
111100
|
||||||
|
000000
|
||||||
|
|
||||||
|
011100
|
||||||
|
100000
|
||||||
|
111100
|
||||||
|
100010
|
||||||
|
011100
|
||||||
|
000000
|
||||||
|
|
||||||
|
111110
|
||||||
|
000010
|
||||||
|
000100
|
||||||
|
001000
|
||||||
|
001000
|
||||||
|
000000
|
||||||
|
|
||||||
|
011100
|
||||||
|
100010
|
||||||
|
011100
|
||||||
|
100010
|
||||||
|
011100
|
||||||
|
000000
|
||||||
|
|
||||||
|
011100
|
||||||
|
100010
|
||||||
|
011110
|
||||||
|
000010
|
||||||
|
011100
|
||||||
|
000000
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
FONT.PRJ ! This file
|
||||||
|
!
|
||||||
|
READ.ME ! About the \sibosdk\font directory
|
||||||
|
!
|
||||||
|
! ===================
|
||||||
|
! Sample font sources
|
||||||
|
!
|
||||||
|
NORM.FSC ! A 'normal' font
|
||||||
|
BOLD.FSC ! A bolded version of the above
|
||||||
|
DIGIT.FSC ! The Series 3 'digits' font
|
||||||
|
DIARY.FSC ! The Series 3 Agenda special character font
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
|||||||
|
This directory contains demonstration font source (.fsc) files.
|
||||||
|
|
||||||
|
Use the program wsfcomp.exe to generate font (.fon) files. For example,
|
||||||
|
to compile diary.fsc, producing diary.fon, just type:
|
||||||
|
|
||||||
|
wsfcomp diary
|
||||||
|
|
||||||
|
See FONT.PRJ (a plain text file) for an annotated list of the files in
|
||||||
|
this directory.
|
||||||
|
|
||||||
|
A font source file contains a header section followed by patterns
|
||||||
|
which make up the font, as in the following extract from the
|
||||||
|
beginning of a font source file:
|
||||||
|
|
||||||
|
*name System mono
|
||||||
|
*descent 2
|
||||||
|
*height 10
|
||||||
|
*maxwid 7
|
||||||
|
*flag ascii
|
||||||
|
*flag cp850
|
||||||
|
|
||||||
|
*char 28
|
||||||
|
|
||||||
|
100000000000
|
||||||
|
100001100000
|
||||||
|
100001100000
|
||||||
|
101111111100
|
||||||
|
100111111000
|
||||||
|
110011110111
|
||||||
|
000001100000
|
||||||
|
000000000000
|
||||||
|
111111111111
|
||||||
|
100000000000
|
||||||
|
|
||||||
|
0000000
|
||||||
|
0000000
|
||||||
|
0001000
|
||||||
|
0001100
|
||||||
|
1111110
|
||||||
|
1111110
|
||||||
|
0001100
|
||||||
|
0001000
|
||||||
|
0000000
|
||||||
|
0000000
|
||||||
|
|
||||||
|
0000000
|
||||||
|
0000011
|
||||||
|
0000011
|
||||||
|
0010011
|
||||||
|
0110011
|
||||||
|
1111111
|
||||||
|
1111111
|
||||||
|
0110000
|
||||||
|
0010000
|
||||||
|
0000000
|
||||||
|
|
||||||
|
The keywords have the following meanings:
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
*name The font name (maximum length 16 characters)
|
||||||
|
|
||||||
|
*descent <n> The descent for the font
|
||||||
|
|
||||||
|
*height <n> The height for the font
|
||||||
|
|
||||||
|
*maxwid <n> Not the real maximum width, but the width of the
|
||||||
|
widest normal character
|
||||||
|
|
||||||
|
*flag Some informational flags
|
||||||
|
|
||||||
|
*char <n> Skip all characters up to the specified code.
|
||||||
|
Character codes start at 0 and follow sequentially
|
||||||
|
until the next *char statement
|
||||||
|
|
||||||
|
The keyword "*special 1" may also be present, to specify a font
|
||||||
|
suitable for "fast" blitting onto the screen. If present, this
|
||||||
|
keyword must come before the *height statement. ("Fast" fonts must
|
||||||
|
have all their widths less than 9 pixels.)
|
||||||
|
|
||||||
|
If the height of a character defined is less than that defined in the
|
||||||
|
header, blank rows are added at the top.
|
||||||
|
|
||||||
|
Possible values for "*flag" (each one defined on its own line) are
|
||||||
|
"ascii", "cp850", "bold", "italic", and "serif".
|
||||||
|
|
||||||
|
For more details about fonts, see the 'Text fonts' sections of both
|
||||||
|
the 'Introduction' and 'Graphics Output' chapters of the WSERV
|
||||||
|
Reference manual.
|
||||||
|
|
||||||
|
Note that only the first letter of keywords and flagnames is
|
||||||
|
significant. Thus "*max_width" and "*maxwid" have the same effect.
|
||||||
|
|
||||||
|
One tip when editing .fsc files is to temporarily change all '1's
|
||||||
|
into graphics square characters (ascii 219, say), and all '0's into
|
||||||
|
dots. Then change them back when you're finished.
|
||||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user