RE: A86: How to use Video Mem?


[Prev][Next][Index][Thread]

RE: A86: How to use Video Mem?



 
Steve wrote:
  > Otherwise, it is immensely more complicated and I'm still
* working on a routine that'll do it right.

I have been working on such a routine, and I have come up with three (to me) useful sprite routines to read and write 8x8 sprites anywhere on the screen:
GetSprite: Read a sprite from de(y,x) to pointer(8 byte large) in hl
PutSpriteOr: Write a sprite to de(y,x) from pointer(8 byte large) in hl
using logical OR
PutSpriteAnd: Write a sprite to de(y,x) from pointer(8 byte large) in hl
using logical AND
All three routines are included with this mail, and may be copied and used freely, as long as credit is given to me.

I am not a very experienced ASM-programmer, so these routines could probably be made for efficient. Please send any comments, suggestions etc. to me !!!

Regards,
Martin

Stud. tech. Martin Blix Grydeland, Computer Science NTNU
E-mail: grydelan@stud.ntnu.no
Web: http://www.stud.ntnu.no/~grydelan


-----Original Message-----
From:	Steve86Asm@aol.com [SMTP:Steve86Asm@aol.com]
Sent:	1. oktober 1997 20:13
To:	assembly-86@lists.ticalc.org
Subject:	Re: A86: How to use Video Mem?

In a message dated 97-10-01 00:43:54 EDT, you write:

> 
>  I wrote earlier:
>  > How do I display a picture on the screen that is written in binary 
>  > like
>  > %11111111
>  > %10000001
>  > %11111111
>  > 
>  > Please help me.
>   
>  Now for more information.  I have the source code for nibbles and was 
>  wondering how they made the levels apper the have code like this:
>  
>  level_data:
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>           .db      %00000000,%00000000,%00000000,%00000000
>  
>  How do I make the levels appear if they are written like that?
>  
>  Thanks,
>  
>  Dann  
>  

To start simple, if you want to put

%11111111
%10000001
%11111111

on the screen, it would definitely be easiest if you're intending on making
the top-left corner be at the left side of one of the 8x8 squares (i.e. x is
a multiple of 8).  In this case, you could use a findpixel routine to point
hl to the location you want it.  Otherwise, it is immensely more complicated
and I'm still working on a routine that'll do it right.  Anyway, if you have
hl pointing to that location in video mem ($FC00+16y+x/8) then you could
point de to the location in your program where the pic is.  Then it would
probably be good if they were switched (ex de,hl) because ldi is pretty much
just ld (de),(hl)\inc hl\inc de.  So, once hl and de are set up, you'd want
to ldi and then increment de by 15 more (to get to the next line), so I would

 push hl
 ld hl,15
 add hl,de
 ex de,hl
 pop hl
so that hl is the same as it was, and de is 15 more.

then just ldi and increment de again and again until you finish the sprite.
 If you're going to do this more than 2 or 3 times, it would be a good idea
to make a loop (but you might want to push/pop bc if you're using a djnz
because I think ldi might dec bc as well)

About the nibbles levels, it appears that each bit represents a 4x4 box.  If
you wanted to display it, then it would be somewhat tricky, and I can't think
of a good algorithm off the top of my head...

~Steve

Warning
Could not process part with given Content-Type: application/ms-tnef