11.3Smacallan/* $NetBSD: nglereg.h,v 1.3 2025/12/15 09:46:42 macallan Exp $ */ 21.1Smacallan 31.1Smacallan/* 41.1Smacallan * Copyright (c) 2025 Michael Lorenz 51.1Smacallan * All rights reserved. 61.1Smacallan * 71.1Smacallan * Redistribution and use in source and binary forms, with or without 81.1Smacallan * modification, are permitted provided that the following conditions 91.1Smacallan * are met: 101.1Smacallan * 1. Redistributions of source code must retain the above copyright 111.1Smacallan * notice, this list of conditions and the following disclaimer. 121.1Smacallan * 2. Redistributions in binary form must reproduce the above copyright 131.1Smacallan * notice, this list of conditions and the following disclaimer in the 141.1Smacallan * documentation and/or other materials provided with the distribution. 151.1Smacallan * 161.1Smacallan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 171.1Smacallan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 181.1Smacallan * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 191.1Smacallan * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, 201.1Smacallan * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 211.1Smacallan * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 221.1Smacallan * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 231.1Smacallan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 241.1Smacallan * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 251.1Smacallan * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 261.1Smacallan * THE POSSIBILITY OF SUCH DAMAGE. 271.1Smacallan */ 281.1Smacallan 291.1Smacallan/* 301.1Smacallan * HP Visualize EG and HCRX 311.1Smacallan * sensible register names instead of random numbers 321.1Smacallan * mostly found by experiment 331.1Smacallan */ 341.1Smacallan 351.1Smacallan#ifndef NGLEREG_H 361.1Smacallan#define NGLEREG_H 371.1Smacallan 381.1Smacallan#define NGLE_HCRX_VBUS 0x000420 /* HCRX video bus access */ 391.1Smacallan 401.1Smacallan/* 411.1Smacallan * BINC writes work more or less like FX4, except pixel addressing is a linear 421.1Smacallan * address in whatever unit specified in NGLE_DBA ( AddrByte or AddrWord ) 431.1Smacallan */ 441.1Smacallan#define NGLE_BINC_SRC 0x000480 /* BINC src */ 451.1Smacallan#define NGLE_BINC_DST 0x0004a0 /* BINC dst */ 461.1Smacallan#define NGLE_BINC_MASK 0x0005a0 /* BINC pixel mask */ 471.1Smacallan#define NGLE_BINC_DATA 0x0005c0 /* BINC data, inc X, some sort of blending */ 481.1Smacallan#define NGLE_BINC_DATA_R 0x000600 /* BINC data, inc X */ 491.1Smacallan#define NGLE_BINC_DATA_D 0x000620 /* BINC data, inc Y */ 501.1Smacallan#define NGLE_BINC_DATA_U 0x000640 /* BINC data, dec Y */ 511.1Smacallan#define NGLE_BINC_DATA_L 0x000660 /* BINC data, dec X */ 521.1Smacallan#define NGLE_BINC_DATA_DR 0x000680 /* BINC data, inc X, inc Y */ 531.1Smacallan#define NGLE_BINC_DATA_DL 0x0006a0 /* BINC data, dec X, inc Y */ 541.1Smacallan#define NGLE_BINC_DATA_UR 0x0006c0 /* BINC data, inc X, dec Y */ 551.1Smacallan#define NGLE_BINC_DATA_UL 0x0006e0 /* BINC data, dec X, dec Y */ 561.1Smacallan 571.1Smacallan/* 581.1Smacallan * coordinate registers 591.1Smacallan * these *do* work like FX4 - you poke coordinates into registers and OR an 601.1Smacallan * opcode on the last register write's address 611.1Smacallan */ 621.1Smacallan#define NGLE_DST_XY 0x000800 /* destination XY */ 631.1Smacallan#define NGLE_SIZE 0x000804 /* size WH */ 641.1Smacallan#define NGLE_SRC_XY 0x000808 /* source XY */ 651.1Smacallan#define NGLE_TRANSFER_DATA 0x000820 /* 'transfer data' - this is */ 661.1Smacallan /* a pixel mask on fills */ 671.1Smacallan#define NGLE_RECT 0x000200 /* opcode to start a fill */ 681.1Smacallan#define NGLE_BLIT 0x000300 /* opcode to start a blit */ 691.1Smacallan#define NGLE_HCRX_FASTFILL 0x000140 /* opcode for HCRX fast rect */ 701.1Smacallan#define NGLE_RECT_SIZE_START (NGLE_SIZE | NGLE_RECT) 711.1Smacallan#define NGLE_BLT_DST_START (NGLE_DST_XY | NGLE_BLIT) 721.1Smacallan 731.1Smacallan/* 741.1Smacallan * bitmap access 751.1Smacallan * works more or less like FX4, with completely different bit assignments 761.1Smacallan */ 771.1Smacallan#define NGLE_BAboth 0x018000 /* read and write mode */ 781.1Smacallan#define NGLE_DBA 0x018004 /* write mode */ 791.1Smacallan#define NGLE_SBA 0x018008 /* read mode */ 801.1Smacallan 811.1Smacallan#define BA(F,C,S,A,J,B,I) \ 821.1Smacallan (((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I)) 831.1Smacallan /* FCCC CSSS AAAJ JJJJ BBBB IIII IIII IIII */ 841.1Smacallan 851.1Smacallan/* F */ 861.1Smacallan#define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ 871.1Smacallan#define FractDcd 1 /* Pixel data is Fractional 8-8-8 */ 881.1Smacallan/* C */ 891.1Smacallan#define Otc04 2 /* Pixels in each longword transfer (4) */ 901.1Smacallan#define Otc32 5 /* Pixels in each longword transfer (32) */ 911.1Smacallan#define Otc24 7 /* NGLE uses this for 24bit blits */ 921.1Smacallan /* Should really be... */ 931.1Smacallan#define Otc01 7 /* one pixel per longword */ 941.1Smacallan/* S */ 951.1Smacallan#define Ots08 3 /* Each pixel is size (8)d transfer (1) */ 961.1Smacallan#define OtsIndirect 6 /* Each bit goes through FG/BG color(8) */ 971.1Smacallan/* A */ 981.1Smacallan#define AddrByte 3 /* byte access? Used by NGLE for direct fb */ 991.1Smacallan#define AddrLong 5 /* FB address is Long aligned (pixel) */ 1001.1Smacallan#define Addr24 7 /* used for colour map access */ 1011.1Smacallan/* B */ 1021.1Smacallan#define BINapp0I 0x0 /* Application Buffer 0, Indexed */ 1031.1Smacallan#define BINapp1I 0x1 /* Application Buffer 1, Indexed */ 1041.1Smacallan#define BINovly 0x2 /* 8 bit overlay */ 1051.1Smacallan#define BINcursor 0x6 /* cursor bitmap on EG */ 1061.1Smacallan#define BINcmask 0x7 /* cursor mask on EG */ 1071.1Smacallan#define BINapp0F8 0xa /* Application Buffer 0, Fractional 8-8-8 */ 1081.1Smacallan/* next one is a guess, my HCRX24 doesn't seem to have it */ 1091.1Smacallan#define BINapp1F8 0xb /* Application Buffer 1, Fractional 8-8-8 */ 1101.1Smacallan#define BINattr 0xd /* Attribute Bitmap */ 1111.1Smacallan#define BINcmap 0xf /* colour map(s) */ 1121.1Smacallan/* I assume one of the undefined BIN* accesses the HCRX Z-buffer add-on. No clue 1131.1Smacallan * about bit depth or if any bits are used for stencil */ 1141.1Smacallan 1151.1Smacallan/* other buffers are unknown */ 1161.1Smacallan/* J - 'BA just point' - function unknown */ 1171.1Smacallan/* I - 'BA index base' - function unknown */ 1181.1Smacallan 1191.1Smacallan#define NGLE_CPR 0x01800c /* control plane register */ 1201.1Smacallan#define NGLE_FG 0x018010 /* fg colour */ 1211.1Smacallan#define NGLE_BG 0x018014 /* bg colour */ 1221.1Smacallan#define NGLE_PLANEMASK 0x018018 /* image planemask */ 1231.1Smacallan#define NGLE_IBO 0x01801c /* image binary op */ 1241.1Smacallan 1251.1Smacallan#define IBOvals(R,M,X,S,D,L,B,F) \ 1261.1Smacallan (((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F)) 1271.1Smacallan /* LSSD XXXX MMMM MMMM RRRR RRRR ???? ??BF */ 1281.1Smacallan 1291.1Smacallan/* R is a standard X11 ROP, no idea if the other bits are used for anything */ 1301.1Smacallan#define RopClr 0x0 1311.1Smacallan#define RopSrc 0x3 1321.1Smacallan#define RopInv 0xc 1331.1Smacallan#define RopSet 0xf 1341.1Smacallan/* M: 'mask addr offset' - function unknown */ 1351.1Smacallan/* X */ 1361.1Smacallan#define BitmapExtent08 3 /* Each write hits ( 8) bits in depth */ 1371.1Smacallan#define BitmapExtent32 5 /* Each write hits (32) bits in depth */ 1381.1Smacallan/* S: 'static reg' flag, NGLE sets it for blits, function is unknown but 1391.1Smacallan we get occasional garbage in 8bit blits without it */ 1401.1Smacallan/* D */ 1411.1Smacallan#define DataDynamic 0 /* Data register reloaded by direct access */ 1421.1Smacallan#define MaskDynamic 1 /* Mask register reloaded by direct access */ 1431.1Smacallan/* L */ 1441.1Smacallan#define MaskOtc 0 /* Mask contains Object Count valid bits */ 1451.1Smacallan/* B = 1 -> background transparency for masked fills */ 1461.1Smacallan/* F probably the same for foreground */ 1471.1Smacallan 1481.1Smacallan#define NGLE_DODGER 0x200000 /* 'busy dodger' idle */ 1491.1Smacallan #define DODGER_IDLE 0x1000 /* or 0x10000, likely tpyo */ 1501.1Smacallan#define NGLE_BUSY 0x200000 /* busy register */ 1511.2Smacallan#define NGLE_CONTROL 0x200004 /* a guess */ 1521.2Smacallan/* 1531.2Smacallan * byte access, need to write 1 here for fb access to work properly 1541.2Smacallan */ 1551.2Smacallan#define NGLE_CONTROL_FB 0x200005 1561.1Smacallan#define NGLE_FIFO 0x200008 /* # of fifo slots */ 1571.1Smacallan#define NGLE_EG_CURSOR 0x200100 /* cursor coordinates on EG */ 1581.1Smacallan #define EG_ENABLE_CURSOR 0x80000000 1591.1Smacallan//#define NGLE_REG_18 0x200104 /* cursor enable */ 1601.1Smacallan#define NGLE_EG_LUTBLT 0x200118 /* EG LUT blt ctrl */ 1611.1Smacallan /* EWRRRROO OOOOOOOO TTRRRRLL LLLLLLLL */ 1621.1Smacallan #define LBC_ENABLE 0x80000000 1631.1Smacallan #define LBC_WAIT_BLANK 0x40000000 1641.1Smacallan #define LBS_OFFSET_SHIFT 16 1651.1Smacallan #define LBC_TYPE_MASK 0xc000 1661.1Smacallan #define LBC_TYPE_CMAP 0 1671.1Smacallan #define LBC_TYPE_CURSOR 0x8000 1681.1Smacallan #define LBC_TYPE_OVERLAY 0xc000 1691.1Smacallan #define LBC_LENGTH_SHIFT 0 1701.1Smacallan//#define NGLE_REG_19 0x200200 /* artist sprite size */ 1711.1Smacallan//#define NGLE_REG_20 0x200208 /* cursor geometry */ 1721.1Smacallan#define NGLE_EG_MISCVID 0x200218 /* Artist misc video */ 1731.1Smacallan#define NGLE_EG_MISCCTL 0x200308 /* Artist misc ctrl */ 1741.1Smacallan#define NGLE_HCRX_CURSOR 0x210000 /* HCRX cursor coord & enable */ 1751.1Smacallan #define HCRX_ENABLE_CURSOR 0x80000000 1761.1Smacallan/* HCRX uses those to access the cursor image instead of BINcursor/BINcmask */ 1771.3Smacallan#define NGLE_HCRX_CURSOR_ADDR 0x210004 /* HCRX cursor address */ 1781.1Smacallan#define NGLE_HCRX_CURSOR_DATA 0x210008 /* HCRX cursor data */ 1791.1Smacallan 1801.1Smacallan#define NGLE_HCRX_LUTBLT 0x210020 /* HCRX LUT blt ctrl */ 1811.1Smacallan#define NGLE_HCRX_PLANE_ENABLE 0x21003c /* HCRX plane enable */ 1821.1Smacallan#define NGLE_HCRX_MISCVID 0x210040 /* HCRX misc video */ 1831.1Smacallan #define HCRX_BOOST_ENABLE 0x80000000 /* extra high signal level */ 1841.1Smacallan #define HCRX_VIDEO_ENABLE 0x0A000000 1851.1Smacallan #define HCRX_OUTPUT_ENABLE 0x01000000 1861.1Smacallan#define NGLE_HCRX_HB_MODE2 0x210120 /* HCRX 'hyperbowl' mode 2 */ 1871.1Smacallan #define HYPERBOWL_MODE2_8_24 15 1881.1Smacallan/* 1891.1Smacallan * this seems to be the HCRX's analogue to FX's force attribute register - we 1901.1Smacallan * can switch between overlay opacity and image plane display mode on the fly 1911.1Smacallan */ 1921.1Smacallan#define NGLE_HCRX_HB_MODE 0x210130 /* HCRX 'hyperbowl' */ 1931.1Smacallan #define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES 4 1941.1Smacallan #define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE 8 1951.1Smacallan #define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE 10 1961.1Smacallan 1971.1Smacallan#endif /* NGLEREG_H */