Re: LZ: Programming and Random # ques.


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

Re: LZ: Programming and Random # ques.



RedLionPA@aol.com wrote:
> 
> I'm new to programming in assembler and have a few very basic (read:
>        stupid)questions to ask:
> 
>    First, I need a random number (integer) between 1 and 9 (or 0 and 8,
> etc.).  I have
>       a random number routine, but don't really know what it does, because I
> don't
>       know what the commands sla and srl do.  Any help?  I have a different

SLA - shift left arithmetic - shifts left all of the bits in the byte 
except bit 7, which indicates sign, basically multiplies it by two, 
keeping sign and keeping magnitude less than or equal to 127

SRL - shift right logical - divides by two, except it includes the bit 7, 
so anynumber from 0 to 255 can be shifted and 0 to 127 can be returned.

> on which
>       uses the command rrc which I also need explained.  (I couldn't find
> mention of

RRC - rotate right through carry - rotates all bits through the carry 
flag.  anything in bit 0 moves to carry, anything in carry moves to bit 
7.

>       them in the files I found about programing assembler).  If anyone has
> any other
>       suggestions, I would be very greatful.
> 
>   Second, I have a program which turns an .85i file into a set of .db
> commands,
>       representing the screen with hexidecimal numbers.  I think its 16 hex #
> in each
>       .db, and one .db for each row of pixels.  What do I do with the .db's
> to display
>       the image?
> 
> Thanx for wasting you time trying to help a struggleing newbie.
> 
> [Jeremy Laucks]

I've never done that picture thing, but you probably need to do something 
like this, (written in hurry, in other words wrong):

ld hl,(PROGRAM_ADDR)	;start of program
ld de,<label of table of .db's>	;offset of picture
add hl,de	add's em up
ld de,$FC00	;start of vid screen
ld bc,$0400	;1024 bytes
ldir	;ld hl to de until bc is zero

-- 
Compliments of:
_-_-_-_-_-_-_-_
  Alan Bailey
  mailto:bailala@mw.sisna.com
  IRC:Abalone
  Web:http://www.mw.sisna.com/users/bailala/home.htm


References: