kernel.lst

来自「DOS SOURCE CODE,DOS-C started in 1988 as」· LST 代码 · 共 1,267 行 · 第 1/4 页

LST
1,267
字号
    278	00AC  55				     push    bp
    279	00AD  1E				     push    ds
    280	00AE  06				     push    es
    281	00AF  53				     push    bx
    282
    283						     ; small model
    284	00B0  B8 0000s				     mov     ax,DGROUP			     ; correct for segments
    285	00B3  8E D8				     mov     ds,ax			     ; ax to carry segment
    286	00B5  89 26 0012r			     mov     word ptr DGROUP:con_dos_stk,sp  ; use internal stack
    287	00B9  8C 16 0014r			     mov     word ptr DGROUP:con_dos_seg,ss
    288	00BD  9C				     pushf				     ; put flags in bx
    289	00BE  5B				     pop     bx
    290	00BF  FA				     cli				     ; no interrupts
    291	00C0  8E D0				     mov     ss,ax
    292	00C2  BC 0200r				     mov     sp,offset DGROUP:con_stk_top
    293	00C5  53				     push    bx
    294	00C6  9D				     popf				     ; restore interrupt flag
    295	00C7  8B EC				     mov     bp,sp			     ; make a c	frame
    296	00C9  FF 36 0008r			     push    word ptr con_rp+2
    297	00CD  FF 36 0006r			     push    word ptr con_rp
    298	00D1  E8 0000e				     call    _con_driver
    299	00D4  59				     pop     cx
Turbo Assembler	 Version 3.1	    04/11/13 12:54:48	    Page 9
kernel.ASM



    300	00D5  59				     pop     cx
    301	00D6  C4 1E 0006r			     les     bx,dword ptr con_rp	     ; now return completion code
    302	00DA  26: 89 47	03			     mov     word ptr es:[bx].status,ax	     ; mark operation complete
    303	00DE  9C				     pushf
    304	00DF  5B				     pop     bx
    305	00E0  FA				     cli				     ; no interrupts
    306	00E1  8B 26 0012r			     mov     sp,word ptr DGROUP:con_dos_stk  ; use dos stack
    307	00E5  8E 16 0014r			     mov     ss,word ptr DGROUP:con_dos_seg
    308	00E9  53				     push    bx
    309	00EA  9D				     popf				     ; restore interrupt flag
    310	00EB  5B				     pop     bx
    311	00EC  07				     pop     es
    312	00ED  1F				     pop     ds
    313	00EE  5D				     pop     bp
    314	00EF  5F				     pop     di
    315	00F0  5A				     pop     dx
    316	00F1  59				     pop     cx
    317	00F2  58				     pop     ax
    318	00F3  5E				     pop     si
    319	00F4  CB				     ret
    320	00F5			     con_entry	     endp
    321
    322						     ;
    323						     ; block device strategy
    324						     ;
    325						     ; NOTE: This code is not standard device driver handlers
    326						     ; It is written for sperate code and data space.
    327						     ;
    328	00F5			     blk_strategy    proc    far
    329	00F5  1E				     push    ds
    330	00F6  50				     push    ax
    331						     ; small model
    332	00F7  B8 0000s				     mov     ax,DGROUP			     ; small model - cs	!= ds
    333	00FA  8E D8				     mov     ds,ax
    334	00FC  8C 06 000Cr			     mov     word ptr DGROUP:blk_rp+2,es
    335	0100  89 1E 000Ar			     mov     word ptr DGROUP:blk_rp,bx
    336	0104  58				     pop     ax
    337	0105  1F				     pop     ds
    338	0106  CB				     ret
    339	0107			     blk_strategy    endp
    340
    341						     ;
    342						     ; block device interrupt
    343						     ;
    344						     ; NOTE: This code is not standard device driver handlers
    345						     ; It is written for sperate code and data space.
    346						     ;
    347	0107			     blk_entry	     proc    far
    348	0107  9C				     pushf
    349	0108  50				     push    ax
    350	0109  53				     push    bx
    351	010A  51				     push    cx
    352	010B  52				     push    dx
    353	010C  55				     push    bp
    354	010D  56				     push    si
Turbo Assembler	 Version 3.1	    04/11/13 12:54:48	    Page 10
kernel.ASM



    355	010E  57				     push    di
    356	010F  1E				     push    ds
    357	0110  06				     push    es
    358
    359						     ; small model
    360	0111  B8 0000s				     mov     ax,DGROUP			     ; correct for segments
    361	0114  8E D8				     mov     ds,ax			     ; ax to carry segment
    362	0116  89 26 0016r			     mov     word ptr DGROUP:blk_dos_stk,sp  ; use internal stack
    363	011A  8C 16 0018r			     mov     word ptr DGROUP:blk_dos_seg,ss
    364	011E  9C				     pushf				     ; put flags in bx
    365	011F  5B				     pop     bx
    366	0120  FA				     cli				     ; no interrupts
    367	0121  8E D0				     mov     ss,ax
    368	0123  BC 0400r				     mov     sp,offset DGROUP:blk_stk_top
    369	0126  53				     push    bx
    370	0127  9D				     popf				     ; restore interrupt flag
    371	0128  8B EC				     mov     bp,sp			     ; make a c	frame
    372	012A  FF 36 000Cr			     push    word ptr blk_rp+2
    373	012E  FF 36 000Ar			     push    word ptr blk_rp
    374	0132  E8 0000e				     call    _blk_driver
    375	0135  59				     pop     cx
    376	0136  59				     pop     cx
    377	0137  C4 1E 000Ar			     les     bx,dword ptr blk_rp		     ; now return completion code
    378	013B  26: 89 47	03			     mov     word ptr es:[bx].status,ax	     ; mark operation complete
    379	013F  FA				     cli				     ; no interrupts
    380	0140  8B 26 0016r			     mov     sp,word ptr DGROUP:blk_dos_stk  ; use dos stack
    381	0144  8E 16 0018r			     mov     ss,word ptr DGROUP:blk_dos_seg
    382	0148  07				     pop     es
    383	0149  1F				     pop     ds
    384	014A  5F				     pop     di
    385	014B  5E				     pop     si
    386	014C  5D				     pop     bp
    387	014D  5A				     pop     dx
    388	014E  59				     pop     cx
    389	014F  5B				     pop     bx
    390	0150  58				     pop     ax
    391	0151  9D				     popf
    392	0152  CB				     ret
    393	0153			     blk_entry	     endp
    394
    395
Turbo Assembler	 Version 3.1	    04/11/13 12:54:48	    Page 11
kernel.ASM



    396
    397						     ;
    398						     ; clock device strategy
    399						     ;
    400						     ; NOTE: This code is not standard device driver handlers
    401						     ; It is written for sperate code and data space.
    402						     ;
    403	0153			     clk_strategy    proc    far
    404	0153  1E				     push    ds
    405	0154  50				     push    ax
    406						     ; small model
    407	0155  B8 0000s				     mov     ax,DGROUP			     ; small model - cs	!= ds
    408	0158  8E D8				     mov     ds,ax
    409	015A  8C 06 0010r			     mov     word ptr DGROUP:clk_rp+2,es
    410	015E  89 1E 000Er			     mov     word ptr DGROUP:clk_rp,bx
    411	0162  58				     pop     ax
    412	0163  1F				     pop     ds
    413	0164  CB				     ret
    414	0165			     clk_strategy    endp
    415
    416						     ;
    417						     ; clock device interrupt
    418						     ;
    419						     ; NOTE: This code is not standard device driver handlers
    420						     ; It is written for sperate code and data space.
    421						     ;
    422	0165			     clk_entry	     proc    far
    423	0165  9C				     pushf
    424	0166  50				     push    ax
    425	0167  53				     push    bx
    426	0168  51				     push    cx
    427	0169  52				     push    dx
    428	016A  55				     push    bp
    429	016B  56				     push    si
    430	016C  57				     push    di
    431	016D  1E				     push    ds
    432	016E  06				     push    es
    433
    434						     ; small model
    435	016F  B8 0000s				     mov     ax,DGROUP			     ; correct for segments
    436	0172  8E D8				     mov     ds,ax			     ; ax to carry segment
    437	0174  89 26 001Ar			     mov     word ptr DGROUP:clk_dos_stk,sp  ; use internal stack
    438	0178  8C 16 001Cr			     mov     word ptr DGROUP:clk_dos_seg,ss
    439	017C  9C				     pushf				     ; put flags in bx
    440	017D  5B				     pop     bx
    441	017E  FA				     cli				     ; no interrupts
    442	017F  8E D0				     mov     ss,ax
    443	0181  BC 0600r				     mov     sp,offset DGROUP:clk_stk_top
    444	0184  53				     push    bx
    445	0185  9D				     popf				     ; restore interrupt flag
    446	0186  8B EC				     mov     bp,sp			     ; make a c	frame
    447	0188  FF 36 0010r			     push    word ptr clk_rp+2
    448	018C  FF 36 000Er			     push    word ptr clk_rp
    449	0190  E8 0000e				     call    _clk_driver
    450	0193  59				     pop     cx
Turbo Assembler	 Version 3.1	    04/11/13 12:54:48	    Page 12
kernel.ASM



    451	0194  59				     pop     cx
    452	0195  C4 1E 000Er			     les     bx,dword ptr clk_rp	     ; now return completion code
    453	0199  26: 89 47	03			     mov     word ptr es:[bx].status,ax	     ; mark operation complete
    454	019D  FA				     cli				     ; no interrupts
    455	019E  8B 26 001Ar			     mov     sp,word ptr DGROUP:clk_dos_stk  ; use dos stack
    456	01A2  8E 16 001Cr			     mov     ss,word ptr DGROUP:clk_dos_seg
    457	01A6  07				     pop     es
    458	01A7  1F				     pop     ds
    459	01A8  5F				     pop     di
    460	01A9  5E				     pop     si
    461	01AA  5D				     pop     bp
    462	01AB  5A				     pop     dx
    463	01AC  59				     pop     cx
    464	01AD  5B				     pop     bx
    465	01AE  58				     pop     ax
    466	01AF  9D				     popf
    467	01B0  CB				     ret
    468	01B1			     clk_entry	     endp
    469
    470
Turbo Assembler	 Version 3.1	    04/11/13 12:54:48	    Page 13
kernel.ASM



    471				     ;
    472				     ; special interrupt routine for break key handling
    473				     ;
    474
    475
    476				     ;
    477				     ; i_save
    478				     ;	     save machine context on stack after an interrupt
    479				     ;	     does not save ss and sp
    480				     ;
    481				     ;	     assumes flags and cs:ip are on stack from interrupt
    482				     ;
    483	01B1			     i_save	     proc    near
    484						     public  i_save
    485	01B1  55				     push    bp		     ; start saving bp
    486	01B2  8B EC				     mov     bp,sp	     ; and mark	frame for exit
    487	01B4  57				     push    di		     ; save the	rest of	the registers
    488	01B5  56				     push    si
    489	01B6  53				     push    bx
    490	01B7  51				     push    cx
    491	01B8  52				     push    dx
    492	01B9  1E				     push    ds
    493	01BA  06				     push    es
    494	01BB  87 46 02				     xchg    ax,[bp+2]	     ; swap return address with	ax
    495	01BE  50				     push    ax		     ; put it back
    496	01BF  8B 46 02				     mov     ax,[bp+2]	     ; recover ax from entry
    497	01C2  8B 6E 00				     mov     bp,[bp]	     ; and bp
    498	01C5  C3				     ret
    499	01C6			     i_save	     endp
    500
    501
    502				     ;
    503				     ; i_exit
    504				     ;	     recovers context from i_save and does interrupt return
    505				     ;	     must be jumped to
    506				     ;
    507				     ;	     warning - make sure you're	using the right	stack
    508				     ;
    509	01C6			     i_exit	     proc    near
    510						     public  i_exit
    511	01C6  07				     pop     es		     ; recover context
    512	01C7  1F				     pop     ds
    513	01C8  5A				     pop     dx
    514	01C9  59				     pop     cx
    515	01CA  5B				     pop     bx
    516	01CB  5E				     pop     si
    517	01CC  5F				     pop     di
    518	01CD  5D				     pop     bp
    519	01CE  58				     pop     ax
    520	01CF  CF				     iret		     ; and make	like a tree (leave)
    521	01D0			     i_exit	     endp
    522
    523
    524					     extrn   _break_handler:near
    525
Turbo Assembler	 Version 3.1	    04/11/13 12:54:48	    Page 14
kernel.ASM



    526	01D0			     _break_key	     proc    near
    527						     public  _break_key
    528	01D0  E8 FFDE				     call    i_save		     ; save context
    529	01D3  8C C8				     mov     ax,cs		     ; correct for segments
    530	01D5  8E D8				     mov     ds,ax		     ; ax to carry segment
    531	01D7  89 26 001Er			     mov     word ptr DGROUP:intr_dos_stk,sp ; use internal stack
    532	01DB  8C 16 0020r			     mov     word ptr DGROUP:intr_dos_seg,ss
    533	01DF  9C				     pushf			     ; put flags in bx
    534	01E0  5B				     pop     bx
    535	01E1  FA				     cli			     ; no interrupts
    536	01E2  8E D0				     mov     ss,ax
    537	01E4  BC 0800r				     mov     sp,offset DGROUP:intr_stk_top
    538	01E7  53				     push    bx
    539	01E8  9D				     popf			     ; restore interrupt flag
    540	01E9  8B EC				     mov     bp,sp		     ; make a c	frame
    541	01EB  E8 0000e				     call    _break_handler	     ; call handler
    542	01EE  C4 1E 0006r			     les     bx,dword ptr con_rp     ; now return completion code
    543	01F2  9C				     pushf
    544	01F3  5B				     pop     bx
    545	01F4  FA				     cli			     ; no interrupts
    546	01F5  8B 26 001Er			     mov     sp,word ptr DGROUP:intr_dos_stk ; use dos stack
    547	01F9  8E 16 0020r			     mov     ss,word ptr DGROUP:intr_dos_seg
    548	01FD  53				     push    bx
    549	01FE  9D				     popf
    550	01FF  EB C5				     jmp     i_exit		     ; and restore & exit
    551	0201			     _break_key	     endp
    552
    553	0201			     _TEXT	     ends
    554
    555
    556	0000			     _FIXED_DATA     segment para public 'DATA'
    557
    558				     ; Because of the following	bytes of data, THIS MODULE MUST	BE THE FIRST
    559				     ; IN THE LINK SEQUENCE.  THE BYTE AT DS:0004 determines the SDA format in
    560				     ; use.  A 0 indicates MS-DOS 3.X style, a 1 indicates MS-DOS 4.0-6.X style.
    561						     public  DATASTART
    562	0000			     DATASTART	     label   byte
    563	0000  00		     dos_data	     db	     0
    564	0001  0014				     dw	     start

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?