'seg' assembly instruction in .s file


 
Thread Tools Search this Thread
Top Forums Programming 'seg' assembly instruction in .s file
# 1  
Old 10-11-2010
'seg' assembly instruction in .s file

Is this x86? I encountered this instruction and can't seem to find any info on what it does anywhere. Any ideas? This is how it appears:

seg es
# 2  
Old 10-11-2010
It's probably a definition or macro, not an instruction. There's dozens of assemblers out there, which are you using?
# 3  
Old 10-12-2010
I use as86, which is an assembler for 8086..80386 processors
# 4  
Old 10-12-2010
From http://www.oldschoolhack.de/tutorials/87.txt:

Code:
Now lets go over the code in a bit more detail:

    MOV   AX, SEG OurString     ; Move the segment where OurString is located
    MOV   DS, AX                ; into AX, and now into DS

    MOV   DX, OFFSET OurString  ; Move the offset where OurString is located
    MOV   AH, 9h                ; Print string subfunction
    INT   21h                   ; Generate interrupt 21h

You'll notice we had to use AX to put the segment address of OurString in DS.
You will discover that you cannot refer to a segment register directly in
Assembler.  In last tute's PutPixel procedure, I moved the address of the VGA
into AX, and then into ES.

So it's not an instruction but something like a macro or operator.
# 5  
Old 10-13-2010
seg es is a directive that tells the assembler which segment...code/data etc. is affected by the instructions that follow it.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[perl script] print the assembly instruction and count the occurence

Hi, I have a input file(text file) with the following lines. 0x000000 0x5a80 0x0060 BRA.l 0x60 ;file:UserCall.s ;function:_user_call_table ;C_sourceLine:24 0x000002 0x1bc5 RETI ;file:UserCall.s ;function:_user_call_table ;C_sourceLine:30 0x000003 0x6840 MOV R0L,R0L ;file:UserCall.s... (6 Replies)
Discussion started by: acdc
6 Replies

2. Programming

Are there any C code r instruction to see where is the creation or last edit for the file

Are there any C or termina instructin code or instruction to see where is the creation or last edit for the file (1 Reply)
Discussion started by: fwrlfo
1 Replies

3. UNIX for Dummies Questions & Answers

Add a header to a sort file instruction

Hello, I have a header which I have to add to a sorted file, however if I use cat header sortedfile > newfile, the operation takes 2 minutes as the sorted file is over 400mb. I have noticed that when I sort the 400mb unsorted file, this only takes 14 seconds to create the output. As... (2 Replies)
Discussion started by: clarcombe
2 Replies

4. Programming

Seg Fault Running AIX COBOL program

Hi some help read............ I'm getting a segmentation fault when I run an AIX COBOL/Db2 program. I initiate the program from the command line, but it hangs, and then when I press enter it generates a segmantation fault and produces a core dump. The box is running AIX software level ... (5 Replies)
Discussion started by: steve_f
5 Replies

5. Programming

Xlib Problem: XCloseDisplay seg fault

Hi, First of all forgive me if Xlib related problems does not go under this thread. In my main program, im using Xlib`s XImage type object which contains a regularly updating bitmap, and maps the XImage to a Xwindow using XPutImage. ( XCreateImage is used to create the XImage. ) The... (0 Replies)
Discussion started by: wolwy_pete
0 Replies

6. HP-UX

HP-UX 64 compilation causing some code to seg fault

Hello everyone, Today we are attempting to port some legacy C code to a 64 HP-UX machine at my company and there is kind of a strange error we ran into. there is a small function they have defined called zgetenv that accepts a char* and basically just does some null checking and returns ... (0 Replies)
Discussion started by: khadesh
0 Replies

7. Programming

Open Suse 10 seg fault

Okay, so here is some code that when compiled on Fedora Core 6 works great, but when I compile and run it on OpenSuse 10 it gives back a seg fault when trying to join the 2nd thead. #include <pthread.h> #include <stdio.h> int print_message_function( void *ptr ); int x = 1; main() { ... (1 Reply)
Discussion started by: chrisdrobison
1 Replies
Login or Register to Ask a Question