rev |
line source |
pascal@19515
|
1 ;***************************************************************
|
pascal@19515
|
2 ;****** This file is distributed under GPL
|
pascal@19515
|
3 ;***************************************************************
|
pascal@19515
|
4 ideal
|
pascal@19515
|
5 %crefref
|
pascal@19515
|
6 %noincl
|
pascal@19515
|
7 %nomacs
|
pascal@19636
|
8 ifdef NO386
|
pascal@19636
|
9 p8086
|
pascal@19636
|
10 else
|
pascal@19515
|
11 p386
|
pascal@19636
|
12 endif
|
pascal@19515
|
13
|
pascal@19515
|
14 group DGROUP _TEXT,_BSS
|
pascal@19515
|
15 assume cs:DGROUP,ds:DGROUP
|
pascal@19515
|
16
|
pascal@19515
|
17 segment _BSS byte public use16 'BSS'
|
pascal@19515
|
18
|
pascal@19899
|
19 global _imgs:dword
|
pascal@19515
|
20
|
pascal@19515
|
21 ends _BSS
|
pascal@19515
|
22
|
pascal@19515
|
23
|
pascal@19515
|
24 segment _TEXT byte public use16 'CODE'
|
pascal@19515
|
25
|
pascal@19515
|
26 ;***************************************************************
|
pascal@19571
|
27 ;void set_sregs_jump_seg_ofs(u32 csip);
|
pascal@19515
|
28 ;****** Never returns
|
pascal@19515
|
29 ;***************************************************************
|
pascal@19515
|
30 global _set_sregs_jump_seg_ofs:near
|
pascal@19515
|
31 proc _set_sregs_jump_seg_ofs near
|
pascal@19515
|
32
|
pascal@19515
|
33 extrn dos_shutdown:near
|
pascal@19515
|
34
|
pascal@19636
|
35 pop ax ; caller return address
|
pascal@19571
|
36 ifdef NO386
|
pascal@19571
|
37 extrn _topseg:near
|
pascal@19571
|
38 call near _topseg
|
pascal@19571
|
39 mov es,ax
|
pascal@19637
|
40 xchg ax,bx
|
pascal@19571
|
41 else
|
pascal@19571
|
42 push 9000h
|
pascal@19571
|
43 pop es
|
pascal@19571
|
44 endif
|
pascal@19825
|
45 pop dx ; ip
|
pascal@19825
|
46 pop cx ; cs
|
pascal@19636
|
47 cli ; we start doing destructive things to DOS
|
pascal@19571
|
48 push es
|
pascal@19571
|
49 pop ss
|
pascal@19571
|
50 mov sp,0A000h
|
pascal@19825
|
51 push cx dx
|
pascal@19636
|
52 extrn _rm_size:word
|
pascal@19636
|
53 mov si,offset _rm_size ; _rm_size, _pm_high, _rm_buf
|
pascal@19636
|
54 lodsw
|
pascal@19636
|
55 xchg ax,cx ; _rm_size
|
pascal@19636
|
56 lodsb ; _pm_high
|
pascal@19636
|
57 mov si,[si] ; _rm_buf
|
pascal@19571
|
58 xor di,di
|
pascal@19571
|
59 ;cld
|
pascal@19571
|
60 rep
|
pascal@19571
|
61 movsb
|
pascal@19571
|
62 extrn _cmdline:word
|
pascal@19571
|
63 mov si,[_cmdline]
|
pascal@19571
|
64 mov di,8000h
|
pascal@19571
|
65 mov ch,10h ; 4k
|
pascal@19571
|
66 rep
|
pascal@19571
|
67 movsb
|
pascal@19636
|
68 cmp al,cl ; load high ?
|
pascal@19515
|
69 jne isbzimage
|
pascal@19637
|
70 ifdef NO386
|
pascal@19637
|
71 add bh,9
|
pascal@19637
|
72 push bx ; topseg()+0x0900
|
pascal@19637
|
73 else
|
pascal@19637
|
74 push 9900h ; 4096 bytes for cmdline
|
pascal@19637
|
75 ;push 9820h ; 512 bytes for cmdline
|
pascal@19637
|
76 endif
|
pascal@19515
|
77 ; finish loading
|
pascal@19515
|
78 extrn @last_ditch$qv:near
|
pascal@19515
|
79 push cs
|
pascal@19515
|
80 call @last_ditch$qv
|
pascal@19899
|
81 mov ax,[word _imgs+2+2] ; get pm->fallback high word
|
pascal@19515
|
82 ; self move
|
pascal@19571
|
83 ;cld
|
pascal@19538
|
84 pop es ; min 2048 bytes for stack
|
pascal@19538
|
85 xor si,si ; A000 -9000 -0800(>movedend)
|
pascal@19515
|
86 xor di,di ; set ZF
|
pascal@19538
|
87 mov cx,offset movedend
|
pascal@19515
|
88 global _bss_end:byte
|
pascal@19538
|
89 ;mov cx,offset _bss_end
|
pascal@19515
|
90 rep
|
pascal@19515
|
91 movsb
|
pascal@19515
|
92 push es
|
pascal@19515
|
93 call near doretf ; mov cs,es
|
pascal@19571
|
94 push ss
|
pascal@19571
|
95 pop es
|
pascal@19515
|
96 push cs
|
pascal@19515
|
97 pop ds
|
pascal@19571
|
98 push ax
|
pascal@19515
|
99 call near dos_shutdown
|
pascal@19538
|
100 ;in al,70h
|
pascal@19538
|
101 ;or al,80h ; disable NMI
|
pascal@19538
|
102 ;out 70h,al
|
pascal@19538
|
103 pop bx
|
pascal@19515
|
104 ; move zImage pm
|
pascal@19515
|
105 mov ax,8
|
pascal@19515
|
106 cwd
|
pascal@19515
|
107 cmp bx,ax
|
pascal@19538
|
108 ja bufhigh
|
pascal@19515
|
109 sub ax,bx
|
pascal@19515
|
110 inc ax
|
pascal@19515
|
111 bufhigh:
|
pascal@19515
|
112 push ax
|
pascal@19515
|
113 push dx ; size=up to 512k
|
pascal@19515
|
114 push bx ; src ofs= pm.fallback
|
pascal@19515
|
115 push dx
|
pascal@19515
|
116 push dx ; srcseg=0
|
pascal@19636
|
117 ifdef NO386
|
pascal@19636
|
118 inc dx
|
pascal@19636
|
119 push dx ; dst
|
pascal@19636
|
120 dec dx
|
pascal@19636
|
121 else
|
pascal@19636
|
122 push 1 ; dst
|
pascal@19636
|
123 endif
|
pascal@19515
|
124 push dx ; ofs=64k
|
pascal@19515
|
125 extrn _memcpy32:near
|
pascal@19515
|
126 call _memcpy32
|
pascal@19538
|
127 add sp,14
|
pascal@19515
|
128
|
pascal@19515
|
129 ifndef noelks
|
pascal@19515
|
130 push ss
|
pascal@19515
|
131 pop ds
|
pascal@19515
|
132 ifndef NO386
|
pascal@19515
|
133 cmp [dword 1E6h],'SKLE'
|
pascal@19515
|
134 else
|
pascal@19515
|
135 cmp [word 1E6h],'LE'
|
pascal@19515
|
136 jne notelks
|
pascal@19515
|
137 cmp [word 1E8h],'SK'
|
pascal@19515
|
138 endif
|
pascal@19515
|
139 jne notelks
|
pascal@19636
|
140 ifdef NO386
|
pascal@19636
|
141 mov cx,120h
|
pascal@19636
|
142 push cx
|
pascal@19636
|
143 mov cl,0h
|
pascal@19636
|
144 push cx
|
pascal@19636
|
145 else
|
pascal@19636
|
146 push 120h
|
pascal@19515
|
147 push 100h
|
pascal@19636
|
148 endif
|
pascal@19515
|
149 pop es
|
pascal@19515
|
150 xor si,si
|
pascal@19515
|
151 xor di,di
|
pascal@19515
|
152 mov ch,05h
|
pascal@19515
|
153 rep
|
pascal@19515
|
154 movsw
|
pascal@19515
|
155 push es
|
pascal@19515
|
156 pop ss
|
pascal@19636
|
157 push cx
|
pascal@19515
|
158 notelks:
|
pascal@19515
|
159 endif
|
pascal@19515
|
160
|
pascal@19571
|
161 isbzimage:
|
pascal@19515
|
162 push ss
|
pascal@19515
|
163 pop ds
|
pascal@19571
|
164 ;push ss
|
pascal@19571
|
165 ;pop es
|
pascal@19636
|
166 ifndef NO386
|
pascal@19515
|
167 push ss
|
pascal@19515
|
168 pop fs
|
pascal@19515
|
169 push ss
|
pascal@19515
|
170 pop gs
|
pascal@19636
|
171 endif
|
pascal@19515
|
172 assume nothing
|
pascal@19515
|
173 assume cs:DGROUP
|
pascal@19515
|
174
|
pascal@19515
|
175 doretf:
|
pascal@19515
|
176 retf
|
pascal@19515
|
177
|
pascal@19515
|
178 movedend:
|
pascal@19515
|
179 endp _set_sregs_jump_seg_ofs
|
pascal@19515
|
180
|
pascal@19515
|
181 ends _TEXT
|
pascal@19515
|
182
|
pascal@19515
|
183 end
|
pascal@19515
|
184
|
pascal@19515
|
185 ;###### END OF FILE ############################################
|