- Timestamp:
- Feb 2, 2011, 3:53:52 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/AssemblyLibrary.inc
r73 r104 1 ; File name : AssemblyLibrary.inc2 1 ; Project name : Assembly Library 3 ; Created date : 2.7.20104 ; Last update : 11.12.20105 ; Author : Tomi Tilli6 2 ; Description : Common defines for all library functions. 7 3 %ifndef ASSEMBLY_LIBRARY_INC … … 16 12 %include "DosFunctions.inc" 17 13 %include "File.inc" 14 %include "Macros.inc" 18 15 %include "Math.inc" 19 16 -
trunk/Assembly_Library/Src/Keyboard/Keyboard.asm
r54 r104 1 ; File name : Keyboard.asm2 1 ; Project name : Assembly Library 3 ; Created date : 5.7.20104 ; Last update : 24.10.20105 ; Author : Tomi Tilli6 2 ; Description : Functions for managing keyboard. 7 3 -
trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm
r52 r104 1 ; File name : CharOutLineSplitter.asm2 1 ; Project name : Assembly Library 3 ; Created date : 11.10.20104 ; Last update : 12.10.20105 ; Author : Tomi Tilli6 2 ; Description : Functions for splitting menu lines during character output. 7 3 … … 20 16 ALIGN JUMP_ALIGN 21 17 CharOutLineSplitter_PrepareForPrintingTextLines: 22 call .GetLastTextLineColumnOffsetToDX 23 call CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX 24 mov ah, dl ; AL = Text line first column, AH = Text line last column 18 ; Get first text line column offset to DX 19 call CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX 20 add al, MENU_TEXT_COLUMN_OFFSET<<1 21 xchg dx, ax 22 23 ; Get last text line column offset to AX 24 call MenuLocation_GetMaxTextLineLengthToAX 25 shl ax, 1 ; Characters to BYTEs 26 add ax, dx 27 28 xchg ax, dx ; AL = First text line column offset 29 mov ah, dl ; AH = Last text line column offset 25 30 CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX 26 ret27 28 ;--------------------------------------------------------------------29 ; .GetLastTextLineColumnOffsetToDX30 ; Parameters:31 ; SS:BP: Ptr to MENU32 ; Returns:33 ; DX: Offset to last (allowed) character in text line34 ; Corrupts registers:35 ; AX36 ;--------------------------------------------------------------------37 ALIGN JUMP_ALIGN38 .GetLastTextLineColumnOffsetToDX:39 call CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX40 xchg dx, ax41 call MenuLocation_GetMaxTextLineLengthToAX42 shl ax, 143 add dx, ax44 31 ret 45 32 46 33 47 34 ;-------------------------------------------------------------------- 48 ; CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX49 35 ; CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX 50 36 ; Parameters: … … 55 41 ; Nothing 56 42 ;-------------------------------------------------------------------- 57 ALIGN JUMP_ALIGN58 CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX:59 call CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX60 add al, MENU_TEXT_COLUMN_OFFSET<<161 ret62 63 43 ALIGN JUMP_ALIGN 64 44 CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX: … … 111 91 push cx 112 92 push ax 113 114 call GetOffsetToPartialWordToSIandSizeToCX 115 call MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine 116 jcxz .NothingToMove 117 call MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 118 .NothingToMove: 119 pop ax 120 pop cx 121 pop si 122 ret 123 93 ; Fall to .GetOffsetToPartialWordToSIandSizeToCX 124 94 125 95 ;-------------------------------------------------------------------- 126 ; GetOffsetToPartialWordToSIandSizeToCX96 ; .GetOffsetToPartialWordToSIandSizeToCX 127 97 ; Parameters: 128 98 ; ES:DI: Ptr to space before border character … … 133 103 ; Nothing 134 104 ;-------------------------------------------------------------------- 135 ALIGN JUMP_ALIGN 136 GetOffsetToPartialWordToSIandSizeToCX: 105 .GetOffsetToPartialWordToSIandSizeToCX: 137 106 xor cx, cx 138 107 mov si, di … … 150 119 inc si ; SI now points one past space 151 120 shl cx, 1 ; Characters to bytes 152 ret 153 121 ; Fall to .ChangeLine 154 122 155 123 ;-------------------------------------------------------------------- 156 ; MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 124 ; .ChangeLine 125 ; Parameters: 126 ; Nothing 127 ; Returns: 128 ; Nothing 129 ; Corrupts registers: 130 ; AX, DX 131 ;-------------------------------------------------------------------- 132 .ChangeLine: 133 call MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine 134 jcxz .ReturnFromMovePartialWordToNewTextLine 135 ; Fall to .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 136 137 ;-------------------------------------------------------------------- 138 ; .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 157 139 ; Parameters: 158 140 ; CX: Number of BYTEs in partial word … … 165 147 ; AX, CX, DX, SI 166 148 ;-------------------------------------------------------------------- 167 ALIGN JUMP_ALIGN 168 MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX: 149 .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX: 169 150 push si 170 151 push cx … … 178 159 call DisplayPrint_RepeatCharacterFromALwithCountInCX 179 160 mov di, si 161 162 .ReturnFromMovePartialWordToNewTextLine: 163 pop ax 164 pop cx 165 pop si 180 166 ret -
trunk/Assembly_Library/Src/Menu/Menu.asm
r60 r104 1 ; File name : Menu.asm2 1 ; Project name : Assembly Library 3 ; Created date : 3.8.20104 ; Last update : 22.11.20105 ; Author : Tomi Tilli6 2 ; Description : Menu Library functions for CALL_MENU_LIBRARY macro 7 3 ; that users should use to make library call. -
trunk/Assembly_Library/Src/Menu/MenuAttributes.asm
r52 r104 1 ; File name : MenuAttributes.asm2 1 ; Project name : Assembly Library 3 ; Created date : 15.7.20104 ; Last update : 9.8.20105 ; Author : Tomi Tilli6 2 ; Description : Finds suitable character attribute for 7 3 ; color, B/W and monochrome displays. -
trunk/Assembly_Library/Src/Menu/MenuBorders.asm
r67 r104 1 ; File name : MenuBorders.asm2 1 ; Project name : Assembly Library 3 ; Created date : 14.7.20104 ; Last update : 9.12.20105 ; Author : Tomi Tilli6 2 ; Description : Functions for drawing menu borders. 7 3 … … 56 52 57 53 ;-------------------------------------------------------------------- 54 ; MenuBorders_RefreshItemBorders 55 ; Parameters 56 ; SS:BP: Ptr to MENU 57 ; Returns: 58 ; Nothing 59 ; Corrupts registers: 60 ; AX, BX, CX, DX, SI, DI 61 ;-------------------------------------------------------------------- 62 ALIGN JUMP_ALIGN 63 MenuBorders_RefreshItemBorders: 64 call MenuBorders_AdjustDisplayContextForDrawingBorders 65 call MenuLocation_GetItemBordersTopLeftCoordinatesToAX 66 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 67 68 call MenuBorders_GetNumberOfMiddleCharactersToDX 69 jmp SHORT RefreshItemBorders 70 71 72 ;-------------------------------------------------------------------- 58 73 ; MenuBorders_AdjustDisplayContextForDrawingBorders 59 74 ; Parameters … … 81 96 82 97 ;-------------------------------------------------------------------- 83 ; MenuBorders_RefreshItemBorders84 ; Parameters85 ; SS:BP: Ptr to MENU86 ; Returns:87 ; Nothing88 ; Corrupts registers:89 ; AX, BX, CX, DX, SI, DI90 ;--------------------------------------------------------------------91 ALIGN JUMP_ALIGN92 MenuBorders_RefreshItemBorders:93 call MenuBorders_AdjustDisplayContextForDrawingBorders94 call MenuLocation_GetItemBordersTopLeftCoordinatesToAX95 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX96 97 call MenuBorders_GetNumberOfMiddleCharactersToDX98 jmp SHORT RefreshItemBorders99 100 101 ;--------------------------------------------------------------------102 98 ; MenuBorders_GetNumberOfMiddleCharactersToDX 103 99 ; Parameters … … 161 157 call DrawSeparationBorderLine 162 158 call MenuScrollbars_GetMaxVisibleItemsOnPageToCX 159 ; Fall to DrawTextBorderLinesByCXtimes 160 161 ;-------------------------------------------------------------------- 162 ; DrawTextBorderLinesByCXtimes 163 ; Parameters 164 ; CX: Number of border lines to draw 165 ; DX: Number of times to repeat middle character 166 ; SS:BP: Ptr to MENU 167 ; Returns: 168 ; Nothing 169 ; Corrupts registers: 170 ; AX, CX, SI, DI 171 ;-------------------------------------------------------------------- 163 172 DrawTextBorderLinesByCXtimes: 164 mov bx, DrawTextBorderLine 165 ; Fall to DrawBorderLinesByCXtimes 166 167 ;-------------------------------------------------------------------- 168 ; DrawBorderLinesByCXtimes 169 ; Parameters 170 ; BX: Offset to border drawing function 171 ; CX: Number of border lines to draw 172 ; DX: Number of times to repeat middle character 173 ; SS:BP: Ptr to MENU 174 ; Returns: 175 ; Nothing 176 ; Corrupts registers: 177 ; AX, CX, SI, DI 178 ;-------------------------------------------------------------------- 179 DrawBorderLinesByCXtimes: 180 jcxz .Return 173 jcxz .NoBorderLinesToDraw 181 174 ALIGN JUMP_ALIGN 182 175 .DrawBordersWithFunctionInBX: 183 call bx176 call DrawTextBorderLine 184 177 loop .DrawBordersWithFunctionInBX 185 . Return:178 .NoBorderLinesToDraw: 186 179 ret 187 180 … … 228 221 ALIGN JUMP_ALIGN 229 222 DrawBottomShadowLine: 230 mov ax, 1 ; Increment column 231 call MenuLocation_MoveCursorByALcolumnsAndAHrows 223 CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX 224 inc ax ; Move one column left 225 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 232 226 inc dx ; Increment repeat count... 233 227 inc dx ; ...for both corner characters … … 319 313 ALIGN JUMP_ALIGN 320 314 PrintBorderCharactersFromCSSI: 321 cld322 315 eSEG cs 323 lodsb ; Load from [ si+BORDER_CHARS.cLeft] to AL316 lodsb ; Load from [cs:si+BORDER_CHARS.cLeft] to AL 324 317 call MenuBorders_PrintSingleBorderCharacterFromAL 325 318 326 319 eSEG cs 327 lodsb ; Load from [ si+BORDER_CHARS.cMiddle] to AL320 lodsb ; Load from [cs:si+BORDER_CHARS.cMiddle] to AL 328 321 call MenuBorders_PrintMultipleBorderCharactersFromAL 329 322 330 323 eSEG cs 331 lodsb ; Load from [ si+BORDER_CHARS.cRight] to AL324 lodsb ; Load from [cs:si+BORDER_CHARS.cRight] to AL 332 325 ; Fall to MenuBorders_PrintSingleBorderCharacterFromAL 333 326 … … 382 375 ; AX, SI, DI 383 376 ;-------------------------------------------------------------------- 384 ;ALIGN JUMP_ALIGN385 377 .PrintTimeoutStringWithSecondsInAX: 378 ; Get attribute to AX 379 xchg di, ax 380 mov si, ATTRIBUTE_CHARS.cNormalTimeout 381 cmp di, BYTE MENU_TIMEOUT_SECONDS_FOR_HURRY 382 eCMOVB si, ATTRIBUTE_CHARS.cHurryTimeout 383 call MenuAttribute_GetToAXfromTypeInSI 384 386 385 push bp 387 388 xchg di, ax389 386 mov bp, sp 390 call .GetTimeoutAttributeToAXfromSecondsInDI391 387 mov si, .szSelectionTimeout 392 388 push ax ; Push attribute … … 399 395 db DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL 400 396 db "%AAutoselection in %2u s",NULL 401 402 ;--------------------------------------------------------------------403 ; .GetTimeoutAttributeToAXfromSecondsInDI404 ; Parameters405 ; DI: Seconds to print406 ; Returns:407 ; AX: Attribute byte for seconds408 ; Corrupts registers:409 ; SI410 ;--------------------------------------------------------------------411 ALIGN JUMP_ALIGN412 .GetTimeoutAttributeToAXfromSecondsInDI:413 mov si, ATTRIBUTE_CHARS.cNormalTimeout414 cmp di, BYTE MENU_TIMEOUT_SECONDS_FOR_HURRY415 eCMOVB si, ATTRIBUTE_CHARS.cHurryTimeout416 jmp MenuAttribute_GetToAXfromTypeInSI417 397 418 398 -
trunk/Assembly_Library/Src/Menu/MenuCharOut.asm
r52 r104 1 ; File name : MenuCharOut.asm2 1 ; Project name : Assembly Library 3 ; Created date : 15.7.20104 ; Last update : 12.10.20105 ; Author : Tomi Tilli6 2 ; Description : Character out function for printing withing menu window. 7 3 -
trunk/Assembly_Library/Src/Menu/MenuEvent.asm
r58 r104 1 ; File name : MenuEvent.asm2 1 ; Project name : Assembly Library 3 ; Created date : 13.7.20104 ; Last update : 12.10.20105 ; Author : Tomi Tilli6 2 ; Description : Functions for initializing menu system. 7 3 -
trunk/Assembly_Library/Src/Menu/MenuInit.asm
r60 r104 1 ; File name : MenuInit.asm2 1 ; Project name : Assembly Library 3 ; Created date : 13.7.20104 ; Last update : 22.11.20105 ; Author : Tomi Tilli6 2 ; Description : Functions for initializing menu system. 7 3 … … 25 21 LOAD_BDA_SEGMENT_TO ds, cx 26 22 push WORD [BDA.wVidCurShape] 27 eENTER_STRUCT MENU_size 23 mov cl, MENU_size 24 eENTER_STRUCT cx 28 25 29 mov cx, MENU_size30 26 call Memory_ZeroSSBPwithSizeInCX 31 27 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX … … 59 55 mov ax, CURSOR_HIDDEN 60 56 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX 61 call MenuEvent_InitializeMenuinit 57 call MenuEvent_InitializeMenuinit ; User initialization 62 58 call MenuInit_RefreshMenuWindow 63 59 jmp MenuLoop_Enter -
trunk/Assembly_Library/Src/Menu/MenuLocation.asm
r60 r104 1 ; File name : MenuLocation.asm2 1 ; Project name : Assembly Library 3 ; Created date : 14.7.20104 ; Last update : 25.11.20105 ; Author : Tomi Tilli6 2 ; Description : Functions for calculation menu window dimensions. 7 3 8 4 ; Section containing code 9 5 SECTION .text 10 11 ;--------------------------------------------------------------------12 ; MenuLocation_GetScrollbarCoordinatesToAXforItemInAX13 ; Parameters14 ; AX: Item index15 ; SS:BP: Ptr to MENU16 ; Returns:17 ; AL: Column (X)18 ; AH: Row (Y)19 ; Corrupts registers:20 ; Nothing21 ;--------------------------------------------------------------------22 ALIGN JUMP_ALIGN23 MenuLocation_GetScrollbarCoordinatesToAXforItemInAX:24 call MenuLocation_GetTextCoordinatesToAXforItemInAX25 add al, [bp+MENUINIT.bWidth]26 sub al, MENU_TEXT_COLUMN_OFFSET*227 ret28 29 6 30 7 ;-------------------------------------------------------------------- … … 72 49 ; MenuLocation_GetTitleBordersTopLeftCoordinatesToAX 73 50 ; MenuLocation_GetItemBordersTopLeftCoordinatesToAX 74 ; MenuLocation_GetInformationBordersTopLeftCoordinatesToAX75 51 ; MenuLocation_GetBottomBordersTopLeftCoordinatesToAX 76 52 ; Parameters … … 93 69 94 70 ALIGN JUMP_ALIGN 95 MenuLocation_GetInformationBordersTopLeftCoordinatesToAX:96 xor ax, ax97 jmp SHORT AddInformationBordersTopLeftCoordinatesToAX98 99 ALIGN JUMP_ALIGN100 71 MenuLocation_GetBottomBordersTopLeftCoordinatesToAX: 101 72 xor ax, ax 102 ; Fall to AddBottomBordersTopLeftCoordinatesToAX73 ; Fall to .AddBottomBordersTopLeftCoordinatesToAX 103 74 104 75 ;-------------------------------------------------------------------- 105 ; AddBottomBordersTopLeftCoordinatesToAX76 ; .AddBottomBordersTopLeftCoordinatesToAX 106 77 ; AddInformationBordersTopLeftCoordinatesToAX 107 78 ; AddItemBordersTopLeftCoordinatesToAX … … 116 87 ; Nothing 117 88 ;-------------------------------------------------------------------- 118 ALIGN JUMP_ALIGN 119 AddBottomBordersTopLeftCoordinatesToAX: 89 .AddBottomBordersTopLeftCoordinatesToAX: 120 90 stc ; Compensate for Information top border 121 91 adc ah, [bp+MENUINIT.bInfoLines] … … 160 130 sub ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET 161 131 ret 162 163 164 ;--------------------------------------------------------------------165 ; MenuLocation_MoveCursorByALcolumnsAndAHrows166 ; Parameters167 ; AL: Number of columns to move168 ; AH: Numver of rows to move169 ; SS:BP: Ptr to MENU170 ; Returns:171 ; Nothing172 ; Corrupts registers:173 ; AX, DI174 ;--------------------------------------------------------------------175 ALIGN JUMP_ALIGN176 MenuLocation_MoveCursorByALcolumnsAndAHrows:177 push ax178 CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX179 pop di180 add ax, di181 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX182 ret -
trunk/Assembly_Library/Src/Menu/MenuText.asm
r67 r104 250 250 call MenuBorders_AdjustDisplayContextForDrawingBorders 251 251 mov ax, cx 252 call MenuLocation_GetScrollbarCoordinatesToAXforItemInAX 252 253 call MenuLocation_GetTextCoordinatesToAXforItemInAX 254 add al, [bp+MENUINIT.bWidth] 255 sub al, MENU_TEXT_COLUMN_OFFSET*2 253 256 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 254 257
Note:
See TracChangeset
for help on using the changeset viewer.