; v32Ea
;  patch kit for Autostar 497
; This 3 July 2004 patch32e4.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)
;-----------------------

;  Version number change from 32Ea  to 32a4 (so Initialization shows 32a )

; adjusted to work with Autostar Suite

; rseymour@wolfenet.com 3-Jul-2004

; 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      201ce    27      20      cordwrap [ 32ea: 3-f1ce
R      202ae    26      21      cordwrap [ 32ea: 3-f2ae
R      201d2    17      23      chksum   cordwrap [ 32ea: 3-f1d2

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

R      484f8  bd      20      (-9d)      AutoTrack  [ 32ea: 8-f4f8
R      484f9  00      21      (+21)=-7c  AutoTrack  [ 32ea: 8-f4f9
R      484fb  05      81      (chksum) 7c+5  AutoStart  [ 32ea: 8-f4fb

; ADD semicolons to BLOCK:  (but why?)
; Allow LPI Autoguiding for Alt/Az as well as polar. Field Rotation issues.
;
R   41e8d    1f  20    autoguide for alt/az too [31ee (brclr->bra+02) 32: 8-8e8d
R   41e8e    00  02    autoguide for alt/az too [31ee 
R   41e8f    08  05    autoguide for alt/az too [31ee (chksum)

;
; Skip-date/time/daylight:   v32ea
; **WARNING: This optional patch should not be used with StarGPS 
; New: 4-e66c:  7e 8baa 03 32   jmp 8baa (chksum)
;   removing semicolons totally skips time/date/daylight prompt at startup.
; R 29b4f   bd  7e   ; jmp to after time/date/daylight  32ea: 5-8b4f (29xxx)
; R 29b50   00  8b   ; jmp   ->8baa
; R 29b51   40  aa   ; 
; R 29b53   e8  32   ; checksum (xfd->x1b3)=b6 adjust, e8-b6=32
;

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

;=== 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 32e4"
;  "Have fun" (tm) -- Dick Seymour   3-Jul-2004

;  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:   32Ea: 8-b55d

;
R       0004    8e      b5       chksum  [32
R       0005    40      c7       chksum
R       0006    92      91      ;chksum
;R       0007    07      07 

R       000A    45      61      (E->a) [32Ea] version
R       0142FE  45      61      (32fe) [32Ea] version
R       000b    61      34      (a->4) [32Ea] version 32a4
R       0142Ff  61      34      (32ff) [32Ea] version
;=================================
; automatic menu patches v32ea
R      13D1A    2D    2D     CityDwn to Street
R      13D1B    36    06     CityDwn to Street

R      13D0C    2D    2D     StrtUp to City
R      13D0D    26    16     StrtUp to City

R      13D26    02    02     ZipAddr->Tr Drv msg
R      13D27    CA    AF     ZipAddr->Tr Drv msg
R      13D28    02    01     Zip->AzTrnMsg(postal)
R      13D29    CE    7e     Zip->AzTrnMsg(postal)
R      13D2C    2D    2B     Zip(AzEd) up to AltTrn
R      13D2D    36    C6     Zip(AzEd) up to AltTrn
R      13D2E    2C    2B     ZipMode to TrnDrvs
R      13D2F    F6    56     ZipMode to TrnDrvs
R      13D33    04    8      action page to Patch page
R      13D34    DA    b5     ZipAct adr to Ptch adr
R      13D35    7F    5d     ZipAct adr to Ptch adr

R      13BCA    2B    2D     AltTrnDwn to AzEd/Zip
R      13BCB    B6    26     AltTrnDwn to AzEd/Zip

R      13D36    02    02     StateAddr->Tr Drv msg
R      13D37    CA    AF     StateAddr->Tr Dev msg
R      13D38    02     1     State->AltTrnMsg(DoB)
R      13D39    CD    7f     State->AltTrnMsg(DoB)
R      13D3A    2D    2B     SteDwn to AzTrn
R      13D3B    26    B6     SteDwn to AzTrn
R      13D3C    2D    2D     SteUp to Zip(AzEd)
R      13D3D    16    26     SteUp to Zip(AzEd)
R      13D3E    2C    2B     SteMode to TrnDrvs
R      13D3F    F6    56     SteMode to TrnDrvs
R      13D43    04    8      action page to Patch page
R      13D44    DA    b5     act adr to Patch adr
R      13D45    38    89     act adr to Patch adr

R      13BBC    2B    2D      AzTrnUp to AltEdit/State
R      13BBD    C6    36      AzTrnUp to AltEdit

R      13D2A    2D    2D     Zip(AzEdit)dn->State(AltEdit)
R      13D2B    06    36     Zip(AzEdit)dn->State(AltEdit)


R      A75E5  50  45 ; P->E
R      A75E6  6F  64 ; o->d
R      A75E7  73  69 ; s->i
R      A75E8  74  74 ; t->t
R      A75E9  61  20 ; a-> 
R      A75EA  6C  41 ; l->A
R      A75EB  2F  7A ; /->z
R      A75EC  5A  20 ; Z-> 
R      A75ED  69  54 ; i->T
R      A75EE  70  72 ; p->r
R      A75EF  20  61 ;  ->a
R      A75F0  43  69 ; C->i
R      A75F1  6F  6E ; o->n
R      A75F2  64  3A ; d->:
R      A75F3  65  20 ; e-> 
R      A75F5  44  45 ; D->E
R      A75F6  61  64 ; a->d
R      A75F7  74  69 ; t->i
R      A75F8  65  74 ; e->t
R      A75F9  20  20 ;  -> 
R      A75FA  6F  41 ; o->A
R      A75FB  66  6C ; f->l
R      A75FC  20  74 ;  ->t
R      A75FD  42  20 ; B-> 
R      A75FE  69  54 ; i->T
R      A75FF  72  72 ; r->r
R      A7600  74  6E ; t->n
R      A7601  68  3A ; h->:

R      A7B3D  72  34 ; r->4
R      A7B3E  65  35 ; e->5
R      A7B3F  61  30 ; a->0
R      A7B40  6B  34 ; k->4
R      A7B41  6D  2F ; m->/
R      A7B42  61  31 ; a->1
R      A7B43  73  31 ; s->1
R      A7B44  6B  34 ; k->4
R      A7B45  20  65 ;  ->e
R      A7B46  5B  71 ; [->q


;=======================================
; Az: 8-b55d Alt: 8-b589
;       [8b55d]   AZ   Train display [31ee] x67 bytes [31ee:8-b55d 32ea: 
R       04455d  FF      3C      pshx
R       04455e  FF      BD      jsr
R       04455f  FF      07      clrscrn [32ea: 07f5
R       044560  FF      f5      clrscrn [32ea: 07f5
R       044561  FF      FC      ldd
R       044562  FF      B6      azTrain  
R       044563  FF      0B      azTrain  [26gc: b60b) 30ed/e:b60b
R       044564  FF      30      tsx
R       044565  FF      ED      std
R       044566  FF      00      0.x
R       044567  FF      CC      ldd
R       044568  FF      01      msgNum [Postal: 32ea: 017e
R       044569  FF      7e      az     [Postal: 32ea: 017e
R       04456a  FF      BD      jsr
R       04456b  FF      00      dispatch
R       04456c  FF      40      dispatch [32ea: 0040
R       04456d  FF      0a      page
R       04456e  FF      81      d->msg [[32ea: a-8113
R       04456f  FF      13      d->msg [[32ea: a-8113]
R       044570  FF      BD      jsr
R       044571  FF      08      msg->scrn [32ea: 0825
R       044572  FF      25      msg->scrn [32ea: 0825
R       044573  FF      C6      lda#01
R       044574  FF      01      #01
R       044575  FF      37      pshb
R       044576  FF      5C      incb
R       044577  FF      BD      jsr
R       044578  FF      07      cursor [32ea: 07a9
R       044579  FF      a9      cursor [32ea: 07a9
R       04457a  FF      31      ins
R       04457b  FF      30      tsx
R       04457c  FF      8F      xgdx
R       04457d  FF      BD      jsr
R       04457e  FF      00      dispatch
R       04457f  FF      40      dispatch [32ea: 0040
R       044580  FF      05      page
R       044581  FF      cd      IntegerInput [32ea: 5-cdf6
R       044582  FF      f6      IntegerInput [32ea: 5-cdf6
R       044583  FF      CE      ldx#
R       044584  FF      B6      azTrain
R       044585  FF      0B      azTrain [31ee]
; variation: jump to common exit code. (could branch, jump's easier)
R       044586  ff    7e   jmp
R       044587  ff    b5   [30Ed-32: common: b5b2 ]
R       044588  ff    b2   [30Ed-32: common: b5b2 ]

;              ALT Train display [a-b589]
R       044589  FF      3C      pshx
R       04458A  FF      BD      jsr
R       04458B  FF      07      clrscrn [32ea: 07f5
R       04458C  FF      f5      clrscrn [32ea: 07f5
R       04458D  FF      FC      ldd
R       04458E  FF      B6      altTrain
R       04458F  FF      09      altTrain [31ee
R       044590  FF      30      tsx
R       044591  FF      ED      std
R       044592  FF      00      0,x
R       044593  FF      CC      ldd#
R       044594  FF      01      msg:Alt
R       044595  FF      7f      Alt [31ee:02ab->017a (DoB)17f
R       044596  FF      BD      jsr
R       044597  FF      00      dispatch
R       044598  FF      40      dispatch [32ea: 0040
R       044599  FF      0a      page
R       04459A  FF      81      d->msg [[32ea: a-8113
R       04459B  FF      13      msg [[32ea: a-8113]
R       04459C  FF      BD      jsr
R       04459D  FF      08      d->scrn [32ea: 0825
R       04459E  FF      25      scr [32ea: 0825
R       04459F  FF      C6      ldb#
R       0445a0  FF      01      #01
R       0445a1  FF      37      pshb
R       0445a2  FF      5C      incb
R       0445a3  FF      BD      jsr
R       0445a4  FF      07      cursor [32ea: 07a9
R       0445a5  FF      a9      curs  [32ea: 07a9
R       0445a6  FF      31      ins
R       0445a7  FF      30      tsx
R       0445a8  FF      8F      xgdx
R       0445a9  FF      BD      jsr
R       0445aA  FF      00      dispatch
R       0445aB  FF      40      dispatch [32ea: 0040
R       0445aC  FF      05      page
R       0445aD  FF      cd      IntInput [32ea: 5-cdf6
R       0445aE  FF      f6      IntIn [32ea: 5-cdf6
R       0445aF  FF      CE      ldx#
R       0445b0  FF      B6      altTrain
R       0445b1  FF      09      altTrain [31ee]
R       0445b2  FF      3C      pshx   <-- common  [31ee: b5b2
R       0445b3  FF      30      tsx
R       0445b4  FF      EC      ldd
R       0445b5  FF      02      2,x
R       0445b6  FF      BD      jsr
R       0445b7  FF      04      burnWd
R       0445b8  FF      d9      burn [32ea: 04d9
R       0445b9  FF      38      pulx
R       0445bA  FF      38      pulx
R       0445bB  FF      39      rts
; 8-b5bc next free byte
; 4504
; 4504/114eq replacing DS-70  20xxx=3-f000 [30ed] 32ea:

R       21207   9d      f9    DS-70->4504msg [32ea:4-8207

R       209ef   02      03     900 FL [31e:3-f2b0 32:3-f9ef
R       209f0   bc      84   [31ee]
R       209fa   0f      12      4800_max_elev [32ea] (3-f9fa)
R       209fb   78      c0   [32ea]
R       20a05   fe      fd     -600_min_elev [32ea]  (3-fa05)
R       20a06   5c      a8   [32ea]
R       20a0e   03      08    3-f05a_branch [32ea]  (3-fa0e f2cf/d0/d1)
R       20a0f   f7     B5    3-f05a_branch  [32ea] 08-b5-bc 
R       20a10   99     bc    3-f05a_branch  [32ea: 08-b5-bc

; patch requires x4f bytes  ..from (32ea)8-b5bc..
R       0445bc   ff      3c  at   [32ea:8-b5bc
R       0445bd   ff      3c   pshx,pshx
R       0445be   ff      cc   ldd_03ca 4504 ratio  4.562963
R       0445bf   ff      03
R       0445c0   ff      CA
R       0445c1   ff      30   tsx
R       0445c2   ff      ed   std_2,x
R       0445c3   ff      02
R       0445c4   ff      cc   ldd_4092
R       0445c5   ff      40
R       0445c6   ff      92
R       0445c7   ff      ed   std_0,x
R       0445c8   ff      00
R       0445c9   ff      bd   dispatch [32ea: 0040
R       0445ca   ff      00
R       0445cb   ff      40   [32ea: 0040]
R       0445cc   ff      0a  setAzratio [32ea: a-8cbe
R       0445cd   ff      8c   [32ea: a-8cbe
R       0445ce   ff      be   [32ea: a-8cbe
R       0445cf   ff      cc   ldd_0194 4504 ratio=4.562693
R       0445d0   ff      01
R       0445d1   ff      94
R       0445d2   ff      30   tsx
R       0445d3   ff      ed   std_2,x
R       0445d4   ff      02
R       0445d5   ff      cc   ldd_4092
R       0445d6   ff      40
R       0445d7   ff      92
R       0445d8   ff      ed   std_0,x
R       0445d9   ff      00
R       0445da   ff      bd   dispatch  ([32ea: 0040
R       0445db   ff      00   [32ea: 0040
R       0445dc   ff      40   [32ea: 0040
R       0445dd   ff      0a   setALTratio [32ea: a-8cf3
R       0445de   ff      8c    [32ea: a-8cf3
R       0445df   ff      f3    [32ea: a-8cf3
R       0445e0   ff      cc   ldd_B73E_(status_bits)[31ee]
R       0445e1   ff      b7
R       0445e2   ff      3e
R       0445e3   ff      30   tsx
R       0445e4   ff      ed   std_0,x
R       0445e5   ff      00
R       0445e6   ff      f6   ldab_B73e [31ee]
R       0445e7   ff      b7
R       0445e8   ff      3e
R       0445e9   ff      ca   orab_x18_(GEM,Polar)
R       0445ea   ff      18
R       0445eb   ff      bd   jst_burn_Byte   ([32ea: 04ed
R       0445ec   ff      04   [32ea: 04ed
R       0445ed   ff      ed   [32ea: 04ed
R       0445ee   ff      cc   ldd_B73d_(more_status)
R       0445ef   ff      b7
R       0445f0   ff      3d   [31ee]
R       0445f1   ff      30   tsx
R       0445f2   ff      ed   std_0,x
R       0445f3   ff      00
R       0445f4   ff      f6   ldab_b73d [31ee]
R       0445f5   ff      b7
R       0445f6   ff      3d
R       0445f7   ff      ca    orab_x08_(cord_wrap)
R       0445f8   ff      08
R       0445f9   ff      bd   jsr burnByte (32ea: 04ed
R       0445fa   ff      04   [32ea: 04ed
R       0445fb   ff      ed   [32ea: 04ed
R       0445fc   ff      38   pulx
R       0445fd   ff      38   pulx
R       0445fe   ff      39   rts
; end of 4504 patch
; start of PeekPatch
;  at line immediately after "cmpb "R":
R 41090  26 7e   old: bne +3 ; jmp [32ea:8-8090 (41xxx
R 41091  03 ff   new: jmp {patch}  [32ea: 5-ff1c]
R 41092  7e 1c                     [32ea: 5-ff1c]

; R 30xxx  ff1c=65308  8-ff=48xxx
R	48F1C	ff	26	bne+3
R	48f1D	ff	3	
R	48f1E	ff	7e	jmp dc84 (:ER) 32:825a
R	48f1F	ff	82	  [32:825a
R	48f20	ff	5a	  [32:825a
R	48f21	ff	c1	cmp "P"
R	48f22	ff	50	
R	48f23	ff	27	beq+3
R	48f24	ff	3	
R	48f25	ff	7e	jmp dabf (:E??) [32:8095
R	48f26	ff	80	  [32:8095
R	48f27	ff	95	  [32:8095
R	48f28	ff	30	tsx
R	48f29	ff	ec	ldd 38,x
R	48f2A	ff	38	
R	48f2B	ff	c3	addd 3
R	48f2C	ff	0	
R	48f2D	ff	3	
R	48f2E	ff	bd	dispatch  [32:0040
R	48f2F	ff	00	 [32:0040
R	48f30	ff	40	 [32:0040
R	48f31	ff	5	   ParseNumericFPString [32:5-fb7b
R	48f32	ff	fb	 [32:5-fb7b
R	48f33	ff	7b	 [32:5-fb7b
R	48f34	ff	bd	jsr  Flt->Int32    [32:204B
R	48f35	ff	20	  [32:204B
R	48f36	ff	4b	  [32:204B
R	48f37	ff	30	tsx
R	48f38	ff	ee	ldx 2,x
R	48f39	ff	2	
R	48f3A	ff	ec	ldd 0,x
R	48f3B	ff	0	
R	48f3C	ff	30	tsx
R	48f3D	ff	bd	dispatch   Int16->rs32 [32: 5-b42b
R	48f3E	ff	00	 [32:0040
R	48f3F	ff	40	 [32:0040
R	48f40	ff	5	[32: 5-b42b
R	48f41	ff	b4	[32: 5-b42b
R	48f42	ff	2b	[32: 5-b42b
R	48f43	ff	7e	jmp dc7d (end of :EQ code)  [32:8253
R	48f44	ff	82	   [32:8253
R	48f45	ff	53	   [32:8253
;; end of 497 peek patch
; end of patch 32e4