| . |
́ ́ , ( ) . ( . assembler ) -, .
|
|
[]
. , . .[1]
[]
[]
[]
- , , .
- «» . , «» . , , , .
- . , , [2]
- , .
- , .
[]
( ), :
- ();
- ( , (. embedded) , , , ).
:
- , C++ Pascal. , , -, , , .
- () . , UNIX. , , (hardware abstraction layer) , . , Windows Linux , , , , . , MenuetOS, . MenuetOS . MenuetOS , ,
- () . , .[3] , , . . , , , 50 .[4]
- . , . . , Windows NT UNIX ( Linux) . .
- .
- .
[]
:
[]
.
[]
- (mov .)
- (add, sub, imul .)
- (or, and, xor, shr .)
- (jmp, loop, ret .)
- ( ): int, into
- / (in, out)
- , , :
-
- cbne ,
- dbnz , ,
- cfsneq , ,
[]
:
[:] [] [;]
( x86, ARM, SPARC, PowerPC, M68k). . :
- AT&T- ( AT&T);
- ( ).
, Zilog Z80 Intel i8080, ( ) . Motorola Fireball Z80, . , Motorola Intel Fireball Intel, Zilog.
[]
: , , . , ( ). « » :
[]
.MODEL TINY CODE SEGMENT ASSUME CS:CODE, DS:CODE ORG 100h START: mov ah,9 mov dx,OFFSET Msg int 21h int 20h Msg DB 'Hello World',13,10,'$' CODE ENDS END START
SECTION .data msg: db "Hello, world",10 len: equ $-msg SECTION .text global _start _start: mov edx, len mov ecx, msg mov ebx, 1 ; stdout mov eax, 4 ; write(2) int 0x80 mov ebx, 0 mov eax, 1 ; exit(2) int 0x80
SECTION .data msg: db "Hello, world",10 len: equ $-msg SECTION .text global _start syscall: int 0x80 ret _start: push len push msg push 1 ; stdout mov eax, 4 ; write(2) call syscall add esp, 3*4 push 0 mov eax, 1 ; exit(2) call syscall
.386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib .data msg db "Hello, world", 13, 10 len equ $-msg .data? written dd ? .code start: push -11 call GetStdHandle push 0 push offset written push len push offset msg push eax call WriteFile push 0 call ExitProcess end start
Windows FASM
format PE console entry start include 'include\win32a.inc' section '.data' data readable writeable message db 'Hello, world!',0 section '.code' code readable executable start: ; CINVOKE FASM. ; CDECL-. cinvoke printf,message cinvoke getch ; INVOKE STDCALL-. invoke ExitProcess,0 section '.idata' import data readable library kernel,'kernel32.dll',\ msvcrt,'msvcrt.dll' import kernel,\ ExitProcess,'ExitProcess' import msvcrt,\ printf,'printf',\ getch,'_getch'
64- Windows YASM (c Microsoft)
;yasm-1.0.0-win32.exe -f win64 HelloWorld_Yasm.asm ;setenv /Release /x64 /xp ;link HelloWorld_Yasm.obj Kernel32.lib User32.lib /entry:main /subsystem:windows /LARGEADDRESSAWARE:NO bits 64 global main extern MessageBoxA extern ExitProcess section .data mytit db 'The 64-bit world of Windows & assembler...', 0 mymsg db 'Hello World!', 0 section .text main: mov r9d, 0 ; uType = MB_OK mov r8, mytit ; LPCSTR lpCaption mov rdx, mymsg ; LPCSTR lpText mov rcx, 0 ; hWnd = HWND_DESKTOP call MessageBoxA mov ecx, eax ; uExitCode = MessageBox(...) call ExitProcess ret
.section ".data" hello: .asciz "Hello World!\n" .section ".text" .align 4 .global main main: save %sp, -96, %sp ! mov 4, %g1 ! 4 = WRITE ( ) mov 1, %o0 ! 1 = STDOUT set hello, %o1 mov 14, %o2 ! ta 8 ! ! mov 1, %g1 ! move 1(exit() syscall) into %g1 mov 0, %o0 ! move 0(return address) into %o0 ta 8 !
org 7C00h use16 jmp code nop db 'hellowrd' SectSize dw 00200h ClustSize db 001h ResSecs dw 00001h FatCnt db 002h RootSiz dw 000E0h TotSecs dw 00B40h Media db 0F0h FatSize dw 00009h TrkSecs dw 00012h HeadCnt dw 00002h HidnSec dw 00000h code: cli mov ax, cs mov ds, ax mov ss, ax mov sp, 7c00h sti mov ax,0b800h mov es,ax mov di,200 mov ah,2 mov bx,MessStr msg_print: mov al,[cs:bx] mov [es:di],ax inc bx add di,2 cmp bx,MessEnd jnz msg_print loo: jmp loo MessStr equ $ Message db 'Hello, World!' MessEnd equ $
[]
() (. assembler ). , « », . : , (« »).
«».
"":
1) ( -, );
2) , , AVR ( );
3) ( , ).
[] .
[]
[]
- . . Win 32. .: , 2007. 368 . ISBN 978-5-8459-1197-1.
- . . DOS, Windows UNIX . ; . , 2006. 608 . ISBN 5-94074-259-9.
- . Intel = Assembly Language for Intel-Based Computers .: , 2005. 912 . ISBN 0-13-091013-9.
- . . ? ! .: -, 2007. 384 . ISBN 978-5-94157-709-5.
- . .: -, 2008. 896 . ISBN 978-5-9775-0082-1.
- . Windows .: -, 2007. 896 . ISBN 978-5-9775-0084-5.
- . . .: -, 2006. 464 . ISBN 5-94157-677-3.
- . Microsoft Windows API .
- . . ? ! . 1.
- ., . Assembler: .: , 1999. . 672. ISBN 5-314-00047-4.
[]
- WASM.ru , .
- Assembler & Win64 (.) 86-64
|
|
|
|---|---|
| IDE | |

