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

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
[B]00F pop ax [/B] <--- 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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.