<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">;
;   Number Nine Revolution 512x8 
;   support routines for raster oriented graphics
;
;   Tim Krauskopf      July 1986
;
;   National Center for Supercomputing Applications, University of Illinois
;   153 Water Resources Building
;   605 E. Springfield Ave.
;   Champaign, IL  61820
;   (217)244-0072
;
;
	TITLE      NUMBER 9 GRAPHICS SUPPORT
	INCLUDE DOS.MAC
	SETX
	PSEG
	PUBLIC	PUTCLR,PUTMAP,NO9LINE
;
;  take three arrays of color table entries and transfer them to the
;  board's Color registers at offset.
;
;  usage:  putclr(rmap,gmap,bmap,count,offset);
;
PUTCLR	PROC	FAR
	PUSH	BP
	MOV	BP,SP
	PUSH	DS
	PUSH	ES

	MOV	AX,[BP+X+2]
	MOV	DS,AX			; where to get maps (seg)
	MOV	AX,0C000H		; control seg for #9
	MOV	ES,AX                   ; where to put color (seg)

	MOV	SI,[BP+X]		; where to get red
	MOV	CX,[BP+X+12]		; length of map
	MOV	DI,0100H		; red map
        ADC	DI,[BP+X+14]            ; offset to correct entry
	REP	MOVSB			; mov red
;
	MOV	SI,[BP+X+4]
	MOV	CX,[BP+X+12]		; length of map
	MOV	DI,0200H		; green map
        ADC	DI,[BP+X+14]            ; offset to correct entry
	REP	MOVSB
;
	MOV	SI,[BP+X+8]		; blue map
	MOV	CX,[BP+X+12]		; length of map
	MOV	DI,0300H	
        ADC	DI,[BP+X+14]            ; offset to correct entry
	REP	MOVSB
;
	POP	ES
	POP	DS
	POP	BP
	RET

PUTCLR  ENDP

;  take three arrays of color table entries and transfer them to the
;  board's registers
;
;  usage:  putmap(rmap,gmap,bmap);
;
PUTMAP	PROC	FAR
	PUSH	BP
	MOV	BP,SP
	PUSH	DS
	PUSH	ES
	MOV	AX,[BP+X+2]
	MOV	DS,AX			; where to get maps (seg)
	MOV	SI,[BP+X]		; where to get red
	MOV	AX,0C000H		; control seg for #9
	MOV	ES,AX
	MOV	DI,0100H		; red map
	MOV	CX,256			; length of map
	REP	MOVSB			; mov red
;
	MOV	SI,[BP+X+4]
	MOV	DI,0200H		; green map
	MOV	CX,256
	REP	MOVSB
;
	MOV	SI,[BP+X+8]		; blue map
	MOV	DI,0300H	
	MOV	CX,256
	REP	MOVSB
;
	POP	ES
	POP	DS
	POP	BP
	RET

PUTMAP	ENDP
;
;  Transfer line to #9 screen, one byte per pixel
;
;   usage : no9line(x,y,buf,nbytes)
;
NO9LINE	PROC	FAR
	PUSH	BP
	MOV	BP,SP
	PUSH	DS
	PUSH	ES
	MOV	AX,0C000H	; control regs
	MOV	ES,AX

	MOV	AX,[BP+X+6]	; ds of buffer
	MOV	DS,AX
	MOV	AX,[BP+X+2]	; y location on screen
	MOV	CL,7		; divide by 128
	SHR	AX,CL
	MOV	BL,AL		; make a copy
	CMP	AL,CS:BANK	; is it the same bank?
	JZ	OKBANK

	MOV	CS:BANK,AL	; bank will be this one
	MOV	DH,00H		; default, might be changed
	AND	AL,02H		; is high bit on?
	JZ	NO706

	MOV	DH,0FFH		;  setting for new bank
NO706:
	MOV	DL,00H		; default setting for 705
	MOV	AL,BL		; get back copy
	AND	AL,01H		; is low bit on?
	JZ	NO705

	MOV	DL,0FFH		; other portion of new bank
NO705:
	MOV	DI,0705H	; where bank reg is
	MOV	AX,DX
	STOSW			; sets both bytes, lo then hi
;
;   READY TO PUT THE LINE
;
OKBANK:
	MOV	AX,0A000H	; data buffer
	MOV	ES,AX
	MOV	SI,[BP+X+4]	; where data will come from
	MOV	AX,[BP+X+2]	; get y value again
	MOV	CL,9
	SHL	AX,CL		; get 16 bit pointer for this bank
	ADD	AX,[BP+X]	; x value of where on screen added in
	MOV	DI,AX		; prepare for movs
	MOV	CX,[BP+X+8]	; how many bytes?
BLAST:
	REP	MOVSB

	POP	ES
	POP	DS
	POP	BP
	RET
BANK	DB	0FFH		; current bank number
NO9LINE	ENDP
	ENDPS
	END
</pre></body></html>