Assembly Language :The True Language Of Programmers

There are many high-level, structured computer programming languages today. Two common examples are C + + and Pascal. However, assembly language still has its place in today's programming world. Since it mimics the operation of the CPU in the machine level, assembly language allows you to get the right "heart" of your computer. | Chapter 1 Assembly Language The True Language Of Programmers There are many high-level structured languages for programming today s PCs. Two popular examples are C and Pascal. However assembly language still has its place in today s programming world. Since it mimics the operations of the CPU at the machine level assembly language lets you get right to the heart of your PC. In fact there are some tasks that you can do only by using assembly language. While it s true that the Pascal language is capable enough to handle interrupts it can t be used to pass keyboard input to DOS for example. Since Pascal has no native way to do this you must still insert an assembler module routine to perform the function. Likewise you can t easily remove a high-level resident program from memory. Once again you have to write the routine in assembly language to do this. For many applications programming code must still be as compact as possible. For example in programming resident programs each kilobyte of RAM below the 640K boundary is vital. Programs written in high-level languages usually require a runtime library which may add several additional kilobytes to the size. Assembly language programs don t need these bulky library routines. However the most important advantage of assembly language is speed. Although high-level languages can be optimized for speed of execution even the best optimization cannot replace the experience of a programmer. Here s a simple example. Let s say that you want to initialize two variables in Pascal to a zero value. The compiler will generate the following assembly code xor ax ax mov varl ax xor ax ax mov var2 ax Here the Pascal compiler optimized the execution speed by using the XOR instruction to zero the ax register the fastest way to do this and storing this value as varl. However due to compiler s limitations the AX register was again zeroed before the second assignment although this was redundant. For truly time-critical tasks such as sprite .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.