⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pm4.bak

📁 cxzv dvsdsd sd fsdf sdf sd f
💻 BAK
字号:
include debug.mac
.386P              
descr struc 
 limit  dw 0
 base_l dw 0                        
 base_m db 0
 attr_l db 0     
 attr_2 db 0      
 base_h db 0             
descr ends   
                         
trap struc 
 offs_1 dw 0             
 sel    dw 16
 rsrv   db 0
 attr   db 8Fh
 offs_h dw 0
trap ends 
 
data segment use16
 gdt_0 label word
 gdt_null descr <>
 gdt_data descr <data_size-1,,,92h>
 gdt_code descr <code_size-1,,,98h>
 gdt_stack descr <255,0,0,92h,0,0>
 gdt_screen descr <4095,8000h,0Bh,92>
 gdt_himem descr <511,0,10h,92h,80h>  
                                    
 gdt_tss_0 descr <103,0,0,89h>      
 gdt_tss_1 descr <103,0,0,89h>      
                                    
 gdt_size=$-gdt_null                
                                    
 idt label word                     
 trap 10 dup (<dummy_exc>)          
 trap <exc_0Ah>                     
 trap <exc_0Bh>                     
 trap <exc_0Ch>                     
 trap <exc_0Dh>                     
 trap <exc_0Eh>                     
 trap 17 dup (<dummy_exc>)          
                                    
 idt_size=$-idt                     
                                    
 pdescr  dq 0                       
 real_sp dw 0                       
 real_ss dw 0                       
                                    
 mes     db 27,'[31;42m Back To Real Mode!  ',27,'[0m$';(21)  
 tblhex  db '0123456789ABCDEF'      
 string  db '**** ****_**** ****_**** ****'
 len=$-string                       
 number db '???? ????'               
                                    
 home_sel dw home                   
          dw 16 
           
 tss_0 db 104 dup (0)
 tss_1 db 104 dup (0)               
 task1_offs dw 0                    
 task1_sel  dw 56                   
                                    
 data_size=$-gdt_null               
data ends                           
                                    
text segment 'code' use16   
 assume cs:text,ds:data     
 begin label word
                 
 exc_0Ah proc    
    pop eax      
    pop eax              
    mov si,offset string+5
    debug        
    mov ax,0Ah   
    jmp dword ptr home_sel
 exc_0Ah endp    
                 
 exc_0Bh proc    
    pop eax      
    pop eax      
    mov si,offset string+5
    debug        
    mov ax,0Bh   
    jmp dword ptr home_sel
 exc_0Bh endp            
                 
 exc_0Ch proc    
    pop eax      
    pop eax      
    mov si,offset string+5
    debug                
    mov ax,0Ch   
    jmp dword ptr home_sel
 exc_0Ch endp                       
                 
 exc_0Dh proc    
    pop eax      
    pop eax      
    mov si,offset string+5
    debug        
    mov ax,0Dh   
    jmp dword ptr home_sel
 exc_0Dh endp    
                 
 exc_0Eh proc            
    pop eax      
    pop eax      
    mov si,offset string+5
    debug        
    mov ax,0Eh   
    jmp dword ptr home_sel
 exc_0Eh endp    
                 
 dummy_exc proc  
    pop eax      
    pop eax      
    mov si,offset string+5
    debug        
    mov ax,1111h 
    jmp dword ptr home_sel
 dummy_exc endp  
                     
 main proc        
      xor eax,eax           
      mov ax,data           
      mov ds,ax             
                               
      shl eax,4             
      mov ebp,eax           
      mov bx,offset gdt_data
      mov [bx].base_l,ax    
      rol eax,16            
      mov [bx].base_m,al    
                            
      xor eax,eax                   
      mov ax,cs             
      shl eax,4             
      mov bx,offset gdt_code
      mov [bx].base_l,ax    
      rol eax,16            
      mov [bx].base_m,al
                  
      xor eax,eax 
      mov ax,ss   
      shl eax,4   
      mov bx,offset gdt_stack
      mov [bx].base_l,ax       
      rol eax,16  
      mov [bx].base_m,al 
      
      mov eax,ebp        
      add ax,offset tss_0
      mov bx,offset gdt_tss_0
      mov [bx].base_l,ax       
      rol eax,16  
      mov [bx].base_m,al 
      
      mov eax,ebp
      add ax,offset tss_1
      mov bx,offset gdt_tss_1
      mov [bx].base_l,ax       
      rol eax,16             
      mov [bx].base_m,al     
                             
      mov dword ptr pdescr+2,ebp
      mov word ptr pdescr,gdt_size-1
      lgdt pdescr            
                           
      mov word ptr tss_1+4Ch,16               
      mov word ptr tss_1+20h,offset highmem
      mov word ptr tss_1+50h,24
      mov word ptr tss_1+38h,128
      mov word ptr tss_1+54h,8
      mov word ptr tss_1+48h,32
                               
                             
      cli                           
      mov al,8Fh             
      out 70h,al             
      jmp $+2                
      mov al,0Ah
      out 71h,al             
                             
      mov ax,40h        
      mov es,ax         
      mov word ptr es:[67h],offset return
      mov word ptr es:[69h],cs
                              
                              
      mov word ptr pdescr,idt_size-1
      xor eax,eax             
      mov ax,offset idt       
      add eax,ebp             
      mov dword ptr pdescr+2,eax
      lidt pdescr   
               
      mov al,0D1h
      out 64h,al
      mov al,0DFh
      out 60h,al
                                    
      mov eax,cr0             
      or eax,1                
      mov cr0,eax             
                              
      db 0EAh  
      dw offset continue
      dw 16     
               
      continue: mov ax,8       
                mov ds,ax           
                         
                mov ax,24 
                mov ss,ax
                         
                mov ax,32
                mov es,ax
                
                mov ax,40
                mov gs,ax
                
                mov ax,48
                ltr ax
                    
                call dword ptr task1_offs
                
                mov word ptr tss_1+20h,offset highmem
                
                call dword ptr task1_offs
                                         
                mov ax,0FFFFh            
          home: mov si,offset string         
                debug                    
                                         
                mov si,offset string     
                mov cx,len               
                mov ah,74h               
                mov di,1600              
           scr: lodsb                    
                stosw                    
                loop scr                 
                         
                mov al,0D1h
                out 64h,al
                mov al,0DDh
                out 60h,al
                                         
                mov al,0FEh
                out 64h,al 
                hlt                        
                              
                              
        return: mov ax,data    
                mov ds,ax     
               
                mov ax,stk    
                mov ss,ax         
                mov sp,256 
                mov ss,real_ss
                              
                sti
                mov al,0      
                out 70h,al    
                              
                mov ah,09h    
                mov dx,offset mes
                int 21h       
                         
                mov ax,4c00h 
                int 21h  
 main endp     
                         
 highmem proc            
       mov ax,40
       mov gs,ax
       mov eax,0
       mov ebx,0
       mov ecx,80000h
 fill: mov gs:[ebx],eax
       push eax 
       push cx 
       mov si,offset number+5
       debug   
       shr eax,16
       mov si,offset number
       debug   
               
       mov si,offset number
       mov cx,9
       mov ah,43h
       mov di,1040
 scrh: lodsb             
       stosw
       loop scrh
       pop cx
       pop eax
       add ebx,4
       inc eax
       db 67h
       loop fill_l
       jmp go
 fill_l: jmp fill
     go: iret      
 highmem endp 
            
 code_size=$-main        
 text ends               
 stk segment stack 'stack'
     db 256 dup ('^')    
 stk ends                      
                         
 end main                

⌨️ 快捷键说明

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