Changeset 183 in xtideuniversalbios


Ignore:
Timestamp:
Nov 15, 2011, 4:35:14 AM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Space optimization, added option to inline offsets for MENUEVENT structure, for situations (such as the XTIDE bios) where only one menu is needed. Ifdef'd change (set in main.asm) so either method can be used.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Inc/MenuEvents.inc

    r58 r183  
    1919;       All
    2020;--------------------------------------------------------------------
     21
     22;
     23; There are two ways to use MENUEVENT:
     24;
     25; 1. If the program needs two different menus, include the definition of the MENUEVENT structure below,
     26;    instantiate with members that point to the routines that make up the menu.
     27;
     28; 2. If the program needs only one menu, %define MENUEVENT_INLINE_OFFSETS before this include file,
     29;    and define (through EQU statements) each of the entry points as offsets from a base address. 
     30;    Entry points must be within 256 bytes of the base (only a byte is used to pass the offset).
     31;
     32
     33%ifndef MENUEVENT_INLINE_OFFSETS
     34
    2135struc MENUEVENT
    2236    ; Parameters:
     
    2539    ;   DS:SI:      Ptr to initialized MENUINIT struct
    2640    .InitializeMenuinitFromDSSI     resb    2
     41%define MENUEVENT_InitializeMenuinitFromDSSI MENUEVENT.InitializeMenuinitFromDSSI
    2742
    2843    ; Parameters:
     
    3247    ;               Clear to cancel exit
    3348    .ExitMenu                       resb    2
     49%define MENUEVENT_ExitMenu MENUEVENT.ExitMenu
    3450
    3551    ; Parameters:
    3652    ;   None
    3753    .IdleProcessing                 resb    2
     54%define MENUEVENT_IdleProcessing MENUEVENT.IdleProcessing
    3855
    3956    ; Parameters:
     
    4158    ;   DX:         Index of previously highlighted item or NO_ITEM_HIGHLIGHTED
    4259    .ItemHighlightedFromCX          resb    2
     60%define MENUEVENT_ItemHighlightedFromCX MENUEVENT.ItemHighlightedFromCX
    4361
    4462    ; Parameters:
    4563    ;   CX:         Index of selected item
    4664    .ItemSelectedFromCX             resb    2
     65%define MENUEVENT_ItemSelectedFromCX MENUEVENT.ItemSelectedFromCX
    4766
    4867    ; Parameters:
     
    5069    ;   AH:         Keyboard library scan code for the key
    5170    .KeyStrokeInAX                  resb    2
     71%define MENUEVENT_KeyStrokeInAX MENUEVENT.KeyStrokeInAX
    5272
    5373    ; Parameters:
     
    5676    .RefreshTitle                   resb    2
    5777    .RefreshInformation             resb    2
     78%define MENUEVENT_RefreshTitle MENUEVENT.RefreshTitle
     79%define MENUEVENT_RefreshInformation MENUEVENT.RefreshInformation
    5880
    5981    ; Parameters:
     
    6183    ;   Cursor has been positioned to the beginning of item line
    6284    .RefreshItemFromCX              resb    2
     85%define MENUEVENT_RefreshItemFromCX MENUEVENT.RefreshItemFromCX
    6386endstruc
    6487
     88%endif ; MENUEVENTS_INLINE_OFFSETS
    6589
    6690%endif ; MENUEVENTS_INC
  • trunk/Assembly_Library/Src/Menu/MenuEvent.asm

    r133 r183  
    2121    pop     ds
    2222    mov     si, bp
    23     mov     bl, MENUEVENT.InitializeMenuinitFromDSSI
     23    mov     bl, MENUEVENT_InitializeMenuinitFromDSSI
    2424    jmp     SHORT MenuEvent_SendFromBX
    2525
     
    3737ALIGN JUMP_ALIGN
    3838MenuEvent_ExitMenu:
    39     mov     bl, MENUEVENT.ExitMenu
     39    mov     bl, MENUEVENT_ExitMenu
    4040    jmp     SHORT MenuEvent_SendFromBX
    4141
     
    5353ALIGN JUMP_ALIGN
    5454MenuEvent_IdleProcessing:
    55     mov     bl, MENUEVENT.IdleProcessing
     55    mov     bl, MENUEVENT_IdleProcessing
    5656    jmp     SHORT MenuEvent_SendFromBX
    5757
     
    7171ALIGN JUMP_ALIGN
    7272MenuEvent_RefreshTitle:
    73     mov     bl, MENUEVENT.RefreshTitle
     73    mov     bl, MENUEVENT_RefreshTitle
    7474    SKIP2B  cx  ; mov cx, <next instruction>
    7575
    7676MenuEvent_RefreshInformation:
    77     mov     bl, MENUEVENT.RefreshInformation
     77    mov     bl, MENUEVENT_RefreshInformation
    7878    mov     cx, [bp+MENUINIT.wHighlightedItem]
    7979    jmp     SHORT MenuEvent_SendFromBX
     
    9494ALIGN JUMP_ALIGN
    9595MenuEvent_RefreshItemFromCX:
    96     mov     bl, MENUEVENT.RefreshItemFromCX
     96    mov     bl, MENUEVENT_RefreshItemFromCX
    9797    jmp     SHORT MenuEvent_SendFromBX
    9898
     
    114114    push    dx
    115115
    116     mov     bl, MENUEVENT.ItemHighlightedFromCX
     116    mov     bl, MENUEVENT_ItemHighlightedFromCX
    117117    call    MenuEvent_SendFromBX
    118118
     
    137137ALIGN JUMP_ALIGN
    138138MenuEvent_KeyStrokeInAX:
    139     mov     bl, MENUEVENT.KeyStrokeInAX
     139    mov     bl, MENUEVENT_KeyStrokeInAX
    140140    SKIP2B  dx  ; mov dx, <next instruction>
    141141
     
    153153;--------------------------------------------------------------------
    154154MenuEvent_ItemSelectedFromCX:
    155     mov     bl, MENUEVENT.ItemSelectedFromCX
     155    mov     bl, MENUEVENT_ItemSelectedFromCX
    156156    ; Fall to MenuEvent_SendFromBX
    157157
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm

    r140 r183  
    2424ALIGN JUMP_ALIGN
    2525BootMenuEvent_Handler:
     26       
     27%ifdef MENUEVENT_INLINE_OFFSETS
     28       
     29    add     bx, BootMenuEvent_Handler
     30    jmp     bx
     31       
     32%else
     33       
    2634    cmp     bx, BYTE MENUEVENT.RefreshItemFromCX    ; Above last supported item?
    2735    ja      SHORT .EventNotHandled
    2836    jmp     [cs:bx+.rgfnEventSpecificHandlers]
     37       
     38%endif
     39       
    2940.EventNotHandled:
    3041    clc
    3142    ret
    3243
     44%ifdef MENUEVENT_INLINE_OFFSETS
     45       
     46MENUEVENT_InitializeMenuinitFromDSSI equ  (BootMenuEvent_Handler.InitializeMenuinitFromDSSI - BootMenuEvent_Handler)
     47MENUEVENT_ExitMenu equ  (BootMenuEvent_Handler.EventCompleted - BootMenuEvent_Handler)
     48MENUEVENT_IdleProcessing equ (BootMenuEvent_Handler.EventNotHandled - BootMenuEvent_Handler)
     49MENUEVENT_ItemHighlightedFromCX equ (BootMenuEvent_Handler.ItemHighlightedFromCX - BootMenuEvent_Handler)
     50MENUEVENT_ItemSelectedFromCX equ (BootMenuEvent_Handler.ItemSelectedFromCX - BootMenuEvent_Handler)
     51MENUEVENT_KeyStrokeInAX equ (BootMenuEvent_Handler.KeyStrokeInAX - BootMenuEvent_Handler)
     52MENUEVENT_RefreshTitle equ (BootMenuPrint_TitleStrings - BootMenuEvent_Handler)
     53MENUEVENT_RefreshInformation equ (BootMenuEvent_Handler.RefreshInformation - BootMenuEvent_Handler)
     54MENUEVENT_RefreshItemFromCX equ (BootMenuEvent_Handler.RefreshItemFromCX - BootMenuEvent_Handler)
     55
     56%else
     57       
    3358ALIGN WORD_ALIGN
    3459.rgfnEventSpecificHandlers:
     
    4267    dw      .RefreshInformation         ; MENUEVENT.RefreshInformation
    4368    dw      .RefreshItemFromCX          ; MENUEVENT.RefreshItemFromCX
     69       
     70%endif
    4471
    4572
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r181 r183  
    1515ORG 000h                        ; Code start offset 0000h
    1616
    17 
     17%define MENUEVENT_INLINE_OFFSETS    ; Only one menu required, save space and inline offsets
     18       
    1819    ; Included .inc files
    1920    %include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
     
    150151iend
    151152
    152 
    153153    ; Libraries and data
    154154    %include "AssemblyLibrary.asm"
     
    170170    %include "BootMenu.asm"         ; For Boot Menu operations
    171171    %include "BootMenuEvent.asm"    ; For menu library event handling
     172    %include "BootMenuPrint.asm"    ; For printing Boot Menu strings (needs to come after BootMenuEvent.asm)
    172173    %include "FloppyDrive.asm"      ; Floppy Drive related functions
    173174    %include "BootSector.asm"       ; For loading boot sector
    174175    %include "BootPrint.asm"        ; For printing boot information
    175     %include "BootMenuPrint.asm"    ; For printing Boot Menu strings
    176176    %include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
    177177
Note: See TracChangeset for help on using the changeset viewer.