newplan

阿基米德在洗澡時發現浮力原理,高興得來不及穿㆖褲子,跑到街㆖大喊:Eureka(我找到了)。
posts - 39, comments - 26, trackbacks - 0, articles - 4
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

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                ;设置中断

    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

posted @ 2008-01-04 00:12 山泉弯延 阅读(890) | 评论 (0)编辑 收藏

$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

posted @ 2008-01-04 00:10 山泉弯延 阅读(138) | 评论 (0)编辑 收藏

08年新邮计划朦胧消息
ms8noo9pK朦胧消息,仅供参考NS#h4@Bk
戊子年(生肖鼠)
1aOe:TR$rZH朱仙镇木版年画
oq/P*ro?r$rwww.zhaoonline.com薄一波同志诞生一百周年
$Q0}0Q5Bu9J+S#LZ)\王震同志诞生一百周年BaC&s(SxW
海南坡鹿/五指山(配合海南建省20周年)
e(I aX\#Pc\fS'SZ佛教题材:白马寺等(中国与印度联合发行)收藏大学 自由讲坛Si3h.J0hBj1v
哪吒闹海www.zhaoonline.comW4H�S5h)E U"H'X`
成语故事(二)#iYW"Br
宁夏回族自治区成立50周年EmKwz0W:x"|k0tSun
广西壮族自治区成立50周年收藏大学 自由讲坛9_9w Y-b.`
海棠花www.zhaoonline.com}^;||Cm0ypv
骊山
4l9|zDi*~/X]收藏大学 自由讲坛颐和园
~$_(RH@)i2?www.zhaoonline.com第29届奥运会
0gH*k6j O2jF7L-e奥运项目(三) Ll.{ PN%vf
奥运会从北京到伦敦(中国与英国联合发行)
%z8A~S7|Du0~u收藏大学 自由讲坛残奥会
A9YB+J{/duwww.zhaoonline.com民间传说——牛郎织女l e n [�m.ka
陕西高速公路
f.B+U@~r�J2010年上海世界博览会Z;q#_;vP
2010年广州亚运会
6fd.T d j2Y万里江山图(@4M$B-p7V"Z:U4X
中国名亭(二)Ie5di]x{k(B
中国古桥——拱桥(二)

posted @ 2007-12-08 00:09 山泉弯延 阅读(191) | 评论 (0)编辑 收藏

;**********************电话号码表实现*******************************

 ;在本次试验中需要注意基址寄存器BX的移动方法,对以字为单位的数组,BX的移动方式
 ;是每移动一次加2或者减2
 ;另外函数调用的过程中需要小心PUSH和pop的调用是否安全,例如在name_sort中pop CX的
 ;时候没有先Push CX,导致了name_sort函数不可以调用
 ;此程序使用比较高效的方法只是对号码单的首地址进行排序,为此开辟了一个地址数组
 ;AdTable,类似C语言中的指针数组
 ;在每个名字的前面存有每个名字的长度,有利于对名字进行比较,体现了空间换时间
 ;程序调试难度较大,费时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;该函数还要返回输入字母为终止时候的提示
,
      ;可以返回一个寄存器的状态来表示
       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

posted @ 2007-12-07 19:22 山泉弯延 阅读(2561) | 评论 (2)编辑 收藏

     摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include <cstdlib>#include <iostream>#include <conio.h>#define &...  阅读全文

posted @ 2007-12-04 18:10 山泉弯延 阅读(2648) | 评论 (0)编辑 收藏

     摘要: 07年11月22日于海韵  阅读全文

posted @ 2007-11-22 23:01 山泉弯延 阅读(422) | 评论 (0)编辑 收藏

/*
 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);

 

posted @ 2007-11-21 18:45 山泉弯延 阅读(1171) | 评论 (0)编辑 收藏

     摘要: 这是 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 在网路漫游时会自动将档案转换成 HTML 网页来储存。请使用网址 http://www.google.com/search?q=cache:HLwqrGxAqr0J:222.34.36.100/longran...  阅读全文

posted @ 2007-11-19 19:10 山泉弯延 阅读(15292) | 评论 (1)编辑 收藏

      刚来海韵,对这个新鲜的环境满怀好奇!想到处去逛逛,看看厦门这边的风土人情,但是接下去是越来越沉重的课业负担,根本就没有办法让自己停下来,停下来的时候已经算是放任自己,堕落自己,有时候还会感叹自己真是没用,但这又能怎样?换来的只是气馁与伤心,我只能不断的告诉自己,坚持住!
     有几同学都认为我是研究性的,我看看自己有时候确实有点象,但可怜的是有时候头难受的让人无法继续思考,真是矛盾我是否该走研究的道路。。。。。
    

posted @ 2007-11-19 13:04 山泉弯延 阅读(504) | 评论 (0)编辑 收藏

http://wiki.ubuntu.org.cn/%E5%BF%AB%E9%80%9F%E8%AE%BE%E7%BD%AE%E6%8C%87%E5%8D%97/DapperDrake#.E4.BF.AE.E6.94.B9.E6.BA.90.E5.B9.B6.E6.9B.B4.E6.96.B0.E5.8D.87.E7.BA.A7Ubuntu

posted @ 2007-11-17 23:44 山泉弯延 阅读(97) | 评论 (0)编辑 收藏

仅列出标题
共4页: 1 2 3 4