1 | ; $Id: bs3-cmn-PrintChr.asm 76553 2019-01-01 01:45:53Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3PrintChr.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2019 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; The contents of this file may alternatively be used under the terms
|
---|
18 | ; of the Common Development and Distribution License Version 1.0
|
---|
19 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | ; CDDL are applicable instead of those of the GPL.
|
---|
22 | ;
|
---|
23 | ; You may elect to license modified versions of this file under the
|
---|
24 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | ;
|
---|
26 |
|
---|
27 |
|
---|
28 | ;*********************************************************************************************************************************
|
---|
29 | ;* Header Files *
|
---|
30 | ;*********************************************************************************************************************************
|
---|
31 | %include "bs3kit-template-header.mac"
|
---|
32 |
|
---|
33 |
|
---|
34 | ;*********************************************************************************************************************************
|
---|
35 | ;* External Symbols *
|
---|
36 | ;*********************************************************************************************************************************
|
---|
37 | %if TMPL_BITS == 16
|
---|
38 | BS3_EXTERN_DATA16 g_bBs3CurrentMode
|
---|
39 | %endif
|
---|
40 | BS3_EXTERN_CMN Bs3Syscall
|
---|
41 |
|
---|
42 |
|
---|
43 | TMPL_BEGIN_TEXT
|
---|
44 |
|
---|
45 | ;;
|
---|
46 | ; @cproto BS3_DECL(void) Bs3PrintChr_c16(char ch);
|
---|
47 | ;
|
---|
48 | BS3_PROC_BEGIN_CMN Bs3PrintChr, BS3_PBC_NEAR
|
---|
49 | BS3_CALL_CONV_PROLOG 1
|
---|
50 | push xBP
|
---|
51 | mov xBP, xSP
|
---|
52 | push xAX
|
---|
53 | push xCX
|
---|
54 | push xBX
|
---|
55 |
|
---|
56 | %if TMPL_BITS == 16
|
---|
57 | ; If we're in real mode or v8086 mode, call the VGA BIOS directly.
|
---|
58 | mov bl, [g_bBs3CurrentMode]
|
---|
59 | cmp bl, BS3_MODE_RM
|
---|
60 | je .do_vga_bios_call
|
---|
61 | %if 0
|
---|
62 | test bl, BS3_MODE_CODE_V86
|
---|
63 | jz .do_system_call
|
---|
64 | %else
|
---|
65 | jmp .do_system_call
|
---|
66 | %endif
|
---|
67 |
|
---|
68 | .do_vga_bios_call:
|
---|
69 | mov al, [xBP + xCB*2] ; Load the char
|
---|
70 | cmp al, 0ah ; \n
|
---|
71 | je .newline
|
---|
72 | mov bx, 0ff00h
|
---|
73 | mov ah, 0eh
|
---|
74 | int 10h
|
---|
75 | jmp .return
|
---|
76 | .newline:
|
---|
77 | mov ax, 0e0dh ; cmd + '\r'.
|
---|
78 | mov bx, 0ff00h
|
---|
79 | int 10h
|
---|
80 | mov ax, 0e0ah ; cmd + '\n'.
|
---|
81 | mov bx, 0ff00h
|
---|
82 | int 10h
|
---|
83 | jmp .return
|
---|
84 | %endif
|
---|
85 |
|
---|
86 | .do_system_call:
|
---|
87 | mov cl, [xBP + xCB*2] ; Load the char
|
---|
88 | mov ax, BS3_SYSCALL_PRINT_CHR
|
---|
89 | call Bs3Syscall ; near! no BS3_CALL!
|
---|
90 |
|
---|
91 | .return:
|
---|
92 | pop xBX
|
---|
93 | pop xCX
|
---|
94 | pop xAX
|
---|
95 | pop xBP
|
---|
96 | BS3_CALL_CONV_EPILOG 1
|
---|
97 | ret
|
---|
98 | BS3_PROC_END_CMN Bs3PrintChr
|
---|
99 |
|
---|
100 | ;
|
---|
101 | ; Generate 16-bit far stub.
|
---|
102 | ; Peformance critical, so don't penalize near calls.
|
---|
103 | ;
|
---|
104 | BS3_CMN_FAR_STUB Bs3PrintChr, 2
|
---|
105 |
|
---|