NASM manual reading notes (2) - the basis of content

EQU

    was EQU 1
    Consistent with MASM in defining constants
    

TIMES

    Similar to the MASM REPT function or instruction DUP
    It is more like the version rept of instruction
    TIMES  n xxxx        =>        REPT n
                        xxxx
                        ENDM
    
    such as: 
    Function: initializing the contents of the buffer, and the full-length 64-byte hash
    BUFFER: DB 'HELLO,WORLD'
    TIMES 64-($-BUFFER) DB ' '
    Note that times the macro instruction can not be used in

$ And $$

    Bank $ indicates an offset address relative to the entire process
    This reduction in variation $$ address segment, so $ - $$ address is within the segment
 

Local LABEL

    To the point. LABEL start will be considered to be a non-point start of the sub-label
    
    such as
        LABEL1 XXXX
                 XXXX
        .CHILD XXXX; in fact, he is LABEL1.CHILD
                 XXXX
        .CHILD2 XXXX; in fact, he is LABEL1.CHILD2
                  JMP .CHILD; LABEL1 same effect may be present in the parent LABEL1 omitted, actually LABEL1.CHILD
        LABEL2 XXXX
                 XXXX
        .CHILD XXXX; in fact, he is LABEL2.CHILD
                  JMP .CHILD; LABEL2 same effect may be present in the parent LABEL2 omitted, actually LABEL2.CHILD1
                 JMP LABEL1.CHILD; because it is not a scope, so to specify the full name
 

FAR CALL

    format
    CALL address segment: offset address
    Both addresses must be immediate, at compile time so you must know the actual address, not by the amount of memory assigned to call, but I have to dynamically modify the instructions to complete a similar function in the process of running, which is somewhat similar to windows or Linux loader dry live.
 

INCBIN

    INCBIN "File"
    It contains binary data, which will directly specified binary data files include it in a position where INCBIN   
 

Cast BYTE WORD DWORD NOSPLIT

    In use can enforce memory address format, the format
    mov ax, [word bx]
    mov ax,[byte bx]
    NOSPLIT action is divided instructions, such as
    [Ax * 2 + offset] is converted to an actual [ax + ax + offset]
    Use [nosplit ax * 2 + offset] literally forces the compiler, so it should be able to speed up instruction execution speed?
    

STRICT cancellation of the mandatory conversion optimization

    such as
        PUSH DWORD  33
        Since the memory 33 can be used BYTE, the compiler optimizes directly into
        PUSH BYTE 33
        But this we do not want to see, will in the end behind the positioning error
        So this time we can use
        PUSH STRICT DWORD 33
        So that the compiler will not give us optimize away
    

Arithmetic operators
    + - * /  % %% | ~ & << >>
    Modulo arithmetic shift left or right with the support and use of the same C
    

SEG / WRT

    16 is mainly used in the compilation of the time taken segment address
    such as
    MOV AX, SEG LABLE1; LABLE1 segment address
    MOV AX, LABLE1; LABLE1 offset address
    
    WRT it is practical calculation may be calculated from the offset address designated address
    such as
    MOV AX, LABLE WRT segment address I specify
    Such LABLE offset address transmitted AX is based on the segment address I specify computed from
    
    These instructions have been entirely useless, because these two commands there are two conditions  
        1.16 Compilation
        2. compiled into windows obj format
    How can the window now 16, 32 almost eliminated, and the only to use 16-bit is the MBR, or the MBR compile large format is BIN ah, so the two directives completely unobtainable
    






Guess you like

Origin www.cnblogs.com/alwaysking/p/12287119.html