Prehistoric Times...

 

 

NOTE - Use your Browsers BACK Button to return to prior page or CLICK here.

   A Visit to Prehistoric Days...
dinoart.gif (12970 bytes) Dinosaurs walked the earth over 65 million years ago... I started writing SQR programs around 5 years ago... sometime in between I used Assembler... In this page you will find Dinosaurs, a Disassembler I wrote and an SQR routine to convert packed data to unpacked...

   Here's a scene from the Jurassic Era...

pndino00.jpg (68769 bytes)

   My Disassembler (Object Code Translater)...

td021a.jpg (84704 bytes)

This is a good learning tool for those learning Assembler or how the CPU interprets object code... The offset represents the current location in memory... The object code at location x'0000' is interpreted as a Store Multiple (STM) command which is 4 bytes in length... The full object code of the instruction is x'90ECD00C'... It is a Register-To-Storage instruction (RS)... The source code has been interpreted as STM 14,12,12(13)... Once a key is pressed (other than the listed function keys) the next instruction is interpreted... This will be at offset x'0004' (object code = x'18CF')... This is a Load Register instruction and the source will be interpreted as LR 12,15... Use the function keys to navigate to any portion of memory... The F10 Key will Step Thru 50 instructions at a time (for demonstration purposes)... For fun I created a version of this that writes each interpreted instruction to an output file... The file could then be assembled and executed to perform as the original version... Effectively it had become a self-generating program... sort of a 'Which came first? The dinosaur or the egg' scenario...
   Note:
I originally wrote this program to run under CICS (1990)... I modified it to work under a PC/DOS environment using PC/370 Version 4.2 (A DOS-Based 370 Assembler Emulator created by Donald Higgins)... MicroFocus bought the rights to the PC/370 package and is now a part of their 370 emulation series (COBOL, CICS, etc).
   Download the TD021 Object Code Translater...
ftdino01.jpg (3772 bytes) Click on the Brontosaurus to download the Object Code Translater components... The TD021.ZIP file contains TD021.COM along with the E370R42.EXE Run-Time Emulation Module. View the Source Code Below...
TD021.ALC Main Module - Object Code Translater Source
TDKEY.CPY Copybook - Keyboard Mapping
TDCLR.CPY Copybook - Color Mapping (Foreground/Background)

   SQR Routine - Converting Packed Data to Unpacked
dinonews.gif (8122 bytes) This Dinosaur is flipping thru his copy of 'SQR in PeopleSoft and Other Applications' by Galina and Vlad Landres... Have you gotten yours yet? Speaking of SQR, let's look at a routine to convert packed data to unpacked format... Read the SQC notes for more information...

   TDUNPK.SQC - Convert Packed Data to Unpacked
!**********************************************************************
!*                                                                    *
!*       MODULE:  TDUNPK.SQC                                          *
!*       AUTHOR:  TONY DELIA.                                         *
!*         DATE:  08/18/1999.                                         *
!*       SYSTEM:  TD SQR UTILITY SERIES.                              *
!*         DESC:  UNPACK STRING VARIABLE.                             *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*        USAGE:  PACKED TO UNPACKED FORMAT.                          *
!*                                                                    *
!*   EXAMPLE #1:  let $I_fld = '()*'                                  *
!*                do Unpack-String($I_fld, $O_fld, #O_amt, $O_ind)    *
!*                .                                                   *
!*   EXAMPLE #2:  let $I_fld = '()+'                                  *
!*                do Unpack-String($I_fld, $O_fld, #O_amt, $O_ind)    *
!*                .                                                   *
!*   EXAMPLE #3:  let $I_fld = 'Hello'                                *
!*                do Unpack-String($I_fld, $O_fld, #O_amt, $O_ind)    *
!*                .                                                   *
!*   EXAMPLE #4:  let $I_fld = 'Goodbye'                              *
!*                do Unpack-String($I_fld, $O_fld, #O_amt, $O_ind)    *
!*                .                                                   *
!*   EXAMPLE #5:  let $I_fld = '0123456789:'                          *
!*                do Unpack-String($I_fld, $O_fld, #O_amt, $O_ind)    *
!*                .                                                   *
!*                .                                                   *
!*                .                                                   *
!*                #Include 'tdunpk.sqc'                               *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*      RESULTS:                                                      *
!*                                                                    *
!*      EXAMPLE   $O_fld                      #O_amt    $O_ind        *
!*      =======   ================            ======    ======        *
!*           #1   '28292A'                     28292    'Y'           *
!*           #2   '28292B'                    -28292    'Y'           *
!*           #3   '48656C6C6F'                     0    'N'           *
!*           #4   '476F6F64627965'                 0    'N'           *
!*           #5   '303132333435363738393A'         0    'N'           *
!*                                                                    *
!*        NOTE:   #5 failed numeric validation because of variable    *
!*                length. Packed numeric data cannot exceed 8 bytes   *
!*                (which yields 15 or 16 unpacked bytes depending if  *
!*                it's packed-signed or packed-unsigned).             *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*         PASS:  $I_fld  => Input String (Assumed Packed)            *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*      RETURNS:  $O_fld  => Unpacked Hex Representation              *
!*                #O_amt  => Signed Numeric Value (or zero)           *
!*                $O_ind  => Valid Numeric Indicator (Y/N)            *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*        LEGAL:  CONFIDENTIALITY INFORMATION.                        *
!*                                                                    *
!*                This module is the original work of Tony DeLia. It  *
!*                can be considered ShareWare under the following     *
!*                conditions.                                         *
!*                                                                    *
!*                A - The author's name (Tony DeLia) remains on any   *
!*                    and all versions of this module.                *
!*                B - Any modifications must be clearly identified.   *
!*                C - A "vanilla" copy of this module must be kept    *
!*                    alongside any revised versions.                 *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*      WEBSITE:  http://www.sqrtools.com                             *
!*                                                                    *
!*                Questions/Comments: tdelia@erols.com                *
!*                                                                    *
!**********************************************************************

!**********************************************************************
!*       Unpack String Variable                                       *
!**********************************************************************

begin-procedure Unpack-String($I_fld, :$O_fld, :#O_amt, :$O_ind)

let #O_amt       = ''
let $O_fld       = ''
let $O_ind       = 'N'

let #err         = 0
let #len         = length($I_fld)
let #pos         = 1

let $hex_val     = '0123456789ABCDEF'
let $sgn_val     = '...........-.-..'

while #pos      <= #len

   let #ascii    = ascii(substr($I_fld, #pos, 1))
   let #hi       = floor(#ascii/16)
   let #lo       = mod(#ascii,16)

   let $hi       = substr($hex_val, #hi + 1, 1)
   let $lo       = substr($hex_val, #lo + 1, 1)

   let $O_fld    = $O_fld || $hi || $lo

   !   Validate hi-order digit (1st 4-bits)
   if  #hi       > 9
       let #err  = #err + 1
   end-if

   !   Validate lo-order digit (2nd 4-bits)
   if  #lo       > 9
   and #pos      < #len
       let #err  = #err + 1
   end-if

   let #pos      = #pos + 1

end-while

!  If numeric validation passed convert to signed-numeric variable

if  #err  = 0
and #len <= 8

    let #ptr       = #len * 2
    if  #lo        > 9
        let #ptr   = #ptr - 1
    end-if

    let #O_amt     = to_number(substr($O_fld, 1, #ptr))

    !   Last 4-bits of string determine sign
    if  substr($sgn_val, #lo + 1, 1) = '-'
        let #O_amt = #O_amt * -1
    end-if

    let $O_ind     = 'Y'

end-if

end-procedure

!**********************************************************************
!*       End of Program                                               *
!**********************************************************************
                                                                                                        

   Another Prehistoric Scene... long after the Dinosaur Age...

pnpreh01.jpg (77969 bytes)

   Feedback
ftoct01.jpg (12389 bytes) I would appreciate any feedback you may have on this site. Send mail to tdelia@erols.com or click on the Octopus.

Tony DeLia - Updated August 19, 1999