Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1109559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:15:17+00:00 2026-05-17T02:15:17+00:00

For example: .text .align 2 .global main .equ val,0x4712 # 16-bit binary code for

  • 0

For example:

        .text
        .align 2
        .global main
        .equ val,0x4712         # 16-bit binary code for 0x4712: 0100 0111 0001 0010
                                # Program code starts now
main:                           # This label must be main:, not MAIN: 
        movi r16,val            # WHAT WOULD THIS LINE BE IN BINARY?
        movi r17,0
loop:   addi r17,r17,1
        subi r16,r16,1 
        bne  r16,r0,loop
stop:   br   stop
.end 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:15:18+00:00Added an answer on May 17, 2026 at 2:15 am

    You mean, by hand?

    By hand, you grab the instruction set sheet for your microprocessor, understand your addressing modes, and other data representation issues, and then convert that to something convenient, like a hexadecimal notation.

    Then you would need to get that information in to the devices memory, using some device specific process (file from disk, file from serial line, keyed in from a front panel with a bunch a switches).

    Obviously, there can be all sorts of tool chain issues that you’ll need to figure out to get your binary into a machine. If you’re just doing it for laughs, hexadecimal, a pencil, and a legal pad have suited many for years.

    Edit —

    You have to know several things.

    First, the op codes, and along with the op codes, you need to know the addressing modes.

    Consider this 6502:

    LDA #$00
    LDA $00
    LDA $1234
    

    Those are three different instructions on the 6502.

    The first loads the Accumulator (A) with $00, 0 in hex. The # symbol tells the assembler that you’re using the “immediate” addressing mode (the 6502 has 13 total addressing modes).

    The second load the Accumulator with the value of the memory location located at address $0000. On the 6502, it has a “zero page” mode, so it can more easily access memory from the first page of memory (addresses $0000-$00FF).

    The third loads the Accumulator with the value of the memory location located at address $1234. This is absolute addressing, simply specifying the actual address of the memory you are interested in.

    I highlight this example because, at a glance, all three of these look the same. But in truth, they all compile to 3 distinct instructions, or opcodes. So, it’s important to understand what your assembly is telling you so that you can select the correct opcode for your processor.

    Now, if you look at a opcode guide for the 6502, and look up the LDA instruction, you’ll see the different, binary values for each instruction.

    So, in this case you would get:

    $A9 $00
    $A5 $00
    $AD $12 $34
    

    That’s the binary (in hex) representation of those 3 instructions.

    The first, $A9, is for the “immediate” addressing mode, the second, $A5, for Zero Page addressing, and finally $AD for Absolute.

    Also note that following the operands, are the arguments. For the 6502, they just follow in the byte stream. Different processors do different things. Note, that for the Absolute, we have 2 bytes, $12 and $34, each representing half of the total, 16 bit address. I believe this is correct, that the Most Significant Byte of the address comes first, but it might be reversed ($A9 $34 $12).

    So, that’s the fundamental of assembling by hand.

    Other things to note are issues like what location the assembly will be loaded at. That will affect values for things like your labels.

    In 6502:

    label:  LDA #$00
            JMP label
    

    If your assembly is starting at the address $1000, this this will assemble to:

    $A9 $00
    $4C $10 $00
    

    If your assembly is starting at address $5555 then:

    $A9 $00
    $4C $55 $55
    

    See, the JMP (Jump) instruction ($4C) needs an address to jump to, and the label in your assembly is relative to its location in the program. Conveniently, in this case, the label is at the very beginning. But you can see how the address is coded in to the final machine code.

    6502 is EASY (really easy) assembly. Modern processors, well, aren’t. The modern assemblers do a lot of work for you, and you have more complicated CPUs with larger instruction sets, and things like alignment issues — these are all missing from the 6502. But as a hand assembler, you’re responsible for all of those nuances.

    Your microprocessor manual is supposed to tell you these nuances. But with the modern complicated CPUs, its likely non-trivial to do and learn.

    Don’t necessarily want to deter you from this, but be aware, it may well be a lot of work.

    But this is the essence of what you need to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to vertically align the text in a floated div? For example: I have
How to get text: Text example max from: <td valign=top align=left> <a href=/server?tree=xabaf class=normal>
Example: <style type=text/css> table { border: 1px solid red; border-collapse: collapse; text-align: left; }
I start with examples: Example 1 <p:dataTable> ... <p:column headerText=Actions style=text-align:center; width:100px;> <p:commandLink value=Delete
I have a string, for example: <div style='text-align:center;' otherattr=script> I want to allow specific
For Example - text = Československá obchodní banka; text string contains diacritics like Č
Can anybody help me with retrieving some elements from the following example text: sdfaasdflj
<div class=example>Some example text</div> <div class=example>Some more example text</div> How can I remove all
I have a string for example like :)text :)text:) :-) word :-( i need
PhoneGap - How to create a new file in assets/www/example/hallo.text my error is Error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.