.sect .text .sect .rom .sect .data .sect .bss .sect .text !THIS FILE CONTAINS THE SYSTEM CALLS FOR PMDS-II AS SUBROUTINES FOR THE !EM-INTERPRETER. a1 CONTAINS A POINTER TO THE RETURN AREA . EACH SUBROUTINE !EXPECTS ITS DATA IN THE FORM EM PRODUCES AND GIVES ITS RESULTS AS EM !REQUIRES. !THE PMDS-II REQUIRES THE ARGUMENTS ON THE STACK AS 4 BYTE INTEGERS OR !POINTERS , AND USES THE C-CALLING CONVENTION. THE 2 BYTE WORDS 4 BYTE !POINTERS VERSION HAS TO DO SOME CONVERSION FIRST . _exit: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 1 _fork: move.l (sp),(a1) trap #0 .data2 2 lea 4(sp),sp bcs 2f tst.l d0 !PID OF CHILD IN PARENT, 0 IN CHILD bne 1f trap #0 .data2 20 mov d1,-(sp) !PID OF PARENT IN d1 mov #1,-(sp) !(PID OF CHILD IN D0),FLAG 1 IN CHILD bra 0f 1: mov d0,-(sp) !PID OF CHILD IN d0 cl -(sp) !FLAG 0 IN PARENT 0: cl -(sp) bra 3f 2: mov d0,-(sp) mov d0,-(sp) 3: move.l (a1),a0 jmp (a0) !_fork is special _read: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 3 sys0: lea 16(sp),sp bcc 1f mov d0,-(sp) mov d0,-(sp) bra 2f 1: move.l d0,-(sp) cl -(sp) 2: move.l (a1),a0 jmp (a0) _write: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 4 bra sys0 _open: move.l (sp),(a1) #ifndef lword bsr st243 #endif trap #0 .data2 5 sys1: lea 12(sp),sp sys5: bcc 1f mov d0,-(sp) mov d0,-(sp) bra 2f 1: mov d0,-(sp) cl -(sp) 2: move.l (a1),a0 jmp (a0) _close: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 6 sys3: lea 8(sp),sp sys4: bcc 1f mov d0,-(sp) mov d0,-(sp) bra 2f 1: cl -(sp) 2: move.l (a1),a0 jmp (a0) _wait: move.l (sp),(a1) trap #0 .data2 7 sys6: lea 4(sp),sp bcc 1f mov d0,-(sp) mov d0,-(sp) bra 2f 1: mov d1,-(sp) ! ?? mov d0,-(sp) cl -(sp) 2: move.l (a1),a0 jmp (a0) _creat: move.l (sp),(a1) #ifndef lword bsr st243 #endif trap #0 .data2 8 bra sys1 _link: move.l (sp),(a1) trap #0 .data2 9 lea 12(sp),sp bra sys4 _unlink: move.l (sp),(a1) trap #0 .data2 10 bra sys3 _chdir: move.l (sp),(a1) trap #0 .data2 12 bra sys3 _mknod: move.l (sp),(a1) #ifndef lword bsr st244 #endif trap #0 .data2 14 lea 16(sp),sp bra sys4 _chmod: move.l (sp),(a1) #ifndef lword bsr st243 #endif trap #0 .data2 15 lea 12(sp),sp bra sys4 _chown: move.l (sp),(a1) #ifndef lword bsr st244 #endif trap #0 .data2 16 lea 16(sp),sp bra sys4 _break: move.l (sp),(a1) trap #0 .data2 17 lea 8(sp),sp bcc 1f mov d0,-(sp) mov d0,-(sp) bra 2f 1: move.l -4(sp),nd cl -(sp) 2: move.l (a1),a0 jmp (a0) .sect .data nd: .data4 endbss .sect .text _stat: move.l (sp),(a1) trap #0 .data2 18 lea 12(sp),sp bra sys4 _lseek: move.l (sp),(a1) #ifndef lword bsr st245 #endif trap #0 .data2 19 lea 16(sp),sp bcc 1f mov d0,-(sp) mov d0,-(sp) bra 2f 1: move.l d0,-(sp) cl -(sp) 2: move.l (a1),a0 jmp (a0) _getpid: move.l (sp),(a1) trap #0 .data2 20 add.l #4,sp mov d0,-(sp) move.l (a1),a0 jmp (a0) _mount: move.l (sp),(a1) #ifndef lword bsr st246 #endif trap #0 .data2 21 lea 16(sp),sp bra sys4 _umount: move.l (sp),(a1) trap #0 .data2 22 bra sys3 _setuid: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 23 bra sys3 _getuid: move.l (sp),(a1) trap #0 .data2 24 sys7: add.l #4,sp mov d1,-(sp) mov d0,-(sp) move.l (a1),a0 jmp (a0) _stime: move.l (sp),(a1) trap #0 .data2 25 bra sys3 _ptrace: move.l (sp),(a1) #ifndef lword bsr st247 #endif trap #0 .data2 26 lea 20(sp),sp bra sys5 _alarm: move.l (sp),(a1) #ifndef lword sub.l #2,sp clr.w 4(sp) #endif trap #0 .data2 27 lea 8(sp),sp mov d0,-(sp) move.l (a1),a0 jmp (a0) _fstat: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 28 lea 12(sp),sp bra sys4 _pause: trap #0 .data2 29 rts _utime: move.l (sp),(a1) trap #0 .data2 30 lea 12(sp),sp bra sys4 _access: move.l (sp),(a1) #ifndef lword bsr st248 #endif trap #0 .data2 33 lea 12(sp),sp bra sys4 _nice: #ifndef lword bsr 241 #endif trap #0 .data2 34 move.l (sp)+,(sp) rts _ftime: move.l (sp),(a1) trap #0 .data2 35 bra sys3 _sync: trap #0 .data2 36 rts _kill: move.l (sp),(a1) #ifndef lword bsr st248 #endif trap #0 .data2 37 lea 12(sp),sp bra sys4 _dup: move.l (sp),(a1) #ifndef lword bsr st248 #endif trap #0 .data2 38 bra sys1 _pipe: move.l (sp),(a1) trap #0 .data2 42 bra sys6 _times: trap #0 .data2 43 move.l (sp),a0 add.l #8,sp jmp (a0) _profil: trap #0 .data2 44 move.l (sp),a0 lea 20(sp),sp jmp (a0) _setgid: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 46 bra sys3 _getgid: move.l (sp),(a1) trap #0 .data2 47 bra sys7 _signal: move.l (sp)+,retaddr mov (sp)+,d4 extend d4 move.l d4,-(sp) move.l retaddr,-(sp) trap #0 .data2 48 lea 12(sp),sp !remove arguments bcc 1f mov d0,-(sp) mov d0,-(sp) bra 2f 1: mov d0,-(sp) cl -(sp) 2: move.l retaddr,a0 jmp (a0) .sect .data retaddr: .data4 0 .sect .text _acct: move.l (sp),(a1) trap #0 .data2 51 bra sys3 _lock: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 53 bra sys3 _ioctl: move.l (sp),(a1) #ifndef lword bsr st248 #endif trap #0 .data2 54 lea 16(sp),sp bra sys4 _mpxcall: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 56 lea 12(sp),sp bra sys4 _exece: move.l (sp),(a1) trap #0 .data2 59 lea 16(sp),sp bra sys4 _umask: move.l (sp),(a1) #ifndef lword bsr st241 #endif trap #0 .data2 60 add.l #8,sp mov d0,-(sp) move.l (a1),a0 jmp (a0) _chroot: move.l (sp),(a1) trap #0 .data2 61 bra sys3 !---------------------------------------------------------------------------- ! STACK ADJUSTMENT FOR THE TWO BYTE INTERPRETER !----------------------------------------------------------------------------- #ifndef lword st241: sub.l #2,sp move.l 2(sp),(sp) move.l 6(sp),4(sp) move.w 10(sp),d0 ext.l d0 move.l d0,8(sp) rts st243: sub.l #2,sp move.l 2(sp),(sp) move.l 6(sp),4(sp) move.l 10(sp),8(sp) move.w 14(sp),d0 ext.l d0 move.l d0,12(sp) rts st244: move.l (sp),-(sp) move.l 8(sp),4(sp) move.l 12(sp),8(sp) move.w 16(sp),d0 ext.l d0 move.l d0,12(sp) move.w 18(sp),d0 ext.l d0 move.l d0,16(sp) rts st245: move.l (sp),-(sp) move.l 8(sp),4(sp) move.w 12(sp),d0 ext.l d0 move.l d0,8(sp) move.l 14(sp),12(sp) move.w 18(sp),d0 ext.l d0 move.l d0,16(sp) rts st246: sub.l #2,sp move.l 2(sp),(sp) move.l 6(sp),4(sp) move.l 10(sp),8(sp) move.l 14(sp),12(sp) move.w 18(sp),d0 ext.l d0 move.l d0,16(sp) rts st247: sub.l #6,sp move.l 6(sp),(sp) move.l 10(sp),4(sp) move.w 14(sp),d0 ext.l d0 move.l d0,8(sp) move.w 16(sp),d0 ext.l d0 move.l d0,12(sp) move.l 18(sp),16(sp) move.w 22(sp),d0 ext.l d0 move.l d0,20(sp) rts st248: move.l (sp),-(sp) move.l 8(sp),4(sp) move.w 12(sp),d0 ext.l d0 move.l d0,8(sp) move.w 14(sp),d0 ext.l d0 move.l d0,12(sp) rts #endif