Click here to Skip to main content
13,141,576 members (35,590 online)
Rate this:
Please Sign up or sign in to vote.
See more:
As a very beginner to assembly language all I am trying to do is to access a globally declared string in assembly program and print its content character by character( for now i m trying to print only first character...for testing purpose) but something is really going wrong. Could you please guide me.

Environment: nasm, 16 bit, Intel X86, flat assembler

Code snippet for your reference.
Please note that I have not pasted the entire code for your reference. Its only the subroutine part that I know something is wrong.
MsgX: db "Hello World!", 0x00
   push bp
   mov  bp, sp
   sub  sp, 2
   push word MsgX
   mov  bx, [bp-2]
   mov  al, byte [bx]
   mov  ah, 0x000E
   int  0x0010
   call prints

Please help :)
Any examples or code snippets in 16 bit would be appreciable.
Posted 28-Mar-13 11:42am
Updated 28-Mar-13 11:48am
Sergey Alexandrovich Kryukov 28-Mar-13 17:46pm
From your previous question, you still did not answer: what's the OS? You said the the flat model is used, but it does not look so (perhaps you are not familiar with the flat model or its detail, it's only in protected mode). Is it 8086 real-mode (or compatible, real mode)?
ThePhantomUpvoter 28-Mar-13 17:46pm
What does "something is really going wrong" mean?
Zerr0cool 28-Mar-13 17:50pm
it is 8086 real mode
Sergey Alexandrovich Kryukov 28-Mar-13 18:06pm
Now, OS/Platform?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is the solution for real mode, DOS (required to use int 0x21, which is the DOS "system call"):[^].

If this is not it, please provide further detail on your platform; please see my comment to the question.

You could do a lot of calculations based on just the CPU model information and memory model used (for Intel, for example), in a way agnostic to the platform, but you cannot do it if I/O is involved, such as screen output. For example, the code referenced above won't work in Windows/*NIX and the like, unless you use some kind of emulator of virtual PC solution. With DOS, for example, you could use either use the system service software interrupt "call", or directly access video memory in its text or video mode. Both ways would depend on platform information.

This is not your first question on assembly programming, but you still did not provide comprehensive information.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100