entry.lst
来自「DOS SOURCE CODE,DOS-C started in 1988 as」· LST 代码 · 共 582 行 · 第 1/2 页
LST
582 行
267 0025 _int21_handler proc far
268 ;
269 ; Create the stack frame for C call. This is done to
270 ; preserve machine state and provide a C structure for
271 ; access to registers.
272 ;
273 ; Since this is an interrupt routine, CS, IP and flags were
274 ; pushed onto the stack by the processor, completing the
275 ; stack frame.
Turbo Assembler Version 3.1 04/11/13 12:54:48 Page 6
entry.ASM
276 ;
277 ; NB: stack frame is MS-DOS dependent and not compatible
278 ; with compiler interrupt stack frames.
279 ;
280 PUSH$ALL
1 281 0025 06 push es
1 282 0026 1E push ds
1 283 0027 55 push bp
1 284 0028 57 push di
1 285 0029 56 push si
1 286 002A 52 push dx
1 287 002B 51 push cx
1 288 002C 53 push bx
1 289 002D 50 push ax
290
291 ;
292 ; Create kernel refernce frame.
293 ;
294 ; NB: At this point, SS != DS and won't be set that way
295 ; until later when which stack to run on is determined.
296 ;
297 002E BD 0000s mov bp,DGROUP
298 0031 8E DD mov ds,bp
299 0033 8B EC mov bp,sp
300 ;
301 ; Push the far pointer to the register frame for
302 ; int21_syscall and remainder of kernel.
303 ;
304 0035 16 push ss
305 0036 8D 46 00 lea ax,word ptr [bp]
306 0039 50 push ax
307 003A E8 0000e call near ptr _int21_syscall
308 ;
309 ; Clean up stack. It's int2_syscall responsibility to
310 ; restore user stack.
311 ;
312 003D 59 pop cx
313 003E 59 pop cx
314 ;
315 ; Recover registers from system call. Registers and flags
316 ; were modified by the system call.
317 ;
318 POP$ALL
1 319 003F 58 pop ax
1 320 0040 5B pop bx
1 321 0041 59 pop cx
1 322 0042 5A pop dx
1 323 0043 5E pop si
1 324 0044 5F pop di
1 325 0045 5D pop bp
1 326 0046 1F pop ds
1 327 0047 07 pop es
328
329 ;
330 ; ... and return.
Turbo Assembler Version 3.1 04/11/13 12:54:48 Page 7
entry.ASM
331 ;
332 0048 CF iret
333 0049 _int21_handler endp
334
335
336
337 ;
338 ; Terminate the current process
339 ;
340 ; VOID INRPT far
341 ; int27_handler(iregs UserRegs)
342 ;
343 assume cs:_TEXT
344 0049 _int27_handler proc far
345 ;
346 ; First convert the memory to paragraphs
347 ;
348 0049 83 C2 0F add dx,0fh ; round up
349 004C D1 DA rcr dx,1
350 004E D1 EA shr dx,1
351 0050 D1 EA shr dx,1
352 0052 D1 EA shr dx,1
353 ;
354 ; ... then use the standard system call
355 ;
356 0054 B8 3100 mov ax,3100h
357 0057 EB CC jmp short _int21_handler ; terminate through int 21h
358 0059 _int27_handler endp
359
360 ;
361 ; I really do need to get rid of this because it's the only thing stopping
362 ; us from being ROMABLE.
363 ;
364 0059 ???????? stkframe dd ?
365
366 005D _low_int25_handler proc far
367 005D FB sti
368 005E 9C pushf
369 005F 50 push ax
370 0060 51 push cx
371 0061 52 push dx
372 0062 53 push bx
373 0063 54 push sp
374 0064 55 push bp
375 0065 56 push si
376 0066 57 push di
377 0067 1E push ds
378 0068 06 push es
379
380 0069 2E: 89 26 0059r mov word ptr cs:stkframe, sp ; save stack frame
381 006E 2E: 8C 16 005Br mov word ptr cs:stkframe+2, ss
382
383 0073 FC cld
384 0074 B8 0000s mov ax, seg DGROUP
385 0077 8E D8 mov ds, ax
Turbo Assembler Version 3.1 04/11/13 12:54:48 Page 8
entry.ASM
386
387 0079 C7 06 0000e 0000e mov word ptr DGROUP:_api_sp, offset DGROUP:_disk_api_tos
388 007F 8C 1E 0000e mov word ptr DGROUP:_api_ss, ds
389
390 0083 0E E8 0000e call far ptr _set_stack
391
392 0087 2E: FF 36 005Br push word ptr cs:stkframe+2
393 008C 2E: FF 36 0059r push word ptr cs:stkframe
394 0091 E8 0000e call _int25_handler
395 0094 83 C4 04 add sp, 4
396
397 0097 0E E8 0000e call far ptr _restore_stack
398
399 009B 07 pop es
400 009C 1F pop ds
401 009D 5F pop di
402 009E 5E pop si
403 009F 5D pop bp
404 00A0 5B pop bx ; pop off sp value
405 00A1 5B pop bx
406 00A2 5A pop dx
407 00A3 59 pop cx
408 00A4 58 pop ax
409 00A5 9D popf
410 00A6 CB retf ; Bug-compatiblity with MS-DOS.
411 ; This function is supposed to leave the original
412 ; flag image on the stack.
413 00A7 _low_int25_handler endp
414
415
416 00A7 _low_int26_handler proc far
417 00A7 FB sti
418 00A8 9C pushf
419 00A9 50 push ax
420 00AA 51 push cx
421 00AB 52 push dx
422 00AC 53 push bx
423 00AD 54 push sp
424 00AE 55 push bp
425 00AF 56 push si
426 00B0 57 push di
427 00B1 1E push ds
428 00B2 06 push es
429
430 00B3 2E: 89 26 0059r mov word ptr cs:stkframe, sp ; save stack frame
431 00B8 2E: 8C 16 005Br mov word ptr cs:stkframe+2, ss
432
433 00BD FC cld
434 00BE B8 0000s mov ax, seg DGROUP
435 00C1 8E D8 mov ds, ax
436
437 00C3 C7 06 0000e 0000e mov word ptr DGROUP:_api_sp, offset DGROUP:_disk_api_tos
438 00C9 8C 1E 0000e mov word ptr DGROUP:_api_ss, ds
439
440 00CD 0E E8 0000e call far ptr _set_stack
Turbo Assembler Version 3.1 04/11/13 12:54:48 Page 9
entry.ASM
441
442 00D1 2E: FF 36 005Br push word ptr cs:stkframe+2
443 00D6 2E: FF 36 0059r push word ptr cs:stkframe
444 00DB E8 0000e call _int26_handler
445 00DE 83 C4 04 add sp, 4
446
447 00E1 0E E8 0000e call far ptr _restore_stack
448
449 00E5 07 pop es
450 00E6 1F pop ds
451 00E7 5F pop di
452 00E8 5E pop si
453 00E9 5D pop bp
454 00EA 5B pop bx ; pop off sp value
455 00EB 5B pop bx
456 00EC 5A pop dx
457 00ED 59 pop cx
458 00EE 58 pop ax
459 00EF 9D popf
460 00F0 CB retf
461 00F1 _low_int26_handler endp
462
463 00F1 _TEXT ends
464 end
Turbo Assembler Version 3.1 04/11/13 12:54:48 Page 10
Symbol Table
Symbol Name Type Value
??DATE Text "04/11/13"
??FILENAME Text "entry "
??TIME Text "12:54:48"
??VERSION Number 030A
@CPU Text 0101H
@CURSEG Text _TEXT
@FILENAME Text ENTRY
@WORDSIZE Text 2
CPM_ERROR Near _TEXT:0020
STANDALONE Text 1
STKFRAME Dword _TEXT:0059
_API_SP (_api_sp) Word _TEXT:---- Extern
_API_SS (_api_ss) Word _TEXT:---- Extern
_CPM_ENTRY (_cpm_entry) Far _TEXT:0000
_DISK_API_TOS (_disk_api_tos) Word _TEXT:---- Extern
_INT20_HANDLER (_int20_handler) Far _TEXT:0023
_INT21_HANDLER (_int21_handler) Far _TEXT:0025
_INT21_SYSCALL (_int21_syscall) Near _TEXT:---- Extern
_INT25_HANDLER (_int25_handler) Near _TEXT:---- Extern
_INT26_HANDLER (_int26_handler) Near _TEXT:---- Extern
_INT27_HANDLER (_int27_handler) Far _TEXT:0049
_LOW_INT25_HANDLER + Far _TEXT:005D
(_low_int25_handler)
_LOW_INT26_HANDLER + Far _TEXT:00A7
(_low_int26_handler)
_RESTORE_STACK (_restore_stack) Far _TEXT:---- Extern
_SET_STACK (_set_stack) Far _TEXT:---- Extern
Macro Name
POP$ALL
PUSH$ALL
Structure Name Type Offset
REGFRAME
REG_AX Word 0000
REG_BX Word 0002
REG_CX Word 0004
REG_DX Word 0006
REG_SI Word 0008
REG_DI Word 000A
REG_BP Word 000C
REG_DS Word 000E
REG_ES Word 0010
REG_IP Word 0012
REG_CS Word 0014
REG_FLAGS Word 0016
IRP_LOW Word 0018
IRP_HI Word 001A
Turbo Assembler Version 3.1 04/11/13 12:54:48 Page 11
Symbol Table
Groups & Segments Bit Size Align Combine Class
DGROUP Group
_BSS 16 0000 Word Public BSS
_BSSEND 16 0000 Byte Public STACK
_DATA 16 0000 Word Public DATA
_FIXED_DATA 16 0000 Para Public DATA
_TEXT 16 00F1 Byte Public CODE
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?