1 | ; File name : Display.asm |
---|
2 | ; Project name : Assembly Library |
---|
3 | ; Created date : 2.7.2010 |
---|
4 | ; Last update : 7.12.2010 |
---|
5 | ; Author : Tomi Tilli |
---|
6 | ; Description : Display Library functions for CALL_DISPLAY_LIBRARY macro |
---|
7 | ; that users should use to make library call. |
---|
8 | |
---|
9 | ; Section containing code |
---|
10 | SECTION .text |
---|
11 | |
---|
12 | ;-------------------------------------------------------------------- |
---|
13 | ; DisplayFunctionFromDI |
---|
14 | ; Parameters: |
---|
15 | ; DI: Function to call (DISPLAY_LIB.functionName) |
---|
16 | ; Others: Depends on function to call (DX cannot be parameter) |
---|
17 | ; Returns: |
---|
18 | ; Depends on function to call |
---|
19 | ; Corrupts registers: |
---|
20 | ; AX (unless used as a return register), DI |
---|
21 | ;-------------------------------------------------------------------- |
---|
22 | ALIGN JUMP_ALIGN |
---|
23 | Display_FunctionFromDI: |
---|
24 | push es |
---|
25 | push ds |
---|
26 | push dx |
---|
27 | |
---|
28 | cld |
---|
29 | LOAD_BDA_SEGMENT_TO ds, dx |
---|
30 | mov dx, [cs:di+.rgfnDisplayLibraryFunctions] |
---|
31 | les di, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition] |
---|
32 | call dx |
---|
33 | mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di |
---|
34 | |
---|
35 | pop dx |
---|
36 | pop ds |
---|
37 | pop es |
---|
38 | ret |
---|
39 | |
---|
40 | ;-------------------------------------------------------------------- |
---|
41 | ; .FormatNullTerminatedStringFromCSSI |
---|
42 | ; Parameters: |
---|
43 | ; Same as DisplayPrint_FormattedNullTerminatedStringFromCSSI |
---|
44 | ; Returns: |
---|
45 | ; Stack variables will be cleaned |
---|
46 | ; Corrupts registers: |
---|
47 | ; AX |
---|
48 | ;-------------------------------------------------------------------- |
---|
49 | ALIGN JUMP_ALIGN |
---|
50 | .FormatNullTerminatedStringFromCSSI: |
---|
51 | pop ax ; Discard return address to inside DisplayFunctionFromDI |
---|
52 | call DisplayPrint_FormattedNullTerminatedStringFromCSSI |
---|
53 | mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di |
---|
54 | |
---|
55 | pop dx |
---|
56 | pop ds |
---|
57 | pop es |
---|
58 | |
---|
59 | pop ax ; Pop return address |
---|
60 | mov sp, bp ; Clean stack variables |
---|
61 | jmp ax |
---|
62 | |
---|
63 | |
---|
64 | ALIGN WORD_ALIGN |
---|
65 | .rgfnDisplayLibraryFunctions: |
---|
66 | istruc DISPLAY_LIB |
---|
67 | at DISPLAY_LIB.InitializeDisplayContext, dw DisplayContext_Initialize |
---|
68 | |
---|
69 | at DISPLAY_LIB.SetCharacterPointerFromBXAX, dw DisplayContext_SetCharacterPointerFromBXAX |
---|
70 | at DISPLAY_LIB.SetCharOutputFunctionFromAXwithAttribFlagInBL, dw DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL |
---|
71 | at DISPLAY_LIB.SetCharacterOutputParameterFromAX, dw DisplayContext_SetCharacterOutputParameterFromAX |
---|
72 | at DISPLAY_LIB.SetCharacterAttributeFromAL, dw DisplayContext_SetCharacterAttributeFromAL |
---|
73 | at DISPLAY_LIB.SetCursorShapeFromAX, dw DisplayCursor_SetShapeFromAX |
---|
74 | at DISPLAY_LIB.SetCursorCoordinatesFromAX, dw DisplayCursor_SetCoordinatesFromAX |
---|
75 | at DISPLAY_LIB.SetNewPageFromAL, dw DisplayPage_SetFromAL |
---|
76 | at DISPLAY_LIB.SynchronizeDisplayContextToHardware, dw DisplayContext_SynchronizeToHardware |
---|
77 | |
---|
78 | at DISPLAY_LIB.GetCharacterPointerToBXAX, dw DisplayContext_GetCharacterPointerToBXAX |
---|
79 | at DISPLAY_LIB.GetSoftwareCoordinatesToAX, dw DisplayCursor_GetSoftwareCoordinatesToAX |
---|
80 | at DISPLAY_LIB.GetColumnsToALandRowsToAH, dw DisplayPage_GetColumnsToALandRowsToAH |
---|
81 | |
---|
82 | at DISPLAY_LIB.FormatNullTerminatedStringFromCSSI, dw .FormatNullTerminatedStringFromCSSI |
---|
83 | at DISPLAY_LIB.PrintSignedWordFromAXWithBaseInBX, dw DisplayPrint_SignedWordFromAXWithBaseInBX |
---|
84 | at DISPLAY_LIB.PrintWordFromAXwithBaseInBX, dw DisplayPrint_WordFromAXWithBaseInBX |
---|
85 | at DISPLAY_LIB.PrintCharBufferFromBXSIwithLengthInCX, dw DisplayPrint_CharacterBufferFromBXSIwithLengthInCX |
---|
86 | at DISPLAY_LIB.PrintNullTerminatedStringFromBXSI, dw DisplayPrint_NullTerminatedStringFromBXSI |
---|
87 | at DISPLAY_LIB.PrintNullTerminatedStringFromCSSI, dw DisplayPrint_NullTerminatedStringFromCSSI |
---|
88 | at DISPLAY_LIB.PrintRepeatedCharacterFromALwithCountInCX, dw DisplayPrint_RepeatCharacterFromALwithCountInCX |
---|
89 | at DISPLAY_LIB.PrintCharacterFromAL, dw DisplayPrint_CharacterFromAL |
---|
90 | at DISPLAY_LIB.PrintNewlineCharacters, dw DisplayPrint_Newline |
---|
91 | at DISPLAY_LIB.ClearAreaWithHeightInAHandWidthInAL, dw DisplayPrint_ClearAreaWithHeightInAHandWidthInAL |
---|
92 | at DISPLAY_LIB.ClearScreenWithCharInALandAttrInAH, dw DisplayPrint_ClearScreenWithCharInALandAttributeInAH |
---|
93 | iend |
---|