Shop OBEX P1 Docs P2 Docs Learn Events
16-Bit operations in assembly — Parallax Forums

16-Bit operations in assembly

cbmeekscbmeeks Posts: 634
edited 2005-10-07 09:34 in General Discussion
Ok, I USED to know how to do this back in my 6502 days but I get very little asm time these days and I'm rusty..lol

Anyway, here is what I am trying to do.

I need to send a 16-bit address (15-bit, actually) to two ports.

I would like to do something like:

SET(512)        // now, RB = %00000000 and RC = %00000001
SET(16788)    //  now, RB = %00010100 and RC = %10000011
etc...




32768··RC
16384··RC
8192···RC
4096···RC
2048···RC
1024···RC
512····RC
256····RC
128····RB
64·····RB
32·····RB
16·····RB
8······RB
4······RB
2······RB
1······RB


Any clues where I can start?

Thanks!

cbmeeks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://metroidclassic.com

=========
DMCA Sucks
RIAA Sucks

Post Edited (cbmeeks) : 9/28/2005 1:58:31 PM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2005-09-28 14:06
    For constants use:

    Value EQU 512

    MOV RB,#(Value & 255)
    MOV RC,#(Value >> 8)

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • cbmeekscbmeeks Posts: 634
    edited 2005-09-28 14:20
    Thanks Bean! But I should have mentioned it would be dynamic....

    I need "Value" to loop from 0 to 32,767

    thanks

    cbmeeks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://metroidclassic.com

    =========
    DMCA Sucks
    RIAA Sucks
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-28 15:01
    If you already have a 16-bit value it exists as two bytes, so just copy them to the ports.

    MOV RB, #addrLo
    MOV RC, #addrHi

    Or am I missing something?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • cbmeekscbmeeks Posts: 634
    edited 2005-09-28 16:41
    hmm...maybe I am making it too difficult? Is it really that simple?

    So, I could:

    
    addr      ds    2             ; two bytes
    
    ;set addr = 2378
    MOV RB, #addr
    MOV RC, #addr+1
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://metroidclassic.com

    =========
    DMCA Sucks
    RIAA Sucks
  • BeanBean Posts: 8,129
    edited 2005-09-28 16:57
    Only without the "#"

    MOV RB,addr
    MOV RC,addr+1

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • nick bernardnick bernard Posts: 329
    edited 2005-09-28 17:04
    arent you just trying to slide a single bit across 2 output registers?

    if so wouldnt this work

    mov ra , #1
    clc
    loop
    rl ra
    rl re
    jmp loop

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • cbmeekscbmeeks Posts: 634
    edited 2005-09-28 18:45
    Bean (Hitt Consulting) said...
    Only without the "#"

    MOV RB,addr
    MOV RC,addr+1

    Bean.

    Dur...yeah, that looks better because I am moving the CONTENTS of addr...not the constant addr...lol
    nick bernard said...
    arent you just trying to slide a single bit across 2 output registers?

    if so wouldnt this work

    mov ra , #1
    clc
    loop
    rl ra
    rl re
    jmp loop

    What I am actually tring to do is read the contents of SRAM.

    I have built SRAM circuits that actually worked really well but my address bus was limited to 256 bytes (one port).
    So, two ports gives me 64k which is exactly the amount I need (actually, 32k for now).

    I am trying to make a PEEK and POKE command. :-D

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://metroidclassic.com

    =========
    DMCA Sucks
    RIAA Sucks
  • edited 2005-09-29 22:54
    Edit by the REAL Jon Williams

    That "other" post was from picomontoya@hotmail.com·at IP: 71.34.186.71 -- any of you that want to send him a , "Hey, that wasn't cool." note are welcome to do so.· We have changed his password, the avatar, and if he wants to play more games our IT staff are ready, happily willing, and extraordinarily able to fight back.

    Sorry, gang.

    Post Edited By Moderator (Jon Williams (Parallax)) : 9/29/2005 11:47:00 PM GMT
  • FreezeSukkaFreezeSukka Posts: 41
    edited 2005-09-29 23:12
    Whoever this is trying to impersonate Jon, it's not all that funny.

    Just from reading all of the posts on here, just about every day, I know for a fact that he's a damn good helper when it comes to this stuff...· (And I can't forget you as well BEAU!)· I noticed at the bottom of the screen when I logged on that the newest member was Jon Williams [noparse][[/noparse]Parallax] and thought it was sorta peculiar, so after looking, it shows only 1 post and the screen name was created today, as well as the tone in his post above was a little off-beat for him. (Unless you didn't Google first! But that's another story!) :-)

    ~Jeff

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    P.S. This is what this part of the alphabet would look like if "Q" and "R" were eliminated.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-09-29 23:19
    Yeah the "Total Posts: 1" sorta gives it away, totally uncool. Whoever you are, you should be banished from the forums permanently. Spoofing a person's identity is completely reprehensible, especially if your aim is to sully the reputation of a Parallax employee. They work hard to provide top notch customer service, and they dont need bleepity bleep bleeps like yourself screwing things up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-10-03 15:19
    No matter where you go, there you are.


    attachment.php?attachmentid=38998

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
    329 x 144 - 16K
  • knightofoldcodeknightofoldcode Posts: 233
    edited 2005-10-07 09:34
    Jon,

    I'd assume you changed his e-mail address on the fake Jon's account, seeing as how he could recover the changed password with the lost password feature. [noparse];)[/noparse]

    But I'm sure you already thought of that. [noparse];)[/noparse]

    Knight.
Sign In or Register to comment.