📄 dump.s
字号:
/* dump.S - LILO register dumper *//* Copyright 1995-1997 Werner Almesberger. See file COPYING for details. */#define LILO_ASM#include "lilo.h" .text .globl _main .org 0_main: push sp ! push all registers push ss pushf push es push ds push cs push bp push di push si push dx push cx push bx push ax mov ax,#BOOTSEG ! let DS point to where we really are mov ds,ax mov bx,#msgs ! set up loopl: call say ! output message cmp byte ptr (bx),#0 ! at end ? je back ! yes -> back to LILO pop ax ! get next data word push bx call wout ! output data word pop bx jmp l ! next round#if 0back: mov ax,#FIRSTSEG mov ds,ax mov word ptr (CODE_START_1),#CODE_START_1+8 mov word ptr (CODE_START_1+2),#FIRSTSEG mov word ptr (CODE_START_1+4),#CODE_START_1+12 mov byte ptr (CODE_START_1+6),#0xfe mov es,ax ! adjust segments mov ax,#BOOTSEG mov ds,ax mov word ptr (10),#0xffff ! no timeout mov si,#haltnow ! copy string data mov di,#CODE_START_1+8 mov cx,#6 rep movsb mov ax,#FIRSTSEG ! restart LILO jmpi #GO,FIRSTSEG#elseback: hlt ! stay here jmp back#endif! Display a NUL-terminated string on the consolesay: mov al,(bx) ! get byte inc bx ! move pointer or al,al ! NUL ? jz aret ! yes -> done push bx ! save pointer mov ah,#14 ! display, tty-style xor bh,bh int 0x10 pop bx jmp say ! next onewout: push ax ! display one word mov al,ah call bout pop axbout: push ax ! display one byte shr al,#4 call nout pop axnout: and al,#15 ! display one nibble add al,#48 cmp al,#58 jb nokay add al,#7nokay: xor bh,bh ! display on screen mov ah,#14 int 0x10aret: ret msgs: .byte 13,10 .ascii "Register dump:" .byte 13,10,10 .ascii "AX=" .byte 0 .ascii " BX=" .byte 0 .ascii " CX=" .byte 0 .ascii " DX=" .byte 0,13,10 .ascii "SI=" .byte 0 .ascii " DI=" .byte 0 .ascii " BP=" .byte 0,13,10 .ascii "CS=" .byte 0 .ascii " DS=" .byte 0 .ascii " ES=" .byte 0,13,10 .ascii "F=" .byte 0,13,10 .ascii "SS:SP=" .byte 0 .ascii ":" .byte 0,13,10,10#if 0 .ascii "Restarting LILO ..."#else .ascii "System halted."#endif .byte 13,10,10,0,0haltnow:.ascii "LILO" ! prevent automatic reboot .byte 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -