home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1995 November / PCWK1195.iso / inne / podstawy / dos / format / fdform18.exe / FDBOOT.ASM < prev    next >
Assembly Source File  |  1991-07-21  |  5KB  |  101 lines

  1.              page      66,128
  2. cseg         segment   para public 'CODE'
  3.              assume    cs:cseg
  4.  
  5.              org       100h                     ;Allow Boot-Sector as COM-File
  6. begin:       jmp       short start              ;Jump
  7.              nop
  8. bpb          db        3FH DUP (0)              ;Reserve enough space for BPB
  9.  
  10. start        proc      far
  11.              cli                                ;Clear Interrupts, while modifying stack
  12.              xor       ax,ax                    ;Zero AX
  13.              mov       ss,ax                    ;Set SS...
  14.              mov       sp,7c00h                 ;..and SP below Code
  15.              mov       ax,7b0h                  ;Set Segment-Registers that Offset is 100H
  16.              push      ax                       ;Push Segment twice
  17.              push      ax
  18.              pop       ds                       ;Get Segment in DS
  19.              pop       es                       ;and also in ES
  20.              mov       si,100h                  ;Set Source to 100H
  21.              mov       di,300h                  ;Set Destination to 300H
  22.              mov       cx,100h                  ;Set Count to 512 Bytes (1 Sector)
  23.              rep       movsw                    ;Move Code
  24.              mov       ax,7d0h                  ;New Segment at 7d0h (+20H)
  25.              push      ax                       ;Push Segment three times
  26.              push      ax
  27.              push      ax
  28.              pop       ds                       ;Get new segment in DS
  29.              pop       es                       ;and also in ES
  30.              mov       ax,offset entry          ;Offset of next instruction
  31.              push      ax                       ;Push to stack
  32.              ret                                ;and pop it to CS:IP
  33. start        endp
  34.  
  35. entry        proc      far
  36.              sti                                ;Start Interrupts again
  37.              mov       si,offset text1          ;Move SI to text
  38.              call      output                   ;display to screen
  39.              mov       ax,201h                  ;AH=2 (read sector), AL=1 (count)
  40.              mov       cx,1                     ;CH=0 (Track), CL=1 (Sector)
  41.              mov       dx,128                   ;DH=0 (Head), DL=128 (Fixed Disk C)
  42.              xor       bx,bx                    ;Segment of Transfer buffer
  43.              push      bx                       ;Push to Stack
  44.              pop       es                       ;Get Segment in ES
  45.              mov       bx,7c00h                 ;Offset of Transfer buffer
  46.              push      es                       ;Push Segment...
  47.              push      bx                       ;And Offset to stack
  48.              int       13h                      ;Read from Harddisk
  49.              jc        error                    ;Jump if error
  50.              cmp       word ptr es:7dfeh,0aa55h ;Valid Boot Secotor?
  51.              jnz       error                    ;No, error
  52.              ret                                ;Continue with Boot-Sector of C:
  53.  
  54. error:       mov       si,offset text2          ;Move SI to text
  55.              call      output                   ;display to screen
  56. loop1:       mov       ah,1                     ;Get Status of...
  57.              int       16h                      ;...Keyboard buffer
  58.              jz        boot_new                 ;if keypressed, reboot
  59.              xor       ah,ah                    ;flush....
  60.              int       16h                      ;...Keyboard Buffer
  61.              jmp       loop1                    ;And try again
  62. boot_new:    xor       ah,ah                    ;flush...
  63.              int       16h                      ;...Keyboard buffer
  64.              xor       dx,dx                    ;Zero DX
  65.              int       19h                      ;Reboot
  66. entry        endp
  67.  
  68. output       proc      near
  69.              cld
  70. loop_o:      lodsb                              ;Get one character
  71.              or        al,al                    ;Is it zero?
  72.              jnz       weiter                   ;No, continue
  73.              ret                                ;else return
  74. weiter:      push      si                       ;Save SI
  75.              mov       ah,0eh                   ;Output character...
  76.              int       10h                      ;...in AL to screen
  77.              pop       si                       ;restore SI
  78.              jmp       short loop_o             ;repeat loop
  79. output       endp
  80.  
  81.              IF        LANGUAGE EQ 1
  82. text1        db        'FDBOOT Version 1.8',10,13
  83.              db        'No Systemdisk. Booting from harddisk.',10,13,0
  84. text2        db        'Cannot load from harddisk.',10,13
  85.              db        'Insert Systemdisk and press any key.',10,13,0
  86.              ENDIF
  87.  
  88.              IF        LANGUAGE EQ 49
  89. text1        db        'FDBOOT Version 1.8',10,13
  90.              db        'Keine Systemdiskette. Starten von Festplatte.',10,13,0
  91. text2        db        'Kann nicht von der Festplatte starten.',10,13
  92.              db        'System-Diskette in Laufwerk A: einlegen',10,13
  93.              db        'Anschließend eine Taste drücken',10,13,0
  94.              ENDIF
  95.  
  96.              org       2feh
  97.              db        55h,0aah
  98.  
  99. cseg         ends
  100.              end       begin
  101.