flat assembler
Message board for the users of flat assembler.

Index > Main > Testing Bits

Author
Thread Post new topic Reply to topic
me239



Joined: 06 Jan 2011
Posts: 200
me239 16 Jun 2011, 06:23
Hello everyone! I just got directory support and file execution on my OS and now I want to add some form of protection from running the kernel again. I want to make it so that hidden files can neither be run or seen. I know that the attribute byte on fat12 is at 11d and that bit 2 is hidden. My question is how do I find whether bit 2 is enabled or not?
Post 16 Jun 2011, 06:23
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 16 Jun 2011, 07:02
or it ?

idk, wait for the os gurus who know about fat12
Post 16 Jun 2011, 07:02
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 16 Jun 2011, 07:37
It is strange you write your own OS, but miss so basic knowledge as testing bits... Shocked
Anyway, read "bt" instruction and "test" instruction reference.
Post 16 Jun 2011, 07:37
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239 16 Jun 2011, 07:52
JohnFound wrote:
It is strange you write your own OS, but miss so basic knowledge as testing bits... Shocked
Anyway, read "bt" instruction and "test" instruction reference.
LOL, I know how to test for things like odd numbers. I think I figured it out now. I and it with 2 and test for a zero. Is this correct?
P.S it's 4am where I live and am very tired so I'm probably not thinking too well.
Post 16 Jun 2011, 07:52
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Jun 2011, 17:17
Code:
BIT_TO_TEST = 2 ; Change at will
test byte[mem], 1 shl BIT_TO_TEST
jnz .itIsSet

; If you want to create a BOOL in AL
mov al, [mem]
shr al, BIT_TO_TEST
and al, 1
; Now AL is either zero or one

;Alternate method (386+):
test byte[mem], 1 shl BIT_TO_TEST
setnz al
    
Post 16 Jun 2011, 17:17
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.