home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / UTIL / WWIVE / MYWIVE.ZIP / LOADER.ASM < prev    next >
Assembly Source File  |  1991-06-13  |  2KB  |  82 lines

  1. .MODEL TINY
  2.  
  3.  
  4.  
  5. .CODE
  6.         org     100h
  7.  
  8.  
  9. start:
  10.         jmp     start1
  11.  
  12.  
  13.  
  14. flag    db      1
  15. prog_name:
  16.         db      'BBS.EXE',0
  17.         db      60 dup (0)
  18.  
  19.  
  20.  
  21. start1:
  22.         mov     ax,cs
  23.         mov     ss,ax
  24.         mov     sp,OFFSET stack_top     ; set the stack
  25.  
  26.         mov     es,ax
  27.         mov     bx,OFFSET stack_top     ; last byte used
  28.         mov     cl,4
  29.         shr     bx,cl                   ; get paragraph count
  30.         add     bx,1                    ; add 1 for luck
  31.         mov     ah,4ah                  ; func 4AH = SETBLOCK
  32.         int     21h                     ; give back most of memory to DOS
  33.  
  34. exec:
  35.         push    cs
  36.         push    cs
  37.         push    cs
  38.         pop     ds
  39.         pop     es
  40.         mov     dx,OFFSET flag          ; DS:DX points to flag, prog name
  41.         mov     ax,256bh                ; set vector 6bh to DS:DX
  42.         int     21h
  43.         pop     ax                      ; AX=CS=DS=ES
  44.         mov     word ptr [parm_block+4],ax ; Set CS in parm_block
  45.         mov     dx,OFFSET prog_name     ; get program name offset
  46.         mov     bx,OFFSET parm_block    ; get offset of parm block
  47.         mov     ax,4b00h                ; fun 4b00 is exec
  48.         mov     byte ptr [flag],0       ; clear the flag
  49.         int     21h                     ; do the exec
  50.  
  51.         cmp     byte ptr cs:[flag],0    ; see if we have to run again
  52.         jne     start1
  53.  
  54.  
  55. terminate:
  56.         xor     dx,dx
  57.         mov     ds,dx
  58.         mov     ax,256bh                ; clear vector 6bh
  59.         int     21h
  60.  
  61.         mov     ah,4dh
  62.         int     21h                     ; get return code
  63.         mov     ah,4ch                  ; terminate
  64.         int     21h
  65.  
  66. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  67.  
  68. parm_block      dw      0               ; environment
  69.                 dw      80h             ; CMD line offset
  70.                 dw      0               ; CMD line seg, set to CS
  71.                 dd      0               ; who cares about the FCB's?
  72.                 dd      0
  73.  
  74.  
  75.  
  76.  
  77. stack_bottom    db 32 dup (0)
  78. stack_top:
  79.  
  80. END start
  81.  
  82.