954,490 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

What is wrong with the code

001 BITS 16
002 segment myStack stack
003 resb 0100h
004
005 segment myData data
006 somedata db 10101100b
007
008 segment myCode code
009
00A dothingstobx:
00B push ax
00C mov ax, 56h
00D add word ax, bx
00E or bx, ax
00F ret
010
011 ..start:
012 mov ax,myData
013 mov ds,ax
014 mov ah,1
015 int 21h
016 mov byte bl, al
017 mov byte bh, [somedata]
018 call dothingstobx
019 mov word ax,4c00h
01A int 21
01B .end

Joonas
Newbie Poster
5 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

Well you didn't read this - http://www.daniweb.com/forums/announcement125-3.html

And you didn't say which assembler (nasm,tasm,masm,?asm) you're using. Do you get any error messages perchance?

Nor did you say what you want it to do, nor what it does (or doesn't) do instead.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

The following simple program contains two rather fatal errors: one is a missing instruction, and the other a wrongly written instruction. Please find them both and give corrections!

The wrongly written instruction: this is not a syntax error, this code would compile. Look for the error in the meaning of values.

It was not said, what the code should do... I tried to figure it out but i didn't understand. It is possible that it doesn't do anything meaningful.

001 BITS 16
002 segment myStack stack
003 resb 0100h
004
005 segment myData data
006 somedata db 10101100b
007
008 segment myCode code
009
00A dothingstobx:
00B push ax
00C mov ax, 56h
00D add word ax, bx
00E or bx, ax
<strong>00F pop ax </strong> <--- this was the missing instruction, I found it myself
010 ret
011
012 ..start:
013 mov ax,myData
014 mov ds,ax
015 mov ah,1
016 int 21h
017 mov byte bl, al
018 mov byte bh, [somedata]
019 call dothingstobx
01A mov word ax,4c00h
01B int 21
01C .end
Joonas
Newbie Poster
5 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

Jiihaa, I found the solution at last!! One h-letter was missing

Joonas
Newbie Poster
5 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You