4 ms·
> He did, however, find at least 22 system calls — the types of actions that send/receive text from a printer, phone, hard disk, etc. — that had the same functi
by nailer 10y ago
> He did, however, find at least 22 system calls — the types of actions that send/receive text from a printer, phone, hard disk, etc. — that had the same function (and function number) as the CP/M code.
Older programmers: what are function numbers? Thanks.
- jstanley 10y agoMy guess is they are referring to software interrupt numbers. https://en.wikipedia.org/wiki/MS-DOS_API#Interrupt_vectors_used_by_DOS https://en.wikipedia.org/wiki/MS-DOS_API#Interrupt_vectors_u... In my opinion it's unsurprising that they would be the same as in CP/M.
- EvanAnderson 10y agoThe real-mode DOS system call interface is based on loading a function number into the AH register, other arguments in other registers, and calling interrupt 21h. I haven't used CP/M before, but it sounds like the DOS function numbers must be numbered in a similar fashion as their CP/M equivalents. Edit: This list of BDOS system calls bears a passing resemblance, based on my foggy memory, to some of the interrupt 21h calls I remember: http://www.seasip.info/Cpm/bdos.html http://www.seasip.info/Cpm/bdos.html The conventions with arguments in registers is different, however.
- linker3000 10y agoFrom a link I posted in response to another comment about the calls: [SNIP] ;********************************************************** ;* * ;* Get the time from DOS * ;* * ;********************************************************** MOV AH,2CH ;Set up DOS call to get the current time INT 21H ;And go get it! [SNIP] MOV AX,04C00 ;Return to DOS INT 21H
- revelation 10y agoThat is still how syscalls work today, you only have a limited number of interrupts but possibly many more system calls so what Linux used to do is use 0x80 for the syscall interrupt and then you just specify in a register the index (or function number) of what syscall you actually wanted to invoke. Nowadays processors have a dedicated "syscall" instruction but it has no operands so you still pass the actual index of the syscall you want in a register.
- JoeAltmaier 10y agoI worked on an OS that did it differently. On the 8086, addresses were constructed by adding the segment and offset (shifted by 4 bits). SO there were 4096 combinations that resolved to the same location. We used those combinations to call into the OS app entry point. The particular combination indicated which function. The stack used the normal calling convention. So no icky trap entry points to code around - just call the OS directly! It was slick.
- EvanAnderson 10y agoThat's pretty ingenious. Can you share any other details about the OS?
- JoeAltmaier 10y agoIt was called, unimaginatively, 'CTOS' for "Convergent Technologies OS". When the 286 came along the original syscall trick quit working, so we invented another one. We simply used an invalid segment and trapped; the offset became the function number. Otherwise it worked identically. CTOS was message-passing. All system calls were for timers, memory or message manipulation. The messages were a tiny header including a 'request code', some scalar arguments and a set of buffers. OpenFile, Read, everything. On the top of the OS were Services that received messages. There was an OS message dispatch mechanism where Services registered for particular message codes. So the client Sending a message didn't know where their message would end up. The original feature that made money was the 'diskless workstation'. The file system codes were dispatched to Client Agent that simply packaged them up and sent them to a designated Server. Brought down the client workstation cost dramatically.
- EvanAnderson 10y agoVery interesting! I worked around a number of CTOS-based machines in a Unisys-based financial environment in the late 90s. I was responsible for the "PC" portion of the network. The CTOS-systems all fell on the "Unisys-side", where we plebeian non-Unisys vendors weren't permitted to work! I was always interested in the CTOS machines but never got a chance to mess around with any of them. Sounds like it might have been a lot of fun.
- anthonybsd 10y agoThey are most probably talking about interrupt handlers.