home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / Geneve / 9640news / CAT15 / GPLMG.ARK < prev    next >
Text File  |  2006-10-19  |  8KB  |  145 lines

  1. ?
  2.                       A LITTLE INTRODUCTION TO GPL CODE
  3.                                By Craig Miller
  4.  
  5.  
  6. We thought you might like to see what a powerful and COMPACT language GPL code
  7. is. With  the GRAM  KRACKER and  a   GPL  Assembler you  will be able to write
  8. programs that  can reside in  the Module space  and will be  displayed on your
  9. Main Menu as a selection. GPL can also link to Assembly and BASIC programs! So
  10. you will have FULL use of the THREE built-in languages  in our 4As (Basic, GPL
  11. and Assembly).  Eat your hearts  out all you  Atari, Commodore, IBM  and other
  12. computer owners!
  13.  
  14. *----------------------------------------------------------------------------*
  15.            * Disassembly of part of the Editor/Assembler Module *
  16.                     * Starting at Grom >6069 thru >6132 *
  17. *----------------------------------------------------------------------------*
  18.  
  19. >6069  MOVE  7 FROM G@REGDAT TO VR01       Load the Vdp registers
  20.  
  21.        CALL  CHKMEM                        Go check for memory expansion and
  22.                                            load the (C) character data
  23.  
  24.        MOVE  16 FROM G@CURSOR TO V@>08F0   Load the box and solid cursor data
  25.  
  26. * Put up the first Menu Screen
  27.  
  28.        ST    >7E,@SUBSTK               Initialize the Sub Return stack pointer
  29.        DCLR  @ERRCODE                  Zero out A/L Error Code indicator
  30.        DCLR  @GROMFLG                  Zero the Grom Flag
  31.        ALL   SPACE                     Clear the screen with space characters
  32.  
  33.        FMT                             Start formatted screen output
  34.        ROW   2                         At row 2
  35.        COL   1                         At column 1 (note 0,0 is home position)
  36.        HTEXT '* EDITOR/ASSEMBLER * '   Put up horizontal text
  37.        ROW+  2                         At current row plus 2
  38.        COL   1                         At column 1
  39.        HTEXT 'PRESS:'                  .
  40.        ROW+  2                         .
  41.        COL   2                         .
  42.        HTEXT '1 TO EDIT'               .  etc.
  43.        ROW+  2                         Note: VTEXT, HCHAR, VCHAR are also
  44.        COL   2                         allowed in a FMT, so is
  45.        HTEXT '2    ASSEMBLE'           FOR xx - where xx equals
  46.        ROW+  2                         the repeat loop counter
  47.        COL   2
  48.        HTEXT '3    LOAD AND RUN'
  49.        ROW+  2
  50.        COL   2
  51.        HTEXT '4    RUN'
  52.        ROW+  2
  53.        COL   2
  54.        HTEXT '5    RUN PROGRAM FILE'
  55.        ROW+  6
  56.        COL   2
  57.        HTEXT >0A                       >0A is the (C) character
  58.        HTEXT '1981 TEXAS INSTRUMENTS'
  59.        FEND                            End the formatted screen output
  60.  
  61. GETKY  SCAN                            Scan the keyboard for a key press
  62.        BR    GETKY                     BR (Branch on Reset) no NEW key pressed
  63.        CEQ   FCTN9,@KEY                Was FCTN 9 (Back) Pressed
  64.        BR    GETKY1                    NO! check the other keys
  65.        EXIT                            YES! Execute the Power Up routine
  66. GETKY1 SUB   >31,@KEY                  Subtract >31 from the keycode (0 - ?)
  67.        CHE   >05,@KEY                  If its now Higher than 4 - wrong key
  68.        BS    GETKY                     So, go wait for another key press
  69.  
  70.        CASE  @KEY                      Otherwise if @KEY equals
  71.  
  72.        BR    EDIT                      0 - goto Edit Menu
  73.        BR    ASSEM                     1 - goto Load Assembler Prompt
  74.        BR    LODRUN                    2 - goto Load and Run prompt
  75.        BR    RUN                       3 - goto Run Program prompt
  76.        BR    RUNPRG                    4 - goto Run Program File prompt
  77.  
  78. Notes: -----------------------------------------------------------------------
  79.  
  80. The above code only  requires 202 bytes of memory and  that includes 119 bytes
  81. of  text! So  that means  the actual  instruction code  only uses  83 bytes of
  82. memory! There  isn't another  language available  for our  99/4As that is this
  83. COMPACT  as GPL. And, when compared to  Assembly, it is much easier to program
  84. in. This  is THE  Language that  TI should  have released  to us  in the first
  85. place!
  86.  
  87. 1. Most  instructions can  work with  bytes or  words. The  D in  front of  an
  88.    instruction  indicates a word operation. The first operand to is SOURCE and
  89.    the  second is the DESTINATION. ie: ST  >03,@TEMP1 stores one byte with the
  90.    value of 3 into location TEMP1.
  91. 2. The COND bit in the GPL Status register (>837C) is turned ON if the test is
  92.    TRUE and OFF when FALSE. It is  also turned on when a NEW key is pressed on
  93.    a keyboard scan or when the result of certain instructions is zero.
  94. 3. BR  =  Branch  On  Reset...  or  Branch  if  the COND bit in the GPL Status
  95.    register is OFF
  96. 4. BS  =  Branch  On  Set.....  or  Branch  if  the COND bit in the GPL Status
  97.    register is ON
  98. 5. CASE is like ON X GOTO ..... except it starts at zero instead of 1
  99.    (Note: the COND bit is always turned OFF (reset) for a CASE or DCASE)
  100. 6. A CALL works like a GOSUB or Assembly's BL (Branch and Link)
  101. 7. 'ALL'  fills  the  screen  with   the  one  byte  character  following  the
  102.    instruction. (That's right only 2 bytes to clear the screen!!!!)
  103. 8. MOVE is a very powerful  GPL instruction. With it you can MOVE  x number of
  104.    bytes FROM any type of memory TO any type of memory You can also move bytes
  105.    to the VDP  Registers! The MOVE instruction only requires  6 to 7 bytes for
  106.    its object code!
  107. 9. SCAN only requires 1 byte of object code!!! (SCAN = >03)
  108.  
  109. Speed Test: ------------------------------------------------------------------
  110.  
  111. We ran the old 1  to 10,000 timing test in  GPL to see how it  compares to the
  112. other languages and here is how it came out.
  113.  
  114. 1. In an incrementing loop with a DCEQ (double Compare Equal) 6.8 seconds.
  115. 2. In a decrementing loop (no compare just BR (not zero)) 4.3 seconds.
  116.  
  117. As we have seen from previous tests this places third on the list.
  118.  
  119.                    1.  Assembly - well under .5 second
  120.                    2.  Forth    - approx 1.3 seconds
  121.                    3.  GPL      - 4.3 to 6.8 seconds
  122.                    4.  Pascal   - I think this is where it falls
  123.                    4.  XB       - 33.9 seconds
  124.                    5.  Basic    - weeks          (just kidding)
  125.  
  126. Since  its not as fast as Assembly or  Forth you are probably wondering why we
  127. are so  excited about GPL?! True, a CRAY 3  its not. However, it requires LESS
  128. THAN one half the space of Assembly code! With the Gram Kracker you have up to
  129. 58K of GPL  program space (with 6K  reserved for the Operating  System), which
  130. would require AT LEAST 116K of Assembly  code. This still leaves ALL of memory
  131. expansion  free plus  the 16K  of cartridge  RAM free  for other things or for
  132. Assembly routines for your GPL programs  to link to (another 48K). That  gives
  133. us a TOTAL program space of 106K plus 16K of VDP Ram for a total of 122K (128K
  134. with  the  Operating  System  area).  Also  with  GPL you can EXPAND or modify
  135. existing Modules. And,  last but certainly  not least, GPL  is the controlling
  136. language for  our 4As,  so now  you make  it do  most anything you want! Start
  137. thinking about those changes you've wanted to  make for the last 6 years, your
  138. chance is coming!!!
  139. (Hmmmmm, lets see, a cold boot of an Assembly, GPL, Forth, XB or Basic program
  140. that would ........................)
  141.  
  142. Download complete.  Turn off Capture File.
  143.  
  144.  
  145.