Changeset 50 in xtideuniversalbios for trunk/Assembly_Library/Src/Display


Ignore:
Timestamp:
Oct 9, 2010, 5:47:26 PM (14 years ago)
Author:
Tomi Tilli
google:author:
aitotat
Message:

Changes to Assembly Library:
Removed Memory_ExchangeSSBPwithESDI since it obviously corrupted stack.
CGA detection is now only done once when initializing Display Context.
Moved File Library defines to File.inc.

Location:
trunk/Assembly_Library/Src/Display
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Src/Display/CgaSnow.asm

    r49 r50  
    22; Project name  :   Assembly Library
    33; Created date  :   8.10.2010
    4 ; Last update   :   8.10.2010
     4; Last update   :   9.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for preventing CGA snow.
     
    88; Section containing code
    99SECTION .text
     10
     11;--------------------------------------------------------------------
     12; CgaSnow_IsCgaPresent
     13;   Parameters:
     14;       DS:     BDA segment (zero)
     15;   Returns:
     16;       CF:     Set if CGA detected
     17;               Cleared if CGA not detected
     18;   Corrupts registers:
     19;       AX
     20;--------------------------------------------------------------------
     21ALIGN JUMP_ALIGN
     22CgaSnow_IsCgaPresent:
     23    cmp     WORD [BDA.wVidPort], CGA_STATUS_REGISTER - OFFSET_TO_CGA_STATUS_REGISTER
     24    jne     SHORT .CgaNotFound
     25    call    DisplayPage_GetColumnsToALandRowsToAH
     26    cmp     ah, [BDA.bVidRows]      ; Video rows stored only by EGA and later
     27    je      SHORT .CgaNotFound      ; Must be EGA or later
     28    stc
     29    ret
     30ALIGN JUMP_ALIGN
     31.CgaNotFound:
     32    clc
     33    ret
    1034
    1135
     
    2953ALIGN JUMP_ALIGN
    3054CgaSnow_Stosb:
    31     call    LoadAndVerifyStatusRegisterFromBDA
    32     jne     SHORT .StosbWithoutWaitSinceUnknownPort
     55    call    LoadCgaStatusRegisterAddressToDXifCgaPresent
     56    jz      SHORT .StosbWithoutWaitSinceUnknownPort
    3357
    3458    mov     ah, al
     
    4468CgaSnow_Stosw:
    4569    push    bx
    46     call    LoadAndVerifyStatusRegisterFromBDA
    47     jne     SHORT .StoswWithoutWaitSinceUnknownPort
     70    call    LoadCgaStatusRegisterAddressToDXifCgaPresent
     71    jz      SHORT .StoswWithoutWaitSinceUnknownPort
    4872
    4973    xchg    bx, ax
     
    7195ALIGN JUMP_ALIGN
    7296CgaSnow_Scasb:
    73     call    LoadAndVerifyStatusRegisterFromBDA
    74     jne     SHORT .ScasbWithoutWaitSinceUnknownPort
     97    call    LoadCgaStatusRegisterAddressToDXifCgaPresent
     98    jz      SHORT .ScasbWithoutWaitSinceUnknownPort
    7599
    76100    mov     ah, al
     
    98122ALIGN JUMP_ALIGN
    99123CgaSnow_RepMovsb:
    100     call    LoadAndVerifyStatusRegisterFromBDA
    101     jne     SHORT .RepMovsbWithoutWaitSinceUnknownPort
     124    call    LoadCgaStatusRegisterAddressToDXifCgaPresent
     125    jz      SHORT .RepMovsbWithoutWaitSinceUnknownPort
    102126
    103127.MovsbNextByte:
     
    115139
    116140;--------------------------------------------------------------------
    117 ; LoadAndVerifyStatusRegisterFromBDA
     141; LoadCgaStatusRegisterAddressToDXifCgaPresent
    118142;   Parameters:
    119143;       DS:     BDA segment (zero)
    120144;   Returns:
    121145;       DX:     CGA Status Register Address
    122 ;       ZF:     Set if CGA Base Port found in BDA
     146;       ZF:     Set if CGA not present
     147;               Cleared if CGA present
    123148;   Corrupts registers:
    124149;       Nothing
    125150;--------------------------------------------------------------------
    126151ALIGN JUMP_ALIGN
    127 LoadAndVerifyStatusRegisterFromBDA:
    128     mov     dx, [BDA.wVidPort]
    129     add     dl, OFFSET_TO_CGA_STATUS_REGISTER
    130     cmp     dx, CGA_STATUS_REGISTER
    131     je      SHORT .CheckIfEgaOrLater
    132     ret
    133 
    134 ALIGN JUMP_ALIGN
    135 .CheckIfEgaOrLater:
    136     push    ax
    137     call    DisplayPage_GetColumnsToALandRowsToAH
    138     cmp     ah, [BDA.bVidRows]      ; Video rows stored only by EGA and later
    139     lahf
    140     xor     ah, 1<<6                ; Invert ZF
    141     sahf
    142     pop     ax
     152LoadCgaStatusRegisterAddressToDXifCgaPresent:
     153    test    BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], FLG_CONTEXT_CGA
     154    jz      SHORT .NoCgaDetected
     155    mov     dx, CGA_STATUS_REGISTER
     156ALIGN JUMP_ALIGN, ret
     157.NoCgaDetected:
    143158    ret
    144159
  • trunk/Assembly_Library/Src/Display/DisplayContext.asm

    r48 r50  
    22; Project name  :   Assembly Library
    33; Created date  :   25.6.2010
    4 ; Last update   :   5.10.2010
     4; Last update   :   9.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for managing display context.
     
    2020ALIGN JUMP_ALIGN
    2121DisplayContext_Initialize:
    22     call    .DetectAndSetDisplaySegment
     22    call    .DetectAndSetDisplaySegment ; and .InitializeFlags
    2323    mov     WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], DEFAULT_CHARACTER_OUTPUT
    2424    mov     WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCursorShape], CURSOR_NORMAL
    2525    mov     BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], SCREEN_BACKGROUND_ATTRIBUTE
    26     mov     BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], FLG_CONTEXT_ATTRIBUTES
    27 
    2826    xor     ax, ax
    2927    call    DisplayCursor_SetCoordinatesFromAX
    30     jmp     SHORT DisplayContext_SynchronizeToHardware
     28    jmp     DisplayContext_SynchronizeToHardware
    3129
    3230;--------------------------------------------------------------------
     
    3735;       Nothing
    3836;   Corrupts registers:
    39 ;       Nothing
     37;       AX, DX
    4038;--------------------------------------------------------------------
    4139.DetectAndSetDisplaySegment:
    42     mov     WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2], COLOR_TEXT_SEGMENT
     40    mov     ax, COLOR_TEXT_SEGMENT
    4341    cmp     BYTE [VIDEO_BDA.bMode], MDA_TEXT_MODE
    44     jne     SHORT .Return
    45     sub     WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2], COLOR_TEXT_SEGMENT - MONO_TEXT_SEGMENT
    46 .Return:
     42    jne     SHORT .StoreSegmentToDisplayContext
     43    mov     ax, MONO_TEXT_SEGMENT
     44.StoreSegmentToDisplayContext:
     45    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2], ax
     46    ; Fall to InitializeFlags
     47
     48;--------------------------------------------------------------------
     49; .InitializeFlags
     50;   Parameters:
     51;       DS:     BDA segment (zero)
     52;   Returns:
     53;       Nothing
     54;   Corrupts registers:
     55;       AX, DX
     56;--------------------------------------------------------------------
     57.InitializeFlags:
     58    mov     dl, FLG_CONTEXT_ATTRIBUTES
     59    call    CgaSnow_IsCgaPresent
     60    jnc     SHORT .DoNotSetCgaFlag
     61    or      dl, FLG_CONTEXT_CGA
     62.DoNotSetCgaFlag:
     63    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], dl
    4764    ret
    4865
     
    188205;       Nothing
    189206;   Corrupts registers:
    190 ;       Nothing
     207;       BL
    191208;--------------------------------------------------------------------
    192209ALIGN JUMP_ALIGN
    193210DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL:
     211    and     bl, FLG_CONTEXT_ATTRIBUTES
     212    and     BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], ~FLG_CONTEXT_ATTRIBUTES
     213    or      [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], bl
    194214    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], ax
    195     mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], bl
    196215    ret
    197216
Note: See TracChangeset for help on using the changeset viewer.