16-bit

What does OFFSET in 16 bit assembly code mean?

a 夏天 提交于 2019-11-30 17:28:21
I am going through some example assembly code for 16-bit real mode. I've come across the lines: mov bx, cs mov ds, bx mov si, OFFSET value1 pop es mov di, OFFSET value2 what is this doing? What does having 'OFFSET' there do? Nathan Fellman As some of the other answers say, the offset keyword refers to the offset from the segment in which it is defined. Note, however, that segments may overlap and the offset in one segment may be different in another segment. For instance, suppose you have the following segment in real mode data SEGMENT USE16 ;# at segment 0200h, linear address 2000h org 0100h

Why is there no 2-byte float and does an implementation already exist?

懵懂的女人 提交于 2019-11-30 12:33:26
问题 Assuming I am really pressed for memory and want a smaller range (similar to short vs int ). Shader languages already support half for a floating-point type with half the precision (not just convert back and forth for the value to be between -1 and 1, that is, return a float like this: shortComingIn / maxRangeOfShort ). Is there an implementation that already exists for a 2-byte float? I am also interested to know any (historical?) reasons as to why there is no 2-byte float. 回答1: Re:

c++ defined 16bit (high) color

谁说我不能喝 提交于 2019-11-30 04:55:12
问题 I am working on a project with a TFT touch screen, with this screen there is an included library. But after some reading, i still dont get something. In the library there are some defines regarding colors: /* some RGB color definitions */ #define Black 0x0000 /* 0, 0, 0 */ #define Navy 0x000F /* 0, 0, 128 */ #define DarkGreen 0x03E0 /* 0, 128, 0 */ #define DarkCyan 0x03EF /* 0, 128, 128 */ #define Maroon 0x7800 /* 128, 0, 0 */ #define Purple 0x780F /* 128, 0, 128 */ #define Olive 0x7BE0 /*

What does OFFSET in 16 bit assembly code mean?

做~自己de王妃 提交于 2019-11-30 01:31:54
问题 I am going through some example assembly code for 16-bit real mode. I've come across the lines: mov bx, cs mov ds, bx mov si, OFFSET value1 pop es mov di, OFFSET value2 what is this doing? What does having 'OFFSET' there do? 回答1: As some of the other answers say, the offset keyword refers to the offset from the segment in which it is defined. Note, however, that segments may overlap and the offset in one segment may be different in another segment. For instance, suppose you have the following

How to do 64 bit multiply on 16 bit machine?

独自空忆成欢 提交于 2019-11-29 12:48:06
I have an embedded 16 bit CPU. On this machine ints are 16 bit wide and it supports longs that are 32 bits wide. I need to do some multiplications that will need to be stored in 64 bits (e.g. multiply a 32 bit number by a 16 bit number). How can I do that with the given constraints? I do not have a math library to do this. Just another metaprogrammer A suggestion in C. Note that this code probably will be easier to implement with inline assembler as carry detection in C doesn't seem that easy // Change the typedefs to what your compiler expects typedef unsigned __int16 uint16 ; typedef

Bootloader works in emulators but not on real hardware

主宰稳场 提交于 2019-11-29 12:30:56
I am writing a bootloader in assembly and it seems to work fine on qemu, bochs and virtualbox. However, it is not loading the kernel on real hardware (it seems). The bootloader starts off by writing a character to the video memory (for debugging), it then reads sector 2 off the drive and far jumps to the kernel. The kernel is then writing some characters to video memory. On a real machine, I see the character from the bootloader on the screen, and there it hangs (blinking caret). I have tried to set DS, ES, SI to zero, and I am also setting up a stack segment. I am reading sector 2 off of the

With C++ and Qt how do I display a 16-bit raw file as an image?

独自空忆成欢 提交于 2019-11-29 11:57:21
I am looking to display heightmaps from the video game Battlefield 2 as images in my application. I am new to C++ and Qt and it might be straight forward but what I am having trouble with is displaying a grayscale 16-bit 1025x1025 2101250 bytes image. There is no header to the file. I need access to the displayed pixels (does not have to be pixel perfect precision) so I can point to a pixel and get its value. What I have tried I have loaded the binary data into a QByteArray from a QFile and I have attempted to use the QImage::fromData function to make the image but I am making a lot of

Operand size prefix in 16-bit mode

佐手、 提交于 2019-11-29 07:03:05
I'm trying to understand GAS's behavior of .code16. From the manual, it seems in 16-bit section, for 32-bit operands or instructions, a 66H operand override prefix will be produced for the instruction encoding. Does that mean .code16 movw %eax, %ebx is legal in such mode? Then the code cannot run on 16-bit processor? Dirk Wolfgang Glomp These are legal instructions for 80386+. Starting with the 80386 we can use operandsize- and addresssize- override prefixes. Those prefixes can be used in combination with the 16 bit address mode and with the 32 bit address mode. Additional it can be used with

Define 16 bit integer in C

余生长醉 提交于 2019-11-29 00:59:48
问题 I need to declare an integer in the size of 16 bit, in C. I know that short and int sizes are machine dependent. I tried to use "stdint.h", but it seems that they simply do typedef short int16_t So my question is: Am I missing something and short type guarantees 16 bit length? If no, is there is an alternative that guarantees it? 回答1: That means int16_t is defined as short on your machine, not all machines. Just use the int16_t where you absolutely need a 16bit integer type; it will be

With C++ and Qt how do I display a 16-bit raw file as an image?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 06:02:39
问题 I am looking to display heightmaps from the video game Battlefield 2 as images in my application. I am new to C++ and Qt and it might be straight forward but what I am having trouble with is displaying a grayscale 16-bit 1025x1025 2101250 bytes image. There is no header to the file. I need access to the displayed pixels (does not have to be pixel perfect precision) so I can point to a pixel and get its value. What I have tried I have loaded the binary data into a QByteArray from a QFile and I