A83: Re: Bit Masking
[Prev][Next][Index][Thread]
A83: Re: Bit Masking
"and" automatically sets the Z flag
if the number is equal , using that number of significant bits.
ie...
ld a,%111
and %111
jp
z,label ; the z-flag would be
set
ld a,%101
and %111
jp
z,label ; the z-flag would not be set,
because the 3 significant bits are not all the same
ld a,%10111
and %111
jp
z,label ; it would jump to the
label... because the last 3 bits in a = "%111"
-Harper Maddox
Harper:
Great routine...I didn't
understand two lines of code (well one really...)
> and %1
;is it at 0 (when we only want 1 or 0)
> jr nz,norm ; goto
"norm" if temp isnt equal to 2
Now, in that first line --
that's a bit mask, right? And % stands for
binary? So, you
take the binary number where?, and 'AND' it with 00000001.
So, what is
the JR routine using to
check?
James.
____________________
James
Matthews.
E-mail (family): matthews@tkb.att.ne.jp
E-mail
(private): james_matthews@hotmail.com
Homepage:
http://home.att.ne.jp/gold/tomcat21/index2.html
ICQ:
7413754
____________________________________
----------
From:
Harper Maddox <jerky@ebicom.net>
To: assembly-83@lists.ticalc.org
Subject:
A83: Re: flashtext
Date: Saturday, March 21, 1998 10:17 AM
I used
this in avalanch and Chicken Shoot...
;-------A cool routine devised by
Harper Maddox and Andrew
Ungvarsky------------
; Displays a flashing
"Press 2nd"
ld c,0
introwait:
ld
b,21
loop:
halt
call getkey
cp 45 ; clear???
ret
z ; return to what called the program... The OS
cp 21
jr
z,start ; If key="2nd" then start the game
djnz
loop
push bc
;-------erase reverse line to left of "Press
2nd"
ld bc,16*256+15 ; start of line = (15,16)
ld
de,16*256+8 ; end of line = (8,16)
ld
h,0 ; 0
means draw a white line
call _iline ;
draw the line
;-----end erase line----------
pop bc
inc c
ld
a,c
and %1 ;is it at 0 (when we only want 1 or 0)
jr nz,norm ;
goto "norm" if temp isnt equal to 2
set
textinverse,(iy+textflags) ; Flash... inverse text is
on
norm:
ld a,3 ; Home screen text starts at (6,3)
ld
(curcol),a
ld a,6
ld (currow),a
ld hl,secnd
call _puts ; display the "secnd" string
res
textinverse,(iy+textflags) ; turn Text Inverse off
jr
introwait ; return back to the intro
loop
getkey:
call _zerooop1
call _getk
call
_op2toop1
call _convop1
ld a,e
jr z,getkey
ret
-Harper
Maddox
jerky@ebicom.net
-----Original Message-----
From: Dustin Graham <ima_macuser@hotmail.com>
To: assembly-83@lists.ticalc.org
<assembly-83@lists.ticalc.org>
Date: Friday, March 20, 1998 4:09 PM
Subject: A83:
flashtext
;try this-I think it will
work
prog_start:
set
textInverse,(iy+textflags)
CALL _CLRLCDFULL ;CLEAR
SCREEN
LD
HL,0202h
ld
(currow),hl
LD
HL,Madeby
CALL
_PUTS
jr
LOOP
res
textInverse,(iy+textflags)
CALL _CLRLCDFULL ;CLEAR
SCREEN
LD
HL,0202h
ld
(currow),hl
LD
HL,Madeby
CALL
_PUTS
CALL
gk
gk:
call
_GetKy
or
a
jr
z,prog_start
ret
nz
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com