接口考试实验题.docx
《接口考试实验题.docx》由会员分享,可在线阅读,更多相关《接口考试实验题.docx(14页珍藏版)》请在冰豆网上搜索。
接口考试实验题
字母下落一行的子程序
参考程序清单如下:
DSEGSEGMENT
ROWDB0
COLDB20
CHRDB41H
DELTDB10
DSEGENDS
CSEGSEGMENT
ASSUMECS:
CSEG,DS:
DSEG
START:
MOVAX,DSEG
MOVDS,AX
MOVAH,0
INT16H
SUBAL,30H
MOVDELT,AL
MOVCX,25
AGAIN:
MOVDH,ROW
MOVDL,COL
MOVAL,CHR
CALLDROP
INCROW
CALLDEALY
DECCX
JNZAGAIN
MOVAH,4CH
INT21H
DEALY:
MOVBL,DELT
DEALY1:
MOVDX,0
DEALY2:
DECDX
JNZDEALY2
DECBL
JNZDEALY1
RET
DROPPROCNEAR
PUSHAX
PUSHDX
ANDDH,DH
MOVDX,3D4H
MOVAL,10
OUTDX,AL
MOVBH,0
MOVAH,2
POPDX
PUSHDX
DECDH
INT10H
MOVAL,20H
MOVAH,0EH
INT10H
DROP1:
POPDX
POPAX
MOVAH,02
INT10H
MOVAH,0EH
INT10H
RET
DROPENDP
CSEGENDS
ENDSTART
2)显示一个开动的汽车
参考程序清单:
DATA_SEGSEGMENT
CARDB7
DB52H,70H,0,0
DB0B1H,70H,0,1
DB0DBH,7,0,1
DB0DBH,7,0,1
DB4FH,7,1,0
DB4FH,7,0,-3
DB2,7,-2,1
CHAR_CNTDW?
POINTERDW?
LINE_ONDB?
COL_ONDB?
DATA_SEGENDS
CODE_SEGSEGMENTASSUNMECS:
CODE_SEG,DS:
DATA_SEG
MAINPROCFAR
PUSHDS
SUBAX,AX
PUSHAX
MOVDX,DATA_SEG
MOVDS,AX
CALLCLEAR_SCREEN
LEADI,CAR
MOVDH,10
MOVDL,10
CALLMOVE_SHAPE
RET
MAINENDP
CLEAR_SCREENPROCNEAR
PUSHAX
PUSHBX
PUSHCX
MOVAH,6
MOVAL,0
MOVCH,0
MOVDH,24
MOVDL,79
MOVBH,7
INT10H
POPDX
POPCX
POPBX
POPAX
RET
CLEAR_SCREENENDP
MOVE_SHAPEPROCNEAR
PUSHAX
PUSHBX
PUSHCX
PUSHDX
PUSHDI
MOVAH,0FH
INT10H
SUBCH,CH
MOVCL,[DI]
INCDI
MOVCHAR_CNT,CX
MOVPOINTER,DI
MOVLINE_ON,DH
MOVCOL_ON,DI
PLOT_NEXT:
ADDAH,[DI+2]
ADDDL,[DI+3]
CMPDI,80
JBMOV_CRSR
CALLERASE
P0PDI
POPDX
POPCX
POPBX
POPAX
RET
MOV_CRSR:
MOVAH,2
INT10H
MOVAL,[DI+1]
PUSHCX
MOVCX,1
MOVAH,09
INT10H
POPCX
ADDDI,4
LOOPPIOT_NEXT
CALLDLY_QRTR
CALLERASE
JMPSHORTPLOT_NEXT
MOVE_SHAPEENDP
ERASEPROC
MOVCX,CHAR_CNT
MOVDI,POINTER
MOVDH,LINE_ON
MOVDL,COL_ON
ERASE_NEXT:
ADDDH,[DI+2]
ADDDL,[DI+3]
MOVAH,2
INT10H
MOVAL,[AI]
MOVBL,0
PUSHCX
MOVCX,1
MOVAH,9
INT10H
POPCX
ADDDI,4
LOOPERASE_NEXT
MOVCX,CHAR_CNT
MOVDI,POINTER
MOVDH,LINE_ON
INCCOL_ON
MOVDL,COL_ON
RET
ERASEENDP
DLY_QRTRPROCNEAR
PUSHCX
PUSHBX
MOVDX,25
D11:
MOVCX,2801
D12:
LOOPD12
DECDX
JNZD11
POPDX
POPCX
RET
DLY_QRTRENDP
CODE_SEGENDS
ENDMAIN
在屏幕中部四处分别显示黑桃、红心、方块和草花
参考程序清单如下:
STACKSEGMENTSTACK’STACK’
DW32DUP(?
)
STACKENDS
DATASEGMENT
CDSHDB5,70H,10,40
DB4,74H,13,37
DB6,70H,13,43
DB3,74H,16,40
DATAENDS
CODESEGMENT
BEGINPROCFAR
ASSUMESS:
STACK,CS:
CODE,DS:
DATA
PUSHDS
SUBAX,AX
PUSHAX
MOVAX,DATA
MOVDS,AX
MOVAH,0
MOVAL,3
INT10H
MOVAH,15
INT10H
MOVSI,OFFSETCDSH
MOVCX,4
AGAIN:
PUSHCX
MOVAH,2
MOVDH,[SI+2]
MOVDL,[SI+3]
INT10H
MOVAH,9
MOVAL,[SI]
MOVBL,[SI+1]
MOVCX,1
INT10H
ADDSI,4
Popcx
LOOPAGAIN
RET
BEGINENDP
CODEENDS
ENDBEGIN
2)在屏幕的左上角显示一排“小人”,白色、红色、绿色、黄色各8个。
小人由3个字符组成
参考程序清单如下:
STACKSEGMENTSTACK’STACK’
DW32DUP(?
)
STACKENDS
DATASEGMENT
DATABDB1,7,0,0,1,4,0,8,1,2,0,16,1,14,0,24
DB4,7,1,0,4,4,1,8,4,2,1,16,4,14,1,24
DB13H,7,2,0,13H,4,2,8,13H,2,2,16,13H,14,2,24
DATAENDS
CODESEGMENT
BEGINPROCFAR
ASSUMESS:
STACK,CS:
CODE,DS:
DATA
PUSHDS
SUBAX,AX
PUSHAX
MOVAX,DATA
MOVDS,AX
MOVAH,0
MOVAL,3
INT10H
MOVAH,15
INT10H
MOVSI,OFFSETDATAB
MOVCX,3
AGAOT:
PUSHCX
MOVCX,4
AGAIN:
PUSHCX
MOVAH,2
MOVDH,[SI+2]
MOVDL,[SI+3]
INT10H
MOVAL,[SI]
MOVAH,9
MOVBL,[SI+1]
MOVCX,8
INT10H
ADDSI,4
POPCX
LOOPAGAIN
POPCX
LOOPAGAOT
RET
BEGINENDP
CODEENDS
ENDBEGIN
编制循环发出乐谱声音的
参考程序如下:
DSEGSEGMENT
DATADW262,294,330,349,392,440,494,524
DSEGENDS
CSEGSEGMENTASSUMECS:
CSEG,DS:
DSEG
START:
MOVAX,DSEG
MOVDS,AX
AGAIN:
MOVSI,OFFSETDATA
MOVCL,8
LOOP1:
CALLSND1
ADDSI,2
DECCL
JNZLOOP1
MOVCL,7
LOOP2:
CALLSND1
SUBSI,2
DECCL
JNZLOOP2
JMPAGAIN
SND1PROCNEAR
MOVDX,[SI]
MOVAX,1000
MOVBL,3
CALLSOUND
MOVAH,01
INT16H
JZSND2
MOVAH,0
INT16H
CMPAL,1BH
JNZSND2
MOVAH,4CH
INT21H
SND2:
RET
SND1ENDP
SOUNDPROCNEAR
PUSHDX
PUSHCX
PUSHBX
PUSHAX
MOVCX,DX
MOVAL,10110110B
OUT43H,AL
MOVDX,0012H
MOVAX,34DCH
DIVCX
OUT42H,AL
MOVAL,AH
OUT42H,AL
INAL,61H
MOVBH,AL
ANDAL,0FCH
ORAL,BL
OUT61H,AL
POPAX
PUSHAX
MOVCX,1000
MULCX
MOVCX,DX
MOVDX,AX
MOVAH,86H
INT15H
MOVAL,BH
OUT61H,AL
POPAX
POPBX
POPCX
POPDX
RET
SOUNDENDP
CSEGENDS
ENDSTART
2)模拟电话铃声
参考程序清单:
CSEGSEGMENTASSUMECS:
CSEG
SOUNDPROC
PUSHCX
PUSHSI
MOVSI,DX
MOVAL,10110110B
OUT43H,AL
MOVDX,0012H
MOVAX,34DCH
DIVSI
OUT42H,AL
MOVAL,AH
OUT42H,AL
INAL,61H
ORAL,03H
OUT61H,AL
POPAX
MOVDX,1000
MULDX
MOVCX,DX
MOVDX,AX
MOVAH,86H
INT15H
POPSI
POPCX
RET
SOUNDENDP
RINGPROCFAR
PUSHDS
XORAX,AX
PUSHAX
MOVBP,8
AGAIN:
MOVCX,30
NE