Hello,
I have some simple questions:
What does the 'align' (pseudo) instruction do and what is it good for? I used it in a program and when I disassembled it, I didn't find any difference.
Can the user keyboard buffer (where the keys are sent), in the IRQ01 handler or in the keyboard handling software interruption, be only a byte long?
Thanks for any help.
Some simple questions
Re:Some simple questions
Hi,
The reason it didn't appear to do anything is that your code/data may have already been aligned.
Cheers,
Brendan
The "align" pseudo-instruction aligns things . For example, for best performance target addresses for "call", "jmp" and branches should be on a 4 byte boundary (or 8, or 16 depending on target CPU trace cache). Also data should be aligned on it's natural boundaries - 2 byte alignment for words, 4 byte alignment for dwords, 8 byte alignment for qwords, etc. To achieve this you can write things like this (for NASM):ManOfSteel wrote: What does the 'align' (pseudo) instruction do and what is it good for? I used it in a program and when I disassembled it, I didn't find any difference.
Code: Select all
align 4
subroutine:
mov eax,[someData]
fld qword [moreData]
ret
section .data
align 4
someData: dd 0
section .bss
alignb 8
moreData: resq 1
section .text
Yes the keyboard buffer can be a byte long, but it wouldn't be much better than polling (which is IMHO a poor way of doing things for an OS intended for 80x86, and barely acceptable for embedded systems). Assuming there's a fast typist, how much time is there between the make code and the break code? Can you guarantee that all software running under your OS will be able to get the keyboard data out of the keyboard buffer (before it's overwritten) that quickly, even when the OS is overloaded with other work (including heaps of IRQs)?ManOfSteel wrote: Can the user keyboard buffer (where the keys are sent), in the IRQ01 handler or in the keyboard handling software interruption, be only a byte long?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.