Hot answers tagged

14 votes

Allocate 64 KiB in Watcom C 16-bit DOS

Typically memory allocators need some extra data in addition to the requested allocation size. This is for maintaining a list of allocated blocks on the heap, it's usually a linked-list node along ...
  • 302
11 votes

How can 8bits = 1byte but also = 255 bytes at the same time?

A one octet word (eight bits, also known as a byte) can take a value 0-255 as you've found. When you use a byte as an address, you can identify 256 different locations. A two-octet word (sixteen bits) ...
  • 111
9 votes
Accepted

Are there architectures with alignment greater than the size of machine word in the pre-32-bit era?

Are there pre-32-bit era ISAs with That's a bit fuzzy, as 32 bit ISAs are older than most 8 or 16 bit ISAs, not to mention many that are smaller or larger than 32 bit. The text makes it sound you're ...
  • 178k
7 votes

Are there architectures with alignment greater than the size of machine word in the pre-32-bit era?

There are many machines which forbade data structures from crossing certain power-of-two boundaries that were larger than a word. If one wants to use a single 16K DMA buffer to feed audio to a DOS-...
  • 29.8k
6 votes

Allocate 64 KiB in Watcom C 16-bit DOS

I have not tried it but the following trick might work: You can use halloc(0x1000, 0x10) to allocate a "huge" memory block of 0x1000 × 0x10 bytes (= 64 KiB) size. According to the manual ...
6 votes
Accepted

Microsoft C 6, far pointer, cast to int, warning C4047

Compilers targeting DOS typically provide macros to manipulate the segment and offset of far pointers. FP_SEG(pointer) provides access to the segment portion, FP_OFF(pointer) to the offset. It's also ...
  • 5,902
4 votes

How can 8bits = 1byte but also = 255 bytes at the same time?

An 8-bit (also called a 1-byte) number, can hold one of 256 distinct values, often an integer between 0 and 255. When used as an address, an 8-bit or 1-byte number can address up to 256 different ...
  • 10.9k
3 votes

Allocate 64 KiB in Watcom C 16-bit DOS

A community wiki answer because it includes a lot of useful evidence, but I seem to flub the numbers somewhere: Per OpenWatcom, the definition of _fmalloc is this. Notably: if( amt == 0 || amt > -...
2 votes

Are there architectures with alignment greater than the size of machine word in the pre-32-bit era?

From experience with working with several C compilers on 8-bit and 16-bit machines in the 1980s: On 8080, Z80, and the like, nobody ever put padding into data structures. There was no performance ...
  • 7,894
2 votes

Was `wchar_t` ever widely adopted by the Unix culture in actual practice?

I think your question must be put a bit differently for a first step towards an answer, like "was it common to use localized Unix applications from 70ies to nineties?" - In my opinion, the ...
  • 28.8k
1 vote

Was `wchar_t` ever widely adopted by the Unix culture in actual practice?

Is it historically correct to say that Unix programmers, liking to pretend that character strings and byte arrays were the same thing anyway, never really adopted wchar_t and in practice wide use was ...
  • 178k

Only top scored, non community-wiki answers of a minimum length are eligible