[comp.sys.handhelds] POKE Routine Rewritten

n023el@tamuts.tamu.edu (Robert Ellis) (07/10/90)

I am posting this for Rick Grevelle whom is unable to do so at this
time. 
----------------------------------------------------------------------

>From n233dk Mon Jul 09 08:08:29 1990 
Return-Path: <n233dk>
Received: by tamuts.tamu.edu (/\../\ Smail3.1.14.4 #14.2)
	id <m0hfj5N-00001gC@tamuts.tamu.edu>; Mon, 09 Jul 90 08:08 CDT
Message-Id: <m0hfj5N-00001gC@tamuts.tamu.edu>
Date: Mon, 09 Jul 90 08:08 CDT 
From: n233dk (Rick Grevelle)
To: n023el


I have recently become unhappy with the POKE routine. I hate having to
constantly manipulate the wordsize to poke data less than 16 nibbles.
The most annoying thing about this is the display routines in the 28
display binary integers according to the current wordsize instead of 
their actual size. Furthermore, POKE does no argument checking and
must depend on key word programming for this as well. 

I would prefer to use a POKE routine that was independent of wordsize,
and would check each argument it takes from the stack. The following
is a disassembly, using Alonzo Gariepy's mnemonics, of a POKE that 
will do this. 



#00000: 132       swap.a     a,d0 
#00003: 103       move.w     a,r3 
#00006: 7430      call.3     #0003E  
#0000A: 10A       move.w     c,r2 
#0000D: 7D20      call.3     #0003E 
#00011: 109       move.w     c,r1 
#00014: 7620      call.3     #0003E 
#00018: AFA       move.w     c,a 
#0001B: 119       move.w     r1,c 
#0001E: 134       move.a     c,d0 
#00021: 11A       move.w     r2,c 
#00024: 80D0      move.1     c,0,p 
#00028: 1501      move.wp    a,@d0 
#0002C: 20        move.1     0,p 
#0002E: 113       move.w     r3,a 
#00031: 132       swap.a     a,d0 
#00034: 142       move.a     @d0,a
#00037: 164       add.a      5,d0 
#0003A: 808C      move.a     @a,pc 
#0003E: 143       move.a     @d1,a 
#00041: 130       move.a     a,d0 
#00044: 142       move.a     @d0,a 
#00047: 3407A20   move.p5    #02A70,c  
#0004E: 8A6DD     brne.a     c,a,#0002E 
#00053: 169       add.a      10,d0 
#00056: 146       move.a     @d0,c 
#00059: 174       add.a      5,d1 
#0005C: E7        inc.a      d 
#0005E: 01        ret


To use this POKE, place the data to be poked in level 3, the address to be poked
in level 2, and the number of nibbles being poked in level 1.  All three levels
must be binary numbers. The binary value in level 1 will need to correspond to 
the position of the nibble(s) being poked.  

+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 
| 15| 14| 13| 12| 11| 10| 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

For example, #4h in level 1 will poke the five nibbles 0-4. I prefer
this because it is in terms of the sixteen nibble fields used by the
routine. If this is a problem, the following program will hopefully
solve it.  

This program, CPOKE, will create POKE which will use an integer (1-16)
taken from level 1, and do the necessary conversion.


CPEEK

<<
    <<  1  -  R->B  A  >>  5 

        # 2D7A010347301231h

        # 31911AFA02679010h

        # 110210510D08A114h

        # 41C8084612412313h

        # A802A70432410313h

        # 107E471641961DD6h

  1  5  START  # 3B82  SYSEVAL  NEXT

        # 7195h  SYSEVAL

        # 44A4h  SYSEVAL

        # 7F77h  SYSEVAL
        
        # 3F41h  SYSEVAL

        # 3EEBh  SYSEVAL

          'POKE'  STO        >>



After I recieve shipment of my 48 I'll post a version for it too.
(for those who are unable to download to thier calculators)

                                      Rick