STARTUPCODE Produce startup code Extension
STARTUPCODE ; Ideal or MASM mode
.STARTUP ; MASM mode only
This directive provides initialization code appropriate for the
current model and operating system. It also marks the beginning of the
program.
STARTUPCODE initializes the DS, SS, and SP registers. For the SMALL,
MEDIUM, COMPACT, LARGE, HUGE, and TPASCAL memory models, TASM sets
DS and SS to @data, and SP to the end of the stack. For TINY and
TCHUGE models, the STARTUPCODE directive doesn't change the segment
registers.
The @Startup symbol is placed at the beginning of the startup code
that the STARTUPCODE directive generates.
Example:
Source text Code generated
MODEL os_dos small
STACK ; STACK 400h
DATASEG
msg_hi db "Hi$" ; msg_hi db "Hi$"
CODESEG ; ASSUME cs:@code
StartupCode ; @Startup:
; ; mov dx,@data
; ; mov ds,dx
; ; ASSUME ds:@data
; ; mov bx,ss
; ; sub bx,dx
; ; shl bx,1
; ; shl bx,1
; ; shl bx,1
; ; shl bx,1
; ; cli
; ; mov ss,dx
; ; add sp,bx
; ; sti
; ; ASSUME ss:@data
mov dx,offset msg_hi ; mov dx,offset msg_hi
mov ah,9 ; mov ah,9
int 21h ; int 21h
ExitCode 0 ; mov ax,4c00h
; ; int 21h
END ; END @Startup