Repository navigation
Out
Home › Miscellaneous Keywords › Out
Outputs a value to a hardware port.
Declare Function Out ( ByVal port As UShort , ByVal data As UByte ) As Longportdata
This function sends value to port and returns immediately.
Out port,value
-
In the Windows and Linux versions three port numbers (&H3C7, &H3C8, &H3C9) are hooked by the graphics library when a graphics mode is in use to emulate QB's VGA palette handling. This use is deprecated; use
Paletteto retrieve and set palette colors.Using true port access in the Windows version requires the program to install a device driver for the present session. For that reason, Windows executables using hardware port access should be run with administrator permits each time the computer is restarted. Further runs don't require admin rights as they just use the already installed driver. The driver is only 3K in size and is embedded in the executable.
'speakersound.bas
Sub Sound(ByVal freq As UInteger, dur As UInteger)
Dim t As Double,f1 As Unsigned Short
f1 = 1193181 \ freq
Out &h61,Inp(&h61) Or 3
Out &h43,&hb6
Out &h42,LoByte(f1)
Out &h42,HiByte(f1)
t=Timer
While ((Timer - t) * 1000) < dur
Sleep 0,1
Wend
Out &h61,Inp(&h61) And &hfc
End Sub
Sound(523, 60) 'C5
Sound(587, 60) 'D5
Sound(659, 60) 'E5
Sound(698, 60) 'F5
Sound(784, 60) 'G5
Sound(880, 60) 'A5
Sound(988, 60) 'B5
Sound(1046, 60) 'C6Category: Miscellaneous Keywords
Kind: function
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing