|
This not encryption or anything mysterious, it is simply copying unsigned char 8 bit into a 32 bit type by bit wise operations not all the time. NOT encryption.
|
|
|
|
|
The RA8875 is a controller for an 800x480 display I am using in a project.
You can rotate the screen via setting some registers.
There is no option to rotate 90 degrees, only 270, leaving the X axis, and thus text and bitmaps mirrored.
Whoever designed this should be forced to use it.
Real programmers use butterflies
|
|
|
|
|
Can't you just rotate it 3 times to get 90 degrees? Inelegant, but I must be missing something.
|
|
|
|
|
It's not quite 5am and my spatial reasoning may not be entirely on point right now.
Basically when I rotate it, it goes 90 degrees with the X axis inverted.
You cannot rotate it 3 times nor flip the X axis because they only use 2 bits to store the rotation.
These are the directions you can set the memory write order:
LRTD
RLTD
TDLR
DTLR
(T=Top, R=Right, D=Down, L=Left)
Real programmers use butterflies
|
|
|
|
|
I'm missing the TLDR option
|
|
|
|
|
Because you can mirror the x axis yourself reading the lines backwards.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Yeah, no. Because then you can't send bitmap data using DMA, and you need to generate a lot more bus traffic. The device should have been designed correctly.
Real programmers use butterflies
|
|
|
|
|
"Rotate" doesn't exist -- there are only flips, on three axes.
Odd that they provide only two bits when you need three.
|
|
|
|
|
Call it what you want. You know what I was talking about so I did my part. Prescriptivism is annoying.
Real programmers use butterflies
|
|
|
|
|
Could you do the rotation and then use the horizontal and vertical scan direction registers to mirror the display (and get an extra 180 degrees of rotation)?
|
|
|
|
|
It doesn't have registers for mirroring aside from the two bits it uses, and I need three.
Real programmers use butterflies
|
|
|
|
|
Register 20H instead of 40H/45H? Or is that the wrong controller I am looking at? It might be something completely different or not do what you need.
I agree, it does need three bits to get all of the rotations/mirrors that are possible and they have a spare bit, so why didn't they just give all eight options?
|
|
|
|
|
Fueled By Decaff wrote: Register 20H instead of 40H/45H?
Nice catch! I guess my eyes are glazing over it after poring over it for a day while writing a driver for it.
I'll see if it works.
I don't know why they didn't use 3 bits. It's just weird.
Real programmers use butterflies
|
|
|
|
|
|
Usually these IoT display controllers allow you to rotate any direction due to the screen orientation being unknown in advance. In any case, thanks to FueledByDecaf I worked it out by adjusting both the write order and the scan direction both.
Real programmers use butterflies
|
|
|
|
|
|
In my defense this code was generated by a tool. It's still some of the weirdest code to do string ops in SQL I've seen. Part of it is due to the fact that it converts everything to UTF32 as it goes, even though in this routine it really doesn't need to.
DROP PROCEDURE [dbo].[SqlCompiledChecker_IsCommentBlockBlockEnd]
GO
CREATE PROCEDURE [dbo].[SqlCompiledChecker_IsCommentBlockBlockEnd] @value NVARCHAR(MAX), @index INT, @ch INT
AS
BEGIN
DECLARE @adv INT
DECLARE @matched INT
DECLARE @valueEnd INT = DATALENGTH(@value)/2+1
DECLARE @tch BIGINT
DECLARE @accept INT = -1
DECLARE @result INT = 0
WHILE @ch <> -1
BEGIN
SET @matched = 0
IF @ch = 42
BEGIN
SET @index = @index + 1
SET @adv = 1
IF @index < @valueEnd
BEGIN
SET @ch = UNICODE(SUBSTRING(@value, @index, 1))
SET @tch = @ch - 0xd800
IF @tch < 0 SET @tch = @tch + 2147483648
IF @tch < 2048
BEGIN
SET @ch = @ch * 1024
SET @index = @index + 1
SET @adv = 2
IF @index >= @valueEnd RETURN -1
SET @ch = @ch + UNICODE(SUBSTRING(@value, @index, 1)) - 0x35fdc00
END
END
ELSE
BEGIN
SET @ch = -1
END
SET @matched = 1
GOTO q1
END
GOTO next
q1:
IF @ch = 47
BEGIN
SET @index = @index + 1
SET @adv = 1
IF @index < @valueEnd
BEGIN
SET @ch = UNICODE(SUBSTRING(@value, @index, 1))
SET @tch = @ch - 0xd800
IF @tch < 0 SET @tch = @tch + 2147483648
IF @tch < 2048
BEGIN
SET @ch = @ch * 1024
SET @index = @index + 1
SET @adv = 2
IF @index >= @valueEnd RETURN -1
SET @ch = @ch + UNICODE(SUBSTRING(@value, @index, 1)) - 0x35fdc00
END
END
ELSE
BEGIN
SET @ch = -1
END
SET @matched = 1
GOTO q2
END
GOTO next
q2:
RETURN CASE @ch WHEN -1 THEN 1 ELSE 0 END
next:
IF @matched = 0
BEGIN
SET @index = @index + 1
SET @adv = 1
IF @index < @valueEnd
BEGIN
SET @ch = UNICODE(SUBSTRING(@value, @index, 1))
SET @tch = @ch - 0xd800
IF @tch < 0 SET @tch = @tch + 2147483648
IF @tch < 2048
BEGIN
SET @ch = @ch * 1024
SET @index = @index + 1
SET @adv = 2
IF @index >= @valueEnd RETURN -1
SET @ch = @ch + UNICODE(SUBSTRING(@value, @index, 1)) - 0x35fdc00
END
END
ELSE
BEGIN
SET @ch = -1
END
END
END
RETURN 0
END
GO
DROP PROCEDURE [dbo].[SqlCompiledChecker_IsCommentBlock]
GO
CREATE PROCEDURE [dbo].[SqlCompiledChecker_IsCommentBlock] @value NVARCHAR(MAX)
AS
BEGIN
DECLARE @adv INT
DECLARE @ch BIGINT
DECLARE @tch BIGINT
DECLARE @index INT = 0
DECLARE @valueEnd INT = DATALENGTH(@value)/2+1
DECLARE @result INT
SET @index = @index + 1
SET @adv = 1
IF @index < @valueEnd
BEGIN
SET @ch = UNICODE(SUBSTRING(@value, @index, 1))
SET @tch = @ch - 0xd800
IF @tch < 0 SET @tch = @tch + 2147483648
IF @tch < 2048
BEGIN
SET @ch = @ch * 1024
SET @index = @index + 1
SET @adv = 2
IF @index >= @valueEnd RETURN -1
SET @ch = @ch + UNICODE(SUBSTRING(@value, @index, 1)) - 0x35fdc00
END
END
ELSE
BEGIN
SET @ch = -1
END
WHILE @ch <> -1
BEGIN
IF @ch = 47
BEGIN
SET @index = @index + 1
SET @adv = 1
IF @index < @valueEnd
BEGIN
SET @ch = UNICODE(SUBSTRING(@value, @index, 1))
SET @tch = @ch - 0xd800
IF @tch < 0 SET @tch = @tch + 2147483648
IF @tch < 2048
BEGIN
SET @ch = @ch * 1024
SET @index = @index + 1
SET @adv = 2
IF @index >= @valueEnd RETURN -1
SET @ch = @ch + UNICODE(SUBSTRING(@value, @index, 1)) - 0x35fdc00
END
END
ELSE
BEGIN
SET @ch = -1
END
GOTO q1
END
RETURN 0
q1:
IF @ch = 42
BEGIN
SET @index = @index + 1
SET @adv = 1
IF @index < @valueEnd
BEGIN
SET @ch = UNICODE(SUBSTRING(@value, @index, 1))
SET @tch = @ch - 0xd800
IF @tch < 0 SET @tch = @tch + 2147483648
IF @tch < 2048
BEGIN
SET @ch = @ch * 1024
SET @index = @index + 1
SET @adv = 2
IF @index >= @valueEnd RETURN -1
SET @ch = @ch + UNICODE(SUBSTRING(@value, @index, 1)) - 0x35fdc00
END
END
ELSE
BEGIN
SET @ch = -1
END
GOTO q2
END
RETURN 0
q2:
EXEC @result = SqlCompiledChecker_IsCommentBlockBlockEnd @value, @index, @ch
RETURN @result
END
RETURN 0
END
GO
Real programmers use butterflies
|
|
|
|
|
UTF16 ain't good enough for you?
|
|
|
|
|
UTF16 surrogate pairs exist, so no. Frankly, I wish UTF16 didn't exist at all. It seems a waste of everyone's time. No wonder MS adopted it.
Real programmers use butterflies
|
|
|
|
|
code salad.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
With a side of syntax soup.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
I'm dying to know what sin in a past life led you to NEED to determine whether the passed in string is a C style comment block - in T-SQL.
Truth,
James
|
|
|
|
|
The comment block was test code. The error of my ways was an outdated idea of restricting access to tables in SQL coupled with stored procedure based field validation, which is where this came in. There is a code generator that produced this particular matcher.
Real programmers use butterflies
|
|
|
|
|
GitHub - roozbehid/WasmWinforms: C# Winforms for Webassembly[^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
To quote Peter Lorre's character in The Black Cat segment of Tales of Terror[^]:
"How vomitable!"
Software Zen: delete this;
|
|
|
|