Tech Note 06: Using Operating System APIs (SysTraps)

March 13, 2007

© 2009 NS BASIC Corporation. All rights reserved.


NS Basic/Palm can call most Palm OS System API functions. Operating System APIs, or SysTraps, can be included in an NS Basic/Palm project using SysTrapSub and SysTrapFunc, two NS Basic/Palm keywords. SysTrapSub is used to call system procedures that do not return a value to Basic, and SysTrapFunc is used to call system procedures that return a single value to Basic. It is an error to use SysTrapFunc without assigning the return value to a variable. This will compile but will not work properly. It is, however, legitimate to use a SysTrapSub for an API function that normally returns a value if you do not care about the return value.
   Syntax:
      SysTrapSub trapnum, numargs[, arg1[, arg2[, ...]]]
      foo = SysTrapFunc(trapnum, numargs[, arg1[, arg2[, ...]]])

   Description:
      Trapnum is a constant, defined in CoreTraps.h, that determines which system
      routine is being called.  System traps begin with 0xA000, so this value is
      added to trapnum at runtime.  Numargs is the number of arguments that are
      passed to the system procedure.  Additional arguments that are included will
      vary, depending on which system procedure is called.  Special attention must
      be paid to the types of arguments and return values that a system procedure
      uses.  
      
      NS Basic/Palm only supports calling OS Traps that have arguments and return 
      values of type char*, int, or double.
      
      SysTrapSub has a limit of 6 parameters, while SysTrapFunc has a limit of 5 parameters.
      
   Examples: (NS Basic/Palm IDE)
      SysTrapSub 564, 1, 3*256            'Calls trap 0xA234 (SndPlaySystemSound)
      SysTrapSub 531, 4, 80, 0, 80, 160   'Calls trap 0xA213 (WinDrawLine)

Some common SysTrap functions are in the NSBSystemLib shared library. They are much more easily used from that library.

When calling routines in shared libraries, it is important to use the correct variable types. The calling routine uses the variable type to place the values on the stack to be passed to the shared library. A shared library will expect each argument passed to it to be the proper type.

If you use literals, NS Basic/Palm will assume you mean certain data types. These are:

Numbers without a decimal point 63 Int32
Numbers with a decimal point 1.5 double
Strings "Hello" Char *
Calculations (1/2) float (except when the result is 0)

It is much safer, however, only to use variables defined by Dim statements when passing parameters to SysTrapFunc and SysTrapSub. For scalar values, the following data types will be used:

Short Int16
Integer Int32
Float float (4-byte IEEE floating point)
Double double (8-byte IEEE floating point)
String Char * (null-terminated)
Byte unsigned char * (single-byte)
Variant void *

If an API function requires a char or Char parameter, you can pass it as a single Short.

Scalar types are normally passed by value, with the exception of strings and bytes, which are always passed by reference/pointer. You can also pass entire arrays of Byte, Short, Integer, Float, or Double. This allows you to use the API functions that fill arrays and even structures. You will have to interpret structures in your NSBasic program, of course. All structures filled by the Palm API functions are big-endian, meaning that the most significant bytes and words come first.

The array mechanism also allows you to pass single parameters by reference/pointer. Declare an array using the Dim statement containing two or more elements of the desired data type. Use the first element as the value. (It is necessary to declare two or more elements because, at runtime, a single-element array is indistinguishable from a scalar.)

Example:

The following code shows how to display the current day and month using API calls:

Dim dt(7) as Short
Dim s as Integer

s = SysTrapFunc(245, 0)     ' TimGetSeconds
SysTrapSub 252, 2, s, dt    ' TimSecondsToDateTime
MsgBox str(dt(4))
MsgBox str(dt(5))

Rationale:

The TimGetSeconds and TimSecondsToDateTime functions are described in the Palm OS Reference as follows:

UInt32 TimGetSeconds (void)
void TimSecondsToDateTime (UInt32 seconds, DateTimePtr dateTimeP)

TimGetSeconds is a function that returns a 32-bit integer, hence an Integer. TimSecondsToDateTime returns void, which means it should be used as a subroutine. It takes a 32-bit integer and a DateTimePtr as parameters and fills the DateTimeType structure pointed to by the DateTimePtr with information about the current date. The DateTimeType structure is described in the Palm OS reference as follows:

typedef struct{
    Int16 second;
    Int16 minute;
    Int16 hour;
    Int16 day;
    Int16 month;
    Int16 year;
    Int16 weekDay;
} DateTimeType;

typedef DateTimeType *DateTimePtr;

This is a straighforward structure containing seven elements, all of which are 16-bit integers, so we can use a seven-element Short array. The day is element 4, and the month is element 5. The trap numbers are given in the Palm OS headers as follows:

#define sysTrapTimGetSeconds							0xA0F5
#define sysTrapTimSecondsToDateTime						0xA0FC

When the A is removed, these are 0F5 and 0FC, which convert to decimal 245 and 252, respectively.


Palm has documention on the API calls on its website:
http://www.palmos.com/dev/tech/docs/

For more information on SysTraps, visit the Web Board at http://groups.yahoo.com/group/nsbasic-palmAPI


Table of Operating System APIs (SysTraps)

A trapnum greater than 882 is Palm OS 3.5 or newer.
A trapnum greater than 1000 is Palm OS 4.0 or newer.
A trapnum greater than 1115 is Palm OS 5.0 or newer.
Palm has Palm OS 5.0 Simulator on its website:
http://www.palmos.com/dev/tools/simulator/

AbtShowAbout 687
AccessorDispatch 1012
AlmAlarmCallback 567
AlmCancelAll 566
AlmDisplayAlarm 570
AlmEnableNotification 571
AlmGetAlarm 569
AlmInit 565
AlmSetAlarm 568
AlmTimeChange 868
AttnAllowClose 1072
AttnDoEmergencySpecialEffects 1071
AttnDoSpecialEffects 1070
AttnEffectOfEvent 1068
AttnEnableNotification 1074
AttnForgetIt 1064
AttnGetAttention 1062
AttnGetCounts 1065
AttnHandleEvent 1067
AttnIndicatorAllow 1053
AttnIndicatorAllowed 1054
AttnIndicatorCheckBlink 1060
AttnIndicatorEnable 1055
AttnIndicatorEnabled 1056
AttnIndicatorGetBlinkPattern 1058
AttnIndicatorSetBlinkPattern 1057
AttnIndicatorTicksTillNextBlink 1059
AttnInitialize 1061
AttnIterate 1069
AttnListOpen 1066
AttnReopen 1073
AttnUpdate 1063
BltCopyRectangle 887
BltDrawChars 888
BltFindIndexes 885
BltGetPixel 1013
BltLineRoutine 889
BltPaintPixel 1014
BltPaintPixels 1111
BltRectangleRoutine 890
BltRoundedRectangle 1045
BltRoundedRectangleFill 1046
BmpBitsSize 994
BmpColortableSize 995
BmpCompress 991
BmpCreate 989
BmpDelete 990
BmpGetBitDepth 1103
BmpGetBits 886
BmpGetColortable 992
BmpGetDimensions 1102
BmpGetNextBitmap 1104
BmpGetSizes 1109
BmpSize 993
CategoryCreateList 707
CategoryCreateListV10 257
CategoryEdit 802
CategoryEditV10 261
CategoryEditV20 709
CategoryFind 259
CategoryFreeList 708
CategoryFreeListV10 258
CategoryGetName 260
CategoryGetNext 263
CategoryInitialize 764
CategorySelect 710
CategorySelectV10 262
CategorySetName 769
CategorySetTriggerLabel 264
CategoryTruncateName 265
ClipboardAddItem 266
ClipboardAppendItem 880
ClipboardCheckIfItemExist 267
ClipboardGetItem 268
CncAddProfile 876
CncDeleteProfile 877
CncGetProfileInfo 875
CncGetProfileList 874
CncMgrDispatch 1008
ConGetS 222
ConPutS 221
Crc16CalcBlock 601
CtlDrawControl 269
CtlEnabled 281
CtlEraseControl 270
CtlGetLabel 275
CtlGetSliderValues 986
CtlGetValue 273
CtlHandleEvent 277
CtlHideControl 271
CtlHitControl 278
CtlNewControl 812
CtlNewGraphicControl 937
CtlNewSliderControl 988
CtlSetEnabled 279
CtlSetGraphics 985
CtlSetLabel 276
CtlSetSliderValues 987
CtlSetUsable 280
CtlSetValue 274
CtlShowControl 272
CtlValidatePointer 808
DateAdjust 612
DateDaysToDate 610
DateSecondsToDate 613
DateTemplateToAscii 973
DateToAscii 614
DateToDays 611
DateToDOWDMFormat 615
DayDrawDays 606
DayDrawDaySelector 604
DayHandleEvent 605
DayOfMonth 609
DayOfWeek 607
DaysInMonth 608
DbgCommSettings 131
DbgControl 833
DbgGetMessage 130
DbgMessage 129
DbgSerDrvClose 952
DbgSerDrvControl 953
DbgSerDrvOpen 951
DbgSerDrvReadChar 956
DbgSerDrvStatus 954
DbgSerDrvWriteChar 955
DbgSrcMessage 128
DlkControl 679
DlkDispatchRequest 733
DlkGetSyncInfo 681
DlkSetLogEntry 682
DlkStartServer 680
DmArchiveRecord 88
DmAttachRecord 82
DmAttachResource 106
DmCloseDatabase 74
DmCreateDatabase 65
DmCreateDatabaseFromImage 127
DmDatabaseInfo 70
DmDatabaseProtect 747
DmDatabaseSize 72
DmDeleteCategory 711
DmDeleteDatabase 66
DmDeleteRecord 87
DmDetachRecord 83
DmDetachResource 107
DmFindDatabase 69
DmFindDatabaseWithTypeCreator 1037
DmFindRecordByID 123
DmFindResource 101
DmFindResourceType 100
DmFindSortPosition 754
DmFindSortPositionV10 125
DmGet1Resource 96
DmGetAppInfoID 124
DmGetDatabase 68
DmGetDatabaseLockState 873
DmGetLastErr 78
DmGetNextDatabaseByTypeCreator 120
DmGetRecord 92
DmGetResource 95
DmGetResourceIndex 110
DmInit 64
DmInsertionSort 692
DmMoveCategory 116
DmMoveOpenDBContext 122
DmMoveRecord 84
DmNewHandle 89
DmNewRecord 85
DmNewResource 108
DmNextOpenDatabase 75
DmNextOpenResDatabase 99
DmNumDatabases 67
DmNumRecords 79
DmNumRecordsInCategory 113
DmNumResources 103
DmOpenDatabase 73
DmOpenDatabaseByTypeCreator 117
DmOpenDatabaseInfo 76
DmOpenDBNoOverlay 944
DmOpenDBWithLocale 945
DmPositionInCategory 114
DmQueryNextInCategory 112
DmQueryRecord 91
DmQuickSort 111
DmRecordInfo 80
DmReleaseRecord 94
DmReleaseResource 97
DmRemoveRecord 86
DmRemoveResource 109
DmRemoveSecretRecords 90
DmResetRecordStates 77
DmResizeRecord 93
DmResizeResource 98
DmResourceInfo 104
DmSearchRecord 690
DmSearchResource 102
DmSeekRecordInCategory 115
DmSet 126
DmSetDatabaseInfo 71
DmSetRecordInfo 81
DmSetResourceInfo 105
DmStrCopy 119
DmWrite 118
DmWriteCheck 121
EncDES 766
EncDigestMD4 765
EncDigestMD5 753
ErrAlertCustom 869
ErrDisplayFileLineMsg 132
ErrExceptionList 136
ErrLongJump 134
ErrSetJump 133
ErrThrow 135
EvtAddEventToQueue 283
EvtAddUniqueEventToQueue 758
EvtCopyEvent 284
EvtDequeueKeyEvent 302
EvtDequeuePenPoint 296
EvtDequeuePenStrokeInfo 295
EvtEnableGraffiti 306
EvtEnqueueKey 301
EvtEnqueuePenPoint 294
EvtEventAvail 716
EvtFlushKeyQueue 300
EvtFlushNextPenStroke 297
EvtFlushPenQueue 293
EvtGetEvent 285
EvtGetPen 286
EvtGetPenBtnList 290
EvtGetSilkscreenAreaList 971
EvtGetSysEvent 288
EvtInitialize 282
EvtKeyQueueEmpty 305
EvtKeyQueueSize 299
EvtPenQueueSize 292
EvtProcessSoftKeyStroke 289
EvtResetAutoOffTimer 304
EvtSetAutoOffTimer 941
EvtSetKeyQueuePtr 298
EvtSetNullEventTick 997
EvtSetPenQueuePtr 291
EvtSysEventAvail 717
EvtSysInit 287
EvtWakeup 303
EvtWakeupWithoutNilEvent 1010
ExgAccept 779
ExgConnect 776
ExgControl 1033
ExgDBRead 834
ExgDBWrite 835
ExgDisconnect 780
ExgDoDialog 998
ExgGet 778
ExgGetDefaultApplication 1028
ExgGetRegisteredApplications 1030
ExgGetRegisteredTypes 1031
ExgGetTargetApplication 1029
ExgInit 775
ExgNotifyGoto 1025
ExgNotifyPreview 1032
ExgNotifyReceive 1024
ExgNotifyReceiveV35 784
ExgPut 777
ExgReceive 782
ExgRegisterData 783
ExgRegisterDatatype 1023
ExgRequest 1026
ExgSend 781
ExgSetDefaultApplication 1027
ExpansionDispatch 839
FileClose 819
FileControl 826
FileDelete 820
FileOpen 818
FileReadLow 821
FileSeek 823
FileSystemDispatch 840
FileTell 824
FileTruncate 825
FileWrite 822
Find 617
FindDrawHeader 621
FindGetLineBounds 620
FindSaveMatch 619
FindStrInStr 618
FlashCompress 865
FlashErase 866
FlashInit 864
FlashProgram 867
FldCalcFieldHeight 338
FldCompactText 340
FldCopy 307
FldCut 308
FldDelete 350
FldDirty 341
FldDrawField 309
FldEraseField 310
FldFreeMemory 311
FldGetAttributes 335
FldGetBounds 312
FldGetFont 320
FldGetInsPtPosition 325
FldGetMaxChars 346
FldGetNumberOfBlankLines 744
FldGetScrollPosition 328
FldGetScrollValues 730
FldGetSelection 314
FldGetTextAllocatedSize 330
FldGetTextHandle 339
FldGetTextHeight 329
FldGetTextLength 331
FldGetTextPtr 313
FldGetVisibleLines 334
FldGrabFocus 323
FldHandleEvent 315
FldInsert 349
FldMakeFullyVisible 354
FldNewField 813
FldPaste 316
FldRecalculateField 317
FldReleaseFocus 324
FldScrollable 333
FldScrollField 332
FldSendChangeNotification 337
FldSendHeightChangeNotification 353
FldSetAttributes 336
FldSetBounds 318
FldSetDirty 352
FldSetFont 321
FldSetInsertionPoint 770
FldSetInsPtPosition 326
FldSetMaxChars 347
FldSetMaxVisibleLines 1112
FldSetScrollPosition 327
FldSetSelection 322
FldSetText 319
FldSetTextAllocatedSize 343
FldSetTextHandle 344
FldSetTextPtr 345
FldSetUsable 348
FldUndo 351
FldWordWrap 342
FlpDispatch 773
FlpEmDispatch 774
FntAverageCharWidth 361
FntBaseLine 358
FntCharHeight 359
FntCharsInWidth 365
FntCharsWidth 363
FntCharWidth 362
FntDefineFont 801
FntDescenderHeight 364
FntGetFont 355
FntGetFontPtr 357
FntGetScrollValues 740
FntLineHeight 360
FntLineWidth 366
FntPrvGetFontList 1022
FntSetFont 356
FntWCharWidth 1036
FntWidthToOffset 846
FntWordWrap 729
FntWordWrapReverseNLines 739
FontSelect 800
FplAdd 232
FplAToF 226
FplBase10Info 227
FplDiv 234
FplFloatToLong 229
FplFloatToULong 230
FplFree 224
FplFToA 225
FplInit 223
FplLongToFloat 228
FplMul 231
FplSub 233
FrmActiveState 827
FrmAddSpaceForObject 810
FrmAlert 402
FrmCloseAllForms 417
FrmCopyLabel 396
FrmCopyTitle 410
FrmCustomAlert 404
FrmCustomResponseAlert 979
FrmDeleteForm 368
FrmDispatchEvent 416
FrmDoDialog 403
FrmDrawForm 369
FrmEraseForm 370
FrmGetActiveField 1093
FrmGetActiveForm 371
FrmGetActiveFormID 373
FrmGetControlGroupSelection 394
FrmGetControlValue 392
FrmGetFirstForm 407
FrmGetFocus 376
FrmGetFormBounds 379
FrmGetFormId 381
FrmGetFormPtr 382
FrmGetGadgetData 419
FrmGetLabel 398
FrmGetNumberOfObjects 383
FrmGetObjectBounds 409
FrmGetObjectId 385
FrmGetObjectIndex 384
FrmGetObjectIndexFromPtr 1108
FrmGetObjectPosition 390
FrmGetObjectPtr 387
FrmGetObjectType 386
FrmGetTitle 400
FrmGetUserModifiedState 374
FrmGetWindowHandle 380
FrmGotoForm 411
FrmHandleEvent 378
FrmHelp 405
FrmHideObject 388
FrmInitForm 367
FrmNewBitmap 816
FrmNewForm 811
FrmNewGadget 817
FrmNewGsi 980
FrmNewLabel 815
FrmPointInTitle 725
FrmPopupForm 412
FrmRemoveObject 837
FrmReturnToForm 414
FrmSaveAllForms 418
FrmSetActiveForm 372
FrmSetCategoryLabel 399
FrmSetCategoryTrigger 421
FrmSetControlGroupSelection 395
FrmSetControlValue 393
FrmSetEventHandler 415
FrmSetFocus 377
FrmSetGadgetData 420
FrmSetGadgetHandler 984
FrmSetLabel 397
FrmSetMenu 752
FrmSetNotUserModified 375
FrmSetObjectBounds 771
FrmSetObjectPosition 391
FrmSetTitle 401
FrmShowObject 389
FrmUpdateForm 413
FrmUpdateScrollers 406
FrmValidatePtr 807
FrmVisible 408
FtrGet 635
FtrGetByIndex 637
FtrInit 633
FtrPtrFree 859
FtrPtrNew 858
FtrPtrResize 860
FtrSet 636
FtrUnregister 634
GetCharAttr 661
GetCharCaselessValue 662
GetCharSortValue 660
GrfAddMacro 656
GrfAddPoint 643
GrfCleanState 645
GrfDeleteMacro 655
GrfFieldChange 659
GrfFilterPoints 648
GrfFindBranch 651
GrfFlushPoints 642
GrfFree 639
GrfGetAndExpandMacro 657
GrfGetGlyphMapping 653
GrfGetMacro 647
GrfGetMacroName 654
GrfGetNumPoints 649
GrfGetPoint 650
GrfGetState 640
GrfInit 638
GrfInitState 644
GrfMatch 646
GrfMatchGlyph 652
GrfProcessStroke 658
GrfSetState 641
GsiEnable 669
GsiEnabled 670
GsiInitialize 667
GsiSetLocation 668
GsiSetShiftState 671
HostControl 836
HwrBacklightV33 746
HwrBattery 872
HwrBatteryLevel 584
HwrCalcDynamicHeapSize 1048
HwrCursorV33 583
HwrCustom 1092
HwrDebuggerEnter 1049
HwrDebuggerExit 1050
HwrDebugSelect 1044
HwrDelay 585
HwrDisableDataWrites 587
HwrDisplayAttributes 882
HwrDisplayDoze 883
HwrDisplayDrawBootScreen 589
HwrDisplayInit 580
HwrDisplayPalette 884
HwrDisplaySleep 581
HwrDisplayWake 592
HwrDockSignals 599
HwrDockStatus 845
HwrDoze 575
HwrEnableDataWrites 586
HwrFlashWrite 1079
HwrGetRAMMapping 572
HwrGetROMToken 832
HwrGetSilkscreenID 970
HwrIdentifyFeatures 958
HwrInterruptsInit 961
HwrIRQ1Handler 593
HwrIRQ2Handler 594
HwrIRQ3Handler 595
HwrIRQ4Handler 596
HwrIRQ5Handler 597
HwrIRQ6Handler 598
HwrLCDBaseAddrV33 588
HwrLCDContrastV33 842
HwrLCDGetDepthV33 831
HwrLEDAttributes 1075
HwrMemReadable 574
HwrMemWritable 573
HwrModelInitStage2 960
HwrModelInitStage3 1052
HwrModelSpecificInit 959
HwrNVPrefGet 863
HwrNVPrefSet 862
HwrPluggedIn 600
HwrPostDebugInit 957
HwrPreDebugInit 947
HwrResetNMI 948
HwrResetPWM 949
HwrSetCPUDutyCycle 579
HwrSetSystemClock 578
HwrSleep 576
HwrSoundOff 963
HwrSoundOn 962
HwrTimerInit 582
HwrTimerSleep 590
HwrTimerWake 591
HwrVibrateAttributes 1076
HwrWake 577
ImcReadFieldNoSemicolon 790
ImcReadFieldQuotablePrintable 791
ImcReadPropertyParameter 792
ImcReadWhiteSpace 794
ImcSkipAllPropertyParameters 793
ImcStringIsAscii 797
ImcWriteNoSemicolon 796
ImcWriteQuotedPrintable 795
InsPtCheckBlink 431
InsPtEnable 427
InsPtEnabled 428
InsPtGetHeight 430
InsPtGetLocation 426
InsPtInitialize 424
InsPtSetHeight 429
InsPtSetLocation 425
IntlDispatch 683
KbdDraw 1088
KbdErase 1089
KbdGetLayout 1083
KbdGetPosition 1085
KbdGetShiftState 1087
KbdHandleEvent 1090
KbdSetLayout 1082
KbdSetPosition 1084
KbdSetShiftState 1086
KeyboardStatusFree 1081
KeyboardStatusNew 1080
KeyBootKeys 950
KeyCurrentState 674
KeyHandleInterrupt 673
KeyInit 672
KeyRates 676
KeyResetDoubleTap 675
KeySetMask 719
KeySleep 677
KeyWake 678
LastTrapNumber 1126
LmDispatch 1034
LocGetNumberSeparators 761
LstDrawList 433
LstEraseList 434
LstGetNumberOfItems 442
LstGetSelection 435
LstGetSelectionText 436
LstGetTopItem 1051
LstGetVisibleItems 767
LstHandleEvent 437
LstMakeItemVisible 441
LstNewList 814
LstPopupList 443
LstScrollList 763
LstSetDrawFunction 432
LstSetHeight 438
LstSetListChoices 440
LstSetPosition 444
LstSetSelection 439
LstSetTopItem 693
MdmDial 688
MdmHangUp 689
MemCardFormat 3
MemCardInfo 4
MemChunkFree 18
MemChunkNew 17
MemCmp 727
MemDebugMode 59
MemGetRomNVParams 1035
MemHandleCardNo 49
MemHandleDataStorage 48
MemHandleFlags 44
MemHandleFree 43
MemHandleHeapID 47
MemHandleLock 33
MemHandleLockCount 31
MemHandleNew 30
MemHandleOwner 46
MemHandleResetLock 52
MemHandleResize 51
MemHandleSetOwner 50
MemHandleSize 45
MemHandleToLocalID 32
MemHandleUnlock 34
MemHeapCheck 57
MemHeapCompact 14
MemHeapDynamic 62
MemHeapFlags 13
MemHeapFreeByOwnerID 16
MemHeapFreeBytes 11
MemHeapID 9
MemHeapInit 15
MemHeapPtr 10
MemHeapScramble 56
MemHeapSize 12
MemInit 0
MemInitHeapTable 1
MemKernelInit 42
MemLocalIDKind 36
MemLocalIDToGlobal 35
MemLocalIDToLockedPtr 54
MemLocalIDToPtr 37
MemMove 38
MemNumCards 58
MemNumHeaps 7
MemNumRAMHeaps 8
MemNVParams 63
MemPtrCardNo 25
MemPtrDataStorage 879
MemPtrFlags 21
MemPtrHeapID 24
MemPtrNew 19
MemPtrOwner 23
MemPtrRecoverHandle 20
MemPtrResetLock 29
MemPtrResize 28
MemPtrSetOwner 27
MemPtrSize 22
MemPtrToLocalID 26
MemPtrUnlock 53
MemSemaphoreRelease 61
MemSemaphoreReserve 60
MemSet 39
MemSetDebugMode 55
MemStoreInfo 5
MemStoreInit 2
MemStoreSearch 40
MemStoreSetInfo 6
MenuAddItem 983
MenuCmdBarAddButton 967
MenuCmdBarDisplay 969
MenuCmdBarGetButtonData 968
MenuDispose 446
MenuDrawMenu 448
MenuEraseMenu 965
MenuEraseStatus 449
MenuGetActiveMenu 450
MenuHandleEvent 447
MenuHideItem 982
MenuInit 445
MenuSetActiveMenu 451
MenuSetActiveMenuRscID 762
MenuShowItem 981
MultimediaDispatch 1125
OEMDispatch 841
OEMDispatch2 1091
OmDispatch 943
PalmPrivate1 1098
PalmPrivate2 1099
PalmPrivate3 1100
PalmPrivate4 1101
PceNativeCall 1114
PenCalibrate 625
PenClose 623
PenGetRawPen 624
PenOpen 622
PenRawToScreen 626
PenResetCalibration 628
PenScreenToRaw 627
PenSleep 629
PenWake 630
PhoneNumberLookup 751
PhoneNumberLookupCustom 1043
PrefGetAppPreferences 723
PrefGetAppPreferencesV10 558
PrefGetPreference 721
PrefGetPreferences 556
PrefOpenPreferenceDB 736
PrefOpenPreferenceDBV10 555
PrefSetAppPreferences 724
PrefSetAppPreferencesV10 559
PrefSetPreference 722
PrefSetPreferences 557
PrgHandleEvent 789
PrgStartDialog 870
PrgStartDialogV31 786
PrgStopDialog 787
PrgUpdateDialog 788
PwdExists 663
PwdRemove 666
PwdSet 665
PwdVerify 664
RctCopyRectangle 453
RctGetIntersection 457
RctInsetRectangle 454
RctOffsetRectangle 455
RctPtInRectangle 456
RctSetRectangle 452
ResLoadConstant 946
ResLoadForm 631
ResLoadMenu 632
SclDrawScrollBar 695
SclGetScrollBar 743
SclHandleEvent 696
SclSetScrollBar 694
ScrCompress 891
ScrCompressScanLine 243
ScrCopyRectangle 236
ScrDecompress 892
ScrDeCompressScanLine 244
ScrDefaultPaletteState 1113
ScrDrawChars 237
ScrDrawNotify 241
ScrGetColortable 1018
ScrGetGrayPat 1019
ScrLineRoutine 238
ScrPalette 1017
ScrRectangleRoutine 239
ScrScreenInfo 240
ScrScreenInit 1015
ScrScreenLock 1020
ScrScreenUnlock 1021
ScrSendUpdateArea 242
ScrUpdateScreenBitmap 1016
SecGetPwdHint 1077
SecSelectViewStatus 975
SecSetPwdHint 1078
SecVerifyPW 974
SelectDay 720
SelectDayV10 602
SelectOneTime 847
SelectTime 966
SelectTimeV33 603
SelectTimeZone 1038
SerialDispatch 871
SerReceiveISP 208
SlkClose 210
SlkCloseSocket 212
SlkFlushSocket 215
SlkOpen 209
SlkOpenSocket 211
SlkProcessRPC 220
SlkReceivePacket 218
SlkSendPacket 217
SlkSetSocketListener 216
SlkSocketRefNum 213
SlkSocketSetTimeout 214
SlkSysPktDefaultResponse 219
SndCreateMidiList 686
SndDoCmd 563
SndGetDefaultVolume 562
SndInit 560
SndInterruptSmfIrregardless 1096
SndPlayResource 1122
SndPlaySmf 685
SndPlaySmfIrregardless 1094
SndPlaySmfResource 878
SndPlaySmfResourceIrregardless 1095
SndPlaySystemSound 564
SndSetDefaultVolume 561
SndStreamCreate 1115
SndStreamDelete 1116
SndStreamGetPan 1124
SndStreamGetVolume 1121
SndStreamPause 1118
SndStreamSetPan 1123
SndStreamSetVolume 1120
SndStreamStart 1117
SndStreamStop 1119
StrAToI 206
StrCaselessCompare 202
StrCat 198
StrChr 204
StrCompare 200
StrCompareAscii 1011
StrCopy 197
StrDelocalizeNumber 760
StrIToA 201
StrIToH 203
StrLen 199
StrLocalizeNumber 759
StrNCaselessCompare 750
StrNCat 726
StrNCompare 749
StrNCompareAscii 1040
StrNCopy 718
StrPrintF 734
StrStr 205
StrToLower 207
StrVPrintF 735
SysAppExit 144
SysAppLaunch 142
SysAppLauncherDialog 180
SysAppStartup 143
SysBatteryDialog 187
SysBatteryInfo 804
SysBatteryInfoV20 182
SysBinarySearch 755
SysBroadcastActionCode 137
SysColdBoot 139
SysCopyStringResource 188
SysCreateDataBaseList 731
SysCreatePanelList 732
SysCurAppDatabase 172
SysCurAppInfoPV20 168
SysDisableInts 165
SysDoze 141
SysErrString 756
SysEvGroupCreate 712
SysEvGroupRead 714
SysEvGroupSignal 713
SysEvGroupWait 715
SysFatalAlert 173
SysFatalAlertInit 972
SysFormPointerArrayToStrings 193
SysGetAppInfo 828
SysGetOSVersionString 803
SysGetStackInfo 829
SysGetTrapAddress 147
SysGraffitiReferenceDialog 737
SysHandleEvent 169
SysHighDensitySelector 1004
SysInit 170
SysInsertionSort 691
SysKernelClockTick 964
SysKernelInfo 189
SysKeyboardDialog 738
SysKeyboardDialogV10 179
SysLaunchConsole 190
SysLCDBrightness 893
SysLCDContrast 843
SysLibFind 186
SysLibInstall 183
SysLibLoad 684
SysLibRemove 184
SysLibTblEntry 185
SysMailboxCreate 697
SysMailboxDelete 698
SysMailboxFlush 699
SysMailboxSend 700
SysMailboxWait 701
SysNewOwnerID 163
SysNotifyBroadcast 853
SysNotifyBroadcastDeferred 854
SysNotifyBroadcastFromInterrupt 1009
SysNotifyDatabaseAdded 855
SysNotifyDatabaseRemoved 856
SysNotifyInit 850
SysNotifyRegister 851
SysNotifyUnregister 852
SysQSort 171
SysRandom 194
SysReserved10Trap1 41
SysReserved30Trap1 838
SysReserved30Trap2 785
SysReserved31Trap1 861
SysReserved40Trap1 1004
SysReserved40Trap2 1005
SysReserved40Trap3 1006
SysReserved40Trap4 1007
SysReset 140
SysResSemaphoreCreate 174
SysResSemaphoreDelete 175
SysResSemaphoreRelease 177
SysResSemaphoreReserve 176
SysRestoreStatus 166
SysSemaphoreCreate 149
SysSemaphoreDelete 150
SysSemaphoreSet 164
SysSemaphoreSignal 152
SysSemaphoreWait 151
SysSetA5 145
SysSetAutoOffTime 192
SysSetPerformance 181
SysSetTrapAddress 146
SysSleep 178
SysStringByIndex 757
SysTaskCreate 155
SysTaskDelay 160
SysTaskDelete 156
SysTaskID 158
SysTaskResume 706
SysTaskSetTermProc 161
SysTaskSuspend 705
SysTaskSwitching 195
SysTaskTrigger 157
SysTaskUserInfoPtr 159
SysTaskWait 702
SysTaskWaitClr 704
SysTaskWake 703
SysTicksPerSecond 745
SysTimerCreate 153
SysTimerDelete 191
SysTimerRead 196
SysTimerWrite 154
SysTranslateKernelErr 148
SysUIAppSwitch 167
SysUIBusy 805
SysUICleanup 999
SysUILaunch 162
SysUnimplemented 138
SysWantEvent 857
TblDrawTable 458
TblEditing 488
TblEraseTable 459
TblFindRowData 498
TblFindRowID 495
TblGetBounds 474
TblGetColumnSpacing 497
TblGetColumnWidth 476
TblGetCurrentField 489
TblGetItemBounds 461
TblGetItemFont 798
TblGetItemInt 463
TblGetItemPtr 938
TblGetLastUsableRow 496
TblGetNumberOfColumns 1105
TblGetNumberOfRows 468
TblGetRowData 499
TblGetRowHeight 491
TblGetRowID 477
TblGetSelection 481
TblGetTopRow 1106
TblGrabFocus 493
TblHandleEvent 460
TblHasScrollBar 742
TblInsertRow 482
TblMarkRowInvalid 479
TblMarkTableInvalid 480
TblRedrawTable 485
TblReleaseFocus 487
TblRemoveRow 483
TblRowInvalid 484
TblRowMasked 978
TblRowSelectable 471
TblRowUsable 486
TblSelectItem 462
TblSetBounds 748
TblSetColumnEditIndicator 728
TblSetColumnMasked 976
TblSetColumnSpacing 501
TblSetColumnUsable 490
TblSetColumnWidth 492
TblSetCustomDrawProcedure 469
TblSetItemFont 799
TblSetItemInt 464
TblSetItemPtr 494
TblSetItemStyle 465
TblSetLoadDataProcedure 472
TblSetRowData 500
TblSetRowHeight 475
TblSetRowID 478
TblSetRowMasked 977
TblSetRowSelectable 470
TblSetRowStaticHeight 741
TblSetRowUsable 467
TblSetSaveDataProcedure 473
TblSetSelection 1107
TblUnhighlightSelection 466
TimAdjust 254
TimDateTimeToSeconds 253
TimeToAscii 616
TimeZoneToAscii 1039
TimGetAlarm 250
TimGetSeconds 245
TimGetTicks 247
TimHandleInterrupt 251
TimInit 248
TimSecondsToDateTime 252
TimSetAlarm 249
TimSetSeconds 246
TimSleep 255
TimTimeZoneToUTC 1041
TimUTCToTimeZone 1042
TimWake 256
TsmDispatch 942
UdaMgrDispatch 1097
UIBrightnessAdjust 939
UIColorGetTableEntryIndex 932
UIColorGetTableEntryRGB 933
UIColorInit 931
UIColorPopTable 936
UIColorPushTable 935
UIColorSetTableEntry 934
UIContrastAdjust 844
UIInitialize 422
UIPickColor 940
UIReset 423
WiCmdV32 881
WinAddWindow 506
WinClipRectangle 530
WinCopyRectangle 521
WinCreateBitmapWindow 996
WinCreateOffscreenWindow 503
WinCreateWindow 502
WinDeleteWindow 504
WinDisableWindow 515
WinDisplayToWindowPt 525
WinDrawArc 913
WinDrawBitmap 550
WinDrawChar 848
WinDrawChars 544
WinDrawGrayLine 532
WinDrawGrayRectangleFrame 540
WinDrawInvertedChars 554
WinDrawLine 531
WinDrawPixel 899
WinDrawPolygon 908
WinDrawRectangle 536
WinDrawRectangleFrame 539
WinDrawTruncChars 849
WinDrawWindowFrame 517
WinEnableWindow 514
WinEraseArc 914
WinEraseChars 545
WinEraseLine 533
WinErasePixel 900
WinErasePolygon 909
WinEraseRectangle 537
WinEraseRectangleFrame 541
WinEraseWindow 518
WinFillArc 916
WinFillLine 535
WinFillPolygon 911
WinFillRectangle 553
WinGetActiveWindow 511
WinGetBitmap 930
WinGetBounds 1110
WinGetClip 527
WinGetDisplayExtent 523
WinGetDisplayWindow 512
WinGetDrawWindow 510
WinGetDrawWindowBounds 552
WinGetFirstWindow 513
WinGetFramesRectangle 543
WinGetPattern 547
WinGetPatternType 923
WinGetPixel 897
WinGetPixelRGB 1003
WinGetWindowExtent 524
WinGetWindowFrameRect 516
WinIndexToRGB 927
WinInitializeWindow 505
WinInvertArc 915
WinInvertChars 546
WinInvertLine 534
WinInvertPixel 901
WinInvertPolygon 910
WinInvertRectangle 538
WinInvertRectangleFrame 542
WinModal 551
WinMoveWindowAddr 809
WinPaintArc 912
WinPaintBitmap 896
WinPaintChar 894
WinPaintChars 895
WinPaintLine 904
WinPaintLines 903
WinPaintPixel 898
WinPaintPixels 902
WinPaintPolygon 907
WinPaintRectangle 905
WinPaintRectangleFrame 906
WinPalette 925
WinPopDrawState 918
WinPrvInitCanvas 1047
WinPushDrawState 917
WinRemoveWindow 507
WinResetClip 529
WinRestoreBits 520
WinRGBToIndex 926
WinSaveBits 519
WinScreenInit 235
WinScreenLock 928
WinScreenMode 830
WinScreenUnlock 929
WinScrollRectangle 522
WinSetActiveWindow 508
WinSetBackColor 921
WinSetBackColorRGB 1001
WinSetBounds 768
WinSetClip 528
WinSetColors 772
WinSetDrawMode 919
WinSetDrawWindow 509
WinSetForeColor 920
WinSetForeColorRGB 1000
WinSetPattern 548
WinSetPatternType 924
WinSetTextColor 922
WinSetTextColorRGB 1002
WinSetUnderlineMode 549
WinValidateHandle 806
WinWindowToDisplayPt 526

Palm OS 5 trap numbers contributed by Adrian Nicolaiev