VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintChr.asm@ 97613

Last change on this file since 97613 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1; $Id: bs3-cmn-PrintChr.asm 96407 2022-08-22 17:43:14Z vboxsync $
2;; @file
3; BS3Kit - Bs3PrintChr.
4;
5
6;
7; Copyright (C) 2007-2022 Oracle and/or its affiliates.
8;
9; This file is part of VirtualBox base platform packages, as
10; available from https://www.virtualbox.org.
11;
12; This program is free software; you can redistribute it and/or
13; modify it under the terms of the GNU General Public License
14; as published by the Free Software Foundation, in version 3 of the
15; License.
16;
17; This program is distributed in the hope that it will be useful, but
18; WITHOUT ANY WARRANTY; without even the implied warranty of
19; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20; General Public License for more details.
21;
22; You should have received a copy of the GNU General Public License
23; along with this program; if not, see <https://www.gnu.org/licenses>.
24;
25; The contents of this file may alternatively be used under the terms
26; of the Common Development and Distribution License Version 1.0
27; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28; in the VirtualBox distribution, in which case the provisions of the
29; CDDL are applicable instead of those of the GPL.
30;
31; You may elect to license modified versions of this file under the
32; terms and conditions of either the GPL or the CDDL or both.
33;
34; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35;
36
37
38;*********************************************************************************************************************************
39;* Header Files *
40;*********************************************************************************************************************************
41%include "bs3kit-template-header.mac"
42
43
44;*********************************************************************************************************************************
45;* External Symbols *
46;*********************************************************************************************************************************
47%if TMPL_BITS == 16
48BS3_EXTERN_DATA16 g_bBs3CurrentMode
49%endif
50BS3_EXTERN_CMN Bs3Syscall
51
52
53TMPL_BEGIN_TEXT
54
55;;
56; @cproto BS3_DECL(void) Bs3PrintChr_c16(char ch);
57;
58BS3_PROC_BEGIN_CMN Bs3PrintChr, BS3_PBC_NEAR
59 BS3_CALL_CONV_PROLOG 1
60 push xBP
61 mov xBP, xSP
62 push xAX
63 push xCX
64 push xBX
65
66%if TMPL_BITS == 16
67 ; If we're in real mode or v8086 mode, call the VGA BIOS directly.
68 mov bl, [g_bBs3CurrentMode]
69 cmp bl, BS3_MODE_RM
70 je .do_vga_bios_call
71 %if 0
72 test bl, BS3_MODE_CODE_V86
73 jz .do_system_call
74 %else
75 jmp .do_system_call
76 %endif
77
78.do_vga_bios_call:
79 mov al, [xBP + xCB*2] ; Load the char
80 cmp al, 0ah ; \n
81 je .newline
82 mov bx, 0ff00h
83 mov ah, 0eh
84 int 10h
85 jmp .return
86.newline:
87 mov ax, 0e0dh ; cmd + '\r'.
88 mov bx, 0ff00h
89 int 10h
90 mov ax, 0e0ah ; cmd + '\n'.
91 mov bx, 0ff00h
92 int 10h
93 jmp .return
94%endif
95
96.do_system_call:
97 mov cl, [xBP + xCB*2] ; Load the char
98 mov ax, BS3_SYSCALL_PRINT_CHR
99 call Bs3Syscall ; near! no BS3_CALL!
100
101.return:
102 pop xBX
103 pop xCX
104 pop xAX
105 pop xBP
106 BS3_CALL_CONV_EPILOG 1
107 ret
108BS3_PROC_END_CMN Bs3PrintChr
109
110;
111; Generate 16-bit far stub.
112; Peformance critical, so don't penalize near calls.
113;
114BS3_CMN_FAR_STUB Bs3PrintChr, 2
115
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette