| 1 | ; AiR-BOOT (c) Copyright 1998-2009 M. Kiewitz | 
|---|
| 2 | ; | 
|---|
| 3 | ; This file is part of AiR-BOOT | 
|---|
| 4 | ; | 
|---|
| 5 | ; AiR-BOOT is free software: you can redistribute it and/or modify it under | 
|---|
| 6 | ;  the terms of the GNU General Public License as published by the Free | 
|---|
| 7 | ;  Software Foundation, either version 3 of the License, or (at your option) | 
|---|
| 8 | ;  any later version. | 
|---|
| 9 | ; | 
|---|
| 10 | ; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY | 
|---|
| 11 | ;  WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS | 
|---|
| 12 | ;  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 
|---|
| 13 | ;  details. | 
|---|
| 14 | ; | 
|---|
| 15 | ; You should have received a copy of the GNU General Public License along with | 
|---|
| 16 | ;  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 17 | ; | 
|---|
| 18 |  | 
|---|
| 19 | ; If ReleaseCode is not defined, it will produce debug-able code... | 
|---|
| 20 | ReleaseCode                 equ    -1 | 
|---|
| 21 |  | 
|---|
| 22 | JUMPS | 
|---|
| 23 |  | 
|---|
| 24 | ; First all Equs | 
|---|
| 25 |  | 
|---|
| 26 | IFDEF ReleaseCode | 
|---|
| 27 | ExecBaseSeg     equ     00060h | 
|---|
| 28 | ExecBasePtr     equ     00000h ; FreeDOS BR starts us at 0060:0000 | 
|---|
| 29 | ELSE | 
|---|
| 30 | ExecBaseSeg     equ     00BFBh | 
|---|
| 31 | ExecBasePtr     equ     00100h | 
|---|
| 32 | ENDIF | 
|---|
| 33 | StackSeg        equ     7000h | 
|---|
| 34 |  | 
|---|
| 35 | include ../../include/asm.inc | 
|---|
| 36 |  | 
|---|
| 37 | .386p | 
|---|
| 38 | model large, basic | 
|---|
| 39 |  | 
|---|
| 40 | code_seg        segment public use16 | 
|---|
| 41 | assume  cs:code_seg, ds:nothing, es:nothing, ss:nothing | 
|---|
| 42 | ;--------------------------------------------------------------------------- | 
|---|
| 43 | org     ExecBasePtr | 
|---|
| 44 | AiRBOOT_Installer: | 
|---|
| 45 | KernelStart:    jmp     KernelRealStart | 
|---|
| 46 |  | 
|---|
| 47 | ;--------------------------------------------------------------------------- | 
|---|
| 48 | TXT_START_Copyright             db      13, 10 | 
|---|
| 49 | db      'AiR-BOOT Installer v1.00', 13, 10 | 
|---|
| 50 | db      ' - (c) Copyright 1998-2009 by M. Kiewitz.', 13, 10 | 
|---|
| 51 | db      ' - FreeDOS bootrecord (c) 1997 by Svante Frey', 13, 10 | 
|---|
| 52 | db      13, 10 | 
|---|
| 53 | db      '-> ...Please wait... <-', 13, 10, 0 | 
|---|
| 54 |  | 
|---|
| 55 | TXT_AfterAdd: | 
|---|
| 56 | TXT_AfterDelete: | 
|---|
| 57 | TXT_AfterQuit   db 13, 10, 'Please hit ENTER to reboot your system...', 0 | 
|---|
| 58 |  | 
|---|
| 59 | KernelRealStart:mov     ax, StackSeg | 
|---|
| 60 | mov     ss, ax | 
|---|
| 61 | mov     sp, 7FFFh | 
|---|
| 62 | mov     ax, cs | 
|---|
| 63 | mov     ds, ax | 
|---|
| 64 | mov     es, ax       ; Set DS&ES to new segment | 
|---|
| 65 | ; Shows Copyright message | 
|---|
| 66 | mov     si, offset TXT_START_Copyright | 
|---|
| 67 | call    APIShowMessage | 
|---|
| 68 |  | 
|---|
| 69 | COM_DoneAlloc:  mov     ax, 8000h | 
|---|
| 70 | mov     es, ax           ; ES = 8000h - space for track 0 | 
|---|
| 71 | jmp     RunInstaller | 
|---|
| 72 |  | 
|---|
| 73 | APIExitProgram: | 
|---|
| 74 | APIAfterAdd: | 
|---|
| 75 | APIAfterDelete: | 
|---|
| 76 | APIAfterQuit:   mov     ax, 8600h | 
|---|
| 77 | mov     cx, 65 | 
|---|
| 78 | xor     dx, dx | 
|---|
| 79 | int     15h              ; Wait a little bit... | 
|---|
| 80 | db      0EAh             ; Jump to eternity | 
|---|
| 81 | dw      0FFF0h | 
|---|
| 82 | dw      0F000h | 
|---|
| 83 |  | 
|---|
| 84 | ; ============================================================================= | 
|---|
| 85 | ; DS:SI - NUL-terminated message to display to console | 
|---|
| 86 | APIShowMessage: push    ax | 
|---|
| 87 | push    bx | 
|---|
| 88 | push    si | 
|---|
| 89 | mov     ah, 0Eh | 
|---|
| 90 | mov     bx, 7 | 
|---|
| 91 | ASM_Loop:          lodsb | 
|---|
| 92 | or      al, al | 
|---|
| 93 | jz      ASM_Done | 
|---|
| 94 | int     10h           ; BIOS: TELETYPE | 
|---|
| 95 | jmp     ASM_Loop | 
|---|
| 96 | ASM_Done:       pop     si | 
|---|
| 97 | pop     bx | 
|---|
| 98 | pop     ax | 
|---|
| 99 | retn | 
|---|
| 100 |  | 
|---|
| 101 | ; ============================================================================= | 
|---|
| 102 | APIShowChar:    push    ax | 
|---|
| 103 | push    bx | 
|---|
| 104 | mov     ah, 0Eh | 
|---|
| 105 | mov     bx, 7 | 
|---|
| 106 | int     10h           ; BIOS: TELETYPE | 
|---|
| 107 | pop     bx | 
|---|
| 108 | pop     ax | 
|---|
| 109 | retn | 
|---|
| 110 |  | 
|---|
| 111 | ; ============================================================================= | 
|---|
| 112 | APIShowError:   call    APIShowMessage | 
|---|
| 113 | call    APIExitProgram | 
|---|
| 114 |  | 
|---|
| 115 | ; ============================================================================= | 
|---|
| 116 | ; Returns AL - Keyboard character that was pressed | 
|---|
| 117 | APIReadKeyboard:xor     ah, ah | 
|---|
| 118 | int     16h              ; BIOS: GET KEYSTROKE | 
|---|
| 119 | ; Result in AL | 
|---|
| 120 | retn | 
|---|
| 121 |  | 
|---|
| 122 | APILockVolume:  retn | 
|---|
| 123 |  | 
|---|
| 124 | include ../inst_x86/install.inc ; Execute generic code | 
|---|
| 125 | COM_EndOfSegment: | 
|---|
| 126 |  | 
|---|
| 127 | code_seg        ends | 
|---|
| 128 | end     AiRBOOT_Installer | 
|---|