DAC: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
'''DAC''' stands for the | '''DAC''' stands for the QBasic Digital to Analog Converter color attributes used in screens 0, 7 and 9. | ||
::::: ''' IMPORTANT: QB64 screens do not use the DAC index!''' | ::::: ''' IMPORTANT: QB64 screens do not use the DAC index!''' | ||
* DAC colors are preset and cannot be changed in | * DAC colors are preset and cannot be changed in QBasic easily(see example). | ||
* DAC color attribute settings cannot be changed using [[PALETTE]] or [[OUT]] RGB statements. | * DAC color attribute settings cannot be changed using [[PALETTE]] or [[OUT]] RGB statements. | ||
* Screen 0 and 9 can use up to 64 DAC color hues. Only attributes 0 to 5 and 7 can have RGB values altered using [[OUT]]. | * Screen 0 and 9 can use up to 64 DAC color hues. Only attributes 0 to 5 and 7 can have RGB values altered using [[OUT]]. | ||
* [[PALETTE]] swap statements can assign one attribute's DAC color setting to another attribute color in [[SCREEN]]s 0 to 9. | * [[PALETTE]] swap statements can assign one attribute's DAC color setting to another attribute color in [[SCREEN]]s 0 to 9. | ||
* Screen attributes 0 to 5 and 7 can have their RGB settings altered using OUT as shown in '''Bold''' below: | * Screen attributes 0 to 5 and 7 can have their RGB settings altered using OUT as shown in '''Bold''' below: | ||
{{ | {{FixedStart}} | ||
'''''SCREEN 0 or 9 SCREEN 7''''' | '''''SCREEN 0 or 9 SCREEN 7''''' | ||
Attribute = DAC setting Attribute = DAC setting | Attribute = DAC setting Attribute = DAC setting | ||
''' 0 to 5 = 0 to 5 | ''' 0 to 5 = 0 to 5 0 to 5 = 0 to 5''' | ||
6 = 20 ''' 6 = 6''' | |||
7 = 7 7 = 7''' | |||
8 = 56 8 = 16 | |||
9 = 57 9 = 17 | 9 = 57 9 = 17 | ||
10 = 58 10 = 18 | 10 = 58 10 = 18 | ||
Line 24: | Line 24: | ||
'''OUT can change RGB intensities where the DAC value matches the attribute value.''' | '''OUT can change RGB intensities where the DAC value matches the attribute value.''' | ||
{{ | {{FixedEnd}} | ||
''Example 1:'' Changing the DAC attributes to use [[OUT]] for custom colors. | ''Example 1:'' Changing the DAC attributes to use [[OUT]] for custom colors. | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl | {{Cl|SCREEN}} 9 'use 0, 7 or 9 only" | ||
InitDAC% = {{Cl|INP}}({{Cl|&H}}3DA) ' prepare DAC port for access | InitDAC% = {{Cl|INP}}({{Cl|&H}}3DA) ' prepare DAC port for access | ||
{{Cl|FOR...NEXT|FOR}} attribute% = 6 {{Cl|TO}} 15 ' attributes 0 to 5 are already non-DAC | {{Cl|FOR...NEXT|FOR}} attribute% = 6 {{Cl|TO}} 15 ' attributes 0 to 5 are already non-DAC | ||
Line 36: | Line 36: | ||
{{Cl|OUT}} {{Cl|&H}}3C0, 32 ' close port access | {{Cl|OUT}} {{Cl|&H}}3C0, 32 ' close port access | ||
{{CodeEnd}} | {{CodeEnd}} | ||
:''Explanation:'' The procedure is a MUST to import 4 BPP bitmap colors in SCREEN 7 or 9. The InitDAC% value is not used, but that code line opens the DAC color port. Now all color attributes 0 to 15 can be used for custom or imported bitmap RGB color settings. | :''Explanation:'' The procedure is a MUST to import 4 BPP bitmap colors in SCREEN 7 or 9. The InitDAC% value is not used, but that code line opens the DAC color port. Now all color attributes 0 to 15 can be used for custom or imported bitmap RGB color settings. | ||
Line 42: | Line 42: | ||
{{CodeStart}} | {{CodeStart}} | ||
D = {{Cl|INP}}(&H3DA) 'prepares port for access | D = {{Cl|INP}}(&H3DA) 'prepares port for access | ||
{{Cl|OUT}} &H3C0, &H30 | {{Cl|OUT}} &H3C0, &H30 | ||
{{Cl|OUT}} &H3C0, 4 | {{Cl|OUT}} &H3C0, 4 | ||
{{CodeEnd}} | {{CodeEnd}} | ||
:''Explanation:'' Make attributes 8-15 available to both foreground AND background colors. In other words it will make fullscreen behave like windowed mode. For the same effect in QB64, use [[_BLINK]] OFF. | :''Explanation:'' Make attributes 8-15 available to both foreground AND background colors. In other words it will make fullscreen behave like windowed mode. For the same effect in QB64, use [[_BLINK]] OFF. | ||
Line 50: | Line 50: | ||
{{CodeStart}} | {{CodeStart}} | ||
D = {{Cl|INP}}(&H3DA) 'prepares port for access | D = {{Cl|INP}}(&H3DA) 'prepares port for access | ||
{{Cl|OUT}} &H3C0, &H30 | {{Cl|OUT}} &H3C0, &H30 | ||
{{Cl|OUT}} &H3C0, 12 | {{Cl|OUT}} &H3C0, 12 | ||
{{CodeEnd}} | {{CodeEnd}} | ||
:'''NOTE: QB64''' allows blinking mode in both fullscreen and windowed modes '''without''' using the code above. To reenable blinking in QB64 after using [[_BLINK]] OFF, use [[_BLINK]] ON. | :'''NOTE: QB64''' allows blinking mode in both fullscreen and windowed modes '''without''' using the code above. To reenable blinking in QB64 after using [[_BLINK]] OFF, use [[_BLINK]] ON. | ||
{{PageSeeAlso}} | |||
* [[SCREEN]], [[COLOR]] | |||
* [[ | |||
* [[PALETTE]] | * [[PALETTE]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 00:28, 29 January 2023
DAC stands for the QBasic Digital to Analog Converter color attributes used in screens 0, 7 and 9.
- IMPORTANT: QB64 screens do not use the DAC index!
- DAC colors are preset and cannot be changed in QBasic easily(see example).
- DAC color attribute settings cannot be changed using PALETTE or OUT RGB statements.
- Screen 0 and 9 can use up to 64 DAC color hues. Only attributes 0 to 5 and 7 can have RGB values altered using OUT.
- PALETTE swap statements can assign one attribute's DAC color setting to another attribute color in SCREENs 0 to 9.
- Screen attributes 0 to 5 and 7 can have their RGB settings altered using OUT as shown in Bold below:
SCREEN 0 or 9 SCREEN 7 Attribute = DAC setting Attribute = DAC setting 0 to 5 = 0 to 5 0 to 5 = 0 to 5 6 = 20 6 = 6 7 = 7 7 = 7 8 = 56 8 = 16 9 = 57 9 = 17 10 = 58 10 = 18 11 = 59 11 = 19 12 = 60 12 = 20 13 = 61 13 = 21 14 = 62 14 = 22 15 = 63 15 = 23 OUT can change RGB intensities where the DAC value matches the attribute value. |
Example 1: Changing the DAC attributes to use OUT for custom colors.
SCREEN 9 'use 0, 7 or 9 only" InitDAC% = INP(&H3DA) ' prepare DAC port for access FOR attribute% = 6 TO 15 ' attributes 0 to 5 are already non-DAC OUT &H3C0, attribute% ' send attribute to change OUT &H3C0, attribute% ' change DAC value to normal number NEXT attribute%" OUT &H3C0, 32 ' close port access |
- Explanation: The procedure is a MUST to import 4 BPP bitmap colors in SCREEN 7 or 9. The InitDAC% value is not used, but that code line opens the DAC color port. Now all color attributes 0 to 15 can be used for custom or imported bitmap RGB color settings.
Example 2: Disabling blinking colors in fullscreen SCREEN 0 mode enabling high intensity only. (DAC)
D = INP(&H3DA) 'prepares port for access OUT &H3C0, &H30 OUT &H3C0, 4 |
- Explanation: Make attributes 8-15 available to both foreground AND background colors. In other words it will make fullscreen behave like windowed mode. For the same effect in QB64, use _BLINK OFF.
Enabling: The following code disables above code and returns SCREEN 0 blinking to normal.
D = INP(&H3DA) 'prepares port for access OUT &H3C0, &H30 OUT &H3C0, 12 |
- NOTE: QB64 allows blinking mode in both fullscreen and windowed modes without using the code above. To reenable blinking in QB64 after using _BLINK OFF, use _BLINK ON.
See also