build: add the SIBO SDK

This commit is contained in:
2026-07-06 18:01:36 +01:00
parent d76326729c
commit 64e484448c
757 changed files with 97167 additions and 0 deletions
+446
View File
@@ -0,0 +1,446 @@
title ATIMDVR -- Attached timer device driver example
subttl Copyright (c) Psion PLC 1991
name ATIMDVR
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 1.00A 01/02/92 JH Alpha release
;
TURBOC equ 1
;
include epocdef.inc
include epocmac.inc
include epocpan.inc
include epoclib.inc
include epocser.inc
HandlerDisable equ 000h ; the hnadler should not be called
HandlerEnable equ 001h ; the handler should be called
;
TimerEnt struc
TimerIo ChanEnt <> ; I/O device driver hdr
ReadRq RqEnt <> ; read request info
ReadStat dw ? ; read completion status
InStrategy dw ? ; internal control
WaitHandler dw ? ; wait handler handle
TimerChan dw ? ; open timer channel handle
Timeout dd ? ; read timout
TimerStat dw ? ; timer completion status
TimerEnt ends
CodeSeg
ProcBegin@ AttachedTimerLDD
; =================
; The externally loadable Attached timer device table
dw LDDSignature
db 'ATM',0,0,0,0,0
dw (VectorEnd-Vector)/2
Vector:
dw AttachedTimerInstall
dw AttachedTimerRemove
dw AttachedTimerHold
dw AttachedTimerResume
dw AttachedTimerReset
dw AttachedTimerUnits
dw AttachedTimerOpen
dw AttachedTimerStrategy
VectorHandler:
dw AttachedTimerHandler
VectorEnd:
ProcEnd noret
ProcBegin@ AttachedTimerInstall,far
; =====================
; Called on device installation by the operating system
;
clc ; installed OK
ret
ProcEnd noret
ProcBegin@ AttachedTimerRemove,far
; ====================
; Always allow to be removed.
;
clc ; removed ok.
ret
ProcEnd noret
ProcBegin@ AttachedTimerHold,far
; ==================
; This does not need to do anything.
;
ret
ProcEnd noret
ProcBegin@ AttachedTimerResume,far
; ====================
; This does not need to do anything.
;
ret
ProcEnd noret
ProcBegin@ AttachedTimerReset,far
; ===================
; This will never be called since we dont request it to be called.
; The lower level driver and timer driver will handle the process
; terminating abnormally.
;
ProcEnd noret
ProcBegin@ AttachedTimerUnits,far
; ===================
; Called by device query units operating system service
;
mov ax, -1 ; supports many open requests
ret
ProcEnd noret
ProcBegin@ AttachedTimerOpen,far
; ==================
; Called by the IoOpen system service
;
; In:
; DX - device handle
; SI - ptr to OpenEnt struct
; Out:
; Carry clear
; BX - open channel handle
; DX - device handle as passed
; Carry set
; AL - error number
; DX - device handle as passed
;
cld
mov cx, (size TimerEnt)
HeapAllocateCell
jc endOpen ; return that error
mov bx, ax
; Initialise the allocated cell to zero.
mov di, ax
shr cx, 1 ; alloc cells should be even no of bytes.
xor ax, ax
rep stosw ; initialize all struct to zero
; Add the waithandler function
mov al, (VectorHandler-Vector)/2
IoAddHandler
jc freeCellExit ; report the add handler error
mov [bx].WaitHandler, ax ; handler handle
; Open a timer channel
push bx ; save the alloc cell handle
mov cx, sp ; save SP for now
xor ax, ax
push ax
mov ax, ':' shl 8 + 'M'
push ax
mov ax, 'I' shl 8 + 'T'
push ax
mov bx, sp ; BX is pointer to name to 'TIM:'
IoOpen ; CX and DX are irrelvant for a timer
mov sp, cx
pop bx
jc freeHandlerExit ; report the timer open error.
mov [bx].TimerChan, ax
; Set up the channel header
mov [bx].ChanSignature, IoChanSignature
mov [bx].ChanLibHandle, dx
mov [bx].ChanNext, bx ; were a root driver for now
; Attach this driver to the currently open driver Hierarchy
mov cx, bx ; channel were attaching
mov al, IoFuncAttach
mov bx, [si].OpenChan ; driver to attach to
IoWithWait
clc ; return BX (ie what attached to)
; Finished the open request
endOpen:
ret
; An error has occured, free the handler then cell in BX and return an error
freeHandlerExit:
push ax
push bx
mov bx, [bx].WaitHandler
IoRemoveHandler
pop bx
pop ax
; An error has occured, free the cell in BX and return an error
freeCellExit:
push ax
HeapFreeCell
pop ax ; AL has the error code
stc
ret
ProcEnd noret
ProcBegin@ StrategyVectorTable
; ===================
; The strategy vector jump table
;
dw StrategyDefault ; IoFuncPanic
dw StrategyRead ; IoFuncRead
dw StrategyDefault ; IoFuncWrite
dw StrategyClose ; IoFuncClose
dw StrategyCancel ; IoFuncCancel
dw StrategyDefault ; IoFuncAttach
dw StrategyDefault ; IoFuncDetach
dw StrategySet ; IoFuncSet
dw StrategySense ; IoFuncSense
StrategyVectorEnd:
ProcEnd noret
ProcBegin@ CancelTimer
; ===========
; Cancel the outstanding timer request
; In:
; BX = TimerEnt ptr
; Out:
; NONE
;
push bx
mov bx, [bx].TimerChan
mov al, IoFuncCancel ; cancel the queued timer
IoWithWait
pop bx
lea di, [bx].TimerStat
IoWaitForStatus ; use up completion signal
ret
ProcEnd noret
ProcBegin@ CancelRead
; ==========
; Cancel the outstanding read request on the lower driver
; In:
; BX = TimerEnt ptr
; Out:
; NONE
;
mov al, IoFuncCancel ; cancel the queued read
IoWithWait
lea di, [bx].ReadStat
IoWaitForStatus ; use up completion signal
ret
ProcEnd noret
ProcBegin@ SignalReadAX
; ============
; Complete the orignal read request with the completion status in AX
; In:
; AX = completion status to report
; BX = control block ptr as allocated by open
; Out:
; NONE
;
xor di, di ; complete the original read request
xchg di, [bx].ReadRq.RqStatusPtr
mov word ptr [di], ax
IoSignal
ret
ProcEnd noret
ProcBegin@ CancelAnyRequests
; =================
; Cancel any outstanding attached driver and timer requests.
; In:
; BX = control block ptr as allocated by open
; Out:
; NONE
;
cmp [bx].ReadRq.RqStatusPtr, 0
je noRequestsQueued
call CancelRead
call CancelTimer
push bx
mov bx, [bx].WaitHandler
mov cl, HandlerDisable
IoEnableHandler
pop bx
mov ax, CancelErr
call SignalReadAX
noRequestsQueued:
ret
ProcEnd noret
ProcBegin@ AttachedTimerStrategy,far
; =====================
; Called by the applications I/O services.
; In:
; BX = control block ptr as allocated by open
; SI = RqEnt pointer
; Out:
; Carry clear
; The request was sucessfully queued, (may have completed)
; Carry set
; The request failed to start
;
cld
mov [bx].InStrategy, 1 ; anti nesting
mov di, [si].RqStatusPtr
mov word ptr [di], PendingErr ; request now pending
mov ax, di ; pre-load AX
mov di, [si].RqFunction
cmp di, (StrategyVectorEnd-StrategyVectorTable)/2
ja StrategyDefault
mov cx, [si].RqA1Ptr ; pre-load CX and DX
mov dx, [si].RqA2Ptr
shl di, 1 ; vector table entry
jmp word ptr cs:StrategyVectorTable[di]
; This device driver does not handle this function, pass it up the driver
; hierarchy to a driver that may support this function.
StrategyDefault:
mov [bx].InStrategy, 0
IoSuper ; pass request to next dvr
ret
StrategyRead:
cmp [bx].ReadRq.RqStatusPtr, 0
jne panicPending ; already a read queued
mov [bx].ReadRq.RqStatusPtr, ax
mov [bx].ReadRq.RqA1Ptr, cx
mov [bx].ReadRq.RqA2Ptr, dx
lea di, [bx].ReadStat ; Q an attached dvr read
mov al, IoFuncRead
IoAsynchronousNoError ; Queue a read on lower dvr
lea di, [bx].TimerStat
lea cx, [bx].Timeout
push bx
push [bx].WaitHandler
mov bx, [bx].TimerChan
mov al, IoFuncRead
IoAsynchronousNoError ; Queue a read on the timer channel
; now let the wait handler be callable
pop bx
mov cl, HandlerEnable
IoEnableHandler
pop bx
and [bx].InStrategy, 0
clc
ret
; The process is making a 2nd call of a function that is already outstanding.
panicPending:
mov al, PanicIoPending
ProcPanic ; stop calling process.
StrategyCancel:
call CancelAnyRequests
and [bx].InStrategy, 0
jmp short completeRequestOk
; This driver defines the IoFuncSet function to set the read timout.
StrategySet:
mov di, cx ; RqA1Ptr is a pointer to a long
mov ax, [di]
mov word ptr [bx].Timeout, ax
mov ax, [di+2]
mov word ptr [bx+2].Timeout, ax
and [bx].InStrategy, 0
jmp short completeRequestOk
; This driver defines the IoFuncSense function to sense the read timout.
StrategySense:
mov di, cx ; RqA1Ptr is a pointer to a long
mov ax, word ptr [bx].Timeout
mov word ptr [di], ax
mov ax, word ptr [bx+2].Timeout
mov word ptr [di+2], ax
completeRequestOk:
mov di, [si].RqStatusPtr
and word ptr [di], 0 ; complete request OK.
IoSignal
and [bx].InStrategy, 0
clc
ret
StrategyClose:
call CancelAnyRequests
push bx
push [bx].WaitHandler
mov bx, [bx].TimerChan
IoClose ; close the timer
pop bx
IoRemoveHandler ; remove the waithandler
pop bx
mov al, IoFuncDetach ; detach from lower driver
IoWithWait
HeapFreeCell ; alloc cell freed !!!
mov di, [si].RqStatusPtr
and word ptr [di], 0 ; complete request OK.
IoSignal
clc
ret
ProcEnd noret
ProcBegin@ AttachedTimerHandler,far
; ====================
; Called by the operating system when the applications I/O semaphore has
; been signalled. See if its one of our requests that have been completed.
; The operating system will automatically stop any nesting if it called this
; handler, however we will get called if we are in the strategy vector and
; use synchronous I/O requests. The driver has set itself up such that this
; will only ever be called if there is an outstanding request by only
; enabling the handler when a read request is received.
;
; In:
; BX = as passed to IoAddHandler
; Out:
; Carry clear
; The signal was not for us.
; Carry set
; AL = 0 - we used signal, allow handler to be disabled.
; AL = 1 - we used signal, keep the handler enabled.
;
cmp [bx].InStrategy, 1
jne notInAttachedTimerStrategy
signalNotForThisDriver:
clc ; get out as fast as possible
ret ; as event definatly not for us.
notInAttachedTimerStrategy:
cmp [bx].ReadStat, PendingErr
je readRequestNotComplete
; The read request has completed.
call CancelTimer
mov ax, [bx].ReadStat ; read completion result
jmp short signalAXdisableHandler
readRequestNotComplete:
cmp [bx].TimerStat, PendingErr
je signalNotForThisDriver
; The timer request has completed.
call CancelRead
mov ax, InActivityErr ; read inactivity on timeout
signalAXdisableHandler:
call SignalReadAX
xor al, al ; we used signal
stc ; handler now disabled.
ret
ProcEnd noret
EndCodeSeg
;
stack segment stack para 'data'
;
stack ends
;
end AttachedTimerLDD
+731
View File
@@ -0,0 +1,731 @@
.xlist
; Include file - EPOCDEF.INC
; Epoc/Os standard definitions include file
; Copyright (c) Psion PLC 1989-91.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 NSM Final release
; 2.12F 08/05/91 NSM Final release
;
EPOCDEF_INC = 1
;
Sibo = 0
S3b = 0
S3c = 0
S3d = 0
S3r = 0
S39 = 0
S3 = 0
S3Pc = 0
Vine = 0
Prot = 0
Asic1 = 1
Asic9 = 0
HandHeld = 0
LapTop = 1
IbmPc = 1
RomServer = 0
McLink = 0
Consumer = 0
Corporate = 0
Dpmi = 0
TickTock = 0
DoubleSpeed = 0
Condor = 0
OvalDisable = 0
S3cExtra = 0
ifdef BUILDPH
S3Pc = 1
endif
ifdef BUILDDL
Dpmi = 1
endif
ifdef BUILDHH
S3 = 1
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
Consumer = 1
TickTock = 1
endif
ifdef BUILDSB
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
Consumer = 1
S3b = 1
S39 = 1
Asic1 = 0
Asic9 = 1
TickTock = 1
endif
ifdef BUILDSC
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
S3c = 1
S39 = 1
Asic1 = 0
Asic9 = 1
TickTock = 1
endif
ifdef BUILDWA
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
S3c = 1
S39 = 1
Asic1 = 0
Asic9 = 1
TickTock = 1
S3cExtra = 1
endif
ifdef BUILDSR
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
Consumer = 1
S3b = 1
S39 = 1
Asic1 = 0
Asic9 = 1
TickTock = 1
S3r = 1
endif
ifdef BUILDVN
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
Consumer = 1
S3b = 1
S39 = 1
Asic1 = 0
Asic9 = 1
TickTock = 1
Vine = 1
Condor = 1
endif
ifdef BUILDPT
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
Consumer = 1
S3b = 1
S39 = 1
Asic1 = 0
Asic9 = 1
Prot = 1
TickTock = 1
DoubleSpeed = 1
endif
ifdef BUILDSD
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
Consumer = 1
S3b = 1
S39 = 1
Asic1 = 0
Asic9 = 1
TickTock = 1
Condor = 1
S3d = 1
OvalDisable = 1
endif
ifdef BUILDCH
Sibo = 1
HandHeld = 1
LapTop = 0
IbmPc = 0
Corporate = 1
TickTock = 1
endif
ifdef BUILDLT
Sibo = 1
IbmPc = 0
endif
ifdef BUILDRM
RomServer = 1
endif
ifdef BUILDMC
McLink = 1
endif
;
PriorityForeground = 080h
PriorityBackground = 070h
;
LcdUnknown = -1
Lcd640X400 = 0
Lcd640X200Small = 1
Lcd640X200Big = 2
Lcd720X348 = 3
Lcd160X80 = 4
Lcd240X80 = 5
;
PcHerc = Lcd720X348
PcCga = Lcd640X200Big
PcMda = 6
PcEgaMono = 7
PcEgaColour = 8
PcVgaMono = 9
PcVgaColour = 10
;
Lcd480X160 = 11
Lcd240X100 = 12
Lcd240X120 = 13
Lcd240X160 = 14
Lcd640X200 = 15
Lcd640X240 = 16
;
OldPsu = 0
MaximPsu = 1
PanPsu = 2
PanA9Psu = 3
BatteryUnknown = 0
BatteryAlkaline = 1
BatteryNicad600 = 2
BatteryNicad1000 = 3
BatteryNicad500 = 4
BatteryNicad850 = 5
;
IsAColdStart = 0
IsAPowerFailStart = 1
IsAResetStart = 2
IsAKernelFault = 3
IsANewOsStart = 4
;
HwInt0Revector = 0
HwInt1Revector = 1
HwInt2Revector = 2
HwInt3Revector = 3
HwInt4Revector = 4
HwIrq0Revector = 5
HwIrq1Revector = 6
HwIrq2Revector = 7
HwIrq3Revector = 8
HwIrq4Revector = 9
HwIrq5Revector = 10
HwIrq6Revector = 11
HwIrq7Revector = 12
;
if IbmPc
TicksPerSecond = 18
endif
if Sibo
TicksPerSecond = 32
endif
FileSystemNameSize = 5
MaxDeviceSize = 8
MaxNameSize = 8
MaxExtSize = 4
MaxNameESize = (MaxNameSize+MaxExtSize)
MaxPathSize = 080h
DeviceSeparator = ':'
ExtSeparator = '.'
MatchAny = '*'
MatchSingle = '?'
MaxErrorTextSize = 64
MaxNotifyTextSize = 64
MaxOptionTextSize = 16
MaxDayName = 32
MaxMonthName = MaxDayName
MaxSuffixes = 31
MaxCommandBuffer = 127
PidMask = 0fffh
MaxEnvNameSize = 16
MaxAlarms = 2
MaxPassword = 8
BackLightDisable = 8000h
BackLightOff = 0
BackLightOn = 1
BackLightToggle = 2
BackLightQuery = 3
FrcCounting = 0
FrcRepeating = 1
;
SoundKeyboardEnable = 00001h
SoundBuzzerEnable = 00002h
SoundDeviceEnable = 00004h
SoundLoud = 00008h
SoundLoudBuzzer = 00010h
SoundDisable = 08000h
SoundMaxVolume = 0
SoundMinVolume = 5
SoundMaxBpm = 240
SoundMinBpm = 2
;
DiskAPresent = 0000000000000001b
DiskAActive = 0000000000000010b
DiskBPresent = 0000000000000100b
DiskBActive = 0000000000001000b
DiskCPresent = 0000000000010000b
DiskCActive = 0000000000100000b
DiskDPresent = 0000000001000000b
DiskDActive = 0000000010000000b
PortAOpen = 0000000100000000b
PortAActive = 0000001000000000b
PortBOpen = 0000010000000000b
PortBActive = 0000100000000000b
PortCOpen = 0001000000000000b
PortCActive = 0010000000000000b
MainsInactive = 0100000000000000b
CondorActive = 1000000000000000b
;
CPBInRom = 0
CPBInRam = 1
CPBMaxPriority = 0c0h
CPBMinPriority = 040h
MaxHeapGrowBy = 0400h
HeapGrowByDefault = 080h
MaxProcesses = 018h
;
CreateSegmentLow = 0
CreateSegmentHigh = 1
CreateSegmentDevice = 2
CreateSegmentLocked = 3
;
DevFuncInstall = 000h
DevFuncRemove = 001h
DevFuncHold = 002h
DevFuncResume = 003h
DevFuncReset = 004h
DevFuncUnits = 005h
DevFuncOpen = 006h
DevFuncStrategy = 007h
;
DevHoldNormal = 000h
DevHoldPowerDown = 001h
DevHoldPowerFail = 002h
;
DevFuncInstallPDD = DevFuncInstall
DevFuncRemovePDD = DevFuncRemove
DevFuncOpenPDD = (DevFuncRemovePDD+1)
DevFuncStrategyPDD = (DevFuncOpenPDD+1)
; Generic I/O r=ests
IoFuncPanic = 000h
IoFuncRead = 001h
SoundChannel1 = IoFuncRead
TimerRelative = IoFuncRead
IoFuncWrite = 002h
SoundChannel2 = IoFuncWrite
TimerAbsolute = IoFuncWrite
IoFuncClose = 003h
IoFuncCancel = 004h
IoFuncAttach = 005h
IoFuncDetach = 006h
IoFuncSet = 007h
IoFuncSense = 008h
IoFuncFlush = 009h
IoFuncAlarm = IoFuncFlush
; The File System
IoFuncSeek = 00ah
IoFuncDial = IoFuncSeek
IoFuncSetEof = 00bh
; Data Link I/O + Wserv
IoFuncConnect = 00ah
IoFuncDisconnect = 00bh
; Wserv functions
IoFuncWriteReply = 00ch
; Serial/llmac
IoFuncTest = 00ah
IoFuncControl = 00bh
IoFuncInquire = 00ch
IoFuncSuperFrame = 00dh
IoFuncStop = 00eh
IoFuncStart = 00fh
; Serial LDD to Serial PDD I/O defines
IoFuncEnable = 010h
IoFuncSetDevice = 011h
; Modem driver functions
IoFuncModemInit = 010h
IoFuncModemDial = 011h
IoFuncModemWaitCall = 012h
IoFuncModemSense = 013h
IoFuncModemSet = 014h
IoFuncModemCancel = 015h
IoFuncModemWrite = 016h
; For 3B sound device
IoSoundPlay = 010h
IoSoundRecord = 011h
IoSoundPlayO = 012h
;
ModeOpen = 00000h
ModeCreate = 00001h
ModeReplace = 00002h
ModeAppend = 00003h
ModeUnique = 00004h
;
ModeStream = 00000h
ModeStreamText = 00010h
ModeText = 00020h
ModeDir = 00030h
ModeFormat = 00040h
ModeDevice = 00050h
ModeNode = 00060h
;
ModeUpdate = 00100h
ModeRandom = 00200h
ModeShare = 00400h
;
ModeLowDensity = 01000h
;
ModeServiceMask = 0000fh
ModeFormatMask = 000f0h
ModeAccessMask = 00f00h
;
SeekAddress = 00h
SeekFromStart = 01h
SeekFromEnd = 02h
SeekFromCurrent = 03h
SeekRecordSense = 04h
SeekRecordSet = 05h
SeekRewind = 06h
;
FileAttWrite = 00001h
FileAttHidden = 00002h
FileAttSystem = 00004h
FileAttVolume = 00008h
FileAttDirectory = 00010h
FileAttModified = 00020h
FileAttRead = 00100h
FileAttExecute = 00200h
FileAttStream = 00400h
FileAttText = 00800h
;
FileChangeDirRoot = 0
FileChangeDirParent = 1
FileChangeDirSubdir = 2
;
FileStatusEnt struc
FileVersionNo dw ?
FileAtt dw ?
FileSize dd ?
FileModDate dd ?
FileSpare db 4 dup (?)
FileStatusEnt ends
;
MaxVolumeName = 32
FileMediaUnknown = 0
FileMediaFloppy = 1
FileMediaHardDisk = 2
FileMediaFlash = 3
FileMediaRam = 4
FileMediaRom = 5
FileMediaWriteProtected = 6
FileMediaCompressible = 08000h
FileMediaDynamic = 04000h
FileMediaInternal = 02000h
FileMediaDualDensity = 01000h
FileMediaFormattable = 00800h
;
DeviceStatusEnt struc
DeviceVersionNo dw ?
DeviceMediaType dw ?
DeviceIsRemovable dw ?
DeviceStatusSize dd ?
DeviceStatusFree dd ?
DeviceStatusName db MaxVolumeName dup (?)
DeviceBatteryState dw ?
DeviceSpare db 16 dup (?)
DeviceStatusEnt ends
;
FileNodeFlat = 0
FileNodeHierarchical = 1
;
NodeStatusEnt struc
NodeVersionNo dw ?
NodeType dw ?
NodeSupportsFormat dw ?
NodeStatusSpare db 26 dup (?)
NodeStatusEnt ends
;
FileBlockShift = 9
FileBlockSize = 00200h
FileMaxRecordSize = 00100h
FileMaxStreamSize = 04000h
;
JustifyLeft = 0
JustifyRight = 1
JustifyCentre = 2
;
ParseWildAny = 00001h
ParseWildName = 00002h
ParseWildExt = 00004h
;
DtobTypeFixed = 00h
DtobTypeExponent = 01h
DtobTypeGeneral = 02h
DtobMaxExponent = 99
DtobGenLimit = 40h
FloatSignificantDigits = 15
;
DtobEnt struc
DtobType db ?
DtobWidth db ?
DtobNdec db ?
DtobPoint db ?
DtobTriad db ?
DtobTrilen db ?
DtobEnt ends
;
FullParseEnt struc
FullParseSystem db ?
FullParseDevice db ?
FullParsePath db ?
FullParseName db ?
FullParseExt db ?
FullParseFlags db ?
FullParseEnt ends
;
GenParseEnt struc
GenParseSourceNamePtr dw ?
GenParseRelatedNamePtr dw ?
GenParseDefaultsPtr dw ?
GenParseTargetNamePtr dw ?
GenParseInfoPtr dw ?
GenParseDeviceSeparator db ?
GenParsePathSeparator db ?
GenParseExtSeparator db ?
GenParseMaxDeviceSize db ?
GenParseMaxPathSize db ?
GenParseMaxNameSize db ?
GenParseMaxExtSize db ?
GenParseDummy db ?
GenParseEnt ends
;
CDataEnt struc
CDataCountryCode dw ?
CDataGmtOffset dw ?
CDataDateType db ?
CDataTimeType db ?
CDataCurrencySymbolPosition db ?
CDataCurrencySpaceRequired db ?
CDataCurrencyDecimalPlaces db ?
CDataCurrencyNegativeInBrackets db ?
CDataCurrencyTriadsAllowed db ?
CDataThousandsSeparator db ?
CDataDecimalSeparator db ?
CDataDateSeparator db ?
CDataTimeSeparator db ?
CDataCurrencySymbol db 9 dup(?)
CDataStartOfWeek db ?
CDataSummerTime db ?
CDataClockType db ?
CDataDayAbbreviation db ?
CDataMonthAbbreviation db ?
CDataWorkDays db ?
CDataUnits db ?
CDataEscCharacter db ?
CDataSpare db 8 dup(?)
CDataEnt ends
;
DyScEnt struc
DyScDays dw 2 dup(?)
DyScSeconds dw 2 dup(?)
DyScEnt ends
;
DateEnt struc
DateYear db ?
DateMonth db ?
DateDay db ?
DateHour db ?
DateMinute db ?
DateSecond db ?
DateYearDay dw ?
DateEnt ends
;
MessEnt struc
MessNext dw ?
MessStatusPtr dw ?
MessType dw ?
MessPid dw ?
MessEnt ends
;
CPBlock struc
CPBCodeParas dw ?
CPBInitialIp dw ?
CPBStackParas dw ?
CPBDataParas dw ?
CPBHeapParas dw ?
CPBCommandLine dw ?
CPBChecksum dw ?
CPBMinHeap dw ?
CPBPriority db ?
CPBRamOrRom db ?
CPBName db ?
CPBlock ends
;
IoChanSignature = 01101h
IoHandlerSignature = 01121h
DbfChanSignature = 01141h
LIBChanSignature = 01161h
LDDSignature = 0dd01h
PDDSignature = 0dd21h
LIBSignature = 0dd41h
VectorInfoSize = 8
;
LibEnt struc
LibSignature dw ?
LibInfo db VectorInfoSize dup(?)
LibCount dw ?
LibBase dw ?
LibEnt ends
;
OpenEnt struc
OpenNamePtr dw ?
OpenMode dw ?
OpenChan dw ?
OpenEnt ends
;
RqEnt struc
RqFunction dw ?
RqA1Ptr dw ?
RqA2Ptr dw ?
RqStatusPtr dw ?
RqEnt ends
;
ChanEnt struc
ChanSignature dw ?
ChanNext dw ?
ChanLibHandle dw ?
ChanEnt ends
;
SndEnt struc
SndBeatsPerMinute db ?
SndVolume db ?
SndEnt ends
;
PassEnt struc
PassData db (MaxPassword*2) dup(?)
PassPos dw ?
PassEnt ends
;
IntEnt struc
IntFrame dw ?
IntBP dw ?
IntES dw ?
IntDS dw ?
IntPC dw ?
IntCS dw ?
IntFLAGS dw ?
IntEnt ends
;
DataEnt struc
DataWordDead dw ?
DataHandNext dw ?
DataHandPrev dw ?
DataCountrySeg dw ?
DataClassHandle dw ?
DataClassPtr dw ?
DataEClassHandle dw ?
DataEClassPtr dw ?
DataEnterFramePtr dw ?
Dataw_ws dw ?
Dataw_am dw ?
DatawClientData dw ?
Datawserv_channel dw ?
DataT dw ?
Datar dw ?
DataOsFramePtr dw ?
DataATFlag db ?
DataHeapLocked db ?
DataProcessNamePtr dw ?
DataCommandPtr dw ?
DataTest dw ?
DataApp1 dw ?
DataApp2 dw ?
DataApp3 dw ?
DataApp4 dw ?
DataApp5 dw ?
DataApp6 dw ?
DataApp7 dw ?
DataDialogPtr dw ?
DataGate dw ?
DataLocked dw ?
DataStatusNamePtr dw ?
DataUsedPathNamePtr dw ?
DataEnt ends
;
; Major exit error numbers
KillExit = 0
PanicExit = 1
TaskPanicExit = 2
; Minor exit error numbers
NoErr = 0
FailErr = -1
ArgumentErr = -2
OsErr = -3
NotSupportedErr = -4
UnderflowErr = -5
OverflowErr = -6
RangeErr = -7
DivideByZeroErr = -8
InUseErr = -9
NoMemoryErr = -10
IoAllocErr = NoMemoryErr
NoSegmentsErr = -11
NoSemaphoreErr = -12
NoProcessErr = -13
AlreadyOpenErr = -14
NotOpenErr = -15
ImageErr = -16
NoReceiverErr = -17
NoDevicesErr = -18
NoFileSystemErr = -19
FailedToStartErr = -20
FontNotLoadedErr = -21
TooWideErr = -22
TooManyItemsErr = -23
BatLowSoundErr = -24
BatLowFlashErr = -25
BatLowIRDAErr = -26
;
ExistsErr = -32
NotExistsErr = -33
WriteErr = -34
ReadErr = -35
EofErr = -36
FullErr = -37
NameErr = -38
AccessErr = -39
LockedErr = -40
DeviceErr = -41
DirErr = -42
RecordErr = -43
ReadOnlyErr = -44
IoInvalidErr = -45
PendingErr = -46
VolumeErr = -47
CancelErr = -48
ReservedErr = -49
DisconnectErr = -50
ConnectErr = -51
ReTransmitErr = -52
LineErr = -53
InActivityErr = -54
ParityErr = -55
FrameErr = -56
OverrunErr = -57
ModemConnectErr = -58
ModemBusyErr = -59
ModemNoAnswerErr = -60
ModemBlacklistErr = -61
NotReadyErr = -62
UnknownErr = -63
DirFullErr = -64
WriteProtectErr = -65
CorruptMediaErr = -66
AbortErr = -67
EraseErr = -68
InvalidFileErr = -69
.list
+284
View File
@@ -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
+512
View File
@@ -0,0 +1,512 @@
.xlist
; Include file - EPOCMAC.INC
; Epoc/Os standard OS macro call definitions include file
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 NSM Final release
; 2.01F 25/03/91 NSM Added a number of extra functions.
;
EPOCMAC_INC equ 1
;
__IntBase = 080h
;
BeginInterrupt macro __Name,__VIntBase
__IntVector = 0
__Name macro
int __VIntBase
endm
IntEntry macro __EntName,__VIntVector
ifdef __DeclareNames
Nm&&__EntName = __VIntVector
endif
__EntName macro
mov ah, __VIntVector
int __VIntBase
endm
__IntVector = __IntVector+1
endm
__IntBase = __IntBase+1
endm
;
BeginInterrupt SegManager,%__IntBase
IntEntry SegFreeMemory,%__IntVector
IntEntry SegCreate,%__IntVector
IntEntry SegDelete,%__IntVector
IntEntry SegOpen,%__IntVector
IntEntry SegClose,%__IntVector
IntEntry SegSize,%__IntVector
IntEntry SegAdjustSize,%__IntVector
IntEntry SegFind,%__IntVector
IntEntry SegCopyTo,%__IntVector
IntEntry SegCopyFrom,%__IntVector
IntEntry SegLock,%__IntVector
IntEntry SegUnLock,%__IntVector
IntEntry SegRamDiskUsed,%__IntVector
IntEntry SegCloseLockedOrDevice,%__IntVector
IntEntry SegTotalK,%__IntVector
;
BeginInterrupt HeapManager,%__IntBase
IntEntry HeapAllocateCell,%__IntVector
IntEntry HeapReAllocateCell,%__IntVector
IntEntry HeapAdjustCellSize,%__IntVector
IntEntry HeapFreeCell,%__IntVector
IntEntry HeapCellSize,%__IntVector
IntEntry HeapSetGranularity,%__IntVector
IntEntry HeapFreeMemory,%__IntVector
;
BeginInterrupt SemManager,%__IntBase
IntEntry SemCreate,%__IntVector
IntEntry SemDelete,%__IntVector
IntEntry SemWait,%__IntVector
IntEntry SemSignalOnce,%__IntVector
IntEntry SemSignalMany,%__IntVector
IntEntry SemSignalOnceNoReSched,%__IntVector
;
BeginInterrupt MessManager,%__IntBase
IntEntry MessInit,%__IntVector
IntEntry MessReceiveAsynchronous,%__IntVector
IntEntry MessReceiveWithWait,%__IntVector
IntEntry MessReceiveCancel,%__IntVector
IntEntry MessSend,%__IntVector
IntEntry MessSendReceiveAsynchronous,%__IntVector
IntEntry MessSendReceiveWithWait,%__IntVector
IntEntry MessFree,%__IntVector
IntEntry MessSignal,%__IntVector
IntEntry MessSignalCancel,%__IntVector
IntEntry MessSignalCancelX,%__IntVector
;
BeginInterrupt LibManager,%__IntBase
IntEntry LibLoad,%__IntVector
IntEntry LibUnLoad,%__IntVector
IntEntry LibLink,%__IntVector
IntEntry LibFind,%__IntVector
IntEntry LibHandle,%__IntVector
IntEntry LibCreate,%__IntVector
IntEntry LibCreateByHandle,%__IntVector
IntEntry LibDestroy,%__IntVector
IntEntry LibCopy,%__IntVector
IntEntry LibOpen,%__IntVector
IntEntry LibLoadFile,%__IntVector
IntEntry LibReClass,%__IntVector
IntEntry LibReClassByHandle,%__IntVector
;
BeginInterrupt DevManager,%__IntBase
IntEntry IoOpen,%__IntVector
IntEntry DevOpenPDD,%__IntVector
IntEntry DevGetPDDAddress,%__IntVector
IntEntry DevInstall,%__IntVector
IntEntry DevHold,%__IntVector
IntEntry DevResume,%__IntVector
IntEntry DevLoadLDD,%__IntVector
IntEntry DevLoadPDD,%__IntVector
IntEntry DevDelete,%__IntVector
IntEntry DevQueryUnits,%__IntVector
IntEntry DevFind,%__IntVector
IntEntry DevRemove,%__IntVector
IntEntry DevVector,%__IntVector
;
BeginInterrupt IoManager,%__IntBase
IntEntry IoAsynchronous,%__IntVector
IntEntry IoAsynchronousNoError,%__IntVector
IntEntry IoWithWait,%__IntVector
IntEntry IoRoot,%__IntVector
IntEntry IoSuper,%__IntVector
IntEntry IoWaitForSignal,%__IntVector
IntEntry IoWaitForStatus,%__IntVector
IntEntry IoYield,%__IntVector
IntEntry IoSignal,%__IntVector
IntEntry IoSignalByPid,%__IntVector
IntEntry IoSignalByPidNoReSched,%__IntVector
IntEntry IoAddHandler,%__IntVector
IntEntry IoRemoveHandler,%__IntVector
IntEntry IoEnableHandler,%__IntVector
IntEntry IoRequestReset,%__IntVector
IntEntry IoRequestResetCancel,%__IntVector
IntEntry IoClose,%__IntVector
IntEntry IoRead,%__IntVector
IntEntry IoWrite,%__IntVector
IntEntry IoSeek,%__IntVector
IntEntry IoKeyAndMouseWithWait,%__IntVector
IntEntry IoAddApplicationHandler,%__IntVector
IntEntry IoRemoveApplicationHandler,%__IntVector
IntEntry IoEnableApplicationHandler,%__IntVector
IntEntry IoShiftStates,%__IntVector
IntEntry IoWaitForSignalNoHandler,%__IntVector
IntEntry IoSignalKillAsynchronous,%__IntVector
IntEntry IoSignalKillCancel,%__IntVector
IntEntry IoKeyAndMouseAsynchronous,%__IntVector
IntEntry IoNextHalfSecond,%__IntVector
IntEntry IoPlaySoundA,%__IntVector
IntEntry IoPlaySoundW,%__IntVector
IntEntry IoPlaySoundCancel,%__IntVector
IntEntry IoRecordSoundA,%__IntVector
IntEntry IoRecordSoundW,%__IntVector
IntEntry IoRecordSoundCancel,%__IntVector
IntEntry IoPlaySoundAO,%__IntVector
IntEntry IoPlaySoundWO,%__IntVector
;
BeginInterrupt FilManager,%__IntBase
IntEntry FilConnect,%__IntVector
IntEntry FilExecute,%__IntVector
IntEntry FilParse,%__IntVector
IntEntry FilPathGet,%__IntVector
IntEntry FilPathSet,%__IntVector
IntEntry FilPathTest,%__IntVector
IntEntry FilDelete,%__IntVector
IntEntry FilRename,%__IntVector
IntEntry FilStatusGet,%__IntVector
IntEntry FilStatusSet,%__IntVector
IntEntry FilStatusDevice,%__IntVector
IntEntry FilStatusSystem,%__IntVector
IntEntry FilMakeDirectory,%__IntVector
IntEntry FilOpenUnique,%__IntVector
IntEntry FilSystemAttach,%__IntVector
IntEntry FilSystemDetach,%__IntVector
IntEntry FilPathGetById,%__IntVector
IntEntry FilChangeDirectory,%__IntVector
IntEntry FilSetInitialPath,%__IntVector
IntEntry FilSetFileDate,%__IntVector
IntEntry FilLocChanged,%__IntVector
IntEntry FilLocDevice,%__IntVector
IntEntry FilLocReadPdd,%__IntVector
;
BeginInterrupt ProcManager,%__IntBase
IntEntry ProcId,%__IntVector
IntEntry ProcIdByName,%__IntVector
IntEntry ProcGetPriority,%__IntVector
IntEntry ProcSetPriority,%__IntVector
IntEntry ProcCreate,%__IntVector
IntEntry ProcCreateTask,%__IntVector
IntEntry ProcResume,%__IntVector
IntEntry ProcSuspend,%__IntVector
IntEntry ProcKill,%__IntVector
IntEntry ProcPanicById,%__IntVector
IntEntry ProcNameById,%__IntVector
IntEntry ProcFind,%__IntVector
IntEntry ProcRename,%__IntVector
IntEntry ProcTerminate,%__IntVector
IntEntry ProcOnTerminate,%__IntVector
IntEntry ProcWatchAllExits,%__IntVector
IntEntry ProcGetOwner,%__IntVector
IntEntry ProcKillReason,%__IntVector
;
BeginInterrupt TimManager,%__IntBase
IntEntry TimSleepForTenths,%__IntVector
IntEntry TimSleepForTicks,%__IntVector
IntEntry TimGetSystemTime,%__IntVector
IntEntry TimSetSystemTime,%__IntVector
IntEntry TimSystemTimeToDaySeconds,%__IntVector
IntEntry TimDaySecondsToSystemTime,%__IntVector
IntEntry TimDaySecondsToDate,%__IntVector
IntEntry TimDateToDaySeconds,%__IntVector
IntEntry TimDaysInMonth,%__IntVector
IntEntry TimDayOfWeek,%__IntVector
IntEntry TimNameOfDay,%__IntVector
IntEntry TimNameOfMonth,%__IntVector
IntEntry TimWaitAbsolute,%__IntVector
IntEntry TimWeekNumber,%__IntVector
IntEntry TimNameOfDayAbb,%__IntVector
IntEntry TimNameOfMonthAbb,%__IntVector
;
BeginInterrupt ConvManager,%__IntBase
IntEntry ConvUnsignedIntToBuffer,%__IntVector
IntEntry ConvUnsignedLongIntToBuffer,%__IntVector
IntEntry ConvIntToBuffer,%__IntVector
IntEntry ConvLongIntToBuffer,%__IntVector
IntEntry ConvArgumentsToBuffer,%__IntVector
IntEntry ConvStringToUnsignedInt,%__IntVector
IntEntry ConvStringToUnsignedLongInt,%__IntVector
IntEntry ConvStringToInt,%__IntVector
IntEntry ConvStringToLongInt,%__IntVector
IntEntry ConvFloatToBuffer,%__IntVector
IntEntry ConvStringToFloat,%__IntVector
;
BeginInterrupt GenManager,%__IntBase
IntEntry GenVersion,%__IntVector
IntEntry GenLcdType,%__IntVector
IntEntry GenStartReason,%__IntVector
IntEntry GenParse,%__IntVector
IntEntry LongUnsignedIntRandom,%__IntVector
IntEntry GenGetCountryData,%__IntVector
IntEntry GenGetErrorText,%__IntVector
IntEntry GenGetOsData,%__IntVector
IntEntry GenDeferredMode,%__IntVector
IntEntry GenNotify,%__IntVector
IntEntry GenNotifyError,%__IntVector
IntEntry GenNotifyHook,%__IntVector
IntEntry GenNotifyUnHook,%__IntVector
IntEntry GenGetRamSizeInParas,%__IntVector
IntEntry GenGetCommandLine,%__IntVector
IntEntry GenGetSoundFlags,%__IntVector
IntEntry GenSetSoundFlags,%__IntVector
IntEntry GenSound,%__IntVector
IntEntry GenMarkActive,%__IntVector
IntEntry GenMarkNonActive,%__IntVector
IntEntry GenGetText,%__IntVector
IntEntry GenGetNotifyState,%__IntVector
IntEntry GenSetNotifyState,%__IntVector
IntEntry GenGetAutoSwitchOffValue,%__IntVector
IntEntry GenSetAutoSwitchOffValue,%__IntVector
IntEntry GenSetRevector,%__IntVector
IntEntry GenResetRevector,%__IntVector
IntEntry GenGetLanguageCode,%__IntVector
IntEntry GenGetSuffixes,%__IntVector
IntEntry GenGetAmPmText,%__IntVector
IntEntry GenSetCountryData,%__IntVector
IntEntry GenGetBatteryType,%__IntVector
IntEntry GenSetBatteryType,%__IntVector
IntEntry GenEnvBufferGet,%__IntVector
IntEntry GenEnvBufferSet,%__IntVector
IntEntry GenEnvBufferDelete,%__IntVector
IntEntry GenEnvBufferFind,%__IntVector
IntEntry GenEnvStringGet,%__IntVector
IntEntry GenEnvStringSet,%__IntVector
IntEntry GenEnvStringDelete,%__IntVector
IntEntry GenEnvStringFind,%__IntVector
IntEntry GenCrc,%__IntVector
IntEntry GenRomVersion,%__IntVector
IntEntry GenAlarmHook,%__IntVector
IntEntry GenAlarmUnHook,%__IntVector
IntEntry GenAlarmId,%__IntVector
IntEntry GenPasswordSet,%__IntVector
IntEntry GenPasswordTest,%__IntVector
IntEntry GenPasswordControl,%__IntVector
IntEntry GenPasswordQuery,%__IntVector
IntEntry GenTickle,%__IntVector
IntEntry GenSetConfig,%__IntVector
IntEntry GenMaskInit,%__IntVector
IntEntry GenMaskEncrypt,%__IntVector
IntEntry GenMaskDecrypt,%__IntVector
IntEntry GenSetOnEvents,%__IntVector
IntEntry GenGetAutoMains,%__IntVector
IntEntry GenSetAutoMains,%__IntVector
IntEntry GenCsToDsAlias,%__IntVector
IntEntry GenDsToCsAlias,%__IntVector
IntEntry GenSetCapsLockMode,%__IntVector
;
BeginInterrupt FloatManager,%__IntBase
ifndef SmallInclude
IntEntry FloatSin,%__IntVector
IntEntry FloatCos,%__IntVector
IntEntry FloatTan,%__IntVector
IntEntry FloatASin,%__IntVector
IntEntry FloatACos,%__IntVector
IntEntry FloatATan,%__IntVector
IntEntry FloatExp,%__IntVector
IntEntry FloatLn,%__IntVector
IntEntry FloatLog,%__IntVector
IntEntry FloatSqrt,%__IntVector
IntEntry FloatPow,%__IntVector
IntEntry FloatRand,%__IntVector
IntEntry FloatMod,%__IntVector
IntEntry FloatInt,%__IntVector
endif
;
BeginInterrupt WservOpcodes,%__IntBase
;
BeginInterrupt HardwareManager,%__IntBase
ifndef SmallInclude
IntEntry HwComboOn,%__IntVector
IntEntry HwComboOff,%__IntVector
IntEntry HwPacksOn,%__IntVector
IntEntry HwPacksOff,%__IntVector
IntEntry HwSetA2Control1Bits,%__IntVector
IntEntry HwClearA2Control1Bits,%__IntVector
IntEntry HwReadA2Control1,%__IntVector
IntEntry HwWriteA2Control1,%__IntVector
IntEntry HwSetA2Control2Bits,%__IntVector
IntEntry HwClearA2Control2Bits,%__IntVector
IntEntry HwReadA2Control2,%__IntVector
IntEntry HwWriteA2Control2,%__IntVector
IntEntry HwSetA2Control3Bits,%__IntVector
IntEntry HwClearA2Control3Bits,%__IntVector
IntEntry HwReadA2Control3,%__IntVector
IntEntry HwWriteA2Control3,%__IntVector
IntEntry HwSelectChannel,%__IntVector
IntEntry HwGetSupplyStatus,%__IntVector
IntEntry HwLcdContrastDelta,%__IntVector
IntEntry HwReadLcdContrast,%__IntVector
IntEntry HwSwitchOff,%__IntVector
IntEntry HwNullFrame,%__IntVector
IntEntry HwExit,%__IntVector
IntEntry HwGetCombo,%__IntVector
IntEntry HwFreeCombo,%__IntVector
IntEntry HwGetChannel,%__IntVector
IntEntry HwFreeChannel,%__IntVector
IntEntry HwGetPsuType,%__IntVector
IntEntry HwSupplyWarnings,%__IntVector
IntEntry HwForceSupplyReading,%__IntVector
IntEntry HwGetBackLight,%__IntVector
IntEntry HwSetBackLight,%__IntVector
IntEntry HwBackLight,%__IntVector
IntEntry HwComboOnInput,%__IntVector
IntEntry HwSupplyInfo,%__IntVector
IntEntry HwScreenSeg,%__IntVector
IntEntry HwGetScreenMode,%__IntVector
IntEntry HwSetScreenMode,%__IntVector
IntEntry HwSetPCurrent,%__IntVector
IntEntry HwSetFCurrent,%__IntVector
IntEntry HwGetScanCodes,%__IntVector
IntEntry HwGetSsdData,%__IntVector
IntEntry HwResetBatteryStatus,%__IntVector
IntEntry HwEnableAutoBatReset,%__IntVector
IntEntry HwGetBatData,%__IntVector
IntEntry HwDetectSoakTestFixture,%__IntVector
IntEntry HwReLogPacks,%__IntVector
IntEntry HwSetIRPowerLevel,%__IntVector
IntEntry HwReturnTickCount,%__IntVector
IntEntry HwReturnExpansionPortState,%__IntVector
IntEntry HwExpansionOn,%__IntVector
IntEntry HwExpansionOff,%__IntVector
endif
;
BeginInterrupt GenDataSegment,%__IntBase
BeginInterrupt ProcPanic,%__IntBase
BeginInterrupt ProcCopyFromById,%__IntBase
BeginInterrupt ProcCopyToById,%__IntBase
BeginInterrupt CharIsDigit,%__IntBase
BeginInterrupt CharIsHexDigit,%__IntBase
BeginInterrupt CharIsPrintable,%__IntBase
BeginInterrupt CharIsAlphabetic,%__IntBase
BeginInterrupt CharIsAlphaNumeric,%__IntBase
BeginInterrupt CharIsUpperCase,%__IntBase
BeginInterrupt CharIsLowerCase,%__IntBase
BeginInterrupt CharIsSpace,%__IntBase
BeginInterrupt CharIsPunctuation,%__IntBase
BeginInterrupt CharIsGraphic,%__IntBase
BeginInterrupt CharIsControl,%__IntBase
BeginInterrupt CharToUpperChar,%__IntBase
BeginInterrupt CharToLowerChar,%__IntBase
BeginInterrupt CharToFoldedChar,%__IntBase
BeginInterrupt BufferCopy,%__IntBase
BeginInterrupt BufferSwap,%__IntBase
BeginInterrupt BufferCompare,%__IntBase
BeginInterrupt BufferCompareFolded,%__IntBase
BeginInterrupt BufferMatch,%__IntBase
BeginInterrupt BufferMatchFolded,%__IntBase
BeginInterrupt BufferLocate,%__IntBase
BeginInterrupt BufferLocateFolded,%__IntBase
BeginInterrupt BufferSubBuffer,%__IntBase
BeginInterrupt BufferSubBufferFolded,%__IntBase
BeginInterrupt BufferJustify,%__IntBase
BeginInterrupt StringCopy,%__IntBase
BeginInterrupt StringCopyFolded,%__IntBase
BeginInterrupt StringConvertToFolded,%__IntBase
BeginInterrupt StringCompare,%__IntBase
BeginInterrupt StringCompareFolded,%__IntBase
BeginInterrupt StringMatch,%__IntBase
BeginInterrupt StringMatchFolded,%__IntBase
BeginInterrupt StringLocate,%__IntBase
BeginInterrupt StringLocateFolded,%__IntBase
BeginInterrupt StringLocateInReverse,%__IntBase
BeginInterrupt StringLocateInReverseFolded,%__IntBase
BeginInterrupt StringSubString,%__IntBase
BeginInterrupt StringSubStringFolded,%__IntBase
BeginInterrupt StringLength,%__IntBase
BeginInterrupt StringValidateName,%__IntBase
BeginInterrupt LongIntCompare,%__IntBase
BeginInterrupt LongIntMultiply,%__IntBase
BeginInterrupt LongIntDivide,%__IntBase
BeginInterrupt LongUnsignedIntCompare,%__IntBase
BeginInterrupt LongUnsignedIntMultiply,%__IntBase
BeginInterrupt LongUnsignedIntDivide,%__IntBase
BeginInterrupt FloatAdd,%__IntBase
BeginInterrupt FloatSubtract,%__IntBase
BeginInterrupt FloatMultiply,%__IntBase
BeginInterrupt FloatDivide,%__IntBase
BeginInterrupt FloatCompare,%__IntBase
BeginInterrupt FloatNegate,%__IntBase
BeginInterrupt FloatToInt,%__IntBase
BeginInterrupt FloatToUnsignedInt,%__IntBase
BeginInterrupt FloatToLong,%__IntBase
BeginInterrupt FloatToUnsignedLong,%__IntBase
BeginInterrupt IntToFloat,%__IntBase
BeginInterrupt UnsignedIntToFloat,%__IntBase
BeginInterrupt LongToFloat,%__IntBase
BeginInterrupt UnsignedLongToFloat,%__IntBase
BeginInterrupt LibSend,%__IntBase
BeginInterrupt LibSendSuper,%__IntBase
BeginInterrupt LibSendExact,%__IntBase
BeginInterrupt LibEnter,%__IntBase
BeginInterrupt LibLeave,%__IntBase
BeginInterrupt Dummy,%__IntBase
BeginInterrupt GenIntByNumber,%__IntBase
BeginInterrupt WservFunctions,%__IntBase
BeginInterrupt LibSendExit,%__IntBase
BeginInterrupt DbfManager,%__IntBase
ifndef SmallInclude
IntEntry DbfOpen,%__IntVector
IntEntry DbfClose,%__IntVector
IntEntry DbfFlush,%__IntVector
IntEntry DbfTrash,%__IntVector
IntEntry DbfCopyDown,%__IntVector
IntEntry DbfCompress,%__IntVector
IntEntry DbfCopyFile,%__IntVector
IntEntry DbfFileSize,%__IntVector
IntEntry DbfExtHeaderRead,%__IntVector
IntEntry DbfExtHeaderWrite,%__IntVector
IntEntry DbfVersion,%__IntVector
IntEntry DbfAbsReadSense,%__IntVector
IntEntry DbfAbsRead,%__IntVector
IntEntry DbfNextRead,%__IntVector
IntEntry DbfBackRead,%__IntVector
IntEntry DbfFirstRead,%__IntVector
IntEntry DbfLastRead,%__IntVector
IntEntry DbfAppend,%__IntVector
IntEntry DbfEraseRead,%__IntVector
IntEntry DbfUpdate,%__IntVector
IntEntry DbfFindRead,%__IntVector
IntEntry DbfSense,%__IntVector
IntEntry DbfCount,%__IntVector
IntEntry DbfDescRecordRead,%__IntVector
IntEntry DbfDescRecordWrite,%__IntVector
IntEntry DbfFindReadField,%__IntVector
endif
BeginInterrupt LibEnterSend,%__IntBase
BeginInterrupt IoKeyAndMouseStatus,%__IntBase
BeginInterrupt StringCapitalise,%__IntBase
BeginInterrupt ProcIndStringCopyFromById,%__IntBase
BeginInterrupt IoNextHalfSecondStatus,%__IntBase
BeginInterrupt IoSerManager,%__IntBase
ifndef SmallInclude
IntEntry IoSerOpen,%__IntVector
IntEntry IoSerAddHandler,%__IntVector
IntEntry IoSerRemoveHandler,%__IntVector
IntEntry IoSerSetHandler,%__IntVector
IntEntry IoSerHandlerSaveError,%__IntVector
IntEntry IoSerOpenHandler,%__IntVector
IntEntry IoSerOpenTimerHandler,%__IntVector
IntEntry IoSerFree,%__IntVector
IntEntry IoSerCloseTimerHandler,%__IntVector
IntEntry IoSerDetachFree,%__IntVector
IntEntry IoSerTimerOpen,%__IntVector
IntEntry IoSerTimerCancel,%__IntVector
IntEntry IoSerTimerClose,%__IntVector
IntEntry IoSerAttachOnOpenChan,%__IntVector
IntEntry IoSerSenseOnOpenChan,%__IntVector
IntEntry IoSerOnOpenChan,%__IntVector
IntEntry IoSerCheckWriteSI,%__IntVector
IntEntry IoSerCheckReadSI,%__IntVector
IntEntry IoSerSignalUserWriteOk,%__IntVector
IntEntry IoSerSignalUserWrite,%__IntVector
IntEntry IoSerSignalUserReadOk,%__IntVector
IntEntry IoSerSignalUserRead,%__IntVector
IntEntry IoSerSignalUser,%__IntVector
IntEntry IoSerQueueRead,%__IntVector
IntEntry IoSerQueueWrite,%__IntVector
IntEntry IoSerQueueSuper,%__IntVector
IntEntry IoSerQueueTimer,%__IntVector
IntEntry IoSerCancelIoRequest,%__IntVector
IntEntry IoSerCancelAllSignalUser,%__IntVector
IntEntry IoSerSignalCompleteOK,%__IntVector
IntEntry IoSerSignalComplete,%__IntVector
IntEntry IoSerSyncWrite,%__IntVector
endif
BeginInterrupt HwSetRomBank,%__IntBase
BeginInterrupt HwGetRomBank,%__IntBase
BeginInterrupt IoActivity,%__IntBase
.list
+91
View File
@@ -0,0 +1,91 @@
.xlist
; Include file - EPOCPAN.INC
; Epoc/Os standard panic number include file
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 NSM Final release
;
EPOCPAN_INC = 1
;
PanicTest0 = 00 ; Test code panic
PanicSem0 = 01 ; Invalid function number for semaphore manager
PanicSem1 = 02 ; Semaphore number out of range
PanicSem2 = 03 ; Semaphore not allocated
PanicSem3 = 04 ; Initial semaphore count not 0 or +ve
PanicSem4 = 05 ; Signal count not >= 0
PanicProc0 = 06 ; Invalid function number for process manager
PanicProc1 = 07 ; Process Id out of range
PanicProc2 = 08 ; Task tried to create a task
PanicTim0 = 09 ; Invalid function number for time manager
PanicSeg0 = 10 ; Invalid function number for segment manager
PanicSeg1 = 11 ; Size was negative
PanicSeg2 = 12 ; Type was neither CreateLow or High or Device
PanicSeg3 = 13 ; Segment handle was invalid
PanicSeg4 = 14 ; Segment copy would have been out of range
PanicHeap0 = 15 ; Invalid function number for heap manager
PanicHeap1 = 16 ; Heap is not allocated
PanicHeap2 = 17 ; Cell being reduced by more than its size
PanicHeap3 = 18 ; Attempt to set heap granularity > MaxHeapGrowBy
PanicHeap4 = 19 ; Cell base address invalid
PanicMess0 = 20 ; Invalid function number for message manager
PanicMess1 = 21 ; Messages are already initialized
PanicMess2 = 22 ; Messages are not initialized
PanicMess3 = 23 ; Cannot initialize with 0 messages in the que
PanicIo0 = 24 ; Invalid function number for I/o manager
PanicIo1 = 25 ; Invalid Io channel
PanicIo2 = 26 ; Device requested panic
PanicIo3 = 27 ; Invalid handler handle
PanicIo4 = 28 ; Key and Mouse already hooked
PanicIo5 = 29 ; Key and Mouse requesting process is not a task
PanicDev0 = 30 ; Invalid function number for device manager
PanicDev1 = 31 ; Inavlid device handle
PanicFile0 = 32 ; Invalid function number for file manager
PanicFile1 = 33 ; Process already connected to file server
PanicFile2 = 34 ; Argument was'nt IoFuncSet or IoFuncSense
PanicLib0 = 35 ; Invalid function number for library manager
PanicLib1 = 36 ; Invalid library handle
PanicLib2 = 37 ; Invalid function number for library
PanicLib3 = 38 ; Invalid LIB file channel
PanicLib4 = 39 ; Invalid DYL index number
PanicFs0 = 40 ; Invalid message to file server
PanicFs1 = 41 ; Process has not connected to file server
PanicConv0 = 42 ; Invalid function number for conversion manager
PanicGen0 = 43 ; Invalid function number for general manager
PanicGen1 = 44 ; Attempt to unhook from alarm or notify when not already hooked
PanicGen2 = 45 ; Invalid revector address
PanicFlt0 = 46 ; Invalid function number for conversion manager
PanicEnter0 = 47 ; Leave called before a call to enter
PanicObj0 = 48 ; No method available to handle message
PanicObj1 = 49 ; Invalid reclass attempted
PanicObj2 = 50 ; Unknown category in LibHandle
PanicObj3 = 51 ; Unknown class in LibCreate
PanicObj4 = 52 ; Supersend called from outside a method
PanicObj5 = 53 ; Attempt to get a handle before being linked
PanicObj6 = 54 ; Missing external categories in LibLink
PanicObj7 = 55 ; Object does not point to a valid class
PanicLink0 = 56 ; Invalid link layer completion code
PanicWin0 = 57 ; Invalid function number for window manager
PanicHw0 = 58 ; Invalid function number for hardware manager
PanicHw1 = 59 ; Unexpected interrupt
PanicHw2 = 60 ; User wrote out of range
PanicHw3 = 61 ; User left interrupts off
PanicHaymd0 = 62 ; Bad things going on in the i/o system
PanicDivide = 63 ; Divide by zero interrupt
PanicOverflow = 64 ; Overflow interrupt
PanicDbf0 = 65 ; Invalid function number for Dbf manager
PanicDbf1 = 66 ; Invalid DBF Io channel
PanicDbf2 = 67 ; Invalid parameter for DBF function
PanicDead0 = 68 ; Address 0 overwrite
PanicStack0 = 69 ; Stack below 100h
PanicEnv0 = 70 ; Environment name size > EnvMaxNameSize
PanicSStep = 71 ; Single step interrupt
PanicBreak = 72 ; Break point interrupt
PanicIoPending = 73 ; Io was already pending
PanicIoSer0 = 74 ; Invalid function number for serial I/O manager
PanicIoAsic9 = 75 ; Call to an asic1 function on asic9 machines
PanicLib5 = 76 ; Trying to find a .DYL not in a visible bank
PanicEM$1 = 77 ; FP Emulator exception
PanicSem5 = 78 ; Semaphore count exceeds 07fffh
.list
+298
View File
@@ -0,0 +1,298 @@
.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
P_BAUD_115000 equ 13h
; 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
+24
View File
@@ -0,0 +1,24 @@
TASM = C:\BC\TASM
TLINK = C:\BC\TLINK
EMAKE = C:\TOOLS\EMAKE
all: snddvr.img sndfrc.img atimdvr.img
snddvr.img: snddvr.exe
$(EMAKE) -s -t2 snddvr
snddvr.exe: snddvr.obj
$(TLINK) /v /n snddvr
snddvr.obj: snddvr.asm
$(TASM) /ml snddvr.asm,snddvr.obj
sndfrc.img: sndfrc.exe
$(EMAKE) -s -t2 sndfrc
sndfrc.exe: sndfrc.obj
$(TLINK) /v /n sndfrc
sndfrc.obj: sndfrc.asm
$(TASM) /ml sndfrc.asm,sndfrc.obj
atimdvr.img: atimdvr.exe
$(EMAKE) -s -t2 atimdvr
atimdvr.exe: atimdvr.obj
$(TLINK) /v /n atimdvr
atimdvr.obj: atimdvr.asm
$(TASM) /ml atimdvr.asm,atimdvr.obj
+241
View File
@@ -0,0 +1,241 @@
.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
;
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
;
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,ResetFlag:1,WakeUp:1,OnKey: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
;
SerialWriteSingle equ 10000000b
SerialWriteMulti equ 10010000b
SerialReadSingle equ 11000000b
SerialReadMulti equ 11010000b
SerialReset equ 00000000b
SerialSelect equ 01000000b
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)
;
Asic4Id equ 001h
Asic5PackId equ 002h
Asic5NormalId equ 003h
Asic6Id equ 004h
Asic8Id equ 005h
Asic2SlaveId equ 01fh
;
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
A3StatusR record PowerFail:1,ColdStart: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)
Vcc1_4To5Delay equ (3) ; Pan only in 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
;
; 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)
;
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
;
if Consumer
DefaultLcdContrast equ 7
else
DefaultLcdContrast equ 15
endif
;
InterruptBase equ 078h
;
KeyPollColumns equ 10
KeyInitialDelay equ 24
if Consumer
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
PostPort equ 0h
else
PostPort equ 01ffh
endif
;
if HandHeld
VideoRamSegment equ 00040h
VideoRamBase equ 00000h
if Corporate
VideoRamWords equ 00320h
else
VideoRamWords equ 00500h
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
;
Vcc4OffFrames equ 25 ; Gives 512 frames = 10.0 ms
;
Vcc1_4to5OffFrames equ 20 ; Gives 392 frames = 6.0 ms
Vcc1_4to5OnTime equ 4 ; Gives 4 ms
;
IntBXHw equ -2
.list
+72
View File
@@ -0,0 +1,72 @@
1) BUILDING SNDDVR.LDD, SNDFRC.LDD, ATIMDVR.LDD
============================================
These drivers are supplied as both source (in this directory) and as
built drivers (in \SIBOSDK\LIB).
To rebuild them you must use the Borland Turbo assembler. The file
MAKEFILE is supplied to simplify the building of all three drivers.
If necessary, edit the first two lines of MAKEFILE to agree with the
directory containing a copy of the Borland Turbo files TASM.EXE and
TLINK.EXE.
Provided that the directory containing Borland Turbo MAKE.EXE is in
your path, you can then build all three drivers by typing:
make RETURN
2) A note on SNDFRC.LDD
====================
The SNDFRC driver is for the Series 3, since the Series 3a has a
built-in FRC device driver. SNDFRC is provided as an illustration
only.
The driver code assumes that, while it is running, no system
code makes use of the Series 3 free-running counter (FRC). The
FRC, however, is used when sounding the buzzer and when the
Flash filing system writes to a Flash SSD.
Writing to a Flash SSD or sounding the buzzer (for example, with
p_sound) while the SNDFRC driver is in use will cause the driver
to hang indefinitely. It is also likely that opening the driver
while writing to a Flash SSD is in progress could adversely affect
the Flash file device driver.
Commercial software should not make use of the Series 3 FRC in the
manner illustrated in this example.
3) The HC Barcode Drivers
======================
The following Barcode decoder/device drivers are provided
(in \SIBOSDK\LIB) for use on the HC:
BAREAN.LDD
BARC39.LDD
BARITF.LDD
BARMPLES.LDD
BAR128.LDD
BARRAW.LDD
4) The HC and Workabout Fast Charger Drivers
=========================================
The following drivers are provided (in \SIBOSDK\LIB):
SYS$CHGH.LDD fast charger driver for the HC
SYS$FCHG.LDD fast charger driver for the Workabout
The header file FCHARGE.H is also provided (in \SIBOSDK\INCLUDE).
4) The Series 3c and Siena IR Drivers
==================================
The following drivers are provided (in \SIBOSDK\LIB):
ACCESSIR.LDD the AcessIR driver, AIR:
IRLPT.LDD IR printer port driver, IRP:
The header file MUX.H is also provided (in \SIBOSDK\INCLUDE).
+395
View File
@@ -0,0 +1,395 @@
title SNDDVR -- Epoc/Os Sound Device Driver Example
subttl Copyright (c) Psion PLC 1992
name SNDDVR
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 1.00A 21/04/92 JH Alpha release
;
TURBOC equ 1
;
include epocdef.inc
include epocmac.inc
include epoclib.inc
include epocser.inc
include ossibo.inc
HandlerDisable equ 000h ; the hnadler should not be called
HandlerEnable equ 001h ; the handler should be called
CodeSeg
ProcBegin@ SnddvrLDD
; ==========
; The externally loadable device table
dw LDDSignature
db 'MUS',0,0,0,0,0
dw (VectorEnd-Vector)/2
Vector:
dw SnddvrInstall
dw SnddvrRemove
dw SnddvrHold
dw SnddvrResume
dw SnddvrReset
dw SnddvrUnits
dw SnddvrOpen
dw SnddvrStrategy
VectorHandler:
dw SnddvrHandler
VectorEnd:
ProcEnd noret
SoundChanOpen db ?
ProcBegin@ CancelWrite
; ===========
; Cancel any outstanding I/O write request.
; Set the completion status word to E_FILE_CANCEL and signal the I/O
; semaphore.
; In:
; BX - sound control block ptr
; Out:
; NONE
;
mov dl, CancelErr
IoSerSignalUserWrite ; complete any write with E_FILE_CANCEL
IoSerTimerCancel ; harmless if nothing queued
mov al, HandlerDisable
IoSerSetHandler ; make SnddvrHandler non callable
; FALL THROUGH to StopSound
ProcEnd noret
;
ProcBegin@ StopSound
; =========
; Stop the sound by turning off the sound chip and shuting down the
; amplifier.
; In:
; BX - sound control block ptr
; Out:
; NONE
;
mov dx, PSoundControl
mov al, 1
out dx, al ; stop sound chip
HwComboOff ; stop amplifier
ret
ProcEnd noret
;
ProcBegin@ PlaySounds
; ==========
; Play any more sounds available.
; Set the note volume from bits 6 and 7 of the first byte.
; Write the note to the chip from bits 0-5 of the first byte.
; Queue the timer to expire on timeout specified in 2nd byte.
; In:
; BX - channel control blk
; Out:
; AL as required by SnddvrHandler routine
;
cmp [bx].IoRequestRqWrite.RqA2Ptr, 0
je finishedAllNotes
cld
dec [bx].IoRequestRqWrite.RqA2Ptr ; one less note to play
mov si, [bx].IoRequestRqWrite.RqA1Ptr
lodsw ; note+volume to AL, duration to AH
mov [bx].IoRequestRqWrite.RqA1Ptr, si
xor cx, cx
mov cl, ah ; the duration (in 1/10ths)
push ax
shr ax, 1 ; factor out the volume bits
and al, 60h ; into bits 5+6 for the hardware
mov ah, al
mov al, A2IWrite
out A2Index, al
mov al, ah
out A2Control, al ; set the volume for that note
pop ax
mov dx, PSoundControl
and al, 3fh ; bottom 6 bits are note info
out dx, al ; and play the note
xor dx, dx
IoSerQueueTimer ; DX:CX is timeout in 1/10ths
mov al, 1 ; enable handler
ret
finishedAllNotes:
call StopSound ; stop sound activity
IoSerSignalUserWriteOk ; write request completed ok
xor ax, ax ; disable handler
ret
ProcEnd noret
;
ProcBegin@ SnddvrInstall,far
; =============
; Install vector called when application calls p_loadldd()
; In:
; NONE
; Out:
; Carry clear if installed ok
; Carry set if failed to install
;
and SoundChanOpen, 0 ; no channel open yet
clc ; installed OK
ret
ProcEnd noret
;
ProcBegin@ SnddvrRemove,far
; ============
; Remove vector called when application calls p_devdel()
; In:
; NONE
; Out:
; Carry clear if removed ok
; Carry set if failed to remove
;
cmp SoundChanOpen, 0
je soundRemoved ; dont do anything if not open
mov al, InUseErr
stc ; channel open, fail to remove
ret
ProcEnd noret
;
ProcBegin@ SnddvrReset,far
; ===========
; Reset vector called if the client terminated.
; We can only get a reset if weve got channel open and client died
; since we cancel the reset request when the channel is closed.
; NOTE: The clients data space no longer exists thus all data required to
; close down the channel must be avaliable in the drivers space.
; In:
; NONE
; Out:
; NONE
;
call StopSound
HwFreeCombo ; allow other sound components to work.
and SoundChanOpen, 0 ; no channel open now
soundRemoved:
clc ; removed OK.
ret
ProcEnd noret
ProcBegin@ SnddvrHold,far
; ==========
; Hold called when another driver loaded or switched off/power fail.
; In:
; AH - reason.
; Out:
; NONE
cmp SoundChanOpen, 0
je soundHeld ; dont do anything if not open
call StopSound ; stop any current sounds.
soundHeld:
ret
ProcEnd noret
ProcBegin@ SnddvrResume,far
; ============
; Resume called after a Hold to allow the driver to continue.
; If we were running the outstanding timer request will complete at some
; in the future at which point we will play the next note.
; Note - we dont immediatly start playing the note that was being played
; when the hold was called - this may be a bug for some applications.
; In:
; NONE
; Out:
; NONE
cmp SoundChanOpen, 0
je soundResumed ; dont do anything if not open
HwComboOn ; waithandler will run eventually
soundResumed:
ret ; when the timer expires if we were active.
ProcEnd noret
ProcBegin@ SnddvrUnits,far
; ===========
; We can only handle 1 sound channel at a time.
;
mov ax, 1 ; support 1 unit at a time
ret
ProcEnd noret
ProcBegin@ SnddvrOpen,far
; ==========
; Open the sound device driver.
; This runs is the context of the process that has called p_open("MUS:").
;
; In:
; DS=ES=SS - Process data space.
; DX - OS device handle
; SI - ptr to OpenEnt struct
; Out:
; DX - OS device handle
; Carry Clear
; BX - channel, DX is as passed (device handle)
; Carry Set
; AL - error number
;
; All device drivers MUST have a ChanEnt as first item at returned BX
;
HwGetCombo ; see if already in use, if not grab it
jc sndAlreadyInUse
; allocate in clients heap the I/O control block, add vector 9 as a
; waithandler and open a timer channel. Tidies up all resources if there
; are any errors.
mov cx, (size IoRequestEnt)
IoSerOpenTimerHandler
jc endOpenNoMemory ; sets up ChanEnt, returns BX
; request reset vector be called if client terminates before closing channel
xchg bx, dx
xor cx, cx
IoRequestReset ; BX=device handle, CX= channel indicator
xchg bx, dx
mov SoundChanOpen, 1
clc ; Opened Ok, BX=channel, DX=device
ret
;
endOpenNoMemory:
push ax
HwFreeCombo ; free up as failed
pop ax
stc
sndAlreadyInUse:
ret
ProcEnd noret
ProcBegin@ SnddvrHandler,far
; ==============
; Called when an I/O signal is generated, it may be our timer to indicate
; that we should play the next note if any.
; In:
; DS,ES,SS == Process data space
; BX = the open sound channel
; Out:
; Carry clear
; Did not consume signal
; Carry set
; al = 0 - Leave handler disabled
; al = non 0 - Enable handler
;
; check that were not currently in any StategyVector code, (anti nesting)
test [bx].IoRequestFlags, RQ_DISABLE_HANDLER
jnz signalNotForUs
; see if we currently have a timer request outstanding
test [bx].IoRequestFlags, RQ_TIMER
jz signalNotForUs ; timer not queued
; see if the outstanding timer has completed
cmp [bx].IoRequestTimerStat, PendingErr
je signalNotForUs ; timer still pending
; timer completed, play next sound if any and re-queue timer
and [bx].IoRequestFlags, NOT RQ_TIMER
call PlaySounds ; returns AL as required
stc
ret
signalNotForUs:
clc ; we didnt use the signal
ret
ProcEnd noret
ProcBegin@ SnddvrStrategy,far
; ==============
; Strategy vector called by an I/O request on the opened sound device driver
; channel.
; The wait handler may be called (when enabled ) unless we block it when we
; call a sync I/O request. Allowing the waithandler to run whilst in the
; strategy vector is generally not a good thing to do.
; In this particular example there are synchronous calls to the I/O system
; to cancel the outstanding timer (if queued) and use the signal generated
; by the cancel.
;
; In:
; DS,ES,SS == Process data space
; BX == channel control block from open request
; DX == device handle
; SI == RqEnt pointer
; Out:
; Carry clear
; - request queued sucessfully (may have completed)
; Carry set
; - error queuing the I/O request
;
cld
; Stop the WaitHandler from being called temporarily
or [bx].IoRequestFlags, RQ_DISABLE_HANDLER
mov al, byte ptr [si].RqFunction
cmp al, IoFuncWrite
jne tryCancel
; P_FWRITE I/O function request
mov di, [si].RqA2Ptr
mov cx, [di] ; length to write
mov di, [si].RqA1Ptr ; ptr to data to write
mov si, [si].RqStatusPtr
IoSerCheckWriteSI ; set *SI to Pending, PendingPanic's
mov [bx].IoRequestRqWrite.RqA2Ptr, cx
mov [bx].IoRequestRqWrite.RqA1Ptr, di
mov al, HandlerEnable
IoSerSetHandler ; make SnddvrHandler callable
HwComboOn ; start the amplifier
call PlaySounds ; start the sound
and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER
ret
tryCancel:
cmp al, IoFuncCancel
jne tryClose
; P_FCANCEL I/O function request
call CancelWrite ; cancel any outstanding requests
and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER
jmp short signalOk ; cancel completed ok.
tryClose:
cmp al, IoFuncClose
jne notForUs
; P_FCLOSE I/O function request
push bx
push dx
call CancelWrite ; cancel any outstanding requests
; cancel the request to call the Reset vector
pop bx ; our I/O device handle
xor cx, cx ; MUST be same as passed to IoRequestReset
IoRequestResetCancel ; dont call reset vector now
; close timer, remove handler, free alloc
pop bx
IoSerCloseTimerHandler
HwFreeCombo ; not in use any more
and SoundChanOpen, 0 ; no channel open now
signalOk:
xor ax, ax
mov di, [si].RqStatusPtr
stosw ; set completion status word to zero
IoSignal ; complete the I/O request
xor ax, ax ; also clears carry
ret
notForUs:
and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER
IoRoot ; pass on request as not for us
ret
ProcEnd noret
EndCodeSeg
;
stack segment stack para 'data'
;
stack ends
;
end SnddvrLDD
+521
View File
@@ -0,0 +1,521 @@
title SNDFRC -- Epoc/Os Sound Device Driver Using FRC
subttl Copyright (c) Psion PLC 1992
name SNDFRC
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 1.00A 21/04/92 JH Alpha release
;
TURBOC equ 1
;
include epocdef.inc
include epocmac.inc
include epocpan.inc
include epoclib.inc
include epocser.inc
include ossibo.inc
HandlerDisable equ 000h ; the hnadler should not be called
HandlerEnable equ 001h ; the handler should be called
MAX_NOTES equ 500
; This is allocated in the user space for the I/O channel
SndFrcEnt struc
SndFrcIo ChanEnt <> ; I/O channel hdr, MUST be first
SndFrcWrite RqEnt <>
SndFrcHandler dw ?
SndFrcFlags dw ?
SndFrcPstat dw ?
SndFrcEnt ends
SndChannel struc
Pid dw ? ; owning channel pid
OpenFrcChan db ? ; channel open status (KEEP ORDER)
WriteStat db ? ; write completion status (ORDER)
DataPtr dw ? ; where we are in buffer
DataLength dw ? ; number of notes to play
DataPreBuffer dw ? ; First Frc timout ptr
DataBuffer dw MAX_NOTES dup (?)
SndChannel ends
CodeSeg
ProcBegin@ SndfrcLDD
; ==========
; The externally loadable device table
dw LDDSignature
db 'MUS',0,0,0,0,0
dw (VectorEnd-Vector)/2
Vector:
dw SndfrcInstall
dw SndfrcRemove
dw SndfrcHold
dw SndfrcResume
dw SndfrcReset
dw SndfrcUnits
dw SndfrcOpen
dw SndfrcStrategy
VectorHandler:
dw SndfrcHandler
VectorEnd:
ProcEnd noret
SoundChan SndChannel <>
ProcBegin@ disableFrcInt
; =============
; Disable the generation of Frc interrupts
;
pushf
cli
in al, A1InterruptMask
and al, not (mask FrcExpired)
out A1InterruptMask, al ; stop Interrupt controller from
popf ; generating Frc interrupts
ret
ProcEnd
;
ProcBegin@ enableFrcInt
; ============
; Starts the free running counter.
;
pushf
cli
in al, A1Control
or al, mask FrcSource or mask FrcMode
out A1Control, al ; set 512khz and prescale mode
mov ax, 5120 ; request a FrcInt every 10ms
out A1FrcControl, ax
out A1FrcEoi, al ; clear any junk Frc Interrupt
in al, A1InterruptMask
or al, mask FrcExpired ; allow interrupt controller to
out A1InterruptMask, al ; generate a Frc Interrupt
popf
ret
ProcEnd noret
;
ProcBegin@ FrcInterrupt,far
; ============
; The Frc interrupt routine.
; Although we could get addressability to the clients data space since it is
; possible that the operating system is currently moving the
; data space of the client in which case the data buffer to be played
; may not be valid.
; The ISR is called by the operating system after all registers have been
; preserved.
; We MUST NOT cause a reschedule directly since the ISR would take a long
; time to complete if we did.
;
; Called in the context of whatever was running when the interrupt went off
;
out A1FrcEoi, al ; clear Frc Interrupt
mov si, SoundChan.DataPtr
cmp byte ptr cs:[si+1], 0 ; look at the duration byte
je finishedThatNote ; if zero goto the next note
dec byte ptr cs:[si+1] ; reduce timeout
endFrcInterrupt:
stc ; no potential reschedule required
endFrcInterruptFlags:
out A1NonSpecificEoi, al ; finish the ISR
ret
finishedThatNote:
cmp SoundChan.DataLength, 0
je finishedAllNotes
dec SoundChan.DataLength ; one less note to play
inc si
inc si ; find next note,volume and duration
mov SoundChan.DataPtr, si ; updated ptr
mov al, byte ptr cs:[si]
push ax
shr ax, 1 ; factor out the volume bits
and al, 60h ; into bits 5+6 for the hardware
mov ah, al
mov al, A2IWrite
out A2Index, al
mov al, ah
out A2Control, al ; set the volume for that note
pop ax
mov dx, PSoundControl
and al, 3fh ; bottom 6 bits are note info
out dx, al ; and play that note
jmp short endFrcInterrupt
finishedAllNotes:
call StopSound
mov SoundChan.WriteStat, 0 ; finished playing that lot
mov bx, SoundChan.Pid ; get the channel owner
IoSignalByPidNoReSched ; signal ourselves, causes handler
clc ; reschedule if possible
jmp short endFrcInterruptFlags
ProcEnd noret
;
ProcBegin@ setFrcIntVector
; ===============
; Set the ISR pointer to our FRC interrupt routine.
; MUST be done with ints disabled so we cant be moved by the operating
; system whilst setting the address.
;
pushf
cli
push bx
mov al, HwIrq5Revector
mov bx, offset FrcInterrupt
mov cx, cs ; this ok as ints disabled.
GenSetRevector
pop bx
popf
ret
ProcEnd noret
;
ProcBegin@ StopSound
; =========
; Stop the sound generation.
;
call disableFrcInt ; Stop Frc interrupts
mov dx, PSoundControl
mov al, 1
out dx, al ; stop sound chip
HwComboOff ; stop amplifier
ret
ProcEnd noret
ProcBegin@ SndfrcInstall,far
; =============
; Install vector called when application calls p_loadldd()
; Set OpenFrcChan to zero.
; In:
; NONE
; Out:
; Carry clear if installed ok
; Carry set if failed to install
;
and SoundChan.OpenFrcChan, 0
clc ; installed OK
ret
ProcEnd noret
;
ProcBegin@ SndfrcRemove,far
; ============
; Remove vector called when application calls p_devdel()
;
cmp SoundChan.OpenFrcChan, 0
je soundRemoved
mov al, InUseErr
stc ; channel open, fail to remove
ret
ProcEnd noret
;
ProcBegin@ SndfrcReset,far
; ===========
; Reset vector called if the client terminated.
; We can only get a reset if weve got channel open and client died
; since we cancel the reset request when the channel is closed.
; NOTE: The clients data space no longer exists thus all data required to
; close down the channel must be avaliable in the drivers space.
; In:
; NONE
; Out:
; NONE
;
call StopSound ; disable Frc ints etc
mov al, HwIrq5Revector
GenResetRevector ; restore the default ROM ISR vector
mov al, mask FrcExpired
HwFreeChannel ; free Frc resource
HwFreeCombo ; free up sound usage resource
and word ptr SoundChan.OpenFrcChan, 0 ; all closed now
soundRemoved:
clc ; removed OK.
ret
ProcEnd noret
ProcBegin@ SndfrcHold,far
; ==========
; Hold called when another driver loaded or switched off/power fail.
; In:
; AH - reason.
; Out:
; NONE
cmp SoundChan.OpenFrcChan, 0
je soundHeld ; dont do anything if not open
call StopSound ; shut down ints and sound
soundHeld:
ret
ProcEnd noret
ProcBegin@ SndfrcResume,far
; ============
; Resume called after a Hold to allow the driver to continue.
; If we were running enabling the Frc interrupt will cause the
; FrcInt routine to be called thus allowing us to count down the current
; duration as though nothing had happened before going to the next note.
; In:
; NONE
; Out:
; NONE
;
cmp SoundChan.OpenFrcChan, 0
je soundResumed ; dont do anything if not open
call setFrcIntVector ; we may have moved, set CS correctly
cmp SoundChan.WriteStat, PendingErr
jne soundResumed ; dont enable ints if no write queued
HwComboOn ; switch amplifier on
call enableFrcInt ; continue where we left off
soundResumed:
ret
ProcEnd noret
ProcBegin@ SndfrcUnits,far
; ===========
; We can only handle 1 sound channel at a time.
;
mov ax, 1 ; support 1 unit at a time
ret
ProcEnd noret
ProcBegin@ SndfrcOpen,far
; ==========
; Open the sound device driver.
; This runs is the context of the process that has called p_open("MUF:").
;
; In:
; DS=ES=SS - Process data space.
; DX - OS device handle
; SI - ptr to OpenEnt struct
; Out:
; DX - OS device handle
; Carry Clear
; BX - channel, DX is as passed (device handle)
; Carry Set
; AL - error number
;
; All device drivers MUST have a ChanEnt as first item at returned BX
;
HwGetCombo ; see if snd already in use, if not grab it
jc sndAlreadyInUse
mov al, mask FrcExpired
HwGetChannel ; see if FRC already in use, if not grab it
jc endFrcInUse
mov cx, (size SndFrcEnt)
HeapAllocateCell
jc endOpenNoMemory ; get users I/O channel
mov bx, ax ; the allocated cell handle
mov al, (VectorHandler-Vector)/2
IoAddHandler ; handler handle in AX
jc endOpenFreeMemory
mov [bx].SndFrcHandler, ax
xchg bx, dx
xor cx, cx
IoRequestReset ; call Reset if client terminates
xchg bx, dx
mov [bx].SndFrcIo.ChanNext, bx ; we are a root device
mov [bx].SndFrcIo.ChanSignature, IoChanSignature
mov [bx].SndFrcIo.ChanLibHandle, dx ; This is our device handle
and [bx].SndFrcPstat, 0 ; no write pending yet
and [bx].SndFrcFlags, 0
ProcId
mov SoundChan.Pid, ax ; remember client id for ISR
mov SoundChan.OpenFrcChan, 1 ; now open
call setFrcIntVector ; set up the ISR address ptr
clc
ret
endOpenFreeMemory:
push ax
HeapFreeCell
pop ax
endOpenNoMemory:
push ax
mov al, mask FrcExpired
HwFreeChannel ; free Frc resource
pop ax
endFrcInUse:
push ax
HwFreeCombo ; free sound resource as failed somewhere
pop ax
stc
sndAlreadyInUse:
ret
ProcEnd noret
ProcBegin@ SndfrcHandler,far
; ==============
; Called when an I/O signal is generated and were enabled. We should only
; enabled when a write request is outstanding.
; We need to check the LOW side drivers completion status to see if all the
; notes have been played yet (SoundChan.WriteStat!=E_FILE_PENDING).
; Typically write the handler defensivly since complex drivers may leave the
; handler enabled other than when a request is outstanding.
;
; In:
; DS,ES,SS == Process data space
; BX == channel control block from open request
; Out:
; Carry clear
; Did not consume signal
; Carry set
; al = 0 - Leave handler disabled
; al = non 0 - Enable handler
;
test [bx].SndFrcFlags, RQ_DISABLE_HANDLER
jnz signalNotForUs ; we are in StategyVector code
cmp [bx].SndFrcPstat, 0
je signalNotForUs ; no write request queued yet
mov al, SoundChan.WriteStat
cmp al, PendingErr
je signalNotForUs ; pending write request not finished
cbw
xor si, si
xchg si, [bx].SndFrcPstat ; no write queued if Pstat is zero
mov [si], ax
IoSignal ; complete the original write request
xor ax, ax ; disable handler now
stc
ret
signalNotForUs:
clc
ret
ProcEnd noret
ProcBegin@ CancelWrite
; ===========
; Cancel any outstanding write request
;
xor di, di
xchg di, [bx].SndFrcPstat
or di, di ; see if any write is currently queued
jz noWriteQueued
push bx
mov bx, [bx].SndFrcHandler
mov cl, HandlerDisable
IoEnableHandler ; make SndfrcHandler non callable
pop bx
call StopSound ; stops Frc ints
mov word ptr [di], CancelErr ; set write completion stat
IoSignal ; and signal write completion
noWriteQueued:
mov SoundChan.WriteStat, 0
ret
ProcEnd noret
;
ProcBegin@ SndfrcStrategy,far
; ==============
; Strategy vector called by an I/O request on the opened sound device driver
; channel.
; The wait handler may be called (when enabled ) unless we block it when we
; call a sync I/O request. Allowing the waithandler to run whilst in the
; strategy vector is generally not a good thing to do.
; In this particular example there are infact no sync calls to the I/O system
; thus the wait handler cannot be run. In more complex drivers it may be
; difficult to determine all possible paths through the code thus the driver
; should be written defensivly (use RQ_DISABLE_HANDLER type mechanism).
; In:
; DS,ES,SS == Process data space
; BX == channel control block from open request
; DX == device handle
; SI == RqEnt pointer
; Out:
; Carry clear
; - request queued sucessfully (may have completed)
; Carry set
; - error queuing the I/O request
;
cld
or [bx].SndFrcFlags, RQ_DISABLE_HANDLER
mov al, byte ptr [si].RqFunction
cmp al, IoFuncWrite
jne tryCancel
cmp [bx].SndFrcPstat, 0
jne writeQueued ; panic if write already queued
mov di, [si].RqA2Ptr
mov cx, [di] ; length to write
cmp cx, MAX_NOTES
jae writeQueued ; length too much, panic dvr
mov di, [si].RqStatusPtr
mov word ptr [di], PendingErr
mov [bx].SndFrcPstat, di ; write request now queued
mov si, [si].RqA1Ptr ; ptr to data to write as sound
mov di, offset SoundChan.DataPreBuffer
and word ptr [di], 0 ; set pre buffer len to zero
mov SoundChan.DataPtr, di
inc di
inc di
mov SoundChan.DataLength, cx ; this many notes to play
mov SoundChan.WriteStat, PendingErr
pushf
cli ; we can set ES when ints are off
push cs
pop es ; copy the notes+vol and duration
popf ; into buf we can access in ISR
rep movsw ; dont use CS override
mov es, [bp].IntES
push bx
mov bx, [bx].SndFrcHandler
mov cl, HandlerEnable
IoEnableHandler ; allow waithandler to be called
pop bx
HwComboOn
call enableFrcInt ; start the sound off
and [bx].SndFrcFlags, NOT RQ_DISABLE_HANDLER
xor ax, ax ; queued OK
ret
writeQueued:
mov al, PanicIoPending
ProcPanic ; stop bad applications
tryCancel:
cmp al, IoFuncCancel
jne tryClose
call CancelWrite ; stop any queued write
and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER
jmp short signalOk ; cancel completed ok.
tryClose:
cmp al, IoFuncClose
jne notForUs
call CancelWrite ; stop any queued writes
push bx
push [bx].SndFrcHandler
push dx
mov al, HwIrq5Revector
GenResetRevector
pop bx ; channel handle
xor cx, cx
IoRequestResetCancel ; dont call Reset vector now
pop bx ; handler handle
IoRemoveHandler
pop bx ; alloc handle
HeapFreeCell
mov al, mask FrcExpired
HwFreeChannel ; free Frc resource
HwFreeCombo ; not in use any more
and word ptr SoundChan.OpenFrcChan, 0 ; all closed now
signalOk:
xor ax, ax
mov di, [si].RqStatusPtr
stosw ; the I/O request completed OK
IoSignal
xor ax, ax ; also clears carry
ret
notForUs:
and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER
IoRoot ; pass on request as not for us
ret
ProcEnd noret
EndCodeSeg
;
stack segment stack para 'data'
;
stack ends
;
end SndfrcLDD
+64
View File
@@ -0,0 +1,64 @@
/*
T_ATIM.C - Test the attached timer a bit
Written by John, February 1992
*/
#include <p_std.h>
#include <p_file.h>
#include <epoc.h>
LOCAL_C VOID panic(
INT num,
INT errno)
{
UBYTE b[100];
p_errs(&b[p_atos(&b[0],"panic num %d - ",num)],errno);
t_panic(&b[0]);
}
GLDEF_C main(VOID)
{
UWORD len;
WORD stat;
INT ret;
UBYTE *pcb;
ULONG timeout;
UBYTE bb[10];
GLREF_D P_DEVICE p_wind,p_file;
p_inst(&p_wind,&p_file,NULL_D);
if (ret=p_loadldd("ATIMDVR.LDD"))
panic(1,ret);
if (ret=p_open(&pcb,"TTY:A"))
panic(2,ret);
if (ret=p_open(&pcb,"ATM:",0))
panic(3,ret);
timeout=50L; /* 5 second timeout */
if (ret=p_iow(pcb,P_FSET,&timeout))
panic(4,ret);
/*
Once the device driver hierarchy has been set up the I/O requests are
identical between a driver with and a driver without an attached timeout
driver, except of course that the attached timeout driver will not wait
forever if no characters can be read.
*/
len=10;
p_ioc(pcb,P_FREAD,&stat,&bb[0],&len);
p_iow(pcb,P_FCANCEL);
p_waitstat(&stat);
if (stat!=E_FILE_CANCEL)
panic(5,stat);
if ((ret=p_read(pcb,&bb[0],10))!=E_FILE_INACT)
panic(6,ret); /* times out after 5 seconds */
p_close(pcb);
p_close(pcb);
if (ret=p_devdel("ATM",E_LDD))
panic(7,ret);
return(0);
}
+118
View File
@@ -0,0 +1,118 @@
/*
T_MUS.C - Test the musical sound driver a bit
Written by John, April 1992
*/
#include <plib.h>
/* all are 1 sec duration by default */
LOCAL_D UBYTE notes[] = {
/* Basic note numbers */
0x30,
0x31,
0x32,
0x33,
0x34,
0x35,
0x36,
0x37,
0x38,
0x39,
0x3a,
0x29,
0x3b,
0x3c,
0x3d,
0x0e,
0x3e,
0x2c,
0x3f,
0x04,
0x05,
0x25,
0x2f,
0x06,
0x07
};
LOCAL_D WORD volume=0; /* volume to use */
LOCAL_D WORD length=10; /* length of notes */
LOCAL_C VOID panic(
INT num,
INT errno)
{
TEXT b[100];
p_errs(&b[p_atob(&b[0],"panic num %d - ",&num)],errno);
t_panic(&b[0]);
}
GLDEF_C main(VOID)
{
INT ret,i;
VOID *pcb;
UBYTE bb[100],*p;
p_loadldd("SNDDVR.LDD");
if (ret=p_open(&pcb,"MUS:",-1))
panic(2,ret);
p_puts("Musical notes tester - ? for help");
FOREVER
{
p_print("Next>");
p_gets(p=(&bb[0]));
p=p_skipwh(p);
if (!*p)
continue;
switch (p_toupper(*p++))
{
case '?':
p_puts("Q - Quit");
p_puts("V<vol> - Volume 0-3");
p_puts("L<len> - Length 0-100");
p_puts("P - Play scale");
break;
case 'Q': /* Quit */
p_close(pcb);
if (ret=p_devdel("MUS",E_LDD))
panic(7,ret);
return(0);
case 'V': /* Volume */
if (p_stoi(&p,&volume)<0)
volume=0;
if (volume<0 || volume>3)
volume=0;
break;
case 'L': /* Length */
if (p_stoi(&p,&length)<0)
length=10;
if (length<0 || length>100)
length=10;
break;
case 'P': /* play that lot */
for (i=0;i<sizeof(notes);i++)
{
bb[i<<1]=notes[i]|(volume<<6);
bb[(i<<1)+1]=length;
}
p_write(pcb,&bb[0],sizeof(notes));
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
bb[0]=notes[((*(p-1))-'0')<<1]|(volume<<6);
bb[1]=length;
p_write(pcb,&bb[0],1);
break;
}
}
}
+118
View File
@@ -0,0 +1,118 @@
/*
T_MUSFRC.C - Test the musical sound driver from the Frc
Written by John, April 1992
*/
#include <plib.h>
/* all are 1 sec duration by default */
LOCAL_D UBYTE notes[] = {
/* Basic note numbers */
0x30,
0x31,
0x32,
0x33,
0x34,
0x35,
0x36,
0x37,
0x38,
0x39,
0x3a,
0x29,
0x3b,
0x3c,
0x3d,
0x0e,
0x3e,
0x2c,
0x3f,
0x04,
0x05,
0x25,
0x2f,
0x06,
0x07
};
LOCAL_D WORD volume=0; /* volume to use */
LOCAL_D WORD length=100; /* length of notes */
LOCAL_C VOID panic(
INT num,
INT errno)
{
TEXT b[100];
p_errs(&b[p_atob(&b[0],"panic num %d - ",&num)],errno);
t_panic(&b[0]);
}
GLDEF_C main(VOID)
{
INT ret,i;
VOID *pcb;
UBYTE bb[100],*p;
p_loadldd("SNDFRC.LDD");
if (ret=p_open(&pcb,"MUS:",-1))
panic(2,ret);
p_puts("Musical notes tester - ? for help");
FOREVER
{
p_print("Next>");
p_gets(p=(&bb[0]));
p=p_skipwh(p);
if (!*p)
continue;
switch (p_toupper(*p++))
{
case '?':
p_puts("Q - Quit");
p_puts("V<vol> - Volume 0-3");
p_puts("L<len> - Length 0-256");
p_puts("P - Play scale");
break;
case 'Q': /* Quit */
p_close(pcb);
if (ret=p_devdel("MUS",E_LDD))
panic(7,ret);
return(0);
case 'V': /* Volume */
if (p_stoi(&p,&volume)<0)
volume=0;
if (volume<0 || volume>3)
volume=0;
break;
case 'L': /* Length */
if (p_stoi(&p,&length)<0)
length=100;
if (length<0 || length>256)
length=100;
break;
case 'P': /* play that lot */
for (i=0;i<sizeof(notes);i++)
{
bb[i<<1]=notes[i]|(volume<<6);
bb[(i<<1)+1]=length;
}
p_write(pcb,&bb[0],sizeof(notes));
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
bb[0]=notes[((*(p-1))-'0')<<1]|(volume<<6);
bb[1]=length;
p_write(pcb,&bb[0],1);
break;
}
}
}