TAILIEUCHUNG - The 80x86 IBM PC and Compatible Computers- P5

The 80x86 IBM PC and Compatible Computers- P5: Praised by experts for its clarity and topical breadth, this visually appealing, one-stop source on PCs uses an easy-to-understand, step-by-step approach to teaching the fundamentals of 80x86 assembly language programming and PC architecture. Offering users a fun, hands-on learning experience, it uses the Debug utility to show what action the instruction performs, then provides a sample program to show its application. | TITLE PROGRAM BOX PROGRAM Performs the following a gets the current video mode and saves it b sets the video mode to a new one and clears screen c draws a colored box and gets the mouse position d displays different messages depending on whether the mouse is clicked inside or outside the box Pressing any key will return to DOS. Thanks to Travis Erck and Gary Hudson for their input on this program CURSOR MACRO ROW COLU MN MOV MOV MOV DH ROW MOV DL COLUMN INT 10H ENDM DISPLAY MACRO STRING MOV MOV DX OFFSET STRING load string address INT 21H ENDM FILL MACRO ROW START COL START ROW END COL END COLOR LOCAL START AG AIN MOV START START MOV START AGAIN MOV MOV AL COLOR INT 10H INC CX CMP END JNE AGAIN INC DX CMP END JNE START ENDM MODEL SMALL .STACK DATA MESSAGE 1 DB AN EXAMPLE OF HOW TO USE INTERRUPT 33H FOR MOUSE. MESSAGE 2 DB IT WORKS MESSAGE 3 DB CLICK IN THE BOX TO SEE WHAT HAPPENS MESSAGE 4 DB No NO NO I SAID IN THE BOX MESSAGE 5 DB NOW PRESS ANY KEY TO GET BACK TO DOS. OLDVIDEO DB NEWVIDEO DB 12H .CODE MAIN PROC MOV AX @DATA MOV DS AX MOV get the current video mode INT 10H MOV OLDVIDEO AL save it MOV clear screen MOV MOV CX 0 MOV INT 10H MOV AH OOH set new video mode MOV AL NEWVIDEO INT 10H CURSOR 0 0 FILL 150 250 250 350 4 draw red box CURSOR 1 1 DISPLAY MESSAGE 1 CURSOR 5 22 DISPLAY MESSAGE 3 MOV initialize mouse INT 33H MOV AX 01H INT 3 3H show mouse cursor Program 5-5 continued on next page 165 BACK MOV check for mouse button press INT 33H now CX COL and DX ROW location CMP check to see if left button is pressed JNE BACK lf not keep checking CMP see if on right side of box JB NOT INSIDE if less it must be outside box CMP see if on left side of box JA NOT INSIDE if not then it is outside the box CMP check for the top of the box JB NOT INSIDE if not then outside the box CMP see if bottom of the box JA NOT INSIDE .

Đã 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.