Shop OBEX P1 Docs P2 Docs Learn Events
code help — Parallax Forums

code help

ArchiverArchiver Posts: 46,084
edited 2003-05-23 16:07 in General Discussion
My assembler hangs at the 'GETABS' line in the following example code.
Any suggestions on how I might best reprogram that line?


MANT1 RMB 2
EXP1 RMB 1
MANT2 RMB 2
EXP2 RMB 1
*
GETABS BCLR MANT2,$80
LDD MANT1
ANDA #$7F
RTS

What about:

GETABS LDD MANT2
andd #$8000
std mant2
LDD MANT1
ANDA #$7F
RTS


thanks,


Ronnie

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-05-23 15:31
    I am using a 4X4 keypad and I am needing a way to set a counter
    or variable within the stamp program. For the keypad I am using
    the lookup function for each of the 4 sets of keys and this works
    good. What I am wanting to be able to do is shift the digits of a
    variable and set the next digit in place. Example say you want to
    type and set the variable to 1500 press key 1 and then press 5 the
    one shifts one place to left and 5 inserts itself. Here is the code I
    am using I am sure their is room for improvement. I am using a
    74hc595 and 74hc165 to set the inputs for the keypad. Here is the
    code I am using can anyone help me around this.

    Thanks
    Mark W.

    '{$STAMP BS2sx}
    dis1 var byte
    keyp var byte
    result var byte
    counter1 var word

    keyp1 con 250




    reset
    dis1=%11101111

    start


    dis1=dis1>>%1
    if dis1=%00000111 then reset

    shiftout 10,12,1,[noparse][[/noparse]dis1]
    high 11
    pause 5
    low 11

    if dis1=14 then row1
    if dis1=29 then row2
    if dis1=59 then row3
    if dis1=119 then row4


    goto start

    row1
    high 15
    shiftin 13,14,3,[noparse][[/noparse]result]
    low 15

    result=result-%10000000
    result=result>>3

    if result=15 then start
    lookup result,[noparse][[/noparse]0,0,0,0,0,0,0,1,0,0,0,2,0,3,99],keyp

    pause keyp1

    debug dec keyp
    goto start

    row2
    high 15
    shiftin 13,14,3,[noparse][[/noparse]result]
    low 15

    result=result-%10000000
    result=result>>3

    if result=15 then start
    lookup result,[noparse][[/noparse]0,0,0,0,0,0,0,4,0,0,0,5,0,6,66],keyp

    pause keyp1

    debug dec keyp
    goto start

    row3
    high 15
    shiftin 13,14,3,[noparse][[/noparse]result]
    low 15

    result=result-%10000000
    result=result>>3

    if result=15 then start
    lookup result,[noparse][[/noparse]0,0,0,0,0,0,0,7,0,0,0,8,0,9,22],keyp

    pause keyp1

    debug dec keyp
    goto start

    row4
    high 15
    shiftin 13,14,3,[noparse][[/noparse]result]
    low 15

    result=result-%10000000
    result=result>>3

    if result=15 then start
    lookup
    result,[noparse][[/noparse]0,0,0,0,0,0,0,300,0,0,0,0,0,999,1000],keyp

    pause keyp1

    debug dec keyp
    goto start



    Thanks
    Mark Waddell
    Stueken LLC
    137 Southchase Blvd.
    Foutain Inn SC 29644
    Phone 864-862-0612 ext. 19
    Fax 864-862-0614
    Email: mwaddell@s...
  • ArchiverArchiver Posts: 46,084
    edited 2003-05-23 16:07
    This process is not difficult -- we just have to remember that shifting left
    with decimal numbers is a matter of multiplying your current result by ten,
    then adding the new digit. If you have "back" key on your keyboard, you can
    employ it by dividing your current value by 10.

    -- Jon Williams
    -- Parallax


    In a message dated 5/23/2003 9:31:58 AM Central Standard Time,
    mwaddell@s... writes:

    > I am using a 4X4 keypad and I am needing a way to set a counter
    > or variable within the stamp program. For the keypad I am using
    > the lookup function for each of the 4 sets of keys and this works
    > good. What I am wanting to be able to do is shift the digits of a
    > variable and set the next digit in place. Example say you want to
    > type and set the variable to 1500 press key 1 and then press 5 the
    > one shifts one place to left and 5 inserts itself. Here is the code I
    > am using I am sure their is room for improvement. I am using a
    > 74hc595 and 74hc165 to set the inputs for the keypad. Here is the
    > code I am using can anyone help me around this.
    >
    > Thanks
    > Mark W.



    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.