home *** CD-ROM | disk | FTP | other *** search
- title setpx256.asm
- comment !
-
-
- (C)opyright 1990 Headland Technology, Inc.
-
- All Rights Reserved
-
-
- Function: Set Pixel in 256 color super-vga modes
-
- Supports:
-
- adapter resolution Video 7 mode no RAM needed
- ---------------------- ---------- --------------- ----------
- 1024i, VRAM, Fastwrite 640x400x256 66h 256K
- 1024i, VRAM, Fastwrite 640x480x256 67h 512K
- VRAM only 720x540x256 68h 512K
- VRAM only 800x600x256 69h 512K
-
-
- Prototype: void setpx256( int x, int y, int color,
- int *bank, int horiz_bytes);
-
- x - horizontal pixel coordinate
- y - vertical pixel coordinate
- color - color to set pixel
- *bank - current bank location
- horiz_bytes - number of horizontal pixels
-
-
- Caller: Microsoft Quick C 2.0 or Microsoft C 5.1 Medium Model
- compiled with MASM 5.1
-
- Returns: void
-
- !
-
- .model medium, c
-
- .code
- include gfxlib.inc
- public setpx256
- setpx256 proc far uses di, x:word, y:word, color:word, active_bank:word, horiz_pixels:word
-
- mov bl, byte ptr [color]
- mov cx, [x]
- mov dx, [y]
-
- mov ax, GRAPHICS_SEG
- mov es, ax
- mov ax, [horiz_pixels] ; bytes per scan line
- mul dx ; ds:ax beginning of scan line
- mov di, ax
- add di, cx ; es:di byte
- adc dx, 0 ; dx bank
- mov cl, bl ; cl color
- ; set bank select
- cmp byte ptr [active_bank], dl
- je done_bank_select
- mov byte ptr [active_bank], dl
- mov bl, dl
- and bl, 1 ; bl extended page select
- mov ah, dl
- and ah, 2
- shl ah, 1
- shl ah, 1
- shl ah, 1
- shl ah, 1 ; ah page select bit
- and dl, 00ch
- mov bh, dl
- shr dl, 1
- shr dl, 1
- or bh, dl ; bh 256K bank select
- mov dx, MISC_READ
- in al, dx ; get Misc. Output Register
- and al, not 20h ; clear page select bit
- or al, ah ; set page select bit (maybe)
- mov dx, MISC_WRITE ; write Misc. Output Register
- out dx, al
- mov dx, SEQUENCER ; Sequencer
- mov al, X_PAGE_SELECT ; extended page select register
- mov ah, bl ; extended page select value
- out dx, ax
- mov al, X_BANK_SELECT ; 256K bank select
- out dx, al
- inc dx ; point to data
- in al, dx
- and al, 0f0h ; clear out bank selects
- or al, bh ; set clear bank selects (maybe)
- out dx, al
- done_bank_select:
- mov es:[di], cl ; write to memory
- ret
- setpx256 endp
- end
-
- comment !
- gfxlib.inc
-
- (C)opyright 1990 Headland Technology, Inc.
-
- This code may be used freely as long as it contains this copyright notice.
-
-
- !
-
-
- ;************************************************************************
- ;
- ; Video Buffer Segments
- ;
-
- GRAPHICS_SEG equ 0A000h
- COLOR_TXT_SEG equ 0B800h
- MONO_TXT_SEG equ 0B000h
-
- ;*************************************************************************
- ;
- ; EGA/VGA Data BIOS Area
- ;
-
- BIOS_MODE equ 0449h ; Current video mode number
- BIOS_COLUMNS equ 044Ah ; Current number of video columns
- BIOS_PAGE_SIZE equ 044Ch ; Current size of video buffer
- BIOS_PAGE_OFF equ 044Eh ; Offset of current video page
- BIOS_CURS_POS equ 0450h ; Col, row position
- BIOS_CURS_MODE equ 0460h ; Current cursor mode setting
- BIOS_CURR_PAGE equ 0462h ; Current page being displayed
- BIOS_6845 equ 0463h ; Base I/O address for 6845/CRTC
- BIOS_CRT_SET equ 0465h ; Simulated value of CGA 3x8
- BIOS_CRT_PAL equ 0466h ; Simulated value of CGA 3x9
- BIOS_ROWS equ 0484h ; Number of character rows - 1
- BIOS_HEIGHT equ 0485h ; Bytes per character
- BIOS_EQUIP_INFO equ 0487h ; Miscellaneous equipment information
- BIOS_SWITCHES equ 0488h ; Switch settings
- BIOS_FLAGS equ 0489h ; More VGA info
- BIOS_DCC equ 048A ; Display combination code
-
-
-
-
- ;************************************************************************
- ;
- ; Miscellaneous registers
- ;
-
- MISC_WRITE equ 3C2h ; Miscellaneous Output write
- MISC_READ equ 3CCh ; Miscellaneous Output read
- STATUS equ 3DAh ; Status register
-
- ;************************************************************************
- ;
- ; Sequencer registers
- ;
-
- SEQUENCER equ 3C4h ; Sequencer index
- RESET equ 0 ; Reset
- CLOCK equ 1 ; Clocking mode
- MAPMASK equ 2 ; Map Mask
- CHARMAP equ 3 ; Character Map Select
- MODE equ 4 ; Memory Mode
-
-
- ;***********************************************************************
- ;
- ; CRT Controller registers
- ;
-
- CRTC equ 3D4h ; CRTC index
- OVFL equ 07h ; Overflow
- PRS equ 08h ; Preset Row scan
- HI_STRT equ 0Ch ; Start Address High
- LO_STRT equ 0Dh ; Start Address Low
- HI_CPOS equ 0Eh ; Cursor Position High
- LO_CPOS equ 0Fh ; Cursor Position Low
- VRE equ 11h ; Vertical Retrace End
- OFFST equ 13h ; Offset
- LCR equ 14h ; Line Compare
-
-
- ;***********************************************************************
- ;
- ; Graphics Controller registers
- ;
-
- GRAPHICS equ 03CEh ; Graphics Controller index
- SET_RES equ 0 ; Set/Reset
- EN_SET equ 1 ; Enable Set/Reset
- CCMP equ 2 ; Color Compare
- ROTATE equ 3 ; Data Rotate
- READMAP equ 4 ; Read Map Select
- GMODE equ 5 ; Graphics Mode
- GMISC equ 6 ; Miscellaneous
- CDONTC equ 7 ; Color Don't Care
- BITMASK equ 8 ; Bit Mask
-
-
- ;***********************************************************************
- ;
- ; Attribute Controller registers
- ;
-
- ATTR equ 3C0h ; Attribute Controller index
- PALETTE equ 0 ; 0-15 Palette registers
- AMODE equ 10h ; Attribute Mode Control
- OVERSCAN equ 11h ; Oversacn Color Register
- PLANE equ 12h ; Color Plane Enable
- PAN equ 13h ; Horizontal Panning
- COLOR_SEL equ 14h ; Color Select
-
-
- ;*************************************************************************
- ;
- ; Video 7 Extension registers
- ;
-
- X_BANK_SELECT equ 0F6h ; Extended Bank Select
- X_PAGE_SELECT equ 0F9h ; Extended Page Select