home *** CD-ROM | disk | FTP | other *** search
- The following text was copied from a photocopy distributed by Leading
- Edge Hardware Products. It contained no copyright notice, and I can't
- imagine the LE would care that I reproduced it. They'll send it to you free
- if you ask them for it. I have proof-read this document very carefully, but
- gremlins may have crept in. Use the information contained herein at your
- own risk.
-
- The Model "D" Video Controller
-
- The Model "D" video controller has the combined capability of the IBM
- Monochrome Display Board and the IBM Color Graphics Display Board. It also
- provides Hercules Compatible Monochrome Graphics and a High Resolution 640 X
- 200 16 color graphics mode.
-
- Since there is only one 6845 CRT controller chip used in the circuitry,
- the system cannot run in both modes simultaneously. The video mode switch in
- the rear of the machine functions in two ways. It physically changes the I/O
- address of the CRT controller chip and related registers between MONOCHROME
- (03BxH) and COLOR (03DxH) and is actually DIPswitch 2-5, which selects
- monochrome or color mode at power on.
-
- There is 64K of video RAM associated with the controller and resides
- from address B0000H to address BFFFFH. This is used to hold the
- characters/attributes or graphic dot patterns to be displayed on the screen.
-
- Below is a description of each of the modes and sample programs for
- initializing the controller to be in each of the modes. Throughout this
- document bit 7 is the most significant bit and bit 0 is the least significant
- bit.
-
-
- *********************
- * *
- * MONOCHROME MODE *
- * *
- *********************
-
- 80 X 25 TEXT MODE
-
- In alphanumeric mode 80 columns by 25 rows of characters can be
- displayed. The characters are mapped into even locations from addresses
- B0000H to B0FFFH. The attributes are mapped into the odd locations.
- Location B0000 corresponds to the top left corner of the screen. The
- attribute determines how the character is to be displayed. The various
- attributes are as follows:
-
- data bits
- 7 6 5 4 3 2 1 0 hex style of text
- --------------- --- -------------------
- 0 0 0 0 0 0 0 0 00 no character display
- 0 0 0 0 0 0 0 1 01 underlined character
- 0 0 0 0 0 1 1 1 07 normal character
- 0 0 0 0 1 0 0 1 09 underline, high intensity
- 0 0 0 0 1 1 1 1 0F high intensity character
- 0 1 1 1 0 0 0 0 70 reverse video character
- 1 0 0 0 0 0 0 1 81 blinking, underlined character
- 1 0 0 0 0 1 1 1 87 blinking, normal character
- 1 0 0 0 1 0 0 1 89 blinking, underline, high intensity
- 1 1 1 1 0 0 0 0 F0 blinking, reverse bideo
- 1 1 1 1 1 0 0 0 F8 blinking, reverse vieo, high intensity
-
- The attribute determines how the character is to be displayed. The
- attribute byte in the color mode is much different than it was in the
- monochrome mode. Each of the bits in the attribute byte areas follows:
-
- Data bit 7 = BLINK CHARACTER
- 6 = RED BACKGROUND
- 5 = GREEN BACKGROUND
- 4 = BLUE BACKGROUND
- 3 = INTENSITY CHARACTER
- 2 = RED CHARACTER
- 1 = GREEN CHARACTER
- 0 = BLUE CHARACTER
-
- By setting some bits on and some bits off, you can create colored
- characters on a differently colored background. Also you have the choice of
- making the character blink or not.
-
-
- 720 X 348 GRAPHICS MODE
-
- In monochrome graphics mode there are two pages of 720 X 348 pixels.
- Each data bit in each byte represents a pixel on the display. Each scan line
- consists of 90 bytes of memory. The adjacent scan lines which appear in the
- display are not mapped adjacently in the video memory. Below is a
- representation of how the memory is arranged in the monochrome graphic mode.
-
- PAGE 0 PAGE 1
- ------------ ----------------
-
- +-----------------------+ +-----------------------+
- B0000 | | B8000 | |
- | SCAN LINES 0,4,8 ETC | | SCAN LINES 0,4,8 ETC |
- | | | |
- B1FFF | | B9FFF | |
- +-----------------------+ +-----------------------+
- B2000 | | BA000 | |
- | SCAN LINES 1,5,9 ETC | | SCAN LINES 1,5,9 ETC |
- | | | |
- B3FFF | | BBFFF | |
- +-----------------------+ +-----------------------+
- B4000 | | BC000 | |
- | SCAN LINES 2,6,10 ETC | | SCAN LINES 2,6,10 ETC |
- | | | |
- B5FFF | | BDFFF | |
- +-----------------------+ +-----------------------+
- B6000 | | BE000 | |
- | SCAN LINES 3,7,11 ETC | | SCAN LINES 3,7,11 ETC |
- | | | |
- B7FFF | | BFFFF | |
- +-----------------------+ +-----------------------+
-
- The page selection is done in the Display Control Register. This will be
- explained in detail later.
-
-
- With color graphics there are 3 separate and different modes available.
-
- 320 X 200 MEDIUM RESOLUTION GRAPHICS MODE
-
- Each pair of data bits represents a pixel on the display. Therefore
- pixel can have 1 of 4 colors as follows:
-
- data bit 7,6 = C1,C0 respectively for the 1st pixel
- 5,4 = C1,C0 respectively for the 2nd pixel
- 3,2 = C1,C0 respectively for the 3rd pixel
- 1,0 = C1,C0 respectively for the 4th pixel
-
- C1 C0 color set 0 color set 1 color set 2 color set 3
- -----------------|--------------|------------|------------|-------------
- 0 0 -----------predetermined background color-----------
- 0 1 green lt. green cyan lt. cyan
- 1 0 red lt. red magenta lt. magenta
- 1 1 brown yellow lt. gray white
-
- The color set and background color are selected by writing the
- appropriate value to the Color Mode Regsiter at location 03D9H.
-
- data bit 0 = blue background
- 1 = green background
- 2 = red background
- 3 = intensity background
- 4 = color set bit 0
- 5 = color set bit 1
- 6 =
- 7 =
-
- Each scan line consists of 80 bytes of memory. The adjacent scan lines
- which appear on the display are not mapped adjacently in the video memory.
- Below is a representation of how the memory is arranged in 320 X 200 graphics
- mode.
-
- +------------------------+
- B8000 | |
- | SCAN LINES 0,2,4 ETC |
- | |
- B9FFF | |
- +------------------------+
- BA000 | |
- | SCAN LINES 1,3,5 ETC. |
- | |
- BBFFF | |
- +------------------------+
-
- 640 X 200 HIGH RESOLUTION 2-COLOR GRAPHICS
-
- Each data bit represents a pixel on the display. Therefore each pixel
- can have 1 of two colors. The background color is always black. The
- foreground color may be any 1 of 16 available colors. It is chosen by
- writing the appropriate value to the Color Mode Register at location 03D9H.
-
- data bit 0 = blue background
- 1 = green background
- 2 = red background
- 3 = intensity background
- 4 =
- 5 =
- 6 =
- 7 =
-
- Each scan line consists of 80 bytes of memory. The adjacent scan lines
- which appear on the display are not mapped adjacently in the video memory.
- Below is a representation of how the memory is arranged in the 640 X 200
- 2-color graphics mode.
-
-
- +------------------------+
- B8000 | |
- | SCAN LINES 0,2,4 ETC |
- | |
- B9FFF | |
- +------------------------+
- BA000 | |
- | SCAN LINES 1,3,5 ETC. |
- | |
- BBFFF | |
- +------------------------+
-
-
- 640 X 200 HIGH RESOLUTION 16-COLOR GRAPHICS
-
- Four separate data bits represent a pixel on the display. Therefore
- each pixel can have 1 of 16 colors. The 4 bits are in different banks of
- memory. Each bank of memory corresponds to red, green, blue, and intensity.
-
- Each scan line consists of 320 bytes of memory. The adjacent scan lines
- which appear on the display are not mapped adjacently in the video memory.
- Below is a representation of how the memory is arranged in 640 X 200 16-color
- graphics mode.
-
-
- INTENSITY BANK BLUE BANK
- +-----------------------+ +-----------------------+
- B0000 | | B4000 | |
- | SCAN LINES 0,2,4 ETC | | SCAN LINES 0,2,4 ETC |
- | | | |
- B1FFF | | B5FFF | |
- +-----------------------+ +-----------------------+
- B2000 | | B6000 | |
- | SCAN LINES 1,3,5 ETC | | SCAN LINES 1,3,5 ETC |
- | | | |
- B3FFF | | B7FFF | |
- +-----------------------+ +-----------------------+
-
- GREEN BANK RED BANK
- +-----------------------+ +-----------------------+
- B8000 | | BC000 | |
- | SCAN LINES 0,2,4 ETC | | SCAN LINES 0,2,4 ETC |
- | | | |
- B9FFF | | BDFFF | |
- +-----------------------+ +-----------------------+
- BA000 | | BE000 | |
- | SCAN LINES 1,3,5 ETC | | SCAN LINES 1,3,5 ETC |
- | | | |
- BBFFF | | BFFFF | |
- +-----------------------+ +-----------------------+
-
-
- VIDEO CONTROLLER REGISTERS
-
- 6845 CRT INDEX REGISTER (03D4H / 03B4H)
- You set this register equal to the number of the data register into
- which you want to write.
-
- 6845 CRT DATA REGISTER (03D5H / 03B5H)
- In conjunction with the index register, it is used to initialize the
- 6845 for proper mode of operation.
-
- INDEX DATA REGISTER VALUE (HEX)
- -------- -----------------------------------------
- 40X25 80X25 80X25 COLOR MONO
- COLOR COLOR MONO GRAPH GRAPH
- ----- ----- ----- ----- -----
- 0 38 71 61 38 35 HORIZONTAL TOTAL
- 1 28 50 50 28 2D HORIZONTAL DISPLAYED
- 2 2D 5A 52 2D 2E HORIZ SYNC POSITION
- 3 0A 0A 0F 0A 07 HORIZ SYNC WIDTH
- 4 1F 1F 19 7F 5B VERTICAL TOTAL
- 5 06 06 06 06 02 VERT TOTAL ADJUST
- 6 19 19 19 64 57 VERTICAL DISPLAYED
- 7 1C 1C 19 70 57 VERTICAL SYNC POSITION
- 8 02 02 02 02 02 INTERLACE MODE
- 9 07 07 0D 01 03 MAX SCAN LINE
- A 06 06 0B 06 0B CURSOR START SCAN LINE
- B 07 07 0C 07 0C CURSOR END SCAN LINE
- C 00 00 00 00 00 BUFFER START ADDRESS (H)
- D 00 00 00 00 00 BUFFER START ADDRESS (L)
- E 00 00 00 00 00 CURSOR POSITION (H)
- F 00 00 00 00 00 CURSOR POSITION (L)
-
- Changing the last 2 registers will allow various pages in color text
- mode to be utilized. The appropriate values are as follows:
-
- 80 column mode 40 column mode
- ---------------- ---------------
- REG C REG D REG C REG D
- ----- ----- ----- -----
- PAGE 0 00 00 PAGE 0 00 00
- PAGE 1 08 00 PAGE 1 04 00
- PAGE 2 10 00 PAGE 2 08 00
- PAGE 3 18 00 PAGE 3 0C 00
- PAGE 4 10 00
- PAGE 5 14 00
- PAGE 6 18 00
- PAGE 7 1C 00
-
- DISPLAY CONTROL REGISTER (03D8H / 03B8H)
- Allows the mode of the controller to be programmed.
-
- data bit 0 ---- 0 = 40X25 (color only) 1 = 80X25
- 1 ---- 0 = alphanumerics 1 = graphics
- 2 ---- 0 = color 1 = black/white
- 3 ---- 0 = disable video 1 = enable video
- 4 ---- 0 = 320X200 1 = 640X200
- 5 ---- 0 = disable blink 1 = enable blink
- 6 ----
- 7 ---- 0 = page 0 (mono graph) 1 = page 1
-
-
- COLOR MODE REGISTER (03D9H)
- Allows the default colors in graphics mode to be selected. This was
- described previously.
-
- DISPLAY STATUS REGISTER (03DAH / 03BAH)
- Allows software reading of VIDEO SYNC LINES and light pen status.
-
- data bit 0 = + HORIZONTAL SYNC
- 1 = + LIGHT PEN STROBE
- 2 = - LIGHT PEN SWITCH
- 3 = + VERTICAL SYNC
- 4 =
- 5 =
- 6 =
- 7 = - HORIZONTAL SYNC
-
- RESET LIGHT PEN LATCH (03DBH / 03BBH)
-
- PRESET LIGHT PEN LATCH (03DCH / 03BCH)
-
- EXTENDED COLOR MODE REGISTER (03DDH / 03BDH)
- Allows selection of 16-color mode and software switch for toggling mode
- switch on back of machine
-
- data bit 0 =
- 1 = SOFTWARE SWITCH (COLOR/MONO)
- 2 =
- 3 = ENABLE 16-COLOR MODE
- 4 =
- 5 =
- 6 =
- 7 =
-
- When bit 1 is set to on, this has the same result as physically
- switching the video mode switch on the rear of the machine. Resetting this
- bit again will undo the previous toggle. Note, if this is used the
- controller must be reinitialized for the new mode. Remember also the
- toggling the switch changes the I/O address for the controller.
-
-
- **********************
- * EXAMPLE PROGRAMS *
- **********************
-
- All of the programs will be written in BASIC simply for simplicity's
- sake. They can be converted to other languages very easily. Because of the
- slower execution speed of BASIC, some of the programs may take a while to
- clear the video memory and complete execution. Please be patient.
-
- EXAMPLE 1: SET CONTROLLER UP FOR MONOCHROME TEXT MODE
-
- 1 rem clear monochrome text page
- 2 CLS:KEY OFF
- 5 DEF SEG=&HB000
- 10 REM set display control register to the needed value
- 20 REM data bit 0 --- 1=80x25
- 30 REM 1 --- 0=ALPHANUMERICS
- 40 REM 2 --- 0
- 50 REM 3 --- 1=ENABLE VIDEO
- 60 REM 4 --- 0
- 70 REM 5 --- 1=ENABLE BLINK
- 80 REM 6 --- 0
- 90 REM 7 --- 0
- 100 OUT &H3B8,&H29
- 110 REM then initialize 6845 crt controller data registers
- 120 FOR INDEX=0 to &HF
- 125 OUT &H3B4,INDEX
- 130 READ BYTE
- 140 OUT &H3B5,BYTE
- 145 NEXT INDEX
- 150 REM display one character of each attribute
- 151 FOR ADDR=0 TO 22 STEP 2
- 152 READ CHAR$:CHAR=ASC(CHAR$)
- 153 READ ATTR
- 154 POKE ADDR,CHAR
- 155 POKE ADDR+1,ATTR
- 156 NEXT ADDR
- 160 GOTO 160
- 165 REM these are the 6845 register values for this mode
- 170 DATA &H61,&H50,&H52,&H0F,&H19,&H06,&H19
- 180 DATA &H19,&H02,&H0D,&H0B,&H0C,&H00,&H00,&H00,&H00
- 185 REM these are the characters and attributes to display
- 190 DATA A,&H00,B,&H01,C,&H07,D,&H09,E,&H0F,F,&H70
- 200 DATA G,&H78,H,&H81,I,&H87,J,&H89,K,&HF0,L,&HF3
-
-
- EXAMPLE 2: SET CONTROLLER UP FOR MONGRAPHICS MODE AND USE PAGE 1 OF MEMORY
-
- 1 REM clear second page of monochrome graphic memory
- 2 KEY OFF:DEF SEG=&HB800:FOR ADDR=0 TO &H7FFF:POKE ADDR,0:NEXT ADDR
- 10 REM set display control register to the needed value
- 20 REM DATA BIT 0 --- 0
- 30 REM 1 --- 1=GRAPHICS
- 40 REM 2 --- 0
- 50 REM 3 --- 1=ENABLE VIDEO
- 60 REM 4 --- 0
- 70 REM 5 --- 0
- 80 REM 6 --- 0
- 90 REM 7 --- 1=PAGE 1
- 100 OUT &H3B8,&H8A
- 110 REM then initialize 6845 crt controller data registers
- 120 FOR INDEX=0 TO &HF
- 125 OUT &H3B4,INDEX
- 130 READ BYTE
- 140 OUT &H3B5,BYTE
- 145 NEXT INDEX
- 150 REM draw scan lines 0,4,8 etc
- 151 STADR=0:DEF SEG=&HB800
- 152 FOR X=1 TO 45 STEP 2:ADDR=STADR
- 153 FOR T=0 TO X
- 154 POKE ADDR,&HFF
- 155 ADDR=ADDR+1
- 156 NEXT T
- 157 STADR=STADR+90:NEXT X
- 160 REM draw scan lines 1,5,9 etc
- 161 STADR=0:DEF SEG=&HBA00
- 162 FOR X=1 TO 45 STEP 2:ADDR=STADR
- 163 FOR T=0 TO X
- 164 POKE ADDR,&HFF
- 165 ADDR=ADDR+1
- 166 NEXT T
- 167 STADR=STADR+90:NEXT X
- 170 REM draw scan lines 2,6,10 etc
- 171 STADR=0:DEF SEG=&HBC00
- 172 FOR X=1 TO 45 STEP 2:ADDR=STADR
- 173 FOR T=0 TO X
- 174 POKE ADDR,&HFF
- 175 ADDR=ADDR+1
- 176 NEXT T
- 177 STADR=STADR+90:NEXT X
- 180 REM draw scan lines 3,7,11 etc
- 181 STADR=0:DEF SEG=&HBE00
- 182 FOR X=1 TO 45 STEP 2:ADDR=STADR
- 183 FOR T=0 TO X
- 184 POKE ADDR,&HFF
- 185 ADDR=ADDR+1
- 186 NEXT T
- 187 STADR=STADR+90:NEXT X
- 190 GOTO 190
- 200 DATA &H35,&H2D,&H2E,&H07,&H5B,&H02,&H57
- 210 DATA &H57,&H02,&H03,&H0B,&H0C,&H00,&H00,&H00,&H00
-
-
- EXAMPLE 3: SET CONTROLLER UP FOR COLOR 40 X 25 TEXT MODE
- 1 REM clear color text page
- 2 DEF SEG=&HB800:CLS:KEY OFF
- 10 REM set display control register to the needed value
- 20 REM DATA BIT 0 --- 0=40X25
- 30 REM 1 --- 0=ALPHANUMERICS
- 40 REM 2 --- 0
- 50 REM 3 --- 1=ENABLE VIDEO
- 60 REM 4 --- 0
- 70 REM 5 --- 1=ENABLE BLINK
- 80 REM 6 --- 0
- 90 REM 7 --- 0
- 100 OUT &H3D8,&H28
- 110 REM then initialize 6845 crt controller data registers
- 120 FOR INDEX=0 to &HF
- 125 OUT &H3D4,INDEX
- 130 READ BYTE
- 140 OUT &H3D5,BYTE
- 145 NEXT INDEX
- 150 REM display one character of each attribute
- 151 ATTR=0:FOR ADDR=0 TO 510 STEP 2
- 152 CHAR=ATTR
- 154 POKE ADDR,CHAR
- 155 POKE ADDR+1,ATTR
- 156 ATTR=ATTR+1:NEXT ADDR
- 160 GOTO 160
- 165 REM these are 6845 register values for this mode
- 170 DATA &H38,&H28,&H2D,&H0A,&H1F,&H06,&H19
- 180 DATA &H1C,&H02,&H07,&H06,&H07,&H00,&H00,&H00,&H00
-
-
- EXAMPLE 4: SET CONTROLLER UP FOR COLOR 80 X 25 TEXT MODE AND
- USE PAGE 2 OF MEMORY
-
- 1 REM clear color text display
- 2 DEF SEG=&HBA00:CLS:KEY OFF
- 10 REM set display control register to the needed value
- 20 REM DATA BIT 0 --- 1=80X25
- 30 REM 1 --- 0=ALPHANUMERICS
- 40 REM 2 --- 0
- 50 REM 3 --- 1=ENABLE VIDEO
- 60 REM 4 --- 0
- 70 REM 5 --- 1=ENABLE BLINK
- 80 REM 6 --- 0
- 90 REM 7 --- 0
- 100 OUT &H3D8,&H29
- 110 REM then initialize the 6845 crt controller data registers
- 120 FOR INDEX=0 TO &HF
- 125 OUT &H3D4,INDEX
- 130 READ BYTE
- 140 OUT &H3D5,BYTE
- 145 NEXT INDEX
- 150 REM display one character of each attribute
- 151 ATTR=0:FOR ADDR=0 TO 510 STEP 2
- 152 CHAR=ATTR
- 154 POKE ADDR,CHAR
- 155 POKE ADDR+1,ATTR
- 156 ATTR=ATTR+1:NEXT ADDR
- 160 GOTO 160
- 165 REM these are the 6845 register values for this mode
- 170 DATA &H71,&H50,&H5A,&H0A,&H1F,&H06,&H19
- 180 DATA &H1C,&H02,&H07,&H06,&H07,&H10,&H00,&H00,&H00
-
-
- EXAMPLE 5 : SET CONTROLLER UP FOR 320 X 200 COLOR GRAPHICS MODE
- USE COLOR SET 3 AND BACKGROUND OF BROWN
-
- 1 REM clear all of color video memory
- 2 KEY OFF
- 3 DEF SEG=&HB800:FOR ADDR=0 TO &H3FFF:POKE ADDR,0:NEXT ADDR
- 5 REM set color mode register
- 6 OUT &H3D9,&H26
- 10 REM set display control register to the needed value
- 20 REM DATA BIT 0 --- 0
- 30 REM 1 --- 1=GRAPHICS
- 40 REM 2 --- 0
- 50 REM 3 --- 1=ENABLE VIDEO
- 60 REM 4 --- 0=320 X 200
- 70 REM 5 --- 0
- 80 REM 6 --- 0
- 90 REM 7 --- 0
- 100 OUT &H3D8,&H0A
- 110 REM then initialize 6845 crt controller data registers
- 120 FOR INDEX=0 TO &HF
- 125 OUT &H3D4,INDEX
- 130 READ BYTE
- 140 OUT &H3D5,BYTE
- 145 NEXT INDEX
- 150 REM draw scan lines 0,2,4 etc
- 151 STADR=0
- 152 DEF SEG=&HB800:FOR X=1 TO 45 STEP 2:ADDR=STADR
- 153 FOR TO=0 TO X
- 154 POKE ADDR,&H0:POKE ADDR+1760,&H55:POKE ADDR+3520,&HAA:POKE ADDR+5280,&HFF
- 155 ADDR=ADDR+1
- 156 NEXT T
- 157 STADR=STADR+80:NEXT X
- 160 REM draw scan lines 1,3,5 etc
- 161 STADR=0
- 162 DEF SEG=&HBA00:FOR X=1 TO 45 STEP 2:ADDR=STADR
- 163 FOR TO=0 TO X
- 164 POKE ADDR,&H0:POKE ADDR+1760,&H55:POKE ADDR+3520,&HAA:POKE ADDR+5280,&HFF
- 165 ADDR=ADDR+1
- 166 NEXT T
- 167 STADR=STADR+80:NEXT X
- 190 GOTO 190
- 195 REM these are the 6845 register values for this mode
- 200 DATA &H38,&H28,&H2D,&H0A,&H7F,&H06,&H64
- 210 DATA &H70,&H02,&H01,&H06,&H07,&H00,&H00,&H00,&H00
-
-
- EXAMPLE 6: SET CONTROLLER UP FOR 640 X 200 2-COLOR GRPAHICS MODE
- AND USE FOREGROUND COLOR OF LIGHT MAGENTA
-
- 1 REM clear all of color video memory
- 2 KEY OFF
- 3 DEF SEG=&HB800:FOR ADDR=0 TO &H3FFF:POKE ADDR,0:NEXT ADDR
- 5 REM set color mode register
- 6 OUT &H3D9,&HD
- 10 REM set display control register to the needed value
- 20 REM DATA BIT 0 --- 0
- 30 REM 1 --- 1=GRAPHICS
- 40 REM 2 --- 1=BLACK/WHITE
- 50 REM 3 --- 1=ENABLE VIDEO
- 60 REM 4 --- 1=640 X 200
- 70 REM 5 --- 0
- 80 REM 6 --- 0
- 90 REM 7 --- 0
- 100 OUT &H3D8,&H1E
- 110 REM then initialize 6845 crt controller data registers
- 120 FOR INDEX=0 TO &HF
- 125 OUT &H3D4,INDEX
- 130 READ BYTE
- 140 OUT &H3D5,BYTE
- 145 NEXT INDEX
- 150 REM draw scan lines 0,2,4 etc
- 151 STADR=0
- 152 DEF SEG=&HB800:FOR X=1 TO 45 STEP 2:ADDR=STADR
- 153 FOR TO=0 TO X
- 154 POKE ADDR,&HFF
- 155 ADDR=ADDR+1
- 156 NEXT T
- 157 STADR=STADR+80:NEXT X
- 160 REM draw scan lines 1,3,5 etc
- 161 STADR=0
- 162 DEF SEG=&HBA00:FOR X=1 TO 45 STEP 2:ADDR=STADR
- 163 FOR T=0 TO X
- 164 POKE ADDR,&HFF
- 165 ADDR=ADDR+1
- 166 NEXT T
- 167 STADR=STADR+80:NEXT X
- 190 GOTO 190
- 195 REM these are the 6845 register values for this mode
- 200 DATA &H38,&H28,&H2D,&H0A,&H7F,&H06,&H64
- 210 DATA &H70,&H02,&H01,&H06,&H07,&H00,&H00,&H00,&H00
-
-
- EXAMPLE 7: SET CONTROLLER UP FOR 640 X 200 16-COLOR GRAPHICS MODE
- 1 REM clear all of video memory
- 2 KEY OFF
- 3 DEF SEG=&HB000:FOR ADDR=0 TO 65535!:POKE ADDR,0:NEXT ADDR
- 5 REM set extended mode register
- 6 OUT &H3DD,&H8
- 7 REM set border color to white
- 8 OUT &H3D9,0
- 10 REM SET DISPLAY CONTROL REGISTER TO THE NEEDED VALUE
- 20 REM DATA BIT 0 --- 0
- 30 REM 1 --- 1=GRAPHICS
- 40 REM 2 --- 0=COLOR
- 50 REM 3 --- 1=ENABLE VIDEO
- 60 REM 4 --- 1=640 X 200
- 70 REM 5 --- 0
- 80 REM 6 --- 0
- 90 REM 7 --- 0
- 100 OUT &H3D8,&H1A
- 110 REM then initialize 6845 crt controller data registers
- 120 FOR INDEX=0 TO &HF
- 125 OUT &H3D4,INDEX
- 130 READ BYTE
- 140 OUT &H3D5,BYTE
- 145 NEXT INDEX
-
- 147 STADR=0
- 150 REM if bit set in COLOUR then fill 6 scan line in appropriate bank
- 151 FOR COLOUR=0 TO 15
-
- 152 REM test BLUE bit
- 155 IF COLOUR AND 1 THEN 156 ELSE 160
- 156 DEF SEG=&HB400:FOR ADDR=STADR TO STADR+239:POKE ADDR,&HFF:
- POKE ADDR+&H2000,&HFF:NEXT ADDR
-
- 157 REM test GREEN bit
- 160 IF COLOUR AND 2 THEN 161 ELSE 165
- 161 DEF SEG=&HB800:FOR ADDR=STADR TO STADR+239:POKE ADDR,&HFF:
- POKE ADDR+&H2000,&HFF:NEXT ADDR
-
- 164 REM test RED bit
- 165 IF COLOUR AND 4 THEN 166 ELSE 170
- 166 DEF SEG=&HBC00:FOR ADDR=STADR TO STADR+239:POKE ADDR,&HFF:
- POKE ADDR+&H2000,&HFF:NEXT ADDR
-
- 167 REM test INTENSITY bit
- 170 IF COLOUR AND 8 THEN 171 ELSE 175
- 171 DEF SEG=&HB000:FOR ADDR=STADR TO STADR+239:POKE ADDR,&HFF:
- POKE ADDR+&H2000,&HFF:NEXT ADDR
-
- 175 STADR=STADR+240
- 185 NEXT COLOUR
- 190 GOTO 190
- 195 REM these are the 6845 register values for this mode
- 200 DATA &H38,&H28,&H2D,&H0A,&H7F,&H06,&H64
- 210 DATA &H70,&H02,&H01,&H06,&H07,&H00,&H00,&H00,&H00
-
- **** END OF DOCUMENT ****