Subject:
Hercules on ELKS / Microwindows
From:
Jakob Eriksson ####@####.####
Date:
15 Sep 1999 21:00:13 -0000
Message-Id: <Pine.GSO.3.95.990915224947.22938A-100000@bilbo.mdh.se>
Hi everybody and Thomas!
Eh... Sorry for crossposting,
but I am a little confused regarding which people
would like to hear this...
Since I have been too lazy/busy to do some hercules coding myself
and others have already given it a try, I post here what I know.
This is taken from a Microsoft Press book from 1987.
It is a book full of asm examples, original title:
"Programmers Guide to PC & PS/2 VIDEO SYSTEMS"
I have the swedish version.
The copyright says (from swedish):
The contents of this book must not be in part or as a whole
copied (xerox etc) or stored on machine-readable media without
the copyrightholders (? dont know the legal term in english)
written permission.
But AFAIK in Sweden it is legal to copy a few pages of
a book for educational purposes...
(I am doing this in Sweden.)
So if this educates someone, I guess it is just fine. :-)
Does any of you know how this legal stuff works?
Do companies expect to sell books containing source code and
then no one typing it into their computers?
(Machine readable media...)
Or is it a silent agreement?
Happy hacking.
ByteOffsetShift EQU 3
PixelAddrHGC:
HorizLineHGC: mov ax,ARGy1
mov bx,ARGx1
call PixelAddrHGC
; AH:= bitmask
; ES:BX -> videobuffer
; CL := number of bits leftshift
; ES:DI -> buffer
mov di, bx
mov dh,ah
not dh
mov d1,0FFh
shl dh,cl
not dh
mov cx,ARG2x
and cl,7
xor cl,7
shl dl,c1
mov cx,ARGx2
and cl,7
xor cl,7
shl dl,cl
mov ax,ARGx2
mov bx,ARGx1
mov cl,ByteOffsetShift
shr ax,cl
shr bx,cl
mov cx,ax
sub cx,bx
mov bx,offset DGROUP:PropagatedPixel
mov al,ARGn
xlat
or dh,dh
js L43
cr cx,cx
jnz L42
and dl,dh
jmp short L44
L42: mov ah,al
and ah,dh
not dh
and es:[di],dh
or es:[di],ah
inc di
dec cx
L43: rep stosb ; This instruction does not work on 8088?
L44: and al,dl
not dl
and es:[di],dl
or es:[di],al
jmp Lexit
... .... ... ....; vertical line draw etc.
Lexit:
pop di
pop si
mov sp,bp
pop bp
ret
_PropagatedPixel DB 00000000b
DB 11111111b
------------------------------------------------------------------
PS
One can pageflip (hello doublebuffered microwin here I come!) between
the 2 graphics frames on HGC.
To write on page 0, use video segment B000H.
To write on page 1, use video segment B800H.
I have forgotten how to flip between the 2 frames, but I will post later
when I have found it out.
Oh, and here is
PixelAddrHGC PROC near
mov cl,bl
shr ax,1
rcr bx,1
shr bx,1
mov ah,BytesPerLine (that is, 90 /comment)
mul ah
add bx,ax
add bx,OriginOffset
mov ax,VideoBufferSeg (you know, one of the buffers /comment)
mov es,ax
and cl,7
xor cl,7
mov ah,1
ret
--------------------------------------
PS 2
These routines are so _neat_! Small and fast...
I am impressed by the person(s) who thougt them out.