Where to Go from Here?

Total Page:16

File Type:pdf, Size:1020Kb

Where to Go from Here? AFTERWORD Where to Go from Here? After you have worked your way through this book, you have mastered the basics of modern assembly programming. The next step depends on your needs. This afterword contains some ideas. Security analysts can use the acquired knowledge to study malware, viruses, and other ways to break into computers or networks. Malware, in binary format, tries to get into computers and networks. You can take this binary code, reverse engineer it, and try to figure out what the code is doing. You would, of course, do that in an isolated lab system. Study how to reverse engineer and acquire the necessary tooling. You should consider learning ARM assembly for analyzing code on smartphones. As a higher-level language programmer, you may consider building your own library of high-speed functions to be linked with your code. Study how you can optimize code; the code in this book was not written for high performance but for illustration purposes. In the book, we referred to a couple of texts that can help you write optimized code. If you want a thorough understanding of the Intel processors, download the Intel manuals and study them. There is a lot of interesting information to digest, and knowing how the hardware and software works together will give you an edge in developing system software or diagnosing system crashes. As a higher-level language programmer with a grasp of assembly language, you are now better equipped to debug your code. Analyze your .obj and .lst files and reverse engineer your code to see what happens. See how your compiler converts your code into machine language. Maybe using other instructions are more efficient? 405 © Jo Van Hoey 2019 J. Van Hoey, Beginning x64 Assembly Programming, https://doi.org/10.1007/978-1-4842-5076-1 Index A avx2, 308 avx512, 308 add instructions, 82 addpd, 240, 244 addps, 240 B addsd, 98 Base pointer, 108 addss, 99 betterloop.asm, 65 adouble.asm, 191 Binary numbers, 13–16 Advanced Vector Extension bitflags variable, 150–151 (AVX), 221, 307 Bit operations, 138, 139, 144, 147, 150 Aggregation, 252 Blend mask, 334, 335 align the stack, 384 blend_trace function, 368 Alive program, 37–40 Block Started by Symbol (bss), 9 Alive program printing, 40–44 Branch functions, 110 alive.asm, 35, 36 break or b command, 30 AND instruction, 49 bt, 147 arguments1.asm output, 385 btr, 147 arguments2.asm output, 386 bts, 147 Arithmetic bit operation, 140 ASCII, 206 Assembler functions, 187 C Assembler preprocessor C functions, 113, 121, 185 directives, 155, 178 C programming language, 1 Assembly instructions, 197 callee-saved register, 130 asum.asm, 190 Calling convention, nonvolatile, 131 AVX instruction, 353, 362 Calling convention, 16-byte aligned, 125 AVX matrix multiplication, 329–331 Calling convention, volatile, 131 AVX matrix operations, 317–327 Calling conventions, 121, 129–130 AVX program, 310–315 Cayley-Hamilton theorem, 332 AVX_transpose function, 360 circle.asm, 115, 188 407 © Jo Van Hoey 2019 J. Van Hoey, Beginning x64 Assembly Programming, https://doi.org/10.1007/978-1-4842-5076-1 INDEX CLI debugger, 21 Environment path variable, 371–373 Clobbered registers, 197, 201 Environment variables, 373 cmp, 62, 218 epilogue, 37 cmpsb, 209, 212, 213 Equal any, 252 coefficient, 323 Equal each, 252 Command line, 181–182 Equal range, 252 Command line, debugging, 183–184 Executable and Linkable Format for Compare and scan strings, 209–214 64-bit (elf64), 5 Comparison, 252 Expanded makefile, 117 Conditional assembly, 168, 178–179 Explicit length, 251, 270–275 Console I/O, 159–161 Extended inline assembly, 198, 199 continue or c command, 31 extern, 113 Conversion calculators, 14 External function, 101, 115 CountReg, 208 CPU, 16, 307–309 cpuid, 215–218 F CreateFileA, 402 File handling, 168, 179 cvtss2sd, 240, 244, 313 File I/O, 167–168 Flag register, 18, 19 Floating-point arguments, 123 D Floating-point numbers, 16, 97, 99, 390–392 Data Display Debugger (DDD), 51–53, 92 FPU instructions, 97 Datatypes, 8 function.asm output, 102 Debugging, break program, 27 function2.asm output, 105 Debug With Arbitrary Record Format function4.asm, 113 (DWARF), 5 dec, 82 DF flag, 207 G direction flag, 207 GDB, 21, 24 divsd, 98, 234, 323 GDB commands, 53, 54, 376 divss, 99 GDB, debugging, 22–27 gdbinit file, 24 gdb memory, 70 E Gedit, 2, 4 eflags, 62 General-purpose register, 16, 18 ELF format, 71 global, 115 Endianness, big-endian, 40 GNU compiler collection (GCC), 3, 6 Endianness, little-endian, 40 GUI debuggers, 21 408 INDEX H jumploop.asm, 63, 64 jz, 213 haddpd, 325 Hello Windows world, 371–376 hello, world, better version, 32–33 L hello, world program, 1 ldmxcsr, 226, 234 High cycles, 360 Leaf functions, 110 Higher-level language lea instruction, 69, 207 programmer, 405 Length of string, 259, 260 Leverrier algorithm, 333 I Linking Options line, 119 icalc.asm, 77 little-endian, 345 idiv instructions, 85 lodsb, 212 IEEE-754, 16 Looping, 63 imm8, 251 Looping vs. jumping, 66 imm8 control byte, 253–256 loop instruction, 65, 66, 89 Implicit length, 251, 267–270 Low cycles, 360 imul instructions, 83, 84 inc instructions, 82 M info registers, 28–30 Inline assembly, 195–197 Machine language, 11, 12 Instruction Pointer Register (rip), 18–19 Macros, 154–156 Integer arithmetic instructions, 82, 83 makefile, 5, 232 Integers, 15 mask, 303 Integrated development environment MASM, 371 (IDE), 3, 57 Match characters, 252 Intel syntax flavor, 23, 24 Match characters in range, 252 IntRes1, 253 Matrix inversion, 317, 332 IntRes2, 253 Matrix Math Extension (MMX), 221 matrix multiplication, 317, 329–332 Matrix print, 328 J, K Matrix transpose, 317, 339–341, 343 jge, 63 Memory, 67–69 jmp instructions, 101 Memory alignment, 12 jne, 212 memory.asm, 67 jnz, 213 Memory investigation, DDD, 54 jump instructions and flags, 63 Memory page, 262 jump.asm, 60 MinGW-w64, 372 409 INDEX Minimalist GNU for Windows Optimization, 361 (MinGW), 372 OR, 47, 48 minus_mask, 321 Out-of-order execution, 360 mov, 10, 54, 69 Overflows, data, 162–165 movaps, 244 movdqa, 248 movdqu, 279 P, Q move.asm, 51, 52 Packed data, 221–223 Moving strings, 203–208 paddd, 248 movq, 44 pcmpestri, 251, 274 movsb, 207, 208 pcmpestrm, 251, 289 movsd, 97, 99, 208 pcmpistri, 251, 269 movss, 99, 240, 313 pcmpistrm, 251, 295 movsw, 208 Permutation, 346 movupd, 240 Permutation mask, 335–337 movups, 240 pextrd, 249 mul, 83 pinsrd, 249 mulsd, 98 Polarity, 252 mulss, 99 pop instruction, 87 Multiline macros, 155 Portable assembly language, 1 MXCSR, 19, 234, 235 port 5 pressure, 361 mxcsr bits, 226–233 Position-independent executables (PIEs), 6 PowerShell, 373 N printb, 133, 138 NASM, 3, 5, 371 printdpfp, 240 nasm-v, 371 printf, 40–42, 83, 91, 101, 115 neg instruction, 49 print_hex.c, 231 Netwide Assembler (NASM), 2, 71, 153 print_mxcsr.c, 231 next or n command, 31 print or p command, 31 Non-floating-point arguments, 122, 383 printspfp, 240, 244 nop instruction, 25 printString, 179 NOT, 47 print_xmm, 234 prologue, 37 pshufd, 279, 348 O pstrcmp, 269 Octal notation, 168 pstrlen, 260 Octal number, 15 pstrln, 295 410 INDEX pstrscan_l function, 266 Search in string, 262–264, 266 push, 87, 90 Search, range of characters, 296, 298–300 pxor, 261–266 Search, range of uppercase, 302 Search, substring, 301, 303–305 section .bss, 9 R section .data, 7, 8 radius, pi variables, 40, 43, 44 section .txt, 9–12 rax, 54, 69, 83 Security analysts, 405 rbx counter, 64 seq_trace function, 368 rdtsc, 360 seq_transpose function, 360 rdtscp, 360 serializing, 360 rdx, 10 setc, 150 readelf, 71–73 setnz, 326 reads function, 165 Settings dialog, SASM, 58, 59 rect.asm, 188 Shadow space, 374, 383 Register constraints, 200 shift, 82 Registers, 16, 62 shl, 139 rep, 207 shr, 139 repe, 212 Shuffle broadcast, 283 repne, 212, 214 Shuffle masks, 283, 288, 350 reverse string, 87–90 Shuffle reverse, 283 reverse_xmm0 function, 295 Shuffle rotate, 283 rflags, 18, 62 Shuffle version, matrix, 348–352 rip register, 18, 29 Shuffling, 277–283 rol, 140 Sign extension, 82, 140 ror, 140 Significand/mantissa, 96 Round down, 226 SimpleASM (SASM), 21, 57, 92, 165, Round to nearest, 226 372, 373 Round up, 226 Simple function, 101–103 Runtime masks, 288 Single vs. double precision, 95 Single instruction, multiple data (SIMD), 19, 221 S Single-line macros, 155 sal, 82, 139 singular, 319 sar, 82, 139 sqrtsd, 99 Scalar data, 221–223 sqrtss, 99 scasb, 209, 212, 214 sreverse.asm, 189 Search, characters, 289–293 SSE, aligned data, 241, 242, 245 411 INDEX SSE packed integers, instruction, 247–250 U SSE string manipulation, 251, 252, 256 Unaligned/aligned data, 223, 224 SSE, unaligned data, 237–240 unpack version, 344–348 SSE unaligned example, 310–312, 314 STABS, 5 Stack alignment, 16 byte, 107–109, 384 V stack.asm, 87, 390 vaddpd, 312 Stack frames, 110 vaddps, 311 Stack layout, 125, 128 variadic function, 393–395 Stack pointer, 68 vblendpd, 325 step or s command, 31 vbroadcastsd, 324 stmxcsr, 234 vdivsd, 324 stosb, 206, 208 vextractf128, 311 stosd, 208 vfmadd213sd, 323 stosw, 208 vfmadd231pd, 327 Streaming SIMD Extension (SSE), 215, 221 vfmadd231sd, 323 String compare, 252 vhaddpd, 325 Strings, explicit length, 270, 271, 273, 274 Visual Studio, 201, 371 Strings, implicit length, 267–269 vmovapd, 324 sub, 82 vmovupd, 312 subsd, 98 vmovups, 311 subss, 99 vmulpd, 324 Substring search, 252 vpermpd, 325 syscall, 167, 376 vperm2f128, 347 System V AMD64 ABI, 182 vshufpd, 351 vtrace function, 333 T vunpckhpd, 345 vunpcklpd, 345 test, 218 vxorpd, 323 testfile.txt file, 179 vzeroall, 321 test instruction, 218–220 time instruction, 66 timestamp, 360 W trace, 322 Windows, 371 Trace computation, 362–369 Windows API, 377 Transpose computation, 353–361 Windows API, Console Output, 377–380 Truncate, 226 WriteConsole, 380 tui enable command, 31 WriteFile, 380, 402 412 INDEX X Y x64 calling convention, 375 ymm register, 19 x86 processors, 201 xmm registers, 19, 277, 392, 397 Z XOR instruction, 48 ZF flag, 213 413.
Recommended publications
  • Declare Labels in Assembly
    Declare Labels In Assembly procrastinatingShimon is clever contentiously. and epigrammatizes Farrow andoccultly cupric while Gregorio flapperish never Ace rebaptizing hushes and his wet-nurses.surprisers! Moodier and detonating Wait glaciates her yes announces or The assembler for both files, a result was, then represents a pascal, and extend legacy code executes code. Their coursework and set. The public directive declares to the optimizing linker that pure symbol. It cut our mission to allow thorough objective accurate lists of material ingredients for efficacy of our products. To explicitly set up condition codes, use power compare instruction. You can make this will send out such as if manual that not to simply using. Please enter your research and discussions at assembly of armor give you do not limited. Three to more individuals gathering, coming over, or meeting with legislation common intention of committing a violent crime as some act, lawful or unlawful, that when breach the peace. How its Use Inline Assembly Language in C Code gcc 6. Cpus compatible with this in memory blocks in showing consumers and labels in declare label value. CCS Assembler Directives. C and C labels are having sensitive than when used by goto statements Assembly instructions can jump man a C or C label with regard to. The data section of the assembler program. Assembly language is difficult to learn however it requires a deeper understanding of system architecture at time most fundamental level Once one understand this duplicate bridge the customer gap you able find learning and programming in assembly is twilight and fun. Scopes are automatically in many situations.
    [Show full text]
  • 2. Assembly Language Assembly Language Is a Programming Language That Is Very Similar to Machine Language, but Uses Symbols Instead of Binary Numbers
    2. Assembly Language Assembly Language is a programming language that is very similar to machine language, but uses symbols instead of binary numbers. It is converted by the assembler into executable machine- language programs. Assembly language is machine-dependent; an assembly program can only be executed on a particular machine. 2.1 Introduction to Assembly Language Tools Practical assembly language programs can, in general, be written using one of the two following methods: 1- The full-segment definition form 2- The simplified segment definition form In both methods, the source program includes two types of instructions: real instructions, and pseudo instructions. Real instructions such as MOV and ADD are the actual instructions that are translated by the assembler into machine code for execution by the CPU. Pseudo instructions, on the other hand, don’t generate machine code and are only used to give directions to the assembler about how it should translate the assembly language instructions into machine code. The assembler program converts the written assembly language file (called source file) into machine code file (called object file). Another program, known as the linker, converts the object file into an executable file for practical run. It also generates a special file called the map file which is used to get the offset addresses of the segments in the main assembly program as shown in figure 1. Other tools needed in assembling coding include a debugger, and an editor as shown in figure 2 Figure 2. Program Development Procedure There are several commercial assemblers available like the Microsoft Macro Assembler (MASM), and the Borland Turbo Assembler (TASM).
    [Show full text]
  • X86 Assembly Language Syllabus for Subject: Assembly (Machine) Language
    VŠB - Technical University of Ostrava Department of Computer Science, FEECS x86 Assembly Language Syllabus for Subject: Assembly (Machine) Language Ing. Petr Olivka, Ph.D. 2021 e-mail: [email protected] http://poli.cs.vsb.cz Contents 1 Processor Intel i486 and Higher – 32-bit Mode3 1.1 Registers of i486.........................3 1.2 Addressing............................6 1.3 Assembly Language, Machine Code...............6 1.4 Data Types............................6 2 Linking Assembly and C Language Programs7 2.1 Linking C and C Module....................7 2.2 Linking C and ASM Module................... 10 2.3 Variables in Assembly Language................ 11 3 Instruction Set 14 3.1 Moving Instruction........................ 14 3.2 Logical and Bitwise Instruction................. 16 3.3 Arithmetical Instruction..................... 18 3.4 Jump Instructions........................ 20 3.5 String Instructions........................ 21 3.6 Control and Auxiliary Instructions............... 23 3.7 Multiplication and Division Instructions............ 24 4 32-bit Interfacing to C Language 25 4.1 Return Values from Functions.................. 25 4.2 Rules of Registers Usage..................... 25 4.3 Calling Function with Arguments................ 26 4.3.1 Order of Passed Arguments............... 26 4.3.2 Calling the Function and Set Register EBP...... 27 4.3.3 Access to Arguments and Local Variables....... 28 4.3.4 Return from Function, the Stack Cleanup....... 28 4.3.5 Function Example.................... 29 4.4 Typical Examples of Arguments Passed to Functions..... 30 4.5 The Example of Using String Instructions........... 34 5 AMD and Intel x86 Processors – 64-bit Mode 36 5.1 Registers.............................. 36 5.2 Addressing in 64-bit Mode.................... 37 6 64-bit Interfacing to C Language 37 6.1 Return Values..........................
    [Show full text]
  • NASM – the Netwide Assembler
    NASM – The Netwide Assembler version 2.14rc7 © 1996−2017 The NASM Development Team — All Rights Reserved This document is redistributable under the license given in the file "LICENSE" distributed in the NASM archive. Contents Chapter 1: Introduction . 17 1.1 What Is NASM?. 17 1.1.1 License Conditions . 17 Chapter 2: Running NASM . 19 2.1 NASM Command−Line Syntax . 19 2.1.1 The −o Option: Specifying the Output File Name . 19 2.1.2 The −f Option: Specifying the Output File Format . 20 2.1.3 The −l Option: Generating a Listing File . 20 2.1.4 The −M Option: Generate Makefile Dependencies. 20 2.1.5 The −MG Option: Generate Makefile Dependencies . 20 2.1.6 The −MF Option: Set Makefile Dependency File. 20 2.1.7 The −MD Option: Assemble and Generate Dependencies . 20 2.1.8 The −MT Option: Dependency Target Name . 21 2.1.9 The −MQ Option: Dependency Target Name (Quoted) . 21 2.1.10 The −MP Option: Emit phony targets . 21 2.1.11 The −MW Option: Watcom Make quoting style . 21 2.1.12 The −F Option: Selecting a Debug Information Format . 21 2.1.13 The −g Option: Enabling Debug Information. 21 2.1.14 The −X Option: Selecting an Error Reporting Format . 21 2.1.15 The −Z Option: Send Errors to a File. 22 2.1.16 The −s Option: Send Errors to stdout ..........................22 2.1.17 The −i Option: Include File Search Directories . 22 2.1.18 The −p Option: Pre−Include a File . 22 2.1.19 The −d Option: Pre−Define a Macro .
    [Show full text]
  • (PSW). Seven Bits Remain Unused While the Rest Nine Are Used
    8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI The Flags Register It is a 16-bit register, also called Program Status Word (PSW). Seven bits remain unused while the rest nine are used. Six are status flags and three are control flags. The control flags can be set/reset by the programmer. 1. DF (Direction Flag) : controls the direction of operation of string instructions. (DF=0 Ascending order DF=1 Descending order) 2. IF (Interrupt Flag): controls the interrupt operation in 8086µP. (IF=0 Disable interrupt IF=1 Enable interrupt) 3. TF (Trap Flag): controls the operation of the microprocessor. (TF=0 Normal operation TF=1 Single Step operation) The status flags are set/reset depending on the results of some arithmetic or logical operations during program execution. 1. CF (Carry Flag) is set (CF=1) if there is a carry out of the MSB position resulting from an addition operation or subtraction. 2. AF (Auxiliary Carry Flag) AF is set if there is a carry out of bit 3 resulting from an addition operation. 3. SF (Sign Flag) set to 1 when result is negative. When result is positive it is set to 0. 4. ZF (Zero Flag) is set (ZF=1) when result of an arithmetic or logical operation is zero. For non-zero result this flag is reset (ZF=0). 5. PF (Parity Flag) this flag is set to 1 when there is even number of one bits in result, and to 0 when there is odd number of one bits. 6. OF (Overflow Flag) set to 1 when there is a signed overflow.
    [Show full text]
  • Obfuscation-Resilient Executable Payload Extraction from Packed
    Obfuscation-Resilient Executable Payload Extraction From Packed Malware Binlin Cheng, Hubei Normal University & Wuhan University; Jiang Ming, Erika A Leal, and Haotian Zhang, The University of Texas at Arlington; Jianming Fu and Guojun Peng, Wuhan University; Jean-Yves Marion, Université de Lorraine, CNRS, LORIA https://www.usenix.org/conference/usenixsecurity21/presentation/cheng-binlin This paper is included in the Proceedings of the 30th USENIX Security Symposium. August 11–13, 2021 978-1-939133-24-3 Open access to the Proceedings of the 30th USENIX Security Symposium is sponsored by USENIX. Obfuscation-Resilient Executable Payload Extraction From Packed Malware Binlin Cheng∗† Jiang Ming∗‡ Hubei Normal University & Wuhan University, China The University of Texas at Arlington, USA [email protected] [email protected] Erika A Leal and Haotian Zhang Jianming Fu† and Guojun Peng† The University of Texas at Arlington, USA Wuhan University, China {erika.leal,haotian.zhang}@mavs.uta.edu {jmfu,guojpeng}@whu.edu.cn Jean-Yves Marion Université de Lorraine, CNRS, LORIA, F-54000 Nancy, France [email protected] Abstract obfuscation schemes and more coverage on resolved Win- Over the past two decades, packed malware is always a ve- dows API names. Since July 2019, we have tested API-Xray ritable challenge to security analysts. Not only is determining in practice to assist security professionals in malware analy- the end of the unpacking increasingly difficult, but also advan- sis: we have successfully rebuilt 155;811 executable malware ced packers embed a variety of anti-analysis tricks to impede programs and substantially improved the detection rate for reverse engineering.
    [Show full text]
  • NASM — the Netwide Assembler Version 2.09.04
    NASM — The Netwide Assembler version 2.09.04 -~~..~:#;L .-:#;L,.- .~:#:;.T -~~.~:;. .~:;. E8+U *T +U' *T# .97 *L E8+' *;T' *;, D97 `*L .97 '*L "T;E+:, D9 *L *L H7 I# T7 I# "*:. H7 I# I# U: :8 *#+ , :8 T, 79 U: :8 :8 ,#B. .IE, "T;E* .IE, J *+;#:T*" ,#B. .IE, .IE, © 1996−2010 The NASM Development Team — All Rights Reserved This document is redistributable under the license given in the file "LICENSE" distributed in the NASM archive. Contents Chapter 1: Introduction . .15 1.1 What Is NASM? . .15 1.1.1 Why Yet Another Assembler?. .15 1.1.2 License Conditions . .15 1.2 Contact Information . .16 1.3 Installation. .16 1.3.1 Installing NASM under MS−DOS or Windows . .16 1.3.2 Installing NASM under Unix . .17 Chapter 2: Running NASM . .18 2.1 NASM Command−Line Syntax . .18 2.1.1 The −o Option: Specifying the Output File Name . .18 2.1.2 The −f Option: Specifying the Output File Format . .19 2.1.3 The −l Option: Generating a Listing File . .19 2.1.4 The −M Option: Generate Makefile Dependencies . .19 2.1.5 The −MG Option: Generate Makefile Dependencies . .19 2.1.6 The −MF Option: Set Makefile Dependency File . .19 2.1.7 The −MD Option: Assemble and Generate Dependencies. .19 2.1.8 The −MT Option: Dependency Target Name. .20 2.1.9 The −MQ Option: Dependency Target Name (Quoted) . .20 2.1.10 The −MP Option: Emit phony targets. .20 2.1.11 The −F Option: Selecting a Debug Information Format .
    [Show full text]
  • Inside an Assembly-Language Game
    Simulations Issue A CWC/I PUBLICATION 1984 JUNE USA $2.95 CAN $3.50 THE MAGAZINE FOR TRS-80 COLOR COMPLJTERIDAND MC-10® lJSERS InsideLearn How the an Pieces Assembly-Language Work Together Game 00700 * 00710 ********PRINTER ROUTINE********* 86 FE 00720 PSTART LDA #$0FE LOA D WITH #-2 Buy Low, Sell High 97 6F 00730 STA $6F AT 'DEVNUM' 00740 CLRB Stock Market Simulator 00750 LDX #$400 TOP OF SCREEN 00760 PLOOP LDA ,X+ GET A CHARACT 00770 INCB AND COUNT IT 00780 BSR GETCHR CONVERT AND P 90 CMPB #$20 32 CHARACTERS • BNE GSKIPl Build Your ....., .1..,: I' CLRB ' LDA #$0D SEND A LINE F Own Atari / JSR [ $A002] TO [CHROUT] ' I I I MPX #$5E0 END OF SCREEN Joystick lnterf ace / ' ............ LOOP NO, PRINT SOM � TITLE DONE / .... .... I ' CORRECT I PAGE I POKE VALUE / ' I ' ' Win (or Lose) Big / /..__ Q,�A"2 o I ' ' SET·UP ''*o At Bringmee Downs , ', � I ROUTINE ' I '' ' ' SCORE ' \ ROUTINE \ \ \ Plus: Elite-Word and \ The Business Accountmg '-� System Reviewed 015E GSKIP2 I LOOP I START LLOOP 06 0 A 74470 12067 II SEND Dealer FOR FREE inquiries CATALOG invited TM ABC'S IN COLOR SPELL BOMBER In the ABC program, all 26 letters spring up in As captain of your ship, you must destroy the enemy bomber by spelling color to the familiar ABC tune. Then, colorful the mystery word. In this exciting and educational game the bomber gets detailed pictures depicting each individual letter closer with each inaccurate letter. You have only EIGHT tries to guess of the alphabet appear one by one.Your child's the mystery word or your ship will be bombed! If you guess the word fascination will mount as he or she correctly correctly, GENERAL QUARTERS will sound and your ship will fire a presses the letter on the keyboard and is missile to destroy the bomber, Three levels are available: EASY, rewarded with a musical tune before the next MEDIUM.
    [Show full text]
  • Overview of IA-32 Assembly Programming
    Overview of IA-32 assembly programming Lars Ailo Bongo University of Tromsø Contents 1 Introduction ...................................................................................................................... 2 2 IA-32 assembly programming.......................................................................................... 3 2.1 Assembly Language Statements................................................................................ 3 2.1 Modes........................................................................................................................4 2.2 Registers....................................................................................................................4 2.2.3 Data Registers .................................................................................................... 4 2.2.4 Pointer and Index Registers................................................................................ 4 2.2.5 Control Registers................................................................................................ 5 2.2.6 Segment registers ............................................................................................... 7 2.3 Addressing................................................................................................................. 7 2.3.1 Bit and Byte Order ............................................................................................. 7 2.3.2 Data Types.........................................................................................................
    [Show full text]
  • The 8086 Microprocessor
    11 The 8086 Microprocessor 1. Draw the pin diagram of 8086. Ans. There would be two pin diagrams—one for MIN mode and the other for MAX mode of 8086, shown in Figs. 11.1 and 11.2 respectively. The pins that differ with each other in the two modes are from pin-24 to pin-31 (total 8 pins). GND 1 40 VCC AD –AD 35–38 0 15 2–16 & 39 A/S16 3–A/S 19 6 NMI 17 34 BHE/S7 INTR 18 33 MN/MX CLK 19 32 RD INTEL GND 20 31 HOLD 8086 RESET 21 30 HLDA READY 22 29 WR TEST 23 28 M/IO INTA 24 27 DT/R ALE 25 26 DEN Fig. 11.1: Signals of intel 8086 for minimum mode of operation 2. What is the technology used in 8086 µµµP? Ans. It is manufactured using high performance metal-oxide semiconductor (HMOS) technology. It has approximately 29,000 transistors and housed in a 40-pin DIP package. 3. Mention and explain the modes in which 8086 can operate. Ans. 8086 µP can operate in two modes—MIN mode and MAX mode. When MN/MX pin is high, it operates in MIN mode and when low, 8086 operates in MAX mode. 194 Understanding 8085/8086 Microprocessors and Peripheral ICs through Questions and Answers For a small system in which only one 8086 microprocessor is employed as a CPU, the system operates in MIN mode (Uniprocessor). While if more than one 8086 operate in a system then it is said to operate in MAX mode (Multiprocessor).
    [Show full text]
  • X86-64 Calling Conventions
    CSE 351: The Hardware/Software Interface Section 4 Procedure calls Procedure calls In x86 assembly, values are passed to function calls on the stack Perks: Concise, easy to remember Drawbacks: Always requires memory accesses In x86-64 assembly, values are passed to function calls in registers Perks: Less wasted space, faster Drawbacks: Potentially requires a lot of register manipulation 2/23/2014 2 x86 calling conventions Simply push arguments onto the stack in order, then “call” the function! Suppose we define the following function: int sum(int a, int b) { return a + b; } (See also sum.c from the provided code) 2/23/2014 3 x86 calling conventions int sum(int a, int b) { return a + b; } In assembly, we have something like this: sum: pushl %ebp # Save base pointer movl %esp, %ebp # Save stack pointer movl 12(%ebp), %eax # Load b movl 8(%ebp), %edx # Load a addl %edx, %eax # Compute a + b popl %ebp # Restore base pointer ret # Return 2/23/2014 4 x86 calling conventions What is happening with %ebp and %esp? pushl %ebp The base pointer %ebp is the address of the caller, which is the location to which “ret” returns. The function pushes it into the stack so that it won’t be overwritten movl %esp, %ebp Functions often shift the stack pointer to allocate temporary stack space, so this instruction makes a backup of the original location. In the body of the function, %ebp is now the original start of the stack ret When sum() returns, execution picks up at the stored base pointer address.
    [Show full text]
  • Linux Assembly HOWTO Linux Assembly HOWTO
    Linux Assembly HOWTO Linux Assembly HOWTO Table of Contents Linux Assembly HOWTO..................................................................................................................................1 Konstantin Boldyshev and François−René Rideau................................................................................1 1.INTRODUCTION................................................................................................................................1 2.DO YOU NEED ASSEMBLY?...........................................................................................................1 3.ASSEMBLERS.....................................................................................................................................1 4.METAPROGRAMMING/MACROPROCESSING............................................................................2 5.CALLING CONVENTIONS................................................................................................................2 6.QUICK START....................................................................................................................................2 7.RESOURCES.......................................................................................................................................2 1. INTRODUCTION...............................................................................................................................2 1.1 Legal Blurb........................................................................................................................................2
    [Show full text]