Challenge: sc2 setpixel

Page 5/10
1 | 2 | 3 | 4 | | 6 | 7 | 8 | 9 | 10

Par FiXato

Scribe (1741)

Portrait de FiXato

24-09-2010, 01:12

ARTRAG: leave out the spaces in the img-tags ;-)

gives:
https://docs.google.com/leaf?id=0Bx4kWAc-fapqNWJmZWVkNTYtMjA1MS00OGRmLWExOWYtNWMzMTg3MjBmZjVi&hl=en&authkey=CJb09LYI
hmm.. looks like MRC doesn't parse https links in their img tags..

then you can perhaps better do:

Screenshot of something

Screenshot of something

AARGH! Forget it.. MRC fucks up seriously with https in any of their BBCode tags...

Par NYYRIKKI

Enlighted (6016)

Portrait de NYYRIKKI

24-09-2010, 12:49

hah!
this time it is not my fault!

True, it was wrong all the time, but if you would have fixed it like this:

	LD A,1
	LD HL,0C007H
.LOOP
	LD (HL),A
	DEC L
	ADD A,A
	JR NC,.LOOP

... then it would have looked a lot smaller bug. Eek!
Just kidding... my fault. Tongue

Par ARTRAG

Enlighted (6923)

Portrait de ARTRAG

24-09-2010, 15:27

just to be sure ... is this the current (x,y) to address mapping?

; A15                    A8   A7                     A0
; 00 RW 00 Y7   Y6 Y5 Y4 X3 | X7 X6 X5 X4   Y3 Y2 Y1 Y0
;                  D7                       D0


is this the C equivalent?

vaddr =   (int)512 * (y & 0xf0) + (int)32*(X & 0x08) + (X & 0xf0) +(y & 0x0f);		

Par NYYRIKKI

Enlighted (6016)

Portrait de NYYRIKKI

24-09-2010, 18:16

I don't think you got it right, but I don't know C
At least in BASIC it goes like this (If I got it right):

VPOKE (Y AND 15) + (X AND &HF0) + ((X AND 8) + (Y AND &HF0))*32 , 2^(7-(X AND 7))

Par ARTRAG

Enlighted (6923)

Portrait de ARTRAG

25-09-2010, 09:37

I need to draw the edge of a box larger than the screen
so I need to draw
from (wx,wy) to (255,wy) ;
from (wx,wy) to (wx,191) ;

or

from (0,wy) to (wx,wy)
from (wx,wy) to (wx,191)

and the other possibilities

Par ARTRAG

Enlighted (6923)

Portrait de ARTRAG

25-09-2010, 09:37

NYYRIKKI, i'm sorry, I'm dumb
i'm trying to do a routine that draws vertical lines and another that horizotal lines

can you confirm that the tile pattern is like this

;  0  2  4 ....28 30
;  1  3  5 ....29 31
; 32 34 36 ....
; 33 35 37 ....
 

Par NYYRIKKI

Enlighted (6016)

Portrait de NYYRIKKI

25-09-2010, 11:03

NYYRIKKI, i'm sorry, I'm dumb
i'm trying to do a routine that draws vertical lines and another that horizotal lines

can you confirm that the tile pattern is like this

;  0  2  4 ....28 30
;  1  3  5 ....29 31
; 32 34 36 ....
; 33 35 37 ....
 

No it is not... It is like this:

; A15                    A8   A7                     A0
; 00 RW 00 Y7   Y6 Y5 Y4 X3 | X7 X6 X5 X4   Y3 Y2 Y1 Y0
;                  D7                       D0
(This part you already got right)

So...

 0 32  2 34  4  36 ... 62
 1 33  3 35  5  37 ... 63
64 96 66 98 68 100 ... 126
65 97 67 99 69 101 ... 127

Just like normal, but swap the bits 0 and 5

Par ARTRAG

Enlighted (6923)

Portrait de ARTRAG

25-09-2010, 17:13

humm
moving a point horizontally with step of 8 pixels seems very hard:

adding 16 to vram address (vaddr) moves of 16 pixels...

an horizontal lotted line should have two loops both step 16
one starting from vaddr
one other from vaddr+256

for vertical lines I need two loops as well, but with step 512
one starting from vaddr
one other from vaddr+8

how odd
Am I right?

Par NYYRIKKI

Enlighted (6016)

Portrait de NYYRIKKI

27-09-2010, 02:08

humm
moving a point horizontally with step of 8 pixels seems very hard:

adding 16 to vram address (vaddr) moves of 16 pixels...

an horizontal lotted line should have two loops both step 16
one starting from vaddr
one other from vaddr+256

Yes, I think you got this one right if you run from 0 to 15. Example of line (256 pixels wide):

FOR X=0 TO 31:VPOKE X*16,255:NEXT X


for vertical lines I need two loops as well, but with step 512
one starting from vaddr
one other from vaddr+8

Yes, I think this could work, if you run from 0 to 7, but why would you do that?
Example of line (192 pixels height):

FOR Y1=0 to 11:FOR Y2=0 to 15:VPOKE Y1*512+Y2,128:NEXT Y2,Y1

BTW I've done quite a good PSET routine that is very handy for example for drawing vertical lines. It does the needed calculations with just two bit rotate commands. Tongue

Par NYYRIKKI

Enlighted (6016)

Portrait de NYYRIKKI

27-09-2010, 02:38

If you are interested especially drawing boxes, then this layout is faster to use:

; A15                    A8   A7                     A0
; 00 RW 00 Y7   Y6 X7 X6 X5 | X4 X3 Y5 Y4   Y3 Y2 Y1 Y0
;                  D7                       D0

... you can draw lines up to 64 pixels height with only one address setup.

Page 5/10
1 | 2 | 3 | 4 | | 6 | 7 | 8 | 9 | 10