;*-------------------------------------------------------------------*;
;* FlashDOS Version 2.1 by P.E.Colla 1988 - COLLA @ MARVM1           *;
;*                                                                   *;
;* This program start a secondary DOS command processor from         *;
;* inside applications.                                              *;
;*                                                                   *;
;* Version 2.0 10-Jul-89 Virtual memory support added.               *;
;* Version 2.1 25-Jul-89 Huge mode added.                            *;
;*                                                                   *;
;*-------------------------------------------------------------------*;
 
 
;*-------------------------------------------------------------------*;
;* DOS Memory Control Block - Chain Record Format (Undocumented)     *;
;*-------------------------------------------------------------------*;
 
mem      segment  at      0FFFFh
 
memtype           db      ?
memid             dw      ?
memsize           dw      ?
 
mem      ends
 
;*-------------------------------------------------------------------*;
;* Main Program Start                                                *;
;*-------------------------------------------------------------------*;
cseg     segment  para    public 'code'
                  org     100h
                  assume  cs:cseg,ds:cseg,es:cseg,ss:cseg
;*-------------------------------------------------------------------*;
;* Equates                                                           *;
;*-------------------------------------------------------------------*;
 
cr                equ     0dh
lf                equ     0ah
bell              equ     07h
hotkey            equ     0Eh
shift_mask        equ     08h
ncol              equ     80
box_row           equ     0
box_col           equ     0
bw_attr           equ     70h
co_attr           equ     17h
id_len            equ     (id_end - id) - 1
prog_len          equ     (initialize - main) / 10h
env_var_len       equ     (env_var_end - env_var)
video_len         equ     315
 
;*-------------------------------------------------------------------*;
;* Control is given here at load time, jump to initialization code   *;
;*-------------------------------------------------------------------*;
 
main:             jmp     initialize
 
;*-------------------------------------------------------------------*;
;* Variable definition area                                          *;
;*-------------------------------------------------------------------*;
;***----                 COMMON AREA                            ---***;
 
;*--- Unique ID to detect multiple load
 
id                db      "@#PonchiFlashDOS#@"
id_unique         db      10 dup (0)
id_end            db      0
 
;*--- External Swap File Area
 
swapfile          db      "A:\FLASHDOS.SWP",0
handle            dw      ?
 
;*--- Inter-Process Communication
 
rc                db      00h
 
;*--- DOS command to be passed to COMMAND.COM at start
 
dos_command_def   db      3,"  ",cr,0,0
dos_command       db      0,40 dup (" "),cr,0,0
command_flag      db      0
 
;*--- Status control area
 
active            db      0
dormant           db      0
buffer_type       db      "I"
huge_mode         db      0
 
;*--- WorkSpace Address & Size
 
ptr_area          dw      0
size_area         dw      4096
 
;*--- Runtime error & messages
 
merr01            db      cr,lf
                  db      "FlashDOS: Invalid Function Code",cr,lf,"$"
merr02            db      cr,lf
                  db      "FlashDOS: File not found",cr,lf,"$"
merr05            db      cr,lf
                  db      "FlashDOS: Access Denied",cr,lf,"$"
merr07            db      cr,lf
                  db      "FlashDOS: Memory Blocks Destroyed",cr,lf,"$"
merr08            db      cr,lf
                  db      "FlashDOS: Insufficient memory",cr,lf,"$"
merr09            db      cr,lf
                  db      "FlashDOS: Invalid Memory Block Address",cr,lf,"$"
merr10            db      cr,lf
                  db      "FlashDOS: Invalid Media",cr,lf,"$"
merr11            db      cr,lf
                  db      "FlashDOS: Invalid Format",cr,lf,"$"
merrff            db      cr,lf
                  db      "FlashDOS: Protection Exception",cr,lf,"$"
merrot            db      cr,lf
                  db      "FlashDOS: Something wrong occurs",cr,lf,"$"
now_inactive      db      cr,lf
                  db      "FlashDOS: Now Inactive",cr,lf,"$"
StartUp           db      cr,lf
db "浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様�",cr,lf
db "�             FlashDOS Version 2.1  by P.E.Colla (COLLA @ MARVM1)             �",cr,lf
db "�                              Type EXIT to End                           "
type_msg          db      "Real"
                  db       "�",cr,lf
db "藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様�",cr,lf
                  db      "$"
disk_msg          db      "Disk"
huge_msg          db      "Huge"
SwapMsg           db      cr,lf
                  db "浜様様様様様様様様様様様様様様様様�",cr,lf
                  db "�          FlashDOS V2.1          �",cr,lf
                  db "�Swapping to Drive "
Drive             db "A:"
                  db ", Please wait�",cr,lf
                  db "藩様様様様様様様様様様様様様様様様�",cr,lf
                  db      "$"
db "                                                                              ",cr,lf
 
Finish            db      cr,lf
                  db      "FlashDOS Ended",cr,lf,"$"
dos_error         db      cr,lf
                  db      "FlashDOS: Secondary COMMAND cann't start",cr,lf,"$"
claim_error       db      cr,lf
                  db      "FlashDOS: Cann't claim memory",cr,lf,"$"
 
;*--- Errors associated with swap process
 
emem_error        db      cr,lf
                  db      "FlashDOS: Memory mgmt error",cr,lf,"$"
epsp_error        db      cr,lf
                  db      "FlashDOS: PSP do not belong to Usr Program",cr,lf,"$"
edisk_error       db      cr,lf
                  db      "FlashDOS: Disk error, Can not swap out",cr,lf,"$"
eno_space         db      cr,lf
                  db      "浜様様様様様様様様様様様様様様様融",cr,lf
                  db      "�          FlashDOS 2.0          �",cr,lf
                  db      "�    Not enough space to swap    �",cr,lf
                  db      "�   Press any key to continue    �",cr,lf
                  db      "藩様様様様様様様様様様様様様様様夕",cr,lf,"$"
eusr_short        db      cr,lf
                  db      "浜様様様様様様様様様様様様様様様融",cr,lf
                  db      "�          FlashDOS 2.0          �",cr,lf
                  db      "�    Insufficient User Memory    �",cr,lf
                  db      "�   Press any key to continue    �",cr,lf
                  db      "藩様様様様様様様様様様様様様様様夕",cr,lf,"$"
eno_open          db      cr,lf
                  db      "FlashDOS: Can not open swap file",cr,lf,"$"
eno_swap          db      cr,lf
                  db      "FlashDOS: Can not swap to file",cr,lf,"$"
eno_shrink        db      cr,lf
                  db      "FlashDOS: Can not shrink Usr memory",cr,lf,"$"
eswap_ok          db      cr,lf
                  db      "FlashDOS: User program swapped OK",cr,lf,"$"
eno_retrieve      db      cr,lf
                  db      "FlashDOS: Can not retrieve memory",cr,lf,"$"
eno_close         db      cr,lf
                  db      "FlashDOS: Can not close swap file",cr,lf,"$"
eno_erase         db      cr,lf
                  db      "FlashDOS: Can not erase swap file",cr,lf,"$"
 
 
;*--- Local Stack Definition
 
Old_ss            dw   ?
Old_sp            dw   ?
Free_Space        dw   512  dup (?)
Loc_sp            dw   10   dup (?)
 
;*--- Interrupt saving area
 
Old_Int_Area      dw   1200 dup (?)
New_Int_Area      dw   1200 dup (?)
 
;*--- EXEC control block
 
env_segment       dw      ?
command_ptr       dw      2 dup (?)
fcb1_ptr          dw      2 dup (?)
fcb2_ptr          dw      2 dup (?)
 
;*--- COMMAND.COM path
 
comspec_path      db      "A:\COMMAND.COM",0
                  db      100 dup (0)
env_var           db      "COMSPEC="
env_var_end       db      ?
 
 
;*--- User memory block information
 
usr_base          dw      ?
usr_psp           dw      ?
usr_size          dw      ?
usr_last          dw      ?
 
;*--- Swap process auxiliary registers
 
swp_len           dw      ?
swp_par           dw      ?
usr_ptr           dw      ?
usr_len           dw      ?
 
;*--- Stack save area
 
ss_save           dw      ?
sp_save           dw      ?
 
;*--- Old Interrupt Address
 
old_int_9         dd      0
old_int_13        dd      0
old_int_21        dd      0
 
;*--- Video Information
 
cursor_pos        dw      0
display_page      db      0
attribute         db      0
nrow              db      25
 
;*--- Flags & Status
 
disk_status       db      0
load_flag         db      0
dos_flag          dd      0
info_ptr          dd      00000487h
lo_fn_flag        db      0
paragraph_size    db      10h
par_size          dw      10h
 
 
;*-------------------------------------------------------------------*;
;* New BIOS Keyboard Interrupt                                       *;
;*-------------------------------------------------------------------*;
 
int_9             proc    far
                  assume  cs:cseg,ds:nothing,es:nothing,ss:nothing
 
;*--- Check if Hot Key is pressed
 
                  sti
                  push    ax
                  mov     ah,0ffh
                  mov     cs:rc,ah
                  in      al,60h
                  cmp     al,hotkey
                  jne     process_key
                  mov     ah,2
                  int     16h
                  and     al,0Fh
                  cmp     al,shift_mask
                  je      our_key
 
;*--- No, continue with old keyboard interrupt handler
 
process_key:
                  pop     ax
                  jmp     dword ptr cs:old_int_9
 
;*--- Yes,reset keyboard and see if it is possible to pop up
 
our_key:
                  in      al,61h
                  mov     ah,al
                  or      al,80h
                  out     61h,al
                  jmp     short $+2
                  out     61h,al
                  cli
                  mov     al,20h
                  out     20h,al
                  sti
 
;*--- Is FlashDOS already active
 
                  cmp     cs:active,0
                  jne     return_a
 
;*--- Is DOS in critical state
 
                  push    ds
                  push    bx
                  lds     bx,cs:dos_flag
                  cmp     byte ptr [bx],0
                  jne     return_b
 
;*--- Is DOS performing Int 21h greather than 0Ch
 
                  cmp     cs:lo_fn_flag,0
                  jne     return_b
 
;*--- Is any disk activity in progress
 
check_b:          cmp     cs:disk_status,0
                  jne     return_b
 
;*--- Is active
 
                  cmp     cs:dormant,0
                  je      invoke
 
return_b:         pop     bx
                  pop     ds
return_a:         pop     ax
                  iret
 
;*--- Condition OK to popup, video condition is saved
 
invoke:           lds     bx,cs:info_ptr
                  lds     bx,[bx]
                  test    bl,08h
                  jnz     return_b
                  mov     attribute,co_attr
                  mov     ah,0Fh
                  int     10h
                  mov     display_page,bh
                  cmp     al,3
                  jbe     mode_ok
                  mov     attribute,bw_attr
                  cmp     al,7
                  jne     return_b
 
;*--- Set active flag, FlashDOS is not re-entrant.
 
mode_ok:          inc     cs:active
 
;*--- Signal with interprocess purposes that at least the condition for popup
;*--- was completed
 
                  mov     ah,80h
                  mov     cs:rc,ah
 
;*--- Put the stack on a safe place and Save everything
 
                  cli
 
                  mov    cs:old_ss,ss
                  mov    cs:old_sp,sp
                  push   cs
                  pop    ss
                  mov    sp,offset cs:Loc_sp
 
                  sti
 
                  push    cx
                  push    dx
                  push    di
                  push    si
                  push    es
                  push    bp
 
                  push    cs
                  pop     ds
 
                  push    cs
                  pop     es
 
;*--- IF External swap mode then preserve interrupt vector and restore the
;*--- vector that was at the FlashDos loading time.
;*--- This operation avoid any conflict if the current program have one or
;*--- more interrupt vectors trapped (pointing to nowhere if swapped).
 
                  cmp     cs:buffer_type,"E"
                  jne     txintend
 
                  cli
 
                  push    es
 
                  mov     ax,0000h
                  mov     es,ax
 
 
                  mov     si,0000h
                  lea     di,new_int_area
                  mov     bx,1024
 
txintold:
                  mov     ah,byte ptr es:[si]
                  mov     byte ptr cs:[di],ah
                  inc     di
                  inc     si
                  dec     bx
 
                  mov     ax,bx
                  cmp     ax,0000h
                  jne     txintold
 
                  mov     si,0000h
                  lea     di,old_int_area
                  mov     bx,1024
 
txintnew:
                  mov     ah,byte ptr cs:[di]
                  mov     byte ptr es:[si],ah
                  inc     di
                  inc     si
                  dec     bx
 
                  mov     ax,bx
                  cmp     ax,0000h
                  jne     txintnew
 
                  pop     es
 
                  sti
 
txintend:
 
                  assume  ds:cseg,es:cseg
 
                  mov     ax,cs
                  mov     ds,ax
                  mov     es,ax
                  mov     ah,3
                  int     10h
                  mov     cursor_pos,dx
 
;*--- Save & clear screen
 
                  mov     di,offset initialize
                  mov     si,0FFFFh
                  call    screen
 
;*--- If a user program is selected to popup don't clear the screen
 
                  cmp     byte ptr cs:command_flag,00h
                  jne     dos_ldr
 
;*--- If external swap is specified don't clear the screen neither
 
                  cmp     byte ptr cs:buffer_type,"E"
                  je      dos_ldr
 
                  call    clr_box
 
;*--- Try to load COMMAND.COM
dos_ldr:
                  call    dos_loader
 
;*--- Restore screen
 
                  mov     si,offset initialize
                  call    screen
                  mov     ah,2
                  mov     dx,cursor_pos
                  int     10h
 
;*--- Reset active flag
 
                  mov     active,0
 
;*--- Restore registers
 
                  pop     bp
                  pop     es
                  pop     si
                  pop     di
                  pop     dx
                  pop     cx
 
;*--- Restore Stack
 
                  cli
 
                  mov    ss,old_ss
                  mov    sp,old_sp
 
                  sti
 
;*--- Check if storage mode is external or internal
;*--- If External restore Interrupt Vector area
 
                  cmp     cs:buffer_type,"E"
                  jne     endint9
 
                  cli
 
                  push    es
 
                  mov     ax,0000h
                  mov     es,ax
 
                  mov     si,0000h
                  lea     di,new_int_area
                  mov     bx,1024
 
reintold:
                  mov     ah,byte ptr cs:[di]
                  mov     byte ptr es:[si],ah
                  inc     di
                  inc     si
                  dec     bx
 
                  mov     ax,bx
                  cmp     ax,0000h
                  jne     reintold
 
                  pop     es
                  sti
 
;*--- Signal with inter-process purposes that the program sucefully ended
 
                  mov     ah,00h
                  mov     cs:rc,ah
 
endint9:
                  pop     bx
                  pop     ds
                  pop     ax
 
 
                  iret
int_9             endp
 
 
;*-------------------------------------------------------------------*;
;* Loader of secondary COMMAND.COM                                   *;
;*-------------------------------------------------------------------*;
dos_loader        proc    near
 
;*--- Set addresability
 
                  mov     ax,cs
                  mov     ds,ax
                  mov     es,ax
 
;*--- Get current video page
 
                  mov     ah,0Fh
                  Int     10h
 
;*--- Position cursor at upper left corner (0,0)
 
                  mov     bl,00h
                  mov     dx,0000h
                  mov     ah,02h
                  Int     10h
 
;*--- Check if Internal or External swap is selected
 
                  cmp     cs:buffer_type,"E"
                  je      external_swap
 
;*--- Get pointer to workspace area (If internal swap is active)
 
internal_storage:
                  mov     ax,word ptr cs:ptr_area
 
;*--- Freed up reserved workspace area
 
                  mov     es,ax
                  mov     ah,49h
                  Int     21h
 
;*--- OK, go to load command.com
 
                  jc      intsto01
                  jmp     load_command
 
;*--- Display error message (never should happen)
 
intsto01:
                  mov     dx,offset claim_error
                  call    print
 
                  jmp     escape
 
;*--- External Swap procedure
 
external_swap:
 
;*--- Get current (user program) PSP segment
 
                  mov     ah,62h
                  Int     21h
 
                  mov     cs:usr_psp,bx
 
 
;*--- Based on PSP segment address the User's MCB is accesed
 
                  push    ds
 
                  mov     ax,cs:usr_psp
                  dec     ax
                  mov     ds,ax
 
                  assume  ds:mem
 
;*--- Verify is the MCB is one of the expected type
 
 
                  cmp     ds:memtype,"M"
                  je      eswap01
 
                  cmp     ds:memtype,"Z"
                  je      eswap01
 
                  mov     dx,offset emem_error
                  call    print
                  call    getkey
                  pop     ds
                  jmp     escape
 
;*--- Get the owner of the MCB (Should be the PSP just retrieved above)
 
eswap01:
                  mov     ax,cs:usr_psp
                  cmp     ds:memid,ax
                  je      eswap02
 
                  mov     dx,offset epsp_error
                  call    print
                  call    getkey
                  pop     ds
                  jmp     escape
 
;*--- Get the memory size of the block owned by the PSP (in paragraphs)
 
eswap02:
                  mov     ax,ds:memsize
                  mov     cs:usr_size,ax
 
;*--- If huge mode is in place the swappable area is set to the user size
;*--- minus one.
                  cmp     byte ptr cs:huge_mode,01h
                  jnz     eswap02b
 
;*--- The reason to let at least one user block in memory is really to avoid
;*--- the mess to completely erase the user MCB and after the operation
;*--- restore it.
                  mov     ax,word ptr cs:usr_size
                  sub     ax,10h
                  mov     word ptr cs:size_area,ax
 
                  assume  ds:cseg
 
eswap02b:
                  pop     ds
 
;*--- The User PSP size is checked against the size of the area required
 
                  cmp     ax,size_area
                  jnb     eswap09
 
                  mov     dx,offset eusr_short
                  call    print
                  call    getkey
                  jmp     escape
 
;*--- The actual segment from wich the memory will be swapped to disk
;*--- is computed.
;*--- First, the last allocated paragraph is computed
 
eswap09:
 
                  mov     ax,cs:usr_psp
                  dec     ax
                  mov     bx,cs:usr_size
                  add     ax,bx
                  dec     ax
                  mov     cs:usr_last,ax
 
;*--- Now the paragraph in which the swap will start is computed
 
                  inc     ax
                  sub     ax,cs:size_area
                  mov     cs:usr_base,ax
 
 
;*--- All the memory dirty work is already done, now all the user's files
;*--- are closed (if any).
 
                  push    bx
                  push    cx
                  mov     cx,0Fh
                  mov     bx,05h
 
eswap03:
                  mov     ah,3Eh
                  Int     21h
 
                  inc     bx
                  loop    eswap03
 
                  pop     cx
                  pop     bx
 
 
;*--- Now take a look around to found space enough to swap out the memory
;*--- Scan drive F: thru A:
 
                  mov     dl,05h
                  mov     dh,00h
 
;*--- Try to get disk status for the selected drive
 
eswap04:
 
                  clc
 
                  mov     di,dx
                  mov     al,00h
                  mov     ah,36h
                  Int     21h
 
                  jnc     eswap05
 
                  mov     dx,offset edisk_error
                  call    print
                  call    getkey
                  jmp     escape
 
;*--- If AX=FFFFh there are no drive available to check
 
eswap05:
 
                  cmp     ax,0FFFFh
                  jne     eswap06
 
;*--- Decrement drive to next available and check again
 
eswap08:
                  mov     dx,di
                  dec     dl
                  jnz     eswap04
 
;*--- If drive count reach 0 no one of the drive have enough space to swap
 
                  mov     dx,offset eno_space
                  call    print
                  call    getkey
                  jmp     escape
 
eswap06:
 
;*--- Check if the space available is really huge, otherwise a
;*--- free amount of paragraphs could be greater than FFFFh and
;*--- the space computation could end on error
 
                  push    ax
                  mov     ax,bx
                  cmp     ax,1000
                  jge     eswap16
                  jmp     eswap17
 
eswap16:
                  pop     ax
                  jmp     eswap07
 
;*--- Get free space on drive
;*--- First get bytes on each cluster
 
eswap17:
                  pop     ax
                  mul     cx
 
 
;*--- Then convert to paragraphs by cluster
 
                  idiv    paragraph_size
 
                  mov     ah,00h
 
;*--- Now get total number of paragraphs available on drive
 
                  mul     bx
 
;*--- Compare with amount needed, if not enough continue to cycle
 
                  cmp     ax,size_area
                  jnb     eswap07
                  jmp     eswap08
 
eswap07:
 
;*--- Now the drive with sufficient space is on DI, transfer to DX
 
                  mov     dx,di
 
;*--- Convert the drive number to a useful form
 
                  add     dl,40h
                  mov     cs:swapfile,dl
                  mov     cs:drive,dl
 
;*--- Print swap in progress message
 
                  mov     ax,cs
                  mov     ds,ax
                  mov     dx,offset SwapMsg
                  call    print
 
;*--- Create and open the swapfile (hidden file)
 
                  push    cs
                  pop     ds
                  mov     dx,offset swapfile
                  mov     cx,02h
                  mov     ah,03cH
                  Int     21h
 
                  jnc     eswap10
 
                  mov     dx,offset eno_open
                  call    print
                  call    getkey
                  jmp     escape
 
;*--- Store the handle number returned by DOS
 
eswap10:
                  mov     cs:handle,ax
 
;*--- Now the swap is actually done
;*--- Set the address FROM
 
                  mov     ax,cs:usr_base
                  mov     cs:usr_ptr,ax
 
;*--- Set the size to swap
 
                  mov     ax,size_area
                  mov     usr_len,ax
 
;*--- Cycle thru the swapable area swapping on 64K chunks
 
eswap11:
                  mov     bx,usr_len
                  mov     ax,0fffh
 
                  cmp     ax,bx
                  jb      more_64K
 
                  mov     ax,usr_len
                  mul     par_size
                  mov     swp_len,ax
                  mov     swp_par,bx
                  jmp     swap_in
 
more_64K:
                  mov     ax,0FFF0h
                  mov     swp_len,ax
                  mov     ax,0fffh
                  mov     swp_par,ax
swap_in:
                  clc
                  mov     bx,handle
                  mov     cx,swp_len
                  mov     dx,0000h
                  push    ds
                  mov     ax,usr_ptr
                  mov     ds,ax
                  mov     ah,40h
                  mov     al,00h
                  Int     21h
                  pop     ds
 
                  jnc     eswap12
 
;*--- Check if the amount of bytes wrote is equal than expected
 
                  mov     dx,offset eno_swap
                  call    print
                  call    getkey
                  jmp     escape
 
;*--- Increment pointer (next paragraph) decrement remaining size
 
eswap12:
 
                  mov     ax,usr_ptr
                  add     ax,swp_par
                  mov     usr_ptr,ax
 
                  mov     ax,usr_len
                  sub     ax,swp_par
                  mov     usr_len,ax
 
 
;*--- When remainder is equal to zero the swap is finished
 
                  cmp     ax,0000h
                  jne     eswap11
 
                  cmp     byte ptr cs:command_flag,00h
                  jne     eswap18
 
;*--- Clear Screen & Position cursor at upper left corner (0,0)
 
                  push    ds
                  push    es
                  call    clr_box
 
                  mov     bl,00h
                  mov     dx,0000h
                  mov     ah,02h
                  Int     10h
                  pop     es
                  pop     ds
 
;*--- To complete the swap the swapfile is closed
 
eswap18:
                  clc
 
                  mov     bx,cs:handle
                  mov     ah,3Eh
                  Int     21h
 
                  jnc     eswap15
 
                  mov     dx,offset eno_close
                  call    print
                  call    getkey
                  jmp     escape
 
;*--- When the swap is complete the piece of the user program swaped is
;*--- shrinked down to allow free space to be used.
 
eswap15:
 
                  mov     ax,usr_size
                  sub     ax,size_area
                  mov     bx,ax
                  mov     ax,usr_psp
                  mov     es,ax
                  mov     ah,4ah
                  mov     al,00h
                  Int     21h
 
                  jnc     load_command
 
                  mov     dx,offset eno_shrink
                  call    print
                  call    getkey
                  jmp     escape
 
load_command:
 
;*--- Set contents of EXEC Control Block
 
                  mov     ax,word ptr cs:2Ch
                  mov     env_segment,ax
                  mov     word ptr cs:env_segment + 4,cs
 
;*--- Select between default or specified DOS Command
 
                  cmp     command_flag,00h
                  je      default_com
                  mov     word ptr cs:env_segment + 2,offset dos_command
                  jmp     start_load
 
default_com:
 
                  mov     word ptr cs:env_segment + 2,offset dos_command_def
 
;*--- Save main registers on stack
 
start_load:
                  push    es
                  push    ds
                  push    bp
 
;*--- Save stack itself
 
                  mov     ss_save,ss
                  mov     sp_save,sp
 
;*--- Display PopUp message
 
                  cmp     byte ptr cs:command_flag,00h
                  jne     cont_load
 
                  mov     ax,cs
                  mov     ds,ax
                  mov     dx,offset StartUp
                  call    print
 
;*--- Load & Exec a Secondary DOS Command Processor
cont_load:
                  mov     ax,cs
                  mov     ds,ax
                  mov     es,ax
                  lea     dx,comspec_path
                  lea     bx,env_segment
                  mov     ah,4bh
                  mov     al,00h
                  Int     21h
 
;*--- Restore stack & registers
 
                  mov     ss,ss_save
                  mov     sp,sp_save
 
                  pop     bp
                  pop     ds
                  pop     es
 
;*--- Something wrong? , Display message.
 
                  jc      load_error
 
end_load:
                  cmp     byte ptr cs:command_flag,00h
                  jne     end_ldb
 
;*--- Display End Session message
 
                  mov     dx,offset Finish
                  call    print
 
end_ldb:
 
                  cmp     cs:buffer_type,"E"
                  je      external_retrieve
 
;*--- If internal swap done Allocate workspace again to preserve it.
 
internal_retrieve:
 
                  mov     ax,cs
                  mov     ds,ax
                  mov     es,ax
                  mov     bx,size_area
                  mov     ah,48h
                  Int     21h
 
;*--- Cann't, display message.
 
                  jc      prt_mem_err
 
;*--- Workspace is under ownership of the interrupted program
;*--- Access DOS Memory Control Block of allocated space and change
;*--- ID to point to PSP of FlashDOS.
 
                  mov     word ptr cs:ptr_area,ax
                  dec     ax
                  mov     ds,ax
 
                  assume  ds:mem
 
                  cmp     ds:memtype,"M"
                  jne     chg_mem_err
 
                  mov     ax,cs
                  mov     ds:memid,ax
 
;*--- Restablish addresability
 
                  assume  cs:cseg,ds:cseg,es:cseg,ss:cseg
                  mov     ax,cs
                  mov     ds,ax
                  jmp     escape
 
;*--- Error handling & display messages
 
chg_mem_err:
                  mov     ax,0ffh
prt_mem_err:
                  call    memory_error
 
;*--- Cann't claim back its memory, became inactive
 
                  mov     dormant,01h
                  mov     dx,offset now_inactive
                  call    print
 
                  jmp     escape
 
;*--- If load error is found after the message the workarea is claimed again
 
load_error:
                  call    memory_error
                  call    getkey
                  jmp     end_load
 
;*--- If external retrieve is active the memory is swapped back
 
external_retrieve:
 
;*--- Last, the Usr program is restored as a main PSP for DOS
 
                  push    cs
                  pop     ax
                  mov     es,ax
                  mov     ds,ax
 
;*--- The user memory block is restored to his original size
 
                  clc
 
                  mov     ax,usr_size
                  mov     bx,ax
                  mov     ax,usr_psp
                  mov     es,ax
                  mov     ah,4ah
                  mov     al,00h
                  Int     21h
 
                  jnc     eretr01
 
                  mov     dx,offset eno_retrieve
                  call    print
 EA     UTILS   珥�#    (   .ICONPOS ���  �      �  �  W    ���WPFolder:DSYMON     ���WPProgramFile:FISHUT.EXE �  `���WPProgramFile:FAUSHELL.EXE 7  `���WPFolder:DCPUIDLE �   `���WPFolder:DLOCK �   `���WPProgramFile:FBUNZIP2.EXE ]   `���WPDataFile:FCYGWIN1.DLL    `���WPFolder:DPDFVIE~1 �  ����WPFolder:DNSCUSERS f  ����WPFolder:DCOMMUN~1 #  ����WPFolder:DWINRAR �   ����WPProgramFile:FRAR.EXE �   ����WPProgramFile:FUNRAR2.EXE T   ����WPFolder:DREGMON    ����WPFolder:DFILEMON �  瓏��WPFolder:DSHELLS _  瓏��WPProgramFile:FAMDK6UPD.EXE   瓏��WPFolder:DREMUS �   瓏��WPProgramFile:FSHELLSEL.EXE k   瓏��WPProgramFile:FTERMINAL.EXE    瓏��WPProgramFile:FPIFEDIT.EXE �   ���WPFolder:DACDSEE32 P   ���WPFolder:DPCTOOLS    ���WPProgramFile:FCDROM.EXE �    ���WPFolder:DWINACE z    ���WPProgramFile:FGOGOTXT.EXE !    ���WPDataFile:FRAMDRIVE.SYS x  `���WPFolder:DPC-SPEED 8  `���WPFolder:DWINZIP �   `���WPFolder:DBIOS �   `���WPCommandFile:FALAB.BAT s   `���WPCommandFile:FDEMOK.BAT !   `���WPProgramFile:FMWUNDEL.EXE �  ����WPProgramFile:FGZIP.EXE p  ����WPProgramFile:FLINK.EXE /  ����WPProgramFile:FJAR32.EXE �   ����WPProgramFile:FSTV.EXE �   ����WPProgramFile:FJAR16.EXE a   ����WPProgramFile:FRAWRITE.EXE    ����WPProgramFile:FGREP.COM �  瓔��WPFolder:DNOTPAD L  瓔��WPFolder:DWINRESQ    瓔��WPProgramFile:FOKCLOAK.COM �   瓔��WPProgramFile:FNOCLOAK.COM \   瓔��WPDataFile:FQBASIC.INI    瓔��WPProgramFile:FPKLITE.EXE �   ���WPProgramFile:FUNPAK.EXE I   ���WPFolder:DADVANSYS    ���WPProgramFile:FREARJ.EXE �    ���WPProgramFile:FSETCOLOR.EXE f    ���WPFolder:DPKLITE     ���WPProgramFile:FPKT2000.COM �  `���WPProgramFile:FUNPACK.COM \  `���WPProgramFile:FZIP2EXE.EXE   `���WPProgramFile:FPKZIPFIX.EXE �   `���WPProgramFile:FDOZFONT.COM _   `���WPProgramFile:FPKUNZJR.COM    `���WPProgramFile:FLHA.EXE �  ����WPProgramFile:FBIN2TXT.EXE U  ����WPProgramFile:FSCAN_KB.COM   ����WPProgramFile:FSCSIEXE.EXE �   ����WPProgramFile:FREBOOT.COM f   ����WPProgramFile:FCLOCK.EXE    ����WPProgramFile:FGIFSHUF.EXE z  珱��WPFolder:DCONFSET :  珱��WPFolder:DWINAMP �   珱��WPProgramFile:FMOUSE.COM �   珱��WPFolder:DSBLIVE j   珱��WPProgramFile:FVSAFE.COM    珱��WPDataFile:FRAMDISK.SYS �   ���WPProgramFile:FIPX.COM B   ���WPProgramFile:FKGB.EXE    ���WPFolder:DCONFIG �    ���WPProgramFile:FUNDELETE.EXE f    ���WPProgramFile:FUNP.EXE     ���WPProgramFile:FDOS4GW.EXE �  `���WPFolder:DUNP O  `���WPDataFile:FVBRUN200.DLL �   `���WPDataFile:FVBRUN300.DLL �   `���WPProgramFile:FARJ.EXE c   `���WPDataFile:FVB40032.DLL    `���WPProgramFile:FUNRAR.EXE �  ����WPProgramFile:FUNIVBE.EXE C  ����WPProgramFile:FREAD.COM �   ����WPProgramFile:FPLAYCD.EXE �   ����WPProgramFile:FPKZIP.EXE l   ����WPProgramFile:FPKUNZIP.EXE    ����WPProgramFile:FPCPARK.COM }  ����WPProgramFile:FPARK.COM <  ����WPProgramFile:FMSD.EXE �   ����WPProgramFile:FLMOUSE.COM �   ����WPProgramFile:FHIEW.EXE b   ����WPProgramFile:FEXE2BIN.EXE    ����WPProgramFile:FDRAIN.COM �      WPDataFile:FCONFIG.SYS e      WPProgramFile:FBOOZ.EXE       WPProgramFile:FBAT2EXEC.COM �       WPCommandFile:FAUTOEXEC.BAT `       WPDataFile:FVBRUN100.DLL        WPFolder:DKGBUTIL �  `   WPFolder:DSN2000 i  `   WPProgramFile:FQBASIC.EXE "  `   WPFolder:DFDFORMAT �   `   WPFolder:DTBAV �   `   WPFolder:DFP `   `   WPFolder:DIOMEGA     `   WPFolder:DCD4X �    ���  
� .CLASSINFO ��� �   �   WPFolder �  � �   	 p WPFolder  sD  0 D P (�0        ����   @������������������������   @   @   @     t �� q ����    ����            	 D WPObject    g       	   �                  240687@10 ��   ��������                            -�����0���2�����5���                                        ������N�O�P�Q�R�S�T�U�V�W�X�Y�Z�[�\�]�^�_�`�a�b�c�d�e�f�g�h�i�j�k�l�m�n�o�p�q�r�s�t�u�v�w�x�y�z�{�|�}�~������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������                                                                     align="left"><a href="../contest.htm">Win 
                    a free copy!</a></p>
                  <p class="smalltext" align="left"><a href="../subscribe.htm">Free 
                    subscription</a></p>
                </td>
              </tr>
              <tr bgcolor="#FFCC66"> 
                <td colspan="2" bgcolor="#CCCCFF" height="10">&nbsp;</td>
              </tr>
              <tr bgcolor="#FFFF99"> 
                <td colspan="2" bgcolor="#FFFFFF" class="topics"><a href="../vitas/aboutme.htm">About</a> 
                </td>
              </tr>
              <tr bgcolor="#FFCC66"> 
                <td width="15" align="right" valign="top" height="48" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left">&nbsp; </p>
                </td>
                <td width="125" align="right" valign="top" height="48" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left"><a href="../vitas/aboutsite.htm">About 
                    this site</a></p>
                  <p class="smalltext" align="left"><a href="../vitas/contactme.htm">Contact 
                    me</a></p>
                  <p class="smalltext" align="left"> <a href="../vitas/myserv.htm">My 
                    services</a> </p>
                  <p class="smalltext" align="left"><a href="../vitas/guestbook.htm">Guestbook</a> 
                  </p>
                </td>
              </tr>
              <tr> 
                <td colspan="2" bgcolor="#CCCCFF">&nbsp;</td>
              </tr>
              <tr bgcolor="#0000CC"> 
                <td colspan="2" bgcolor="#FFFFFF" class="topics"><a href="../vitas/download.htm">Downloads</a></td>
              </tr>
              <tr bgcolor="#FFCC66"> 
                <td width="15" align="right" valign="top" height="48" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left">&nbsp;</p>
                </td>
                <td width="125" align="right" valign="top" height="48" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left"><a href="../vitas/downl_mso.htm">MS 
                    Office crackers</a></p>
                  <p class="smalltext" align="left"> <a href="../vitas/downl_pwl.htm">Windows 
                    security tools</a></p>
                  <p class="smalltext" align="left"> <a href="../vitas/downl_soft.htm">Developer 
                    tools</a></p>
                  <p class="smalltext" align="left"> <a href="../vitas/downl_free.htm">Free 
                    stuff</a></p>
                </td>
              </tr>
              <tr> 
                <td colspan="2" bgcolor="#CCCCFF">&nbsp;</td>
              </tr>
              <tr bgcolor="#0000CC"> 
                <td colspan="2" bgcolor="#FFFFFF" class="topics"><a href="articles.htm">Articles</a></td>
              </tr>
              <tr bgcolor="#FFCC66"> 
                <td width="15" align="right" valign="top" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left">&nbsp;</p>
                </td>
                <td width="125" align="right" valign="top" height="48" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left"><a href="psw.htm">About passwords</a></p>
                  <p class="smalltext" align="left"> <font color="#CC0000">PWL 
                    files</font></p>
                  <p class="smalltext" align="left"> <a href="mailpsw.htm">Email 
                    passwords</a></p>
                  <p class="smalltext" align="left"> <a href="antihack.htm">Shareware 
                    protection</a></p>
                </td>
              </tr>
              <tr> 
                <td colspan="2" bgcolor="#CCCCFF">&nbsp;</td>
              </tr>
              <tr bgcolor="#FFCC00"> 
                <td colspan="2" bgcolor="#FFFFFF" class="topics"><a href="../fun/index.html">Fun</a></td>
              </tr>
              <tr bgcolor="#FFCC66"> 
                <td width="15" align="right" valign="top" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left">&nbsp; </p>
                </td>
                <td width="125" align="right" valign="top" height="2" bgcolor="#CCCCFF"> 
                  <p class="smalltext" align="left"><a href="../fun/vrpic.htm">Pictures</a> 
                  </p>
                  <p class="smalltext" align="left"> <a href="../fun/techrat.htm">TechRat</a> 
                  </p>
                </td>
              </tr>
              <tr bgcolor="#FFCC66"> 
                <td colspan="2" bgcolor="#CCCCFF">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
    <td width="15" height="297">&nbsp;</td>
    <td width="590" height="297" valign="top"> 
      <table width="590" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCFF">
        <tr>
          <td class="welcome">PWL files</td>
        </tr>
      </table>
      <p class="normal">&nbsp;</p>
      <p class="normal">PWL file contains valuable information like dial-up and 
        network passwords. This is an universal storage for sensitive information. 
        Any program could use PWL files. However Microsoft does not provide technical 
        specification for PWL files and API description (as far as I know), so 
        usually only Microsoft programs use PWL files.</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> In other words PWL file is a secured database. Each record 
        has three fields:</p>
      <ol class="normal">
        <li> Resource type (0..255)</li>
        <li> Resource name</li>
        <li> Resource password</li>
      </ol>
      <p class="normal">Both resource name and resource password may be binary. 
        Moreover program may interpret these fields as it wants so 'resource name' 
        may be not a name and 'resource password' may be not a password. There 
        is exists a limit of 255 records per single PWL file. All records along 
        with user name and checksum are encrypted with strong cipher algorithm 
        RC4. Encryption key is derived from login password. Windows uses PWL files 
        to verify login password. However login password is not stored in PWL 
        file. Windows decrypts PWL file using specified password and then verify 
        checksum. If checksum is correct then entered password assumed to be valid. 
        So it is possible to get access to PWL file if only both login password 
        and user name are known. If login password is unknown then a search is 
        the only way to get access to PWL file's contents. User name must be known 
        because it is involved into checksum verification. Usually PWL file name 
        is the same as user name. However it is not necessary. PWL file name never 
        exceeds 8 characters. Windows never overwrites PWL files. By default PWL 
        files are located in the Windows directory. Since Windows never overwrites 
        PWL files it's possible that resulting PWL file name will be mangled. 
        For example, if robert.pwl file is already exists then new PWL file for 
        user Robert will have rober000.pwl file name. Next file name is rober001.pwl 
        and so forth.</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> Both user name and login password are case sensitive 
        for PWL file, however high level Windows functions convert them to uppercase. 
        Nevertheless there is an exception: dial-up network server use rna.pwl 
        file to store connections passwords. User name is *Rna (case sensitive).</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> Each PWL file must be registered in system. There is 
        [Password Lists] section in system.ini file. Each line in this section 
        looks like this: USERNAME=FullPathToPwlFile</p>
      <p class="topics">&nbsp; </p>
      <table width="590" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCFF">
        <tr> 
          <td class="topics">Resource types</td>
        </tr>
      </table>
      <p class="normal">&nbsp; </p>
      <p class="normal">Following resource types are most useful.</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> 6 - this resource type is used by dial-up networking 
        and MS Crypto API. Dial-up networking use PWL as follows. Resource name 
        looks like *Rna\ConnectionName\Username . Resource password is a connection 
        password.</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> 19 - WWW resource (used by Internet Explorer). Resource 
        name has following syntax: DomainName/Page title . Resource password contains 
        login name and password separated by colon. For example John:abc </p>
      <p class="normal">&nbsp;</p>
      <p class="normal">You can use pwlview program to examine current user's 
        PWL file contents.</p>
      <p class="topics">&nbsp; </p>
      <table width="590" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCFF">
        <tr> 
          <td class="topics">Windows versions</td>
        </tr>
      </table>
      <p class="topics">&nbsp;</p>
      <p class="normal"> The original Windows version contained a gross error 
        which enabled easy extracting of cached passwords (in fact, this is possible 
        for most (but not all) PWL files). Well-known program called glide do 
        this. However original glide.exe uses an imperfect algorithm so it fails 
        often. In the OSR2 version this error has been corrected, although security 
        problems persist (as you can see). Windows '98 does not seem to differ 
        from OSR2 in the sense of security, but Windows NT is built quite differently 
        (<a href="../vitas/downl_pwl.htm#ntp">click here</a> for NT recovery). 
        About Windows 3.11. Its PWLs are same with original Windows 95.</p>
      <p class="topics">&nbsp; </p>
      <table width="590" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCFF">
        <tr> 
          <td class="topics">PWL files reliability estimation (OSR2 version).</td>
        </tr>
      </table>
      <p class="normal">&nbsp;</p>
      <p class="normal">You should keep in mind that a saved password can be extracted 
        by a malefactor - therefore passwords should only be saved if no unauthorized 
        personnel can access your computer. It has to be mentioned that a PWL 
        file is encrypted and it's not easy to extract passwords from it. The 
        first Windows'95 version encryption algorithm was quite poor, which allowed 
        for a program for PWL files decryption to be created. However, in the 
        OSR2 version this drawback has been fixed - it is now much harder to decrypt 
        a PWL file.</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> Despite the information which is contained on my site, 
        the password storage system in OSR2 is generally made quite professionally 
        and is reliable from the cryptographer�s point of view. Still, it contains 
        several quite serious drawbacks, namely:</p>
      <ol class="normal">
        <li> All passwords are converted to uppercase, which significantly reduces 
          the quantity of various possible passwords and allows for a higher password 
          search speed. By the way, the low level password engine uses a password 
          �as is�, i.e., does not convert it to uppercase � it�s entirely the 
          fault of the high level part. This drawback is aggravated by #2.</li>
        <li> MD5 and RC4 algorithms are professional and decipher-resistant but 
          fast, which allows to implement a very fast password search.</li>
        <li> The password caching system is inherently unreliable. If some program 
          is able to get an earlier saved password than any hacker can do the 
          same thing. Microsoft should have explained to its customers that password 
          can be saved only if no unauthorized personnel can access your computer. 
          Yet, it would be inconvenient to abandon saving passwords altogether. 
          The right thing to do would be providing one more working mode for Windows 
          (and make this mode a default one) in which all passwords could be saved 
          but every time they have to be retrieved it took entering one short 
          master password to retrieve them.</li>
      </ol>
      <table width="590" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCFF">
        <tr> 
          <td class="topics">PWL files and US Government limitations on export 
            of cipher systems.</td>
        </tr>
      </table>
      <p class="normal">&nbsp;</p>
      <p class="normal"> Here�s one interesting note. There are export limitations 
        effective in USA on encryption systems with a key more than 40 or 56 bit 
        long (depending on systems� destination). Windows uses the professional 
        RC4 ciphering algorithm with a 128-bit key (a 128-bit key is obtained 
        by converting a password with an unlimited length). This code is present 
        in all Windows� versions including the international ones. I�m not a lawyer 
        and I�m not commenting this fact, meanwhile I would be interested in knowing 
        a lawyer�s opinion on this problem.</p>
      <p class="topics">&nbsp; </p>
      <table width="590" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCFF">
        <tr> 
          <td class="topics">PWL-related software</td>
        </tr>
      </table>
      <p class="normal">&nbsp;</p>
      <p class="normal"><a href="../vitas/downl_pwl.htm#pwlview">PWLView</a> will 
        show current username and login password if you run it on a logged-on 
        computer. It also shows all cached passwords (such as dial-up networking 
        passwords).</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> <a href="../vitas/downl_pwl.htm#pwltool">PwlTool</a> 
        is much more powerful version of PwlView. It able to obtain information 
        from PWL files when logon password is lost. PwlTool uses brute-force attack 
        (fastest!) dictionary search or <a href="../vitas/smartforce.htm">smart-force</a> 
        technology to recover a password.</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> <a href="../vitas/downl_pwl.htm#makepwl">MakePWL</a> 
        is an extremely useful tool for administrators who need to pre-configure 
        multiple computers. You can specify password information and MakePWL will 
        create PWL file that can be simply copied to another computers.</p>
      <p class="topics">&nbsp; </p>
      <table width="590" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCFF">
        <tr> 
          <td class="topics">Some tricks and tips</td>
        </tr>
      </table>
      <p class="normal">&nbsp;</p>
      <p class="normal"> <font color="#0033CC">Q: Are PWL files safe ?</font></p>
      <p class="normal"> A: They are safe if only login password is long enough 
        (alphanumerical, at least 8 characters long) AND intruder has no physical 
        access to the computer after logon. If user leaves computer unattended 
        after logon intruder can grab passwords from computer's memory.</p>
      <p class="normal">&nbsp;</p>
      <p class="normal"> <font color="#0033CC">Q: How to force Windows do not 
        ask login password at startup ?</font></p>
      <p class="normal"> A: You can enable silent logon as follows</p>
      <ol class="normal">
        <li> Set empty login password</li>
        <li>Select "Windows Logon" as the value in the Primary Network Logon box 
          in the Network option in Control Panel.</li>
        <li> Make sure that user profiles are NOT enabled (using the Passwords 
          option in Control Panel or by setting the related system policy).</li>
      </ol>
      <p class="normal"> <font color="#0033CC">Q: Tell me more about passwords</font></p>
      <p class="normal"> A: There are many various guides how to choose right 
        password. One o �L$$�J�H �D$�n� P�� f��"P ��0�   commdlg_help    commdlg_FindReplace WndProcPtr%.8X%.8X  f�=�"P  tf��"P P蒻� �   �-��P s<莨i �Q��葷����g� �"� �Y� � <  �C��蒻�  茵o����� �� �  U���椿S�E�犬"P 茲) f�E� 3��E��葭� �U�dg�  �E�[��]�U���椿S�E�姑"P �m) f�E� �3��E��菁� �U�dg�  �E�[��]�U���辻S�M��E�語"P �1) f�E� 3��E���M怦�� �U�dg�  �E�[��]�U���槻S���E��#P 蔘( f�E� j j j j j�Sj j ��� �E��}�u�U�3��
�E����u壽�� Y�E�j j �u��u�j�Sj j �^� �E��E�3���M��U俶�� P�u俶�� YX�E�dg�  �E�[��]�U���槻S���E��4#P �^( f�E� �U��U��]崙E� 3��E���U俶}� �M�dg�  �E�[��]�U���辻S���E��h#P �( f�E� �U�3��
f�E� 3��E��U��E��宙埒 �U��E�莠   �M��E��   �}   �M�dg�  �E�[��]�U���辻�E�絹#P 莟' f�E� �U�3��
f�E� �E�梯�<$3��E��E��E韆6� �U��E��Q   �M��E��   �   �M�dg�  �E���]� U��QSV���E��}� t�E��_� ��   t	�u�茵���Y^[Y]�U��SV������ ��^[]�U��SV������ ��^[]�U���槌S�M��U��E亳$P 蒟& f�E� 3��U��E�f�E� �M��M��U���E��M��	��� f�E�  �U��E�������E�f�E�, P�M��E��   �8���Xf�E�  �E��U�dg�  [��]�U��S� �蕈� ����[]�U��S� �蓙� ����[]�U��S� �菻� ����[]�U��S� �莠� ����[]�U��SV�������宙����樟��染�^[]�U��SV�������宙����樟��染�^[]�U���辻SV���惴\$P 菠% �E��帶?����E��0f�E� �E��嚠*����E�� Z�3� P�M��E��   �7����M��E��   �'���X�U�dg�  ^[��]�U���辻SV���惴�$P �Y% �E��帶煉���E��0f�E� �E��嚠惚���E�� Z蓼� P�M��E��   萋����M��E��   莇���X�U�dg�  ^[��]�U��S� �y� []�U��� ������]�U���辻SVW�M����惴�$P 菁$ �VR蒻� Y��3�;�~�@;���7 f�E� �E��怦癩���E�f�E� W荀� Yf�E�  �U��E��O����E�f�E�, P�M��E��   ����Xf�E�  �E��U�dg�  _^[��]�U���辻S�U��惴D%P �.$ f�E� 3��U��U��E��宙擬 �U��E�萵����E�f�E� P�M��E��   �����Xf�E� �E��U�dg�  [��]�U���椿SVW�����惴�%P 萓# f�E� 3��U��M�Q�E������宙x� �U��E�o����Ef�E� P�M��E��   �&���Xf�E� �E��U�dg�  _^[��]� U���辻SVW�����惴�%P �I# f�E� 3��U��M�Q�E��E��嚠�����E�� ���帶\� �U��E蓚����Ef�E� P�M��E��   茴����M��E��   �����Xf�E� �E��U�dg�  _^[��]� U���槻SV�M����惴@&P 莎" f�E� f�VR�v�6�E��嚠����E�� 3��U��U��E跏�� �U��E��R����E�f�E� P�M��E��   �	����M��E��   蔔���Xf�E� �E��U�dg�  ^[��]�U���椿SVW�����惴�&P �" f�E� f�UR�u�u3��M��E�P�E������宙� �U��E菽����Ef�E� P�M��E��   �z���Xf�E� �E��U�dg�  _^[��]� U���辻SV�M����惴�&P ��! f�E� 3��U��M��E����宙�� �U��E��O����E�f�E� P�M��E��   ����Xf�E� �E��U�dg�  ^[��]�U���辻�E��$'P �2! f�E� �u�u3��M��E��E韆�� �U��E�萵����E�f�E� P�M��E��   �����Xf�E� �E��U�dg�  ��]� U���辻SV�M����惴p'P 菴  f�E� �u�u3��M��M��E����宙秣 �U��E��k����E�f�E� P�M��E��   �"���Xf�E� �E��U�dg�  ^[��]� U��j j j��8 t� �個+P Pj j 莇� ]�U��S��QSj��8 t� �古+P Pj j ��� ��[]�U�跏\� ]�U���梯S�M��U��E��U��E�� �M�蔬� [��]�U���梯S�M��U��E��E��U��M���� [��]�U���程S�U��E��E��U��V� [YY]�U���程S�U��E��U���E�� 蒡� [YY]�U���槻S�U��惴�'P �o f�E� �E��嚠灌���E�� 3��U��U��E跏�� �U��E������E�f�E� P�M��E��   萢����M��E��   莉���Xf�E� �E��U�dg�  [��]�U���槻S�U��惴 (P 蒟 f�E� �E��嚠V����E�� 3��U��U��E跏�� �U��E�������E�f�E� P�M��E��   �E����M��E��   �5���Xf�E� �E��U�dg�  [��]�U���槻S�U��惴x(P �_ f�E� �E��嚠劣���E�� 3��U��U��E跏=� �U��E������E�f�E� P�M��E��   莉����M��E��   茘���Xf�E� �E��U�dg�  [��]�U���槻S�U��惴�(P 蒄 f�E� �E��嚠F����E�� 3��U��U��E跏� �U��E��~����E�f�E� P�M��E��   �5����M��E��   �%���Xf�E� �E��U�dg�  [��]�U���槻S�U��惴()P �O f�E� �E��嚠杖���E�� 3��U��U��E跏�� �U��E�蔬����E�f�E� P�M��E��   茘����M��E��   �����Xf�E� �E��U�dg�  [��]�U���槌S�M��U��E垳�)P 菽 f�E� 3��U��E�f�E� �M��M��E�P�M��U��E�� �� f�E�  �U��E�[����Ef�E�, P�M��E��   ����Xf�E�  �E��U�dg�  [��]� U���椿S�惴�)P �= f�E� �E��嚠�����E�� �s� P�M��E��   荳���X�U�dg�  [��]�U���椿SV���惴�)P 蓁 f�E� �E��嚠\����E�� �帶Z� P�M��E��   �h���X�U�dg�  ^[��]�U���槻S�惴*P �� f�E� �E��嚠����E�� �R� �]��M��E��   �����E��M�dg�  [��]�U���辻SVW�����惴H*P �F �E��嚠資���E��0f�E� �E��帶�����E�� ��Z葩� P�M��E��   莟����M��E��   茵���X�U�dg�  _^[��]�U���辻SV���惴x*P 菻 �E��嚠G����E��0f�E� �E��帶2����E�� Z莚� P�M��E��   �?����M��E��   �/���X�U�dg�  ^[��]�U���椿SV���惴�*P �a f�E� �E��嚠偃���E�� �帶嬖 P�M��E��   蒂���X�U�dg�  ^[��]�U���辻SV���惴�*P � �E��嚠�����E��0f�E� �E��帶n����E�� Z�|� P�M��E��   �{����M��E��   �k���X�U�dg�  ^[��]�U���椿SV���惴�*P �� f�E� �E��嚠����E�� �帶拮 P�M��E��   ����X�U�dg�  ^[��]�U��SV�������宙����H����^[]�U��SV�������宙~���������^[]�U���椿S�惴+P � f�E� �E��嚠�����E�� �i� P�M��E��   �����X�U�dg�  [��]�U���通S�M��U��惴h+P 莨 f�E� �E��嚠�����E�f�E� �M��M��E��U��� � f�E�  �U��E��X����E�f�E�, P�M��E��   ����Xf�E�  �E��U�dg�  [��]�U���uj �u�   ��]�U�������P�槻SVW�]�u鍵+P � 3��E�   S�E�+�@P��倆���RV�~W ����倆���Q��� Y�����x u!�U�RV萠V ��:]�t�M�QV蔗W ��覈f�E� ��倆���E�蓖����E��U��E�p����M��E��   �1����M�dg�  _^[��]� �-��P s7萠l��葫� ���  萬� 茴)  菘l���(]���� ��� ��� ��p �
TShapeType       AI stRectanglestSquarestRoundRectstRoundSquare	stEllipsestCircle        �I     �I     �I �   �H c�K d�K e�K ��H ��K ��K �"I ��G Y�H ��G �G !�G $�G <�G ��H n�H �H %�G ��H *�G 3�G S�G L�G X"I ��H ��H ��H ��H 挑H q�H |�H �H 皃H =�H ��H @�H ��H ��H  �H 潯H �H s�H ��H \�H ��H �H 薈H 螂H 研H 欧H 磴H q�H 造H 7#I   W$I StyleChangedTShapeTShape�I ��H  ExtCtrls ��I �  �`$I       �   � Brushy�@ V  �V  �      �����	 
DragCursor��@ D  ��  �      �    
 DragMode�~K @  �k�H       �    Enabled�~K f  �磧H       �    ParentShowHint舟I �  �l$I       �   � PenAI �  �x$I       �     Shape�~K e  �函H ァH    �   � ShowHint�~K ?  �9�H       �    Visible�}H �  ��  �      �   � 
OnDragDrop}}H �  ��  �      �   � 
OnDragOverj~H �  ��  �      �   � 	OnEndDragn|H h  �h  �      �   � OnMouseDown�|H p  �p  �      �   � OnMouseMoven|H x  �x  �      �   � 	OnMouseUp/~H �  ��  �      �   � OnStartDrag        I             I �   �H c�K d�K e�K ��H ��K ��K %I ��G Y�H ��G �G !�G $�G <�G ��H n�H �H %�G ��H *�G 3�G S�G L�G �$I ��H ��H ��H ��H 挑H q�H |�H �H 皃H =�H ��H @�H ��H C%I  �H 潯H �H s�H ��H \�H ��H �H 薈H 螂H 研H 欧H 磴H q�H 造H r%I TImageTImageKI ��H  ExtCtrls ��@ C  �
�H       �     Align�~K �  �f&I       �    	 AutoSize�~K �  �t&I       �    
 Centery�@ V  �V  �      ����� 
DragCursor��@ D  ��  �      �     DragMode�~K @  �k�H       �    Enabled�~K f  �磧H       �    ParentShowHintD�I �  ��&I       �   � Picture�J X  ���H       �   � 	PopupMenu�~K e  �函H ァH    �   � ShowHint�~K �  ��&I       �     Stretch�~K ?  �9�H       �    VisibleSkG �  ��  �      �   � OnClickSkG �  ��  �      �   � 
OnDblClick�}H �  ��  �      �   � 
OnDragDrop}}H �  ��  �      �   � 
OnDragOverj~H �  ��  �      �   � 	OnEndDragn|H h  �h  �      �   � OnMouseDown�|H p  �p  �      �   � OnMouseMoven|H x  �x  �      �   � 	OnMouseUp/~H �  ��  �      �   � OnStartDragTBevelStyle       I 	bsLoweredbsRaisedTBevelShape       GI bsBoxbsFrame	bsTopLinebsBottomLine
bsLeftLinebsRightLine        �I             �I �   �H c�K d�K e�K ��H ��K ��K &�H ��G Y�H ��G �G !�G $�G <�G ��H n�H �H %�G ��H *�G 3�G S�G L�G h'I ��H ��H ��H ��H 挑H q�H |�H �H 皃H =�H ��H @�H ��H ��H  �H 潯H �H s�H ��H \�H ��H �H 薈H 螂H 研H 欧H 磴H q�H 造H 0)I TBevelTBevel�I ��H  ExtCtrls ��@ C  �
�H       �     Align�~K f  �磧H       �   	 ParentShowHintGI �  ��'I       �    
 Shape�~K e  �函H ァH    �   � ShowHintI �  ��'I       �     Style�~K ?  �9�H       �    VisibleTBevelWidth   ���TBorderWidth    ���        I         �I I 4  X�H c�K d�K e�K �H ��K ��K ,�H ��G Y�H ��G A�H !�G $�G <�G ��H ０H �H ��H ��H *�G 3�G S�G L�G )+I ��H ��H s�H ��H 挑H q�H |�H �H 皃H S�H s�H ��H ��H ��H  �H 潯H �H s�H 斃H \�H ��H =�H 薈H ��H 研H 轅H e�H c�H I�H �,I ��H �+I �H �H ��H E�H ��H �H 5�H /�H 麕H b�H P�H �H 蚰H -I K,I  ��2� ,I ,I :,I {,I TCustomPanelTCustomPanel�I k�H 	 ExtCtrls          �I             �I 4  �I c�K d�K e�K �H ��K ��K ,�H ��G Y�H ��G A�H !�G $�G <�G ��H ０H �H ��H ��H *�G 3�G S�G L�G )+I ��H ��H s�H ��H 挑H q�H |�H �H 皃H S�H s�H ��H ��H ��H  �H 潯H �H s�H 斃H \�H ��H =�H 薈H ��H 研H 轅H e�H c�H I�H �,I ��H �+I �H �H ��H E�H ��H �H 5�H /�H 麕H b�H P�H �H 蚰H -I K,I TPanelTPanel�I I - ExtCtrls$ ��@ C  �
�H       �    	 Align�jG 0 �v.I       �   
 	Alignment��@  ��.I       �     
BevelInner��@  ��.I       �    
BevelOuter�I  ��.I       �    
BevelWidth�I   ��.I       �     BorderWidth�:I $ ��.I       �     BorderStyley�@ V  �V  �      ����� 
DragCursor��@ D  ��  �      �     DragMode�~K @  �k�H       �    Enabledd|H ��H ��H       �   � Captionh�@ P  � �H �H    �  � Color�~K �  ���H ��H    �   � Ctl3Dk�I L  ���H ��H    �   � Font�~K & �& �      �     Locked�~K B  �!�H       �     ParentColor�~K �  �警H       �    ParentCtl3D�~K A  ���H       �    
ParentFont�~K f  �磧H       �    ParentShowHint�J X  ���H       �   � 	PopupMenu�~K e  �函H ァH    �   � ShowHintP|H 旛H T�H       ����� TabOrder�~K �  �j�H       �     TabStop�~K ?  �9�H       �     VisibleSkG �  ��  �      �   �! OnClickSkG �  ��  �      �   �" 
OnDblClick�}H �  ��  �      �   �# 
OnDragDrop}}H �  ��  �      �   �$ 
OnDragOverj~H �  ��  �      �   �% 	OnEndDragSkG   �  �      �   �& OnEnterSkG  � �      �   �' OnExitn|H h  �h  �      �   �( OnMouseDown�|H p  �p  �      �   �) OnMouseMoven|H x  �x  �      �   �* 	OnMouseUpSkG ( �( �      �   �+ OnResize/~H �  ��  �      �   �, OnStartDrag        !I         � I � I ,  h�J c�K d�K e�K �H ��K ��K �2I ��G Y�H ��G �6I !�G $�G <�G ��H �4I �H ��H ��H *�G 3�G S�G L�G +2I ��H ��H s�H ��H 挑H q�H |�H �H 皃H S�H s�H ��H ��H ��H  �H 潯H �H s�H 斃H \�H ��H =�H 薈H ��H 研H 轅H e�H c�H I�H �5K ��H r�H �H �H ��H E�H ��H �H 5�H /�H 麕H b�H P�H �H 蚰H �5K �6I  �� W6I �6I �6I TCustomRadioGroupTCustomRadioGroup�I ��J 	 ExtCtrls  U���椿S�]�[��C�E��C�E���E��C�E��E�P��E�@��@菫�  �E��E��E��E���E��C�E��E��E��E��E��U��E�@��   荼�  �E�P�E�@��@�w�  �M��E��E��E��E��C�E��C�E��E��E��E��E��U��E�@��   �j�  [��]�U���梯S�M��U��E��]�E��@�   萬�  �E��H�E��H��~KU����Yj�j��E�P蕘p ����E��@�E��@[��]� U��QSV��t�悌蔕u �U���3��宙U���f§"I fC<f�C<�A   �宙�y���A   �宙�y���絹�I 莢�  ���蓋   �^�FW$I ����I �\�  ���骸   �^�FW$I ���}� t菫u d�    ��^[Y]�     SV茘u �������   蓙s ���   葩s ���磅�捺������~�捺nu ^[�SVWU�程���外   ���   �捺��  ���   �捺��  �F���  劍y�� �$�$�D$�F�s�  �{4+�G�F�e�  �k8+�E�F�W�  ��uOM;�~�萩�����   ��t
��t��u+���y�� <$+蔆�y�� l$�������   ��r��r!��rD�Z<$Wl$U�L$�T$�捺��  �@<$Wl$U����y��霜RR�L$���T$荐�  �<$Wl$U�L$�T$�捺蠅  YZ]_^[�����   ����   ��Q����   ��Q�:��   t���   ����   �U��QSV��t�悌菫s �U���3��宙���f�%I fC<f�C<��/�I �r ���慨   �^�F�&I �i   �宙Xw���i   �宙,w�����}� t荐s d�    ��^[Y]�   SV��s �������   蔆q ���磅�捺餮����~�捺bs ^[�SVW��3����   �x�悩Q�I 茹q ��t	�蝿s�  ����_^[�SV�悌�懼Ct-�外   ��F�@�  ��F��  �C4P�C8P3�3��捺蠅  �珊    t������Ql��   �産    tW���   �l�  P�D$P���   �[�  �S8+佰�y�� R���   �.�  �S4+佰�y�� R���   ��  ��XZ蓐Q���'���   ��  P�D$P���   蓖�  ��3�3先�Q�����   ���   �J�壽里  ��^[����   �俶=   �:��   t���   �俶'   �V�����   ��Q^�:��   t���   �俶   �SV���燦    tF���   �f�  ��~7���   �l�  ��~(���   �H�  P���   �Q�  P�K0�S,���0���   �慨   �F�Q�I 蒡o ��t,�捺�  ;C4| ���   ��  ;C8|f�d'I fC<f�C<�f�d'I ��f#C<f�C<������   ^[� @   SV��t�悌蓐p ����3��捺J���f｛'I fF<f�F<���    ���    �2   �捺tt���2   �捺�t������t蒿p d�    ��^[�    :��   t���   ����   �:��   t���   ����   �U���槻SV���E�@��旭   �E�P��F��  �M��S�茫O���E��E��E��E��M��S���O���E��E��E��E��M��S�C�xO���E��E��E��E��U莵   �捺檗  �E�P��F茴�  �M��S�C�AO���E��E��E��E��M��S�C�'O���E��E��E��E��M��S��O���E��E��E��E��U莵   �捺s�  ^[��]�U��SVW�����U�R����   ���C� �  �����宙�  �M�U�宙��  _^[]� U���停S�E��E����   �   �@茫�  �E��鹸    u�E�  ��E�  ���E�  ��E�  ��E����   ����  �$��)I �)I �)I A*I w*I �*I �*I U�E��@8HP�E�P�E��H4I3�3先*N���E粫1���Y�M  �]��E��E�U�E��@8HP�E�P�E��H4I�   �   蒡                 call    getkey
                  jmp     escape
 
eretr01:
 
;*--- Now the swapfile is open for read
 
                  clc
 
                  push    cs
                  pop     ds
                  mov     dx,offset swapfile
                  mov     ax,3D00h
                  Int     21h
 
                  jnc     eretr02
 
                  mov     dx,offset eno_open
                  call    print
                  call    getkey
                  jmp     escape
 
;*--- If the file was sucefully open the swaped part of the memory is restored
 
eretr02:
                  mov     cs:handle,ax
 
                  push    cs
                  pop     ax
                  mov     es,ax
                  mov     ds,ax
 
                  mov     ax,usr_base
                  mov     usr_ptr,ax
                  mov     ax,size_area
                  mov     usr_len,ax
 
eretr03:
                  mov     bx,usr_len
                  mov     ax,0fffh
 
 
                  cmp     ax,bx
                  jb      more_64Kb
 
                  mov     ax,usr_len
                  mul     par_size
                  mov     swp_len,ax
                  mov     swp_par,bx
                  jmp     swap_out
 
more_64Kb:
                  mov     ax,0FFF0h
                  mov     swp_len,ax
                  mov     ax,0fffh
                  mov     swp_par,ax
 
swap_out:
                  clc
 
                  mov     bx,handle
                  mov     cx,swp_len
                  mov     dx,0000h
 
                  push    ds
                  mov     ax,usr_ptr
                  mov     ds,ax
                  mov     al,00h
                  mov     ah,3Fh
                  Int     21h
                  pop     ds
 
                  jnc     eretr04
 
                  mov     dx,offset eno_swap
                  call    print
                  call    getkey
                  jmp     escape
 
eretr04:
 
                  mov     ax,usr_ptr
                  add     ax,swp_par
                  mov     usr_ptr,ax
 
                  mov     ax,usr_len
                  sub     ax,swp_par
                  mov     usr_len,ax
 
                  cmp     ax,0000h
                  je      eretr04b
                  jmp     eretr03
 
;*--- If the swap back ends sucefully the swapfile is closed
 
eretr04b:
                  mov     bx,handle
                  mov     ah,3Eh
                  Int     21h
 
                  jnc     eretr05
 
                  mov     dx,offset eno_close
                  call    print
                  call    getkey
                  jmp     escape
 
eretr05:
 
;*--- Just to be clean the swapfile is erased from the disk
 
                  clc
 
                  push    cs
                  pop     ds
                  mov     dx,offset swapfile
                  mov     ah,41h
                  Int     21h
 
                  jnc     escape
 
                  mov     dx,offset eno_erase
                  call    print
                  call    getkey
                  jmp     escape
 
escape:
                  ret
 
dos_loader        endp
 
;*-------------------------------------------------------------------*;
;* Wait for any key to be pressed                                    *;
;*-------------------------------------------------------------------*;
 
getkey            proc    near
 
                  mov     ah,1
                  int     16h
                  jne     getkey1
                  jmp     getkey
 
getkey1:          mov     ah,0
                  int     16h
 
                  ret
getkey            endp
 
 
;*-------------------------------------------------------------------*;
;* Save/Restore Screen                                               *;
;*-------------------------------------------------------------------*;
 
screen            proc    near
                  cld
                  mov     bh,display_page
                  mov     ch,00
                  mov     cl,nrow
                  mov     dh,box_row
row_loop:
                  push    cx
                  mov     cx,ncol
                  mov     dl,box_col
col_loop:
                  push    cx
                  mov     ah,2
                  int     10h
                  cmp     si,0FFFFh
                  je      do_save
                  lodsw
                  mov     bl,ah
                  mov     ah,9
                  mov     cx,01
                  int     10h
                  jmp     short do_loop
do_save:
                  mov     ah,8
                  int     10h
                  stosw
 
do_loop:
                  inc     dl
                  pop     cx
                  loop    col_loop
                  pop     cx
                  inc     dh
                  loop    row_loop
                  ret
screen            endp
 
 
;*-------------------------------------------------------------------*;
;* Clear Screen and Set Color                                        *;
;*-------------------------------------------------------------------*;
 
clr_box           proc    near
                  mov     ax,0600h
                  mov     ch,box_row
                  mov     cl,box_col
                  mov     dh,box_row - 1
                  add     dh,nrow
                  mov     dl,box_col + ncol - 1
                  mov     bh,attribute
                  int     10h
                  ret
clr_box           endp
 
;*-------------------------------------------------------------------*;
;* New Disk BIOS Interrupt Handler                                   *;
;*-------------------------------------------------------------------*;
 
int_13            proc    far
                  assume  ds:nothing,es:nothing
                  mov     cs:disk_status,1
                  pushf
                  call    dword ptr cs:old_int_13
                  mov     cs:disk_status,0
                  sti
                  ret     2
int_13            endp
 
;*-------------------------------------------------------------------*;
;* New Main DOS Interrupt Handler                                    *;
;*-------------------------------------------------------------------*;
 
int_21            proc    far
                  mov     cs:lo_fn_flag,0
                  cmp     ah,0
                  jne     check
                  mov     ah,4Ch
go_direct:
                  jmp     dword ptr cs:old_int_21
check:
                  cmp     ah,0ch
                  ja      go_direct
                  inc     cs:lo_fn_flag
                  pushf
                  call    dword ptr cs:old_int_21
                  mov     cs:lo_fn_flag,0
                  ret     2
int_21            endp
 
 
 
;*-------------------------------------------------------------------*;
;* Handler of process errors                                         *;
;*-------------------------------------------------------------------*;
 
memory_error      proc    near
                  assume  cs:cseg,ds:cseg,es:cseg,ss:cseg
                  push    ds
                  push    ax
 
                  mov     ax,cs
                  mov     ds,ax
 
                  pop     ax
 
                  cmp     ax,01h
                  je      err_mem_01h
                  cmp     ax,02h
                  je      err_mem_02h
                  cmp     ax,05h
                  je      err_mem_05h
                  cmp     ax,10
                  je      err_mem_10h
                  cmp     ax,11
                  je      err_mem_11h
                  cmp     ax,07h
                  je      err_mem_07h
                  cmp     ax,08h
                  je      err_mem_08h
                  cmp     ax,09h
                  je      err_mem_09h
                  cmp     ax,0ffh
                  je      err_mem_ffh
err_mem_oth:
                  mov     dx,offset merrot
                  call    print
                  jmp     end_memory
 
err_mem_07h:
                  mov     dx,offset merr07
                  call    print
                  jmp     end_memory
err_mem_01h:
                  mov     dx,offset merr01
                  call    print
                  jmp     end_memory
err_mem_02h:
                  mov     dx,offset merr02
                  call    print
                  jmp     end_memory
err_mem_05h:
                  mov     dx,offset merr05
                  call    print
                  jmp     end_memory
err_mem_10h:
                  mov     dx,offset merr10
                  call    print
                  jmp     end_memory
err_mem_11h:
                  mov     dx,offset merr11
                  call    print
                  jmp     end_memory
 
err_mem_08h:
                  mov     dx,offset merr08
                  call    print
                  jmp     end_memory
 
err_mem_09h:
                  mov     dx,offset merr09
                  call    print
                  jmp     end_memory
 
err_mem_ffh:
                  mov     dx,offset merrff
                  call    print
                  jmp     end_memory
 
end_memory:
                  call    getkey                          ;Version 2.0
                  pop     ds
                  ret
memory_error      endp
 
;*-------------------------------------------------------------------*;
;* Routine to convert from binary to ASCII (Hex Format)              *;
;*-------------------------------------------------------------------*;
 
L0154             proc    near
 
                  push    cx
                  mov     cx,4
                  mov     ah,0
                  rol     ax,cl
                  ror     al,cl
 
L015E:            add     al,30h;'0'
                  cmp     al,39h;'9'
                  jle     L0166
                  add     al,7
 
L0166:            cmp     ch,0
                  je      L016D
                  xchg    al,ah
                  pop     cx
                  ret
 
 
L016D:            mov     ch,1
                  xchg    al,ah
                  jmp     L015E
 
L0154             endp
 
;*-------------------------------------------------------------------*;
;* Print String - BIOS based version of Int 21h Fn=09h               *;
;*-------------------------------------------------------------------*;
 
print             proc    near
                  assume  cs:cseg,ds:cseg,es:cseg,ss:cseg
                  push    es
                  push    ds
                  push    ax
                  push    dx
                  push    si
                  push    bx
                  push    cx
                  mov     ax,dx
                  mov     si,ax
                  mov     ax,cs
                  mov     ds,ax
 
print_loop:
                  cmp     byte ptr cs:[si],"$"
                  je      eprint
 
                  mov     ah,0Fh
                  Push    si
                  Int     10h
                  Pop     si
 
                  mov     bl,00h
                  mov     al,byte ptr cs:[si]
                  mov     ah,0eh
 
                  Push    si
                  Int     10h
                  Pop     si
 
                  inc     si
 
                  jmp     print_loop
eprint:
                  pop     cx
                  pop     bx
                  pop     si
                  pop     dx
                  pop     ax
                  pop     ds
                  pop     es
                  ret
print             endp
 
 
;*-------------------------------------------------------------------*;
;* Main Initialization code                                          *;
;*-------------------------------------------------------------------*;
 
initialize        proc    near
                  assume  cs:cseg,ds:cseg,es:nothing,ss:cseg
 
;*--- Set addresability & Display Copyright notice
 
                  mov     ax,cs
                  mov     ds,ax
                  mov     es,ax
 
                  mov     dx,offset copyright
                  call    print
 
;*--- Check if DOS version is greater than 2.00
 
                  push    es
                  push    ds
                  mov     ah,30h
                  Int     21h
 
                  cmp     al,02h
                  jge     next_init
 
;*--- No, message error and terminate
 
                  mov     load_flag,0
                  mov     dx,offset wrong_dos
                  call    print
                  pop     ds
                  pop     es
                  jmp     no_load
 
next_init:
                  pop     ds
                  pop     es
                  mov     word ptr [main+0],0
                  mov     word ptr [main+2],0
 
;*--- Search for copies of itself on DOS memory chain
 
                  xor     bx,bx
                  mov     ax,cs
next_para:
                  inc     bx
                  cmp     ax,bx
                  mov     es,bx
                  je      end_search
                  mov     si,offset id
                  mov     di,si
                  mov     cx,id_len
                  rep     cmpsb
                  or      cx,cx
                  jnz     next_para
 
;*--- Another copy was founded, send message and prevent to load again
;*--- also, the segment in wich the previous copy was founded is saved
 
                  mov     load_flag,0
                  mov     ax,es
                  mov     curr_segm,ax
 
                  mov     dx,offset yet_loaded
                  call    print
                  jmp     get_parm
 
end_search:
 
;*--- No another copy can be founded, prosecute installation
 
                  mov     load_flag,1
 
;*--- In ES is stored the current CS segment , save it
 
                  mov     ax,es
                  mov     curr_segm,ax
 
;*--- Now command parameters are inspected
 
 
get_parm:
 
;*--- Point to first character of parameter area in the PSP
 
                  mov     si,81h
                  push    cs
                  pop     ds
 
;*--- Throw away if blank
 
parse:
                  cmp     ds:byte ptr [si],32
              