On 2/3/25 17:43, ben via cctalk wrote: > On 2025-02-03 5:06 p.m., Chuck Guzis via cctalk wrote: >> On 2/3/25 15:47, ben via cctalk wrote: >>> No compiler generates bad code,just some hardware was never meant to >>> have stack based addressing, like the 6502 or the 8088/8086. >> >> Really? The x86 family does indeed have stack-based addressing. In >> particular, The BP register holds the base of the stack frame and the >> assumed segment is SS. Even the lowly 8085 has some (undocumented) nod >> toward stack addressing. > > Was the X86 family meant for pascal type languages? > Other than the small model, every thing is a hack.
I get the feeling that you haven't done much x86 programming. Look at some real code where arguments are pushed on the stack before a call, local storage is allocated (stack frame) by setting BP, and addressing of any member of the stack can be accomplished with {BP+displacement] addressing. If DS and CS are different, you can address 128KB without issues (why would one want to change the executable code? If you want a private stack area, set SS to something different. To push the point a bit further, one need not have explicit stack hardware if a generous enough register file is provided and register-displacement addressing is implemented. Witness, for example, IBM 370. --Chuck