ncr/doc/RealPOS/Other/5945_Electronic_Payment - Alsys Data

ncr/doc/RealPOS/Other/5945_Electronic_Payment - Alsys Data ncr/doc/RealPOS/Other/5945_Electronic_Payment - Alsys Data

12.07.2015 Views

NCR 5945 Electronic PaymentTerminalRelease 1.0Developer’s GuideB005-0000-1105Issue B

NCR <strong>5945</strong> <strong>Electronic</strong> <strong>Payment</strong>TerminalRelease 1.0Developer’s GuideB005-0000-1105Issue B


The product described in this book is a licensed product of NCR Corporation.IBM is a registered trademark of International Business Machines, Inc.It is the policy of NCR Corporation (NCR) to improve products as new technology, components, software,and firmware become available. NCR, therefore, reserves the right to change specifications without priornotice.All features, functions, and operations described herein may not be marketed by NCR in all parts of theworld. In some instances, photographs are of equipment prototypes. Therefore, before using this <strong>doc</strong>ument,consult with your NCR representative or NCR office for information that is applicable and current.To maintain the quality of our publications, we need your comments on the accuracy, clarity, organization,and value of this book.Address correspondence to:Retail Solutions Group−AtlantaNCR Corporation2651 Satellite Blvd.Duluth, GA 30096Copyright © 1999By NCR CorporationDayton, Ohio U.S.A.All Rights Reserved


Developer’s GuideiTable of ContentsChapter 1: OverviewIntroduction ..................................................................1-1Intended Audience.................................................1-1<strong>5945</strong> Features.................................................................1-2Hardware Features.................................................1-2Software Features ...................................................1-3<strong>5945</strong> Character Pattern .................................................1-4<strong>5945</strong> Bookshelf ..............................................................1-5NCR <strong>5945</strong> User’s Guide .....................................1-5NCR <strong>5945</strong> Developer’s Guide............................1-5Developer’s Kit .............................................................1-5Chapter 2: Porting an NCR 5944 ApplicationGeneral Considerations..........................................2-1Required Modifications..........................................2-1Chapter 3: Programming the <strong>5945</strong>General Considerations................................................3-1Software Architecture ............................................3-1Security Module (SM) ........................................3-2FLASH Resident Operating System (OS) .........3-2FLASH Resident Application ............................3-2Security....................................................................3-3Security Module Routines .................................3-3Keypad................................................................3-3Input/Output Devices ...........................................3-3Integrated User Interface ...................................3-3


iiDeveloper’s GuideI/O Ports.............................................................3-4Developing a <strong>5945</strong> Application....................................3-4OS/Application Load File Format ........................3-7<strong>5945</strong> Response Statuses......................................3-8Aborting a Load in Process................................3-8VLI vs. Raw Mode..................................................3-8Loading the <strong>5945</strong> ....................................................3-9<strong>5945</strong> Detects a Corrupted Application or OSat Power-Up........................................................3-9OS/Application Replacement...........................3-9Manual Intervention ..........................................3-9Reset Device (Function Code 09h) ...................... 3-10Message Formats.............................................. 3-10Beeper Programming ................................................. 3-10<strong>5945</strong> Specific C Library Functions ....................... 3-10_tone()................................................................ 3-10Clock Programming ................................................... 3-11Microsoft C Library <strong>Data</strong> Structures................... 3-11typedef struct dosdate_t .................................. 3-11typedef struct dostime_t .................................. 3-11Microsoft C Library Functions ............................ 3-11_dos_getdate() .................................................. 3-12_dos_gettime() .................................................. 3-12_dos_setdate()................................................... 3-12_dos_settime()................................................... 3-13Display Programming................................................ 3-14The Display Pages ............................................ 3-14ANSI C Library Functions ................................... 3-15Display Library Functions ................................... 3-15_clearscreen() .................................................... 3-15_getactivepage()................................................ 3-16_getvisualpage() ............................................... 3-16


Developer’s Guideiii_outtext()........................................................... 3-17_setactivepage() ................................................ 3-17_settextposition() .............................................. 3-18_setvisualpage()................................................ 3-18<strong>5945</strong> Specific C Library Functions ....................... 3-19_scrolltext()........................................................ 3-19_stopscroll()....................................................... 3-19_setftable()......................................................... 3-20Key Management Programming ............................... 3-20PIN Block .............................................................. 3-20Standard............................................................ 3-20Alternate (Diebold Style) ................................. 3-20<strong>5945</strong> Specific C Library Functions ....................... 3-21_decrypt().......................................................... 3-21_e<strong>ncr</strong>ypt().......................................................... 3-21_key_stat()......................................................... 3-21_load_working_key() ....................................... 3-22_mac_clear()...................................................... 3-23_mac_gen()........................................................ 3-23_pin_enable() .................................................... 3-23_pin_enable_b() ................................................ 3-25_pin_get() .......................................................... 3-26_pin_get_b() ...................................................... 3-27_pin_status() ..................................................... 3-28_secure_abort() ................................................. 3-29_ukpt_status()................................................... 3-29_upin_enable().................................................. 3-30_upin_test() ....................................................... 3-31Keypad Programming................................................ 3-32The ASCII Keycodes............................................. 3-33ANSI C Library Functions ................................... 3-33


ivDeveloper’s GuideMicrosoft C Library Functions ............................ 3-33getch()................................................................ 3-34getche().............................................................. 3-34kbhit()................................................................ 3-35<strong>5945</strong> Specific C Library Functions ....................... 3-35_disablekeyboard()........................................... 3-35_enablekeyboard()............................................ 3-35_getkeyclick().................................................... 3-36_getkeymask()................................................... 3-36_initkeyboard() ................................................. 3-36_setkeyclick() .................................................... 3-37_setkeymask() ................................................... 3-37Magnetic Stripe Reader (MSR) Programming.......... 3-39<strong>5945</strong> Specific C Library Functions ....................... 3-39_cardswiped() ................................................... 3-39_disablemsr() .................................................... 3-40_enablemsr() ..................................................... 3-40_getmsrtone().................................................... 3-40_readmsr()......................................................... 3-41_setmsrformat() ................................................ 3-42_setmsrtone() .................................................... 3-42Serial I/O Programming ............................................ 3-43The Host Port........................................................ 3-43The EIA-232-D Aux Ports .................................... 3-44Baud Rate.......................................................... 3-45Word Length and Parity .................................. 3-45Legal Port Configurations ............................... 3-45<strong>5945</strong> Specific C Library Functions ....................... 3-45_closeaux1() ...................................................... 3-46_closehcom(), _closeaux2(), _closeaux3()........ 3-46_enableaux2(), _enableaux3() .......................... 3-46


Developer’s Guidev_disableaux2(), _disableaux3() ........................ 3-47_getstathcom(), _getstataux1(),_getstataux2(), _getstataux3().......................... 3-47_openaux1() ...................................................... 3-47_openhcom(), _openaux2(), _openaux3() ....... 3-48_readaux1() ....................................................... 3-49_readhcom(), _readaux2(), _readaux3().......... 3-49_setctrlhcom(), _setctrlaux2(), _setctrlaux3().. 3-50_writeaux1()...................................................... 3-50_writehcom(), _writeaux2(), _writeaux3()...... 3-50Timer Programming................................................... 3-51_canceltimer() ................................................... 3-51_delay().............................................................. 3-51_gettimerstat()................................................... 3-51_inittimer() ........................................................ 3-52_settimer() ......................................................... 3-52Chapter 4: Host/NCR 4430 Emulation InterfaceIntroduction ..................................................................4-1Application Programming Functions ...................4-1Special Function Keypad Input – Function Code83H...........................................................................4-2Read All Tracks - Function Code 10H ..................4-3Read Track 1 - Function Code 91H .......................4-5Read Track 2 - Function Code 92H .......................4-6Input PIN Using Standard PIN Block - FunctionCode 20H.................................................................4-7Optional PIN Entry Using Standard PIN Block- Function Code 0EH..............................................4-9Input PIN Using Alternate PIN Block - FunctionCode 85H............................................................... 4-11Optional PIN Entry Using The Alternate PINBlock - Function Code 13H................................. 4-12


viDeveloper’s GuideInput From Keypad - Function Code A2H......... 4-14Remote Display Write - Function Code 23H...... 4-16Remote Display Table 1 Load - Function CodeA4H ....................................................................... 4-16Remote Display Table 2 Load - Function Code76H......................................................................... 4-17Multiple Display Message Load - FunctionCode 0BH .............................................................. 4-18Remote Display Table 1 Read - Function Code25H......................................................................... 4-19Remote Display Table 2 Read - Function Code79H......................................................................... 4-19Initiate Load - E<strong>ncr</strong>ypted Working Key -Function Code B0H .............................................. 4-20Request for Key Status - Function Code 38H ..... 4-21Resend Last Response - Function Code D0H..... 4-23Abort - Function Code 51H ................................. 4-24Illogical Function Code - Error - No Command. 4-24Incorrect Communications BCC - FunctionCode xxH .............................................................. 4-25Communications Turnaround Test - FunctionCode 40H............................................................... 4-25Set Display Timers - Function Code 89H............ 4-26UKPT Operations........................................................ 4-27UKPT Request - Function Code 15H................... 4-27UKPT PIN Entry Request - Function Code15H,70H................................................................. 4-27UKPT PIN Entry Cancel - Function Code15H,72H................................................................. 4-29UKPT PIN Entry Test Request - Function Code15H,76H................................................................. 4-29UKPT Cardholder <strong>Data</strong> Entry Request -Function Code 15H, 80H...................................... 4-31


Developer’s GuideviiUKPT Cancel and Display Request - FunctionCode 15H,82H...................................................... 4-33Buffering Operations.................................................. 4-34Begin Buffered Input - Function Code 70H....... 4-34Reset Buffered <strong>Data</strong> - Function Code F1H ..... 4-37Read Buffered MSR <strong>Data</strong> - Function Code F2H 4-38Read Buffered Standard Format PIN - FunctionCode 73H.............................................................. 4-39Read Buffered Alternate Format PIN - FunctionCode 08H.............................................................. 4-40Read Buffered Special Function Keypad Input -Function Code 75H............................................... 4-42Level 0 Diagnostics..................................................... 4-43Level 0 Diagnostics Test - Function Code C2H. 4-43Response Code Message <strong>Data</strong> Fields.................. 4-44Non-supported NCR 4430 Emulation Functions4-44Chapter 5: Using the <strong>5945</strong>LD UtilityInstalling the <strong>5945</strong>LD Software .............................5-1Using <strong>5945</strong>LD from the Command Line...............5-1Supplying the Password on the CommandLine......................................................................5-1Building an Application Load File from aHEX file...............................................................5-2Downloading a Load File ..................................5-2Using <strong>5945</strong>LD from the Main Menu .....................5-2Configuration .....................................................5-2Setting Up or Changing Your Password ..............5-3Downloading the Keys...........................................5-3Key definition .....................................................5-3Load UKPT Key or KEKs into <strong>5945</strong> ..................5-4Load Working Key .............................................5-4Test Loaded Keys ...............................................5-5


viiiDeveloper’s GuideCreating a Load File ...............................................5-5Application Load File.........................................5-5Downloading Load Files........................................5-5Index


Developer’s GuideixRevision RecordIssue Date RemarksA Apr 99 First issueB Oct 99 Revision (Chapter-3 & Chapter 4)


xDeveloper’s GuideRadio Frequency Interference StatementsFederal Communications Commission (FCC)Information to UserThis equipment has been tested and found to comply with the limits for a Class Adigital device, pursuant to Part 15 of FCC Rules. These limits are designed to providereasonable protection against harmful interference when the equipment is operated ina commercial environment. This equipment generates, uses, and can radiate radiofrequency energy and, if not installed and used in accordance with the instructionmanual, may cause harmful interference to radio communications. Operation of thisequipment in a residential area is likely to cause interference in which case the userwill be required to correct the interference at his own expense.NCR is not responsible for any radio or television interference caused by unauthorizedmodification of this equipment or the substitution or attachment of connecting cablesand equipment other than those specified by NCR. The correction of interferencecaused by such unauthorized modification, substitution or attachment will be theresponsibility of the user. The user is cautioned that changes or modifications notexpressly approved by NCR may void the user’s authority to operate the equipment.Canadian Department of CommunicationsThis digital apparatus does not exceed the Class A limits for radio noise emissionsfrom digital apparatus set out in the Radio Interference Regulations of the CanadianDepartment of Communications.Le présent appareil numérique n’émet pas de bruits radioélectriques dépassant leslimites applicables aux appareils numériques de la classe A prescrites dans leRèglement sur le brouillage radioélectriques édicté par le ministrère desCommunications du Canada.Voluntary Control Council For Interference (VCCI)


1-1Chapter 1: OverviewIntroductionIntended AudienceThe NCR <strong>5945</strong> terminal operates on a direct connect basis to an<strong>Electronic</strong> Cash Register (ECR), also referred to as a Point-Of-Sale(POS) device. Primary applications for the <strong>5945</strong> include:• ATM/Debit• Credit• Check• <strong>Electronic</strong> Benefits Transfer (EBT)<strong>Other</strong> applications include:• <strong>Electronic</strong> ACH• Frequent ShopperThe <strong>5945</strong> is designed with special consideration to the ultimate enduser of the product. The design of the packaging, keypad, display,base application and keypad overlay is oriented toward the noncomputerliterate individual.Warning: The <strong>5945</strong> terminal cannot be opened for any reason.The information in this <strong>doc</strong>ument is not comprehensive, but is usefulto experienced application programmers who have some experiencewith “C” language. The basics of application programming are notcovered in this manual.


1-2 Chapter 1: Overview<strong>5945</strong> FeaturesHardware FeaturesApplication CPUSecure CPUMemoryDisplayKeypadCard ReaderHost PortToshiba TMP95C061 microcontroller running at24 MHZDallas DS5002 secure microcontroller runningat 16 MHZ512 KB of flash memory for code and file space,32KB of SRAM for data and stackBacklit 2x20 Liquid Crystal DisplayTen numeric keys, Cancel, Clear, Enter, Yes,No, and three screen addressable function keysTrack 1 and 2 and optional Trace 1, 2 and 3 bidirectionalMagnetic Stripe Card ReaderIBM-485, EIA232 (TXD, RXD, RTS, CTS)Aux Ports Up to three EIA232 auxiliary ports using a <strong>5945</strong>“Y” cable and RCBs (Remote Connector Blocks)Physical SecurityCabinet interlock switch and a securemicrocontroller


Chapter 1: Overview 1-3Software FeaturesProgrammableOperating SystemApplicationFile SystemDiagnostics MenuSupervisor MenuLogical SecurityFully programmable in C using off the shelfANSI compilerField downloadable and upgradableField downloadable and written in “C” usingextensive library functions provided by NCRConfigurable space size, with library functionsfor reading, writing, and deleting file recordsComprehensive on board diagnostic functionsfor the memory, keypad, display,communication ports, card reader, ande<strong>ncr</strong>yption testAllows downloading, system configurations,and file read, write, and deleteMaster/Session and DUKPT key management,e<strong>ncr</strong>yption/decryption using DES, ANSI 9.2,ANSI 9.8, and Canadian INTERAC compliance


1-4 Chapter 1: Overview<strong>5945</strong> Character PatternUpper4 bitLower4 bitLLLLLLLHLLLL LLHL LLHH LHLL LHLH LHHL LHHH HLLL HLLH HLHL HLHH HHLL HHLH HHHL HHHHCGRAM(1)(2)LLHL(3)LLHH(4)LHLL(5)LHLH(6)LHHL(7)LHHH(8)HLLL(1)HLLH(2)HLHL(3)HLHH(4)HHLL(5)HHLH(6)HHHL(7)HHHH(8)


Chapter 1: Overview 1-5<strong>5945</strong> BookshelfNCR <strong>5945</strong> User’s GuideThis manual focuses on the setup and configuration of the <strong>5945</strong>terminal. Details of the Application Load Process, the CMDLDownload Process, Supervisor Mode functions, Diagnostic functions,and 4430 emulation are included in this manual. This manual alsoincludes step-by-step instructions about the installation and operatingprocedures of the <strong>5945</strong> terminal. General information about theterminal along with the troubleshooting table, maintenance and the<strong>5945</strong> specifications is included.Developer’s KitNCR <strong>5945</strong> Developer’s GuideThis manual discusses the programming environment and providesdetails on how to develop an application for the <strong>5945</strong>. The NCRwritten API functions, Utility Applications, and NCR 5944 to NCR <strong>5945</strong>Port Application Migration information is included in this manual.The tools below run on your PC for use during the <strong>5945</strong> applicationdevelopment. This software is available as part of the <strong>5945</strong> Developer’sGuide.• Software development kit diskette, includes:• <strong>5945</strong> C libraries• Batch file for compiling, linking, and loading application code• Downloadable <strong>5945</strong> operating system• Example application source code• <strong>5945</strong> loader utilitiesNote: The SDK does not include the required ToshibaCompiler/Linker tools. These must be purchased separately.


1-6 Chapter 1: OverviewNCR Software development partners and NCR "value-adders" mayqualify for special discounting when purchasing the Toshiba compileror software development support products from Toshiba. You areencouraged to check with your local Toshiba representative aboutdiscounting programs in effect at the time of purchase.Toshiba TLCS900 C Compiler Part # SW96CEO-ZZE


2-1Chapter 2: Porting an NCR 5944 ApplicationGeneral ConsiderationsRequired ModificationsNCR <strong>5945</strong> application development is based upon the ANSI C, Toshiba900 C, and <strong>5945</strong>-specific functions identified in Chapter 3 of this<strong>doc</strong>ument. The aforementioned chapter fully describes all <strong>5945</strong> APIfunctions 1 .New applications are encouraged to use the native <strong>5945</strong> API’s.All applications must be linked with the libraries NCR<strong>5945</strong>E.lib andNCR<strong>5945</strong>C.lib.New applications are encouraged to use standard structuredprogramming techniques and not to rely on hard coded address spacessince the memory map of the <strong>5945</strong> is NOT guaranteed to remain as is.Register applications will have to extend their download packet timeouts to 30 seconds. This delay which occurs after the first packet andthe final packet is due to the unit rebooting itself and erasing theapplication from flash.The <strong>5945</strong> places variables on even memory addresses (wordboundaries), thus any segment of code which relies on byte boundaryplacement of variables must be modified. This generally includes BCCchecks over variables in memory and manipulating variables as offsetsfrom a base variable.1ANSI C functions used in programming the <strong>5945</strong> may not be completely described inthis book. Please refer to an appropriate ANSI C programming manual for complete information.


2-2 Chapter 2: Porting an NCR 5944 ApplicationDue to the word boundary alignment of variables, code space cannotbe conserved by using chars for individual variables. This does notapply to char arrays.The <strong>5945</strong> does not natively interpret commands from the host. All hostcommands must be processed by the application, unless theapplication is in the F1 setup menu. The F1 setup menu will interpretthe following host commands: 0x09, 0x51, 0xB0 and 0xD2. API’s areavailable to ease the processing of these function codes.Code space and constant strings on the <strong>5945</strong> are in read only Flash andconsequently cannot be modified.<strong>Data</strong> is stored in volatile RAM and is not retained over boots.<strong>Data</strong> which must be stored over boots must be written to the Flash filesystem.Add ‘near’ to all global variables to keep them out of flash. This isnecessary to force global variable to reside in RAM otherwise thevariable will end up in flash which is read only.


Chapter 2: Porting an NCR 5944 Application 2-3The include files “cc900api.h,” “<strong>ncr</strong>_api.h,” and “stubs.h” MUST beincluded in all C module files. The include file “cc900api.h” must bethe first include file after the standard ANSI C include files. All nativeNCR <strong>5945</strong> include files must precede the included file “stubs.h,” whichmust precede the old NCR 5944 include files.For example:#include /*Standard ANSI C includes */#include #include “cc900api.h”#include “flags.h”#include “disp_api.h” /* NCR<strong>5945</strong> “Native” includes */#include “<strong>ncr</strong>_hcom.h”#include “<strong>ncr</strong>_api.h”#include “stubs.h”#include “dos.h” /* NCR5944 includes */#include “conio.h”To get the F1 setup menu on boot-up, all <strong>5945</strong> applications must call_init_5944() first. The function _init_5944() must be the first functioncalled immediately after any local declarations in main(). Thisrequires that the include file <strong>ncr</strong>_init_.h is included. The function_exit_5944() can be called at application exit if the programmer wishesto be prompted for OS options. If _exit_5944() is not called, theapplication will exit. This will make the unit lock up since noapplication is running. In general, all applications should beprogrammed to never exit without rebooting the unit.All <strong>5945</strong> applications must call initkeyboard() after _init_5944().The <strong>5945</strong> multiplexes its AUX ports over a single set of wires. Due tothis constraint, the application must manage which AUX port is theintended port. Use the _enableauxN() and _disableauxN() functions todo this. Only one AUX port can be enabled at a time. The function_openauxN() will enable the desired port and disable all other AUXports.


2-4 Chapter 2: Porting an NCR 5944 ApplicationThe call _openhcom() does not override the host communicationparameters set in the <strong>5945</strong>’s file system. The F1 setup menu writes thehost communication files if the host port setup is entered. The hostcommunications files can be deleted prior to calling _openhcom() if thevalues of _openhcom() are desired.Function putchar() requires disp_api.h to be included.Various standard ANSI C functions are macros in the <strong>5945</strong> emulation.This will result in various unresolved link errors. This situation can beremedied by including the appropriate header file from the extendedcollection of header files.Dosdate_t and dosttime_t are now typedefs. Any references must bechanged from:• struct dosdate_t date; to dostdate_t date;• struct dostime_t time; to dostime_t time;All printf(), sprintf(), _outtext(), _scrolltext(), and _readmsr() callsmust cast the string to a char *.Example: printf((char *)”TEST”);printf() and sprintf() do NOT support %d.The various Xprintf() functions are subsets of the ANSI C functions:


Chapter 2: Porting an NCR 5944 Application 2-5* This routine is a subset of the C standard library function vsprintf().* Withing its defined subset, its behavior is identical to vsprintf(). It* is capable of outputting: unsigned integers (either as decimal or* hex) and strings.** Format String Syntax:* No attempt is made to describe the behavior of the printf()* family of functions in their entirity. The differences are* described instead. A format specification has the following* form (brackets denote optional fields):** %[flags][width][type size]type** Only supported type flag is “l” for long.** A single “!” is printed when an unsupported type is* encountered in the format string.All strings printed by puts(), printf(), and similar functions must benull terminated and are not truncated at 20 or 40 bytes.Remove all #pragmas Toshiba compiler supports a different set of#pragmas.Prototype all functions and moved all prototypes to header files. Allfunctions must be prototyped.Add time number to timer functions. The <strong>5945</strong> has up to eight timers(see “timer.h”).The <strong>5945</strong> only has “cancel” and “clear” keys. To simulate “cancel,”“clear,” and “backspace” keys of the 5944, the two <strong>5945</strong> keys aremultiplexed. If the 5944 “backspace” is enabled, then the “clear” keyon the 5944 will return to “backspace.” If the 5944 “cancel” key isenabled, the <strong>5945</strong> will return to “cancel.” If either the 5944 “backspace”or “cancel” key is not enabled, then the <strong>5945</strong> will return to “clear” inplace of the disabled key.Minimum length of PAN (Personal Account Number) for UKPT EntryRequest is 7 digits. The PAN must be terminated with a 0xF in eithernibble.


2-6 Chapter 2: Porting an NCR 5944 ApplicationMake sure that the keyboard is enabled when using any functionrelated to getting key presses from the keyboard (i.e., kbhit(), getch(),gets(), etc.).To prevent malicious capture of a PIN, the <strong>5945</strong> scans any wordsprinted to the screen for key words associated with PIN entry. If anyof these words are encountered, the unit locks out the keyboard and nokey presses will be returned to the application. An incomplete list ofwords which are scanned for are PIN, NIP, etc.MSR beeps are produced when the application calls _readmsr thus theapplication must be conscious of responding to the MSR readimmediately so that double beeps and delayed beeps do not occur.The response timeout of the VLI packet forming routines is set to adefault of 3 seconds. This can be changed by the applicationprogrammer and is done by setting the value in the file system. WriteApp 1 File 100 Record 1 to the desired value in 10 millisecondi<strong>ncr</strong>ements (100=1 second). If this file does not exist the default valueis used.The Toshiba compiler does not like , &= ~.Remove all ones-compliments.Example: buffered_msr &= ~SEVEN; is now buffered_msr &=0xFFF8.Move all #defines to header files.Remove any unused variables.


3-1Chapter 3: Programming the <strong>5945</strong>General ConsiderationsSoftware ArchitectureA <strong>5945</strong> application development is based upon the ANSI C, Toshiba900 C, and <strong>5945</strong>-specific functions identified in this chapter. Thischapter fully describes all <strong>5945</strong> functions 2 and their compatibility to the5944.To develop a <strong>5945</strong> application you need all of the following.• IBM compatible PC with 486 or later processor• ASCII text editor• Toshiba 900TLCS Development Tools (DOS based)• <strong>5945</strong> specific function library (NCR5944E.LIB & NCR<strong>5945</strong>C.LIB)• <strong>5945</strong> specific header filesThe following are optional for developing <strong>5945</strong> applications.• Toshiba RTE Model 20 or 25• Soft-AID DebuggerThe <strong>5945</strong> software architecture consists of three levels.• Security Module (SM)• Operating system (OS)• Application2ANSI C functions used in programming the <strong>5945</strong> may not be completely described inthis book. Please refer to an appropriate ANSI C programming manual for complete information.


3-2 Chapter 3: Programming the <strong>5945</strong>The SM code runs on a separate processor (DALLAS 5002) from the OSand application. SM data and code resides in battery backed NVRAMand is not directly accessible by application programmers.The OS and application code run on the Toshiba 900TLCS processor.OS and application code is downloaded to, stored in and run fromFLASH in the <strong>5945</strong>. The OS and Application share 32K of RAM forprogram data and stack.Software reloading is necessary only when updating the application orif the FLASH is corrupted.Security Module (SM)The SM controls the keyboard and display and provides the PINe<strong>ncr</strong>yption and key management facilities of the <strong>5945</strong>. NCR providesthe <strong>5945</strong> SM.FLASH Resident Operating System (OS)The secure OS provides an interface between the hardware andapplication levels. In addition, the OS provides the communicationslink between the SM and the application. NCR provides the <strong>5945</strong> OS.The OS can be upgraded in the field.FLASH Resident ApplicationThe application sits at the highest system level. You can useapplications supplied by NCR, such as the 4430 emulation application,or you can write your own customized application using the Cprogramming language.To interface with the <strong>5945</strong> OS your application must use the functionsprovided in the NCR5944E.LIB and NCR<strong>5945</strong>C.LIB that are providedon the diskettes included with the <strong>5945</strong> Software Development Kit andthe ANSI C function library C900ML.LIB that is provided with theToshiba 900TLCS Development Tools.


Chapter 3: Programming the <strong>5945</strong> 3-3SecuritySecurity Module RoutinesThe <strong>5945</strong> BIOS routines perform low level I/O as follows.• Writing to the display• Reading from the keypad• PIN E<strong>ncr</strong>yption and related security functionsApplication code cannot read, modify, or directly call the <strong>5945</strong> SMroutines. These routines reside in NVRAM which is both read andwrite protected. SM routines are only accessible to the applicationcode via the <strong>5945</strong> OS using the application program interface (API)routines.KeypadInput/Output DevicesApplication code can receive keypad inputs by calling the libraryfunctions. It cannot obtain key entries directly from the internal keypadregisters or buffer, however.Integrated User Interface• Beeper• Clock• Display• Key (PIN) Management• Keypad• MSR• Serial I/O• Timer


3-4 Chapter 3: Programming the <strong>5945</strong>I/O Ports• Host port (EIA-232-D & IBM EIA-485)• AUX Ports 3• Up to 2 AUX ports using expander RCBDeveloping a <strong>5945</strong> ApplicationUse the following procedure to develop a customized <strong>5945</strong> application.The environment variables TOSHIBADIR, <strong>5945</strong>DIR and LOCALDIRcan be set to specify the location (path names) of the Toshiba utilities,the <strong>5945</strong> application programmers interface and the local project.1. Write your application in C using the ANSI C Toshiba compilerand the <strong>5945</strong> specific C functions described in this manual.2. Compile your application using the Toshiba C compilerCC900.EXE.Example: cc900 -ml –Nb1 –w2 –Xp1 -g -Xuc –Xw -c -Ao –Am –ITOSHIBADIR –I<strong>5945</strong>DIR -ILOCALDIR –ofile.obj file.c3. Link your application object files with the NCR5944E.LIB andNCR<strong>5945</strong>C.LIB libraries for <strong>5945</strong> specific functions and with theToshiba C900ML.LIB library for ANSI C library functions. This isaccomplished with the Toshiba 900 TLCS linker TULINK.EXE. Thelibraries NCR5944E.LIB and NCR<strong>5945</strong>C.LIB are on the disketteprovided in the <strong>5945</strong> SDK. This will output a Toshiba ABS formatfile which can be used on the Real-Time emulator.Example: tulink -lgm –lf file.map <strong>5945</strong>dir\app512.lnk –ofile.absfile1.obj …. FileN.obj <strong>ncr</strong>5944E.lib <strong>ncr</strong><strong>5945</strong>C.lib c900ml.lib4. Use the batch file APP512.BAT to convert the Toshiba ABS file to aMotorola S32 format file. This runs the utility TUCONV.EXE.3Aux2 and Aux3 are multiplexed using the sameUART, and cannot be used simultaneously. However,either may be used simultaneously with the host port.


Chapter 3: Programming the <strong>5945</strong> 3-5Example: <strong>5945</strong>dir\app512.bat file.s32 file.abs5. Use the MSF2BIN.EXE utility to convert the Motorola S32 formatfile to binary format. This is the application that will run on theNCR <strong>5945</strong>. MSF2BIN.EXE is on the diskette provided with the <strong>5945</strong>SDK.Example: msf2bin file.s32 file.bin6. Download the application to the <strong>5945</strong> using the NCRCMDL.EXEutility. Refer to the User’s manual to put the NCR<strong>5945</strong> into CMDLmode for downloading. NCRCMDL.EXE is on the disketteprovided with the <strong>5945</strong> SDK. The back slashes (\) are necessary toescape the double quotes (“) in DOS.Example: <strong>ncr</strong>cmdl download 1 \”file.bin\”;7. To generate a form of the application which can be downloadedusing the 5944LD.EXE application follow these additional steps.8. Generate EFTL & EFTP files by using the NCRCMDL.EXE utility.For a complete description refer to the programmers manual. Theback slashes (\) are necessary to escape the double quotes (“) inDOS. Note that the program and parameter levels of the <strong>5945</strong>resident application and file system are taken from the four digitsuffix of the EFTL and EFTP files respectively.Example: <strong>ncr</strong>cmdl do \”eft.cmc\”;


3-6 Chapter 3: Programming the <strong>5945</strong>Example: Contents of eft.cmc{print “Creating EFT Program File”;ibmeft247 file “eftl0001.”;download 0 “file.bin”;ibmeft247 file close;print “Creating EFT Parameter File”;ibmeftbin247 32 0001 file “eftp0001.”;msglevel 0;/* The next line is necessary to enable 5944 downloads */write system app 15 32769 record 4 “1”;do “param.cmc”;msglevel 2;ibmeftbin247 32 0001 file close;print “Done!”;}Example: Contents of param.cmc{/* Notice that within a cmc file processed by NCRCMDL nobackslash is necessary to escape the double quotes */write public app 1 2 record 3 “This is an example file entry”;write public app 1 2 record 4 “Record 3 & 4 of file 2 are datastrings”;}*The program and parameter levels are stored in the file system.write system app 15 32770 record 10 “0001”; /* program level */write system app 15 32770 record 11 “0001”; /* parameter level*/9. Now convert the EFT files to a 5944 style download file by usingthe CEFT2NCR.EXE utility. This will generate a file calleddownload.out that can be downloaded as described in the nextsection. The 5944LD.EXE utility can be used to download this fileto the <strong>5945</strong>.Example: Ceft2<strong>ncr</strong> eftp0001 eftl0001


Chapter 3: Programming the <strong>5945</strong> 3-710. A batch file (makeapp.bat) has been supplied to take theapplication (source code) and produce an NCR style load file. Thisbatch file will compile, link and make the conversions to producefile.ld, ready to download to the <strong>5945</strong>.Example: Makeapp fileOS/Application Load File FormatAn OS/application load file (download.out in the above example)consists of a series of D2h load command messages that have beenformatted as follows:VLI Byte Function Code Load Record BCCxxh D2h OS/Application xxhTo write your own <strong>5945</strong> loader, parse the command messages from theload file as follows:1. Read the first byte of the load file; this is the VLI (variable lengthindicator, or message length of the first load command).2. Read the next (VLI - 1) bytes of the load file and append them tothe VLI; this forms the first message.3. Send the first message, and wait for the following response(maximum wait time 30 seconds) from the <strong>5945</strong>:VLI Byte Function Code Status 4 SEQ 5 BCC06h D1h/D2h xxh xxxxh xxh4. If the <strong>5945</strong> responds with an error instead, resend the message.5. Repeat the above steps until you have sent all of the data in theload file.4See <strong>5945</strong> Response Statuses5SEQ is presented in-byte-reversed (low orderbyte,followed by high order-byte) format


3-8 Chapter 3: Programming the <strong>5945</strong><strong>5945</strong> Response StatusesCommand successfulInvalid record typeInvalid sequence numberInvalid mode for commandInvalid BCC00hE8hF7hFAhFFhVLI vs. Raw ModeAborting a Load in ProcessSend the following command to abort a load that is in process:VLI Byte Function Code BCC03h 0Ah 09hThe VLI and raw modes only affect the serial port receive function.The HOST port supports both raw and VLI modes. <strong>Other</strong> ports onlysupport raw mode.In raw mode, each byte of data is made available to the application via_readxxx() as soon as the <strong>5945</strong> receives it.In VLI mode, the <strong>5945</strong> expects the first byte it receives to be themessage VLI (message length plus the VLI byte). It makes no dataavailable to the application via _readxxxx() until it receives a numberof bytes equal to the VLI.Unlike the 5944, the <strong>5945</strong> application must handle all host data. TheOS does not intercept and handle host messages except duringdownloads and when in the F1 startup menu.


Chapter 3: Programming the <strong>5945</strong> 3-9Loading the <strong>5945</strong>The following files must be written to configure the host portcommunications on the <strong>5945</strong>.NCRCMDL do \”comm.cmc\”;Contents of comm.cmc{write system app 32769 record 1 “0”;/* 0 – RS232 1- RS485 */write system app 32769 record 10 “9600”; /* Baud Rate */write system app 32769 record 11 “8”; /* <strong>Data</strong> Bits */write system app 32769 record 12 “0”; /* Parity */}Four scenarios for loading the <strong>5945</strong> OS and/or application aredescribed below.To enable the ability of the <strong>5945</strong> to perform 5944 compatibledownloads the following file must be written to the file system usingNCRCMDL.NCRCMDL write system app 15 32769 record 4 \”1\”;<strong>5945</strong> Detects a Corrupted Application or OS at Power-UpThis places the <strong>5945</strong> in an idle state, where it only responds to 0xD2commands. After a new OS or application is loaded the <strong>5945</strong> will resetit self.OS/Application ReplacementPower-up is normal, and the application runs. To download a new orupdated OS/application to the <strong>5945</strong>, the existing <strong>5945</strong> application mustrespond to a 0xD2 message by setting the appropriate download flagsand rebooting the <strong>5945</strong>.Manual Intervention1. The <strong>5945</strong> can be placed in supervisor mode and a CMDL downloadcan be performed.2. The <strong>5945</strong> power up sequence is interrupted by pressing the "F1" keyand selecting the desired load method from the F1 startup menu.


3-10 Chapter 3: Programming the <strong>5945</strong>Reset Device (Function Code 09h)Function code 09 causes the <strong>5945</strong> to send a response message and thenreset it self. This function must be handled by the applicationprogrammer by calling vColdBoot().Message FormatsBeeper ProgrammingHostVLI Function Code BCC03h 09h 0AhSuccessful ResponseVLI Function code Status BCC04h 09h 00h0Dh<strong>5945</strong> Specific C Library FunctionsThe <strong>5945</strong> specific C library functions used for <strong>5945</strong> beeperprogramming are described in the following section._tone()Purpose:Syntax:Generates a tone having the specified duration.int _tone(unsigned int dur, unsigned int unusedA,unsigned int unusedB).Arguments: dur (duration in 10 millisecond i<strong>ncr</strong>ements, range is 0h-7FFh).unusedA (reserved for future use)unused B (reserved for future use).Includes:#include


Chapter 3: Programming the <strong>5945</strong> 3-11Returns:0 (successful).non zero (command not executed).Clock ProgrammingExample Call: tone(10,0,0); /* beep for 100 milliseconds */The <strong>5945</strong> system clock provides time and date information. Since it isnot battery backed and does not keep time when the <strong>5945</strong> is powereddown, the <strong>5945</strong> application must set the system clock as part of the<strong>5945</strong> initialization.Microsoft C Library <strong>Data</strong> StructuresThe data structures for the <strong>5945</strong> clock programming library functionsare described in the following section.typedef struct dosdate_ttypedef struct{unsigned char day; /* range 1-31 */unsigned char month; /* range 1-12 */unsigned int year; /* range 1995-2099 */unsigned char dayofweek; /* range 0-6; 0 = Sunday */} dosdate_ttypedef struct dostime_tMicrosoft C Library Functionstypdef struct{unsigned char hour; /* range 0-23 */unsigned char minute; /* range 0-59 */unsigned char second; /* range 0-59 */unsigned char hsecond; /* range 0-99 */} dostime_tThe library functions used for <strong>5945</strong> clock programming are describedin the following section.


3-12 Chapter 3: Programming the <strong>5945</strong>_dos_getdate()Purpose:Syntax:Argument:Includes:Returns:Example Call:_dos_gettime()Purpose:Syntax:Argument:Includes:Returns:Example Call:_dos_setdate()Purpose:Syntax:Argument:Includes:Returns:Example Call:Gets the current system date.void _dos_getdate(dosdate_t *date);date (pointer to the structure receiving the componentsof date).#include None._dos_getdate(&current_date); /* current date is astructure of type dosdate_t */Gets the system time.void _dos_gettime(dostime_t *time);time (pointer to the structure receiving the componentsof time).#include None._dos_gettime(&current_time); /* current time is astructure of type dostime_t */Sets the system date.unsigned int _dos_setdate(dosdate_t *date);date (pointer to the structure containing thecomponents of date).#include 0 (successful).non zero (unsuccessful)._dos_setdate(&current_date); /* current time is astructure of type dosdate_t */


Chapter 3: Programming the <strong>5945</strong> 3-13_dos_settime()Purpose:Syntax:Argument:Includes:Returns:Example Call:Sets the system time.unsigned int _dos_settime(dostime_t *time);time (pointer to the structure containing thecomponents of time).#include 0 (successful).non zero (unsuccessful)._dos_settime(&current_time); /* current time is astructure of type dostime_t */


3-14 Chapter 3: Programming the <strong>5945</strong>Display ProgrammingThe <strong>5945</strong> displays forty 5x7 dot matrix LCD characters in the 2x20character arrangement shown below. The <strong>5945</strong>'s ASCII character fonttable includes both the USA and the international ASCII character sets.No alternate font tables are available.The application cannot write directly to the display memory. It mustcall the appropriate functions (such as putchar and puts), which in turncall the system procedures and write to the display.The Display PagesSix different 40-character display pages (screens) are provided forstoring display messages. Use the _setactivepage() function to select apage for display output, and the _setvisualpage() function to select thepage to be displayed.The active and the displayed pages may be the same, and you canwrite to one page while displaying another.


Chapter 3: Programming the <strong>5945</strong> 3-15ANSI C Library FunctionsThe ANSI C library functions used for <strong>5945</strong> display programming arelisted below:These functions require the inclusion of “disp_api.h” in program fileswhich reference them.• putchar() 6• puts()• printf() 78• sprintf() 9Display Library FunctionsThe C library functions used for <strong>5945</strong> display programming aredescribed in the following section._clearscreen()Purpose:Syntax:Argument:Includes:Clears the display, and moves the cursor to the homeposition.void _clearscreen(int nothing);int nothing (integer place holder for backwardscompatibility).#include 6putchar() requires disp_api.h to be included.7printf(), sprintf, _outtrext(), and _scrolltext()must cast the string to a char*. Example: printf((char*)”This is an example of printf()”);8printf() and sprintf() support only %c, %s, %X,and %u types.9sprintf() does not output to the display directly.However, it can be used in conjunction with _outtext() tooutput formatted text to the current active video page.


3-16 Chapter 3: Programming the <strong>5945</strong>Returns:Example Call:None._clearscreen(8);_getactivepage()Purpose: Obtains the number (0-5) of the video page to which alltext output is currently directed.Syntax: int _getactivepage(void);Arguments: None.Includes: #include Returns: Page number of the current active page.Example Call:_getvisualpage()Purpose:Syntax:Arguments:Includes:Returns:Example Call:current_page = _getactivepage(); /* get and savecurrent active page number */Obtains the number (0-5) of the video page that iscurrently being displayed.int _getvisualpage(void);None.#include Page number of the current visual page.current_page = _getvisualpage(); /* Get and savecurrent visual page number */


Chapter 3: Programming the <strong>5945</strong> 3-17_outtext()Purpose:Syntax:Argument:Includes:Returns:Outputs s (a null-terminated string) to the active videopage at the current cursor position. Use _outtext() tooutput to any active page that is different from thedefault page 0. 10 This function does not process anyspecial formatting characters.void _outtext(char far *s);s (specifies the address of the null terminated string tobe written to the current active page).#include None.Example Call: _outtext(" Select Credit or Debit");_setactivepage()Purpose: Sets the display page specified by page_number as thenew active page. Output from _outtext() is directed tothis page. Formatted output is produced by first usingthe ANSI C sprintf() function to format and write thetext to a buffer, and then using _outtext() to output thisformatted text to the current active page. The defaultactive page is 0.Under Microsoft C and MS-DOS, outputs from theANSI display functions (e.g., putchar(), printf(), ...) arealways directed to the visual page and not the activepage..Syntax: int _setactivepage(int page_number);Argument: page_number (the new active page, 0-5).Includes: #include 10With formatted text, first use the ANSI Csprintf() function to write the formatted text into a bufferand then use _outtext() to display the buffer contents.


3-18 Chapter 3: Programming the <strong>5945</strong>Returns:Example Call:The page number of the previous active page ifsuccessful. A negative value if unsuccessful._setactivepage(5); /* select video page 5 as thenew active page so all output to the display willgo to video page 5 */_settextposition()Purpose:Syntax:Arguments:Includes:Returns:Example Call:_setvisualpage()Purpose:Syntax:Argument:Includes:Returns:Example Call:Moves the text output position to the location specifiedby row and col. The location specified by (1, 1) is theupper left corner of the screen. The returned value canbe used later to return the cursor to its originalposition. This acts on the current visual page.struct record _settextposition(int row, int col);row, col (row and column position of the cursor).#include A structure of type record, containing the row andcolumn locations existing before the call._settextposition(1,1); /* set cursor at the homeposition */Selects the video page (specified by page_number) asthe visual page. Under Microsoft C and MS-DOS,outputs from the ANSI display functions (e.g.,putchar(), printf(), ...) are always directed to the visualpage and not the active page.int _setvisualpage(int page_number);page_number (the page, 0-5, to be displayed).#include The page number of the previous visual page ifsuccessful. A negative value if unsuccessful._setvisualpage(1); /* select video page 1 to bedisplayed */


Chapter 3: Programming the <strong>5945</strong> 3-19<strong>5945</strong> Specific C Library FunctionsThe <strong>5945</strong> specific C library functions used for <strong>5945</strong> displayprogramming are described in the following section._scrolltext()Purpose:Syntax:Arguments:Includes:Returns:Example Call:_stopscroll()Purpose:Syntax:Arguments:Includes:Returns:Continuously scrolls the null-terminated string fromright to left, using the specified line and speed. Nonscrollingtext may be displayed on a line that is notscrolling. Any call to a display function will stop thescrolling.int _scrolltext(int line, int speed, char far *string);line (1 for top line, 2 for bottom line).speed (1-10, in characters per second).string (length 0-120, in characters, excluding the endnull character. Buffers less than 21 characters will notbe scrolled but will be displayed and remainstationary).#include Length of the string if successful; otherwise, EOF._scrolltext(2,5,"*** Scrolling 5 chars/sec onbottom line *** ");Stops (but does not clear) any text that is scrolling as aresult of an earlier _scrolltext() call. Any display callwill result in the halting of the scrolling.void _stopscroll(void);None.#include None.Example Call: _stopscroll(); /* stop any scrolling text */


3-20 Chapter 3: Programming the <strong>5945</strong>_setftable()Purpose:Syntax:Includes:Returns:Does nothing. Provided for 5944 compatibility.int _setftable(char far *ftable);#include FFFFh (not supported).Key Management ProgrammingPIN BlockStandardThe standard PIN block is defined in ANSI X9.8. An account numberblock (defined by the same specification) is created and exclusive OR'd(XOR'd) with the PIN block. The result is e<strong>ncr</strong>ypted and returned asthe PIN block.Alternate (Diebold Style)The Diebold style PIN block construction as defined below issupported. It is OR'd with the account number block. The result ise<strong>ncr</strong>ypted and returned as the PIN block.Bit 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64Digit* P P P P PF PF PF PF PF PF PF PF PF F F F FNote: P = PIN digit; F = fill digit


Chapter 3: Programming the <strong>5945</strong> 3-21<strong>5945</strong> Specific C Library FunctionsThe <strong>5945</strong> specific C library functions used for <strong>5945</strong> key managementprogramming are described in the following section._decrypt()Purpose:Syntax:Includes:Returns:_e<strong>ncr</strong>ypt()Purpose:Syntax:Includes:Returns:_key_stat()Purpose:Syntax:Argument:Includes:Does nothing. Provided for 5944 compatibility.int _decrypt(char mode, char far *data, char far *key);include FFFFh and eight bytes of ASCII 0s in data.Does nothing. Provided for 5944 compatibility.int _e<strong>ncr</strong>ypt(char mode, char far *data, char far *key);include FFFFh and eight bytes of ASCII 0s in data.Used to determine the status of any of the 10 pairs ofe<strong>ncr</strong>yption keys stored in the <strong>5945</strong>, as follows:33 = both keys are valid.31 = exchange key is valid.30 = neither key is valid.int _key_stat(char kid, char far *key_data);kid (KID, 01h-0Ah, of the target key pair. A 00h returnsthe status of all keys).key_data (buffer that holds the returning key status).include


3-22 Chapter 3: Programming the <strong>5945</strong>Returns:Example Call:The key number/key status pair for the selected key (orall keys if 00h is selected as kid) in key_data, plus astatus as follows.0000h (successful).FFFFh (KID out of range).status = _key_stat(0x02, key_data); /* return thestatus of key ID 2 */_load_working_key()Purpose:Syntax:Argument:Includes:Returns:Used to load a working key into the <strong>5945</strong>. (A KEK mustbe loaded for the associated working key prior to thiscall.) All ten KEK/WK key pairs can be used for pinentry. Key pairs are not reserved for specific tasks aswas the case in the 5944.int _load_working_key(char key_id, char far *key, charparity);key_id (KID, 01h-0Ah, of the working key beingloaded).key (the eight-byte, or 16-ASCII-character, key. Must benull terminated).parity (not supported, provided for 5944 compatibility).include 0000h (successful).FFFFh (KID is out of range).FFFDh (KEK for this key was not loaded).Example Call: status = _load_working_key(5, key_data, 0);/* load key 5 using key in buffer key_data */


Chapter 3: Programming the <strong>5945</strong> 3-23_mac_clear()Purpose:Syntax:Includes:Returns:_mac_gen()Purpose:Syntax:Includes:Return:_pin_enable()Purpose:Does nothing. Provided for 5944 compatibility.int _mac_clear(char kid, char far *mac);include FFFFh (not supported).Does nothing. Provided for 5944 compatibility.int _mac_gen(char kid, char far *mac);include FFFFh (not supported).Enables the keypad for secure input using KEK/WKkey management techniques. All keypad input isdirected to the secure key entry routine. Attempts toread the standard keypad input result in no keypaddata available. PIN input asterisks are displayedbeginning at the row and column specified. Note thatsubsequent writes to the display will change thelocation of the PIN entry row and column. printf() andother display functions will overwrite the PIN display.During PIN entry the bottom row of the display is NOTcleared. Pin entry is halted once the ENTER orCANCEL keys are pressed. If less than 4 characters areentered the _pin_status() function will return a 0xE3.


3-24 Chapter 3: Programming the <strong>5945</strong>Syntax:Arguments:Includes:Returns:A PIN pad is normally used for debit transactions.Typically, the host enables the MSR on the <strong>5945</strong> withfunction _enablemsr(). After the debit bank card issuccessfully read, this function is called. The PIN isthen entered, permitting the host to verify that thecustomer is an authorized user of the debit cardaccount.This function immediately returns a status (but no PINdata) to the application. The function _pin_status()must be called prior to calling _pin_get() to set theappropriate flags and to check if a PIN putaway keyhas been hit. Once a PIN is available then _pin_get()may be called. To obtain the PIN data use function_pin_get().int _pin_enable(char fill, char kid, char far *pan, introw_col, char pinblock);fill (fill character, usually 0Fh).kid (KID pair, 1h-0Ah, used to e<strong>ncr</strong>ypt the PIN databefore it is returned to the host).pan (customer's 12-byte primary account number, fromthe MSR debit card, in ASCII format. Must be nullterminated).row_col (row 1 or 2 placed in the high byte, andcolumn 1-20 placed in the low byte, in which to displayPIN asterisks).pinblock (0 for standard PIN block or 1 for alternateDiebold PIN block).include 0000h (successful).FFFFh (KID is not valid).Example Call: status = pin_enable(0xFF, 1, pan, 0x0201, 0); /*enable pin entry, fill is 0xFFh, key ID is 1,asterisks display on row 2, column 1, and standardPIN block is constructed */


Chapter 3: Programming the <strong>5945</strong> 3-25_pin_enable_b()Purpose:Syntax:Argument:Includes:Enables the keypad for secure input using KEK/WKkey management techniques. All keypad input isdirected to the secure key entry routine. Attempts toread the standard keypad input result in no keypaddata available. PIN input asterisks are displayedbeginning at the row and column specified.Subsequent writes to the display will result in the rowand column position changing. During PIN entry thebottom row of the display is NOT cleared. Pin entry ishalted once the ENTER or CANCEL keys are pressed.If less than 4 characters are entered _pin_status() willreturn a 0xE3.This function is similar to _pin_enable(), except that thekey that e<strong>ncr</strong>ypts the PIN data is not supplied until thehost polls for the PIN data with function _pin_get_b().Meanwhile, the PIN is e<strong>ncr</strong>ypted with the <strong>5945</strong>’sinternal storage key as soon as the PIN data is enteredinto the <strong>5945</strong>.This function immediately returns a status (but no PINdata) to the application. The function _pin_status()must be called prior to calling _pin_get_b() to set theappropriate flags and to check if a PIN putaway keyhas been hit. Once a PIN is available then _pin_get_b()may be called. To obtain the PIN data use function_pin_get_b().The use of this function is discouraged. It may take upto 10 seconds to return an e<strong>ncr</strong>ypted PIN.int _pin_enable_b(int row_col);row_col (row 1 or 2 placed in the high byte, andcolumn 1-20 placed in the low byte, in which to displayPIN asterisks).include


3-26 Chapter 3: Programming the <strong>5945</strong>Returns:Example Call:0000h (successful).FFFFh (no keys are loaded).status = _pin_enable_b(0x0201); /* enablebuffered mode PIN entry, asterisks display on row2, column 1 */_pin_get()Purpose:Syntax:Argument:Includes:Returns:Used in conjunction with _pin_enable() or UKPTfunction _upin_enable() for obtaining e<strong>ncr</strong>ypted PINdata. This function is issued after _pin_status() hasdetected a PIN putaway key._pin_status() must be called prior to calling _pin_get()to guarantee proper functioning of this routine on the<strong>5945</strong>. Once _pin_status reports a PIN putaway keythen _pin_get() may be called.int _pin_get(char far *pin);pin (returned e<strong>ncr</strong>ypted pin, plus serial number if theUKPT method is used).include PIN:UKPT: Two zeros, followed by ten-byte serial numberand eight-byte e<strong>ncr</strong>ypted PIN, all as packed binary 11data.KEK/WK: Eight-byte packed binary 8 e<strong>ncr</strong>ypted PIN.bits.11Each packed binary digit is represented as four


Chapter 3: Programming the <strong>5945</strong> 3-27Status:Length of PIN data (successful function if UKPT).0000h (e<strong>ncr</strong>ypted PIN data was successfully returned ifWEK/WK).FFF0h (no PIN data available yet).FFF2h (2 million UKPT transactions, new keyrequired).Example Call: status = pin_get(pin); /* get the e<strong>ncr</strong>ypted PINblock */_pin_get_b()Purpose:Syntax:Arguments:Used in conjunction with _pin_enable_b() for obtaininge<strong>ncr</strong>ypted PIN data. This function is issued after_pin_status() has detected a PIN putaway key. Whencalled with an invalid KID this function clears any PINdata that was found in the unit._pin_status() must be called prior to calling_pin_get_b() to guarantee proper functioning of thisroutine on the <strong>5945</strong>. Once _pin_status reports a PINputaway key then _pin_get_b() may be called.Use of this function is discouraged. It may take up to 10seconds to return.char _pin_get_b(char far *pin, char kid, char fill, charfar *pan, char pinblock);pin (returned e<strong>ncr</strong>ypted pin).kid (KID pair, 1h-0Ah, used to e<strong>ncr</strong>ypt the PIN databefore it is returned to the host).char fill (fill character, usually 0Fh).pan (12-byte primary account number in ASCII format.Must be null terminated).pinblock (0 for standard PIN block or 1 for alternateDiebold PIN block).


3-28 Chapter 3: Programming the <strong>5945</strong>Includes:Returns:include pin (the eight-byte e<strong>ncr</strong>ypted PIN).0000h (e<strong>ncr</strong>ypted PIN data was successfully returned).FFF0h (no PIN data available yet).FFFFh (KID is out of range, or the correspondingKEK/WK pair is not loaded into the <strong>5945</strong>).Example Call: status = _pin_get_b(pin, 1, 0x0F, pan, 1);/*return the e<strong>ncr</strong>ypted PIN in buffer using key ID 1and PAN, return using Diebold PIN block */_pin_status()Purpose:Syntax:Arguments:Includes:Returns:Determines PIN activity within the <strong>5945</strong> (e.g., Cancelwas pressed).This function should NOT be called in a tight loopsince it will over load the security processorscapabilities. A short call to delay() in the loop will taxthe main processor and allow the security processor tohandle PIN and keyboard functions.The function _pin_status() must be called prior tocalling _pin_get() or _pin_get_b() to guarantee properfunctioning of these routine on the <strong>5945</strong>. Once_pin_status reports that a PIN putaway key has beenhit then _pin_get() or _pin_get_b() may be called.int _pin_status(void);None.include FFF0h (no PIN activity).0057h (CANCEL key pressed).0064h (PIN available, ENTER pressed).00E3h (ENTER pressed with no PIN digits or when anINVALID PIN ENTRY is entered or the PIN entry hasTIMED OUT (255 seconds)).


Chapter 3: Programming the <strong>5945</strong> 3-29Example Call: status = _pin_status(); /* get the status of thePIN being returned */_secure_abort()Purpose:Syntax:Arguments:Includes:Returns:Abort any secure function, i.e., _pin_enable(),_pin_enable_b(), or _upin_enable(), that was initiatedby the application.void _secure_abort(void);None.include None.Example Call: _secure_abort(); /* abort current securefunction */_ukpt_status()Purpose:Syntax:Arguments:Includes:Returns:Example Call:Determines if the UKPT key is loaded.int _ukpt_status(void);None.include 0000h (UKPT key is loaded).FFFFh(UKPT key not loaded).status = _ukpt_status(); /* get UKPT keystatuses */


3-30 Chapter 3: Programming the <strong>5945</strong>_upin_enable()Purpose:Syntax:Arguments:Enables the keypad for secure input using UKPT keymanagement techniques. All keypad input is directedto the secure key entry routine. Attempts to read thestandard keypad input result in no keypad dataavailable. PIN input asterisks are displayed beginningat the row and column specified. Subsequent calls todisplay functions will change the row and column.During PIN entry the bottom row of the display is NOTcleared. Pin entry is halted once the ENTER orCANCEL keys are pressed. If less than 4 characters areentered _pin_status() will return a 0xE3A PIN pad is normally used for debit transactions.Typically the host enables the MSR on the <strong>5945</strong> usingfunction _enablemsr(). After the debit bank card issuccessfully read the PIN is then entered permitting thehost to verify the customer as an authorized user of thedebit card account.This function immediately returns a status (but no PINdata) to the application. The function _pin_status()must be called prior to calling _pin_get() to set theappropriate flags and to check if a PIN putaway keyhas been hit. Once a PIN is available then _pin_get()may be called. To obtain the PIN data use function_pin_get().int _upin_enable(char far *pan, int row_col);pan (customer's primary account number from theMSRdebit card. 9 numeric digits minimum and 18numeric digits maximum length. The PAN is sent aspacked binary 12 data terminated with 0Fh termination.In addition it must be null terminated after the 0Fh.bits.12Each packed binary digit is represented as four


Chapter 3: Programming the <strong>5945</strong> 3-31Includes:Return:Example Call:The PIN data is XOR'd with this number before it ise<strong>ncr</strong>ypted).row_col (row 1 or 2 placed in the high byte, andcolumn 1-20 placed in the low byte, in which to displayPIN asterisks).include 0000h (function successfully initiated).FFFFh (no UKPT key loaded).00F4h (if the PAN length is not between 9-18characters long).status = _upin_enable(pan, 0x0201); /* enable UKPTPIN entry using account #401234567890, pancontains packed binary data 40 12 34 56 78 90 0F00, display asterisks on row 2, column 1 */_upin_test()Purpose:Syntax:Arguments:Includes:Similar to UKPT function _upin_enable(), except thatPIN 1234 is e<strong>ncr</strong>ypted and an e<strong>ncr</strong>ypted PIN block isreturned. This function i<strong>ncr</strong>ements the KSN of the <strong>5945</strong>each time it is called. In addition, this function is calledby the OS initialization routines once per power cycle.int _upin_test(char far *pan, char far *pinblk);pan (Primary account number. 9 numeric digitsminimum and 18 numeric digits maximum length. ThePAN is sent as packed binary 13 data terminated with0Fh termination. In addition it must be null terminatedafter the 0Fh).pinblk (key serial number and the returned e<strong>ncr</strong>yptedPIN block).include bits.13Each packed binary digit is represented as four


3-32 Chapter 3: Programming the <strong>5945</strong>Returns:Example Call:pinblk (Two zeros, followed by ten-byte serial numberand eight byte e<strong>ncr</strong>ypted PIN, all as packed binarydata.Total length of serial no. + PIN data (successfulfunction).FFFFh (UKPT key not loaded).FFF2h (1 million UKPT transactions; new keyrequired).00F4h (UKPT PAN length incorrect; must be greaterthan 9 digits and less than 18 digits)status = upin_test(pan, pinblk); /* return a UPKTe<strong>ncr</strong>ypted PIN block using PIN 1234 */Keypad ProgrammingThe <strong>5945</strong> keypad has 18 keys, as shown below. The keys shown as F1 –F3, F5 & F6 are programmable. Custom keypad overlays are available.The NCR <strong>5945</strong> keyboard is much less sensitive to multiple key hitsthan the 5944. It is recommended that the keyboard be enabled at alltimes and that keys be processed as they are received by setting the keymask appropriately.


Chapter 3: Programming the <strong>5945</strong> 3-33The ASCII KeycodesEach key entered is stored as a two-byte ASCII code sequence (shownbelow) in the internal keypad buffer. A Single byte is returned for eachkey code and is listed in the column “Return”Key Code Return Key Code Return Key Code Return"0" 0x0B30 0x30 "8" 0x0938 0x38 "F7" 0x4100 NONE"1" 0x0231 0x31 "9" 0x0A39 0x39 "F8" 0x4200 NONE"2" 0x0332 0x32 "F1" 0x3B00 0x3B "Enter/OK" 0x1C0D 0x0D"3" 0x0433 0x33 "F2" 0x3C00 0x3C "Cancel" 0x011B 0x1B"4" 0x0534 0x34 "F3" 0x3D00 0x3D "Backspace" 0x0E08 0x08"5" 0x0635 0x35 "F4" 0x3E00 NONE "Clear" 0x5300 0x53"6" 0x0736 0x36 "F5" 0x3F00 0x3F"7" 0x0837 0x37 "F6" 0x4000 0x40ANSI C Library FunctionsTo prevent the unintended capture of a plain text (une<strong>ncr</strong>ypted) PINby a programmer the <strong>5945</strong> scans the display for certain unpublishedkey words. An example of this is the word PIN. If any of these keywords is printed to the screen the keyboard will be locked until theoffending word is removed. While the keyboard is locked none of thekeyboard functions will return data.The ANSI C library functions used for <strong>5945</strong> keypad programming arelisted below.• getchar()• gets()Microsoft C Library FunctionsThe Microsoft C library functions used for <strong>5945</strong> keypad programmingare described in the following section.


3-34 Chapter 3: Programming the <strong>5945</strong>getch()Purpose:Syntax:Arguments:Includes:Returns:Example Call:getche()Purpose:Syntax:Arguments:Includes:Returns:Example Call:Waits for and reads a single character from the keypadwithout buffering it or echoing it to the screen. Usefulin reading single key entries. When reading functionkeys, getch() must be called twice; it returns 0 the firsttime and the code for the function key pressed thesecond time (see the ASCII Keycodes).int getch(void);None.#include The ASCII code for the character read.c = getch(); /* wait for and get a key withoutechoing it to the display */Waits for and reads a single character from the keypadand echoes it to the display, with no buffering. Usefulfor reading a single character from the keypad andechoing it to the display. When reading function keys,getche() must be called twice; it returns 0 the first timeand the code for the function key pressed the secondtime (see the ASCII Keycodes).int getche(void);None.#include The ASCII code for the character read.c = getche(); /* wait for and get a key and echothe key to the display */


Chapter 3: Programming the <strong>5945</strong> 3-35kbhit()Purpose:Syntax:Arguments:Includes:Returns:Checks for keypad entries in the buffer waiting to beread.int kbhit(void);None.#include 0 if no key was pressed. <strong>Other</strong>wise non-zero.Example Call: while(!kbhit()); /* wait for a keystroke */<strong>5945</strong> Specific C Library FunctionsThe <strong>5945</strong> specific C library functions used for <strong>5945</strong> keypadprogramming are described in the following section:_disablekeyboard()Purpose: Disables the entire keyboard and key buffering.Syntax: void _disablekeyboard(void);Arguments: None.Includes: #include Returns None.Example Call: _disablekeyboard(); /* disable the keyboard */_enablekeyboard()Purpose Enables the keyboard if it was previously disabled.Syntax: void _enablekeyboard(void);Arguments: None.


3-36 Chapter 3: Programming the <strong>5945</strong>Includes:Returns#include None.Example Call: _enablekeyboard(); /* enable the keyboard */_getkeyclick()Purpose:Syntax:Arguments:Includes:Returns:Example Call:_getkeymask()Purpose:Syntax:Arguments:Includes:Returns:Example Call:Reads the keyclick parameters. See also _setkeyclick().The volume bits are ignored in the <strong>5945</strong>.unsigned long _getkeyclick(void);None.#include The current keyclick settings.old_ctrl = _getkeyclick(); /* get current keyclickparameters */Gets the current keymask. See also _setkeymask().unsigned long _getkeymask(void);None:#include The current keymask settings.Key_mask = getkeymask(); /* Key_mask is a longvariable holding the current key mask for thekeypad */_initkeyboard()Purpose:Syntax:Initializes the keyboard library properties. Must becalled once by any <strong>5945</strong> application before anykeyboard library function is called but after_init_5944().void _initkeyboard(void);


Chapter 3: Programming the <strong>5945</strong> 3-37Arguments:Includes:Returns:Example Call:None:#include None._initkeyboard(); /* place at beginning of mainfunction */_setkeyclick()Purpose:Syntax:Argument:Includes:Returns:Example Call:_setkeymask()Purpose:Syntax:Sets the keyclick parameters. Volume bits are ignored.unsigned long _setkeyclick(unsigned long ctrl);ctrl (specifies the new keyclick parameters).Bit 0 (1 enables keyclick).Bit 1 (1 enables error tone).Bits 2-9 (not significant).Bits 10-15 (keyclick tone length in 10 millisecondi<strong>ncr</strong>ements, range is 0-63).Bits 16-31 (error tone length in 10 millisecondi<strong>ncr</strong>ements, range is 0-127).#include The old keyclick parameters.old_ctrl = setkeyclick(0x321403); /* enablekeyclick at standard volume for 50 milliseconds,enable error tone at standard volume for 500milliseconds */Sets the mask bits for the keypad (least significant bitcorresponds to the upper left key, next bit correspondsto the next key to the right, etc.) A keypress sounds anormal keytone and puts the ASCII key code in thekeypad buffer if the corresponding bit for the key is set.If that bit is clear, the keypress sounds a long error toneand no keys are buffered.unsigned long _setkeymask(unsigned long mask);


3-38 Chapter 3: Programming the <strong>5945</strong>Argument:mask (defines the new keymask).Bit 0 set (upper left, F1 key enabled).Bit 25 set (lower right, Enter key enabled).Key Bit Key Bit Key BitF1 0 F2 1 F3 3F4 None F5(Yes) 5 F6(No) 10F7 None F8 None Cancel 9Clear None BackSpace(Clear)19 Enter 24‘1’ 6 ‘2’ 7 ‘3’ 8‘4’ 11 ‘5’ 12 ‘6’ 13‘7’ 16 ‘8’ 17 ‘9’ 18‘0’ 22The <strong>5945</strong> only has “cancel” and “clear” keys. Tosimulate the “cancel”, “clear” and “backspace” keys ofthe 5944 the two <strong>5945</strong> keys are multiplexed. If the 5944“backspace” is enabled then the “clear” key on the 5944will return “backspace”. If the 5944 “cancel” key isenabled the <strong>5945</strong> will return “cancel”. If either the 5944“backspace” or “cancel” key is not enabled and the5944 “clear” key is enabled, then the <strong>5945</strong> will return“clear” in place of the disabled key.Includes:Returns:Example Call:#include The old keymask.old_key_mask = _setkeymask(0x4000C0); /* enablekeys ‘0’, ‘1’, and ‘2’ only, save the old key maskso it can be restored later */


Chapter 3: Programming the <strong>5945</strong> 3-39Magnetic Stripe Reader (MSR) ProgrammingThe <strong>5945</strong> MSR can simultaneously read tracks 1, 2, and (optionally) 3,and the reader for all tracks are enabled at once. The read formatoptions for each track are ASCII and hexadecimal. ISO, AAMVA andCA Driver License formats are automatically parsed by the internalMSR routines.The application reads the buffer by calling the _readmsr() function.The data read is stored in an internal buffer and is erased uponreading.<strong>5945</strong> Specific C Library FunctionsThe <strong>5945</strong> specific C library functions used for <strong>5945</strong> MSR programmingare described in the following section._cardswiped()Purpose:Syntax:Arguments:Includes:Returns:Example Call:Determines if MSR data is waiting in the buffer to beread and what MSR track the data was retrieved from.int _cardswiped(void);None.#include -1 (no tracks enabled).0 (no card swiped).1 (track 1 data available).2 (track 2 data available).3 (tracks 1 and 2 data available).4 (track 3 data available).5 (tracks 1 and 3 data available).6 (tracks 2 and 3 data available).7 (tracks 1, 2, and 3 data available).card_stat = _cardswiped(); /* return the MSRstatus */


3-40 Chapter 3: Programming the <strong>5945</strong>_disablemsr()Purpose:Syntax:Arguments:Includes:Returns:Disables the MSR device.void _disablemsr(void);None.#include None.Example Call: _disablemsr(); /* disable the MSR */_enablemsr()Purpose:Syntax:Arguments:Includes:Returns:Enables specified MSR tracks. The MSR must be reenabledafter a call to _readmsr(). <strong>Data</strong> is returned in“type” format.int _enablemsr(char tracks, char type);tracks (_TRACK1, _TRACK2, _TRACK3, or any bitwiselogical OR combination, such as _TRACK1 |_TRACK2).type (type of data to be returned: _MSRASCII or_MSRHEX).#include 0 (one or more tracks are enabled).FFFFh (tracks not enabled).Example Call: status = _enablemsr(_TRACK1, _MSRASCII); /*enable MSR track 1 and return read data in ASCIIformat */_getmsrtone()Purpose:Syntax:Argument:Obtains the current MSR tone settings.void _getmsrtone(long far *tone);tone (points to a long integer to hold the MSR tonesetting).


Chapter 3: Programming the <strong>5945</strong> 3-41Includes:Returns:Example Call:_readmsr()Purpose:Syntax:Arguments:Includes:#include The current MSR tone parameters, as follows:Bit 0 (enables good read tone if set to 1).Bit 1 (enables read error tone if set to 1).Bits 2-9 (not significant).Bits 10-15 (good tone length in 10 millisecond units,1-63).Bits 16-24 (error tone length in 10 millisecond units,1-511)._getmsrtone(&tone); /* get current MSR toneparameters and put it in tone */Reads the MSR track data from the internal MSR bufferand writes it to the buffer pointed to by buf. The typeof the returned data is determined earlier by the_enablemsr() function. A separate readmsr() call mustbe made to retrieve the data for each individual track(although all tracks are read with a single swipe).int _readmsr(char track, char far *buf, int size);track (_TRACK1, _TRACK2, or _TRACK3).buf (points to the caller's buffer for holding the MSRdata).size (size of the caller's buffer).#include


3-42 Chapter 3: Programming the <strong>5945</strong>Returns:Example Call:Length of the data copied if successful. <strong>Other</strong>wise anerror status as follows.0000h (card not swiped).FFFFh(MSR not enabled, MSR in secure mode, orcaller's buffer too small).FFF1h(no start sentinel).FFF2h(parity error).FFF3h(no end sentinel).FFF4h(LRC error).FFF5h(buffer overflow).FFF6h(no data on track).FFF7h(track not installed).status = _readmsr(_TRACK1, buf, 120); /* read datafrom MSR track 1 if available */_setmsrformat()Purpose:Syntax:Includes:Returns:Not Supported. Provided for 5944 compatibility.int _setmsrformat(unsigned char track, unsigned charsize, unsigned char start, unsigned char end, unsignedchar parity);#include FFFFh(not supported)._setmsrtone()Purpose:Syntax:Argument:Includes:Sets the current MSR tone parameters. See also_getmsrtone(). The MSR tone is only sounded when the_readmsr() call is made by the application for theparticular track of interest to the application.long _setmsrtone(long far *tone);tone (specifies the new MSR tone setting. After the callthe buffer pointed to by tone holds the old MSRsetting).#include


Chapter 3: Programming the <strong>5945</strong> 3-43Returns:The previous MSR tone parameters as follows.Bit 0 (enables good read tone if set to 1).Bit 1 (enables read error tone if set to 1).Bits 2-9 (not significant).Bits 10-15 (good tone length in 10 millisecond units,1-63).Bits 16-24 (error tone length in 10 millisecond units,1-511).Serial I/O ProgrammingExample Call: tone = 0x321403;old_tone = setmsrtone(&tone); /*enable MSR good tone for duration 50 milliseconds,enable error tone at duration 500 milliseconds andold_tone contains the previous parameter */The Host PortEvery <strong>5945</strong> can communicate with a host using EIA-232-D or IBM EIA-485 two-wire communications. A parameter in the file system controlsthis (See Users Manual). In addition, a different host communicationcable is used to support each communication type. The value of theserial port communication parameters can be set in the file system ofthe <strong>5945</strong>. This is described in greater detail in the User’s Manual. Thefunction _openhcom() does not override these settings if they are set inthe file system. By deleting the host communications settings from thefile system _openhcom() will open the host communications with thespecified values and set the values in the file system.


3-44 Chapter 3: Programming the <strong>5945</strong>File System Host Communications InformationParameter Application File Record Class DescriptionInterface 1 32769 1 3(system)0 = RS-2321 = RS-485 IBMNCR DL 1 32769 4 3 0 = IBMDownload1 = NCRDownloadBaud Rate 1 32769 10 3 Baud Rate<strong>Data</strong> Bits 1 32769 11 3 <strong>Data</strong> BitsParity 1 32769 12 3 0 = None1 = Odd2 = EvenProgramLevelParameterLevel1 32770 10 3 CurrentProgram Level1 32770 11 3 CurrentParameterLevelThe EIA-232-D Aux PortsTwo (2) EIA-232-D auxiliary ports support common POS peripheralserial devices, including printers, clerk pads, and MICR check readers.The baud rates, word length/parity combinations, and legal AUX nport configurations are listed below.AUX baud rates are in the range from 1200bps to 19200 bps. Only oneAUX port can be accessed at any given time. There are only two (2)available AUX ports on the <strong>5945</strong>. These are named ports 2 & 3 toprovide compatibility with the 5944 full featured AUX ports. Calls thatreference AUX 1 are stubbed and return FFFFh.


Chapter 3: Programming the <strong>5945</strong> 3-45Baud Rateserio.h Define Value Baud Rate_BAUD_1200 1200_BAUD_2400 2400_BAUD_4800 4800_BAUD_9600 9600_BAUD_19200 19200Word Length and Parityserio.h Define Value <strong>Data</strong> Bits Parity Stop Bits_D7ES1 7 Even 1_D7OS1 7 Odd 1_D8NS1 8 None 1_D8ES1 8 Even (host only) 1_D8OS1 8 Odd (host only) 1Legal Port ConfigurationsEIA-232-D Port 7 bits with parity 8 bits with parity 8 bits without parity Baud rateHost Yes Yes Yes AllAux2 Yes No Yes AllAux3 Yes No Yes All<strong>5945</strong> Specific C Library FunctionsThe <strong>5945</strong> specific C library functions used for <strong>5945</strong> serial I/Oprogramming are described in the following section.


3-46 Chapter 3: Programming the <strong>5945</strong>_closeaux1()Purpose:Includes:Syntax:Returns:Not Supported. Provided for 5944 compatibility. The<strong>5945</strong> hardware does not support an AUX 1 port.#include int _closeaux1(unsigned char baud, unsigned charformat, unsigned char type);FFFFh (not supported)._closehcom(), _closeaux2(), _closeaux3()Purpose: Flushes the indicated communication port and closesthe port.Syntax: int _closehcom(void);Arguments: None.Includes: #include Returns: 0 (successful).FFFFh (unsuccessful).Example Call: _closehcom(); /* close host port */_enableaux2(), _enableaux3()Purpose: Enables indicated AUX port and disables other AUXport. Only one AUX port can be used at any giventime.Syntax: int _enableauxx(void);Arguments: None.Includes: #include Returns: 0 (successful).FFFFh (unsuccessful).Example Call: _enableaux3(); /* enable AUX 3 port */


Chapter 3: Programming the <strong>5945</strong> 3-47_disableaux2(), _disableaux3()Purpose:Syntax:Arguments:Includes:Returns:Disables the indicated AUX port.int _disableauxx(void);None.#include 0 (successful).FFFFh (unsuccessful).Example Call: _disableaux2(); /* disable AUX 2 port */_getstathcom(), _getstataux1(), _getstataux2(), _getstataux3()Purpose: Not Supported. Provided for 5944 compatibility. The<strong>5945</strong> hardware does not support control lines for anyports.Syntax: int _getstatxxxx(void);Includes: #include Returns: FFFFh (not supported)._openaux1()Purpose:Includes:Syntax:Returns:Not Supported. Provided for 5944 compatibility. The<strong>5945</strong> hardware does not support an AUX 1 port.#include int _openaux1(unsigned char baud, unsigned charformat, unsigned char type);FFFFh (not supported).


3-48 Chapter 3: Programming the <strong>5945</strong>_openhcom(), _openaux2(), _openaux3()Purpose:Syntax:Arguments:Includes:Opens the indicated communication port and sets upthe communication parameters. In the case of EIA-485,the arguments are not significant and are entered as 0s,e.g., _openhcom(0, 0, 0).The host open function does not override thecommunication values stored in the <strong>5945</strong>’s file system.See programmer’s manual for host communications fileinformation. For _openhcom() to set the passed invalues the host parameter files must not exist in the filesystem. This can be done by deleting the hostconfiguration files with the API iFileDeleteRecord().The include file file_api.h will be needed with thisfunction.The F1 setup menu writes to the host communicationfiles if the host port setup is entered. The hostcommunications files can be deleted prior to calling_openhcom() if the values passed into _openhcom()are desired. To delete all the relevant hostcommunication files the programmer should calli4430DeleteCommFiles() prior to calling _openhcom().int _openhcom(unsigned char baud, unsigned charformat, unsigned char type);baud (a constant specifying the baud rate).format (a constant specifying the communicationparameters).type (as follows 14 ): _RAW (all ports); _VLI (host portonly).#include in Chapter 4.14VLI vs. RAW mode is discussed in more detail


Chapter 3: Programming the <strong>5945</strong> 3-49Returns:Example Call:0 (successful).FFFFh (unsuccessful)._openhcom(_BAUD_9600, _D70S1, _VLI); /* 9600 baud,7 data bits, odd parity, one stop bit, VLI typeprotocol) */_readaux1()Purpose:Syntax:Includes:Returns:Not Supported. Provided for 5944 compatibility. The<strong>5945</strong> hardware does not support an AUX 1 port.int _readaux1(char far *buf, unsigned int count);#include FFFFh(not supported)._readhcom(), _readaux2(), _readaux3()Purpose: Reads a specified number of bytes from the device portto the application's buffer.Syntax: int _readxxxx(char far *buf, unsigned int count);Argument: buf (points to the application's buffer which receivesthe data read from the device port.)count (number of bytes to read, 256 bytes maximum).Includes: #include Returns: xx (the number of bytes actually read).FFFFh (unsuccessful, port may not be enabled and/oropened).Example Call: nbytes = _readaux1(buffer, 256); /* read up to 256bytes from Aux1 port and set nbytes equal to theactual number of bytes read */


3-50 Chapter 3: Programming the <strong>5945</strong>_setctrlhcom(), _setctrlaux2(), _setctrlaux3()Purpose:Syntax:Includes:Returns:Not Supported. Provided for 5944 compatibility. The<strong>5945</strong> hardware does not support control lines for anyports.int _setctrlxxxx(int control);#include FFFFh(not supported)._writeaux1()Purpose:Syntax:Includes:Returns:Not Supported. Provided for 5944 compatibility. The<strong>5945</strong> hardware does not support an AUX 1 port.int _writeaux1(char far *buf, unsigned int count);#include FFFFh (not supported)._writehcom(), _writeaux2(), _writeaux3()Purpose: Writes a specified number of bytes from theapplication's buffer to the device port.Syntax: int _writexxxx (char far *buf, unsigned int count);Arguments: buf (pointer to the application's buffer containing thedata to write).count (number of bytes to write to the device).Includes: #include Returns: xx (the number of bytes actually written).FFFFh (unsuccessful, port may not be enabled and/oropened).Example Call:_writeaux3(buffer, 10); /* Write ten bytes fromthe buffer to the Aux3 port */


Chapter 3: Programming the <strong>5945</strong> 3-51Timer Programming_canceltimer()Purpose:Syntax:Argument:Includes:Returns:Example Call:_delay()Purpose:Syntax:Argument:Includes:Returns:Cancels a previously set timer.void _canceltimer(unsigned int timer);timer (timer number 0, 1 (_TIMER1), 2 (_TIMER2),3 (_TIMER3), 4 (_TIMER4), 5, 6, or 7.#include None._canceltimer(_TIMER4); /* cancel previously settimer */Delays the application program execution for theperiod (length x 10 milliseconds).int _delay(unsigned int length);length (timer delay period in 10 millisecondi<strong>ncr</strong>ements).#include 0 (successful).FFFFh (previous delay not expired).Example Call: _delay(10); /* delay 100 milliseconds */_gettimerstat()Purpose:Syntax:Argument:Returns the status of the application timer startedby _settimer(). There are eight (8) timers available.int _gettimerstat(unsigned int timer);timer (timer number 0, 1 (_TIMER1), 2 (_TIMER2),3 (_TIMER3), 4 (_TIMER4), 5, 6, or 7.


3-52 Chapter 3: Programming the <strong>5945</strong>Includes:Returns:Example Call:_inittimer()Purpose:Syntax:Arguments:Includes:Returns:Example Call:_settimer()Purpose:Syntax:Argument:Includes:Returns:Example Call:#include 0 (timer expired).1 (timer not expired).FFFFh (timer number is out of range).status = _gettimerstat(_TIMER1); /* status = 0 if_TIMER1 is expired */Initializes the timer library functions. Must be calledbefore any timer function is used (place at beginning ofmain function).void _inittimer(void);None.#include None._inittimer(); /* initialize the timer libraryfunctions */Sets an application timer of duration (length * 10 ms).There are eight (8) timers available.int _settimer(unsigned int timer, unsigned int length);timer (timer number 0, 1 (_TIMER1), 2 (_TIMER2),3 (_TIMER3), 4 (_TIMER4), 5, 6, or 7).length (timer duration in 10 millisecond i<strong>ncr</strong>ements).#include 0 (successful).FFFFh (timer number is out of range)._settimer(_TIMER1, 10); /* set application_TIMER1 to expire in 100 milliseconds */


4-1Chapter 4: Host/NCR 4430 Emulation InterfaceIntroductionThis chapter provides information about the application programmingfunctions used with the NCR <strong>5945</strong> running the NCR 4430 Emulationapplication. This chapter includes detailed information about FunctionCodes, Response Codes, Error Codes, and message formats.Application programming for the NCR <strong>5945</strong>’s 4430 Emulationapplication is illustrated in the 4430_AT utility included as part of theNCR <strong>5945</strong> SDK enclosed with this book. The utility shows examples ofthe 4430 Emulation application Function Codes, Response Codes, andError Codes used to program the <strong>5945</strong>. Detailed explanations of thethese codes is given in the following sections.Application Programming FunctionsThe following Codes are listed by the Function Codes used in theApplication, and define the Function, Response, and Error Codes,together with the data fields needed to implement the Application.To verify successful completion of the command, the <strong>5945</strong> returnsResponse Codes to the host workstation. Error Codes are returned tothe host when the command was not successful.The message-level fields required for each communication interfaceprotocol, such as the VLI, LN, and BCC Fields are not shown.


4-2 Chapter 4: Host/NCR 4430 Emulation InterfaceSpecial Function Keypad Input – Function Code 83HFunction Code 83H - Message Format[ 83H ] [ 1-BYTE TONE TYPE ]Response Code D3H - Message Format[ D3H ] [ 1-BYTE KEYPAD STATUS ]Error Code - NoneWhen the <strong>5945</strong> receives a (83H) Function Code, it activates a tone typeand opens the keypad for single key input. This Function Code doesnot alter the contents of the display. The host application must displaythe key that is depressed, using Function Code (23H).The one-byte tone type tells the <strong>5945</strong> which tone to use. Tone types arelisted in the following table.Tone Codes00H01H08H10HDescriptionNo ToneGood Entry ToneKey ClickError ToneWhen no valid Working Keys are loaded, the full keypad is enabledand the <strong>5945</strong> responds with a keypad status byte, as shown in thefollowing table.Tone Codes23H2AH24H23H2AH0AHDescriptionF1 (Upper Left Key)F2 (Middle Upper Key)F3 (Upper Right Key)F5 (Yes Key)F6 (No Key)Cancel Key


Chapter 4: Host/NCR 4430 Emulation Interface 4-3Tone Codes0AH0DH30H31H32H33H34H35H36H37H38H39HDescriptionClear KeyEnter Key"0" Key"1" Key"2" Key"3" Key"4" Key"5" Key"6" Key"7" Key"8" Key"9" KeyWhen valid Working Keys are loaded, keys 4, 5, 6, 7, 8, and 9 aredisabled; but this still allows nine keys to be used as special functionkeys. Once a key has been depressed, one of the status's is returned tothe host in Response Code message format.No Error Code is associated with the Special Function Key Inputcommand.Read All Tracks - Function Code 10HFunction Code 10H - Message Format[ 10H ] [ 1-BYTE RETRY COUNT ] (maximum retries = 5)Response Code 61H/62H/73H - Message Format[ 61H ] [ UP TO 79-BYTES OF TRACK 1 DATA ] [ 62H ][ UP TO 40-BYTES OF TRACK 2 DATA ] [ 73H ]


4-4 Chapter 4: Host/NCR 4430 Emulation InterfaceError Code F1H/F2H/73H - Message Format[ F1H ] [ F2H ] [ 73H ] (ALL TRACKS BAD)OR[ F1H ] [ 62H ] [ UP TO 40-BYTES TRACK 2 DATA ] [ 73H ](TRACK 1 BAD)OR[ 61H ] [ UP TO 79-BYTES TRACK 1 DATA ] [ F2H ] [ 73H ](TRACK 2 BAD)When the <strong>5945</strong> receives a (10H) Function Code, it opens the magneticstripe reader for reading, waits for a card to be swiped, and displaysMessage 2 from Table 1, as shown below.Please Pass CardThrough SlotThe format for track data (ASCII or HEX) is selected during 4430 Setup.After the card is swiped, the <strong>5945</strong> reads Track 1 and Track 2, and stripsthe start sentinel, the end sentinel, the LRC check character, and thecharacter level parity bits from the magnetic stripe data. The <strong>5945</strong>’s4430 Emulation application does not support a Track 3 read.If a successful swipe is completed, the <strong>5945</strong> assembles the data inResponse Code format, transmits the maximum data lengths, anddisplays Message 3 from Table 1, as shown below.Please WaitIf an error occurred on either of the Track reads and the error retrycount has not expired, the <strong>5945</strong> ignores the previous read data, anddisplays Message 4 from Table 1 as shown below. The reader remainsopen for a retry. Five is the maximum number of retries.Error Pass CardThru Slot Again


Chapter 4: Host/NCR 4430 Emulation Interface 4-5If the error retry count has expired, the <strong>5945</strong> replaces the data and goodResponse Codes of the bad track(s) with Error Codes, and displaysMessage 3 from Table 1, as shown below. A (73H)-Track 3 Bad ErrorCode is always returned as there is no Track 3 Head in the card reader.Please WaitRead Track 1 - Function Code 91HFunction Code 91H - Message Format[ 91H ] [ 1-BYTE RETRY COUNT ] (maximum retries = 5)Response Code 61H - Message Format[ 61H ] [ UP TO 79-BYTES OF TRACK 1 DATA ]Error Code F1H - Message Format[ F1H ]When the <strong>5945</strong> receives a (91H) Function Code, it opens the magneticstripe reader for reading, waits for a card to be swiped, and displaysMessage 2 from Table 1, as shown below.Please Pass CardThrough SlotThe format for track data (ASCII or HEX) is selected during 4430 Setup.After the card is swiped, the <strong>5945</strong> reads Track 1, and strips the startsentinel, the end sentinel, the LRC check character, and the characterlevel parity bits from the magnetic stripe data.If a successful swipe is completed, the <strong>5945</strong> assemblesthe data inResponse Code format, transmits the maximum data lengths, anddisplays Message 3 from Table 1, as shown below.Please Wait


4-6 Chapter 4: Host/NCR 4430 Emulation InterfaceIf an error occurred on Track 1 and the error retry count has notexpired, the <strong>5945</strong> ignores the previous read data and displays Message4 from Table 1, as shown below. The reader remains open for a retry.Error Pass CardThru Slot AgainIf the error retry count has expired, the <strong>5945</strong> replaces the data and goodResponse Code with Error Code (F1H), and displays Message 3 fromTable 1, as shown below.Please WaitRead Track 2 - Function Code 92HFunction Code 92H - Message Format[ 92H ] [ 1-BYTE RETRY COUNT ] (Maximum retries = 5)Response Code 62H - Message Format[ 62H ] [ UP TO 40-BYTES OF TRACK 2 DATA ]Error Code F2H - Message Format[ F2H ]When the <strong>5945</strong> receives a (92H) Function Code, it opens the magneticstripe reader for reading, waits for a card to be swiped, and displaysMessage 2 from Table 1, as shown below.Please Pass CardThrough SlotThe format for track data (ASCII or HEX) is selected during 4430 Setup.After the card is swiped, the <strong>5945</strong> reads Track 2, and strips the startsentinel, the end sentinel, the LRC check character, and the characterlevel parity bits from the magnetic stripe data.


Chapter 4: Host/NCR 4430 Emulation Interface 4-7If a successful swipe is completed, the <strong>5945</strong> assembles the data inResponse Code format, transmits the maximum data lengths, anddisplays Message 3 from Table, as shown below.Please WaitIf an error occurred on Track 2 and the error retry count has notexpired, the <strong>5945</strong> ignores the previous read data and displays Message4 from Table 1, as shown below. The reader remains open for a retry.Error Pass CardThru Slot AgainIf the error retry count has expired, the <strong>5945</strong> replaces the data and goodResponse Code with Error Code (F2H), and displays Message 3 fromTable 1, as shown below.Please WaitInput PIN Using Standard PIN Block - Function Code 20HFunction Code 20H - Message Format[ 20H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ][ 12-BYTE ASCII ACCOUNT NUMBER ]OR[ 20H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ]OR[ 20H] [1-BYTE KEY ID ]Response Code 64H - Message Format[ 64H ] [ 8-BYTE ENCRYPTED PIN ]Error Code F4H/7AH - Message Format[ F4H ] (ERROR)OR[ 7AH ] (ILLOGICAL)


4-8 Chapter 4: Host/NCR 4430 Emulation InterfaceWhen the <strong>5945</strong> receives a (20H) Function Code, it checks for validWorking Keys. If no Working Keys are loaded, the <strong>5945</strong> returns anIllogical Response Code (7AH) to the host workstation.The <strong>5945</strong> then evaluates the Key ID number. If the Key ID number isn'ta value between (01H) and (0AH) inclusive, the <strong>5945</strong> returns an ErrorCode (7AH) to the host workstation. If the Key ID number is valid, the<strong>5945</strong> verifies that the Working Key is also valid. If the Working Key isnot valid, the <strong>5945</strong> returns an Error Code (7AH) to the host.The <strong>5945</strong> then verifies the presence and length of the 12-byte ASCIIAccount Number. If the length is incorrect, the <strong>5945</strong> returns an ErrorCode (F4H) to the host workstation. If the account number is valid, the<strong>5945</strong> opens the keypad for numeric input and displays Message 6 fromTable 1, as shown below.Please Enter PINWhen a valid numeric key is pressed, the <strong>5945</strong> displays an asterisk, andactuates a key click tone.Press the CLEAR key to delete PIN digits during input.If less than 4 PIN digits are entered the <strong>5945</strong> sounds an error tone andrestarts PIN entry. The <strong>5945</strong> does not accept PINs of more than 12digits, an error tone is sounded when trying to enter a 13 th PIN digit.If the CANCEL key is pressed during PIN entry, the <strong>5945</strong> sounds anerror tone and restarts PIN entry.After valid PIN data has been entered and the Enter key has beenpressed, the PIN is stored and the <strong>5945</strong> constructs the PIN block anddisplays Message 3 from Table 1, as shown below.Please Wait• All unused positions (less than 12 positions) to the right of the PINare filled with the programmable one-byte fill character (FH is thedefault).• The PIN block is then Exclusive-ORed to the account number block,and the result is e<strong>ncr</strong>ypted with the specified Working Key andsent to the host in Response Code format.


Chapter 4: Host/NCR 4430 Emulation Interface 4-9Optional PIN Entry Using StandardPIN Block - Function Code 0EHFunction Code 0EH - Message Format[ 0EH ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ][ 12-BYTE ASCII ACCOUNT NUMBER ]OR[ 0EH ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ]OR[ 0EH] [1-BYTE KEY ID ]Response Code 64H/E3H - Message Format[ 64H ] [ 8-BYTE ENCRYPTED PIN ]OR[ E3H ] (No PIN Entered)Error Code F4H/7AH - Message Format[ F4H ] (ERROR)OR[ 7AH ] (ILLOGICAL)This command permits the user to PASS when entering a PIN. Whenthe <strong>5945</strong> receives a (0EH) Function Code, it checks for valid WorkingKeys. If no Working Keys are loaded, the <strong>5945</strong> returns an IllogicalResponse Code (7AH) to the host workstation.The <strong>5945</strong> then evaluates the Key ID number. If the Key ID number isn'ta value between (01H) and (0AH) inclusive, the <strong>5945</strong> returns an ErrorCode (7AH) to the host workstation. If the Key ID number is valid, the<strong>5945</strong> verifies that the Working Key is also valid. If the Working Key isnot valid, the <strong>5945</strong> returns an Error Code (7AH) to the host.


4-10 Chapter 4: Host/NCR 4430 Emulation InterfaceThe <strong>5945</strong> then verifies the presence and length of the 12-byte ASCIIAccount Number. If the length is incorrect, the <strong>5945</strong> returns an ErrorCode (F4H) to the host workstation. If the account number is valid, the<strong>5945</strong> opens the keypad for numeric input and displays Message 6 fromTable 1, as shown below.Please Enter PINWhen a valid numeric key is pressed, the <strong>5945</strong> displays an asterisk, andactuates a key click tone.Press the CLEAR key to delete PIN digits during input.If less than 4 PIN digits are entered the <strong>5945</strong> sounds an error tone andrestarts PIN entry. The <strong>5945</strong> does not accept PINs of more than 12digits, an error tone is sounded when trying to enter a 13 th PIN digit.If the CANCEL key is pressed any time during PIN entry, the <strong>5945</strong>returns a (E3H) Response Code message to the host workstationindicating PIN entry has been optionally PASSED.After valid data has been entered and the Enter key has been pressed,the PIN is stored and the <strong>5945</strong> constructs the PIN block and displaysMessage 3 from Table 1, as shown below.Please Wait• All unused positions (less than 12 positions) to the right of the PINare filled with the programmable one-byte fill character (FH is thedefault).• The PIN block is then Exclusive-ORed to the account number, andthe result is e<strong>ncr</strong>ypted with the specified Working Key and sent tothe host in (64H) Response Code format.


Chapter 4: Host/NCR 4430 Emulation Interface 4-11Input PIN Using Alternate PIN Block - Function Code 85HFunction Code 85H - Message Format[ 85H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ][ 12-BYTE ASCII ACCOUNT NUMBER ]OR[ 85H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ]OR[ 85H] [1-BYTE KEY ID ]Response Code 64H - Message Format[ 64H ] [ 8-BYTE ENCRYPTED PIN ]Error Code F4H/7AH - Message Format[ F4H ] (ERROR)OR[ 7AH ] (ILLOGICAL)When the <strong>5945</strong> receives a (85H) Function Code, it checks for validWorking Keys. If no Working Keys are loaded, the <strong>5945</strong> returns anIllogical Response Code (7AH) to the host workstation.The <strong>5945</strong> then evaluates the Key ID number. If the Key ID number isn'ta value between (01H) and (0AH) inclusive, the <strong>5945</strong> returns an ErrorCode (7AH) to the host workstation. If the Key ID number is valid, the<strong>5945</strong> verifies that the Working Key is also valid. If the Working Key isnot valid, the <strong>5945</strong> returns an Error Code (7AH) to the hostworkstation.The <strong>5945</strong> then verifies the presence and length of the 12-byte ASCIIAccount Number. If the length is incorrect, the <strong>5945</strong> returns an ErrorCode (F4H) to the host workstation. If the account number is valid, the<strong>5945</strong> opens the keypad for numeric input and displays Message 6 fromTable 1, as shown below.


4-12 Chapter 4: Host/NCR 4430 Emulation InterfacePlease Enter PINWhen a valid numeric key is pressed, the <strong>5945</strong> displays an asterisk, andactuates a key click tone.Press the CLEAR key to delete PIN digits during input.If less than 4 PIN digits are entered the <strong>5945</strong> sounds an error tone andrestarts PIN entry. The <strong>5945</strong> does not accept PINs of more than 12digits, an error tone is sounded when trying to enter a 13 th PIN digit.If the CANCEL key is pressed during PIN entry, the <strong>5945</strong> sounds anerror tone and restarts PIN entry.After valid data has been entered and the Enter key has been pressed,the PIN is stored and the <strong>5945</strong> constructs the alternate PIN block anddisplays Message 3 from Table 1, as shown below.Please WaitAll unused positions (less than 12 positions) to the right of the PIN arefilled with the programmable one-byte fill character (FH is the default).The PIN block is then Exclusive-ORed to the account number, and theresult is e<strong>ncr</strong>ypted with the specified Working Key and sent to the hostin (64H) Response Code format.Note: The alternate PIN block construction is shown below.Bit1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64[P] [P] [P] [P] [P/F] [P/F] [P/F] [P/F] [P/F] [P/F] [P/F] [P/F][F] [F] [F] [F][P] - PIN Digit[P/F] - PIN or Fill Digit[F] - Fill DigitOptional PIN Entry Using The Alternate PIN Block - FunctionCode 13HFunction Code 13H - Message Format[ 13H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ][ 12-BYTE ASCII ACCOUNT NUMBER ]OR


Chapter 4: Host/NCR 4430 Emulation Interface 4-13[ 13H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ]OR[ 13H] [1-BYTE KEY ID ]Response Code 64H/E3H - Message Format[ 64H ] [ 8-BYTE ENCRYPTED PIN ]OR[ E3H ] (No PIN Entered)Error Code F4H/7AH - Message Format[ F4H ] (ERROR)OR[ 7AH ] (ILLOGICAL)This command permits the user to PASS when entering a PIN. Whenthe <strong>5945</strong> receives a (13H) Function Code, it checks for valid WorkingKeys. If no Working Keys are loaded, the <strong>5945</strong> returns an IllogicalResponse Code (7AH) to the host workstation.The <strong>5945</strong> then evaluates the Key ID number. If the Key ID number isn'ta value between (01H) and (0AH) inclusive, the <strong>5945</strong> returns an ErrorCode (7AH) to the host workstation. If the Key ID number is valid, the<strong>5945</strong> verifies that the Working Key is also valid. If the Working Key isnot valid, the <strong>5945</strong> returns an Error Code (7AH) to the host.The <strong>5945</strong> then verifies the presence and length of the 12-byte ASCIIAccount Number. If the length is incorrect, the <strong>5945</strong> returns an ErrorCode (F4H) to the host workstation. If the account number is valid, the<strong>5945</strong> opens the keypad for numeric input and displays Message 6 fromTable 1, as shown below.Please Enter PINWhen a valid numeric key is pressed, the <strong>5945</strong> displays an asterisk, andactuates a key click tone.Press the CLEAR key to delete PIN digits during input.


4-14 Chapter 4: Host/NCR 4430 Emulation InterfaceIf less than 4 PIN digits are entered the <strong>5945</strong> sounds an error tone andrestarts PIN entry. The <strong>5945</strong> does not accept PINs of more than 12digits, an error tone is sounded when trying to enter a 13 th PIN digit.If the CANCEL key is pressed any time during PIN entry, the <strong>5945</strong>returns a (E3H) Response Code message to the host workstationindicating PIN entry has been optionally PASSED.After valid data has been entered and the Enter key has been pressed,the PIN is stored and the <strong>5945</strong> constructs the PIN block and displaysMessage 3 from Table 1, as shown below.Please Wait• All unused positions (less than 12 positions) to the right of the PINare filled with the programmable one-byte fill character (FH is thedefault).• The PIN block is then Exclusive-ORed to the account number, andthe result is e<strong>ncr</strong>ypted with the specified Working Key and sent tothe host in (64H) Response Code message format.Note: The alternate PIN block construction is shown below.Bit1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64[P] [P] [P] [P] [P/F] [P/F] [P/F] [P/F] [P/F] [P/F] [P/F] [P/F][F] [F] [F] [F][P] - PIN Digit[P/F] - PIN or Fill Digit[F] - Fill DigitInput From Keypad - Function Code A2HFunction Code A2H - Message Format[ A2H ]Response Code E6H - Message Format[ E6H ] [UP TO 64 BYTES OF ASCII KEYPAD DATA ]Error Code - None


Chapter 4: Host/NCR 4430 Emulation Interface 4-15When the <strong>5945</strong> receives an (A2H) Function Code, it opens the keypadfor alphanumeric input, waits for a key to be depressed, and displaysMessage 15 from Table 1, as shown below.Enter <strong>Data</strong>If a key is pressed, the <strong>5945</strong> indicates a valid data entry by displayingthe pressed key, and actuating a tone.You must press two keys to enter letters from the <strong>5945</strong> keypad. Thefirst key is one of the top-three special function keys located on the firstrow of the <strong>5945</strong> keypad. The second key is the numeric key with theletter you want to enter.To determine which special function key to use, look at the numerickey with the letter you want to enter and note the letter's position. Ifthe letter is located on the top-left of the numeric key, press the specialfunction key located on the left of the keypad.To enter a letter, press the special function key, followed by thenumeric key with the letter you wish to enter. Additional examples aregiven in the list below.• To enter an "A", press the top-left key, then the "2" key.• To enter a "B", press the top-middle key, then the "2" key.• To enter a "C", press the top-right key, then the "2" key.To enter numeric data, press the appropriate key numbered 0 to 9. Ifincorrect data is entered or multiple keys are depressed, the <strong>5945</strong>actuates an error tone and displays Message 5 from Display Table 1, asshown below.Please PressCancelPress the CANCEL key to restart alphanumeric input.When up to 64 character are entered, press the top-right key (F3), thenthe Enter key. The data is assembled and transmitted to the host inResponse Code format. The <strong>5945</strong> displays Message 3 from DisplayTable 1, as shown below.


4-16 Chapter 4: Host/NCR 4430 Emulation InterfacePlease WaitNo Error Code is associated with the Input From Keypad command.Remote Display Write - Function Code 23HFunction Code 23H - Message Format[ 23H ] [ 32-ASCII CHARACTERS ]Response Code 67H - Message Format[ 67H ]Error Code - NoneWhen the <strong>5945</strong> receives a (23H) Function Code, it displays thecorresponding 32-ASCII character message. The 32-ASCII charactermessage can be any combination of <strong>5945</strong> ASCII character codes.If the data field is less than 32 characters, the <strong>5945</strong> fills in the field withASCII "space" characters (20H). If the data field is greater than 32characters, it truncates the field at 32-characters. It is the application'sresponsibility to center the displayed data for aesthetics.After the message is displayed, the <strong>5945</strong> returns a (67H) ResponseCode to the host workstation. No Error Code is associated with theRemote Display Write command.Remote Display Table 1 Load - Function Code A4HFunction Code A4H - Message Format[ A4H ] [ 1-BYTE MESSAGE NUMBER ] [ 32-ASCII CHARACTERS]Response Code 68H - Message Format[ 68H ]Error Code - NoneWhen the <strong>5945</strong> receives a (A4H) Function Code, it updates the MessageNumber in Display Table 1 with the 32-ASCII characters in theFunction Code Message.


Chapter 4: Host/NCR 4430 Emulation Interface 4-17If the data field is less than 32 characters, the <strong>5945</strong> fills in the field withASCII "space" characters (20H). If the data field is greater than 32characters, it truncates the field at 32 characters.The 1-byte message-number field contains Message Numbers (0H) to(10H). A (0H) message number forces the Display Table 1 to bereloaded from ROM. Message numbers (01H) to (10H) updatecorresponding message numbers in Display Table 1 with thetransmitted ASCII characters. Message numbers greater than (10H) areforced into the message table and processed. For example, MessageNumber (11H) becomes Message Number (01H) or Message Number(21H) becomes (01H), etc.After the <strong>5945</strong> updates and checksums Display Table 1, a (68H)Response Code is returned to the host workstation. No Error Code isassociated with the Remote Display Table 1 Load command.Remote Display Table 2 Load - Function Code 76HFunction Code 76H - Message Format[ 76H ] [ 1-BYTE MESSAGE NUMBER ] [ 32-ASCII CHARACTERS]Response Code F7H - Message Format[ F7H ]Error Code - NoneWhen the <strong>5945</strong> receives a (76H) Function Code, it updates the MessageNumber in Display Table 2 with the 32-ASCII characters in theFunction Code Message.If the data field is less than 32 characters, the <strong>5945</strong> fills in the field withASCII "space" characters (20H). If the data field is greater than 32characters, it truncates the field at 32 characters.


4-18 Chapter 4: Host/NCR 4430 Emulation InterfaceThe 1-byte message-number field contains Message Numbers (0H) to(10H). A (0H) message number forces the Display Table 2 to bereloaded from ROM. Message numbers (01H) to (10H) updatecorresponding message numbers in Display Table 2 with thetransmitted ASCII characters. Message numbers greater than (10H) areforced into the message table and processed. For example, MessageNumber (11H) becomes Message Number (01H) or Message Number(21H) becomes (01H), etc.After the <strong>5945</strong> updates and checksums Display Table 1, a (F7H)Response Code is returned to the host workstation. No Error Code isassociated with the Remote Display Table 2 Load command.Multiple Display Message Load - Function Code 0BHFunction Code 0BH - Message Format[ 0BH ] [ NUMESS ] ( M11D, M1, M21D, M2, M31D, M3, M41D, M4 )(Optional)Response Code 8CH - Message Format[ 8CH ]Error Code 0DH - Message Format[ 0DH ]When the <strong>5945</strong> receives a (0BH) Function Code, it updates displaymessages in both tables. The Response Code Message is returnedwhen the tables are successfully updated.Display messages are updated according to the following definitions.• NUMESS - One byte field that indicates the number of displaymessages (0-4) to follow. When this value is zero, Display Table 1and Display Table 2 are reloaded from ROM. When this value isgreater than four, the Error Code Message is returned to the hostworkstation.


Chapter 4: Host/NCR 4430 Emulation Interface 4-19• M11D, M21D, M31D, M41D - One byte field that specifies thelocation for the 32-byte ASCII message that follows this entry.Values (01H) to (10H) point to messages in Table 1. Values (11H)to (20H) point to messages in Table 2. Value (00H) points to (10H)in Table 1. Values greater than (20H) are forced into the messagetables by subtracting (20H) from each value until the remainder is(20H) or less.• M1, M2, M3, M4 - 32-byte ASCII message that is loaded into thecorresponding ID. NOTE: These messages must be 32 bytes inlength.Remote Display Table 1 Read - Function Code 25HFunction Code 25H - Message Format[ 25H ] [ 1-BYTE MESSAGE NUMBER ]Response Code 54H - Message Format[ 54H ] [ 1-BYTE MESSAGE NUMBER ] [ 32-ASCII-BYTES ]Error Code - NoneWhen the <strong>5945</strong> receives a (25H) Function Code, it finds the messagenumber in Display Table 1, reads the 32 ASCII character message, andreturns it to the host workstation. Message numbers greater than(10H) are forced into the message table and processed. For example,Message Number (11H) becomes Message Number (01H) or MessageNumber (21H) becomes (01H), etc.No Error Code is associated with the Remote Display Table 1 Readcommand.Remote Display Table 2 Read - Function Code 79HFunction Code 79H - Message Format[ 79H ] [ 1-BYTE MESSAGE NUMBER ]Response Code F8H - Message Format[ F8H ] [ 1-BYTE MESSAGE NUMBER ] [ 32-ASCII-BYTES ]


4-20 Chapter 4: Host/NCR 4430 Emulation InterfaceError Code - NoneWhen the <strong>5945</strong> receives a (79H) Function Code, it finds the messagenumber in Display Table 2, reads the 32 ASCII character message, andreturns it to the host workstation. Message numbers greater than(10H) are forced into the message table and processed. For example,Message Number (11H) becomes Message Number (01H) or MessageNumber (21H) becomes (01H), etc.No Error Code is associated with the Remote Display Table 2 Readcommand.Initiate Load - E<strong>ncr</strong>ypted Working Key - Function Code B0HFunction Code B0H - Message FormatFormat A: [ B0H ] [ 1-BYTE KEY ID ] [ 04H ][ 8-BYTE ENCROR ] [ 1-BYTE ]Format B: [ B0H ] [ 1-BYTE KEY ID ][ 1-BYTE INPUT METHOD ] [ 1-BYTE INSTRUCTION CODE ]Response Code E9H - Message Format[ E9H ]Error Code F8H - Message Format[ F8H ]Format A: When the <strong>5945</strong> receives a Function Code Message (B0H) inFormat A, the <strong>5945</strong> validates message information or returns an ErrorCode (F8H) to the host workstation if any of the verifications fail. The<strong>5945</strong> verifies the following parameters.• Message Length is correct• 1-Byte Key ID number is between (01H) and (0AH) inclusive• Key Exchange Key is loadedWhen the verifications pass, the <strong>5945</strong> decrypts the 8-Byte E<strong>ncr</strong>yptedWorking Key with the Key Exchange Key specified by the Key IDnumber.


Chapter 4: Host/NCR 4430 Emulation Interface 4-21The <strong>5945</strong> stores the decrypted Working Key in the location given by theKey ID number. The 1-Byte Instruction Code is ignored and the <strong>5945</strong>returns the Response Code Message (E9H).Format B: When the <strong>5945</strong> receives a Function Code Message (B0H) inFormat B, the <strong>5945</strong> validates message information or returns an ErrorCode (F8H) to the host workstation if any of the verifications fail. The<strong>5945</strong> verifies the following parameters.• Message Length is correct• 1-Byte Key ID number is between (01H) and (0AH) inclusive• Key Exchange Key is loaded• 1-Byte Input Method value is either (01H), (03H), or (09H).When the verifications pass, the <strong>5945</strong> opens the input device specifiedby the Input Method, as shown below:• (01H) = Keypad Input (This method displays actual keys as theyare pressed.)• (03H) = MSR Track 2 Input• (09H) = Keypad Input (This method displays asterisks when keysare pressed.)The <strong>5945</strong> decrypts the data entered with the Key Exchange Keyspecified by the Key ID number.The <strong>5945</strong> stores the decrypted Working Key in the location given by theKey ID number. The 1-Byte Instruction Code is ignored and the <strong>5945</strong>returns the Response Code Message (E9H).Request for Key Status - Function Code 38HFunction Code 38H - Message FormatFORMAT A [ 38H ] [ UP TO 16 BYTES SPECIFYING KEY ID]ORNUMBERSFORMAT B [ 38H ]Response Code 52H - Message Format


4-22 Chapter 4: Host/NCR 4430 Emulation InterfaceFORMAT 1 [ 52H ] [ 1-BYTE KEY #, 1-BYTE STATUS ] (Repeated forall keys)ORFORMAT 2 [ 52H ] (No Valid Key Numbers Requested)Error Code – NoneWhen the <strong>5945</strong> receives a (38H) Function Code Message using FormatA, it checks the status of the Exchange Keys and Working Keysembedded in the Function Code Message. If the Key ID Numbers arebetween (00H) and (10H) inclusive, the <strong>5945</strong> uses Format 1 to return a(52H) Response Code and data to the host workstation. The meaningof the 1-Byte Status field in the Response Code Message is given in thefollowing table.1-Byte Status Valid Keys Invalid Keys(30H) None Key Exchange Key andWorking Key(31H) Key Exchange Key Working Key(33H)Key Exchange Key andWorking KeyNoneIf Key ID Numbers are not between (00H) and (10H), the <strong>5945</strong> usesFormat 2 to return a (52H) Response Code to the host workstation.When the <strong>5945</strong> receives a (38H) Function Code Message using FormatB or if the Key ID Number is (00H), the <strong>5945</strong> checks the status of allkeys and returns this information to the host workstation. No ErrorCode is associated with the Request For Key Status command.Note: The <strong>5945</strong> supports only ten Key ID Numbers, (01H) through(0AH) inclusive. This Function Code allows Key ID Numbers (0BH)through (10H) inclusive for backward migration purposes. BUT, thestatus for Key ID Numbers (0BH) through (10H) inclusive will alwaysbe returned as 30H.


Chapter 4: Host/NCR 4430 Emulation Interface 4-23Resend Last Response - Function Code D0HFunction Code D0H - Message Format[ D0H ]Response Code RC/EC - Message Format[ PREVIOUS RESPONSE/ERROR CODE MESSAGE] [ PREVIOUS DATA ]


4-24 Chapter 4: Host/NCR 4430 Emulation InterfaceAbort - Function Code 51HError Code - NoneWhen the <strong>5945</strong> receives a (D0H) Function Code, it returns the lastmessage still present in its transmit buffer to the host workstation. Theone-byte code field can be a response or Error Code.No Error Code is associated with the Resend Last Response command.Function Code 51H - Message Format[ 51H ]Response Code EFH - Message Format[ EFH ]Error Code - NoneWhen the <strong>5945</strong> receives a (51H) Function Code, it aborts the currentfunction in progress, clears all buffers, returns an (EFH) ResponseCode to the host workstation, and displays Message 1 from DisplayTable 1, as shown below.ReadyNo Error Code is associated with the Abort command.Illogical Function Code - Error - No CommandFunction Code xxH - Message Format[ xxH ] (xx = an undefined Function Code)Response Code - NoneError Code 7AH – Message Format[ 7AH ]When the <strong>5945</strong> receives an Illogical Command (xxH) Function Code, itreturns a (7AH) Error Code to the host workstation, indicating it hasreceived a Function Code with no corresponding program in the 4430Emulation application.


Chapter 4: Host/NCR 4430 Emulation Interface 4-25No message is displayed. There is no Error Code for the IllogicalCommand Function Code.Incorrect Communications BCC - Function Code xxHFunction Code xxH - Message Format[ xxH ] BAD BCC CHARACTERResponse Code - NoneError Code FBH - Message Format[ FBH ] BAD BCC CHARACTERWhen the <strong>5945</strong> receives a Function Code Message that contains a badBCC character, it aborts the function in progress, clears all buffers andreturns the (FBH) Error Code to the host workstation. There is noResponse Code associated with the Incorrect Communications BCCFunction Code.Communications Turnaround Test - Function Code 40HFunction Code 40H - Message Format[40H ] [ 253-BYTE TEST-PATTERN (MAX) ]Response Code 6BH - Message Format[6BH ] [ 208-BYTE TEST-PATTERN (MAX) ]Error Code - NoneWhen the <strong>5945</strong> receives a (40H) Function Code, it copies the messagefrom its receiver buffer to its transmit buffer, inserts a (6BH) ResponseCode in the FC/RC field, and returns the message to the application.No message is displayed.No Error Code is associated with the Communications TurnaroundTest command.


4-26 Chapter 4: Host/NCR 4430 Emulation InterfaceSet Display Timers - Function Code 89HFunction Code 89H - Message Format[ 89H ] [ 1-BYTE TIMER A ] [ 1-BYTE TIMER B ]Response Code 8AH - Message Format[ 8AH ]Error Code - NoneWhen the <strong>5945</strong> receives a (89H) Set Display Timers Function CodeMessage, the <strong>5945</strong> saves the value of Timer A as the number of 0.25second intervals Message A is displayed and it saves the value ofTimer B as the number of 0.25 second intervals Message B isdisplayed. After values for the timers are saved, the <strong>5945</strong> returns the(8AH) Response Code Message to the host workstation.


Chapter 4: Host/NCR 4430 Emulation Interface 4-27UKPT OperationsThe <strong>5945</strong> supports VISA's Unique Key Per Transaction e<strong>ncr</strong>yptionmethod. Each UKPT message must be embedded in the DATA field ofa (15H) Function Code or Response Code Message.In UKPT messages, four bits represent one digit. Complete bytes areformed by combining consecutive fields of digits. If there is an oddnumber of digits, four zero bits are used for the lower nibble of the lastbyte to form a whole number of bytes.Definitions for digits and bytes are provided in the following table.TermDefinitionNumeric Digit 4 bits, 0000 to 1001 (0-9)Hexadecimal Digit 4 bits, 0000 to 1111 (0H to FH)Special Digit 4 bits, 1111 (FH)Alphanumeric Byte 8 bit ASCII textUKPT Request - Function Code 15HFunction Code 15H - Message Format[ 15H ] [ VISA UKPT COMMAND AND DATA ]Response Code 15H,00H - Message Format[ 15H ] [ 00H ] [ VISA UKPT RESPONSE CODE DATA ]Error Code 15H - Message Format[ 15H ] [ VISA UKPT ERROR CODE ]UKPT PIN Entry Request - Function Code 15H,70HFunction Code 15H,70H - Message Format[ 15H ] [ 70H ] [ BETWEEN 9 and 19 NUMERIC DIGITS FOR PRIMARYACCOUNT NUMBER PLUS CHECKSUM, SPECIAL DIGIT, 1 HEXADECIMAL DIGITDEBIT/CREDIT INDICATOR, 3 TO 12 NUMERIC DIGITS FOR TRANSACTIONAMOUNT, SPECIAL DIGIT ]


4-28 Chapter 4: Host/NCR 4430 Emulation InterfaceResponse Code 15H,00H,71H - Message Format[ 15H ] [ 00H ] [ 71H ] [ 1 NUMERIC DIGIT FUNCTION KEYINDICATOR (ALWAYS 0), 10 TO 20 HEXADECIMAL DIGITS FOR KEY SERIALNUMBER, 16 HEXADECIMAL DIGITS FOR ENCRYPTED PIN ]OR[ 15H ] [ 00H ] [ 71H ] (User did not enter PIN data)Error Code 15H,F4H/15H,03H/15H,02H - Message Format[ 15H ] [ F4H ]OR[ 15H ] [ 03H ] (No UKPT Key Loaded)OR[ 15H ] [ 02H ] (One million transactions processed)This command permits the user to PASS when entering a PIN. Whenthe <strong>5945</strong> receives a (15H,70H) Function Code, it checks for a validUKPT key. If no UKPT Key is loaded, the <strong>5945</strong> returns an Error Code(15H,03H) to the host workstation.The <strong>5945</strong> then checks the number of transactions. If one milliontransactions have been processed and the UKPT key has not beenreinitialized, the <strong>5945</strong> returns an Error Code (15H,02H) to the hostworkstation.The next verification is data field lengths. If any field lengths areinvalid, the <strong>5945</strong> returns an Error Code (15H,F4H) to the host. If fieldlengths are valid, the <strong>5945</strong> opens the keypad for numeric input anddisplays Message 6 from Table 1, as shown below.Please Enter PINWhen a valid numeric key is pressed, the <strong>5945</strong> displays an asterisk andactuates a key click tonePress the CLEAR key to delete the previous key entries.If less than 4 PIN digits are entered the <strong>5945</strong> sounds an error tone andrestarts PIN entry. The <strong>5945</strong> does not accept PINs of more than 12digits, an error tone is sounded when trying to enter a 13 thPIN digit.


Chapter 4: Host/NCR 4430 Emulation Interface 4-29If the CANCEL key is pressed anytime during PIN entry, the <strong>5945</strong>returns a (15H,00H,71H) Response Code Message to the hostworkstation indicating the PIN entry has been optionally PASSED anddisplays Message 3 from Table 1, as shown below.Please WaitAfter valid data has been entered and the Enter key has been pressed,the PIN is stored and the <strong>5945</strong> constructs the PIN block and displaysMessage 3 from Table 1, as shown below.Please WaitThe Primary Account Number Block is constructed and Exclusive-ORed with the PIN block. The resulting block of data is e<strong>ncr</strong>yptedwith the UKPT Key. The <strong>5945</strong> uses the (15H,00H,71H) Response CodeMessage format to send this e<strong>ncr</strong>ypted data and other transaction datato the host.UKPT PIN Entry Cancel - Function Code 15H,72HFunction Code 15H,72H - Message Format[ 15H ] [ 72H ]Response Code 15H,00H - Message Format[ 15H ] [ 00H ]Error Code - NoneWhen the <strong>5945</strong> receives a (15H,72H) Function Code Message, the <strong>5945</strong>aborts the current PIN entry and erases any PIN related data. Whenthe <strong>5945</strong> is ready for the next Function Code Message, it sends the(15H,00H) Response Code Message to the host workstation.UKPT PIN Entry Test Request - Function Code 15H,76HFunction Code 15H,76H - Message Format[ 15H ] [ 76H ] [BETWEEN 9 and 19 NUMERIC DIGITS FOR PRIMARYACCOUNT NUMBER PLUS CHECKSUM, SPECIAL DIGIT, 1 HEXADECIMAL DIGIT


4-30 Chapter 4: Host/NCR 4430 Emulation InterfaceDEBIT/CREDIT INDICATOR, 3 TO 12 NUMERIC DIGITS FOR TRANSACTIONAMOUNT, SPECIAL DIGIT ]Response Code 15H,00H,71H - Message Format[ 15H ] [ 00H ] [ 71H ] [ 1 NUMERIC DIGIT FUNCTION KEYINDICATOR (ALWAYS 0), 10 TO 20 HEXADECIMAL DIGITS FOR KEY SERIALNUMBER, 16 HEXADECIMAL DIGITS FOR ENCRYPTED PIN ]OR[ 15H ] [ 00H ] [ 71H ] (User did not enter PIN data)Error Code 15H,F4H/15H,03H/15H,02H - Message Format[ 15H ] [ F4H ][ 15H ] [ 03H ] (Illogical)OR[ 15H ] [ 02H ] (One million transactions processed)When the <strong>5945</strong> receives a (15H,76H) Function Code, it checks for avalid UKPT key. If no UKPT Key is loaded, the <strong>5945</strong> returns an ErrorCode (15H,03H) to the host workstation.The <strong>5945</strong> then checks the number of transactions. If one milliontransactions have been processed and the UKPT key has not beenreinitialized, the <strong>5945</strong> returns an Error Code (15H,02H) to the hostworkstation.The next verification is data field lengths. If any field lengths areinvalid, the <strong>5945</strong> returns and Error Code (15H,F4H) to the host.The <strong>5945</strong> uses an une<strong>ncr</strong>ypted PIN of "1234" for this test. This PIN isstored and the <strong>5945</strong> constructs the PIN block and displays Message 3from Table 1, as shown below.Please WaitThe Primary Account Number Block is constructed and Exclusive-ORed with the PIN block. The resulting block of data is e<strong>ncr</strong>yptedwith the UKPT Key. The <strong>5945</strong> uses the (15H,00H,71H) Response CodeMessage format to send this e<strong>ncr</strong>ypted data and other transaction datato the host.


Chapter 4: Host/NCR 4430 Emulation Interface 4-31UKPT Cardholder <strong>Data</strong> Entry Request - Function Code 15H,80HFunction Code 15H,80H - Message Format[ 15H ] [ 80H ]Response Code 15H,00H,81H - Message Format[ 15H ] [ 00H ] [ 81H ] [ 1 ALPHANUMERIC BYTE MSR INDICATOR,UP TO 76 ALPHANUMERIC BYTES OF TRACK 1 DATA ]OR[ 15H ] [ 00H ] [ 81H ] [ 1 ALPHANUMERIC BYTE MSR INDICATOR,UP TO 37 NUMERIC DIGITS OF TRACK 2 DATA ]OR[ 15H ] [ 00H ] [ 81H ] [BETWEEN 9 and 19 NUMERIC DIGITS FORPRIMARY ACCOUNT NUMBER PLUS CHECKSUM, SPECIAL DIGIT, 4 NUMERICDIGITS FOR EXPIRATION DATE ]Error Code - None


4-32 Chapter 4: Host/NCR 4430 Emulation InterfaceWhen the <strong>5945</strong> receives a (15H,80H) Function Code Message, the <strong>5945</strong>displays Message 2 from Table 1, as shown below, and attempts to readmagnetic card data.Please Pass CardThrough SlotIf data from both tracks (Track 1 and Track 2) is read successfully, datafrom Track 1 is returned to the host workstation. If data from one track(Track 1 or Track 2) is read successfully, data from that track isreturned to the host workstation.The Alphanumeric Byte MSR Indicator is returned in the ResponseCode Message format. Values for this indicator are shown in thefollowing table.MSR Indicator Value(20H)(40H)(43H)(44H)(45H)DefinitionMagnetic stripe read successfulUnknown or reading not attemptedOne of the magnetic stripes was notencoded on the cardIncorrect parity or LRC on cardIncorrect data format on cardAfter three unsuccessful read attempts, the <strong>5945</strong> opens the keypad forAccount Number entry and displays Message 4 from Display Table 2,as shown below.Enter Acct #:The LCD shows keys when they are pressed and up to 19 digits arepermitted. After Account Number entry is complete, the <strong>5945</strong> opensthe keypad for Expiration Date entry and displays Message 5 fromDisplay Table 2, as shown below.Enter Exp. DateMM/YYThe <strong>5945</strong> returns entered data to the host workstation.


Chapter 4: Host/NCR 4430 Emulation Interface 4-33UKPT Cancel and Display Request - Function Code 15H,82HFunction Code 15H,82H - Message Format[ 15H ] [ 82H ] [ 16 BYTE ALPHANUMERIC DISPLAY MESSAGE ]Response Code 15H,00H - Message Format[ 15H ] [ 00H ]Error Code - NoneWhen the <strong>5945</strong> receives a (15H,82H) Function Code Message, the <strong>5945</strong>blanks the LCD and displays the text embedded in the Function CodeMessage. The <strong>5945</strong> displays this 16 byte alphanumeric text on the topline of the LCD.Messages with less than 16 bytes of text are spaced filled to 16 bytes.Messages more than 16 bytes of text are truncated to 16 bytes. The(15H,00H) Response Code Message is sent when the <strong>5945</strong> is ready forthe next Function Code Message.


4-34 Chapter 4: Host/NCR 4430 Emulation InterfaceBuffering OperationsWhen the <strong>5945</strong> receives a valid Begin Buffered Input command, itcollects the requested data. Buffering commands are detailed on thefollowing pages.Begin Buffered Input - Function Code 70HFunction Code 70H - Message Format[ 70H ] [ 1-BYTE INPUT ] [ 1-BYTE MSR TRACKS ][ 1-BYTE MSR RETRIES ] [ 58H ] [ 58H ] [ 58H ][ 58H ] [ 58H ]Response Code FEH - Message Format[ FEH ]Error Code 7FH - Message Format[ 7FH ]When the <strong>5945</strong> receives a (70H) Function Code Message, the <strong>5945</strong>verifies the data fields embedded in the message. If an invalid numberis found, the <strong>5945</strong> returns a (7FH) Error Code Message to the hostworkstation.


Chapter 4: Host/NCR 4430 Emulation Interface 4-35If the field data is valid, the <strong>5945</strong> begins buffering items requested bythe 1-Byte Input Field. Valid field values are shown in the followingtable.Field1-Byte Input FieldMeaning(01H) – Buffer MSR Card <strong>Data</strong>(02H) – Buffer MSR Card <strong>Data</strong> and MandatoryPIN(03H) – Buffer MSR Card <strong>Data</strong>, Mandatory PIN,and Account Type(04H) – Buffer MSR Card <strong>Data</strong> and OptionalPIN(05H) – Buffer MSR Card <strong>Data</strong>, Optional PINand Account Type1-Byte MSR Tracks (01H) – Track 1 only(02H) – Track 2 only(03H) – Tracks 1 and 21-Byte MSR Retries (05H) – Maximum number of MSR retriesAll the Input Field values request MSR card data to be buffered. The<strong>5945</strong> opens the magnetic stripe reader for reading, waits for a card tobe swiped, and displays Message 2 from Table 1, as shown below.Please Pass CardThrough SlotAfter the card is swiped, the <strong>5945</strong> reads the track data requested in theMSR Tracks Field, and strips the start sentinel, the end sentinel, theLRC check character, and the character level parity bits from themagnetic stripe data.If an error occurred on the track reads and the error retry countindicated in the MSR Retries Field has not expired, the <strong>5945</strong> ignores theprevious read data, and displays Message 4 from Table 1 as shownbelow. The reader remains open for a retry.


4-36 Chapter 4: Host/NCR 4430 Emulation InterfaceError Pass CardThru Slot AgainAfter either a successful swipe is completed or the error retry count hasexpired, the <strong>5945</strong> buffers the MSR data/statuses.If the Input Field value was (01H – MSR card data only), the <strong>5945</strong>displays Message 3 from Table 1 and the function code is complete, asshown below.Please WaitIf the Input Field value requires PIN buffering, the <strong>5945</strong> displaysMessage 6 from Table 1, as shown below.Please Enter PINWhen a valid numeric key is pressed, the <strong>5945</strong> displays an asterisk, andactuates a key click tone.Press the CLEAR key to delete PIN digits during input.If less than 4 PIN digits are entered the <strong>5945</strong> sounds an error tone andrestarts PIN entry. The <strong>5945</strong> does not accept PINs of more than 12digits, an error tone is sounded when trying to enter a 13 th PIN digit.If the Input Field value requires a Mandatory PIN (02H or 03H) entryand the CANCEL key is pressed anytime during PIN entry, the <strong>5945</strong>ignores previously entered PIN digits and redisplays Message 2 fromTable 1 allowing for a new card swipe, as shown below.Please Pass CardThrough SlotIf the Input Field value asks for an Optional PIN (04H or 05H) entryand the CANCEL key is pressed anytime during PIN entry, the <strong>5945</strong>buffers that the PIN entry has been optionally PASSED. The <strong>5945</strong> thendisplays either Message 3 from Table 1 if no Account Type is required,as shown below


Chapter 4: Host/NCR 4430 Emulation Interface 4-37Please Waitor Message 1 from Table 2 if the Account Type is required, as shownbelow.SelectCredit or DebitΝοτε: At this point in the Optional PIN Input values (04H and 05H),pressing the CANCEL key causes the <strong>5945</strong> to ignore any previouslyentered PIN data and return back to the MSR card swipe promptallowing for a new card swipe.For Input Field values (02H, 03H, 04H 05H), after valid PIN data hasbeen entered and the Enter key has been pressed, the PIN is buffered.The <strong>5945</strong> then displays either Message 3 from Table 1 if no AccountType is required (indicating the function is complete), as shown belowPlease Waitor Message 1 from Table 2 if the Account Type is required, as shownbelow.SelectCredit or DebitAfter the Account Type is entered, the <strong>5945</strong> buffers the Account Typeinformation and displays Message 3 from Table 1 indicating thefunction is complete, as shown below.Please WaitReset Buffered <strong>Data</strong> - Function Code F1HFunction Code F1H - Message Format[ F1H ]Response Code FEH - Message Format[ FEH ]


4-38 Chapter 4: Host/NCR 4430 Emulation InterfaceError Code - NoneWhen the <strong>5945</strong> receives a (F1H) Function Code Message, the <strong>5945</strong>aborts any buffering operations that in progress, clears all buffereddata, and displays Message 1 from Display Table 1, as shown below.ReadyRead Buffered MSR <strong>Data</strong> - Function Code F2HFunction Code F2H - Message Format[ F2H ] [ 1-BYTE MSR TRACKS ]Response CodeFEH/61H/F1H/62H/F2H/(61H/62H/73H)/(61H/F2H/73H)/(F1H/62H/73H)/(F1H/F2H/73H)- Message Format[ FEH ] (No data is buffered)ORIF MSR TRACKS = (01H):[ 61H ] [ UP TO 79 BYTES OF TRACK 1 DATA ]OR[ F1H ] (Track 1 read failed)IF MSR TRACKS = (02H):[ 62H ] [ UP TO 40 BYTES OF TRACK 2 DATA ]OR[ F2H ] (Track 2 read failed)IF MSR TRACKS = (03H):[ 61H ] [ UP TO 79 BYTES OF TRACK 1 DATA ] [62H ][ UP TO 40 BYTES OF TRACK 2 DATA ] [ 73H ]OR


Chapter 4: Host/NCR 4430 Emulation Interface 4-39[ F1H ] [ 62H ] [ UP TO 40 BYTES OF TRACK 2 DATA ][ 73H ] (Track 1 read failed)OR[ 61H ] [ UP TO 79 BYTES OF TRACK 1 DATA ] [ F2H ] [ 73H ](Track 2 read failed)OR[ F1H ] [ F2H ] [ 73H ] (Track 1 & 2 read failed)Error Code 7FH - Message Format[ 7FH ]When the <strong>5945</strong> receives a (F2H) Function Code Message, the <strong>5945</strong>verifies the value of the 1-Byte MSR Tracks field. This field determineswhich MSR tracks the <strong>5945</strong> will read. Valid choices for this field areshown below.• (01H) - Track 1 only• (02H) - Track 2 only• (03H) - Tracks 1 and 2If the 1-Byte MSR Tracks field is invalid, the <strong>5945</strong> returns a (7FH) ErrorCode Message. If the 1-Byte MSR Tracks field is valid, the <strong>5945</strong> returnsthe appropriate Response Code Message and requested MSR data.Read Buffered Standard Format PIN - Function Code 73HFunction Code 73H - Message Format[ 73H ] [ 1-BYTE KEY ID# ] [ 1-BYTE FILL CHARACTER ][ 12-BYTE ASCII ACCOUNT NUMBER ]OR[ 73H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ]Response Code FEH/64H/E3H - Message Format[ FEH ] (No data is buffered)OR[ 64H ] [ 8-BYTE ENCRYPTED PIN ]OR[ E3H ] (Customer did not enter PIN)


4-40 Chapter 4: Host/NCR 4430 Emulation InterfaceError Code F4H/7AH - Message Format[ F4H ]OR[ 7AH ] (ILLOGICAL, no Working Keys loaded)When the <strong>5945</strong> receives a (73H) Function Code, it checks for validWorking Keys. If no Working Keys are loaded, the <strong>5945</strong> returns anIllogical Response Code (7AH) to the host workstation.The <strong>5945</strong> then evaluates the Key ID number. If the Key ID number isn'ta value between (01H) and (0AH) inclusive, the <strong>5945</strong> returns an ErrorCode (7AH) to the host workstation. If the Key ID number is valid, the<strong>5945</strong> verifies that the Working Key is also valid. If the Working Key isnot valid, the <strong>5945</strong> returns an Error Code (7AH) to the host.The <strong>5945</strong> then verifies the presence and length of the 12-byte ASCIIAccount Number. If the length is incorrect, the <strong>5945</strong> returns an ErrorCode (F4H) to the host workstation.If the account number is valid, the <strong>5945</strong> checks for buffered PIN data.If the CANCEL key was entered during the optional buffered PINinput, the <strong>5945</strong> returns a (E3H) Response Code Message to the hostworkstation.If a valid buffered PIN is present, the <strong>5945</strong> constructs the standard PINblock.• All unused positions (less than 12 positions) to the right of the PINare filled with the programmable one-byte fill character (FH is thedefault).• The PIN block is then Exclusive-ORed to the account number, andthe result is e<strong>ncr</strong>ypted with the specified Working Key and sent tothe host in (64H) Response Code format.Read Buffered Alternate Format PIN - Function Code 08HFunction Code 08H - Message Format[ 08H ] [ 1-BYTE KEY ID# ] [ 1-BYTE FILL CHARACTER ][ 12-BYTE ASCII ACCOUNT NUMBER ]OR


Chapter 4: Host/NCR 4430 Emulation Interface 4-41[ 08H ] [ 1-BYTE KEY ID ] [ 1-BYTE HEX FILL CHARACTER ]Response Code FEH/64H/E3H - Message Format[ FEH ] (No data is buffered)OR[ 64H ] [ 8-BYTE ENCRYPTED PIN ]OR[ E3H ] (Customer did not enter PIN)Error Code F4H/7AH - Message Format[ F4H ]OR[ 7AH ] (ILLOGICAL, no Working Keys loaded)When the <strong>5945</strong> receives a (08H) Function Code, it checks for validWorking Keys. If no Working Keys are loaded, the <strong>5945</strong> returns anIllogical Response Code (7AH) to the host workstation.The <strong>5945</strong> then evaluates the Key ID number. If the Key ID number isn'ta value between (01H) and (0AH) inclusive, the <strong>5945</strong> returns an ErrorCode (7AH) to the host workstation. If the Key ID number is valid, the<strong>5945</strong> verifies that the Working Key is also valid. If the Working Key isnot valid, the <strong>5945</strong> returns an Error Code (7AH) to the host.The <strong>5945</strong> then verifies the presence and length of the 12-byte ASCIIAccount Number. If the length is incorrect, the <strong>5945</strong> returns an ErrorCode (F4H) to the host workstation.If the account number is valid, the <strong>5945</strong> checks for buffered PIN data.If the CANCEL key was entered during the optional buffered PINinput, the <strong>5945</strong> returns a (E3H) Response Code Message to the hostworkstation.If a valid buffered PIN is present, the <strong>5945</strong> constructs the alternate PINblock.• All unused positions (less than 12 positions) to the right of the PINare filled with the programmable one-byte fill character (FH is thedefault).


4-42 Chapter 4: Host/NCR 4430 Emulation Interface• The PIN block is then Exclusive-ORed to the account number, andthe result is e<strong>ncr</strong>ypted with the specified Working Key and sent tothe host in (64H) Response Code format.Read Buffered Special Function Keypad Input - Function Code75HFunction Code 75H - Message Format[ 75H ]Response Code FEH/D3H - Message Format[ FEH ] (No data is buffered)OR[ D3H ] [ 1-BYTE STATUS ]Error Code - NoneWhen the <strong>5945</strong> receives a (75H) Function Code Message, the <strong>5945</strong>returns a Response Code Message to the host workstation. If no specialfunction key data is buffered, the <strong>5945</strong> returns a (FEH) Response CodeMessage to the host workstation.If special function key data is buffered, the <strong>5945</strong> returns a (D3H)Response Code and a 1-byte status field. Status field definitions areshown in the following table.1-Byte Status Value(23H)(2AH)Key Depression BufferedF5 – <strong>5945</strong> Yes Key (Credit)F6 – <strong>5945</strong> No Key (Debit)


Chapter 4: Host/NCR 4430 Emulation Interface 4-43Level 0 DiagnosticsLevel 0 Diagnostics Test - Function Code C2HFunction Code C2H - Message Format[ C2H ]Response Code 7CH/FDH/7FH/6EH - Message Formats:[ 7CH ] [ F/W REV ] [ DISP ] [ ENCRYPT ] ROM ERROROR[ FDH ] [ F/W REV ] [ DISP ] [ ENCRYPT ] RAM ERROROR[ 7FH ] [ F/W REV ] [ DISP ] [ ENCRYPT ] TABLE ERROROR[ 6EH ] [ F/W REV ] [ DISP ] [ ENCRYPT ] NO ERRORWhen the <strong>5945</strong> receives a (C2H) Function Code, it enters Level 0Diagnostics, and performs a ROM Checksum Test, a non-destructiveRAM Pattern Test, and a display Table Checksum Test:ROM Checksum Test: If a checksum error occurs, a (7CH) ResponseCode is returned to the application, and the <strong>5945</strong> displays Message 13:ErrorRom ChecksumIf no error occurred, the next test is run.Display Table Checksum Test: If a checksum error occurs, a (7FH)Error Code is returned to the application, and the <strong>5945</strong> displaysMessage 16:ErrorTable ChecksumNo Level 0 Diagnostics Errors: If no errors have occurred, a (6EH)Response Code is returned to the application, and the <strong>5945</strong> displaysMessage 1:


4-44 Chapter 4: Host/NCR 4430 Emulation InterfaceReadyResponse Code Message <strong>Data</strong> FieldsThe Response Code Message data fields "FW/REV", "DISPLAY", and"ENCRYPTION" contain the following configuration information of the<strong>5945</strong> under test.• The FW/REV field contains the ASCII value for the Level of thefirmware release: ASCII "0" (30H) to "9" (39H).• The DISPLAY field contains an ASCII value for the display present:ASCII "0" (30H) for the LED, and ASCII "1" (31H) for the LCDdisplays.• The ENCRYPTION field contains an ASCII value to indicatewhether or not e<strong>ncr</strong>yption keys are installed. These ASCII valuesare shown below.• ASCII "0" (30H) for Not Installed• ASCII "1" (31H) for Working Keys only• ASCII "2" (32H) for UKPT Key only• ASCII "3" (33H) for UKPT and Working Keys installedNon-supported NCR 4430 Emulation FunctionsSome functions of the 4430 Emulation application are not supported bythe NCR <strong>5945</strong> due to hardware and security restraints. These functionshave been DISABLED on the <strong>5945</strong>. To support backward migration forthe NCR 5944 users, if any of the following Function Codes are sent tothe <strong>5945</strong> an Error Code 7AH (Illogical) is always returned.E<strong>ncr</strong>ypt <strong>Data</strong> – Function Code 01HDecrypt <strong>Data</strong> – Function Code 02HRemote PIN Display – Function Code 04HInitiate Load – KEK – Function Code 31HInitiate/Continue Load – KEK – Function Code 37H


Chapter 4: Host/NCR 4430 Emulation Interface 4-45Initiate Load – Key Exchange Key (no KEK Parity) – Function Code86HInitiate/Continue Load – Key Exchange Key (no KEK Parity) –Function Code 07HMAC Generation – Function Code 32HMAC Send/Clear – Function Code B3HUKPT Load Initial Key Request – Function Code 15H,90HUKPT Reinitialize UKPT Key – Function Code 15H,92H


4-46 Chapter 4: Host/NCR 4430 Emulation Interface


5-1Chapter 5: Using the <strong>5945</strong>LD UtilityThe loader utility performs the following functions:• Downloads load files to the <strong>5945</strong>, using EIA-232-D• Loads e<strong>ncr</strong>yption keys (Working Keys only) into the <strong>5945</strong>Note: This utility cannot be used to load Key Exchange Keys orDUKPT keys into the NCR <strong>5945</strong> due to security enhancements. Theutility includes these functions for 5944 compatibility.Installing the <strong>5945</strong>LD Software1. Make a backup copy of the <strong>5945</strong>LD software diskette.2. Create a <strong>5945</strong>LD directory (C:\<strong>5945</strong>LD, for example) on your harddrive.3. Copy the following files from the diskette to the above directory:<strong>5945</strong>LD.EXE (the loader executable) <strong>5945</strong>LD.CFG (the loaderconfiguration file) <strong>5945</strong>LD.TXT (a text version of this chapter, plusany last minute information)4. Make the <strong>5945</strong>LD directory your current directory.Using <strong>5945</strong>LD from the Command LineThree <strong>5945</strong>LD functions can be performed from the DOS prompt,terminating when execution is complete. The syntax for the commandsthat invoke each of these functions is shown below.Supplying the Password on the Command Line<strong>5945</strong>LD [password]


5-2 Chapter 5: Using the <strong>5945</strong>LD UtilityBuilding an Application Load File from a HEX file<strong>5945</strong>LD [password] -ha Downloading a Load File<strong>5945</strong>LD [password] -l Using <strong>5945</strong>LD from the Main MenuTo use <strong>5945</strong>LD.EXE from its Main Menu, simply enter the followingcommand at the command line and follow the prompts:<strong>5945</strong>LDConfigurationThe <strong>5945</strong>LD.EXE menus let you define the following parameters,which are maintained in <strong>5945</strong>LD.CFG.Communications Port SettingsSets the parameters of the EIA-232-D port on the developer's PC towhich the <strong>5945</strong> is attached. As each selection is made from the menu,the new port configuration displays at the top of the menu.Key Test ParametersDefines the parameters used for testing e<strong>ncr</strong>yption keys that are loadedinto the <strong>5945</strong>: Key ID, Fill character, PAN, and PIN.Key Loading ParametersYou cannot load DUKPT or KEK into the <strong>5945</strong> using this utility.Allows you to select the key load method and other parameters.Note: The <strong>5945</strong> OS must be loaded before keys can be loaded. Then,load keys from either the setup menu or the OS idle loop.The available key loading selections are:• Use hex keypad for all parts (load all keys via the <strong>5945</strong> keypad)• Use MSR for all parts (load all keys via the <strong>5945</strong> MSR)


Chapter 5: Using the <strong>5945</strong>LD Utility 5-3• Use comm port for all parts (load all keys via the <strong>5945</strong> HOST port)• Use comm port for first part, then hex keypad (load the first part ofeach key via the <strong>5945</strong> serial port & the remaining parts via the <strong>5945</strong>keypad. Single part keys (working key) are loaded completely viathe serial port.)• Use comm port for first part, then MSR (load the first part of eachkey via the <strong>5945</strong> serial port & the remaining parts via the <strong>5945</strong> MSR.Single part keys (working key) are loaded completely via the serialport.)• Do not check key for odd parity (disable <strong>5945</strong> key parity checking)• Check key for odd parity (enable <strong>5945</strong> key parity checking.)• Echo keys during entry/Do not echo keys during entry (When keyecho is disabled, <strong>5945</strong>LD and the <strong>5945</strong> display asterisks as you enterthe keys; otherwise, they display the keys in the clear.)Setting Up or Changing Your PasswordDownloading the KeysThe <strong>5945</strong>LD password is stored in <strong>5945</strong>LD.CFG. You always need apassword to run <strong>5945</strong>LD, but you can change the password as often asyou wish. To set up your password the first time, or to change it at anytime later, select Change Password and follow the prompts.The default password is simply a carriage return, which you can useunchanged if you wish. If you select a different password, and cannotremember it, you must run <strong>5945</strong>CFG.EXE and start over with thedefault password.<strong>5945</strong>LD can download keys using either the KEK/WK format or theVISA UKPT format. To load e<strong>ncr</strong>yption keys into the <strong>5945</strong>, selectDownload the Keys from the Main Menu.Key definitionThe available Key Definition selections are:


5-4 Chapter 5: Using the <strong>5945</strong>LD Utility• KEKs (single or multipart) (NOT AVAILABLE ON <strong>5945</strong>)• Working keys• UKPT key and serial number (NOT AVAILABLE ON <strong>5945</strong>)• Save keys to disk (The loader prompts you for a password, which ituses to DES e<strong>ncr</strong>ypt the key file. Use any file name; however, theloader forces all file name extensions to .key. You cannot saveUKPT/serial numbers to disk.• Read keys from disk (You must know the key file password; see"Save keys to disk" above for details.• Purge keys (deletes any keys presently in the loader)You can enter either KEK/working keys or VISA UKPT/serial number,but not both. If you enter a KEK/working key and then try to enter aVISA UKPT, the KEK is destroyed, and vice versa.All keys are 16 digits and all serial numbers are 20 digits. You canenter up to five partial KEKs with a given working key, and you canenter up to 16 KEK/working key sets. The loader displays the currentloaded key status at the bottom of the screen. As you enter each KEKor working key, the loader displays the cumulative checksum for thatkey. You can use this checksum to make sure you have entered the keycorrectly,Load UKPT Key or KEKs into <strong>5945</strong>Load either the UKPT or KEK into the <strong>5945</strong> using whatever methodyou selected in the Key Loading Parameters Configuration menu.Load Working KeyLoad the working key into the <strong>5945</strong> using the method you selectedfrom the key loading parameters configuration menu.


Chapter 5: Using the <strong>5945</strong>LD Utility 5-5Creating a Load FileTest Loaded KeysTo test a KEK and working key pair that has been loaded into a <strong>5945</strong>,select Test Loaded Keys from the Download Keys to <strong>5945</strong> menu. Thissends to the <strong>5945</strong> a message containing the test parameters set by theKey Test Parameters selection on the Configuration Menu. The <strong>5945</strong>responds to this message by e<strong>ncr</strong>ypting the PIN using the otherparameters and returning an e<strong>ncr</strong>ypted PIN block. This response isdisplayed in hexadecimal, and can be compared against a knowncorrect response; if the response is not correct, incorrect keys wereloaded into the <strong>5945</strong>.This is not supported on the <strong>5945</strong>. Load file creation for the <strong>5945</strong> isdescribed in chapter 2 of this <strong>doc</strong>ument.Load files contain the messages sent to the <strong>5945</strong> to load an application.To create a load file select Create a Load File from the Main Menu andfollow the prompts.Application Load FileDownloading Load FilesCreates a load file containing the application program that runs in the<strong>5945</strong>.Select Download a Load File from the Main Menu and follow thedisplayed prompts.


5-6 Chapter 5: Using the <strong>5945</strong>LD Utility


5-7Index—A—Abort - Function Code 51H, 4-24ANSI C Library Functions, 3-16Application Programming Functions, 4-1—B—Beeper Programming, 3-11_tone(), 3-12Begin Buffered Input - Function Code 70H,4-35Buffering Operations, 4-35Building an Application Load File from aHEX file, 5-2—C—Clock Programming, 3-12Communications Turnaround Test -Function Code 40H, 4-25Creating a Load File, 5-5—D—Developer’s Kit, 1-5Developing a <strong>5945</strong> Application, 3-4Display Library Functions, 3-16_clearscreen(), 3-16_getactivepage(), 3-17_getvisualpage(), 3-17_outtext(), 3-18_setactivepage(), 3-18_settextposition(), 3-19_setvisualpage(), 3-19Display Programming, 3-15Downloading a Load File, 5-2Downloading Load Files, 5-5Downloading the Keys, 5-4—I—Illogical Function Code - Error - NoCommand, 4-24Incorrect Communications BCC - FunctionCode xxH, 4-25Initiate Load - E<strong>ncr</strong>ypted Working Key -Function Code B0H, 4-20Input PIN Using Alternate PIN Block -Function Code 85H, 4-11Input PIN Using Standard PIN Block -Function Code 20H, 4-7Input/Output Devices, 3-3I/O Ports, 3-4Integrated user interface, 3-3Installing the <strong>5945</strong>LD Software, 5-1—K—Key Management Programming, 3-21Key Management Specific C LibraryFunctions, 3-23_decrypt(), 3-23_e<strong>ncr</strong>ypt(), 3-23_key_stat(), 3-23_load_working_key(), 3-24


_mac_clear(), 3-25_mac_gen(), 3-25_pin_enable(), 3-25_pin_enable_b(), 3-27_pin_get(), 3-28_pin_get_b(), 3-29_pin_status(), 3-30_secure_abort(), 3-31_ukpt_status(), 3-31_upin_enable(), 3-32Key Managment Specific C LibraryFunctions_upin_test(), 3-33Keypad Programming, 3-34ANSI C library functions, 3-35ASCII Keycodes, 3-35Keypad Programming Microsoft C LibraryFunctions, 3-36getch(), 3-36getche(), 3-36kbhit(), 3-38Keypad Programming Specific C LibraryFunctions, 3-38_disablekeyboard(), 3-38_enablekeyboard(), 3-38_getkeyclick(), 3-40_getkeymask(), 3-40_initkeyboard(), 3-41_setkeymask(), 3-42—L—Level 0 Diagnostics, 4-44Load UKPT Key or KEKs into <strong>5945</strong>, 5-4Load Working Key, 5-5Loading the <strong>5945</strong>, 3-10Corrupted application or OS at powerup,3-10Manual intervention, 3-11OS/Application replacement, 3-10—M—Magnetic Stripe Reader (MSR)Programming, 3-43Microsoft C Library <strong>Data</strong> Structures, 3-12typedef struct dosdate_t, 3-12typedef struct dostime_t, 3-13Microsoft C Library Functions, 3-13_dos_getdate(), 3-13_dos_gettime(), 3-13_dos_setdate(), 3-14_dos_settime(), 3-14MSR Specific C Library Functions, 3-43_cardswiped(), 3-44_disablemsr(), 3-44_enablemsr(), 3-45_getmsrtone(), 3-45_readmsr(), 3-46_setmsrformat(), 3-47_setmsrtone(), 3-47Multiple Display Message Load - FunctionCode 0BH, 4-18—N—NCR <strong>5945</strong> Character Pattern, 1-4NCR <strong>5945</strong> Developer’s Guide, 1-5NCR <strong>5945</strong> Features, 1-2Hardware features, 1-2Software features, 1-3NCR <strong>5945</strong> Specific C Library Functions, 3-20_scrolltext(), 3-20_setftable(), 3-21_stopscroll(), 3-20NCR <strong>5945</strong> User’s Guide, 1-5


Index-9Non-supported NCR 4430 EmulationFunctions, 4-45—O—Optional PIN Entry Using Standard PINBlock - Function Coe 0EH, 4-9OS/Application Load File Format, 3-8<strong>5945</strong> response statuses, 3-9Aborting a load in process, 3-9—P—PIN Block, 3-21Alternate (Diebold Style), 3-21Standard, 3-21Porting a 5944 Application, 2-1Required modifications, 2-1Programming, 3-1FLASH Resident application, 3-2FLASH Resident operating system, 3-2Security module, 3-2Security module routines, 3-3Software architecture, 3-1—R—Read All Tracks - Function Code 10H, 4-3Read Buffered Alternate Format PIN -Function Code 08H, 4-41Read Buffered MSR <strong>Data</strong> - Function CodeF2H, 4-39Read Buffered Special Function KeypadInput - Function Code 75H, 4-43Read Buffered Standard Format PIN -Function Code 73H, 4-40Read Track 1 - Function Code 91H, 4-5Read Track 2 - Function Code 92H, 4-6Remote Display Table 1 Load - FunctionCode A4H, 4-16Remote Display Table 1 Read - FunctionCode 25H, 4-19Remote Display Table 2 Load - FunctionCode 76H, 4-17Remote Display Table 2 Read - FunctionCode 79H, 4-19Remote Display Write - Function Code23H, 4-16Request for Key Status - Function Code38H, 4-22Resend Last Response - Function CodeD0H, 4-23Reset Buffered <strong>Data</strong> - Function Code F1H,4-38Reset Device (Function Code 09h), 3-11Message formats, 3-11—S—Serial I/O Programming, 3-48EIA 232 aux ports, 3-49Host Port, 3-48Serial I/O Specific C Library Functions, 3-50_closeaux1(), 3-51_closehcom(); _closeaux2(), 3-51_disableaux2(), _disableaux3(), 3-53_enableaux2(), _enableaux3(), 3-51_getstathcom(), _getstataux1(),_getstataux2(), _getstataux3(), 3-53_openaux1(), 3-53_openhcome(), _openaux2(),_openaux3(), 3-54_readaux1(), 3-55_readhcom(), _readaux2(), _readaux3(),3-55_setctrlhcom(), _setctrlaux2(),_setctrlaux3(), 3-56_writeaux1(), 3-56


_writehcome(), _writeaux2(),_writeaux3(), 3-56Set Display Timers - Function Code 89H, 4-27Setting Up or Changing Your Password, 5-3Special Function Keypad Input – FunctionCode 83H, 4-2Supplying the Password on the CommandLine, 5-2—T—Test Loaded Keys, 5-5Timer Programming, 3-58_canceltimer(), 3-58_delay(), 3-58_gettimerstat(), 3-58_inittimer(), 3-59_settimer(), 3-59—U—UKPT Cancel and Display Request -Function Code 15H,82H, 4-34UKPT Cardholder <strong>Data</strong> Entry Request -Function C, 4-32UKPT Operations, 4-28UKPT PIN Entry Cancel - Function Code15H,72H, 4-30UKPT PIN Entry Request - Function Code15H,70H, 4-28UKPT PIN Entry Test Request - FunctionCode 15H,76H, 4-31UKPT Request - Function Code 15H, 4-28Using <strong>5945</strong>LD from the Command Line, 5-1Using <strong>5945</strong>LD from the Main Menu, 5-2—V—VLI vs. Raw Mode, 3-9


CutPlease answer the questions and mail the form.READER COMMENTSHow do you rate the technical accuracy of this <strong>doc</strong>ument?1 2 3 4 5How do you rate the organization of this <strong>doc</strong>ument?1 2 3 4 5How easy is it for you to locate specific information in this <strong>doc</strong>ument?Very Difficult1 2 3 4 5Very EasyHow well did this <strong>doc</strong>ument help you perform your job?Not Well1 2 3 4 5Extremely WellAdditional comments - use space below or back of form as necessary.If we may contact you concerning your comments, please provide the following.NameAddressPhoneFaxE-MailFoldB005-0000-1105Issue ANO POSTAGENECESSARYIF MAILEDIN THEUNITED STATESCutBUSINESS REPLY MAILFIRST CLASS MAIL PERMIT NO. 3 DAYTON, OHPOSTAGE WILL BE PAID BY ADDRESSEENCR CorporationInformation Products2651 Satellite BoulevardDuluth, GA 30096-5810


B005-0000-1105 Apr. 1999Printed on recycled paper

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!