source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Initialization/PrintString.asm@ 87

Last change on this file since 87 was 86, checked in by krille_n_@…, 14 years ago

Size optimizations in various files in the XTIDE BIOS.
Also added a new include file for generic macros (macros.inc).

File size: 1.8 KB
RevLine 
[3]1; Project name : IDE BIOS
2; Description : Functions for printing strings used in this IDE BIOS.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Prints string with formatting parameters.
9; Do not call PrintString_JumpToFormat!!! Jump there only!
[86]10;
[3]11; PrintString_JumpToFormat
12; Parameters:
13; DH: Number of bytes pushed to stack
14; CS:SI: Ptr to string to format
15; Stack: Parameters for formatting placeholders.
16; Parameter for first placeholder must be pushed last
17; (to top of stack).
18; High word must be pushed first for 32-bit parameters.
19; Returns:
20; Nothing
21; Corrupts registers:
22; AX, CX, DX, SI
23;--------------------------------------------------------------------
24ALIGN JUMP_ALIGN
25PrintString_JumpToFormat:
26 mov cx, ds ; Backup DS
27 push cs ; Push string segment...
28 pop ds ; ...and pop it to DS
29 mov dl, ' ' ; Min length character
30 call Print_Format
31 mov ds, cx ; Restore DS
32 eMOVZX ax, dh ; Bytes in stack
33 add sp, ax ; Clean stack
34 ret
35
36
37;--------------------------------------------------------------------
38; Prints STOP terminated string from wanted segment.
[86]39;
[3]40; PrintString_FromCS
41; PrintString_FromES
42; PrintString_FromDS
43; Parameters:
44; SI: Offset to string to print
45; Returns:
46; Nothing
47; Corrupts registers:
48; AX, DX
49;--------------------------------------------------------------------
50ALIGN JUMP_ALIGN
51PrintString_FromCS:
52 push ds
[86]53 push cs ; Push string segment here...
54 SKIP2B ax ; mov ax, <next 2 bytes/instructions>
[3]55PrintString_FromES:
56 push ds
[86]57 push es ; ...or here...
[3]58 pop ds ; ...and pop it to DS
59 call PrintString_FromDS
60 pop ds
61 ret
62
63ALIGN JUMP_ALIGN
64PrintString_FromDS:
65 mov dx, si ; DS:DX now points to string
66 PRINT_STR_LEN
67 ret
Note: See TracBrowser for help on using the repository browser.