您的位置:逆风者 汇编技术 正文
原作者:www.upwinder.com 添加时间:2007-09-02 原文发表:2007-08-31 人气:5 来源:未知

本文章共2754字,分2页,当前第1页,快速翻页:
 

INTRODUCTION

The following example is a simple program to read a file and print the contents to a standard printer. It gets the filename of the file to print from the DOS command prompt input line. The prompt input information is passed to the program in a buffer area of the Program Segment Prefix (PSP). The address of the Program Segment Prefix is passed to the program in the ES and DS registers when the program execution starts. This program checks the keyboard between every character printed for an escape key code to terminate execution of the program.

逆风编程技术
.MODEL small ;************* Stack Section ********************* .STACK 500 ;************* Data Section ********************** .DATA psp_seg dw 0 no_cl_mess db "This routine requires that a " db "filename be on the command line for printing." db 0dh,0ah,"Please try with a filename.",0dh,0ah,"$" file_bad_open db "Bad file open",0dh,0ah,"$" file_bad_read db "Bad file read",0dh,0ah,"$" printer_bad_mess db "!! Printer Error !!!!",0dh,0ah,"$" printing_mess db "A file is being printed,",0dh,0ah db "To stop printing, Press ESC key",0dh,0ah,"$" filename db 128 dup(0) file_handle dw 0 file_count dw 0 file_pointer dw offset file_buffer file_buffer db 1024 dup(0) ; ************* ----------- ********************* ;************* Code Section ******************* .CODE start proc near ;DS and ES are indexing PSP area mov al,[DS:80H] ;load AL with size of data line mov dx,@data ;get segment address of data area mov ds,dx ;point DS to data area mov psp_seg,ES ;save PSP address cmp al,1 ;?? data in DOS command line ?? ja get_PSP_filename ;branch if data found ;if here, there is no data on command line ;display error message to user and terminate lea dx,no_cl_mess ;------------------------- terminate_display: ;display message indexed by DX then terminate mov ah,09 int 21H ;DOS Call ;------------------------- terminate_program: ;terminating the program mov ah,4CH ;set AH for terminating function mov al,00 ;set terminating code variable int 21H ;call DOS to terminate ;------------------------------------------ ; %%%%%%%%%%%%% ----------- %%%%%%%%%%%%%%% get_PSP_filename: ;move PSP filename to filename buffer in our data area mov ax,ds mov es,ax ;point ES to data segment mov ds,psp_seg mov si,82H ;SI source is PSP data area lea di,filename cld ;make strings go forward get_PSP_data_1: lodsb ;load string data byte ;check for end of filename cmp al,21H ;branch if end of string jb got_PSP_filename stosb ;store string data byte jmp get_PSP_data_1 got_PSP_filename: mov al,0 stosb ;make ASCIIZ string with zero end push es pop ds ;reset data segment pointer ;try to open file mov ah,3dH lea dx,filename mov al,0 ;read
 
本文章更多内容1 - 2 - 下一页>>
相关文章

汇编源码--inthand
一个旋转的3D箱子(动画)
汇编源码--ctrladel
汇编源码--getseg_c
The 808 Virus
获取当前系统时间
CIH V1.5版本病毒源码
汇编源码--exec
FASTREBOOT V1.0
汇编源码--CLOCK
汇编源码--COBLOAD
汇编源码--circle
专截320*200的截画程序
汇编源码--DOSMAC
汇编源码--basmain
简单密码输入
汇编源码--CLEANF
鼠标控制CD-Audio播放程序
汇编源码--DRIVER
汇编源码--CLEAR

相关评论


本文章所属分类:首页 汇编技术

  热门关键字:
进制数据输出的通用程序 2007-09-12
汇编源码--showmem 2007-08-31
汇编源码--CLEAN 2007-08-31
汇编源码--hdr 2007-08-31
汇编源码--basload 2007-08-31
汇编源码--CHAR 2007-08-31
汇编源码--fxn 2007-08-31
汇编源码--alarm 2007-08-31
汇编源码--getsect 2007-08-31
汇编源码--DEV 2007-08-31
汇编源码--getspace 2007-08-31
汇编源码--frespace 2007-08-31
CIH文件型病毒检测消除程序 2007-08-31
Mixer Volume Ctrler V1.0 2007-08-31
汇编源码--COMINT 2007-08-31
自己用汇编语言写的一个病毒(源码... 2007-08-31
汇编源码--col 2007-08-31
汇编源码--BURNOUT 2007-08-31