freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

匯編語(yǔ)言程序設(shè)計(jì)-閱讀頁(yè)

2025-02-28 18:02本頁(yè)面
  

【正文】 I ][ S I ]A H A LB H B LC H C LD H D LB PS ID IS PF l a gI PC SD SS SE S* 1 0 H 例題: : 假設(shè)從一壓力傳感器讀取 100個(gè)數(shù)據(jù) 字 的程序,要求每隔 1ms從傳感器讀取 一個(gè)數(shù)據(jù)字,然后屏蔽每個(gè)字的高4位并把結(jié)果放在一個(gè) 數(shù)組 中。時(shí)鐘周期數(shù)( 5MHZ): MOV CX, 295 ; 4=C0 HERE: LOOP HERE ; 17 or 5 RET ; CT=C0+17N 12 WAIT_1MS ENDP ; N=(CTC0+12)/17 CODE ENDS ; N=(50004+12)/17 END START ; =295 以 1ms時(shí)間間隔讀取 100個(gè)采樣數(shù)據(jù)的匯編語(yǔ)言程序 2)數(shù)據(jù)保存 MULTO PROC NEAR PUSHF PUSH AX PUSH BX PUSH CX .. POP CX POP BX POP AX POPF RET MULTO ENDP (3) 調(diào)用過程的參數(shù)傳遞 當(dāng)調(diào)用一過程時(shí),經(jīng)常需要把一些數(shù)據(jù)值或地址傳遞到過程中,另外過程也經(jīng)常需要把一些數(shù)據(jù)值或地址傳回到主程序。 傳遞參數(shù)的四種主要途徑是: 1 在寄存器中 2 在用名字存取的存儲(chǔ)器中 3 用指針 4 用堆棧 R A MF F F F F H0 0 0 0 0 HX X X X 0 HX X X X 0 HX X X X 0 HC o d e s e g m e n t6 4 kD a t as e g m e n t6 4 kS t a c ks e g m e n t6 4 kE x t r as e g m e n t6 4 k[ B X ][ S P ][ B X ]I PC P U[ S I ][ D I ][ B P ][ D I ][ S I ]A H A LB H B LC H C LD H D LB PS ID IS PF l a gI PC SD SS SE S* 1 0 H 1. 用寄存器傳遞參數(shù)實(shí)例: 2. 問題定義: 3. 要求將壓縮的 BCD數(shù) 17轉(zhuǎn)換成等價(jià)的二進(jìn)制數(shù)。 R A MF F F F F H0 0 0 0 0 HX X X X 0 HX X X X 0 HX X X X 0 HC o d e s e g m e n t6 4 kD a t as e g m e n t6 4 kS t a c ks e g m e n t6 4 kE x t r as e g m e n t6 4 k[ B X ][ S P ][ B X ]I PC P U[ S I ][ D I ][ B P ][ D I ][ S I ]A H A LB H B LC H C LD H D LB PS ID IS PF l a gI PC SD SS SE S* 1 0 H DATA SEGMENT BCD_IN DB 17H BIN_VAL DB ? DATA ENDS STACK SEGMENT DW 100 DUP (0) STACK ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA, SS: STACK START: MOV AX, DATA MOV DS, AX MOV AX, STACK MOV SS, AX MOV SI, OFFSET BCD_IN MOV DI, OFFSET BIN_VAL CALL BCD_BIN NOP BCD_BIN PROC NEAR PUSHF PUSH AX PUSH BX PUSH CX MOV AL, [SI] MOV BL, AL AND BL, 0FH AND AL, 0F0H MOV CL, 04 ROR AL, CL MOV BH, 0AH MUL BH ADD AL, BL MOV [DI], AL POP CX POP BX POP AX POPF RET BCD_BIN ENDP ( c)用指向有名存儲(chǔ)單元 CODE ENDS 的指針傳遞參數(shù)實(shí)例 END START C語(yǔ)言程序: /* headcount=5 */ includestdio /* headcount=404 */ /* present=404 */ Void main ( ) /* *present=5 */ { /* present=406 */ int headcount=5。 printf (“ headcount= %d \n headcount= %d \n present= %d \n *present= %d \n present= %d \n” ,headcount, headcount, present, *present, present )。同理,過程也把傳回調(diào)用程序的參數(shù)寫入棧中,然后主程序中的指令把這些參數(shù)讀出。 void get_temp(int *ptr)。 tempf=c2f ( tempc )。 printf ( “ The temperature in Fahrenheit is %d \n” , temp )。 f=9*c/5+32。 } Void get_temp(int *ptr ) { printf ( “ Please enter the Celsius temperature. /n” )。 } 程序舉例:說明、調(diào)用和定義 C函數(shù)模板 參數(shù)傳遞小結(jié): 在調(diào)用程序和過程之間可以用( 1)寄存器、( 2)指定存儲(chǔ)單元(用名字或指針存?。┗蛘撸?3)棧傳遞參數(shù)。對(duì)于少量參數(shù)傳遞的簡(jiǎn)單程序,使用寄存器通常是最容易的方法,對(duì)于向 /從過程傳遞數(shù)組或其他數(shù)據(jù)結(jié)構(gòu),則用寄存器傳遞指向這些數(shù)據(jù)結(jié)構(gòu)開始地址的指針,如前面已解釋過的,傳遞指針到過程比過程用名字直接存取數(shù)據(jù)結(jié)構(gòu)要靈活的多。當(dāng)編寫在棧中傳遞參數(shù)的程序中,應(yīng)該借助如上圖所示中的棧狀態(tài)圖幫助你記錄當(dāng)前棧中任何內(nèi)容的位置。 系統(tǒng)功能調(diào)用和 BIOS 由一系列的中斷服務(wù)子程序構(gòu)成,但調(diào)用與返回不是使用子程序調(diào)用指令 CALL 和返回指令 RET, 而是通過軟中斷指令 INT n 和中斷返回指令 IRET 調(diào)用和返回的。 用 戶 區(qū) :應(yīng) 用 程 序 , D O SR A M6 4 0 KV i d e o D i s p l a yR A M1 2 8 KR O M2 5 6 K0 0 0 0 0 HC O O O HB F F F F HA O O O H9 F F F F HF F F F F HM e m o r y A l l o c a t i o n i n t h e I B M P C 類 型 0 指 針 除 法 錯(cuò) 誤類 型 2 5 5 指 針 ( 可 用 )..類 型 3 3 指 針 ( 可 用 )類 型 3 2 指 針 ( 可 用 )類 型 3 1 指 針 ( 保 留 )..類 型 5 指 針 ( 保 留 )類 型 4 指 針 溢 出類 型 3 指 針 1 字 節(jié) I N T 指 令類 型 2 指 針 非 屏 蔽 中 斷類 型 1 指 針 單 步I N T 0 0I N T 0 1I N T F FI N T 0 5I N T 0 4I N T 0 3I N T 0 2C SI P0 0 0 H3 F F H3 F C H0 8 0 H0 7 C H0 1 4 H0 1 0 H0 0 C H0 0 8 H0 0 4 H8 0 8 6 中 斷 向 量 表 Difference between INT and CALL instructions ? A “ CALL FAR” instruction can jump to any location within the 1 megabyte address range of the 8086 / 8088 CPU, but “ INT nn” goes to a fixed memory location in the interrupt vector table to get the address of the interrupt service routine. ? A “ CALL FAR” instruction is used by programmer in the sequence of instructions in the program but an externally activated hardware interrupt can e in at any time, requesting the attention of the CPU. ? A “ CALL FAR” instruction cannot be masked (disabled), but “ INT nn” belonging to externally activated hardware interrupts can be masked. ? A “ CALL FAR” instruction automatically saves only CS:IP of the next instruction on the stack, while “ INT nn” saves FR (flag register) in addition to CS:IP of the next instruction. ? At the end of the subroutine that has been called by the “ CALL FAR” instruction, the RET (return FAR) is the last instruction, whereas the last instruction in the interrupt service routine (ISR) for “ INT nn” is the instruction IRET (interrupt return). The difference is that RET pops CS,IP off the stack but the IRET pops off the FR (flag register) in addition to CS and IP. 1 41 5R = r e s e r v e d S F = s i g n f l a gU = u n d e f i n e d Z F = z e r o f l a gO F = o v e r f l o w f l a g A F = a u x i l i a r y c a r r y f l a gD F = d i r e c t i o n f l
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1