kfl@5941ux.UUCP (09/20/83)
A friend of mine recently was having trouble getting
his Heath H100 to light one pixel using the
bit-mapped graphics under ZDOS (MS-DOS), so he
called the consulting folks at Zenith and got this
reply. I am posting it because I think it may be of
general interest to Heath H100/Zenith Z100 owners.
Ken Lee
5941ux!kfl
______________________________________
Dear Customer:
In response to your request, we are sending the
attached information.
If we can be of any further assistance, please call
(616) 982-3860 for operating systems/languages
questions or (616) 982-3884 for applications
programs, or write to: Zenith Data Systems, Software
Consultation, Hilltop Road, St. Joseph, MI 49085.
Sincerely,
The Software Consultation Group
Zenith Data Systems
_______________________________________
Attachment 1
Question: Given an X, Y coordinate, how can I
access a single pixel on the Z100 video screen
within an assembly language program?
Answer: The first thing that must be done is to
enable access to video memory. This is done by
reading port 0D8H, ANDing the value read with 07FH,
and then writing the result back to port 0D8H.
The next step is to form the address of the byte
containing the desired pixel from the X, Y
coordinate. The video disply is organized as 640
pixels or 80 bytes horizontally, by 225 pixels
vertically. The 225 vertical lines are organized
into 25 rows of 9 scan lines each. Assuming that
the X coordinate is in the range 0 to 639 and the Y
coordinate 0 to 224, the 16 bit address can be
formed by first dividing the X ordinate by 8, saving
the remainder and storeing the result in bit
positions 0 through 6 of the address. Next, the Y
ordinate should be divided by 9, the remainder
placed in bit positions 7 through 10, and the result
in positions 11 through 15 or the address. this
resulting address will point to the byte within a
particular color plane containing the pixel. The
remainder from the X divide by 8 operation performed
above can be used to obtain the bit position of the
pixel within that byte. The color planes are 64K
each, with green being at segment E000H, red ad
D000H, and blue at C000H. The diagram below shows
the different fields and their positions within the
address.
15 11 10 7 6 0
__________________________________
| Row | Line | Column |
| 0 - 24 | 0 - 8 | 0 - 79 |
__________________________________
Sixteen bit address
The code fragment given below will accomplish the
task of "turning on" a pixel in the color plane
pointed to be register ES. The X ordinate of the
pixel is passed in register BX, and the Y ordinate
in register AX.
MOV DL,0111B
AND DL,BL ; DL = Remainder of X/8
MOV CL,3
SHR BX,CL ; BX = X/8
MOV DI,BX ; Save result (bits 0-6)
MOV BL,9
DIV BL ; Divide Y by 9
XCHG AL,AH ; AH=result, AL=remainder
MOV BX,AX
AND BX,0FH ; Isolate line number
MOV CL,7
SHL BX,CL ; Move it into position
AND AX,1F00H ; Isolate row number
MOV CL,3
SHL AX,CL ; Move it into position
OR AX,BX
OR DI,AX ; DI = complete address
MOV AL,80H
MOV CL,DL ; CL = remainder from X/8
SHR AL,CL ; AL = pixel mask
OR ES:[DI],AL ; Turn pixel on
________________________________________________
That's it. It works. The Zenith people were very helpful.
We also did the same thing using the CI C86 compiler under
ZDOS. Works fine. The assembly language code given in the letter
is, of course, for the 8088.