NewsProductsSprinterSupportDownloadSprinter ForumAbout usLinksSite map Russian site
Support
 Updates | Knowledge base | Manuals | Resellers | Warranties | Feedback

Knowledge Base

[ Back ] [ Index ] [ Categories ] [ Next ]

Q10009. Screen memory location.

Summary

This article contain usage examples of graphic modes.

More information

Today, Estex DSS support four screen modes: text 40x32 with 16 colors (mode 02h); text 80x32 with 16 colors (mode 03h); graphic 320x256 with 256 colors (mode 81h); graphic 640x256 with 16 colors (mode 82h); The default mode for the DSS is 80x32 text mode, if your program need another screen mode then you need to switch it by DSS function 50h (SETVMOD). Also before switching you should ask DSS and save current screen mode by function 51h (GETVMOD). And when you program will be ready to finished, restore it by 50h (SETVMOD). for example:
	LD	C,51h	;get screen mode
	RST	10h
	LD	C,A	;move mode number to register C
	PUSH	BC	;and save to stack BC (B - active page, C - mode)
	.
	. 		;your program
	.

	POP	BC	;restore mode from stack
	LD	A,C	;move screen mode to register A
	LD	C,50h	;set screen mode
	RST	10h
	LD	C,41h	;terminate program
	RST	10h
DSS has some functions for outing symbols and strings at the text screen. But for the graphic modes you need to write it yourself. for example:
	LD	HL,STRING	;pointer to the string
	LD	C,5Ch		;outing string
	RST	10h

STRING	DB	"Thank you for using my program..."
	DB	13,10		;CR and LF codes
	DB	0		;End of string
For painting at the graphic screen memory, you need to set one of three memory frames 04000h-07FFFh, 08000h-0BFFFh, 0C000h-0FFFFh. It can be made by set value 50h to the ports 0A2h, 0C2h or 0E2h. Don't forgot about STACK place! for example: if you want to set one point then routine for 81h mode will look like:
; HL - x coord
; DE - y coord
	IN	A,(0E2h)	;read page number
	LD	C,A		;move it to C (save)
	LD	A,50h		;page of video RAM
	OUT	(0E2h),A	;set it to third frame 0C000-0FFFFh
	LD	A,E		;Y-coord (0...255)
	OUT	(89h),A		;set to Y-port
	LD	DE,0C000h	;frame address
	ADD	HL,DE		;add x-coord
	LD	A,255		;point color (от 0 до 255) (index to palette)
	LD	(HL),A		;put pixel
	LD	A,C		;restore page number
	OUT	(0E2h)		;set it
Note: Before it, you need to set required colors at the palette.

30 May 2002.
PETERS PLUS LTD.

[ Back ] [ Index ] [ Categories ] [ Next ]