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

📄 rd2hd.asm

📁 Menuet 操作系统源代码。 非常难得的东西
💻 ASM
字号:
;
;   Save Ramdisk to HD
;
;   Compile with FASM for Menuet
;
   
use32
   
               org    0x0
   
               db     'MENUET01'              ; 8 byte id
               dd     0x01                    ; header version
               dd     START                   ; start of code
               dd     I_END                   ; size of image
               dd     0x5000  ; 20 Kb         ; memory for app
               dd     0x4fff                  ; esp
               dd     0x0 , 0x0               ; I_Param , I_Icon
   
START:                    ; start of execution
   
    call draw_window
   
still:
   
    mov  eax,10           ; wait here for event
    int  0x40
   
    dec  eax              ; redraw request ?                                
    je   red
    dec  eax              ; key in buffer ?                                 
    je   key
    dec  eax              ; button in buffer ?                              
    je   button
   
  red:                    ; redraw
    call draw_window
    jmp  still
   
  key:                    ; key
    mov  eax,2            ; just read it and ignore                        
    int  0x40
    jmp  still
   
  button:                 ; button
    mov  eax,17           ; get id
    int  0x40
   
    dec  ah               ; button id=1 ?
    jne  noclose
   
  exit:
    xor eax,eax
    dec eax               ; close this program                             
    int  0x40
  noclose:
   
    mov eax,18            ; save ramdisk to hd
    mov ebx,6
    int 0x40
    jmp exit
   
;   *********************************************
;   *******  WINDOW DEFINITIONS AND DRAW ********
;   *********************************************
   
draw_window:
   
    mov  eax,12                    ; function 12:tell os about windowdraw
    xor  ebx,ebx                   ; 1, start of draw
    inc  ebx
    int  0x40
                                   ; DRAW WINDOW
    xor  eax,eax                   ; function 0 : define and draw window
    mov  ebx,100*65536+340         ; [x start] *65536 + [x size]
    mov  ecx,100*65536+72          ; [y start] *65536 + [y size]
    mov  edx,0x03dddddd ;02        ; color of work area RRGGBB,8->color gl
    int  0x40
                                   ; SAVE BUTTON
    mov  eax,8                     ; function 8 : define and draw button
    mov  ebx,10*65536+320          ; [x start] *65536 + [x size]
    mov  ecx,26*65536+37           ; [y start] *65536 + [y size]
    mov  edx,2                     ; button id
    mov  esi,0x00dd8866            ; button color RRGGBB
    int  0x40
                                   ; WINDOW LABEL
    mov  eax,4                     ; function 4 : write text to window
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
    mov  ecx,0x10dddddd            ; font 1 & color ( 0xF0RRGGBB )
    mov  edx,labelt                ; pointer to text beginning
    mov  esi,labellen-labelt       ; text length
    int  0x40
   
    mov  ebx,105*65536+35          ; BUTTON TEXT 1
    mov  edx,btntext
    mov  esi,btntextend-btntext
    int  0x40
   
    add  ebx,0xffdd000d            ; BUTTON TEXT 2
    mov  edx,btntxt1
    mov  esi,btntxt1end-btntxt1
    int  0x40
   
    mov  eax,12                    ; function 12:tell os about windowdraw
    mov  ebx,2                     ; 2, end of draw
    int  0x40
   
    ret
   
   
; DATA AREA
   
labelt:
     db   'RD2HD'
labellen:
   
btntext:
     db   'CLICK HERE TO SAVE'
btntextend:
   
btntxt1:
     db   'RAMDISK TO /HD/1/MENUET.IMG'
btntxt1end:
   
I_END:
   
   
   
   

⌨️ 快捷键说明

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