Category : C Source Code
Archive   : EGAGRAX.ZIP
Filename : EGAGRA.ASM
_DATA segment word public 'DATA'
first8 dw 0
first14 dw 0
first16 dw 0
drawseg dw 0A000h
maxseg dw 28000
maxline dw 350
_DATA ends
CONST segment word public 'CONST'
ate dw 8
fourt dw 14
sixt dw 16
eighty dw 80
btab db 80h,40h,20h,10h,8h,4h,2h,1h
left db 255,127,63,31,15,7,3,1
right db 128,192,224,240,248,252,254,255
CONST ends
_BSS segment word public 'BSS'
es8 dw ?
bp8 dw ?
es14 dw ?
bp14 dw ?
es16 dw ?
bp16 dw ?
leftbit db ?
rightbit db ?
lefttop dw ?
leftbot dw ?
righttop dw ?
rightbot dw ?
ysave dw ?
leftx dw ?
rightx dw ?
xx0 dw ?
yy0 dw ?
xx1 dw ?
yy1 dw ?
xc10 dw ?
xc20 dw ?
xc11 dw ?
xc21 dw ?
lowyb dw ?
del_y dw ?
del_x dw ?
_BSS ends
DGROUP GROUP CONST, _BSS, _DATA
assume ds: DGROUP, ss: DGROUP, es: DGROUP
cseg _egagraf
;The code in this program has been optimized for speed, not readibility.
;As much as possible is put into registers. Replication of large blocks
;of code has been used in some places to avoid calling subroutines.
pBegin _symbol
; symbol(ix,iy,height,icol,&isym) plots a single 8xheight character
; matrix pointed to by isym at ix, iy in color icol.
; ix, iy and icol are integers
push bp
mov bp,sp
push di
push si
ifdef NEARDATA
mov si, word ptr [bp+argbase+12] ;pick up address of table
mov bx,ds ;containing symbol to plot
mov es,bx
endif
ifdef FARDATA
les si,[bp+argbase+12]
endif
mov bx,word ptr [bp+argbase+8] ;height
mov ax,word ptr [bp+argbase+4] ;this is x
mov dx,ax ;break x into byte # and bit in byte
and dx,7
mov cl,3
sar ax,cl
mov [bp+argbase+8],ax ;byte #
mov [bp+argbase+4],dx ;leftmost bit used
mov dx,drawseg ;segment of display buffer
push ds
mov ax,es
mov es,dx
mov ds,ax
jmp commonl
pEnd _symbol
pBegin _slettr
; slettr(ix,iy,ichr,icol) plots a single 8-high IBM character ichr at
; x,y in color icol. all are integers
push bp
mov bp,sp
push di
push si
cmp first8,0 ;get address of bios table of characters
jne sec8
inc first8 ;done only first time this routine is called
mov ah, 011h
mov al, 030h
mov bh, 03
push bp ;(gasp)Bios call destroys BP
int 010h
mov ax,es
mov es8,ax
mov bp8,bp
pop bp
sec8:
xor ax,ax
mov al,byte ptr [bp+argbase+8] ;this is the character
;look up location of ascii characters
mov cl,3
shl ax,cl ;in bios
add ax,bp8
mov si,ax
mov ax,word ptr [bp+argbase+4] ;this is x
mov dx,ax
and dx,7 ;break into bit and byte
mov cl,3
sar ax,cl
mov [bp+argbase+8],ax ;byte #
mov [bp+argbase+4],dx ;bit in byte
mov ax,drawseg ;segment of display buffer
mov es,ax
push ds
mov ax,es8 ;segment for bios reference
mov ds,ax ;used to
mov bx,8 ;find character
jmp commonl
pEnd _slettr
pBegin _llettr
; llettr(ix,iy,ichr,icol) plots a single IBM 14-high character ichr at
; x,y in color icol. all are integers
push bp
mov bp,sp
push di
push si
cmp first14,0 ;works just like slettr : done again for speed
jne sec14
inc first14
mov ah, 011h
mov al, 030h
mov bh, 02
push bp
int 010h
mov ax,es
mov es14,ax
mov bp14,bp
pop bp
sec14:
xor ax,ax
mov al,byte ptr [bp+argbase+8]
mul fourt
add ax,bp14
mov si,ax
mov ax,word ptr [bp+argbase+4]
mov dx,ax
and dx,7
mov cl,3
sar ax,cl
mov [bp+argbase+8],ax
mov [bp+argbase+4],dx
mov ax,drawseg
mov es,ax
push ds
mov ax,es14
mov ds,ax
mov bx,14
jmp commonl
pEnd _llettr
pBegin _xlettr
; llettr(ix,iy,ichr,icol) plots a single IBM 16-high character ichr at
; x,y in color icol. all are integers
push bp
mov bp,sp
push di
push si
cmp first16,0 ;works just like slettr : done again for speed
jne sec16
inc first16
mov ah, 011h
mov al, 030h
mov bh, 06
push bp
int 010h
mov ax,es
mov es16,ax
mov bp16,bp
pop bp
sec16:
xor ax,ax
mov al,byte ptr [bp+argbase+8]
mul sixt
add ax,bp16
mov si,ax
mov ax,word ptr [bp+argbase+4]
mov dx,ax
and dx,7
mov cl,3
sar ax,cl
mov [bp+argbase+8],ax
mov [bp+argbase+4],dx
mov ax,drawseg
mov es,ax
push ds
mov ax,es16
mov ds,ax
mov bx,16
commonl:
;symbol, slettr, and llettr the same after this
;compute location of byte to change
mov ax,word ptr [bp+argbase+6] ;this is y
mov dx,ax
shl dx,1
shl dx,1
add ax,dx
mov cl,4
shl ax,cl
add ax,[bp+argbase+8] ;this is horiz byte number
mov di,ax
mov dx,3ceh ;change SET/RESET register
mov al,00h ;to contain the color to write.
out dx,al
mov dx,3cfh
mov ax,word ptr [bp+argbase+10] ; <-- color
out dx,al
mov dx,3ceh ;point controller to bit mask register
mov al,08h
out dx,al
mov dx,3cfh
cmp word ptr [bp+argbase+8],0ffffh ;special case:partially off
;left edge of screen
je loop2m1
cmp word ptr [bp+argbase+8],79 ;Partially off right edge
je loop2p1
cmp word ptr [bp+argbase+8],80 ;totally off screen horizontally
jae commf
loop2:
xor ax,ax
mov ah,ds:[si+0] ;get pattern of current row
mov cx,[bp+argbase+4]
shr ax,cl ;shr to get two bytes
out dx,al
inc byte ptr es:[di+1] ;actual screen write
mov al,ah
out dx,al
inc byte ptr es:[di] ;write second byte
add di,80 ;next row
inc si
dec bx
jg loop2
jmp commf
loop2m1:
xor ax,ax ;leftmost byte is off screen
mov ah,ds:[si+0] ;get current row pattern
mov cx,[bp+argbase+4]
shr ax,cl ;shr to get two bytes
out dx,al
inc byte ptr es:[di+1] ;actual screen write
add di,80
inc si
dec bx
jg loop2m1
jmp commf
loop2p1:
xor ax,ax ;rightmost byte is off screen
mov ah,ds:[si+0] ;get current row pattern
mov cx,[bp+argbase+4]
shr ax,cl ;shr to get two bytes
mov al,ah
out dx,al
inc byte ptr es:[di]
add di,80
inc si
dec bx
jg loop2p1
commf:
pop ds
pop si
pop di
pop bp
ret
pEnd _xlettr
pBegin _max_lin
mov ax,maxline
ret
pEnd _max_lin
; setmod.asm routine to be called from c to set mode n using
; call setmod(n) : n=3 set to cursor mode, n=16 set to color graphics mode
; n = 15 for bw graphics mode, 18 for VGA 480x640 color mode
pBegin _setmod
push bp
mov bp,sp
mov ax, word ptr [bp+argbase+4]
mov maxseg,28000
mov maxline,350
cmp ax,18
jnz setm1
mov maxseg,38400
mov maxline,480
setm1:
int 10H
pop bp
ret
pEnd _setmod
pBegin _zsetup
push dx
push ax
mov dx,3c4h ;allow writing to all planes
mov al,02h ;can be changed by setmask
out dx,al
mov dx,3c5h
mov al,0fh
out dx,al
mov dx,3ceh ;change ENABLE SET/RESET register
mov al,01h ;to use SET/RESET feature
out dx,al
mov dx,3cfh
mov al,0fh
out dx,al
pop ax
pop dx
ret
pEnd _zsetup
; ZLINE : SUBROUTINE TO DRAW LINE ON EGA BOARD
;this version has microsoft c calling convention
; zline(ix0,iy0,ix1,iy1,icolor)
pBegin _zline
push bp
mov bp,sp
mov cx,word ptr [bp+argbase+6] ;cx has first y
cmp cx,word ptr [bp+argbase+10] ;compare with last y
jne nhoriz
jmp far ptr __horiz_
nhoriz:
sub sp,6
push di
push si
mov dx,3ceh ;set up color register
mov al,00h
out dx,al
mov dx,3cfh
mov ax,word ptr [bp+argbase+12] ;this is color
out dx,al
mov dx,word ptr [bp+argbase+10] ;dx has last y
mov ax,word ptr [bp+argbase+8]
mov di,ax ;di has last x
mov bx,word ptr [bp+argbase+4] ;bx has first x
mov ax,di
sub ax,bx
jge store_x
mov bx,di
mov di,dx ;make sure line goes from lower to higher x
mov dx,cx
mov cx,di
neg ax
store_x:
mov word ptr[bp+argbase+6],ax
mov word ptr[bp+argbase+4],bx ;store new first point
mov word ptr[bp+argbase+8],cx
sub dx,cx
mov word ptr [bp-2],80 ;put increment for pointer in screen buffer
jge store_y ;into temporary
neg word ptr [bp-2]
neg dx
store_y:
mov word ptr[bp+argbase+10],dx
;initialize values
mov dx,3ceh ;prepare register for changing pixel
mov al,08h
out dx,al
mov ax,drawseg ;load start of screen buffer in es
mov es,ax
;calculate address in screen buffer of first point
mov ax,word ptr[bp+argbase+4]
mov dx,ax
and dx,7
mov cl,3
sar ax,cl
mov si,ax ;load initial x byte offset into si
lea bx,btab
add bx,dx ;[bx] has a 1 in bit of first point
mov ax,word ptr[bp+argbase+8] ;mul by first y
mov dx,ax
shl dx,1
shl dx,1
add ax,dx
mov cl,4
shl ax,cl
mov dx,ax
mov al,[bx] ;al has pointer in byte for exact bits
mov bx,dx ;bx has address in screen buffer
mov cx,0 ;cx is point counter
;figure out if slope is greater or less than 1
mov dx,word ptr[bp+argbase+6]
cmp dx,word ptr[bp+argbase+10]
jl csteep
call slant
jmp finish
csteep:
call steep
finish:
pop si
pop di
mov sp,bp
pop bp
ret
pEnd _zline
slant proc near
;slope<1
cmp si,80 ;test for line off screen to right
jge quit1
mov di,word ptr[bp+argbase+10]
mov dx,word ptr[bp+argbase+6]
mov word ptr [bp-4],dx
shr dx,1
mov word ptr [bp-6],dx
mov dx,3cfh
newdot:
cmp si,0 ;test for line off screen to left
jl q1
out dx,al ;output bit in byte to mask register
inc byte ptr es:[bx][si] ;insert byte in buffer ... note that
;the inc instruction doesn't actually do the
;work -- it;s done by the EGA's wierd hardware
q1: ror al,1 ;rotate bit in byte
jnc nc1 ;test for shifting to next byte in screen
inc si ;memory
cmp si,80
je quit1
nc1: add cx,di ;this is the actual line algorithm
cmp cx,word ptr [bp-6] ;standard algorithm registerized for speed
jle dcount
sub cx,word ptr[bp+argbase+6]
add bx,word ptr [bp-2]
dcount: dec word ptr [bp-4]
jge newdot
quit1: ret
slant endp
steep proc near
;slope>1 see comments in "slant"
cmp si,80
jge quit2
mov di,word ptr[bp+argbase+6]
or di,di
je vertical
mov dx,word ptr[bp+argbase+10]
mov word ptr[bp-4],dx
shr dx,1
mov word ptr[bp-6],dx
mov dx,3cfh
out dx,al
newdot2:
cmp si,0
jl c3
inc byte ptr es:[bx][si]
c3: add bx,word ptr [bp-2]
add cx,di
cmp cx,word ptr[bp-6]
jle dcount2
sub cx,word ptr[bp+argbase+10]
ror al,1
out dx,al
jnc dcount2
inc si
cmp si,80
je quit2
dcount2:
dec word ptr[bp-4]
jge newdot2
quit2: ret
vertical:
add bx,si
cmp si,0 ;special case for vertical lines
jl quit2 ;which doesn't need fancy algorithm
mov cx,word ptr[bp+argbase+10]
mov dx,3cfh
out dx,al
loopy2:
inc byte ptr es:[bx]
c3v:
add bx,word ptr [bp-2]
dec cx
jge loopy2
ret
steep endp
; setpal.asm routine to be called from c to set palete m to n
; setpal(m,n) m=0 to 15, n 0 to 63
pBegin _setpal
push bp
mov bp, sp
push di
push si
; Get arguments into registers
mov bl, byte ptr [bp+argbase+4]
mov bh, byte ptr [bp+argbase+6]
mov al,0
mov ah,16
; Call BIOS
int 10H
pop si
pop di
pop bp
ret
pEnd _setpal
;char colorlist[17]
;setpals(colorlist) causes all 16 palete registers and the border color
;colorlist[16] to be set in one call. This uses the BIOS.
;pBegin _setpals
; push bp
; mov bp, sp
;ifdef NEARDATA
; mov dx, word ptr [bp+argbase+4]
; mov ax,ds
; mov es,ax
;endif
;ifdef FARDATA
; les dx,[bp+argbase+4]
;endif
; mov al,2
; mov ah,16;
; Call BIOS
; int 10H
; pop bp
; ret
;pEnd _setpals
;char colorlist[17]
;setpals(colorlist) causes all 16 palete registers and the border color
;colorlist[16] to be set in one call. This is MUCH faster than the one
;using the IBM BIOS
pBegin _setpals
push bp
mov bp, sp
push si
ifdef NEARDATA
mov bx, word ptr [bp+argbase+4]
mov ax,ds
mov es,ax
endif
ifdef FARDATA
les bx,[bp+argbase+4]
endif
mov dx,03dah
spnvr: in al,dx ;wait for NOT vertical retrace
test al,8
jnz spnvr
spvr: in al,dx ;wait for vertical retrace
test al,8
jz spvr
xor si,si
mov dx,03c0h
sp2loop:
mov ax,si
out dx,al
mov al,byte ptr es:[bx][si]
out dx,al
inc si
cmp si,16
jne sp2loop
mov al,011h
out dx,al
mov al,byte ptr es:[bx][si]
out dx,al
mov al,020h
out dx,al
pop si
pop bp
ret
pEnd _setpals
;this routine resets the system to use ordinary bios or dos screen writes
;it has no parameters and may be called from any language
pBegin _curmod
push dx
push ax
mov dx,3ceh ; change ENABLE SET/RESET register
mov al,01h ; to disable SET/RESET feature
out dx,al
mov dx,3cfh
mov al,00h
out dx,al
mov dx,3ceh ;set bit mask to enable all
mov al,08h ;8 bits in a byte
out dx,al
mov dx,3cfh
mov al,0ffh
out dx,al
pop ax
pop dx
ret
pEnd _curmod
; zpoint.asm plot point at xt,yt in color zpcol
pBegin _zpoint
push bp
mov bp,sp
mov dx,3ceh ; change SET/RESET register
mov al,00h ; to contain the color to write.
out dx,al
mov dx,3cfh
mov al,byte ptr [bp+argbase+8] ; <-- THIS IS THE COLOR.
out dx,al
mov ax,drawseg ; segment of display buffer
mov es,ax
mov cx,word ptr [bp+argbase+4] ; this is x value
mov bx,cx
and bx,7
sar cx,1 ;split x into bit and byte
sar cx,1
sar cx,1
or cx,cx
jl ptquit
cmp cx,79
jg ptquit
mov dx,3ceh
mov al,08h
out dx,al ;set bit mask register
mov dx,3cfh
mov al,byte ptr btab[bx]
out dx,al
mov bx,cx
mov ax,word ptr [bp+argbase+6] ;this is y value
mov dx,ax
shl dx,1
shl dx,1
add ax,dx
mov cl,4
shl ax,cl
add bx,ax
inc byte ptr es:[bx]
ptquit: pop bp
ret
pEnd _zpoint
pBegin _setmask
; set mask register setmask(mask)
push bp
mov bp,sp
mov cx,word ptr [bp+argbase+4]
mov dx,03c4h
mov al,2
out dx,al
mov dx,03c5h
mov al,cl
out dx,al
pop bp
ret
pEnd _setmask
;_e_start start up ellipse plotter
; e_start(xleft,xright,y,color)
pBegin _e_start
push bp
mov bp,sp
mov dx,3ceh ; change SET/RESET register
mov al,00h ; to contain the color to write.
out dx,al
mov dx,3cfh
mov al,byte ptr [bp+argbase+10] ; <-- THIS IS THE COLOR.
out dx,al
mov ax,drawseg ; segment of display buffer
mov es,ax
mov cx,word ptr [bp+argbase+4] ; this is left x value
mov bx,cx
and bx,7
sar cx,1
sar cx,1
sar cx,1
mov dx,3ceh
mov al,08h
out dx,al
mov dx,3cfh
mov al,byte ptr btab[bx]
mov leftbit,al
out dx,al
mov ax,word PTR [bp+argbase+8]
mov bx,ax
shl ax,1
shl ax,1
add bx,ax
shl bx,1
shl bx,1
shl bx,1
shl bx,1
mov ysave,bx
mov leftx,cx
add bx,cx
mov leftbot,bx
mov lefttop,bx
cmp cx,80
jae s1
inc byte ptr es:[bx]
s1: mov cx,word ptr [bp+argbase+6] ; this is right x value
mov bx,cx
and bx,7
sar cx,1
sar cx,1
sar cx,1
mov dx,3cfh
mov al,byte ptr btab[bx]
mov rightbit,al
out dx,al
mov bx,ysave
mov rightx,cx
add bx,cx
mov rightbot,bx
mov righttop,bx
cmp cx,80
jae s2
inc byte ptr es:[bx]
s2: pop bp
ret
pEnd _e_start
pBegin _e_xd
mov ax,drawseg
mov es,ax
rol rightbit,1
mov al,rightbit
jae l1
dec rightx
dec rightbot
dec righttop
l1: mov dx,3cfh
out dx,al
cmp rightx,80
jae s3
mov bx,righttop
inc byte ptr es:[bx]
mov bx,rightbot
inc byte ptr es:[bx]
s3:
ror leftbit,1
mov al,leftbit
jae l2
inc leftx
inc lefttop
inc leftbot
l2: out dx,al
cmp leftx,80
jae s4
mov bx,lefttop
inc byte ptr es:[bx]
mov bx,leftbot
inc byte ptr es:[bx]
s4: ret
pEnd _e_xd
pBegin _e_xdyu
mov ax,drawseg
mov es,ax
rol rightbit,1
mov al,rightbit
jae l3
dec rightx
dec rightbot
dec righttop
l3: mov dx,3cfh
out dx,al
mov cx,80
add righttop,cx
sub rightbot,cx
cmp rightx,cx
jae s5
mov bx,righttop
inc byte ptr es:[bx]
mov bx,rightbot
inc byte ptr es:[bx]
s5:
ror leftbit,1
mov al,leftbit
jae l4
inc leftx
inc lefttop
inc leftbot
l4: out dx,al
add lefttop,cx
sub leftbot,cx
cmp leftx,cx
jae s6
mov bx,lefttop
inc byte ptr es:[bx]
mov bx,leftbot
inc byte ptr es:[bx]
s6: ret
pEnd _e_xdyu
pBegin _e_yu
mov ax,drawseg
mov es,ax
mov al,leftbit
mov dx,3cfh
out dx,al
mov cx,80
add lefttop,cx
sub leftbot,cx
cmp leftx,cx
jae s7
mov bx,lefttop
inc byte ptr es:[bx]
mov bx,leftbot
inc byte ptr es:[bx]
s7: mov al,rightbit
out dx,al
add righttop,cx
sub rightbot,cx
cmp rightx,cx
jae s8
mov bx,righttop
inc byte ptr es:[bx]
mov bx,rightbot
inc byte ptr es:[bx]
s8: ret
pEnd _e_yu
pBegin _rectfill
; rectfill(ix0,iy0,ix1,iy1,icol) plots a rectangle in
; color icol. all are integers
push bp
mov bp,sp
mov bx,word PTR [bp+argbase+10] ;bx has y1
cmp bx,word ptr [bp+argbase+6] ;compare with y0
jne notflat
jmp far ptr __horiz_
notflat:
push di
push si
nop
mov dx,3ceh ; change SET/RESET register
mov al,00h ; to contain the color to write.
out dx,al
mov dx,3cfh
mov al,byte ptr [bp+argbase+12] ; <-- THIS IS THE COLOR.
out dx,al
mov cx,word PTR [bp+argbase+4] ;cx has x0
mov dx,word PTR [bp+argbase+6] ;dx has y0
mov ax,word PTR [bp+argbase+8] ;ax has x1
cmp ax,cx ;make first point leftmost one
jge test2
mov si,ax
mov ax,cx
mov cx,si
test2: or ax,ax
jge test3
jmp rfinish
test3: cmp cx,640 ;clip to screen limits
jl test4
jmp rfinish
test4: cmp cx,0
jge test5
sub cx,cx
test5: cmp ax,640
jl test6
mov ax,639
test6:
cmp bx,dx
jge test7
mov si,bx
mov bx,dx
mov dx,si
test7: or bx,bx
jge test8
jmp rfinish
test8: cmp dx,maxline
jl test9
jmp rfinish
test9: cmp dx,0
jge testa
sub dx,dx
testa: cmp bx,maxline
jl testb
mov bx,maxline
dec bx
testb:
mov xx0,cx
mov yy0,dx
mov xx1,ax
mov yy1,bx
mov ax,cx ;calculate bte position in graphics
mov dx,ax ;memory (x value)
and dx,7
mov cl,3
sar ax,cl
mov xc10,ax ;byte value for leftmost point
mov xc20,dx ;offset in byte
mov di,ax
mov ax,xx1
mov dx,ax
and dx,7
mov cl,3
sar ax,cl
mov xc11,ax ;byte value for rightmost byte
mov xc21,dx ;offset in byte
sub ax,di
mov del_x,ax
mov ax,drawseg
mov es,ax
mov dx,3ceh
mov al,08h
out dx,al
mov ax,yy0 ; compute location of first byte to change
mov dx,ax ; (y value)
shl dx,1
shl dx,1
add ax,dx ; mul by 80
mov cl,4
shl ax,cl
add ax,xc10
mov lowyb,ax
mov ax,yy1
sub ax,yy0
inc ax
mov del_y,ax ;number of y lines
mov bx,xc20
mov dl,left[bx]
or del_x,0
jnz leftcol ;if only one byte column, may need to mask
mov bx,xc21 ;right hand bits
and dl,right[bx]
leftcol:
mov al,dl
mov dx,3cfh ;draw the entire left column of bytes
out dx,al ;set bit mask register
mov bx,lowyb
mov cx,del_y
mov ax,80
loopd: inc byte ptr es:[bx]
add bx,ax
loop loopd ;end of left column drawer
cmp del_x,1
jl rfinish
jz lastcol
mov al,255
out dx,al ;set mask register to all eight bits
mov bx,del_y
mov ax,lowyb
inc ax
mov si,del_x
dec si
loope1: mov cx,si ;draw the middle columns
mov di,ax
rep stosb
add ax,80
dec bx
jnz loope1
lastcol:
mov bx,xc21 ;draw the right column
mov al,right[bx]
out dx,al
mov bx,lowyb
add bx,del_x
mov cx,del_y
mov ax,80
loopf: inc byte ptr es:[bx]
add bx,ax
loop loopf
rfinish:
pop si
pop di
pop bp
ret
pEnd _rectfill
pBegin __horiz_ ;stripped down version of rectfill
push di
push si
mov dx,word PTR [bp+argbase+6] ;dx has y0
cmp dx,maxline ;test for off screen verticallly
jae rfinish
mov dx,3ceh ; change SET/RESET register
mov al,00h ; to contain the color to write.
out dx,al
mov dx,3cfh
mov al,byte ptr [bp+argbase+12] ; <-- THIS IS THE COLOR.
out dx,al
mov cx,word PTR [bp+argbase+4] ;cx has x0
mov bx,word PTR [bp+argbase+8] ;bx has x1
cmp bx,cx
jge test2h
mov si,bx
mov bx,cx
mov cx,si
test2h: or bx,bx ;clip to screen
jge test3h
jmp hfinish
test3h: cmp cx,640
jl test4h
jmp hfinish
test4h: cmp cx,0
jge test5h
sub cx,cx
test5h: cmp bx,640
jl test6h
mov bx,639
test6h:
xor dx,dx
mov ax,cx
div ate
mov xc10,ax ;byte value
mov xc20,dx ;offset in byte
mov cx,ax
xor dx,dx
mov ax,bx
div ate
mov xc11,ax
mov xc21,dx
sub ax,cx
mov cx,ax
mov ax,drawseg
mov es,ax
mov dx,3ceh
mov al,08h
out dx,al
; compute location of byte to change
mov ax,word ptr [bp+argbase+6]
mov dx,ax
shl dx,1
shl dx,1
add ax,dx
shl ax,1
shl ax,1
shl ax,1
shl ax,1
add ax,xc10
mov di,ax
mov bx,xc20
mov al,left[bx]
or cx,cx
jnz leftcoh
mov bx,xc21
and al,right[bx]
leftcoh:
mov dx,3cfh
out dx,al
inc byte ptr es:[di]
inc di
cmp cx,1
jl hfinish
jz lastcoh
mov al,255
out dx,al
dec cx
rep stosb
lastcoh:
mov bx,xc21
mov al,right[bx]
out dx,al
inc byte ptr es:[di]
hfinish:
pop si
pop di
pop bp
ret
pEnd __horiz_
;setdraw(i) sets drawing buffer to i i = 0 or 1
pBegin _setdraw
push bp
mov bp,sp
mov cx, word ptr [bp+argbase+4]
mov ax,0a000h
loopds:
cmp cx,0
jz ds1
add ax,0800h
cmp maxline,480
jnz ds1
add ax,0800h
ds1: mov drawseg,ax
pop bp
ret
pEnd _setdraw
;setdisp(i) sets the displayed segment to i = 0 or 1
pBegin _setdisp
push bp
mov bp,sp
mov ax, word ptr [bp+argbase+4]
mov ah,5
int 010h
pop bp
ret
pEnd _setdisp
endcs _egagraf
end
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/