|
stack segment para stack 'stack' db 256 dup(0) stack ends ; data segment para public 'data' buffer db 16h dup(0) bufpt1 dw 0 bufpt2 dw 0 kbflag db 0
prompt db '---kbd_io program begin ---',13,10,'$' scantab db 0,0,'1234567890-=',0,0 db 'qwertyuiop[]',0dh,0 db 'asdfghjkl;',0,0,0,0 db 'zxcvbnm,./',0,0,0 db ' ',0,0,0,0,0,0,0,0,0,0,0,0,0 db '789-456+1230.' even shiftab db 0,0,'!@#$%^&*()_+',0,0 db 'QWERTYUIOP{}',0dh,0 db 'ASDFGHJKL:"',0,0,0 db 'ZXCVBNM<>?',0,0,0 db ' ',26 dup(0) even oldcs9 dw ? oldip9 dw ? data ends ; code segment para public 'code' start proc far assume cs:code,ds:data push ds mov ax,0 push ax mov ax,data mov ds,ax
cli mov al,09 mov ah,35h int 21h mov oldcs9,es mov oldip9,bx ;保存中斷 push ds mov dx,offset kbint mov ax,seg kbint mov ds,ax mov al,09 mov ah,25h int 21h pop ds ;設(shè)置中斷
in al,21h and al,0fdh out 21h,al
mov dx,offset prompt mov ah,09 int 21h sti forever: call kbget test kbflag,80h jnz endint push ax call dispchar pop ax cmp al,0dh jnz forever mov al,0ah call dispchar jmp forever endint: mov dx,oldip9 mov ax,oldcs9 mov ds,ax mov al,09h mov ah,25h int 21h
ret start endp kbget proc near push bx cli mov bx,bufpt1 cmp bx,bufpt2 jnz kbget2 cmp kbflag,80h jz kbget3 sti pop bx jmp kbget kbget2: mov al,[buffer+bx] inc bx cmp bx,16 jc kbget3 mov bx,0 kbget3: mov bufpt1,bx pop bx ret kbget endp ;------------------------------------------------------------ kbint proc far push bx push ax ; in al,60h push ax in al,61h or al,80h out 61h,al and al,7fh out 61h,al ; pop ax test al,80h jnz kbint5 cmp al,42 jz left_shif cmp al,54 jz right_shif test kbflag,03h ;判斷shif鍵是否按住 jnz press_shif mov bx,offset scantab xlat scantab cmp al,0 jnz kbint4 mov kbflag,80h jmp kbint2
left_shif: or kbflag,01h jmp kbint2 right_shif: or kbflag,02h jmp kbint2
press_shif: mov bx,offset shiftab xlat shiftab cmp al,0 jnz kbint4 mov kbflag,80h jmp kbint2 kbint4: mov bx,bufpt2 mov [buffer+bx],al inc bx cmp bx,16 jc kbint3 mov bx,0 kbint3: cmp bx,bufpt1 jz kbint2 mov bufpt2,bx kbint5: cmp al,0aah jz kbint1 cmp al,0b6h jz kbint1 jmp kbint2 kbint1: mov kbflag,0 kbint2: cli mov al,20h out 20h,al pop ax pop bx sti iret kbint endp ; dispchar proc near push bx mov bx,0 mov ah,0eh int 10h pop bx ret dispchar endp ; code ends end start
$P0000 $P0110 $P020A $P0320 $P040B $P0530 $P060B $P0740 $P0801 $P0A01 $p0B00 $M00018110 $M0101ED82 $M0200C048 $M0300E004 $M0400B005 $M0501A206 $M06959A01 $M0700E00D $M08001001 $M0901ED83 $M0A01ED87 $M0B01ED8E $M0C01ED96 $M0D028201 $M0E00E00F $M0F00A015 $M1001ED92 $M1101ED94 $M1200A017 $M13018001 $M14002018 $M15070A01 $M1600D181 $M17050A10 $M18068A11
08年新郵計劃朦朧消息
ms8noo9pK朦朧消息,僅供參考NS#h4@Bk
戊子年(生肖鼠)
1aOe:TR$rZH朱仙鎮(zhèn)木版年畫
oq/P*ro?r$rwww.zhaoonline.com薄一波同志誕生一百周年
$Q0}0Q5Bu9J+S#LZ)\王震同志誕生一百周年BaC&s(SxW
海南坡鹿/五指山(配合海南建省20周年)
e(IaX\#Pc\fS'SZ佛教題材:白馬寺等(中國與印度聯(lián)合發(fā)行)收藏大學 自由講壇Si3h.J0hBj1v
哪吒鬧海www.zhaoonline.comW4H?S5h)EU"H'X`
成語故事(二)#iYW"Br
寧夏回族自治區(qū)成立50周年EmKwz0W:x"|k0tSun
廣西壯族自治區(qū)成立50周年收藏大學 自由講壇9_9wY-b.`
海棠花www.zhaoonline.com}^;||Cm0ypv
驪山
4l9|zDi*~/X]收藏大學 自由講壇頤和園
~$_(RH@)i2?www.zhaoonline.com第29屆奧運會
0gH*k6jO2jF7L-e奧運項目(三) Ll.{ PN%vf
奧運會從北京到倫敦(中國與英國聯(lián)合發(fā)行)
%z8A~S7|Du0~u收藏大學 自由講壇殘奧會
A9YB+J{/duwww.zhaoonline.com民間傳說——牛郎織女len [?m.ka
陜西高速公路
f.B+U@~r?J2010年上海世界博覽會Z;q#_;vP
2010年廣州亞運會
6fd.Td j2Y萬里江山圖(@4M$B-p7V"Z:U4X
中國名亭(二)Ie5di]x{k(B
中國古橋——拱橋(二)
;**********************電話號碼表實現(xiàn)*******************************
;在本次試驗中需要注意基址寄存器BX的移動方法,對以字為單位的數(shù)組,BX的移動方式 ;是每移動一次加2或者減2 ;另外函數(shù)調(diào)用的過程中需要小心PUSH和pop的調(diào)用是否安全,例如在name_sort中pop CX的 ;時候沒有先Push CX,導致了name_sort函數(shù)不可以調(diào)用 ;此程序使用比較高效的方法只是對號碼單的首地址進行排序,為此開辟了一個地址數(shù)組 ;AdTable,類似C語言中的指針數(shù)組 ;在每個名字的前面存有每個名字的長度,有利于對名字進行比較,體現(xiàn)了空間換時間 ;程序調(diào)試難度較大,費時2天長度,長度349行 ;12月7日于海韻 ;================================================================== DateArea segment TemplateName db 20,?,20 dup(?) TemplateNumber db 9,?,9 dup(?) PhoneTable db 50 dup ( 21 dup (?), 8 dup (?) ,'$')
AdTable dw 50 dup (?)
FindedAdress dw 1 dup (?) InputNamePrint db 13,10,'Input name:','$' InputNumPrint db 13,10,'Input a telephone number:','$' AskForNumPrint db 13,10,'Do you want a telepment numbre:(Y/N)','$' NamePrint db 13,10,'name?','$' AnswerFindedPrint db 13,10,'name',16 dup (20h),'tel.',13,10,'$'
AnswerNoFindPrint db 13,10,'NO SUCH NAME!','$' DateArea ends ;===================================================================== CodeArea segment assume cs:CodeArea ,ds:DateArea ,es:DateArea ;----------------------------- main proc far
push ds sub ax,ax push ax mov ax,DateArea mov ds,ax mov es,ax ; mov bx,0 lea si,PhoneTable Start: lea dx , InputNamePrint mov ah,09h int 21h ; lea di,AdTable mov AdTable[bx],si call input_name;該函數(shù)還要返回輸入字母為終止時候的提示, ;可以返回一個寄存器的狀態(tài)來表示 jz Search call stor_name ; lea dx, InputNumPrint mov ah ,09h int 21h ; call inphone ; add si,30 add bx ,2 jmp Start
Search: ;lea dx, AskForNumPrint ;mov ah,09h ;int 21h call name_sort lea dx, AskForNumPrint mov ah,09h int 21h ; mov ah,1 int 21h sub al,4Eh ; jz Exit ; lea dx,NamePrint mov ah,09h int 21h ; call input_name ; call name_search ; call printline ; jmp Search Exit: ret main endp ;------------------------------ input_name proc near push ax push bx push cx push dx push si push di ; lea dx,TemplateName mov ah,0ah int 21h lea di ,TemplateName add di,1 mov al,[di] cmp al,0 ; pop di pop si pop dx pop cx pop bx pop ax ; ret input_name endp ;------------------------------ stor_name proc near push ax push bx push cx push dx push si push di ; mov di,AdTable[bx] lea si,TemplateName add si,1 mov dx,21 mov cl,[si] mov al,cl cbw mov cx,ax inc cx sub dx,cx cld repnz movsb mov cx,dx cld mov al ,20h repnz stosb ; pop di pop si pop dx pop cx pop bx pop ax ; ret ; stor_name endp ;------------------------------ inphone proc near push ax push bx push cx push dx push si push di ; lea dx,TemplateNumber mov ah,0ah int 21h ; mov di,AdTable[bx] add di,21 lea si,TemplateNumber add si,1 mov cl,[si] mov al,cl cbw mov cx,ax add si,1 cld repnz movsb ; pop di pop si pop dx pop cx pop bx pop ax ; ret inphone endp ;------------------------------ name_sort proc near push ax push bx push cx push dx push si push di lea dx, AskForNumPrint mov ah,09h int 21h mov cx,bx OuterSort: mov bx,0 InnerSort: mov si,AdTable[bx] add bx,2 mov di ,AdTable[bx] mov al,[si] mov dl,[di] cmp al,dl push cx jg AxGrBx mov al,dl cbw mov cx,ax jmp PassAGB AxGrBx: cbw mov cx,ax PassAGB: add si ,1 add di ,1 cld
repz cmpsb pop cx jb Belower mov ax,AdTable[bx] sub bx,2 mov dx,AdTable[bx] xchg ax,dx mov AdTable[bx],dx add bx,2 mov AdTable[bx],ax Belower: mov ax,bx add ax,2 cmp ax,cx jnz InnerSort sub cx,2 cmp cx,2 jnz OuterSort pop di pop si pop dx pop cx pop bx pop ax ret name_sort endp ;------------------------------ name_search proc near push ax push bx push cx push dx push si push di mov ax,bx mov bx ,0 mLoop: lea si,TemplateName+1 mov cl,[si] push ax mov al,cl cbw mov cx,ax add cx,1 pop ax mov di,AdTable[bx] cld repz cmpsb jz FindOutNum add bx, 2 cmp bx ,ax jz FindNoNum jmp mLoop FindNoNum: pop di pop si pop dx pop cx pop bx pop ax ret FindOutNum: mov dx,AdTable[bx] add dx,1 mov FindedAdress,dx ;mov ah,09h ; int 21h pop di pop si pop dx pop cx pop bx pop ax ret name_search endp ;------------------------------ printline proc near push ax push bx push cx push dx push si push di jz NoFind lea dx,AnswerFindedPrint mov ah,09 int 21h mov dx,[FindedAdress] mov ah,09h int 21h JMP RetPlace NoFind: lea dx,AnswerNoFindPrint mov ah,09h int 21h RetPlace: pop di pop si pop dx pop cx pop bx pop ax
ret printline endp ;------------------------------
CodeArea ends end main
摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include <cstdlib>#include <iostream>#include <conio.h>#define &... 閱讀全文
/* 07.11.20 于海韻 */ #include "sys/times.h" #include "apue.h" #include "fcntl.h" clock_t times(struct tms *buf);
static void pr_times(clock_t real ,struct tms *tmsstart, struct tms *tmsend);
int main(int argc, char *argv[]) { struct tms tmsstart,tmsend; clock_t start,end; off_t excursion; if((excursion=lseek(0,0,SEEK_END))==-1)printf("can not seek!\n"); char buf[excursion]; /*printf("excutsion ==#%d\n",excursion);*/ int outfile_fd;/*out file descrite tag */ lseek(0,0,SEEK_SET);/*it is very importent to go back to the beginning of input file!*/ if(read(0,buf,excursion)==0)printf("read OK!\n"); /* buf[excursion]='\0';*/ if(argc==3 && strcmp(argv[2],"sync")==0) { if(( outfile_fd=open(argv[1],O_RDWR|O_CREAT|O_SYNC,0666))<0)err_sys("creat error");} else if(argc==2) {if (( outfile_fd=open(argv[1],O_RDWR|O_CREAT,0666))<0)err_sys("creat error");} else{printf("para error!\n");exit(1);} long size=1024; fflush(stdin); printf("BUFFSIZE USER CPU SYSTEM CPU REAL TIMES CIRCLE TIMES\n"); int n; int t; char *p=buf; long redo_count;/*re do copy times*/
do{ if((start=times(&tmsstart))==-1)err_sys("times error"); redo_count=0;/*it is very import to set the counter zero at every circle */ t=1;/*it is use in the inside while */ while((n=write(outfile_fd,p,size))==size) { p+=size;/*the begin buf must increase every time*/ redo_count++;/*count how many times circle do*/ t=size*redo_count;/*one tag to count how many charaters we have travered*/ /* printf("excursion==%d t==%d excursion-t==%d size==%d\n",excursion,t,excursion-t,size);*/ if((excursion-t)<size)break; } if(excursion-t>0) if(write(outfile_fd,p,excursion-t)!=(excursion-t))err_sys("read error"); if((end=times(&tmsend))==-1)err_sys("times error"); printf("%7ld",size); pr_times(end-start,&tmsstart,&tmsend); printf("%7ld\n",redo_count); lseek(outfile_fd,0,SEEK_SET);/*let the outfile pointer go back to the beginning of outfile!*/ p=buf;/*let p return to the beginning of buf;*/ /* printf("size=%d excursion=%d\n",size,excursion);*/ } while((size*=2)<=excursion); return 0; } static void pr_times(clock_t real ,struct tms *tmsstart,struct tms *tmsend) {static long clktck=0; if(clktck==0) if((clktck=sysconf(_SC_CLK_TCK))<0) printf("sysconf error");
printf(" %2.5f",(tmsend->tms_utime-tmsstart->tms_utime)/(double)clktck); printf(" %2.5f",(tmsend->tms_stime-tmsstart->tms_stime)/(double)clktck); printf(" %2.5f ",real/(double)clktck); }
摘要: 這是 http://222.34.36.100/longrange/%E6%B1%87%E7%BC%96%E8%AF%AD%E8%A8%80.doc 的 HTML 檔。G o o g l e 在網(wǎng)路漫游時會自動將檔案轉(zhuǎn)換成 HTML 網(wǎng)頁來儲存。請使用網(wǎng)址 http://www.google.com/search?q=cache:HLwqrGxAqr0J:222.34.36.100/longran... 閱讀全文
剛來海韻,對這個新鮮的環(huán)境滿懷好奇!想到處去逛逛,看看廈門這邊的風土人情,但是接下去是越來越沉重的課業(yè)負擔,根本就沒有辦法讓自己停下來,停下來的時候已經(jīng)算是放任自己,墮落自己,有時候還會感嘆自己真是沒用,但這又能怎樣?換來的只是氣餒與傷心,我只能不斷的告訴自己,堅持住! 有幾同學都認為我是研究性的,我看看自己有時候確實有點象,但可憐的是有時候頭難受的讓人無法繼續(xù)思考,真是矛盾我是否該走研究的道路。。。。。
|