TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: DAVE NAVARRO
date: 1995-10-21 18:57:00
subject: Mode 13 Graphics for ASIC

' Misc mode 13h code
' Public Domain by Dave Navarro, Jr.
'
' Notes:  I'm just testing some ideas and theories and thought I'd share
'         my code for anyone interested in it.
DEFINT A-Z      'required!
DIM Image?(0:32000)
vMode 1         'set mode 13
vCLS 15
SLEEP
FOR x = 0 TO 319
  FOR y = 0 TO 199
    vPSET x, y, (x * y) AND 255     'plot pixel on the screen
  NEXT y
NEXT x
vGET 20, 20, 100, 100, Image?(0)
vGET 50, 150, 200, 150, Image?(6500)
SLEEP
vCLS 0
SLEEP
vPUT 20,  20, Image?(0)
vPUT 50, 150, Image?(6500)
SLEEP
vMode 0         'set text mode
END
SUB vMode(BYVAL bool AS INTEGER) PUBLIC
  IF bool THEN             'if non-zero
    bool = &H13            ' set mode 13h
  ELSE
    bool = &H03            'otherwise give us text mode
  END IF
  ! push DS                ; save DS for PowerBASIC
  ! mov  AX, bool          ; put the mode value in AX
  ! int  &H10              ; call BIOS
  ! pop  DS                ; restore DS
END SUB
SUB vCLS(BYVAL vcolor AS BYTE) PUBLIC
  ! push DS                ; save DS
  ! mov  AX, &HA000        ; VGA buffer at A000:0000
  ! mov  ES, AX            ; put segment in ES
  ! xor  DI, DI            ; point DI to start of buffer
  ! mov  CX, 32000         ; buffer is 64k, use 32k of words, they're faster
  ! mov  AL, vcolor        ; put color in AX
  ! mov  AH, AL            ;  and AH
  ! rep  stosw             ; fill the whole screen
  ! pop  DS                ; restore DS
END SUB
SUB vPSET(BYVAL x, BYVAL y, BYVAL vcolor) PUBLIC
  ! push DS                ; save DS for PowerBASIC
  ! mov  AX, &HA000        ; VGA buffer at A000:0000
  ! mov  DS, AX            ; put segment in DS
  ! mov  AX, y             ; put Y in AX
  ! mov  BX, 320           ; there are 320 pixels per line
  ! mul  BX                ; AX = AX * BX
  ! add  AX, x             ; add X location
  ! mov  SI, AX            ; point SI at pixel
  ! mov  AX, vcolor        ; put color in AX
  ! mov  DS:[SI], AL       ; put pixel on the screen
  ! pop  DS                ; restore DS
END SUB
FUNCTION vPGET(BYVAL x, BYVAL y) PUBLIC
  ! push DS                ; save DS for PowerBASIC
(Continued to next message)
---
 * QMPro 1.53 * WOMEN: Cant live with 'em and you cant live with 'em
--- GEcho 1.20/Pro
---------------
* Origin: Toast House * (314) 994-0312 * (1:100/560)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.