; 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      201ca    27      20      cordwrap [ 32eh:
R      202aa    26      21      cordwrap [ 32eh
R      201ce    17      23      chksum   cordwrap [ 32eh

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

R      484f9  bd      20      (-9d)      AutoTrack  [ 32eh
R      484fa  00      21      (+21)=-7c  AutoTrack  [ 32eh
R      484fc  05      81      (chksum) 7c+5  AutoStart  [ 32eah

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

;
; Skip-date/time/daylight:   v32eh
; **WARNING: This optional patch should not be used with StarGPS 
;   removing semicolons totally skips time/date/daylight prompt at startup.
; R 29b6b   bd  7e   ; jmp to after time/date/daylight  32eh: (29xxx) 5-8b6b
; R 29b6c   00  8b   ; jmp   ->8bC6
; R 29b6d   40  C6   ; 
; R 29b6f   e8  16   ; checksum (xfd->x1cf)=d2 adjust, e8-d2=16
;

;  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 32h4"
;  "Have fun" (tm) -- Dick Seymour   23-Aug-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  32eh:

;
R       0004    73      f6       chksum  [32
R       0005    29      b0       chksum
R       0006    95      94      ;chksum
;R       0007    07      07 

R       000A    45      68      (E->h) [32Ea] version
R       0142FE  45      68      (32fe) [32Ea] version
R       000b    68      34      (a->4) [32Ea] version 32a4
R       0142Ff  68      34      (32ff) [32Ea] version
;=================================
; automatic menu patches v32eh
R      13CDA    2C    2C     CityDwn to Street
R      13CDB    F6    C6     CityDwn to Street

R      13CCC    2C    2C     StrtUp to City
R      13CCD    E6    D6     StrtUp to City

R      13CE6    02    02     ZipAddr->Tr Drv msg
R      13CE7    CA    AF     ZipAddr->Tr Drv msg
R      13CE8    02    01     Zip->AzTrnMsg(postal)
R      13CE9    CE    7e     Zip->AzTrnMsg(postal)
R      13CEC    2C    2B     Zip(AzEd) up to AltTrn
R      13CED    F6    86     Zip(AzEd) up to AltTrn
R      13CEE    2C    2B     ZipMode to TrnDrvs
R      13CEF    B6    16     ZipMode to TrnDrvs
R      13CF3    04    8      action page to Patch page
R      13CF4    DA    b5     ZipAct adr to Ptch adr
R      13CF5    7D    5d     ZipAct adr to Ptch adr

R      13B8A    2B    2C     AltTrnDwn to AzEd/Zip
R      13B8B    76    E6     AltTrnDwn to AzEd/Zip

R      13CF6    02    02     StateAddr->Tr Drv msg
R      13CF7    CA    AF     StateAddr->Tr Dev msg
R      13CF8    02     1     State->AltTrnMsg(DoB)
R      13CF9    CD    7F     State->AltTrnMsg(DoB)
R      13CFA    2C    2B     SteDwn to AzTrn
R      13CFB    E6    76     SteDwn to AzTrn
R      13CFC    2C    2C     SteUp to Zip(AzEd)
R      13CFD    D6    E6     SteUp to Zip(AzEd)
R      13CFE    2C    2B     SteMode to TrnDrvs
R      13CFF    B6    16     SteMode to TrnDrvs
R      13D03    04    8      action page to Patch page
R      13D04    DA    b5     act adr to Patch adr
R      13D05    36    89     act adr to Patch adr

R      13B7C    2B    2C      AzTrnUp to AltEdit/State
R      13B7D    86    F6      AzTrnUp to AltEdit

R      13CEA    2C    2C     Zip(AzEdit)dn->State(AltEdit)
R      13CEB    C6    F6     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 [32eh: 07f5 
R       044560  FF      f5      clrscrn [32eh: 07f5
R       044561  FF      FC      ldd
R       044562  FF      B6      azTrain  
R       044563  FF      0B      azTrain  [32eh: 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: 32eh: 017e
R       044569  FF      7e      az     [Postal: 32eh: 017e
R       04456a  FF      BD      jsr
R       04456b  FF      00      dispatch
R       04456c  FF      40      dispatch [32eh: 0040
R       04456d  FF      0a      page
R       04456e  FF      81      d->msg [[32eh: a-8113
R       04456f  FF      13      d->msg [[32eh: a-8113]
R       044570  FF      BD      jsr
R       044571  FF      08      msg->scrn [32eh: 0825
R       044572  FF      25      msg->scrn [32eh: 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 [32eh: 07a9
R       044579  FF      a9      cursor [32eh: 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 [32eh: 0040
R       044580  FF      05      page
R       044581  FF      cd      IntegerInput [32eh: 5-cdf6
R       044582  FF      f6      IntegerInput [32eh: 5-cdf6
R       044583  FF      CE      ldx#
R       044584  FF      B6      azTrain
R       044585  FF      0B      azTrain [32eh]
; 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 [8-b589]
R       044589  FF      3C      pshx
R       04458A  FF      BD      jsr
R       04458B  FF      07      clrscrn [32eh: 07f5
R       04458C  FF      f5      clrscrn [32eh: 07f5
R       04458D  FF      FC      ldd
R       04458E  FF      B6      altTrain
R       04458F  FF      09      altTrain [332eh
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 [32eh: (DoB)17f
R       044596  FF      BD      jsr
R       044597  FF      00      dispatch
R       044598  FF      40      dispatch [32eh: 0040
R       044599  FF      0a      page
R       04459A  FF      81      d->msg [[32eh: a-8113
R       04459B  FF      13      msg [[32eh: a-8113]
R       04459C  FF      BD      jsr
R       04459D  FF      08      d->scrn [32eh: 0825
R       04459E  FF      25      scr [32eh: 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 [32eh: 07a9
R       0445a5  FF      a9      curs  [32eh: 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 [32eh: 0040
R       0445aC  FF      05      page
R       0445aD  FF      cd      IntInput [32eh: 5-cdf6
R       0445aE  FF      f6      IntIn [32eh: 5-cdf6
R       0445aF  FF      CE      ldx#
R       0445b0  FF      B6      altTrain
R       0445b1  FF      09      altTrain [32eh]
R       0445b2  FF      3C      pshx   <-- common  [32eh: 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 [32eh: 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 [32eh:

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

R       209eb   02      03     900 FL [32:3-f9ef h:eb
R       209ec   bc      84   [32eh]
R       209f6   0f      12      4800_max_elev [32eh] (3-f9fa)h:f6
R       209f7   78      c0   [32eh]
R       20a01   fe      fd     -600_min_elev [32eh]  (3-fa05)h:01
R       20a02   5c      a8   [32eh]
R       20a0a   03      08    3-f05a_branch [32eh]  (3-fa0a f2cf/d0/d1)
R       20a0b   f7     B5    3-f05a_branch  [32eh] 08-b5-bc 
R       20a0c   95     bc    3-f05a_branch  [32eh: 08-b5-bc

; patch requires x4f bytes  ..from (32eh)8-b5bc..
R       0445bc   ff      3c  at   [32eh: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 [32eh: 0040
R       0445ca   ff      00
R       0445cb   ff      40   [32eh: 0040]
R       0445cc   ff      0a  setAzratio [32eh: a-8cbc
R       0445cd   ff      8c   [32eh: a-8cbc
R       0445ce   ff      bc   [32eh: a-8cbc
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  ([32eh: 0040
R       0445db   ff      00   [32eh: 0040
R       0445dc   ff      40   [32eh: 0040
R       0445dd   ff      0a   setALTratio [32eh: a-8cf1
R       0445de   ff      8c    [32eh: a-8cf1
R       0445df   ff      f1    [32eh: a-8cf1
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   ([32eh: 04ed
R       0445ec   ff      04   [32eh: 04ed
R       0445ed   ff      ed   [32eh: 04ed
R       0445ee   ff      cc   ldd_B73d_(more_status)
R       0445ef   ff      b7
R       0445f0   ff      3d   [32eh]
R       0445f1   ff      30   tsx
R       0445f2   ff      ed   std_0,x
R       0445f3   ff      00
R       0445f4   ff      f6   ldab_b73d [32eh]
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 (32eh: 04ed
R       0445fa   ff      04   [32eh: 04ed
R       0445fb   ff      ed   [32eh: 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 410ac  26 7e   old: bne +3 ; jmp [32eh:8-808c (41xxx 32eh:8-80ac
R 410ad  03 ff   new: jmp {patch}  [32eh: 8-ff1c]
R 410ae  7e 1c                     [32eh: 8-ff1c]

; R 30xxx  ff1c=65308  8-ff=48xxx
R	48F1C	ff	26	bne+3
R	48f1D	ff	3	
R	48f1E	ff	7e	jmp (:ER) 32a:825a 32h:8276
R	48f1F	ff	82	  [32:8276
R	48f20	ff	76	  [32:8276
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 (:E??) [32:8095 32h:80b1
R	48f26	ff	80	  [32:80b1
R	48f27	ff	b1	  [32:80b1
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 [32h:5-fba5
R	48f32	ff	fb	 [32:5-fba5
R	48f33	ff	a5	 [32:5-fba5
R	48f34	ff	bd	jsr  Flt->Int32    [32:204B h:200a
R	48f35	ff	20	  [32:200a
R	48f36	ff	0a	  [32:200a
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 [32h: 5-b446
R	48f3E	ff	00	 [32:0040
R	48f3F	ff	40	 [32:0040
R	48f40	ff	5	[32: 5-b446
R	48f41	ff	b4	[32: 5-b446
R	48f42	ff	46	[32: 5-b446
R	48f43	ff	7e	jmp dc7d (end of :EQ code)  [32h:826f
R	48f44	ff	82	   [32:826f
R	48f45	ff	6f	   [32:826f
;; end of 497 peek patch
; end of patch 32h4