The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

41CL Routine of the week: "YEDIT"
Message #1 Posted by 聲gel Martin on 16 May 2012, 2:21 a.m.

Not meaning to set a forced commitment but it'd be neat idea to share your favorite CL routine w/ the rest of the folks, no matter how simple it is, FOCAL, MCODE, all goes :-)

Preaching with the example, here's a short one that makes vieving the contects of RAM and FLASH a very easy affair.

Often I need to check for the right content of a given block, since I'm always moving stuff in RAM - and lately also in FLASH as I'm adding more modules and new versions of existing ones to the library. Using YPEEK is of course the way, but it's a bit tedious to remember the format and proper syntax so a little driver routine was in order.

Here it is, make sure you have the CLUTILS and the AMCOSX plugged (or the CCDOSX, or the original CCD for that matter). The only requirement is to make YINPT programmable - which it isn't in the posted versions. For that just change the first word in the MCODE from its current value 000 (NOP) to 260 (SETHEX), a good neutral byte.

01*	LBL "YEDIT"
02	YINPT
03	ASTO X
04	12
05	WSIZE
06	CLX
07	LBL 05
08	CLA
09	ARCL Y
10	ARCLH
11	"|- -8888"
12	YPEEK
13	PROMPT
14	E 
15	+
16	GTO 05
17	END

To use it, input the first three digits of the (HEX) address (a.k.a. block) at the "Y: _" prompt and hit R/S. All bytes values will be shown with each consecutive R/S action, increasing automatically.

To jump to another location within the same block, just input the offset from the current one in X (in decimal of course), press "+" to advance or "-" to back up, and resume with R/S to get there.

YEDIT is just a minimalistic routine to review the values, but will be easy to enhance it to also modify them using YPOKE, getting closer to a real editor. Anyone going for that?

Hope you enjoy it.

Note: if changing the NOP to HEXEDIT is not for you, just program the function using the XROM XX,NN while the CLUTILS is *not* plugged, then plug it before running it.

Edited: 16 May 2012, 7:44 a.m. after one or more responses were posted

      
Re: 41CL Routine of the week: "YEDIT"
Message #2 Posted by John W Kercheval on 16 May 2012, 6:19 a.m.,
in response to message #1 by 聲gel Martin

Is not YEDIT some sort of snow monster living in the high Himalayas???

            
Re: 41CL Routine of the week: "YEDIT"
Message #3 Posted by 聲gel Martin on 16 May 2012, 7:43 a.m.,
in response to message #2 by John W Kercheval

Well, yes if you're (like me) a bit dyslexic :-)

Edited: 16 May 2012, 1:51 p.m. after one or more responses were posted

                  
Re: 41CL Routine of the week: "YEDIT"
Message #4 Posted by M. Joury on 16 May 2012, 1:27 p.m.,
in response to message #3 by 聲gel Martin

Darn! You beat me to it!

LOL

Cheers,

-Marwan

      
Re: 41CL Routine of the week: "YEDIT"
Message #5 Posted by 聲gel Martin on 17 May 2012, 4:42 a.m.,
in response to message #1 by 聲gel Martin

ok, ok, by popular demand here愀 a possible extension that also writes to RAM using YPOKE. Note that it愀 also quite compact, but its usability is somehow limited: it obviously won't write to FLASH.

Also for RAM blocks mapped to the MMU (of course) you may rather use a proper HEX Editor, like HEXEDIT in the HEPAX or ROMED in the ToolBox4.

Anyway, FWIW here it is - the extended version now so you can pick your choice.

01*	LBL "YEDIT+"
02	YINPT
03	ASTO X
04	12
05	WSIZE
06	CLX
07	LBL 05
08	CLA
09	ARCL Y
10	ARCLH
11	"|- -8888"
12	YPEEK
13	AVIEW
14	Y/N?
15	X<0?
16	GTO 02
17	E 
18	+
19	GTO 05
20	LBL 02
21	YCL-
22	APPEND
23	YPOKE
24	GTO 05
25	END

Y/N? in line #14 is in the CLUTLS4H module. It expects a Yay/Nay response, it'll continue showing the next address if "Y" (or R/S), or will prompt for the new byte value if "N".

APPEND in line #22 is on the TBOX4 module as well. It's a nice alternative to PMTA that doesn't delete the "prompted" text. It'll be also possible to use YINPT there instead to remove the dependency.

It's a poor-man's version of an Editor but illustrates the point.

Cheers, 'AM

Edited: 17 May 2012, 4:54 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall