1
2	SECTION	code_clib
3	PUBLIC	pixeladdress
4
5	INCLUDE	"graphics/grafix.inc"
6
7	EXTERN	base_graphics
8
9;
10;	$Id: pixladdr.asm,v 1.9 2016-04-22 20:17:17 dom Exp $
11;
12
13; ******************************************************************
14;
15; Get absolute	pixel address in map of virtual (x,y) coordinate.
16;
17; in:  hl	= (x,y) coordinate of pixel (h,l)
18;
19; out: de	= address	of pixel byte
20;	   a	= bit number of byte where pixel is to be placed
21;	  fz	= 1 if bit number is 0 of pixel position
22;
23; registers changed	after return:
24;  ......hl/ixiy same
25;  afbcde../.... different
26;
27
28.pixeladdress
29
30	;; Ported from the ZX ROM PIXEL-ADD routine
31
32				; Direct ROM call
33				; better not to use it:
34;		ld	b,l	; maybe someone wants to
35;		ld	c,h	; make a ROM :-)
36;		call	8880
37;		call	8881
38;		xor	@00000111
39;		ld	d,h
40;		ld	e,l
41;		ret
42
43
44		LD	A,L
45	        AND     A
46	        RRA
47	        SCF			; Set Carry Flag
48	        RRA
49	        AND     A
50	        RRA
51	        XOR     L
52	        AND     @11111000
53	        XOR     L
54	        LD      D,A
55	        LD      A,H
56	        RLCA
57	        RLCA
58	        RLCA
59	        XOR     L
60	        AND     @11000111
61	        XOR     L
62	        RLCA
63	        RLCA
64	        LD      E,A
65	        LD      A,H
66	        AND     @00000111
67	        XOR	@00000111
68
69	        RET
70