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

📄 mpanel.asm

📁 Application sources:A084.ZIP
💻 ASM
📖 第 1 页 / 共 2 页
字号:
    add     esi, 13
    cmp     edi, edx     
    jbe     bdp000              ; Run out of space to display
    
bdp001:  
    mov     [displayedApps], ecx

    ; Now the closing part of the big curve
    mov     ecx, BMP_BC_DEPTH
    mov     esi, BMP_BC + BMPHEADER
       
    mov     ebx, [scrSizeX]     ; The length of each screen line, in bytes
    imul    ebx, BPP
    
    mov     edx, PANEL_IMAGE
    add     edx, ebx            ; The top righthand pos
    
fill6:
    push    ecx
    push    edi
    ; Copy the image..
    push    esi
    mov     ecx, BMP_BC_WIDTH * BPP
    rep     movsb
    
    mov     eax, [edi-3]
fill6_1:
    mov     [edi], eax
    add     edi, 3
    cmp     edi, edx
    jb      fill6_1

    
    pop     esi
    add     esi, ((BMP_BC_WIDTH * BPP) + 3) and 0xFFFC
    pop     edi
    add     edi, ebx            ; Move down one line
    add     edx, ebx
    pop     ecx
    loop    fill6

    ret



;***************************************************************************
;   Function
;      strLen
;
;   Description
;       Returns the length of string at esi in ecx
;       string is 'terminated' by null or space
;
;***************************************************************************
strLen:
    push    esi

    dec     esi
    xor     ecx, ecx
sl001:
    inc     esi
    cmp     [esi], byte '0'
    je      slexit
    cmp     [esi], byte ' '
    je      slexit
    inc     ecx
    jmp     sl001
slexit: 
    pop     esi   

    ret    



;***************************************************************************
;   Function
;      drawSlot
;
;   Description
;       Copies a time/appname slot into the panel image
;       location ( top line position ) pointed to by edi
;       width ( number of characters ) in ecx
;
;***************************************************************************
drawSlot:
    ; Add in the small curve for the clock
    ; Note, we do funny maths here because the bmp image
    ; is stored with a multiple of 4 pixels per row
    
    push    ecx                 ; save num characters
    
    mov     ecx, BMP_SCL_DEPTH
    mov     esi, BMP_SCL + BMPHEADER
    
    push    edi
       
    mov     ebx, [scrSizeX]     ; The length of each screen line, in bytes
    imul    ebx, BPP
       
fill3:
    push    ecx
    push    edi
    ; Copy the image..
    push    esi
    mov     ecx, BMP_SCL_WIDTH * BPP
    rep     movsb
    pop     esi
    add     esi, ((BMP_SCL_WIDTH * BPP) + 3) and 0xFFFC
    pop     edi
    add     edi, ebx            ; Move down one line
    pop     ecx
    loop    fill3
    
    pop     edi    
    add     edi, BMP_SCL_WIDTH * BPP


    mov     ebx, [scrSizeX]     ; The length of each screen line, in bytes
    imul    ebx, BPP
    pop     ecx
fill4_1:
    push    edi
    push    ecx
    
    mov     ecx, BMP_SCC_DEPTH
    mov     esi, BMP_SCC + BMPHEADER
       
fill4:
    push    ecx
    push    edi
    ; Copy the image..
    push    esi
    mov     ecx, BMP_SCC_WIDTH * BPP
    rep     movsb
    pop     esi
    add     esi, ((BMP_SCC_WIDTH) * BPP + 3) and 0xFFFC
    pop     edi
    add     edi, ebx            ; Move down one line
    pop     ecx
    loop    fill4

    pop     ecx
    pop     edi
    add     edi, BMP_SCC_WIDTH * BPP
    loop    fill4_1


    ; Now the closing part of the small curve
    mov     ecx, BMP_SCR_DEPTH
    mov     esi, BMP_SCR + BMPHEADER
       
    mov     ebx, [scrSizeX]     ; The length of each screen line, in bytes
    imul    ebx, BPP
 
    push    edi
          
fill5:
    push    ecx
    push    edi
    ; Copy the image..
    push    esi
    mov     ecx, BMP_SCR_WIDTH * BPP
    rep     movsb
    pop     esi
    add     esi, ((BMP_SCR_WIDTH * BPP) + 3) and 0xFFFC
    pop     edi
    add     edi, ebx            ; Move down one line
    pop     ecx
    loop    fill5

    pop     edi
    
    add     edi, BMP_SCR_WIDTH * BPP 

    ret



;***************************************************************************
;   Function
;      setWindowForm
;
;   Description
;       Scans the panel image looking for the curved outline, so it can 
;       generate a free-form outline window
;
;***************************************************************************
setWindowForm:
    ; Create the free-form pixel map;
    ; black is the 'ignore' colour
    mov     esi,0
    
    mov     edx, [scrSizeX]
    imul    edx, PANEL_DEPTH
    
newpix:
    mov     eax,[ PANEL_IMAGE + esi*BPP]
    mov     bl,0
    and     eax,0xffffff
    cmp     eax,0x000000
    je      cred
    mov     bl,1

cred:
    mov     [esi+ PANEL_AREA ],bl
    inc     esi
    cmp     esi,edx
    jbe     newpix

    ; set the free-form window in the OS
    mov  eax,50
    mov  ebx,0
    mov  ecx,PANEL_AREA
    int  0x40
    ret
    
    

;***************************************************************************
;   Function
;      readBitmaps
;
;   Description
;       Loads the picture elements used to construct the panel image
;
;***************************************************************************
readBitmaps:
    ; Main panel button, plus curves
    mov     eax, 58
    mov     ebx, pbutton
    int     0x40
    mov     eax, 58
    mov     ebx, scc
    int     0x40
    mov     eax, 58
    mov     ebx, scl
    int     0x40
    mov     eax, 58
    mov     ebx, scr
    int     0x40
    mov     eax, 58
    mov     ebx, bc
    int     0x40    
    ret
    


;   *********************************************
;   *******  WINDOW DEFINITIONS AND DRAW ********
;   *********************************************
draw_window:
    mov     eax,12                     ; function 12:tell os about windowdraw
    mov     ebx,1                      ; 1, start of draw
    int     0x40

                                    ; DRAW WINDOW
    mov     eax,0                      ; function 0 : define and draw window
    mov     ebx, [scrSizeX]
    dec     ebx
    mov     ecx,0*65536+PANEL_DEPTH             ; [y start] *65536 + [y size]
    mov     edx,0x01000000 ; 0x02ffffff  ; col of work area RRGGBB,8->color gl
    mov     esi,0x815080d0             ; color of grab bar  RRGGBB,8->color gl
    mov     edi,0x005080d0             ; color of frames    RRGGBB
    int     0x40

                                    ; MENU BUTTON
    mov     eax,8                      ; function 8 : define and draw button
    mov     ebx,0*65536+BMP_1_WIDTH - 10    ; [x start] *65536 + [x size]
    mov     ecx,0*65536+BMP_1_DEPTH - 5    ; [y start] *65536 + [y size]
    mov     edx,0x60000001             ; button id
    mov     esi,0x6688dd               ; button color RRGGBB
    int     0x40

                                    ; Place the image on the screen
    mov     eax,7
    mov     ebx,PANEL_IMAGE    
    mov     ecx, [scrSizeX]
    shl     ecx, 16
    add     ecx, PANEL_DEPTH
    mov     edx,0
    int     0x40
    
    call    showTime                    ; display the time
    call    showApps                    ; You can guess what this does
    
    mov     eax,12                    ; function 12:tell os about windowdraw
    mov     ebx,2                     ; 2, end of draw
    int     0x40

    ret




;***************************************************************************
;   Function
;      showTime
;
;   Description
;       Updates the time on the panel
;
;***************************************************************************
showTime:
    ; blank out old time    
    mov     eax,7
    mov     ebx,PANEL_IMAGE + (CLOCK_X * BPP)    
    mov     ecx, (BMP_SCC_WIDTH * 5 * 65536) + 1
    mov     edx,CLOCK_X * 65536 + CLOCK_Y
st001:
    pusha
    int     0x40
    popa
    inc     edx
    cmp     edx, CLOCK_X * 65536 + CLOCK_Y + 8    
    jne     st001
    
    call    setTimeStr

    mov     eax, 4                     ; Write text to display
    mov     ebx, (CLOCK_X * 65536) + CLOCK_Y
    mov     ecx, CLOCK_COLOUR
    mov     edx, clockStr
    mov     esi, 5                  ; 5 digits in clock hh:mm
    int     0x40  
    ret
    


;***************************************************************************
;   Function
;      showApps
;
;   Description
;       Writes the application names to the display
;
;***************************************************************************
showApps:
    mov     esi, RUNNINGAPPS
    mov     ebx, (APP_X * 65536) + APP_Y
    
    mov     ecx, [displayedApps]
    
    cmp     ecx, 0
    jne     sa001
    ret

sa001:
    pusha
    call    strLen                      ; ecx has length of string @ esi
    mov     edx, esi
    mov     esi, ecx

    mov     eax, 4                     ; Write text to display
    mov     ecx, APP_COLOUR
    int     0x40
    popa
    push    ecx
    call    strLen                      ; ecx has length of string @ esi
    imul    ecx, 6
    add     ecx, APP_INC
    shl     ecx, 16
    add     ebx, ecx
    pop     ecx
    add     esi, 13
    loop    sa001
    ret

    

;***************************************************************************
;   Function
;      setTimeStr
;
;   Description
;       Reads the time and places it in a string.
;       The : character is alternated every second
;
;***************************************************************************
setTimeStr:
    mov     eax, 3                      ; Get time
    int     0x40
    mov     ecx, '0'
    mov     ebx, eax
    and     ebx, 0xF0
    shr     ebx, 4
    add     ebx, ecx
    mov     [clockStr], bl
    mov     ebx, eax
    and     ebx, 0x0F
    add     ebx, ecx
    mov     [clockStr+1], bl
    mov     ebx, eax
    and     ebx, 0xF000
    shr     ebx, 12
    add     ebx, ecx
    mov     [clockStr+3], bl
    mov     ebx, eax
    and     ebx, 0x0F00
    shr     ebx, 8
    add     ebx, ecx
    mov     [clockStr+4], bl

    and     eax, 0x00FF0000
    mov     [lastsecs], eax
    
    mov     bl, ':'
    and     eax, 0x00010000
    cmp     eax, 0
    je      sts001
    mov     bl, ' '
sts001:
    mov     [clockStr+2], bl

    ret



; Data area
lastsecs    dd  0
scrSizeX    dd  0                   ; Resolution of screen
scrSizeY    dd  0                   ; Resolution of screen
appname     db  'MMENU       '
numApps     dd  0                   ; Number of running applications
numDisplayApps  dd 0
displayedApps   dd  0

clockStr    db '12:34'

pbutton:
    dd  0
    dd  0
    dd  -1                          ; Amount to load - all of it
    dd  BMP_1                       ; Place to store file data
    dd  OSWORKAREA                  ; os work area - 16KB
    db  '/rd/1/mpanel.bmp',0

scl:
    dd  0
    dd  0
    dd  -1                          ; Amount to load - all of it
    dd  BMP_SCL                     ; Place to store file data
    dd  OSWORKAREA                  ; os work area - 16KB
    db  '/rd/1/scl.bmp',0

scc:
    dd  0
    dd  0
    dd  -1                          ; Amount to load - all of it
    dd  BMP_SCC                     ; Place to store file data
    dd  OSWORKAREA                  ; os work area - 16KB
    db  '/rd/1/scc.bmp',0

scr:
    dd  0
    dd  0
    dd  -1                          ; Amount to load - all of it
    dd  BMP_SCR                     ; Place to store file data
    dd  OSWORKAREA                  ; os work area - 16KB
    db  '/rd/1/scr.bmp',0
    
bc:
    dd  0
    dd  0
    dd  -1                          ; Amount to load - all of it
    dd  BMP_BC                      ; Place to store file data
    dd  OSWORKAREA                  ; os work area - 16KB
    db  '/rd/1/bc.bmp',0


startfile:
    dd  16                          ; Start file option
    dd  0                           ; Reserved, 0
    dd  params                      ; Parameters - MAINMENU
    dd  0                           ; Reserved, 0
    dd  OSWORKAREA                  ; OS work area - 16KB
    db  '/rd/1/mmenu',0
params:
    db  'MAINMENU 9 28',0

I_END:




⌨️ 快捷键说明

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