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

  • Home
  • SEARCH
  • 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 8159321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:52:09+00:00 2026-06-06T17:52:09+00:00

List the SHORTEST POSSIBLE CODE (counting number of instructions) for making x, y, and

  • 0

List the SHORTEST POSSIBLE CODE (counting number of instructions) for making x, y, and z, defined as follows, get the value 1.
for an 80*86 machine

x:   dw   0xff00
y:   resb 1
z:   resw 1

edit:
I think the answer should be somethink like that:

MOV  DWORD [x+1], 0x01010001  ; 

;check:

mov eax , 0
mov al , byte[y]
print_d eax ; print 0

mov eax , 0
mov ax , word[x]
print_d eax ; print 256

mov eax , 0
mov ax , word[z]
print_d eax ; print 257 

but. it is not good…sholud print 1

  • 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-06-06T17:52:11+00:00Added an answer on June 6, 2026 at 5:52 pm

    Here’s the memory where your x, y and z are, listed as bytes (from lower addresses (x) to higher (z)):

    xx XX yy zz ZZ
    

    where xx is the least significant byte of x (0), XX is the most significant byte of x (0xFF) and likewise for y and z.

    If I understand it correctly, y and z aren’t initialized (res* hints NASM syntax for memory reservation keywords).

    So you want to transform this:

    00 FF yy zz ZZ
    

    into this:

    01 00 01 01 00
    

    Right?

    MOV DWORD [x+1], 0x01010001 will transform it into:

    00 01 00 01 01
    

    So, it’s not correct. And you need more than 1 instruction to change 5 bytes because 32-bit instructions write at most 4 bytes at a time.

    I’d say the shortest in terms of the number of instructions is 2 MOVs (NASM syntax):

    mov dword [x], 0x01010001
    mov byte [x+4], 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the shortest, one-liner way to list all methods defined with attr_accessor ? I
I am searching for the shortest way (in code) to initialize list of strings
List<MyClass> myclassList = (List<MyClass>) rs.get(); TreeSet<MyClass> myclassSet = new TreeSet<MyClass>(myclassList); I don't understand why
How to get the shortest path between 2 given nodes of a cyclic directed
Given String p and list of strings find the shortest string for which p
The challenge The shortest code by character count to output a best-case blackjack hand
I'm trying to make a shortest code for input with condition as much as
There are two lists of string List<string> A; List<string> B; What is the shortest
What's the shortest way to pass a list of BOOL's to a method in
How can I generate the shortest sequence with contains all possible permutations? Example: For

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.