1 ; **************************************************************************** 2 ; inittest.s (init386.s) 3 ; ---------------------------------------------------------------------------- 4 ; 5 ; Retro UNIX 386 v1.2 Kernel - /etc/init file executing test (30/11/2021) 6 ; 7 ; [ Last Modification: 04/12/2021 ] 8 ; 9 ; **************************************************************************** 10 ; (modified from 'init0.s', 24/10/2015, Retro UNIX 386 v1 /etc/init test file) 11 ; ---------------------------------------------------------------------------- 12 ; nasm inittest.s -l inittest.txt -o init386 -Z error.txt 13 14 ; 04/12/2021 15 ; 30/11/2021 16 ; 21/09/2015 17 ; 07/08/2015 18 ; 30/06/2015 19 ; 14/07/2013 20 ; UNIX v1 system calls 21 _rele equ 0 22 _exit equ 1 23 _fork equ 2 24 _read equ 3 25 _write equ 4 26 _open equ 5 27 _close equ 6 28 _wait equ 7 29 _creat equ 8 30 _link equ 9 31 _unlink equ 10 32 _exec equ 11 33 _chdir equ 12 34 _time equ 13 35 _mkdir equ 14 36 _chmod equ 15 37 _chown equ 16 38 _break equ 17 39 _stat equ 18 40 _seek equ 19 41 _tell equ 20 42 _mount equ 21 43 _umount equ 22 44 _setuid equ 23 45 _getuid equ 24 46 _stime equ 25 47 _quit equ 26 48 _intr equ 27 49 _fstat equ 28 50 _emt equ 29 51 _mdate equ 30 52 _stty equ 31 53 _gtty equ 32 54 _ilgins equ 33 55 _sleep equ 34 ; Retro UNIX 8086 v1 feature only ! 56 _msg equ 35 ; Retro UNIX 386 v1 feature only ! 57 _getrr equ 36 ; Retro UNIX 386 v1 feature only ! 58 _test equ 37 ; Retro UNIX 386 v1.2 test !!! 59 60 %macro sys 1-4 61 ; 13/04/2015 62 ; Retro UNIX 386 v1 system call. 63 mov eax, %1 64 %if %0 >= 2 65 mov ebx, %2 66 %if %0 >= 3 67 mov ecx, %3 68 %if %0 = 4 69 mov edx, %4 70 %endif 71 %endif 72 %endif 73 int 30h 74 %endmacro 75 76 [BITS 32] ; We need 32-bit intructions for protected mode 77 78 [ORG 0] 79 80 START_CODE: 81 sys _test ; 04/12/2021 82 <1> 83 <1> 84 00000000 B825000000 <1> mov eax, %1 85 <1> %if %0 >= 2 86 <1> mov ebx, %2 87 <1> %if %0 >= 3 88 <1> mov ecx, %3 89 <1> %if %0 = 4 90 <1> mov edx, %4 91 <1> %endif 92 <1> %endif 93 <1> %endif 94 00000005 CD30 <1> int 30h 95 ;sys _msg, copy_right_msg, 255, 0Fh ; copy right message with white color 96 sys _msg, running_msg, sizeof_msg, 0Fh 97 <1> 98 <1> 99 00000007 B823000000 <1> mov eax, %1 100 <1> %if %0 >= 2 101 0000000C BB[27000000] <1> mov ebx, %2 102 <1> %if %0 >= 3 103 00000011 B98D000000 <1> mov ecx, %3 104 <1> %if %0 = 4 105 00000016 BA0F000000 <1> mov edx, %4 106 <1> %endif 107 <1> %endif 108 <1> %endif 109 0000001B CD30 <1> int 30h 110 111 sys _exit 112 <1> 113 <1> 114 0000001D B801000000 <1> mov eax, %1 115 <1> %if %0 >= 2 116 <1> mov ebx, %2 117 <1> %if %0 >= 3 118 <1> mov ecx, %3 119 <1> %if %0 = 4 120 <1> mov edx, %4 121 <1> %endif 122 <1> %endif 123 <1> %endif 124 00000022 CD30 <1> int 30h 125 126 haltsys: 127 00000024 F4 hlt 128 00000025 EBFD jmp short haltsys 129 130 ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 131 ; messages 132 ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 133 134 running_msg: 135 ;db 0Dh, 0Ah, 07h 136 00000027 0D0A db 0Dh, 0Ah ; 04/12/2021 137 00000029 526574726F20554E49- db 'Retro UNIX 386 v1.2 Kernel Function Test : Function is OK!' 138 00000032 58203338362076312E- 139 0000003B 32204B65726E656C20- 140 00000044 46756E6374696F6E20- 141 0000004D 54657374203A203C73- 142 00000056 7973657865633E2046- 143 0000005F 756E6374696F6E2069- 144 00000068 73204F4B21 145 0000006D 0D0A db 0Dh, 0Ah 146 0000006F 0D0A db 0Dh, 0Ah 147 00000071 526574726F20554E49- db 'Retro UNIX 386 v1.2 loading and running test is OK!' 148 0000007A 58203338362076312E- 149 00000083 32203C2F6574632F69- 150 0000008C 6E69743E206C6F6164- 151 00000095 696E6720616E642072- 152 0000009E 756E6E696E67207465- 153 000000A7 7374206973204F4B21 154 000000B0 0D0A db 0Dh, 0Ah 155 000000B2 0D0A db 0Dh, 0Ah 156 sizeof_msg equ $ - running_msg 157 000000B4 00 db 0 158 159 copy_right_msg: 160 000000B5 286329204572646F67- db '(c) Erdogan TAN - 04/12/2021' 161 000000BE 616E2054414E202D20- 162 000000C7 30342F31322F323032- 163 000000D0 31 164 000000D1 0D0A00 db 0Dh, 0Ah, 0