     1                                  ; ****************************************************************************
     2                                  ; clock386.s (Retro Unix 386 v1) - 'clock' prints current date & time
     3                                  ; ----------------------------------------------------------------------------
     4                                  ;
     5                                  ; RETRO UNIX 386 (Retro Unix == Turkish Rational Unix)
     6                                  ; Operating System Project (v0.2) by ERDOGAN TAN (Beginning: 24/12/2013)
     7                                  ;
     8                                  ; Retro UNIX 8086 v1 - 'clock.asm' file
     9                                  ;
    10                                  ; Derived from 'Retro UNIX 8086 v1' source code by Erdogan Tan
    11                                  ; (v0.1 - Beginning: 11/07/2012)
    12                                  ;
    13                                  ; [ Last Modification: 18/11/2015 ]
    14                                  ;
    15                                  ; Derived from UNIX Operating System (v1.0 for PDP-11) 
    16                                  ; (Original) Source Code by Ken Thompson (Bell Laboratories, 1971-1972)
    17                                  ; ****************************************************************************
    18                                  ;
    19                                  ; clock0.s (17/10/2015, Retro UNIX 386 v1, NASM 2.11, 32 bit version)
    20                                  ; CLOCK.ASM, 12/12/2013 - 17/01/2014 (Retro UNIX 8086 v1, MASM 6.11) 
    21                                  ; 17/10/2015
    22                                  
    23                                  ; UNIX v1 system calls
    24                                  _rele 	equ 0
    25                                  _exit 	equ 1
    26                                  _fork 	equ 2
    27                                  _read 	equ 3
    28                                  _write	equ 4
    29                                  _open	equ 5
    30                                  _close 	equ 6
    31                                  _wait 	equ 7
    32                                  _creat 	equ 8
    33                                  _link 	equ 9
    34                                  _unlink	equ 10
    35                                  _exec	equ 11
    36                                  _chdir	equ 12
    37                                  _time 	equ 13
    38                                  _mkdir 	equ 14
    39                                  _chmod	equ 15
    40                                  _chown	equ 16
    41                                  _break	equ 17
    42                                  _stat	equ 18
    43                                  _seek	equ 19
    44                                  _tell 	equ 20
    45                                  _mount	equ 21
    46                                  _umount	equ 22
    47                                  _setuid	equ 23
    48                                  _getuid	equ 24
    49                                  _stime	equ 25
    50                                  _quit	equ 26	
    51                                  _intr	equ 27
    52                                  _fstat	equ 28
    53                                  _emt 	equ 29
    54                                  _mdate 	equ 30
    55                                  _stty 	equ 31
    56                                  _gtty	equ 32
    57                                  _ilgins	equ 33
    58                                  _sleep	equ 34 ; Retro UNIX 8086 v1 feature only !
    59                                  _msg    equ 35 ; Retro UNIX 386 v1 feature only !
    60                                  
    61                                  %macro sys 1-4
    62                                      ; 03/09/2015	
    63                                      ; 13/04/2015
    64                                      ; Retro UNIX 386 v1 system call.		
    65                                      %if %0 >= 2   
    66                                          mov ebx, %2
    67                                          %if %0 >= 3    
    68                                              mov ecx, %3
    69                                              %if %0 = 4
    70                                                 mov edx, %4   
    71                                              %endif
    72                                          %endif
    73                                      %endif
    74                                      mov eax, %1
    75                                      int 30h	   
    76                                  %endmacro
    77                                  
    78                                  ; Retro UNIX 386 v1 system call format:
    79                                  ; sys systemcall (eax) <arg1 (ebx)>, <arg2 (ecx)>, <arg3 (edx)>
    80                                  
    81                                  [BITS 32] ; We need 32-bit intructions for protected mode
    82                                  
    83                                  [ORG 0] 
    84                                  
    85                                  START_CODE:
    86                                  	sys	_write, 1, b_dt_txt, dt_size+1
    87                              <1> 
    88                              <1> 
    89                              <1> 
    90                              <1>  %if %0 >= 2
    91 00000000 BB01000000          <1>  mov ebx, %2
    92                              <1>  %if %0 >= 3
    93 00000005 B9[F2020000]        <1>  mov ecx, %3
    94                              <1>  %if %0 = 4
    95 0000000A BA19000000          <1>  mov edx, %4
    96                              <1>  %endif
    97                              <1>  %endif
    98                              <1>  %endif
    99 0000000F B804000000          <1>  mov eax, %1
   100 00000014 CD30                <1>  int 30h
   101                                  	;jc	short terminate
   102                                  	sys	_gtty, 0, 1 ; get console tty, cursor position
   103                              <1> 
   104                              <1> 
   105                              <1> 
   106                              <1>  %if %0 >= 2
   107 00000016 BB00000000          <1>  mov ebx, %2
   108                              <1>  %if %0 >= 3
   109 0000001B B901000000          <1>  mov ecx, %3
   110                              <1>  %if %0 = 4
   111                              <1>  mov edx, %4
   112                              <1>  %endif
   113                              <1>  %endif
   114                              <1>  %endif
   115 00000020 B820000000          <1>  mov eax, %1
   116 00000025 CD30                <1>  int 30h
   117                                  	;jc	short terminate
   118 00000027 A2[0C030000]                    mov     [ttynum], al
   119 0000002C 3C07                    	cmp	al, 7 
   120 0000002E 760B                    	jna	short x1
   121 00000030 66C705[F3020000]07-     	mov	word [dt_txt], 0D07h
   122 00000038 0D                 
   123 00000039 EB09                    	jmp	short clk0
   124                                  x1:
   125 0000003B 66891D[F0020000]        	mov 	[cursor_pos], bx ; cursor position
   126 00000042 31D2                    	xor	edx, edx ; 0
   127                                  clk0:
   128                                  	sys 	_time
   129                              <1> 
   130                              <1> 
   131                              <1> 
   132                              <1>  %if %0 >= 2
   133                              <1>  mov ebx, %2
   134                              <1>  %if %0 >= 3
   135                              <1>  mov ecx, %3
   136                              <1>  %if %0 = 4
   137                              <1>  mov edx, %4
   138                              <1>  %endif
   139                              <1>  %endif
   140                              <1>  %endif
   141 00000044 B80D000000          <1>  mov eax, %1
   142 00000049 CD30                <1>  int 30h
   143                                  	; EAX = Unix epoch time
   144 0000004B 39D0                    	cmp	eax, edx
   145 0000004D 0F8495000000                    je      clk4
   146                                  clk1:
   147 00000053 50                      	push	eax ; current time
   148 00000054 E898000000              	call	ctime
   149                                  	sys	_write, 1, cbuf, 25
   150                              <1> 
   151                              <1> 
   152                              <1> 
   153                              <1>  %if %0 >= 2
   154 00000059 BB01000000          <1>  mov ebx, %2
   155                              <1>  %if %0 >= 3
   156 0000005E B9[D6020000]        <1>  mov ecx, %3
   157                              <1>  %if %0 = 4
   158 00000063 BA19000000          <1>  mov edx, %4
   159                              <1>  %endif
   160                              <1>  %endif
   161                              <1>  %endif
   162 00000068 B804000000          <1>  mov eax, %1
   163 0000006D CD30                <1>  int 30h
   164                                  	sys	_gtty, 0, 0
   165                              <1> 
   166                              <1> 
   167                              <1> 
   168                              <1>  %if %0 >= 2
   169 0000006F BB00000000          <1>  mov ebx, %2
   170                              <1>  %if %0 >= 3
   171 00000074 B900000000          <1>  mov ecx, %3
   172                              <1>  %if %0 = 4
   173                              <1>  mov edx, %4
   174                              <1>  %endif
   175                              <1>  %endif
   176                              <1>  %endif
   177 00000079 B820000000          <1>  mov eax, %1
   178 0000007E CD30                <1>  int 30h
   179 00000080 6609DB                  	or	bx, bx
   180 00000083 741F                    	jz	short clk2
   181                                  	sys	_read, 0, chr, 1
   182                              <1> 
   183                              <1> 
   184                              <1> 
   185                              <1>  %if %0 >= 2
   186 00000085 BB00000000          <1>  mov ebx, %2
   187                              <1>  %if %0 >= 3
   188 0000008A B9[0B030000]        <1>  mov ecx, %3
   189                              <1>  %if %0 = 4
   190 0000008F BA01000000          <1>  mov edx, %4
   191                              <1>  %endif
   192                              <1>  %endif
   193                              <1>  %endif
   194 00000094 B803000000          <1>  mov eax, %1
   195 00000099 CD30                <1>  int 30h
   196 0000009B 803D[0B030000]1B        	cmp	byte [chr], 1Bh ; ESC key
   197 000000A2 743C                    	je	short clk3 ; exit
   198                                  clk2:
   199 000000A4 803D[0C030000]08        	cmp	byte [ttynum], 8
   200 000000AB 7218                    	jb	short clk_pt
   201                                  	sys	_write, 1, dt_txt, dt_size
   202                              <1> 
   203                              <1> 
   204                              <1> 
   205                              <1>  %if %0 >= 2
   206 000000AD BB01000000          <1>  mov ebx, %2
   207                              <1>  %if %0 >= 3
   208 000000B2 B9[F3020000]        <1>  mov ecx, %3
   209                              <1>  %if %0 = 4
   210 000000B7 BA18000000          <1>  mov edx, %4
   211                              <1>  %endif
   212                              <1>  %endif
   213                              <1>  %endif
   214 000000BC B804000000          <1>  mov eax, %1
   215 000000C1 CD30                <1>  int 30h
   216 000000C3 EB15                    	jmp	short x2
   217                                  clk_pt:
   218 000000C5 668B15[F0020000]        	mov	dx, [cursor_pos]
   219 000000CC 66B9FFFF                	mov	cx, 0FFFFh ; set cursor position only
   220 000000D0 6631DB                  	xor 	bx, bx ; set for console tty
   221                                  	sys	_stty
   222                              <1> 
   223                              <1> 
   224                              <1> 
   225                              <1>  %if %0 >= 2
   226                              <1>  mov ebx, %2
   227                              <1>  %if %0 >= 3
   228                              <1>  mov ecx, %3
   229                              <1>  %if %0 = 4
   230                              <1>  mov edx, %4
   231                              <1>  %endif
   232                              <1>  %endif
   233                              <1>  %endif
   234 000000D3 B81F000000          <1>  mov eax, %1
   235 000000D8 CD30                <1>  int 30h
   236                                  x2:
   237 000000DA 5A                      	pop	edx ; current time -> previous time
   238 000000DB E964FFFFFF                      jmp     clk0 
   239                                  clk3:
   240 000000E0 58                      	pop	eax
   241                                  terminate:
   242                                  	sys	_exit
   243                              <1> 
   244                              <1> 
   245                              <1> 
   246                              <1>  %if %0 >= 2
   247                              <1>  mov ebx, %2
   248                              <1>  %if %0 >= 3
   249                              <1>  mov ecx, %3
   250                              <1>  %if %0 = 4
   251                              <1>  mov edx, %4
   252                              <1>  %endif
   253                              <1>  %endif
   254                              <1>  %endif
   255 000000E1 B801000000          <1>  mov eax, %1
   256 000000E6 CD30                <1>  int 30h
   257                                  clk4:
   258 000000E8 90                      	nop
   259 000000E9 90                      	nop
   260 000000EA 90                      	nop
   261 000000EB 90                      	nop
   262 000000EC E953FFFFFF                      jmp     clk0 
   263                                  
   264                                  %include 'ctime386.inc'
   265                              <1> ; ****************************************************************************
   266                              <1> ; ctime386.inc (Retro Unix 386 v1 - /bin/ls - list file or directory)
   267                              <1> ; ----------------------------------------------------------------------------
   268                              <1> ; RETRO UNIX 386 (Retro Unix == Turkish Rational Unix)
   269                              <1> ; Operating System Project (v0.2) by ERDOGAN TAN (Beginning: 24/12/2013)
   270                              <1> ;
   271                              <1> ; [ Last Modification: 06/10/2015 ]
   272                              <1> ;
   273                              <1> ; Derived from 'CTIME.INC' source code file of 'Retro UNIX 8086 v1'
   274                              <1> ; operating system project, /bin/ls source code by Erdogan Tan
   275                              <1> ; (28/11/2013)
   276                              <1> ;
   277                              <1> ; Derived from 'ctime.c' file of original UNIX v5 (usr/source/s3/ctime.c)
   278                              <1> ;
   279                              <1> ; ls386.s (ls0.s) 23/09/2015 - 06/10/2015
   280                              <1> ; include ctime386.inc
   281                              <1> ;
   282                              <1> ; ****************************************************************************
   283                              <1> 
   284                              <1> ; Assembler: NASM 2.11
   285                              <1> 
   286                              <1> ;timezone equ 5*60*60
   287                              <1> 
   288                              <1> 
   289                              <1> ctime:  ; ctime(at)
   290                              <1> 	; int *at;
   291                              <1> 	; {
   292                              <1> 	; 	return(asctime(localtime(at)));
   293                              <1> 	; }
   294                              <1> 
   295                              <1> 	; EAX = unix epoch time (in seconds)
   296                              <1> 
   297                              <1> 	;call localtime
   298                              <1> 	;call asctime
   299                              <1> 
   300                              <1> 	;retn
   301                              <1>   
   302                              <1> localtime:
   303                              <1> 	; localtime(tim)
   304                              <1> 	; int tim[];
   305                              <1> 	; 	{
   306                              <1> 	;		register int *t, *ct, dayno;
   307                              <1> 	;	int daylbegin, daylend;
   308                              <1> 	;	int copyt[2];
   309                              <1> 	;	t = copyt;
   310                              <1> 	;	t[0] = tim[0];
   311                              <1> 	;	t[1] = tim[1];
   312                              <1> 	;	dpadd(t, -timezone);
   313                              <1> 	;	ct = gmtime(t);
   314                              <1> 	;	dayno = ct[YDAY];
   315                              <1> 	;	if (nixonflg && (ct[YEAR]>74 || ct[YEAR]==74 && (dayno > 5 ||
   316                              <1> 	;	    dayno==5 && ct[HOUR]>=2))) {
   317                              <1> 	;		daylight =| 1;
   318                              <1> 	;		daylbegin = -1;
   319                              <1> 	;		daylend = 367;
   320                              <1> 	;	} else {
   321                              <1> 	;		daylbegin = sunday(ct, 119);	/* last Sun in Apr */
   322                              <1> 	;		daylend = sunday(ct, 303);	/* last Sun in Oct */
   323                              <1> 	;	}
   324                              <1> 	;	if (daylight &&
   325                              <1> 	;	    (dayno>daylbegin || (dayno==daylbegin && ct[HOUR]>=2)) &&
   326                              <1> 	;	    (dayno<daylend || (dayno==daylend && ct[HOUR]<1))) {
   327                              <1> 	;		dpadd(t, 1*60*60);
   328                              <1> 	;		ct = gmtime(t);
   329                              <1> 	;		ct[ISDAY]++;
   330                              <1> 	;	}
   331                              <1> 	;	return(ct);
   332                              <1> 	;	}
   333                              <1> 
   334                              <1> 	;sub	eax, timezone	
   335                              <1> 
   336                              <1> 	;push	eax
   337                              <1> 
   338 000000F1 E885000000          <1> 	call 	gmtime
   339                              <1> ; if (nixonflg && (ct[YEAR]>74 || ct[YEAR]==74 && (dayno > 5 ||
   340                              <1> ;     dayno==5 && ct[HOUR]>=2))) {
   341                              <1> 	;cmp	byte [nixonflg], 0
   342                              <1> 	;jna	short lt1
   343                              <1> 	;cmp	word [year], 1974
   344                              <1> 	;jb	short lt1
   345                              <1> 	;ja	short lt0
   346                              <1> 	;cmp	word [yday], 5
   347                              <1> 	;jb	short lt1
   348                              <1> 	;ja	short lt0 
   349                              <1> 	;cmp	word [hour], 2
   350                              <1> 	;jb	short lt1
   351                              <1> ; nixonflag > 0
   352                              <1> ;lt0:
   353                              <1> 	;mov	word [daylight], 1
   354                              <1> 	;mov	word [daylbegin], -1
   355                              <1> 	;mov	word [daylend], 367
   356                              <1> ;	;jmp	short lt2
   357                              <1> 
   358                              <1> ; } else {
   359                              <1> ;lt1:
   360                              <1> ;	mov	cx, 119
   361                              <1> ;	call	sunday ; sunday(ct, 119); /* last Sun in Apr */
   362                              <1> ;	mov	[daylbegin], cx
   363                              <1> ;	mov	cx, 303
   364                              <1> ;	call	sunday ; sunday(ct, 303); /* last Sun in Oct */	
   365                              <1> ;	mov	[daylend], cx
   366                              <1> ;lt2:
   367                              <1> ; if (daylight &&
   368                              <1> ;    (dayno>daylbegin || (dayno==daylbegin && ct[HOUR]>=2)) &&
   369                              <1> ;    (dayno<daylend || (dayno==daylend && ct[HOUR]<1))) {
   370                              <1> 
   371                              <1> ;	pop	eax
   372                              <1> 
   373                              <1> 	;cmp	byte [daylight], 0
   374                              <1> 	;jna	short lt5
   375                              <1> 	
   376                              <1> 	;mov	cx, [yday]
   377                              <1> 
   378                              <1> 	;cmp	cx, [daylbegin]
   379                              <1> 	;jb	short lt5
   380                              <1> 	;ja	short lt3
   381                              <1> 	;cmp	word [hour], 2
   382                              <1> 	;jb	short lt5
   383                              <1> 	;jmp	short lt4
   384                              <1> ;lt3:
   385                              <1> 	;cmp	cx, [daylend]
   386                              <1> 	;jb	short lt4
   387                              <1> 	;ja	short lt5
   388                              <1> 	;cmp	word [hour], 1
   389                              <1> 	;jnb	short lt5
   390                              <1> ;lt4:
   391                              <1> 	;add	eax, 1*60*60
   392                              <1> 	;call	gmtime
   393                              <1> 	;inc	word [isday]
   394                              <1> ;lt5:
   395                              <1> ;	}
   396                              <1> ;	return(ct);
   397                              <1> ;	}
   398                              <1> 
   399                              <1> 	;retn
   400                              <1> 
   401                              <1> 
   402                              <1> asctime:
   403                              <1> 	; asctime(t)
   404                              <1> 	;int *t;
   405                              <1> 	;{
   406                              <1> 	;	register char *cp, *ncp;
   407                              <1> 	;	register int *tp;
   408                              <1> 	;
   409                              <1> 	;	cp = cbuf;
   410                              <1> 	;	for (ncp = "Day Mon 00 00:00:00 1900\n"; *cp++ = *ncp++;);
   411                              <1> 	;	ncp = &"SunMonTueWedThuFriSat"[3*t[6]];
   412                              <1> 	;	cp = cbuf;
   413                              <1> 	;	*cp++ = *ncp++;
   414                              <1> 	;	*cp++ = *ncp++;
   415                              <1> 	;	*cp++ = *ncp++;
   416                              <1> 	;	cp++;
   417                              <1> 	;	tp = &t[4];
   418                              <1> 	;	ncp = &"JanFebMarAprMayJunJulAugSepOctNovDec"[(*tp)*3];
   419                              <1> 	;	*cp++ = *ncp++;
   420                              <1> 	;	*cp++ = *ncp++;
   421                              <1> 	;	*cp++ = *ncp++;
   422                              <1> 	;	cp = numb(cp, *--tp);
   423                              <1> 	;	cp = numb(cp, *--tp+100);
   424                              <1> 	;	cp = numb(cp, *--tp+100);
   425                              <1> 	;	cp = numb(cp, *--tp+100);
   426                              <1> 	;	cp =+ 2;
   427                              <1> 	;	cp = numb(cp, t[YEAR]);
   428                              <1> 	;	return(cbuf);
   429                              <1> 	;}
   430                              <1> 	
   431                              <1> 	;;mov	edi, cbuf
   432                              <1> 	;;mov	esi, ncp0
   433                              <1> 	;;mov	ecx, 13
   434                              <1> 	;;movsw	
   435                              <1> 	;
   436 000000F6 BF[D6020000]        <1> 	mov	edi, cbuf	
   437                              <1> 	;movzx	esi, word [wday]
   438                              <1> 	;shl	si, 2
   439                              <1> 	;add	esi, ncp1
   440                              <1> 	;movsd
   441 000000FB 0FB735[6C020000]    <1> 	movzx	esi, word [month]
   442 00000102 66C1E602            <1> 	shl	si, 2
   443 00000106 81C6[A2020000]      <1> 	add	esi, ncp2 - 4
   444 0000010C A5                  <1> 	movsd
   445                              <1> 	;movzx eax, word [day]
   446 0000010D 66A1[6A020000]      <1> 	mov	ax, [day]
   447                              <1> 	;mov	cx, 10
   448 00000113 B10A                <1> 	mov	cl, 10
   449 00000115 E831010000          <1> 	call	numb
   450 0000011A B020                <1>  	mov	al, 20h
   451 0000011C AA                  <1> 	stosb
   452                              <1> 	;
   453 0000011D 66A1[6E020000]      <1> 	mov	ax, [year]
   454 00000123 B564                <1> 	mov	ch, 100
   455 00000125 F6F5                <1> 	div	ch
   456 00000127 6650                <1> 	push	ax ;
   457 00000129 6698                <1> 	cbw ; century (19, 20)
   458 0000012B E81B010000          <1> 	call	numb
   459 00000130 6658                <1> 	pop	ax
   460 00000132 88E0                <1> 	mov	al, ah
   461 00000134 6698                <1> 	cbw ;	year (0 to 99)
   462 00000136 E810010000          <1> 	call	numb
   463 0000013B B020                <1> 	mov 	al, 20h
   464 0000013D AA                  <1> 	stosb
   465                              <1> 	;
   466 0000013E 0FB735[70020000]    <1>         movzx   esi, word [wday]
   467 00000145 66C1E602            <1> 	shl	si, 2
   468 00000149 81C6[8A020000]      <1> 	add	esi, ncp1
   469 0000014F A5                  <1> 	movsd
   470                              <1> 	;
   471 00000150 66A1[68020000]      <1> 	mov	ax, [hour]
   472 00000156 E8F0000000          <1> 	call	numb
   473 0000015B B03A                <1>  	mov	al, ':'
   474 0000015D AA                  <1> 	stosb
   475 0000015E 66A1[66020000]      <1> 	mov	ax, [minute]
   476 00000164 E8E2000000          <1> 	call	numb
   477 00000169 B03A                <1>  	mov	al, ':'
   478 0000016B AA                  <1> 	stosb
   479 0000016C 66A1[64020000]      <1> 	mov	ax, [second]
   480 00000172 E8D4000000          <1> 	call	numb
   481 00000177 B020                <1>  	mov	al, 20h
   482 00000179 AA                  <1> 	stosb
   483                              <1> 	;mov	ax, [year]
   484                              <1> 	;mov	ch, 100
   485                              <1> 	;div	ch
   486                              <1> 	;push	ax ;
   487                              <1> 	;cbw ; century (19, 20)
   488                              <1> 	;call	numb
   489                              <1> 	;pop	ax
   490                              <1> 	;mov	al, ah
   491                              <1> 	;cbw ;	year (0 to 99)
   492                              <1> 	;call	numb
   493                              <1> 	;mov	al, 20h
   494                              <1> 	;stosb
   495                              <1> 	;xor	al, al
   496                              <1> 	;stosb
   497                              <1> 
   498 0000017A C3                  <1> 	retn
   499                              <1> 
   500                              <1> gmtime:
   501                              <1> 	; 24/11/2013 (yday, wday)
   502                              <1> 	; Retro UNIX 8086 v1 - UNIX.ASM (20/06/2013)
   503                              <1> 	; Retro UNIX 8086 v1 feature/procedure only!
   504                              <1> 	; 'convert_from_epoch' procedure prototype: 
   505                              <1> 	; 	            UNIXCOPY.ASM, 10/03/2013
   506                              <1> 	; 30/11/2012
   507                              <1> 	; Derived from DALLAS Semiconductor
   508                              <1> 	; Application Note 31 (DS1602/DS1603)
   509                              <1> 	; 6 May 1998
   510                              <1> 	;
   511                              <1> 	; INPUT:
   512                              <1> 	; DX:AX = Unix (Epoch) Time
   513                              <1> 	;
   514                              <1> 	; ((Modified registers: AX, DX, CX, BX))  
   515                              <1> 	;
   516 0000017B 31D2                <1> 	xor edx, edx
   517 0000017D B93C000000          <1> 	mov ecx, 60
   518 00000182 F7F1                <1> 	div ecx
   519                              <1> 	;mov [imin], eax     	  ; whole minutes
   520                              <1> 				  ; since 1/1/1970
   521 00000184 668915[64020000]    <1> 	mov [second], dx  	  ; leftover seconds
   522                              <1> 	; mov ecx, 60
   523 0000018B 29D2                <1> 	sub edx, edx
   524 0000018D F7F1                <1> 	div ecx
   525                              <1> 	;mov [ihrs], eax   	  ; whole hours
   526                              <1> 				  ; since 1/1/1970
   527 0000018F 668915[66020000]    <1> 	mov [minute], dx  	  ; leftover minutes
   528                              <1> 	;mov ecx, 24
   529 00000196 31D2                <1> 	xor edx, edx
   530 00000198 B118                <1> 	mov cl, 24
   531 0000019A F7F1                <1> 	div ecx
   532                              <1> 	;mov [iday], ax  	  ; whole days
   533                              <1> 				  ; since 1/1/1970
   534 0000019C 66A3[70020000]      <1> 	mov [wday], ax 		  ; 24/11/2013	
   535 000001A2 668915[68020000]    <1> 	mov [hour], dx   	  ; leftover hours
   536 000001A9 05DB020000          <1> 	add eax, 365+366	  ; whole day since
   537                              <1> 				  ; 1/1/1968 	
   538                              <1> 	;mov [iday], ax
   539 000001AE 50                  <1> 	push eax
   540 000001AF 66B9B505            <1> 	mov cx, (4*365)+1	  ; 4 years = 1461 days
   541 000001B3 29D2                <1> 	sub edx, edx
   542 000001B5 F7F1                <1> 	div ecx
   543 000001B7 59                  <1> 	pop ecx
   544                              <1> 	;mov [lday], ax  	  ; count of quadyrs (4 years)
   545 000001B8 52                  <1> 	push edx
   546                              <1> 	;mov [qday], dx           ; days since quadyr began
   547 000001B9 6683FA3C            <1> 	cmp dx, 31 + 29           ; if past feb 29 then
   548 000001BD F5                  <1> 	cmc			  ; add this quadyr's leap day
   549 000001BE 83D000              <1> 	adc eax, 0		  ; to # of qadyrs (leap days)
   550                              <1> 	;mov [lday], ax  	  ; since 1968			  
   551                              <1> 	;mov cx, [iday]
   552 000001C1 91                  <1> 	xchg ecx, eax		  ; CX = lday, AX = iday		  
   553 000001C2 29C8                <1> 	sub eax, ecx		  ; iday - lday
   554                              <1> 	;mov ecx, 365
   555 000001C4 66B96D01            <1> 	mov cx, 365
   556 000001C8 31D2                <1> 	xor edx, edx		  ; DX  = 0
   557                              <1> 	; EAX = iday-lday
   558 000001CA F7F1                <1> 	div ecx
   559                              <1> 	;mov [iyrs], ax		  ; whole years since 1968
   560                              <1> 	; jday = iday - (iyrs*365) - lday
   561                              <1> 	;mov [jday], dx  	  ; days since 1/1 of current year
   562                              <1> 	;add eax, 1968		  ; compute year
   563 000001CC 05B0070000          <1> 	add eax, 1968
   564 000001D1 66A3[6E020000]      <1> 	mov [year], ax
   565 000001D7 89C3                <1> 	mov ebx, eax		
   566                              <1> 	;mov ax, [qday]
   567 000001D9 58                  <1> 	pop eax
   568 000001DA 663D6D01            <1> 	cmp ax, 365		  ; if qday <= 365 and qday >= 60	
   569 000001DE 7709                <1> 	ja short L1		  ; jday = jday +1
   570 000001E0 6683F83C            <1> 	cmp ax, 60	          ; if past 2/29 and leap year then
   571 000001E4 F5                  <1>         cmc			  ; add a leap day to the # of whole
   572 000001E5 6683D200            <1> 	adc dx, 0		  ; days since 1/1 of current year
   573                              <1> L1:			
   574                              <1> 	;mov [jday], dx
   575                              <1> 	;mov [yday], dx 	  ; 24/11/2013	
   576 000001E9 66B90C00            <1> 	mov cx, 12		  ; estimate month
   577 000001ED 6687CA              <1> 	xchg cx, dx		  ; CX = jday, DX = month 	
   578 000001F0 66B86E01            <1> 	mov ax, 366		  ; mday, max. days since 1/1 is 365
   579 000001F4 6683E303            <1> 	and bx, 11b		  ; year mod 4	(and bx, 3) 
   580                              <1> L2:	; Month calculation	  ; 0 to 11  (11 to 0)	
   581 000001F8 6639C1              <1> 	cmp cx, ax		  ; mday = # of days passed from 1/1
   582 000001FB 731D                <1> 	jnb short L3
   583 000001FD 664A                <1> 	dec dx			  ; month = month - 1
   584 000001FF 66D1E2              <1> 	shl dx, 1 
   585 00000202 668B82[72020000]    <1> 	mov ax, [edx+DMonth] 	  ; # elapsed days at 1st of month
   586 00000209 66D1EA              <1> 	shr dx, 1		  ; dx = month - 1 (0 to 11)
   587 0000020C 6683FA01            <1> 	cmp dx, 1		  ; if month > 2 and year mod 4  = 0	
   588 00000210 76E6                <1> 	jna short L2		  ; then mday = mday + 1
   589 00000212 08DB                <1> 	or bl, bl		  ; if past 2/29 and leap year then
   590 00000214 75E2                <1> 	jnz short L2		  ; add leap day (to mday)
   591 00000216 6640                <1> 	inc ax			  ; mday = mday + 1
   592 00000218 EBDE                <1> 	jmp short L2
   593                              <1> L3:
   594 0000021A 6642                <1> 	inc dx 			  ; -> dx = month, 1 to 12
   595 0000021C 668915[6C020000]    <1> 	mov [month], dx
   596 00000223 6629C1              <1> 	sub cx, ax		  ; day = jday - mday + 1	
   597 00000226 6641                <1> 	inc cx 			  
   598 00000228 66890D[6A020000]    <1> 	mov [day], cx
   599                              <1> 	
   600                              <1> 	; eax, ebx, ecx, edx are changed at return
   601                              <1> 	; output ->
   602                              <1> 	; [year], [month], [day], [hour], [minute], [second]
   603                              <1> 	; [yday] -> 24/11/2013
   604                              <1> 	; [wday] -> 24/11/2013
   605                              <1> 	;
   606                              <1> 	; 24/11/2013
   607 0000022F 66A1[70020000]      <1> 	mov	ax, [wday] ; [iday]
   608 00000235 6631D2              <1> 	xor	dx, dx
   609 00000238 6683C004            <1> 	add	ax, 4
   610                              <1> 	; NOTE: January 1, 1970 was THURSDAY
   611                              <1> 	; ch = 0
   612 0000023C B107                <1> 	mov	cl, 7
   613 0000023E 66F7F1              <1> 	div	cx
   614 00000241 668915[70020000]    <1> 	mov	[wday], dx ; week of the day,  0 to 6 
   615                              <1> 	; 0 = sunday ... 6 = saturday
   616                              <1> 	;mov	word [isday], 0
   617                              <1> 
   618 00000248 C3                  <1> 	retn
   619                              <1> 
   620                              <1> 
   621                              <1> ;sunday:
   622                              <1> 	; sunday(at, ad)
   623                              <1> 	; 	int *at;
   624                              <1> 	;	 {
   625                              <1> 	; 	register int *t, d;
   626                              <1> 	; 	t = at;
   627                              <1> 	; 	d = ad;
   628                              <1> 	; 	d = ad + dysize(t[YEAR]) - 365;
   629                              <1> 	; 	return(d - (d - t[YDAY] + t[WDAY] + 700) % 7);
   630                              <1> 	; 	}
   631                              <1> 
   632                              <1> 	;mov	dx, [year]
   633                              <1> 	;call	dysize
   634                              <1> 	;sub	ax, 365
   635                              <1> 	; add 	cx, ax
   636                              <1> ;	test	word [year], 11b
   637                              <1> ;	jnz	short sunday1
   638                              <1> 	; CX = 119 (77h) or CX = 303 (12Fh)
   639                              <1> 	;inc	cx
   640                              <1> ;	inc	cl
   641                              <1> ;sunday1:
   642                              <1> ;	mov	ax, cx
   643                              <1> ;	add	ax, [wday]
   644                              <1> 	;adc	ax, 700
   645                              <1> ;	add	ax, 700
   646                              <1> ;	sub	ax, [yday]
   647                              <1> 	;xor	dx, dx
   648                              <1> ;	mov	bx, 7
   649                              <1> 	;div	bx
   650                              <1> ;	div	bl
   651                              <1> ;	sub	cx, bx
   652                              <1> ;	retn
   653                              <1> 
   654                              <1> ;dysize:
   655                              <1> ; dysize(y)
   656                              <1> ;	{
   657                              <1> ;	if((y%4) == 0)
   658                              <1> ;		return(366);
   659                              <1> ;	return(365);
   660                              <1> ;	}
   661                              <1> 
   662                              <1> ;	mov 	ax, 365	
   663                              <1> ;	test 	dx, 11b
   664                              <1> ;	jnz 	short dysize1
   665                              <1> ;	;inc 	ax
   666 00000249 FEC0                <1> 	inc 	al			
   667                              <1> ;dysize1:	
   668                              <1> ;	retn 
   669                              <1> 		
   670                              <1> 
   671                              <1> numb:   ; AX = 0 to 99
   672                              <1> 	;
   673                              <1> 	; numb(acp, n)
   674                              <1> 	; {
   675                              <1> 	;	register char *cp;
   676                              <1> 	;
   677                              <1> 	;	cp = acp;
   678                              <1> 	;	cp++;
   679                              <1> 	;	if (n>=10)
   680                              <1> 	;	   *cp++ = (n/10)%10 + '0';
   681                              <1> 	;	else
   682                              <1> 	;	   *cp++ = ' ';
   683                              <1> 	;	*cp++ = n%10 + '0';
   684                              <1> 	;	return(cp);
   685                              <1> 	; }
   686                              <1> 	;
   687                              <1> 	;mov	cl, 10
   688 0000024B 6683F80A            <1> 	cmp 	ax, 10
   689 0000024F 7306                <1> 	jnb	short nb1
   690 00000251 88C4                <1> 	mov	ah, al
   691 00000253 30C0                <1> 	xor	al, al ; 0
   692 00000255 EB04                <1> 	jmp	short nb2
   693                              <1> nb1:	
   694 00000257 F6F1                <1> 	div	cl
   695 00000259 88E2                <1> 	mov	dl, ah
   696                              <1> 	
   697                              <1> nb2:	
   698 0000025B 0430                <1> 	add	al, '0'
   699 0000025D AA                  <1> 	stosb	; digit 1
   700 0000025E 88E0                <1> 	mov	al, ah
   701 00000260 0430                <1> 	add	al, '0'
   702 00000262 AA                  <1> 	stosb	; digit 2
   703 00000263 C3                  <1> 	retn
   704                              <1> 
   705                              <1> 
   706                              <1> ;;; DATA
   707                              <1> 
   708                              <1> ;daylight: db 1 ; int daylight 1; /* Allow daylight conversion */
   709                              <1> ;nixonflg: db 0 ; int nixonflg 0; /* Daylight time all year around */
   710                              <1> ;daylbegin: dw 0
   711                              <1> ;daylend: dw 0
   712                              <1> 
   713                              <1> 
   714                              <1> ct:
   715                              <1> ; 24/11/2013 (re-order)
   716                              <1> ;
   717                              <1> ; Retro UNIX 8086 v1 - UNIX.ASM
   718                              <1> ; 09/04/2013 epoch variables
   719                              <1> ; Retro UNIX 8086 v1 Prototype: UNIXCOPY.ASM, 10/03/2013
   720                              <1> ;
   721                              <1> 
   722 00000264 0000                <1> second: dw 0
   723 00000266 0000                <1> minute: dw 0
   724 00000268 0000                <1> hour: dw 0
   725 0000026A 0100                <1> day: dw 1
   726 0000026C 0100                <1> month: dw 1
   727 0000026E B207                <1> year: dw 1970
   728 00000270 0000                <1> wday: dw 0 ; 24/11/2013
   729                              <1> ;yday: dw 0 ; 24/11/2013
   730                              <1> ;isday: dw 0 ; 24/11/2013
   731                              <1> 
   732                              <1> DMonth:
   733 00000272 0000                <1> dw 0
   734 00000274 1F00                <1> dw 31
   735 00000276 3B00                <1> dw 59
   736 00000278 5A00                <1> dw 90
   737 0000027A 7800                <1> dw 120
   738 0000027C 9700                <1> dw 151
   739 0000027E B500                <1> dw 181
   740 00000280 D400                <1> dw 212
   741 00000282 F300                <1> dw 243
   742 00000284 1101                <1> dw 273
   743 00000286 3001                <1> dw 304
   744 00000288 4E01                <1> dw 334
   745                              <1> 
   746                              <1> ;ncp0: db "Day Mon 00 00:00:00 1970", 0, 0
   747 0000028A 53756E204D6F6E2054- <1> ncp1: db "Sun Mon Tue Wed Thu Fri Sat "
   748 00000293 756520576564205468- <1>
   749 0000029C 752046726920536174- <1>
   750 000002A5 20                  <1>
   751 000002A6 4A616E20466562204D- <1> ncp2: db "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec "
   752 000002AF 617220417072204D61- <1>
   753 000002B8 79204A756E204A756C- <1>
   754 000002C1 204175672053657020- <1>
   755 000002CA 4F6374204E6F762044- <1>
   756 000002D3 656320              <1>
   757                              <1> 
   758                              <1> cbuf: 	; char cbuf[26]
   759 000002D6 00<rept>            <1> 	times 26 db 0
   760                              <1> 
   761                              <1> 
   762                              <1> ;; ctime.c (Unix v5)
   763                              <1> ;
   764                              <1> ;#
   765                              <1> ;/*
   766                              <1> ; * This routine converts time as follows.
   767                              <1> ; * The epoch is 0000 Jan 1 1970 GMT.
   768                              <1> ; * The argument time is in seconds since then.
   769                              <1> ; * The localtime(t) entry returns a pointer to an array
   770                              <1> ; * containing
   771                              <1> ; *  seconds (0-59)
   772                              <1> ; *  minutes (0-59)
   773                              <1> ; *  hours (0-23)
   774                              <1> ; *  day of month (1-31)
   775                              <1> ; *  month (0-11)
   776                              <1> ; *  year-1970
   777                              <1> ; *  weekday (0-6, Sun is 0)
   778                              <1> ; *  day of the year
   779                              <1> ; *  daylight savings flag
   780                              <1> ; *
   781                              <1> ; * The routine corrects for daylight saving
   782                              <1> ; * time and will work in any time zone provided
   783                              <1> ; * "timezone" is adjusted to the difference between
   784                              <1> ; * Greenwich and local standard time (measured in seconds).
   785                              <1> ; * In places like Michigan "daylight" must
   786                              <1> ; * be initialized to 0 to prevent the conversion
   787                              <1> ; * to daylight time.
   788                              <1> ; *
   789                              <1> ; * "nixonflg,", if set to 1, will
   790                              <1> ; * cause daylight savings time all year around
   791                              <1> ; * independently of "daylight".
   792                              <1> ; *
   793                              <1> ; * The routine does not work
   794                              <1> ; * in Saudi Arabia which runs on Solar time.
   795                              <1> ; *
   796                              <1> ; * asctime(tvec))
   797                              <1> ; * where tvec is produced by localtime
   798                              <1> ; * returns a ptr to a character string
   799                              <1> ; * that has the ascii time in the form
   800                              <1> ; *	Thu Jan 01 00:00:00 1970n0\; *	01234567890123456789012345
   801                              <1> ; *	0	  1	    2
   802                              <1> ; *
   803                              <1> ; * ctime(t) just calls localtime, then asctime.
   804                              <1> ; */
   805                              <1> ;char	cbuf[26];
   806                              <1> ;int	dmsize[12]
   807                              <1> ;{
   808                              <1> ;	31,
   809                              <1> ;	28,
   810                              <1> ;	31,
   811                              <1> ;	30,
   812                              <1> ;	31,
   813                              <1> ;	30,
   814                              <1> ;	31,
   815                              <1> ;	31,
   816                              <1> ;	30,
   817                              <1> ;	31,
   818                              <1> ;	30,
   819                              <1> ;	31
   820                              <1> ;};
   821                              <1> ;
   822                              <1> ;int timezone	5*60*60;
   823                              <1> ;int tzname[]
   824                              <1> ;{
   825                              <1> ;	"EST",
   826                              <1> ;	"EDT",
   827                              <1> ;};
   828                              <1> ;int	daylight 1;	/* Allow daylight conversion */
   829                              <1> ;int	nixonflg 0;	/* Daylight time all year around */
   830                              <1> ;
   831                              <1> ;#define SEC	0
   832                              <1> ;#define MIN	1
   833                              <1> ;#define HOUR	2
   834                              <1> ;#define MDAY	3 
   835                              <1> ;#define MON	4
   836                              <1> ;#define YEAR	5
   837                              <1> ;#define WDAY	6
   838                              <1> ;#define YDAY	7
   839                              <1> ;#define ISDAY	8
   840                              <1> ;
   841                              <1> ;ctime(at)
   842                              <1> ;int *at;
   843                              <1> ;{
   844                              <1> ;	return(asctime(localtime(at)));
   845                              <1> ;}
   846                              <1> ;
   847                              <1> ;localtime(tim)
   848                              <1> ;int tim[];
   849                              <1> ;{
   850                              <1> ;	register int *t, *ct, dayno;
   851                              <1> ;	int daylbegin, daylend;
   852                              <1> ;	int copyt[2];
   853                              <1> ;
   854                              <1> ;	t = copyt;
   855                              <1> ;	t[0] = tim[0];
   856                              <1> ;	t[1] = tim[1];
   857                              <1> ;	dpadd(t, -timezone);
   858                              <1> ;	ct = gmtime(t);
   859                              <1> ;	dayno = ct[YDAY];
   860                              <1> ;	if (nixonflg && (ct[YEAR]>74 || ct[YEAR]==74 && (dayno > 5 ||
   861                              <1> ;	    dayno==5 && ct[HOUR]>=2))) {
   862                              <1> ;		daylight =| 1;
   863                              <1> ;		daylbegin = -1;
   864                              <1> ;		daylend = 367;
   865                              <1> ;	} else {
   866                              <1> ;		daylbegin = sunday(ct, 119);	/* last Sun in Apr */
   867                              <1> ;		daylend = sunday(ct, 303);	/* last Sun in Oct */
   868                              <1> ;	}
   869                              <1> ;	if (daylight &&
   870                              <1> ;	    (dayno>daylbegin || (dayno==daylbegin && ct[HOUR]>=2)) &&
   871                              <1> ;	    (dayno<daylend || (dayno==daylend && ct[HOUR]<1))) {
   872                              <1> ;		dpadd(t, 1*60*60);
   873                              <1> ;		ct = gmtime(t);
   874                              <1> ;		ct[ISDAY]++;
   875                              <1> ;	}
   876                              <1> ;	return(ct);
   877                              <1> ;}
   878                              <1> ;
   879                              <1> ;sunday(at, ad)
   880                              <1> ;int *at;
   881                              <1> ;{
   882                              <1> ;	register int *t, d;
   883                              <1> ;
   884                              <1> ;	t = at;
   885                              <1> ;	d = ad;
   886                              <1> ;	d = ad + dysize(t[YEAR]) - 365;
   887                              <1> ;	return(d - (d - t[YDAY] + t[WDAY] + 700) % 7);
   888                              <1> ;}
   889                              <1> ;
   890                              <1> ;gmtime(tim)
   891                              <1> ;int tim[];
   892                              <1> ;{
   893                              <1> ;	register int d0, d1;
   894                              <1> ;	register *tp;
   895                              <1> ;	static xtime[9];
   896                              <1> ;	extern int ldivr;
   897                              <1> ;
   898                              <1> ;	/*
   899                              <1> ;	 * break initial number into
   900                              <1> ;	 * multiples of 8 hours.
   901                              <1> ;	 * (28800 = 60*60*8)
   902                              <1> ;	 */
   903                              <1> ;
   904                              <1> ;	d0 = ldiv(tim[0], tim[1], 28800);
   905                              <1> ;	d1 = ldivr;
   906                              <1> ;	tp = &xtime[0];
   907                              <1> ;
   908                              <1> ;	/*
   909                              <1> ;	 * generate hours:minutes:seconds
   910                              <1> ;	 */
   911                              <1> ;
   912                              <1> ;	*tp++ = d1%60;
   913                              <1> ;	d1 =/ 60;
   914                              <1> ;	*tp++ = d1%60;
   915                              <1> ;	d1 =/ 60;
   916                              <1> ;	d1 =+ (d0%3)*8;
   917                              <1> ;	d0 =/ 3;
   918                              <1> ;	*tp++ = d1;
   919                              <1> ;
   920                              <1> ;	/*
   921                              <1> ;	 * d0 is the day number.
   922                              <1> ;	 * generate day of the week.
   923                              <1> ;	 */
   924                              <1> ;
   925                              <1> ;	xtime[WDAY] = (d0+4)%7;
   926                              <1> ;
   927                              <1> ;	/*
   928                              <1> ;	 * year number
   929                              <1> ;	 */
   930                              <1> ;	for(d1=70; d0 >= dysize(d1); d1++)
   931                              <1> ;		d0 =- dysize(d1);
   932                              <1> ;	xtime[YEAR] = d1;
   933                              <1> ;	xtime[YDAY] = d0;
   934                              <1> ;
   935                              <1> ;	/*
   936                              <1> ;	 * generate month
   937                              <1> ;	 */
   938                              <1> ;
   939                              <1> ;	if (dysize(d1)==366)
   940                              <1> ;		dmsize[1] = 29;
   941                              <1> ;	for(d1=0; d0 >= dmsize[d1]; d1++)
   942                              <1> ;		d0 =- dmsize[d1];
   943                              <1> ;	dmsize[1] = 28;
   944                              <1> ;	*tp++ = d0+1;
   945                              <1> ;	*tp++ = d1;
   946                              <1> ;	xtime[ISDAY] = 0;
   947                              <1> ;	return(xtime);
   948                              <1> ;}
   949                              <1> ;
   950                              <1> ;asctime(t)
   951                              <1> ;int *t;
   952                              <1> ;{
   953                              <1> ;	register char *cp, *ncp;
   954                              <1> ;	register int *tp;
   955                              <1> ;
   956                              <1> ;	cp = cbuf;
   957                              <1> ;	for (ncp = "Day Mon 00 00:00:00 1900\n"; *cp++ = *ncp++;);
   958                              <1> ;	ncp = &"SunMonTueWedThuFriSat"[3*t[6]];
   959                              <1> ;	cp = cbuf;
   960                              <1> ;	*cp++ = *ncp++;
   961                              <1> ;	*cp++ = *ncp++;
   962                              <1> ;	*cp++ = *ncp++;
   963                              <1> ;	cp++;
   964                              <1> ;	tp = &t[4];
   965                              <1> ;	ncp = &"JanFebMarAprMayJunJulAugSepOctNovDec"[(*tp)*3];
   966                              <1> ;	*cp++ = *ncp++;
   967                              <1> ;	*cp++ = *ncp++;
   968                              <1> ;	*cp++ = *ncp++;
   969                              <1> ;	cp = numb(cp, *--tp);
   970                              <1> ;	cp = numb(cp, *--tp+100);
   971                              <1> ;	cp = numb(cp, *--tp+100);
   972                              <1> ;	cp = numb(cp, *--tp+100);
   973                              <1> ;	cp =+ 2;
   974                              <1> ;	cp = numb(cp, t[YEAR]);
   975                              <1> ;	return(cbuf);
   976                              <1> ;}
   977                              <1> ;
   978                              <1> ;dysize(y)
   979                              <1> ;{
   980                              <1> ;	if((y%4) == 0)
   981                              <1> ;		return(366);
   982                              <1> ;	return(365);
   983                              <1> ;}
   984                              <1> ;
   985                              <1> ;
   986                              <1> ;numb:
   987                              <1> ;	
   988                              <1> ;
   989                              <1> ;numb(acp, n)
   990                              <1> ;{
   991                              <1> ;	register char *cp;
   992                              <1> ;	cp = acp;
   993                              <1> ;	cp++;
   994                              <1> ;	if (n>=10)
   995                              <1> ;		*cp++ = (n/10)%10 + '0';
   996                              <1> ;	else
   997                              <1> ;		*cp++ = ' ';
   998                              <1> ;	*cp++ = n%10 + '0';
   999                              <1> ;	return(cp);
  1000                              <1> ;}
  1001                              <1> ;
  1002                                  
  1003 000002F0 0000                    cursor_pos: dw 0
  1004                                  
  1005                                  b_dt_txt:
  1006 000002F2 07                      	db 07h
  1007                                  dt_txt:
  1008 000002F3 0D                      	db 0Dh
  1009 000002F4 0A                      	db 0Ah
  1010 000002F5 43757272656E742044-     	db 'Current Date & Time : '
  1011 000002FE 61746520262054696D-
  1012 00000307 65203A20           
  1013                                  dt_size equ $ - dt_txt	
  1014 0000030B 00                      chr:	db 0
  1015 0000030C 00                      ttynum: db 0
