; Copyright 1996 Acorn Computers Ltd ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ; ; > $.Source.VduDecl ; ARTHUR OPERATING SYSTEM - Vdu Drivers ; ======================= ; ; Vdu driver workspace and macro declarations ; ; Author R C Manby ; Date 5.9.86 ; GBLL ForceMark ; whether we force start of mark state ForceMark SETL {FALSE} ; of cursor on exit from WRCH GBLL RePlot ; Re-plot cursor after wrch RePlot SETL {TRUE} GBLL UseVLineOnSolidLines ; When TRUE VLine is assembled and used UseVLineOnSolidLines SETL {TRUE} ; to plot vertical solid lines GBLL AvoidScreenReads ; When TRUE, use extra code to avoid AvoidScreenReads SETL {TRUE} ; reading the screen when we can avoid it GBLL DefaultSupremacy ; When TRUE, 16bpp and 32bpp modes' default DefaultSupremacy SETL {FALSE} ; palettes use top bits for supremacy ; ; Register usage ; ============== ; StkPtr RN 13 ;Restore on exit to keep BASIC happy!! Link RN 14 ; ; Manifest constants ; ================== ; PhysCursorStartAdr * CursorSoundPhysRAM ; Reason codes for generalised DAG interface HALDAG_VInit * 0 HALDAG_VStart * 1 HALDAG_VEnd * 2 HALDAG_VRender * 3 [ ModeSelectors ; OS_ScreenMode reason codes ScreenModeReason_SelectMode * 0 ScreenModeReason_ReturnMode * 1 ScreenModeReason_EnumerateModes * 2 ScreenModeReason_SelectMonitorType * 3 ScreenModeReason_ConfigureAcceleration * 4 ScreenModeReason_CleanCache * 5 ScreenModeReason_ForceCleanCache * 6 ScreenModeReason_Limit * 7 ; Mode selector format ^ 0 ModeSelector_Flags # 4 ; flags word ModeSelector_XRes # 4 ; x-resolution in pixels ModeSelector_YRes # 4 ; y-resolution in pixels ModeSelector_PixelDepth # 4 ; pixel depth (=Log2BPP) ModeSelector_FrameRate # 4 ; nominal frame rate (in Hz) ModeSelector_ModeVars # 0 ; start of pairs of (mode var index, value) ModeSelectorFlags_FormatMask * &FF ModeSelectorFlags_ValidFormat * 1 ModeSelector_MaxSize * ModeSelector_ModeVars+(NumModeVars * 8)+4 ; maximum size of a mode selector, with each mode variable overridden ; plus terminator on end ] ; Layout of palette space PalEntries * 256+1+3 ^ 0 Pal_Blank # PalEntries*4 ; Blank palette (for screen saver) Pal_LogFirst # PalEntries*4 ; Logical palette (as read/written by user) Pal_LogSecond # PalEntries*4 Pal_PhysFirst # PalEntries*4 ; Physical palette (post transfer function) Pal_PhysSecond # PalEntries*4 Pal_RTable # 256 ; Logical->physical lookup tables for R,G,B,S Pal_GTable # 256 Pal_BTable # 256 Pal_STable # 256 Pal_Blocksize # 0 ; ; Macro Definitions ; ================= ; ; ; Macro Sort - Sort two values into increasing order ; MACRO Sort $lo, $hi CMP $hi, $lo EORLT $lo, $lo, $hi EORLT $hi, $lo, $hi EORLT $lo, $lo, $hi MEND ; ; Macro SortT - Sort two values into increasing order using a temporary reg ; MACRO SortT $lo, $hi, $temp SUBS $temp, $hi, $lo MOVLT $hi, $lo ADDLT $lo, $lo, $temp MEND ; ; Macro CompSwap - Compare and sort a pair of coordinates into ; order of increasing Y ; If Y values equal, sort in order of decreasing X ; MACRO CompSwap $xl,$yl, $xh,$yh CMP $yh, $yl EORLT $yl, $yl, $yh EORLT $yh, $yl, $yh EORLT $yl, $yl, $yh CMPEQ $xl, $xh EORLT $xl, $xl, $xh EORLT $xh, $xl, $xh EORLT $xl, $xl, $xh MEND ; ; Macro CompSwapT - Compare and sort a pair of coordinates into ; order of increasing Y ; If Y values equal, sort in order of decreasing X ; Uses a temporary register ; MACRO CompSwapT $xl,$yl, $xh,$yh, $temp SortT $yl, $yh, $temp CMPEQ $xl, $xh EORLT $xl, $xl, $xh EORLT $xh, $xl, $xh EORLT $xl, $xl, $xh MEND ; ; Macro Difference - rc := ABS(ra-rb) ; ; Test GE/LT for ra>=rb / ra window CMP $ry,$rb ORRLT $result,$result,#4 ;Set bit 2 if Y < window CMP $rt,$ry ORRLT $result,$result,#8 ;Set bit 3 if Y > window MEND MACRO $lab EQUB $var ASSERT $var >= &00 ASSERT $var <= &FF $lab = $var MEND MACRO OrrEor $d,$s, $or,$eor ORR $d,$s,$or EOR $d,$d,$eor MEND MACRO ;Scr:=ScrOR(oraANDmsk)EOR(eorANDmsk) OrrEorMASK $scr,$msk, $ora,$eor, $tmp AND $tmp,$msk,$ora ORR $scr,$scr,$tmp AND $tmp,$msk,$eor EOR $scr,$scr,$tmp MEND MACRO ORoreorEORoreor $d,$s, $oo,$eo,$oe,$ee, $tmp OrrEor $tmp,$s, $oo,$eo ORR $d,$d,$tmp OrrEor $tmp,$s, $oe,$ee EOR $d,$d,$tmp MEND MACRO ORoreorEORoreorMASK $d,$s,$m, $oo,$eo,$oe,$ee, $tmp OrrEor $tmp,$s, $oo,$eo AND $tmp,$tmp,$m ORR $d,$d,$tmp OrrEor $tmp,$s, $oe,$ee AND $tmp,$tmp,$m EOR $d,$d,$tmp MEND MACRO ShiftR $d,$e, $r,$rcomp MOV $d,$d,LSR $r ORR $d,$d,$e,LSL $rcomp MEND MACRO ShiftL $d,$e, $r,$rcomp MOV $e,$e,LSL $rcomp ORR $e,$e,$d,LSR $r MEND MACRO BitLOffset $b,$x, $xshftfactor,$npix,$log2bpc AND $b,$x,$npix MOV $b,$b,LSL $log2bpc MEND MACRO BitROffset $b,$x, $xshftfactor,$npix,$log2bpc AND $b,$x,$npix ADD $b,$b,#1 MOV $b,$b,LSL $log2bpc SUB $b,$b,#1 MEND MACRO WordOffset $w,$x, $xshftfactor,$npix,$log2bpc MOV $w,$x,ASR $xshftfactor MEND MACRO OffsetWordAndBit $o,$b,$x,$tmp LDR $tmp,[WsPtr,#XShftFactor] MOV $o,$x,ASR $tmp ;Word offset into scanline LDR $tmp,[WsPtr,#NPix] AND $b,$x,$tmp ;Pixel offset into word LDR $tmp,[WsPtr,#Log2BPC] MOV $b,$b,LSL $tmp ;Bit offset into word MEND MACRO $label ErrorMsg $num,$string $label DCD $num DCB "$string", 0 ALIGN MEND ; ; Macro when given a register will return the state to indicate ; if we are in a graphics mode. Originally lots of code used to simply ; load NPix and look for a null parameter (fair enough in 1-8 bit per pixel) ; but now we look at the mode flags, the choice of a new generation! ; MACRO $label GraphicsMode $scrap $label LDR $scrap, [WsPtr, #ModeFlags] TST $scrap, #Flag_NonGraphic ;NE then non-graphic mode! MEND END