; v33El .. 1st edition (Peek fix, PECs added)
; Full Edition patch kit for Autostar 497 with PECs for LXD models
; 
; This 12 Apr 2005 patch33L4504.txt patch file contains:

;  Editing of Training Values
; (an EDIT menu item under Setup>Train Drives)
;  Adds 4504/114eq to Known Models (replaces DS-70)(a GEM scope!)
; this also allows DS motors to be used on a GEM mount.
; PEEK ...... adds :EPxxxxx# command, returns 16-bit contents. Decimal args/results.
;
; OPTIONAL patches: (edit this file to invoke or supress)
;  Automatic Satellite Track starting at down-count=zero 
;  CordWrap control 
;  Allow LPI to autoguide in Alt/Az <----
;  Skip time/date/daylight at power-up (disabled by default)
;
;  See end of file for instructions on adjusting PEC timing data to
;   match non-Meade final drive gear tooth counts.  This file has
;    data for 100, 130, 180, 359 and 360 toothed final drive gears.
;
;-----------------------

;  Version number change from 33El  to 33L4 (so Initialization shows 33L )

; adjusted to work with Autostar Suite

; rseymour@wolfenet.com 9-Apr-2005

; Here are the Four optional patches:
;   Cord Wrap control, Automatic Satellite Tracking, Alt/Az Autoguide, Skip Time/date

; ADD semicolons (;) in front of the next three ";R" lines to BLOCK permitting of
; Cord Wrap ON/OFF in hard-stopped scopes (ETX90/105/125,LXD55)
; This only -allows- turning Cord Wrap OFF, it does not change its current setting.

R   232ff    27  20    cordwrap   [ 33eL: 4-a2ff
R   233df    26  21      cordwrap [ 33eL: 4-a3df
R   23303    17  23      chksum   cordwrap [ 33eL: 4-a303

; ADD semicolons to the following three "R" lines to -prevent- Automatic
;  Start-of-tracking during a Satellite pass.  
;            Satellite  AutoTrack

R   4d380  bd   20  (-9d)      AutoTrack  [ 33eL: 9-c380 (4dxxx))
R   4d381  00   21  (+21)=-7c  AutoTrack  [ 33eL: 9-c381
R   4d383  08   84  (chksum) 7c+8  AutoStart  [ 33eL: 9-c383

; ADD semicolons to BLOCK:  (but why?)
; Allow LPI Autoguiding for Alt/Az as well as polar. Field Rotation issues.
;
R  46e01  1f  20 autoguide alt/az too [(brclr->bra+02) 33eL: 8-de01
R  46e02  00  02    autoguide for alt/az too [   33eL: 8-de02
R  46e03  08  05    autoguide for alt/az too [ (chksum)   33eL: 8-de03

;
; Skip-date/time/daylight:   v33ef
; **WARNING: This optional patch should not be used with StarGPS 
;   removing semicolons totally skips time/date/daylight
;       prompt at startup.
; R 2c33b   bd  7e   ; jmp to after time/date/daylight    33eL:5-b33b
; R 2c33c   00  b3   ; jmp   ->b396    33eL:5-b33c
; R 2c33d   40  96   ; (04 97 05)  fd  1c7 =ca =b6+14     33eL:5-b33d
; R 2c33f   97  83   ; checksum ;            33eL:5-b33f
; R 2c342   b6  00   ; checksum ;            33eL:5-b342
;

; Except for customizing PEC for various final drive gear tooth-counts,
;  there are NO further "optional" patches in this file.
;  changing any further "R" lines will cause the Updater to refuse to load the file.

; BUT: if you wish to change the PEC timing to match various output
; final drive tooth-counts, scroll down to the =end= of this file,
; and read the instructios.

;=== make no changes below this line ====

; Autostar Menu items added by this patch:
;
;  Training results Display and Edit:

; Under Setup > Telescope > Train Drive 
; are now (scroll up or down from the "Az/RA Train" or "Alt/Dec Train")
;  Edit: > Az/RA Train
;    and
;  Edit: > Alt/Dec Train
; press [enter] to allow direct display and manipulation of the results of training.
;    a power cycle (without using Park Scope) is needed for 
;     the  new values to be fully implemented.
; =======

;  4504/114eq replaces DS-70  (use the DS-60 for -70 if you need to)
;   The upper lower travel limits are 4800/-600 arcmin (+60 deg, - 10 deg)
;   ... values taken from the LXD55 series.  Please inform me if they're
;  too restrictive (too many Check Mount messages) or too loose (hits tripod)
;

;  For installation instructions, see:
;   READMEpatch.txt  which should have come with this kit.
;  the last line of -this- file says "; end of patch 32h4"
;  "Have fun" (tm) -- Dick Seymour   12-Apr-2005

;  there are NO further "optional" patches in this file.
;  changing any further lines will cause the Updater to refuse to load the file.

;  patch region:   

;
R       0004    e7      0d       chksum  [33ef
R       0005    62      b3       chksum
R       0006    37      36      ;chksum
;R      0007    07      07 

R       000A    45      4c      (E->L) [33El] version
R       0142FE  45      4c      (33ff) [33El] version
R       000b    6c      34      (i->4) [33El] version 33L4
R       0142Ff  6c      34      (33ff) [33El] version
;=================================
; automatic menu patches v33el
R      13DAE    2D    2D     CityDwn to Street
R      13DAF    CA    9A     CityDwn to Street

R      13DA0    2D    2D     StrtUp to City
R      13DA1    BA    AA     StrtUp to City

R      13DBA    02    02     ZipAddr->Tr Drv msg
R      13DBB    EC    D0     ZipAddr->Tr Drv msg
R      13DBC    02    01     Zip->AzTrnMsg(postal)
R      13DBD    F0    8d     Zip->AzTrnMsg(postal)
R      13DC0    2D    2C     Zip(AzEd) up to AltTrn
R      13DC1    CA    4A     Zip(AzEd) up to AltTrn
R      13DC2    2D    2B     ZipMode to TrnDrvs
R      13DC3    8A    DA     ZipMode to TrnDrvs
R      13DC7    05    b      action page to Patch page
R      13DC8    89    b5     ZipAct adr to Ptch adr
R      13DC9    8E    5d     ZipAct adr to Ptch adr

R      13C4E    2C    2D     AltTrnDwn to AzEd/Zip
R      13C4F    3A    BA     AltTrnDwn to AzEd/Zip

R      13DCA    02    02     StateAddr->Tr Drv msg
R      13DCB    EC    D0     StateAddr->Tr Dev msg
R      13DCC    02     1     State->AltTrnMsg(DoB)
R      13DCD    EF    8E     State->AltTrnMsg(DoB)
R      13DCE    2D    2C     SteDwn to AzTrn
R      13DCF    BA    3A     SteDwn to AzTrn
R      13DD0    2D    2D     SteUp to Zip(AzEd)
R      13DD1    AA    BA     SteUp to Zip(AzEd)
R      13DD2    2D    2B     SteMode to TrnDrvs
R      13DD3    8A    DA     SteMode to TrnDrvs
R      13DD7    05    b      action page to Patch page
R      13DD8    89    b5     act adr to Patch adr
R      13DD9    47    89     act adr to Patch adr

R      13C40    2C    2D      AzTrnUp to AltEdit/State
R      13C41    4A    CA      AzTrnUp to AltEdit

R      13DBE    2D    2D     Zip(AzEdit)dn->State(AltEdit)
R      13DBF    9A    CA     Zip(AzEdit)dn->State(AltEdit)


R      A1A83  50  45 ; P->E
R      A1A84  6F  64 ; o->d
R      A1A85  73  69 ; s->i
R      A1A86  74  74 ; t->t
R      A1A87  61  20 ; a-> 
R      A1A88  6C  41 ; l->A
R      A1A89  2F  7A ; /->z
R      A1A8A  5A  20 ; Z-> 
R      A1A8B  69  54 ; i->T
R      A1A8C  70  72 ; p->r
R      A1A8D  20  61 ;  ->a
R      A1A8E  43  69 ; C->i
R      A1A8F  6F  6E ; o->n
R      A1A90  64  3A ; d->:
R      A1A91  65  20 ; e-> 
R      A1A93  44  45 ; D->E
R      A1A94  61  64 ; a->d
R      A1A95  74  69 ; t->i
R      A1A96  65  74 ; e->t
R      A1A97  20  20 ;  -> 
R      A1A98  6F  41 ; o->A
R      A1A99  66  6C ; f->l
R      A1A9A  20  74 ;  ->t
R      A1A9B  42  20 ; B-> 
R      A1A9C  69  54 ; i->T
R      A1A9D  72  72 ; r->r
R      A1A9E  74  6E ; t->n
R      A1A9F  68  3A ; h->:

R      A2012  72  34 ; r->4
R      A2013  65  35 ; e->5
R      A2014  61  30 ; a->0
R      A2015  6B  34 ; k->4
R      A2016  6D  2F ; m->/
R      A2017  61  31 ; a->1
R      A2018  73  31 ; s->1
R      A2019  6B  34 ; k->4
R      A201A  20  65 ;  ->e
R      A201B  5B  71 ; [->q
;=======================================
; Az: 8-b55d Alt: 8-b589, 8-b is 044xxx 9-b is 04Cxxx  b-b is 05Cxxx
;       [8-b55d]   AZ   Train display [32Ei] x67 bytes [31ee:8-b55d 32Ei: 
R       05c55d  FF      3C      pshx
R       05c55e  FF      BD      jsr
R       05c55f  FF      08      clrscrn [33Ef: L0840 33El: L0844
R       05c560  FF      44      clrscrn [33Ef: L0840 33El: L0844
R       05c561  FF      FC      ldd
R       05c562  FF      B6      azTrain  
R       05c563  FF      0B      azTrain  [b60b
R       05c564  FF      30      tsx
R       05c565  FF      ED      std
R       05c566  FF      00      0.x
R       05c567  FF      CC      ldd
R       05c568  FF      01      msgNum [Postal: 33El: 018d
R       05c569  FF      8d      az     [Postal: 33El: 018d
R       05c56a  FF      BD      jsr
R       05c56b  FF      00      dispatch
R       05c56c  FF      40      dispatch [32Ei: 0040
R       05c56d  FF      0a      page
R       05c56e  FF      ca      d->msg  [33El: a-cabc
R       05c56f  FF      bc      d->msg  [33El: a-cabc
R       05c570  FF      BD      jsr
R       05c571  FF      08      msg->scrn [ 33El: 0874
R       05c572  FF      74      msg->scrn [ 33El: 0874
R       05c573  FF      C6      lda#01
R       05c574  FF      01      #01
R       05c575  FF      37      pshb
R       05c576  FF      5C      incb
R       05c577  FF      BD      jsr
R       05c578  FF      07      cursor [ 33El: 07f8
R       05c579  FF      f8      cursor [ 33El: 07f8
R       05c57a  FF      31      ins
R       05c57b  FF      30      tsx
R       05c57c  FF      8F      xgdx
R       05c57d  FF      BD      jsr
R       05c57e  FF      00      dispatch
R       05c57f  FF      40      dispatch [ 33El: 0040
R       05c580  FF      08      page
R       05c581  FF      99      IntegerInput [ 33El: 8-994f
R       05c582  FF      4f      IntegerInput [ 33El: 8-994f
R       05c583  FF      CE      ldx#
R       05c584  FF      B6      azTrain
R       05c585  FF      0B      azTrain [ 33El: ]
; variation: jump to common exit code. (could branch, jump's easier)
R       05c586  ff    7e   jmp
R       05c587  ff    b5   [30Ed-32: common: b5b2 ]
R       05c588  ff    b2   [30Ed-32: common: b5b2 ]

;              ALT Train display [8-b589]
R       05c589  FF      3C      pshx
R       05c58A  FF      BD      jsr
R       05c58B  FF      08      clrscrn [33El: L0844
R       05c58C  FF      44      clrscrn [33El: L0844
R       05c58D  FF      FC      ldd
R       05c58E  FF      B6      altTrain
R       05c58F  FF      09      altTrain [332Ei
R       05c590  FF      30      tsx
R       05c591  FF      ED      std
R       05c592  FF      00      0,x
R       05c593  FF      CC      ldd#
R       05c594  FF      01      msg:Alt
R       05c595  FF      8e      Alt [ 33El: 018e
R       05c596  FF      BD      jsr
R       05c597  FF      00      dispatch
R       05c598  FF      40      dispatch [ 33El: 0040
R       05c599  FF      0a      page
R       05c59A  FF      ca      d->msg [ 33El: a-cabc
R       05c59B  FF      bc      d->msg [ 33El: a-cabc
R       05c59C  FF      BD      jsr
R       05c59D  FF      08      d->scrn [ 33El: 0874
R       05c59E  FF      74      d->scrn [ 33El: 0874
R       05c59F  FF      C6      ldb#
R       05c5a0  FF      01      #01
R       05c5a1  FF      37      pshb
R       05c5a2  FF      5C      incb
R       05c5a3  FF      BD      jsr
R       05c5a4  FF      07      cursor [ 33El: 07f8
R       05c5a5  FF      f8      curs  [ 33El: 07f8
R       05c5a6  FF      31      ins
R       05c5a7  FF      30      tsx
R       05c5a8  FF      8F      xgdx
R       05c5a9  FF      BD      jsr
R       05c5aA  FF      00      dispatch
R       05c5aB  FF      40      dispatch [32Ei: 0040
R       05c5aC  FF      08      page
R       05c5aD  FF      99      IntInput [ 33El: 8-994f
R       05c5aE  FF      4f      IntIn [ 33El: 8-994f
R       05c5aF  FF      CE      ldx#
R       05c5b0  FF      B6      altTrain
R       05c5b1  FF      09      altTrain [32Ei]
R       05c5b2  FF      3C      pshx   <-- common  [32Ei: b5b2
R       05c5b3  FF      30      tsx
R       05c5b4  FF      EC      ldd
R       05c5b5  FF      02      2,x
R       05c5b6  FF      BD      jsr
R       05c5b7  FF      04      burnWd
R       05c5b8  FF      dd      burn [ 33El: 04dd
R       05c5b9  FF      38      pulx
R       05c5bA  FF      38      pulx
R       05c5bB  FF      39      rts
; 8-b5bc next free byte
; 4504
; 4504/114eq replacing DS-70  23xxx=4-a000 [32Ei:

R       242ad   01  02   DS-70->4504msg [33El: 4-b2ad 01ac->020c
R       242ae   ac  0c   DS-70->4504msg [33El: 01ac->020c

R       23bf9   02      03     900 FL [33ef:4-abf6/7 33El: 4-abf9
R       23bfa   bc      84   [32Ei]
R       23c04   0f      12      4800_max_elev [33ef:4-ac01/2 33El: 4-ac04
R       23c05   78      c0   [32Ei]
R       23c0f   fe      fd     -600_min_elev [33ef:4-ac0c/d 33El: 4-ac0f
R       23c10   5c      a8   [32Ei]
R       23c18   04      0b    3-f05a_branch [33El: 4-ac18  0b (05Cxxx)
R       23c19   a8     B5    3-f05a_branch  [33El: 0b-b5-bc 
R       23c1a   db     bc    3-f05a_branch  [33El: 0b-b5-bc 

; patch requires x4f bytes  ..from (32Ei)8-b5bc..
R       05c5bc   ff      3c  at   [33El: b-b5bc
R       05c5bd   ff      3c   pshx,pshx
R       05c5be   ff      cc   ldd_03ca 4504 ratio  4.562963
R       05c5bf   ff      03
R       05c5c0   ff      CA
R       05c5c1   ff      30   tsx
R       05c5c2   ff      ed   std_2,x
R       05c5c3   ff      02
R       05c5c4   ff      cc   ldd_4092
R       05c5c5   ff      40
R       05c5c6   ff      92
R       05c5c7   ff      ed   std_0,x
R       05c5c8   ff      00
R       05c5c9   ff      bd   dispatch [32ei: 0040
R       05c5ca   ff      00
R       05c5cb   ff      40   [32ei: 0040]
R       05c5cc   ff      0a  setAzratio [33Ef: a-D66E 33El: a-d670
R       05c5cd   ff      d6   [ 33El: a-d670
R       05c5ce   ff      70   [ 33El: a-d670
R       05c5cf   ff      cc   ldd_0194 4504 ratio=4.562693
R       05c5d0   ff      01
R       05c5d1   ff      94
R       05c5d2   ff      30   tsx
R       05c5d3   ff      ed   std_2,x
R       05c5d4   ff      02
R       05c5d5   ff      cc   ldd_4092
R       05c5d6   ff      40
R       05c5d7   ff      92
R       05c5d8   ff      ed   std_0,x
R       05c5d9   ff      00
R       05c5da   ff      bd   dispatch  ([32ei: 0040
R       05c5db   ff      00   [32ei: 0040
R       05c5dc   ff      40   [32ei: 0040
R       05c5dd   ff      0a   setALTratio [ 33El: a-d6a5
R       05c5de   ff      d6    [ 33El: a-d6a5
R       05c5df   ff      a5    [ 33El: a-d6a5
R       05c5e0   ff      cc   ldd_B73E_(status_bits)[31ee]
R       05c5e1   ff      b7
R       05c5e2   ff      3e
R       05c5e3   ff      30   tsx
R       05c5e4   ff      ed   std_0,x
R       05c5e5   ff      00
R       05c5e6   ff      f6   ldab_B73e [31ee]
R       05c5e7   ff      b7
R       05c5e8   ff      3e
R       05c5e9   ff      ca   orab_x18_(GEM,Polar)
R       05c5ea   ff      18
R       05c5eb   ff      bd   jst_burn_Byte   [ 33El: L04f1
R       05c5ec   ff      04      [ 33El: L04f1
R       05c5ed   ff      f1      [ 33El: L04f1
R       05c5ee   ff      cc   ldd_B73d_(more_status)
R       05c5ef   ff      b7
R       05c5f0   ff      3d   [32Ei]
R       05c5f1   ff      30   tsx
R       05c5f2   ff      ed   std_0,x
R       05c5f3   ff      00
R       05c5f4   ff      f6   ldab_b73d [32Ei]
R       05c5f5   ff      b7
R       05c5f6   ff      3d
R       05c5f7   ff      ca    orab_x08_(cord_wrap)
R       05c5f8   ff      08
R       05c5f9   ff      bd   jsr burnByte    [ 33El: L04f1
R       05c5fa   ff      04   [   [ 33El: L04f1
R       05c5fb   ff      f1   [   [ 33El: L04f1
R       05c5fc   ff      38   pulx
R       05c5fd   ff      38   pulx
R       05c5fe   ff      39   rts
; end of 4504 patch

; start of PeekPatch
;  at line immediately after "cmpb "R": (33f:8-c975) 33ef:8-c975 33el:8-cfba
R 45fba   26 7e   old: bne +3 ; jmp [33El: 8-b5cc  33el: 8-cfba 
R 45fbb   03 b5   new: jmp {patch}  [33El: 8-b5cc] 45xxx  33el: 8-b
R 45fbc   7e cc                     [33El: 8-b5cc]

; R 30xxx  ff1c=65308  8-ff=48xxx (42. bytes x2a) 33el: b5cc-b5f5  044xxx
R	 445cC	ff	26	bne+3
R	 445cD	ff	3	
R	 445cE	ff	7e	jmp (:ER) 32a:825a 32h:8276 i:cb3f 33el:
R	 445cF	ff	d1  cb   	  [32:8276  <<return1 (c977)  33El: d184
R	 445d0	ff	84  3f   	  [32:8276  33Ef: 8-cb3f    33El: d184
R	 445d1	ff	c1	cmp "P"
R	 445d2	ff	50	
R	 445d3	ff	27	beq+3
R	 445d4	ff	3	
R	 445d5	ff	7e	jmp (:E??) [33f:c97a 32i:8095 33El: cfbf
R	 445d6	ff	cf  c9 80	  [<< patch return2 [ 33El: cfbf
R	 445d7	ff	bf  7a  95	  [ 33El: cfbf
R	 445d8	ff	30	tsx
R	 445d9	ff	ec	ldd 38,x  (buffer)
R	 445dA	ff	38	
R	 445dB	ff	c3	addd 3   (past the EP)
R	 445dC	ff	0	
R	 445dD	ff	3	
R	 445dE	ff	bd	dispatch  [32:0040
R	 445dF	ff	00	 [32:0040
R	 445e0	ff	40	 [32:0040
R	 445e1	ff	8	 ParseNumericFPString [33El: 8-cae3
R	 445e2	ff	ca  c4  fb	 [ 33El: 8-cae3
R	 445e3	ff	e3  9e  86	 [ 33El: 8-cae3
R	 445e4	ff	bd	jsr  Flt->Int32    [32:204B h:200a  :204B
R	 445e5	ff	20	  [32:200a  33f:206c  33El: 20a1
R	 445e6	ff	a1	  [32:200a   33El: 20a1
R	 445e7	ff	30	tsx
R	 445e8	ff	ee	ldx 2,x
R	 445e9	ff	2	
R	 445eA	ff	ec	ldd 0,x
R	 445eB	ff	0	
R	 445eC	ff	30	tsx
R	 445eD	ff	bd	dispatch   Int16->rs232 [32h: 5-b446 b445
R	 445eE	ff	00	 [32:0040
R	 445eF	ff	40	 [32:0040
R	 445f0	ff	8	[33f:5-fcb6  33El: 8-82f4
R	 445f1	ff	82 	[33f:5-fcb6  33El: 8-82f4
R	 445f2	ff	f4 	[33f:5-fcb6  33El: 8-82f4
R	 445f3	ff	7e	jmp dc7d (end of :EQ code)  [32h:826f 8253
R	 445f4	ff	d1  cb 82	   [32:826f  33f: cb38 33El: d17d
R	 445f5	ff	7d  38  53	   [32:826f  33El: d17d
;; end of 497 peek patch
	

;  33f:5-b156 cmpb 11; beq xxxx -> jmp 33f:5-b5bc  33El:at 5-bc35

R 2cc35 c1  7e   
R 2cc36 11  b5
R 2cc37 27  bc 

; here: cmpb 11, bne +3, jmp 9225, cmpb 3, beq +3, jmp 9286
-----------------------------
;  the three PEC factors:
R	2C5BC	ff	c1	cmpb 11	(5-b5bc)
R	2C5BD	ff	11		
R	2C5BE	ff	26	bne +3		32eh  32ei
R	2C5BF	ff	03		
R	2C5C0	ff	7e  jmp 
R	2C5C1	ff	bc b1		[33ef: b15d  33El: bc3c
R	2C5C2	ff	3c 5d		[33ef: b15d  33El: bc3c
R	2C5C3	ff	c1	cmpb 3	(DS-70 scope type)
R	2C5C4	ff	03		
R	2C5C5	ff	27	beq+3	
R	2C5C6	ff	03		
R	2C5C7	ff	7e  jmp
R	2C5C8	ff	bd b2	[33ef: b223  33El: bd03
R	2C5C9	ff	03 23	[33ef: b223  33El: bd03
; more: load 4504/100 tooth fac2: 64800. (fd20) fac3: 12960. (32a0) fac4: 5		
R	2C5CA	ff	cc	fac2.msw	ldd 0000
R	2C5CB	ff	00		
R	2C5CC	ff	00		
R	2C5CD	ff	fd	std (32i:36cf) [33El:36df
R	2C5CE	ff	36	fac2.msw	 [33El:36df
R	2C5CF	ff	df		 [33El:36df
R	2C5D0	ff	cc	fac2.lsw	ldd fd20
R	2C5D1	ff	fd		
R	2C5D2	ff	20		
R	2C5D3	ff	fd	std (32i:36d1) [33El:36e1
R	2C5D4	ff	36	fac2.lsw	 [33El:36e1
R	2C5D5	ff	e1		 [33El:36e1
R	2C5D6	ff	cc	fac3.msw	ldd 0000
R	2C5D7	ff	00		
R	2C5D8	ff	00		
R	2C5D9	ff	fd	std (32i:36d7) (33f:36e7
R	2C5DA	ff	36	fac3.msw  [33El:36e7
R	2C5DB	ff	e7		 [33El:36e7
R	2C5DC	ff	cc	fac3.lsw	ldd 32a0
R	2C5DD	ff	32		
R	2C5DE	ff	a0		
R	2C5DF	ff	fd	std (32i:36d9)(33f:36e9
R	2C5E0	ff	36		fac3.lsw [33El:36e9
R	2C5E1	ff	e9		 [33El:36e9
R	2C5E2	ff	cc	fac4.msw	ldd 0000
R	2C5E3	ff	00		
R	2C5E4	ff	00		
R	2C5E5	ff	fd	std (32i:36d3)(33f:36e3
R	2C5E6	ff	36	fa4.msw [33El:36e3	
R	2C5E7	ff	e3		
R	2C5E8	ff	cc	fac4.lsw	ldd 0005
R	2C5E9	ff	00		
R	2C5EA	ff	05		
R	2C5EB	ff	fd	std (32i:36d5)(33f:36e5
R	2C5EC	ff	36	fac4.lsw [33El:36e5	
R	2C5ED	ff	e5		
R	2C5EE	ff	7e	jmp 928e 92a9 92a8
R	2C5EF	ff	bc  b1		(33f:b1ff  33El: bcdf
R	2C5F0	ff	df  ff		(33f:b1ff  33El: bcdf

------------------------------		
;  4504patchTOO  32i:3-ecb5 33f: 4-9de9  22de9 33El: 4-9de6
;   cmpb 1 ; beq ecc9 -> jmp here (4-ffb8) ecb5 ffb8
R	22de6 	c1	7e		
R	22de7 	01	ff		to 4-ffb8 28fb8
R	22de8 	27	b8		

; cmpb 1 ; bne +3; jmp ecc9 ; cmpb 3 ; beq +3; jmp ecb9	
R	28FB8	ff	c1		cmb 01
R	28FB9	ff	01		
R	28FBA	ff	26		bne +3
R	28FBB	ff	03		
R	28FBC	ff	7e	jmp (33f:9dfd  9-ecc5 ecc9
R	28FBD	ff	9d  	<patch return1	[33El: 9dfa
R	28FBE	ff	fa  		[33El: 9dfa
R	28FBF	ff	c1		cmb 03  ds70
R	28FC0	ff	03		
R	28FC1	ff	27		beq +3
R	28FC2	ff	03		
R	28FC3	ff	7e	jmp (33f:9ded  [33El: 9dea
R	28FC4	ff	9d 		<patch return2  [33El: 9dea
R	28FC5	ff	ea 		  [33El: 9dea
; ((loadtime)) jmp ece5 ;  time: 1402.407422 (44AF 4D0A)	
R	28FC6	ff	cc		ldd 44af
R	28FC7	ff	44		
R	28FC8	ff	af		
R	28FC9	ff	ed		std b2,x
R	28FCA	ff	b2		
R	28FCB	ff	cc		ldd 4d0a
R	28FCC	ff	4d		
R	28FCD	ff	0a		
R	28FCE	ff	7e	jmp (33f:9e19  ece5 ece1 ece5
R	28FCF	ff	9e 		<patch return3   [33El: 9e16
R	28FD0	ff	16 		  [33El: 9e16
; end of 4504/100 tooth PEC patch
--------------------------	
; start of LXD substitute patches
;  replaces LXD PEC insertions  5-b1e2  2c1e2 33El:5-bcc2
;  Time Interval is patched directly in-line
;  PEC Factors are patched out-line (here) 5-b4ca 2c4ca
R   2ccc2  5f  7e   clrb, clra, std -> jmp b4ca
R   2ccc3  4f  b4
R   2ccc4  fd  ca
;  values here are for LXD.  Optional patches cause changes
R	2C4CA	ff	cc	fac2.msw	ldd 0000
R	2C4CB	ff	00	fac2.msw	
R	2C4CC	ff	00	fac2.msw	
R	2C4CD	ff	fd	std  (33f:36df
R	2C4CE	ff	36		
R	2C4CF	ff	df		
R	2C4D0	ff	cc	fac2.lsw	ldd 2328
R	2C4D1	ff	23	fac2.lsw	
R	2C4D2	ff	28	fac2.lsw	
R	2C4D3	ff	fd	std  (33f:36e1
R	2C4D4	ff	36		
R	2C4D5	ff	e1		
R	2C4D6	ff	cc	fac3.msw	ldd 0000
R	2C4D7	ff	00		
R	2C4D8	ff	00		
R	2C4D9	ff	fd	std  (33f:36e7
R	2C4DA	ff	36		
R	2C4DB	ff	e7		
R	2C4DC	ff	cc	fac3.lsw	ldd 003c
R	2C4DD	ff	00	fac3.lsw	
R	2C4DE	ff	3c	fac3.lsw	
R	2C4DF	ff	fd	std (33f:36e9
R	2C4E0	ff	36		
R	2C4E1	ff	e9		
R	2C4E2	ff	cc	fac4.msw	ldd 0000
R	2C4E3	ff	00		
R	2C4E4	ff	00		
R	2C4E5	ff	fd	std (33f:36e3
R	2C4E6	ff	36		
R	2C4E7	ff	e3		
R	2C4E8	ff	cc	fac4.lsw	ldd 0001
R	2C4E9	ff	00	fac4.lsw	
R	2C4EA	ff	01	fac4.lsw	
R	2C4EB	ff	fd	std (33f:36e5
R	2C4EC	ff	36		
R	2C4ED	ff	e5		
R	2C4EE	ff	7e	jmp 928e 92a9 92a8
R	2C4EF	ff	bc		(33f:b1ff  33El: bcdf
R	2C4F0	ff	df		(33f:b1ff  33El: bcdf
R	2C4F1	ff	00  chksum
R	2C4F2	ff	00  chksum
R	2C4F3	ff	00  chksum

;  PEC -- the following patches change all LXD models to
;  have customized PEC Training parameters.
;=======================================================
;   100 tooth fac2: 64800. (fd20) fac3: 12960. (32a0) fac4: 5
;   100 tooth  time: 1402.407422 (44AF 4D0A)
;R 22e0f  44  44	interval.msw  4-9e12  [33El: 4-9e0f
;R 22e10  73  af
;R 22e14  79  4d	interval.lsw    [33El: 4-9e14
;R 22e15  38  0a
; fac2 5-b4d1
;R	2C4D1	23  fd	fac2.lsw	
;R	2C4D2	28  20	fac2.lsw	
; fac3 5-b4dd 
;R	2C4DD	00  32	fac3.lsw	
;R	2C4DE	3c  a0	fac3.lsw	
; fac4 5-b4e9
;R	2C4E9	00  00	fac4.lsw	
;R	2C4EA	01  05	fac4.lsw	
; (1f0)(33e)=14e=ff+4f
;R	2C4F4 ff 00  chksum
;R	2C4F5	ff b0  chksum
; end of 100
;=======================================================
;  130-tooth: fac2: 129600 (1fa40)  fac3: 864 (x0360)  fac4: 13 (x0d)
; 130 tooth interval:  1078.775 ( 4486 d8cd )
; 130 tooth ratio:  2.96593  ( 403D D1CC ) or(C03D D1CC)
;R 22e0f  44  44	interval.msw  4-9e12  [33El: 4-9e0e
;R 22e10  73  86
;R 22e14  79  d8	interval.lsw   [33El: 4-9e14
;R 22e15  38  cd
; fac2 5-b4d1
;R	2C4CC	00	01     fac2.msw
;R	2C4D1	23  fa	fac2.lsw	
;R	2C4D2	28  40	fac2.lsw	
; fac3 5-b4dd 
;R	2C4DD	00  03	fac3.lsw	
;R	2C4DE	3c  60	fac3.lsw	
; fac4 5-b4e9
;R	2C4E9	00  00	fac4.lsw	
;R	2C4EA	01  13	fac4.lsw	
;  (1f0)(420)=230=ff+ff+32
;R	2C4F4	 ff 00 chksum
;R	2C4F5  ff 00  chksum
;R	2C4F6  ff cd  chksum
; end of 130
;=======================================================
;  180 tooth fac2: 1c20  fac3: 30  fac4: 1  
;  180 tooth Interval: 779.1153 4442 c761
;R 22e0f  44 44 	interval.msw  4-9e12  [33El: 4-9e0e
;R 22e10  73 42
;R 22e14  79 c7 	interval.lsw   [33El: 4-9e14
;R 22e15  38 61
; fac2 5-b4d1
;R	2C4D1	23  1c	fac2.lsw	
;R	2C4D2	28  20	fac2.lsw	
; fac3 5-b4dd 
;R	2C4DD	00  00	fac3.lsw	
;R	2C4DE	3c  30	fac3.lsw	
; fac4 5-b4e9
;R	2C4E9	00  00	fac4.lsw	
;R	2C4EA	01  01	fac4.lsw	
;  (1f0)(21b)=2b
;R	2C4F4	ff  d4  chksum
; end of 180
;=======================================================
; 359 tooth fac2: 13c680 fac3: 21c0 fac4: 167 
;   Interval: 390.6428  43c3 5246
;R 22e0f  44  43	interval.msw  4-9e12  [33El: 4-9e0e
;R 22e10  73  c3
;R 22e14  79  52	interval.lsw   [33El: 4-9e14
;R 22e15  38  46
; fac2 5-b4d1
;R	2C4CC	00  13	fac2.msw	
;R	2C4D1	23  c6	fac2.lsw	
;R	2C4D2	28  80	fac2.lsw	
; fac3 5-b4dd 
;R	2C4DD	00  21	fac3.lsw	
;R	2C4DE	3c  c0	fac3.lsw	
; fac4 5-b4e9
;R	2C4E9	00  01	fac4.lsw	
;R	2C4EA	01  67	fac4.lsw	
;   
;R	2C4F4	ff  ad chksum
;R	2C4F5	ff  00 chksum
;R	2C4F6	ff  00 chksum
; end of 359
;=======================================================
;  360 tooth fac2: 0e10  fac3: 18  fac4: 1  float: 43c2 c761
; 360 interval:  389.5576  43c2 c761
;R 22e0f  44 43	interval.msw  4-9e12  [33El: 4-9e0e
;R 22e10  73 c2
;R 22e14  79 c7	interval.lsw   [33El: 4-9e14
;R 22e15  38 61
; fac2 5-b4d1
;R	2C4D1	23  0e	fac2.lsw	
;R	2C4D2	28  10	fac2.lsw	
; fac3 5-b4dd 
;R	2C4DD	00  00	fac3.lsw	
;R	2C4DE	3c  18	fac3.lsw	
;   (1ef)(263)=74
;R	2C4F4	ff  8b chksum
; end of 360
;=======================================================
; end 0f variable gearing section
;
; How to set up PEC for different gearing:
;  Above this note are 5 sections of code between labels
;  stating their tooth-count, and "end of XXX" for that count.
; In order to activate your tooth-count section, remove the
;  semicolons (;) in front of all of the letter "R" lines in your 
; section.   Then apply the patch kit.
; When operating your telescope, select -any- LXD model,
;  enter your Ratios directly into the Setup/Telescope/Ratio
; (both RA and DEC) fields from the keypad, and PEC should
; become operational.
;
;  end of patch 33el4504 with PEC and PEEK