If you are using an Intel 80x86 processor, at least from the 486 onwards, you should be able to find some floating point instructions which will let you store a decimal square root to memory, and then read it back as a (rounded down) integer square root.
I'm not sure it makes sense mathematically either. To paraphrase:
There is a number(int), 7 say, and i want to find the number(int) wich when you square it you will get either the number 7 or the int before it (i.e. 6 ).
Well neither 6 or 7 have integer square roots.
A trap is an interrupt which occurs as a result of some action taken by the program - such as setting the single step flag, executing an INTO instruction, or issuing a break point interrupt. Unless you are doing something relatively specialised, such as writing a degugger, you seldom if ever...
If you use int 10H in a TSR program there is a good chance it will crash. There are very few interrupts which can be called from within a TSR without taking elaborate precautions, and int 10H isn't one of them. The best thing to do would be to write directly to video buffer at 0B800:0000.
With...
Whenever I look at assembly language programs, on this and other sites, they are always full of MS-DOS style programs. Part of the reason is that, if you want to cover every part of assembly language, you have got to use DOS type programs, otherwise Windows will get in your way.
It could be that way, because it doesn't say
#ifndef wchar_t
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
Try commenting out the offending line and see if the problem goes away. If it does you have your answer.
Intel x86 assembly language is as future proof as could be wished for. A program written in 1981 for the very first PC could, in theory, be run on the very latest PC. Provided you installed MS-DOS first of course, or alternatively (like me) have it already installed on a spare partition for old...
The registers obviously need replacing with variables
================================
>>= and <<= in place of shr and shl
==================================
mov ebx, [start_neg_pow2]
add ax, word ptr [ebx + ecx * 2 ]
replacing start_neg_pow2 with p, the above becomes something like:
add...
Open glut.h, go to line 50, and see what you find there. Apparently a short integer, which has already been declared somewhere or other, is being declared again.
Have you heard of the Global Descriptor Table? In protected mode the segment registers do not contain an address you can do calculations on. Instead they contain an index into the GDT. The GDT contains details of all currently allocated memory, and the particular piece of information you would...
If you are writing a console OS, the buffer will always be at B800:0000. For the life of me I can't see the point of not using the BIOS interrupts; MS-DOS certainly does, and that's what they are there for. I wouldn't envy anybody the job of trying to program a floppy disk controller directly...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.