$V mg0V}b\g+9cS RxCKQLAxLsLBSSNHBEGINABGAHEX!BHEXc>CHEXZRES MKSTRGnHEXCONLNqDISARRAY:LNHEXLEAD02BYTE1BYTE2NIBL1NIBL2SPLICEDIRREPETEOMOOVE pSPDUPSLODWNFORWDlREVRSDELAYD*OTOxCHNGSPDV+BYTE3C4 D1A0A7CDCA8vC8NGBYTE4HexDecBYTEVALUELCONVERTCONVERT.NIBL`NIBRDUNNSUMUNIBLIFUSUMRSUMLBITE1BITE2BITE3MKSTRNGSTRNIBDECNIB DECNIBSUMDECLrLNIBDECRRNIBCOMPORT-SHOWITGOESTOPP#RUNNHOLD(HOLDDP1XMITGLOCO9RETURNB1bB2B3CONVRT0aMOOVEChgSpeedW INITIALIZE{chg_SpeedmainkLOCOpeedGOsubTO6breakspeedupWslowdownroutines inseparate subprogramsELSEIFIF>AutoRunhJ!xDELAY2gD2D3OD32qTopSpeedspdinsideUfinishG subroutineAutoauto.Ramp_upcruisedown-printittest1keysubendoY7 RtnToExeciExec. CruiseTime) AutoRunLoop>WaitTimeStopTimeMenuG BreakLoopExit1forwardSelecteddefaultA Yincrease9oneQother>revs]atzbottomX1uET4UKhowscancodes  uppercaselettersextendedcodeHellFreezesOverIatementsAddBYTE1.BYTE2.BYTE3.BYTE4D VersionHVersion1) automaticCONTROLProgramcontwstmtsdon statement]esleIFmodelocates`sKeyIsPressedHellFreezesOver TheSkeyIsPressed sKeyIsPressedmanualRampingNof%cycle:clean statementsgDetectorSensesTrainDetector SensesTrain SensorBlockeddummydetectXsensorcanumbersspdCmd GetLocoNum AutoCircleNCE ManualModemTitle ManualRunMoveAove^BASeachRINTWSpd2Spd1CtrReplacePvariable AutoPntToPnt# NopecountereCntr WestboundRevCmd2Ct1Sp1uSp2Sp3Cmd1ends operationworkspoorly5 GetLocomotiveNumberq subsaboveLocoNumnochgsModifyfixesL scrollingproblemBreakAutoCirclecontrlBreakAutoPoint< spsspcsCmd3KeyXmNCE01a.BAS, 05-18-01 !*(extracted from "RNLOC21m.BAS") L= Initialize sclear the screen m"COM1:9600,N,8,1,BIN,RS,DS0,CD0,CS0d  Y&Display commands & titles e`  Set direction forward m " L ($Initialize to 'space'; get loco number L= L=!Executive Program L mq"G ,q to exits(sd se6m{ Key$=| L m|}..( L m "a4Y4Space bar=get loco number(I4sdsdm"04 Manual Run Mode - Speed Step = em-"4 L -d a.2 chars=arrow pressed@m..e<m.. .clear old msgs from auto loops@ L dB 1isolate right character@ eM]"e` . right arrow = run forward@ eK]^eP . left arrow = run reverse@ eH] d . up arrow = increase speed@ eP] dw .down arrow = decrease speed@Y.send command to NCE4P(P( (  L -#Read keybd; <- = ^K, -> = ^M, ^ = ^H, v= ^P7 need above to reset Key$ after return from auto. subybnse sem## Exiting program (Key$=| L m|) N L= L= L=9Outputs: B1 & B2, Bytes 1 & 2 convrtd fr hex to decimali sd sdm02 {Enter Loco Cab Number.....  mu"]m1862 'union pacific #1862a me"]m0452 'erie lackawanna #0452 md"]0m2316 'd&h u23 #2316  mh"]dm3333 'd&h c628 # 3 mq"]|[ -d_]d [ Z   -dc]m0"  [ d , " separate 2 hex bytes. d B  d,  dB (C PRINT LNHEX$; " "; BYTE1$; " "; BYTE2$; " "; NIBL1$; " "; NIBL2$b Pad loco number with 'C000' m0"]mC" [ m1"]mD" [ m2"]mE" f    ! put byte back togethert se m 20 {lnhex$=" m byte1$/byte2$=" m " P temporary check on bytes. Y*#cnvrt byte 1 & 2 from hex to dec for xor sd m02 {............Cab # = '" m'.....}"oM= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ==0 ?Convert bytes 1 & 2 (loco number) from hex to decimal for xork  Y    Y   Y/send command packet to NCE to print directionto L=0send new command packet to NCE command station dc] d %Limits Spd range = 0 to 14 e_] e 4 da %Limits Ctr range = 0, 2 to 15 ,d  IH , d #%Adds 1 to adjust around emer.stop P%%(emer. stop =1; need to avoid this)m*  = = = = = = = = = = = = = = = = = = =:  This section sends the command to the command station         y y V V  mQ m " m " m "   d } *  = = = = = = = = = = = = = = = = = = = sd mA (clean line) -" sd m03 NCE: Direction= "sd se e`] mForward --> , Speed Step=" Qm, Ctr= Q eP] m<--Reverse , Speed Step=" Qm, Ctr= Q sesd m121 {.B1...B2..B3..CK..|.BYTE1.BYTE2.BYTE3.BYTE4.}" sesd m22 {    Vm| m.... m.... m.... m....}" sesd m23 { Xmit String=' m' }"o L=21 this subroutine converts hex bytes to decimal. 2 data to be converted enters as BYTE$, is parsed 1 to left and right characters, converted to hexd 5 by "brute force" lookup, then combined as decimal.  data is returned as SUM. @ d, ( (NIB$ IS VALUE TO CONVERT.)@ dB   * let's decimalize the left nibble first.@ mA"]d) [@ mB"]e [@ mC"]e [@ mD"]e [@ mE"]e [@ mF"]4e [@ Z " this does the digits 0-9  ep &! adjust for weight of left hex char. " now decimalize the right nibble@  mA"]d) [@  mB"] e [@  mC"],e [@  mD"]Ne [@  mE"]pe [@  mF"]e [@  Z " this does the digits 0-9B now we will put the nibbles back together as a decimal value  @    o L= sdsd mANCE MANUAL TRAIN CONTROL PROGRAM (technical details by Fred Cupp)" '02 Get Loco Num & Direction> '03: NCE info: direction, speed step, actual counter 'ctr'< '04: Subroutine info: Manual / AutoCircle / AutoPntToPnt '05: not usedn '11: not used  se  m=12 |--------------------------------------------------------|" m= | CHOICES: |" m= | Space Bar to enter new loco number |" m= | Arrows: Up/Down = Speed Up/Down, -> & <- = forward/rev |" m= | 'q' to quit program |" m= |--------------------------------------------------------|" m5 "  '20 Byte info in hexC '21: Byte Column Labels0 '22 Byte values in Dec / Byte values in Hex '23 Xmit string to NCE G ' PRINT "22 --(NOTE: using Line 24 or lower, wipes out line 1 ) -"-> ' PRINT "23 --(  if Line 1 has been written first ) -"o L