can we use db tags for file name and details

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

can we use db tags for file name and details

Post by PatrickV »

I was wondering if their is anyone who has done or any source code that use db tags in nasm. I want to konw if we can put a search on sector range and if it finds it will load the allocated sector say each file can be 512 bytes for example. I was planing of creating my filing methods. Can you guys help me out
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Re: can we use db tags for file name and details

Post by Zenith »

Hello again, Patrick.

What you have to remember is that NASM is an ASSEMBLER. There are no higher-level abstractions, and each line corresponds to a string of bytes that the CPU interprets directly.

db isn't a processor instruction - it allows the programmer to insert a byte of data at the exact place. Next time, please make sure to search for information thoroughly instead of immediately asking us. Here is the NASM Manual - http://nasm.sourceforge.net/doc/nasmdoc0.html. Make sure to look at Chapter 3 which deals with how to declare data and access memory locations.

If you want to load a sector in real mode, you might want to look at int 13h here - http://www.ctyme.com/intr/int-13.htm, specifically AH=02h.

So,

Code: Select all

db 0x24 ;Puts a byte with the value 0x24 at this place
dw 0xAA55 ;Puts a bootloader signature at this place (w = 2 bytes)
"Sufficiently advanced stupidity is indistinguishable from malice."
Post Reply