From: CW%APG.PH.UCL.AC.UK@pucc.PRINCETON.EDU Subject: Explorations of a wierd data type (HP48sx) Hi again, Well I've been playing around with the routine at 371Dh all weekend and it seems rather better than I imagined. So far I have tried it on i) Array of String (Varying length) ii) Array of Global Name (varying length) iii) Array of XLIB name iv) Array of System Binary v) Array of Real Array (Varying sizes and dimensions) PLUS vi) Arrays of mixed types!! (More later) and each time it is capable of correctly extracting the n'th object from an array. An example now follows of vi) above with an array that contains [ Array_of_Real Array_of_System_Binary Array_of_XLIB_name ] This will demonstate the abilities of the routine at 371Dh quite nicely. This array looks like this in memory ( as it would be viewed in the memory scanner (i.e. reversed)) 8E920 [ Array prolog 68000 Length of array in nybbles (inc these 5) 8E920 Here are 5 nybbles that dictate what is contained in the array In this case 029E8-> array of arrays 10000 Number of dimensions 30000 Number of points in that dimension (i.e. one dimensional array of three arrays) Then begins the first object without its header 93000 Length of 1st array in nybbles (inc these 5) 33920 Prolog of what is contained in this array (real numbers) 20000 Number of dimensions 20000 Number of numbers in first dimension 10000 Number of numbers in second dimension 0000000000000010 First real number (1) 0000000000000020 second real number (2) Then begins the second object without its header 91000 Length of this array in nybbles (inc these 5) 11920 Prolog of whats in this array (system binary) 10000 Number of dimensions 10000 Number of system binaries in that dimension (1x1) array 55555 The system Binary itself <55555h> Then begins the third object without its header 02000 29E20 Prolog of whats in this array (XLIB names) 10000 20000 B01000 XLIB 267 0 B01100 XLIB 267 1 If the 48sx was programmed to display this it would look something like, [ [[ 1 ] [ <55555h> ] [ XLIB 267 0 XLIB 267 1 ] ] [ 2 ]] but if you do (*this point is marked for further reference) "8E920680008E9201000030000930003392020000200001000000000000000000 10000000000000002091000119201000010000555550200029E201000020000B 01000B0110026CF" ASC-> (which is equivalent to putting the aforementioned array on the stack) you get 1: Array of Real Array but don't be put off! All the information is in there. Incase you didn't read my last posting I found that if I had the following on the stack 2: 1: Array of String (Where is a system binary i.e. <1h> <3d> etc....) And typed the following #371Dh SYSEVAL then the N'th string in the array would be extracted. And you get 2: "N'th string" 1: External where I am not sure what the external is (probably True or False for success or failure?). I have now found that it can be generalized further to if you have the following on the stack 1: 2: Array of Any Object and you type #371Dh SYSEVAL then the N'th Object of the array will be extracted. (When I say array of any object I am assuming it will work for any object although I've only tried it on the ones listed above, but I see no reason why it should not work on any object!!) So lets write a program called GET2 (typed in by hand). \<< R\->B #5A03h SYSEVAL @Binary to System Binary SWAP #371Dh SYSEVAL @Extract N'th object from array DROP @Get rid of external \>> So if you create the array mentioned above (see point marked for further reference above) then you can play with. I shall refer to it as ARRAY If you have ARRAY (it must be the array and NOT a local or global name specifying where it is stored) in level one of the stack the following can be done A) 1 GET2 produces 1: [[ 1 ] [ 2 ]] and then Ai) 1 GET2 produces 1: 1 or Ai) 2 GET2 produces 1: 2 B) 2 GET2 produces 1: Array of System Binary and then Bi) 1 GET2 produces 1: <55555h> C) 3 GET2 produces 1: Array of XLIB name and then Ci) 1 GET2 produces 1: XLIB 267 0 or Cii) 2 GET2 produces 1: XLIB 267 1 Which is what was stored in the array. Well I'll leave it there for the moments. If anybody finds an object it doesn't work on please let me know. As for a use for all of this: Hard to say! Mixed arrays are rather like lists, and so might not be necessary, and arrays of just one type of object might not be useful, but as Arthur C Clarke says (I think it was him), 'We are only limited by our imagination'. One final caveat This SEEMS to work for 2-dimensional arrays but you still only apply one number. eg if you have 1: [ [ 3 7 ] [ 4 5 ] ] then 1 GET2 gives 3, 2 GET2 gives 7, 3 GET2 gives 4, and 4 GET2 gives 5. Also the routine does check to see if an array has been passed to it and justs returns an external (probably a fail flag). Talk to you soon Conrad