16-bit 32-bit I still don't really understand

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by krimszon on May 31, 2005:

Hey, first of all, is this forum right for questions about programming?

If you say a processor is 16 bits, what part exactly is 16 bits? The most logical thing would be the register size right? But some say it's the address bus size, but that would only have consequences for the maximum addressable memory or I/O, right? I have also read data bus size, but if the bus is only 8 bits wide, you could still fetch a 16 bit value with two consecutive reads and store it if your register is 16 bit, so data bus size doesn't really say anything about 'how many bits' the cpu 'is'?

Did I get it, or should I go back and read some more? I'm used to high level programming, so this is basically new to me, although I remember everyone bragging about my sega is 16 bits!!

Can you give examples, for instance SNES, PlayStation and Pentium 4, registersize, addressbus, databus?

Thanks a lot!!
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by AntiPasta on Jun 1, 2005:

Sure, and don't worry, you're not the only one confused by bit size, there's no definitive way to measure it. Most people say register size, although that would make the Z80 a bit of a weirdo. Adress bus is usually not used as it used to be more than the "bitness". For instance:

6502 (NES,C64,etc.) - only 8 bit registers, so that's easy. 16 bit addressing.
65816 (SNES) - not sure about this, it's a souped-up 6502 with 16 bit registers and 24-bit addressing
R3000A (PSX) - true 32 bit RISC, 32 bit addressing, 32 32bit registers. (and a very nice instruction set)
R4300i (N64) - 64 bit RISC with 32-bit backwards compatibility. 32 bit addressing, I think.
386 - 32 bit registers with 16 and 8-bit "halves", 32 bit addressing.
Pentium Pro and onward - 32 bit registers, 36 bit addressing, 80 bit floating point, 64 bit MMX - but ALU operations are still 32 bit
Pentium 4 - a lot more complicated ;-)

I gotta run now, but I can give a better explanation later!
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by Paulo on Jun 1, 2005:

Have you noticed how they stoped the bits crap for the 360 and PS3...
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by AntiPasta on Jun 1, 2005:

Good, because it stopped making sense when the Jaguar came around. Wackos at Neo-Geo.com seem to be convinced the AES/MVS/CD is '24 bit', by the way, which is complete wank. Yeah, my Saturn is 168 bits, yayness!
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by krimszon on Jun 1, 2005:

Yeah, it didn't make sense with Dreamcast either, where 1 component can work with 128 bit values, so they called it a 128 bit console.

Thanks for the explanation.

What I notice, is that the PS has 32 separate registers, isn't that a lot? Is that a pro or a con?

My primary interest is for SNES (and maybe GBA), the SNES has only 2 registers, correct?

And last question, if you have a 16 bit register, and a 24 bit address bus (like the snes apparently), doesn't that limit your capabilities for putting an actual 24 bit address on the bus? It can't come from a register, right?




Code:

mov bx, 12C6 <-- random 16 bit value
mov ax, [bx] <-- i'd like to put a 24 bit address, but how can I?

I'm just starting out with this assembly stuff, so your comments are greatly appreciated!!
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by AntiPasta on Jun 1, 2005:

krimszon said:




Yeah, it didn't make sense with Dreamcast either, where 1 component can work with 128 bit values, so they called it a 128 bit console.

Yeah, basically just marketing mumbo-jumbo.




krimszon said:




Thanks for the explanation.

No problem. Ask away if you have any more questions Image




krimszon said:




What I notice, is that the PS has 32 separate registers, isn't that a lot? Is that a pro or a con?

Well, yes, that is quite a lot, but mind you the PS has a RISC processor, which philosophy is to be simple, easy to implement and "orthogonal" (simple principles apply to all instructions, or something), and the abundance of registers fits into that mindset - to compensate for the lack of memory operations. Unlike X86, RISC CPUs can't perform operations on memory values directly, they have to be loaded into registers first. And yes, having that many registers rules :smt045




krimszon said:




My primary interest is for SNES (and maybe GBA), the SNES has only 2 registers, correct?

I have no idea, never did any SNES dev I must admit.




krimszon said:




And last question, if you have a 16 bit register, and a 24 bit address bus (like the snes apparently), doesn't that limit your capabilities for putting an actual 24 bit address on the bus? It can't come from a register, right?

Yes it does limit your capabilities, that's why a multi-level mechanism is used for generating addresses. I'm not sure how it works exactly with the SNES, but I think you must set an 8 bit "page number" in some machine register, and then you can use 16 bit addresses "within" that page. Somewhat similar to X86's real mode addressing, with segments and offsets.




krimszon said:




I'm just starting out with this assembly stuff, so your comments are greatly appreciated!!

Hehe, cool. Yay for assembly :ramen
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by krimszon on Jun 1, 2005:

Yes, very nice to learn. I finally am starting to have an understanding of 'the machine'.

I use this free pdf book called "The Art of Assembly" (get it here: http://webster.cs.ucr.edu/). It covers a lot and comes with nice programs and exercises, but it leaves some things blank, like that thing about addressing you just covered.

I can't wait untill I know enought to get something going on a console!
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by d4s on Jun 1, 2005:

krimszon said:




My primary interest is for SNES (and maybe GBA), the SNES has only 2 registers, correct?

theres 3 registers in total, a, x and y.
whats special about the 65816 is that you can select register size(8/16bit) during runtime for a/mem and x/y individually.
snes has a somewhat fake 24bit adressing.
it consists of a 16bit(64kbyte) adress range + 8bit banks.
the accumulator can access 24bit adresses and jump to 24bit adresses, but sequential code cant overlap these bank borders.
the index registers(x,y) can only access adresses in the 16bit range.
theres an additional data bank register, you can use that to load from 24bit adresses using the index registers.
its annoying, but you'll get used to it eventually.

usually, you just stay in one bank and load from other banks either by indirect indexed 24bit like lda [$00],y, wich only works using the direct page, use the mvn/mvp opcode to move blocks or dma transfers if you want to transfer blocks of data to vram or wram.
you could also do lda $808000,x, but not ldx $808000,y, for example.

if you have any additional questions regarding snes, feel free to ask.
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by OldProgie on Jun 2, 2005:

krimszon said:




Yeah, it didn't make sense with Dreamcast either, where 1 component can work with 128 bit values, so they called it a 128 bit console.

Thanks for the explanation.

What I notice, is that the PS has 32 separate registers, isn't that a lot? Is that a pro or a con?

If you have a lot of registers, you can keep data in the registers and avoid expensive memory access. It can get quite difficult to keep track of though if you use a lot of general purpose registers in hand crafted assembler. Also slows things down if you have to preserve a lot of items on the stack.



krimszon said:




My primary interest is for SNES (and maybe GBA), the SNES has only 2 registers, correct?

2 registers and 1 accumulator (X,Y and A). An accumulator is a special register that allows you to perform math functions on it. In most modern processors, most registers are actually accumulators, but it's an important distinction in 6502 and Z80 processors.
(There are actually a couple of simple math operators for the X and Y regs, such as INX and DEX, but most math functions only worked on A)

The 68000 had 8 16 bit accumulators (d0-d7) and 8 32 bit address registers (a0-a7). The accumulators though were mostly refered to as data registers.

The 68000 was called a 16 bit processor because the accumulators were 16 bits wide, the Z80 and 6502 are 8 bit because they have 8 bit accumulators.

Although the 68008 only had an 8 but external data bus, it is usually still refered to as a 16 bit processor because it still has 16 bit accumulators and internal bus.




krimszon said:




And last question, if you have a 16 bit register, and a 24 bit address bus (like the snes apparently), doesn't that limit your capabilities for putting an actual 24 bit address on the bus? It can't come from a register, right?




Code:

mov bx, 12C6 <-- random 16 bit value
mov ax, [bx] <-- i'd like to put a 24 bit address, but how can I?




In the 80x86 series, you had 4 extra 16 bit segment registers(code, data, stack and extra). These held the top 16 bits of your 24 bit address (the bottom 8 basically being 0). To read/write memory the processor added your address register to your segment register. e.g. address = (ds<<8)+ax

In the 68000, which also had a 24 bit bus, you had a 32 bit address register, but the top 8 bits were essentially ignored. These top 8 bits were usually used as flags.




krimszon said:




I'm just starting out with this assembly stuff, so your comments are greatly appreciated!!

No problem. Everyone should know a little assembler.
 

User avatar
Archive
Posts: 891479
Joined: June 25th, 2019, 11:00 am

16-bit 32-bit I still don't really understand

Post by Archive » June 26th, 2019, 7:56 pm

posted by AntiPasta on Jun 2, 2005:

OldProgie said:




In the 80x86 series, you had 4 extra 16 bit segment registers(code, data, stack and extra). These held the top 16 bits of your 24 bit address (the bottom 8 basically being 0). To read/write memory the processor added your address register to your segment register. e.g. address = (ds<<8)+ax

Well actually it's a bit different, the segment register overlaps with the offset to form a 20 bit address from two 16 bit registers.

And your use of the accumulator width as the "bitness" of the CPU raises an interesting point... what about DSPs with their odd, for instance 42 bit accumulator sizes? Are they 42 bit processors? And would that make FPUs 80 bit or more (internal extra precision bits) or less (64 bit as "preferred" data type)?
 

Locked