Page 1 of 1

Display Codes

Posted: Wed Jul 13, 2022 9:24 am
by mz-80a
Here's an interesting question: Why are the display codes in the Display Code Table ordered in the way that they are?

For instance, it would have been nice if Sharp had put the numeric symbols before the alphabetic symbols. That way if you wanted to print the number "5" on the screen you wouldn't have to do any calculations about what display code to use (not that that is difficult), if the display code for the character '5' was just the value '5' it would be useful.

But apart from that.... there's some cool stuff Sharp did. The pseudo-pixel graphic characters found at the end of the table are all represented by a single bit in the least significant bits for that character. The top-left 'dot' is represented by the LSB (least significant bit). Top-right is the next bit (bit 1 if we're counting from 0). Bottom-left 'dot' is the third bit and bottom-right is represented by the 4th bit. So each 'dot' has its own bit. That makes it very easy to turn dots on and off on the display.

I notice also that they have grouped similar symbols together where the most significant 4 bits don't change but only 1 bit in the least significant 4 bits changes.

Also, along those lines, the filled circle and the empty (or unfilled) circle are easily switched between by inverting the bits! Filled circle is 0111 and unfilled circle is 1000.

Any other patterns in there that are useful?

Re: Display Codes

Posted: Fri Jul 15, 2022 10:16 am
by Pacman
DISPLAY 1:

Vertical bars:
0x71 -> 0x31 -> 0x75 -> 0x35 -> 0x79 -> 0x39 -> 0x7D -> 0x3D
-0x40 +0x44 -0x40 +0x44 -0x40 +0x44 -0x40

Horizontal bars:
0x70 -> 0x30 -> 0x74 -> 0x34 -> 0x78 -> 0x38 -> 0x7C -> 0x3C
-0x40 +0x44 -0x40 +0x44 -0x40 +0x44 -0x40

Re: Display Codes

Posted: Fri Jul 15, 2022 12:53 pm
by hlide
Indeed.

From Left/top to right/bottom:

Code: Select all

NEXT_BAR:
		SUB	$40		; A' = (A - $40) MOD 256 
		JR	C,@f		; if A == $7x then A' = $3x and skip the next instruction else A' = $Fx and execute the next instruction   
		ADD	$84		; A'' = $Fx + $84 = $7x' where x' = (x + 4) MOD 16; wrap from $7C/7D to $70/$71. 
	@@:	...
From Right/bottom to left/top:

Code: Select all

NEXT_BAR:
		ADD	$40		; A' = (A + $40) MOD 256 
		JP	P,@f		; if A == $3x then A' = $7x and skip the next instruction else A' = $Bx and execute the next instruction   
		SUB	$84		; A'' = $Bx - $84 = $3x' where x' = (x - 4) MOD 16; wrap from $30/31 to $3C/3D.
	@@:	...

Re: Display Codes

Posted: Fri Jul 15, 2022 7:52 pm
by Pacman
There are others in the same style:

Square :
0x72 0x73
0x32 0x33

Complements :
0x3A and 0x7A : +0x40
0x3B and 0x7B : +0x40
0x5B and 0x6C : +0x11

Large circle :

Code: Select all

0x9C 0x9D 0x9E 0x9F
0xB0           0xB3
0xB4           0xB7
0xB8 0xB9 0xBA 0xBB

Re: Display Codes

Posted: Sun Jul 17, 2022 7:45 pm
by mz-80a
All very cool! Thanks :)

I guess Sharp put some thought into it.