Subversion Repositories Kolibri OS

Rev

Rev 67 | Rev 76 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 67 Rev 75
Line 1415... Line 1415...
1415
     cmp   eax,0xffff            ; length > 0 ?
1415
     cmp   eax,0xffff            ; length > 0 ?
1416
     jge   cont_displ
1416
     jge   cont_displ
1417
     ret
1417
     ret
1418
   cont_displ:
1418
   cont_displ:
Line 1419... Line 1419...
1419
 
1419
 
1420
     cmp   eax,60*0x10000        ; length <= 60 ?
1420
     cmp   eax,61*0x10000        ; length <= 60 ?
1421
     jbe   cont_displ2
1421
     jb    cont_displ2
1422
     ret
1422
     ret
Line 1423... Line 1423...
1423
   cont_displ2:
1423
   cont_displ2:
Line 1433... Line 1433...
1433
     sub   esp,64
1433
     sub   esp,64
Line 1434... Line 1434...
1434
 
1434
 
1435
     cmp   ah,0                  ; DECIMAL
1435
     cmp   ah,0                  ; DECIMAL
1436
     jne   no_display_desnum
1436
     jne   no_display_desnum
1437
     shr   eax,16
1437
     shr   eax,16
1438
     and   eax,0x2f
1438
     and   eax,0x3f
1439
     push  eax
1439
     push  eax
1440
     ;mov   edi,[0x3010]
1440
     ;mov   edi,[0x3010]
1441
     ;mov   edi,[edi+0x10]
1441
     ;mov   edi,[edi+0x10]
1442
     mov   edi,esp
1442
     mov   edi,esp
Line 1459... Line 1459...
1459
   no_display_desnum:
1459
   no_display_desnum:
Line 1460... Line 1460...
1460
 
1460
 
1461
     cmp   ah,0x01               ; HEXADECIMAL
1461
     cmp   ah,0x01               ; HEXADECIMAL
1462
     jne   no_display_hexnum
1462
     jne   no_display_hexnum
1463
     shr   eax,16
1463
     shr   eax,16
1464
     and   eax,0x2f
1464
     and   eax,0x3f
1465
     push  eax
1465
     push  eax
1466
     ;mov   edi,[0x3010]
1466
     ;mov   edi,[0x3010]
1467
     ;mov   edi,[edi+0x10]
1467
     ;mov   edi,[edi+0x10]
1468
     mov   edi,esp
1468
     mov   edi,esp
Line 1486... Line 1486...
1486
   no_display_hexnum:
1486
   no_display_hexnum:
Line 1487... Line 1487...
1487
 
1487
 
1488
     cmp   ah,0x02               ; BINARY
1488
     cmp   ah,0x02               ; BINARY
1489
     jne   no_display_binnum
1489
     jne   no_display_binnum
1490
     shr   eax,16
1490
     shr   eax,16
1491
     and   eax,0x2f
1491
     and   eax,0x3f
1492
     push  eax
1492
     push  eax
1493
     ;mov   edi,[0x3010]
1493
     ;mov   edi,[0x3010]
1494
     ;mov   edi,[edi+0x10]
1494
     ;mov   edi,[edi+0x10]
1495
     mov   edi,esp
1495
     mov   edi,esp
Line 1635... Line 1635...
1635
     mov  [esp+36],dword 1
1635
     mov  [esp+36],dword 1
1636
     ret
1636
     ret
1637
   nsyse2:
1637
   nsyse2:
1638
     cmp  eax,3                      ; CD
1638
     cmp  eax,3                      ; CD
1639
     jnz  nsyse3
1639
     jnz  nsyse3
-
 
1640
     test ebx,ebx
-
 
1641
     jz   nosesl
-
 
1642
     cmp  ebx, 4
-
 
1643
     ja   nosesl
1640
     mov  [cd_base],bl
1644
     mov  [cd_base],bl
1641
     cmp  ebx,1
1645
     cmp  ebx,1
1642
     jnz  noprma
1646
     jnz  noprma
1643
     mov  [cdbase],0x1f0
1647
     mov  [cdbase],0x1f0
1644
     mov  [cdid],0xa0
1648
     mov  [cdid],0xa0
Line 1692... Line 1696...
1692
 
1696
 
Line 1693... Line 1697...
1693
   nsyse6:
1697
   nsyse6:
1694
 
1698
 
-
 
1699
     cmp  eax,7                      ; HD BASE
-
 
1700
     jne  nsyse7
-
 
1701
     test ebx,ebx
-
 
1702
     jz   nosethd
1695
     cmp  eax,7                      ; HD BASE
1703
     cmp  ebx,4
1696
     jne  nsyse7
1704
     ja   nosethd
1697
     mov  [hd_base],bl
1705
     mov  [hd_base],bl
1698
     cmp  ebx,1
1706
     cmp  ebx,1
1699
     jnz  noprmahd
1707
     jnz  noprmahd
Line 1725... Line 1733...
1725
   noseslhd:
1733
   noseslhd:
1726
     mov   [0xfe10],dword 0
1734
     mov   [0xfe10],dword 0
1727
    call  reserve_hd1
1735
    call  reserve_hd1
1728
    call  clear_hd_cache
1736
    call  clear_hd_cache
1729
    mov   [hd1_status],0        ; free
1737
    mov   [hd1_status],0        ; free
-
 
1738
   nosethd:
1730
     ret
1739
     ret
Line 1731... Line 1740...
1731
 
1740
 
Line 1732... Line 1741...
1732
hd_base db 0
1741
hd_base db 0
Line 1746... Line 1755...
1746
     ret
1755
     ret
1747
   nsyse8:
1756
   nsyse8:
Line 1748... Line 1757...
1748
 
1757
 
1749
     cmp  eax,10                     ; SOUND DMA CHANNEL
1758
     cmp  eax,10                     ; SOUND DMA CHANNEL
-
 
1759
     jne  no_set_sound_dma
-
 
1760
     cmp  ebx,3
1750
     jne  no_set_sound_dma
1761
     ja   sys_setup_err
1751
     mov  [sound_dma],ebx
1762
     mov  [sound_dma],ebx
1752
     ret
1763
     ret
Line 1753... Line 1764...
1753
   no_set_sound_dma:
1764
   no_set_sound_dma:
Line 1768... Line 1779...
1768
 
1779
 
1769
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1780
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1770
include 'vmodeint.inc'
1781
include 'vmodeint.inc'
Line -... Line 1782...
-
 
1782
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1771
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1783
 
1772
 
1784
sys_setup_err:
Line 1773... Line 1785...
1773
     mov  [esp+36],dword -1
1785
     mov  [esp+36],dword -1
Line 2060... Line 2072...
2060
    waitterm:            ; wait here for termination
2072
    waitterm:            ; wait here for termination
2061
     mov   eax,5
2073
     mov   eax,5
2062
     call  delay_hs
2074
     call  delay_hs
2063
     jmp   waitterm
2075
     jmp   waitterm
Line -... Line 2076...
-
 
2076
 
-
 
2077
iglobal
-
 
2078
sys_system_table:
-
 
2079
        dd      sysfn_shutdown          ; 1 = system shutdown
-
 
2080
        dd      sysfn_terminate         ; 2 = terminate thread
-
 
2081
        dd      sysfn_activate          ; 3 = activate window
-
 
2082
        dd      sysfn_getidletime       ; 4 = get idle time
-
 
2083
        dd      sysfn_getcpuclock       ; 5 = get cpu clock
-
 
2084
        dd      sysfn_saveramdisk       ; 6 = save ramdisk
-
 
2085
        dd      sysfn_getactive         ; 7 = get active window
-
 
2086
        dd      sysfn_sound_flag        ; 8 = get/set sound_flag
-
 
2087
        dd      sysfn_shutdown_param    ; 9 = shutdown with parameter
-
 
2088
        dd      sysfn_minimize          ; 10 = minimize window
-
 
2089
        dd      sysfn_getdiskinfo       ; 11 = get disk subsystem info
-
 
2090
        dd      sysfn_lastkey           ; 12 = get last pressed key
-
 
2091
        dd      sysfn_getversion        ; 13 = get kernel version
-
 
2092
        dd      sysfn_waitretrace       ; 14 = wait retrace
-
 
2093
        dd      sysfn_centermouse       ; 15 = center mouse cursor
-
 
2094
        dd      sysfn_getfreemem        ; 16 = get free memory size
-
 
2095
        dd      sysfn_getallmem         ; 17 = get total memory size
-
 
2096
sysfn_num = ($ - sys_system_table)/4
-
 
2097
endg
2064
 
2098
 
-
 
2099
sys_system:
-
 
2100
        dec     eax
-
 
2101
        cmp     eax, sysfn_num
-
 
2102
        jae     @f
-
 
2103
        jmp     dword [sys_system_table + eax*4]
-
 
2104
@@:
Line 2065... Line 2105...
2065
sys_system:
2105
        ret
2066
 
-
 
2067
     cmp  eax,1                              ; BOOT
2106
 
2068
     jnz  nosystemboot
2107
sysfn_shutdown:         ; 18.1 = BOOT
2069
     mov  [0x2f0000+0x9030],byte 0
2108
     mov  [0x2f0000+0x9030],byte 0
2070
  for_shutdown_parameter:
2109
  for_shutdown_parameter:
2071
     mov  eax,[0x3004]
2110
     mov  eax,[0x3004]
2072
     add  eax,2
2111
     add  eax,2
2073
     mov  [shutdown_processes],eax
2112
     mov  [shutdown_processes],eax
2074
     mov  [0xFF00],al
2113
     mov  [0xFF00],al
2075
     xor  eax, eax
2114
     and  dword [esp+36], 0
2076
     ret
2115
     ret
2077
  uglobal
2116
  uglobal
2078
   shutdown_processes: dd 0x0
-
 
Line 2079... Line 2117...
2079
  endg
2117
   shutdown_processes: dd 0x0
2080
   nosystemboot:
-
 
2081
 
2118
  endg
2082
     cmp  eax,2                              ; TERMINATE
2119
 
2083
     jnz  noprocessterminate
2120
sysfn_terminate:        ; 18.2 = TERMINATE
2084
     cmp  ebx,2
2121
     cmp  ebx,2
2085
     jb   noprocessterminate
2122
     jb   noprocessterminate
2086
     mov  edx,[0x3004]
2123
     mov  edx,[0x3004]
2087
     cmp  ebx,edx
2124
     cmp  ebx,edx
2088
     jg   noprocessterminate
2125
     ja   noprocessterminate
2089
     mov  eax,[0x3004]
2126
     mov  eax,[0x3004]
-
 
2127
     shl  ebx,5
-
 
2128
     mov  edx,[ebx+0x3000+4]
Line 2090... Line 2129...
2090
     shl  ebx,5
2129
     add  ebx,0x3000+0xa
2091
     mov  edx,[ebx+0x3000+4]
2130
     cmp  byte [ebx], 9
2092
     add  ebx,0x3000+0xa
2131
     jz   noprocessterminate
Line 2093... Line 2132...
2093
 
2132
 
2094
     ;call MEM_Heap_Lock      ;guarantee that process isn't working with heap
2133
     ;call MEM_Heap_Lock      ;guarantee that process isn't working with heap
2095
     mov  [ebx],byte 3       ; clear possible i40's
2134
     mov  [ebx],byte 3       ; clear possible i40's
2096
     ;call MEM_Heap_UnLock
2135
     ;call MEM_Heap_UnLock
2097
 
-
 
2098
     cmp  edx,[application_table_status]    ; clear app table stat
2136
 
-
 
2137
     cmp  edx,[application_table_status]    ; clear app table stat
Line 2099... Line 2138...
2099
     jne  noatsc
2138
     jne  noatsc
2100
     mov  [application_table_status],0
-
 
2101
   noatsc:
2139
     mov  [application_table_status],0
2102
     ret
2140
   noatsc:
2103
   noprocessterminate:
2141
   noprocessterminate:
2104
 
2142
     ret
2105
     cmp  eax,3                              ; ACTIVATE WINDOW
2143
 
Line 2113... Line 2151...
2113
     ;shl  ebx, 1
2151
     ;shl  ebx, 1
2114
     ;add  ebx, 0xc000
2152
     ;add  ebx, 0xc000
2115
     ;mov  esi, [ebx]        ; esi = window stack value
2153
     ;mov  esi, [ebx]        ; esi = window stack value
2116
     ;and  esi, 0xffff       ;       word
2154
     ;and  esi, 0xffff       ;       word
2117
    movzx esi, word [0xC000 + ebx*2]
2155
    movzx esi, word [0xC000 + ebx*2]
2118
     mov  edx, [0x3004] ; edx = number of processes
2156
     cmp  esi, [0x3004] ; number of processes
2119
     cmp  esi, edx
-
 
2120
     jz   nowindowactivate ; continue if window_stack_value != number_of_processes
2157
     jz   nowindowactivate ; continue if window_stack_value != number_of_processes
2121
                           ;     i.e. if window is not already active
2158
                           ;     i.e. if window is not already active
Line 2122... Line 2159...
2122
 
2159
 
2123
;* start code - get active process (1) - Mario79
2160
;* start code - get active process (1) - Mario79
2124
     cli
2161
;     cli
2125
     mov  [window_minimize],2
2162
     mov  [window_minimize],2
2126
;     mov  [active_process],edi
2163
;     mov  [active_process],edi
2127
     sti
2164
;     sti
Line 2128... Line 2165...
2128
;* end code - get active process (1) - Mario79
2165
;* end code - get active process (1) - Mario79
2129
 
-
 
2130
     mov  [0xff01],edi     ; activate
-
 
2131
     xor  eax, eax
-
 
2132
     ret
2166
 
-
 
2167
     mov  [0xff01],edi     ; activate
Line 2133... Line 2168...
2133
 
2168
nowindowactivate:
2134
   nowindowactivate:
-
 
2135
 
2169
     ret
-
 
2170
 
2136
     cmp  eax,4                              ; GET IDLETIME
2171
sysfn_getidletime:              ; 18.4 = GET IDLETIME
2137
     jnz  nogetidletime
-
 
Line 2138... Line 2172...
2138
     mov  eax,[idleusesec]
2172
     mov  eax,[idleusesec]
2139
     ret
-
 
2140
   nogetidletime:
2173
     mov  [esp+36], eax
-
 
2174
     ret
2141
 
2175
 
2142
     cmp  eax,5                              ; GET TSC/SEC
-
 
Line 2143... Line 2176...
2143
     jnz  nogettscsec
2176
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2144
     mov  eax,[0xf600]
2177
     mov  eax,[0xf600]
2145
     ret
2178
     mov  [esp+36], eax
2146
   nogettscsec:
2179
     ret
2147
 
2180
 
2148
;  SAVE ramdisk to /hd/1/menuet.img
2181
;  SAVE ramdisk to /hd/1/menuet.img
2149
;!!!!!!!!!!!!!!!!!!!!!!!!
2182
;!!!!!!!!!!!!!!!!!!!!!!!!
-
 
2183
   include 'blkdev/rdsave.inc'
2150
   include 'blkdev/rdsave.inc'
2184
;!!!!!!!!!!!!!!!!!!!!!!!!
2151
;!!!!!!!!!!!!!!!!!!!!!!!!
-
 
2152
     cmp  eax,7
2185
 
2153
     jnz  nogetactiveprocess
2186
sysfn_getactive:        ; 18.7 = get active window
2154
     mov  eax,[active_process]
2187
     mov  eax,[active_process]
2155
     ret
2188
     mov  [esp+36],eax
2156
 nogetactiveprocess:
2189
     ret
-
 
2190
 
2157
     cmp  eax,8
2191
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
2158
     jnz  nosoundflag
2192
     cmp  ebx,1
2159
     cmp  ebx,1
2193
     jne  nogetsoundflag
2160
     jne  nogetsoundflag
2194
     movzx  eax,byte [sound_flag] ; get sound_flag
2161
     movzx  eax,byte [sound_flag] ; get sound_flag
-
 
2162
     ret
2195
     mov  [esp+36],eax
2163
 nogetsoundflag:
-
 
2164
     cmp  ebx,2
2196
     ret
-
 
2197
 nogetsoundflag:
-
 
2198
     cmp  ebx,2
2165
     jnz  nosoundflag
2199
     jnz  nosoundflag
2166
     inc  byte [sound_flag]       ; set sound_flag
-
 
2167
     and byte [sound_flag],1      ;
2200
     xor  byte [sound_flag], 1
2168
     ret
2201
 nosoundflag:
2169
nosoundflag:
2202
     ret
2170
     cmp  eax,9                   ; system shutdown with param
2203
 
2171
     jnz  noshutdownsystem
2204
sysfn_shutdown_param:   ; 18.9 = system shutdown with param
2172
     cmp  ebx,1
2205
     cmp  ebx,1
2173
     jl  exit_for_anyone
-
 
-
 
2206
     jl   exit_for_anyone
2174
     cmp  ebx,4
2207
     cmp  ebx,4
2175
     jg   exit_for_anyone
-
 
2176
     mov  [0x2f0000+0x9030],bl
2208
     jg   exit_for_anyone
2177
     jmp  for_shutdown_parameter
2209
     mov  [0x2f0000+0x9030],bl
2178
noshutdownsystem:
2210
     jmp  for_shutdown_parameter
2179
     cmp  eax,10                   ; minimize window
-
 
-
 
2211
 
2180
     jnz  nominimizewindow
2212
sysfn_minimize:         ; 18.10 = minimize window
2181
     mov   [window_minimize],1
-
 
2182
 exit_for_anyone:
2213
     mov   [window_minimize],1
2183
     ret
2214
 exit_for_anyone:
2184
nominimizewindow:
2215
     ret
2185
     cmp  eax,11           ; get disk info table
2216
 
2186
     jnz  nogetdiskinfo
2217
sysfn_getdiskinfo:      ; 18.11 = get disk info table
2187
     cmp  ebx,1
2218
     cmp  ebx,1
2188
     jnz  full_table
2219
     jnz  full_table
2189
  small_table:
2220
  small_table:
2190
     call for_all_tables
2221
     call for_all_tables
2191
     mov cx,10
2222
     mov ecx,10
2192
     cld
2223
     cld
2193
     rep movsb
2224
     rep movsb
2194
     ret
2225
     ret
2195
   for_all_tables:
-
 
2196
     mov edi,[3010h]
2226
   for_all_tables:
2197
     mov edi,[edi+10h]
2227
     mov edi,[3010h]
2198
     add edi,ecx
2228
     mov edi,[edi+10h]
2199
     mov esi,0x40000
2229
     add edi,ecx
2200
     xor ecx,ecx
2230
     mov esi,0x40000
2201
     ret
2231
     ret
2202
  full_table:
2232
  full_table:
2203
     cmp  ebx,2
2233
     cmp  ebx,2
2204
     jnz  exit_for_anyone
2234
     jnz  exit_for_anyone
2205
     call for_all_tables
2235
     call for_all_tables
2206
     mov cx,16384
2236
     mov ecx,16384
2207
     cld
-
 
2208
     rep movsd
2237
     cld
2209
     ret
2238
     rep movsd
2210
nogetdiskinfo:
2239
     ret
2211
     cmp  eax,12      ; get all key pressed with ALT
2240
 
2212
     jnz  nogetkey
-
 
2213
     mov   eax,[last_key_press]
2241
sysfn_lastkey:          ; 18.12 = get all key pressed with ALT
2214
     mov   al,[keyboard_mode_sys]
2242
     mov   eax,[last_key_press]
2215
     mov   [esp+36],eax
2243
     mov   al,[keyboard_mode_sys]
2216
     mov   [last_key_press],0
-
 
2217
 .finish:
2244
     mov   [esp+36],eax
2218
     ret
2245
     mov   [last_key_press],0
2219
nogetkey:
2246
     ret
2220
     cmp  eax,13      ; get kernel ID and version
2247
 
2221
     jnz  nogetkernel_id
2248
sysfn_getversion:       ; 18.13 = get kernel ID and version
2222
     mov edi,[3010h]
2249
     mov edi,[3010h]
2223
     mov edi,[edi+10h]
2250
     mov edi,[edi+10h]
2224
     add edi,ebx
2251
     add edi,ebx
2225
     mov esi,version_inf
2252
     mov esi,version_inf
2226
     mov ecx,version_end-version_inf
2253
     mov ecx,version_end-version_inf
2227
     cld
-
 
2228
     rep movsb
2254
     cld
2229
     ret
2255
     rep movsb
2230
nogetkernel_id:
2256
     ret
2231
     cmp  eax,14      ; sys wait retrace
2257
 
2232
     jnz  nosys_wait_retrace
2258
sysfn_waitretrace:     ; 18.14 = sys wait retrace
2233
     ;wait retrace functions
2259
     ;wait retrace functions
2234
 sys_wait_retrace:
2260
 sys_wait_retrace:
2235
     mov edx,0x3da
2261
     mov edx,0x3da
2236
 WaitRetrace_loop:
2262
 WaitRetrace_loop:
2237
     in al,dx
-
 
-
 
2263
     in al,dx
2238
     test al,1000b
2264
     test al,1000b
2239
     jz WaitRetrace_loop
-
 
2240
     mov [esp+36],dword 0
2265
     jz WaitRetrace_loop
2241
     ret
2266
     mov [esp+36],dword 0
2242
nosys_wait_retrace:
2267
     ret
-
 
2268
 
2243
     cmp  eax,15      ; mouse centered
2269
sysfn_centermouse:      ; 18.15 = mouse centered
2244
     jnz  no_mouse_centered
-
 
2245
     call  mouse_centered
-
 
2246
     mov [esp+36],dword 0
2270
     call  mouse_centered
2247
     ret
2271
     mov [esp+36],dword 0
-
 
2272
     ret
2248
no_mouse_centered:
2273
 
2249
     cmp  eax,16
-
 
2250
     jnz  no_get_free_space
-
 
-
 
2274
sysfn_getfreemem:
2251
     mov  eax,[MEM_FreeSpace]
2275
     mov  eax,[MEM_FreeSpace]
2252
     shl  eax,2
2276
     shl  eax,2
2253
     ret
2277
     mov  [esp+36],eax
2254
no_get_free_space:
2278
     ret
2255
     cmp  eax,17
2279
 
-
 
2280
sysfn_getallmem:
2256
     jnz  no_get_all_space
2281
     mov  eax,[0xFE8C]
2257
     mov  eax,[0xFE8C]
-
 
Line 2258... Line -...
2258
     shr  eax,10
-
 
2259
;     mov  eax,[MEM_AllSpace]
2282
     shr  eax,10
2260
;     shl  eax,2
2283
;     mov  eax,[MEM_AllSpace]
2261
     ret
2284
;     shl  eax,2
2262
no_get_all_space:
2285
     mov  [esp+36],eax
2263
 
2286
     ret
Line 2692... Line 2715...
2692
align 4
2715
align 4
Line 2693... Line 2716...
2693
 
2716
 
Line 2694... Line 2717...
2694
sys_date:
2717
sys_date:
-
 
2718
 
2695
 
2719
        cli
2696
        cli
2720
 
2697
        mov     al,6            ; day of week
2721
  @@:   mov   al, 10
-
 
2722
        out   0x70, al
-
 
2723
        in    al, 0x71
-
 
2724
        test  al, al
-
 
2725
        jns   @f
-
 
2726
        mov   esi, 1
-
 
2727
        call  delay_ms
-
 
2728
        jmp   @b
2698
        out     0x70,al
2729
  @@:
2699
        in      al,0x71
2730
 
2700
        mov     ch,al
2731
        mov     ch,0
2701
        mov     al,7            ; date
2732
        mov     al,7            ; date
2702
        out     0x70,al
2733
        out     0x70,al
2703
        in      al,0x71
2734
        in      al,0x71
Line 3501... Line 3532...
3501
    pop  ecx edi esi
3532
    pop  ecx edi esi
3502
  .ret:
3533
  .ret:
3503
    ret
3534
    ret
Line -... Line 3535...
-
 
3535
 
3504
 
3536
 
3505
 
-
 
3506
align 4
-
 
3507
 
-
 
3508
read_floppy_file:
-
 
3509
 
3537
;  Sysfunction 34, read_floppy_file, is obsolete. Use 58 or 70 function instead.
3510
; as input
3538
;align 4
3511
;
-
 
3512
; eax pointer to file
-
 
3513
; ebx file lenght
-
 
3514
; ecx start 512 byte block number
-
 
3515
; edx number of blocks to read
3539
;
-
 
3540
;read_floppy_file:
-
 
3541
;
-
 
3542
;; as input
-
 
3543
;;
-
 
3544
;; eax pointer to file
-
 
3545
;; ebx file lenght
-
 
3546
;; ecx start 512 byte block number
-
 
3547
;; edx number of blocks to read
-
 
3548
;; esi pointer to return/work area (atleast 20 000 bytes)
-
 
3549
;;
-
 
3550
;;
-
 
3551
;; on return
-
 
3552
;;
-
 
3553
;; eax = 0 command succesful
-
 
3554
;;       1 no fd base and/or partition defined
-
 
3555
;;       2 yet unsupported FS
-
 
3556
;;       3 unknown FS
-
 
3557
;;       4 partition not defined at hd
3516
; esi pointer to return/work area (atleast 20 000 bytes)
3558
;;       5 file not found
-
 
3559
;; ebx = size of file
3517
;
3560
;
-
 
3561
;     mov   edi,[0x3010]
-
 
3562
;     add   edi,0x10
3518
;
3563
;     add   esi,[edi]
3519
; on return
-
 
3520
;
-
 
3521
; eax = 0 command succesful
-
 
3522
;       1 no fd base and/or partition defined
-
 
3523
;       2 yet unsupported FS
-
 
3524
;       3 unknown FS
-
 
3525
;       4 partition not defined at hd
-
 
3526
;       5 file not found
-
 
3527
; ebx = size of file
-
 
3528
 
-
 
3529
     mov   edi,[0x3010]
-
 
3530
     add   edi,0x10
-
 
3531
     add   esi,[edi]
-
 
3532
     add   eax,[edi]
3564
;     add   eax,[edi]
3533
 
3565
;
3534
     pushad
3566
;     pushad
3535
     mov  edi,esi
3567
;     mov  edi,esi
3536
     add  edi,1024
3568
;     add  edi,1024
3537
     mov  esi,0x100000+19*512
3569
;     mov  esi,0x100000+19*512
3538
     sub  ecx,1
3570
;     sub  ecx,1
3539
     shl  ecx,9
3571
;     shl  ecx,9
3540
     add  esi,ecx
3572
;     add  esi,ecx
3541
     shl  edx,9
3573
;     shl  edx,9
3542
     mov  ecx,edx
3574
;     mov  ecx,edx
3543
     cld
3575
;     cld
3544
     rep  movsb
3576
;     rep  movsb
3545
     popad
3577
;     popad
3546
 
3578
;
3547
     mov   [esp+36],eax
3579
;     mov   [esp+36],eax
Line 3548... Line 3580...
3548
     mov   [esp+24],ebx
3580
;     mov   [esp+24],ebx
Line 3556... Line 3588...
3556
 
3588
 
3557
    mov   edi,[0x3010]
3589
    mov   edi,[0x3010]
3558
    add   edi,0x10
3590
    add   edi,0x10
Line 3559... Line -...
3559
    add   eax,[edi]
-
 
3560
 
3591
    add   eax,[edi]
3561
    mov   edx,ebx
3592
 
3562
    shl   edx,2
-
 
3563
    add   edx,irq_owner
3593
    cmp   ebx,16
3564
    mov   edx,[edx]
3594
    jae   .not_owner
3565
    mov   edi,[0x3010]
3595
    mov   edi,[0x3010]
3566
    mov   edi,[edi+0x4]
3596
    mov   edi,[edi+0x4]
-
 
3597
    cmp   edi,[irq_owner+ebx*4]
3567
    cmp   edx,edi
3598
    je    spril1
3568
    je    spril1
3599
.not_owner:
3569
    mov   [esp+36],dword 1
3600
    mov   [esp+36],dword 1
Line 3570... Line 3601...
3570
    ret
3601
    ret
Line 3582... Line 3613...
3582
 
3613
 
Line 3583... Line 3614...
3583
 
3614
 
3584
align 4
-
 
-
 
3615
align 4
-
 
3616
 
3585
 
3617
get_irq_data:
3586
get_irq_data:
3618
     cmp   eax,16
3587
 
3619
     jae   .not_owner
3588
     mov   edx,eax           ; check for correct owner
3620
     mov   edx,eax           ; check for correct owner
3589
     shl   edx,2
3621
     shl   edx,2
3590
     add   edx,irq_owner
3622
     add   edx,irq_owner
3591
     mov   edx,[edx]
3623
     mov   edx,[edx]
3592
     mov   edi,[0x3010]
3624
     mov   edi,[0x3010]
3593
     mov   edi,[edi+0x4]
3625
     mov   edi,[edi+0x4]
3594
     cmp   edx,edi
3626
     cmp   edx,edi
3595
     je    gidril1
-
 
3596
     mov   [esp+36],eax
3627
     je    gidril1
Line 3597... Line 3628...
3597
     mov   [esp+32],dword 2
3628
.not_owner:
Line 3598... Line 3629...
3598
     mov   [esp+24],ebx
3629
     mov   [esp+32],dword 2     ; ecx=2
Line 3616... Line 3647...
3616
     mov   edi,esi
3647
     mov   edi,esi
3617
     inc   esi
3648
     inc   esi
3618
     mov   ecx,4000 / 4
3649
     mov   ecx,4000 / 4
3619
     cld
3650
     cld
3620
     rep   movsd
3651
     rep   movsd
3621
     xor   ecx,ecx
3652
;     xor   ecx,ecx     ; as result of 'rep' ecx=0
3622
   gid1:
3653
   gid1:
3623
     mov   [esp+36],eax
3654
     mov   [esp+36],eax
3624
     mov   [esp+32],ecx
3655
     mov   [esp+32],ecx
3625
     mov   [esp+24],ebx
3656
     mov   [esp+24],ebx
3626
     ret
3657
     ret
Line 3676... Line 3707...
3676
;   r_port_area:
3707
;   r_port_area:
Line 3677... Line 3708...
3677
 
3708
 
Line 3678... Line 3709...
3678
     pushad
3709
     pushad
3679
 
3710
 
-
 
3711
     cmp   ebx,ecx            ; beginning > end ?
-
 
3712
     ja    rpal1
3680
     cmp   ebx,ecx            ; beginning > end ?
3713
     cmp   ecx,65536
3681
     jg    rpal1
3714
     jae   rpal1
3682
     mov   esi,[0x2d0000]
3715
     mov   esi,[0x2d0000]
3683
     cmp   esi,0              ; no reserved areas ?
3716
     test  esi,esi            ; no reserved areas ?
3684
     je    rpal2
3717
     je    rpal2
3685
     cmp   esi,255            ; max reserved
3718
     cmp   esi,255            ; max reserved
3686
     jge   rpal1
3719
     jae   rpal1
3687
   rpal3:
3720
   rpal3:
3688
     mov   edi,esi
3721
     mov   edi,esi
3689
     shl   edi,4
3722
     shl   edi,4
3690
     add   edi,0x2d0000
3723
     add   edi,0x2d0000
3691
     cmp   ebx,[edi+8]
3724
     cmp   ebx,[edi+8]
3692
     jg    rpal4
3725
     ja    rpal4
3693
     cmp   ecx,[edi+4]
3726
     cmp   ecx,[edi+4]
3694
     jae   rpal1
3727
     jae   rpal1
3695
;     jb    rpal4
3728
;     jb    rpal4
Line 3719... Line 3752...
3719
 
3752
 
Line 3720... Line 3753...
3720
   new_port_access:
3753
   new_port_access:
Line 3721... Line 3754...
3721
 
3754
 
3722
     pushad
3755
     pushad
Line 3723... Line 3756...
3723
 
3756
 
Line 3724... Line 3757...
3724
     mov   ebp,0                  ; enable - eax = port
3757
     xor   ebp,ebp                ; enable - eax = port
Line 3755... Line 3788...
3755
free_port_area:
3788
free_port_area:
Line 3756... Line 3789...
3756
 
3789
 
Line 3757... Line 3790...
3757
     pushad
3790
     pushad
3758
 
3791
 
3759
     mov   esi,[0x2d0000]     ; no reserved areas ?
3792
     mov   esi,[0x2d0000]     ; no reserved areas ?
3760
     cmp   esi,0
3793
     test  esi,esi
3761
     je    frpal2
3794
     je    frpal2
3762
     mov   edx,[0x3010]
3795
     mov   edx,[0x3010]
3763
     mov   edx,[edx+4]
3796
     mov   edx,[edx+4]
Line 3823... Line 3856...
3823
     ret
3856
     ret
Line 3824... Line 3857...
3824
 
3857
 
Line -... Line 3858...
-
 
3858
 
3825
 
3859
reserve_free_irq:
-
 
3860
 
-
 
3861
     mov   ecx, 1
3826
reserve_free_irq:
3862
     cmp   ebx, 16
Line 3827... Line -...
3827
 
-
 
3828
     cmp   eax,0
-
 
3829
     jz    reserve_irq
3863
     jae   fril1
3830
 
3864
     test  eax,eax
3831
     mov   edi,ebx
3865
     jz    reserve_irq
3832
     shl   edi,2
3866
 
3833
     add   edi,irq_owner
-
 
3834
     mov   edx,[edi]
-
 
3835
     mov   eax,[0x3010]
3867
     lea   edi,[irq_owner+ebx*4]
3836
     mov   eax,[eax+0x4]
3868
     mov   edx,[edi]
3837
     mov   ecx,1
3869
     mov   eax,[0x3010]
3838
     cmp   edx,eax
3870
     cmp   edx,[eax+0x4]
3839
     jne   fril1
3871
     jne   fril1
3840
     mov   [edi],dword 0
3872
     dec   ecx
Line 3841... Line 3873...
3841
     mov   ecx,0
3873
     mov   [edi],ecx
Line 3842... Line -...
3842
   fril1:
-
 
3843
     mov   [esp+36],ecx ; return in eax
-
 
3844
     ret
3874
   fril1:
3845
 
-
 
3846
  reserve_irq:
-
 
3847
 
3875
     mov   [esp+36],ecx ; return in eax
3848
     mov   edi,ebx
3876
     ret
Line 3849... Line 3877...
3849
     shl   edi,2
3877
 
3850
     add   edi,irq_owner
3878
  reserve_irq:
3851
     mov   edx,[edi]
3879
 
3852
     mov   ecx,1
3880
     lea   edi,[irq_owner+ebx*4]
3853
     cmp   edx,0
-
 
3854
     jne   ril1
3881
     cmp   dword [edi], 0
3855
 
-
 
3856
     mov   edx,[0x3010]
3882
     jnz   ril1
3857
     mov   edx,[edx+0x4]
-
 
3858
     mov   [edi],edx
3883
 
Line 3859... Line 3884...
3859
     mov   ecx,0
3884
     mov   edx,[0x3010]
Line 3902... Line 3927...
3902
       call  vesa20_drawbackground_stretch
3927
       call  vesa20_drawbackground_stretch
3903
       dec   [mouse_pause]
3928
       dec   [mouse_pause]
3904
       call   [draw_pointer]
3929
       call   [draw_pointer]
3905
       ret
3930
       ret
Line -... Line 3931...
-
 
3931
 
-
 
3932
align 4
-
 
3933
 
Line -... Line 3934...
-
 
3934
syscall_putimage:                       ; PutImage
-
 
3935
 
-
 
3936
     mov   edx,ecx
Line 3906... Line 3937...
3906
 
3937
     mov   ecx,ebx
3907
 
3938
        lea     ebx, [eax+std_application_base_address]
3908
 
3939
 
3909
sys_putimage:
3940
sys_putimage:
Line 3914... Line 3945...
3914
     test  ecx,0xFFFF0000
3945
     test  ecx,0xFFFF0000
3915
     jnz   @f
3946
     jnz   @f
3916
  .exit:
3947
  .exit:
3917
     ret
3948
     ret
3918
 @@:
3949
 @@:
3919
;     inc   [mouse_pause]
3950
        mov     eax, vga_putimage
3920
     cmp   [0xfe0c],word 0x12
3951
        cmp     [0xfe0c], word 0x12
3921
     jne   spiv20
3952
        jz      .doit
3922
     call  vga_putimage
3953
        mov     eax, vesa12_putimage
3923
;     dec   [mouse_pause]
-
 
3924
     call   [draw_pointer]
-
 
3925
     ret
-
 
3926
   spiv20:
-
 
3927
     cmp   [0xfe0c],word 0100000000000000b
3954
        cmp     [0xfe0c], word 0100000000000000b
3928
     jge   piv20
3955
        jae     @f
3929
     cmp   [0xfe0c],word 0x13
3956
        cmp     [0xfe0c], word 0x13
3930
     je    piv20
3957
        jnz     .doit
-
 
3958
@@:
3931
     call  vesa12_putimage
3959
        mov     eax, vesa20_putimage
-
 
3960
.doit:
3932
;     dec   [mouse_pause]
3961
;       inc     [mouse_pause]
3933
     call   [draw_pointer]
3962
        call    eax
3934
     ret
-
 
3935
   piv20:
-
 
3936
     call  vesa20_putimage
-
 
3937
;     dec   [mouse_pause]
3963
;       dec     [mouse_pause]
3938
     call   [draw_pointer]
3964
        jmp     [draw_pointer]
3939
     ret
-
 
3940
 
-
 
3941
 
-
 
Line 3942... Line 3965...
3942
 
3965
 
3943
; eax x beginning
3966
; eax x beginning
3944
; ebx y beginning
3967
; ebx y beginning
3945
; ecx x end
3968
; ecx x end
Line 4456... Line 4479...
4456
     mov  ecx,edx                  ; size
4479
     mov  ecx,edx                  ; size
Line 4457... Line 4480...
4457
 
4480
 
4458
     mov  eax,edi
4481
     mov  eax,edi
4459
     add  eax,ecx
4482
     add  eax,ecx
4460
     cmp  eax,ebx
4483
     cmp  eax,ebx
Line 4461... Line 4484...
4461
     jge  ipc_err3                 ; not enough room ?
4484
     jg   ipc_err3                 ; not enough room ?
Line 4462... Line 4485...
4462
 
4485
 
4463
     push ecx
4486
     push ecx
Line 4596... Line 4619...
4596
     mov   [esp+36],ebx
4619
     mov   [esp+36],ebx
4597
     ret
4620
     ret
Line 4598... Line 4621...
4598
 
4621
 
Line 4599... Line -...
4599
align 4
-
 
4600
 
-
 
4601
syscall_putimage:                       ; PutImage
-
 
4602
 
-
 
4603
     mov   edi,[0x3010]
-
 
4604
     add   edi,0x10
-
 
4605
     add   eax,[edi]
-
 
4606
     mov   edx,ecx
-
 
4607
     mov   ecx,ebx
-
 
4608
     mov   ebx,eax
-
 
4609
     call  sys_putimage
-
 
4610
     mov   [esp+36],eax
-
 
4611
     ret
-
 
4612
 
-
 
4613
align 4
4622
align 4
Line 4614... Line 4623...
4614
 
4623
 
4615
syscall_drawrect:                       ; DrawRect
4624
syscall_drawrect:                       ; DrawRect
4616
 
4625
 
Line 4640... Line 4649...
4640
     mov   [esp+36],eax
4649
     mov   [esp+36],eax
4641
     ret
4650
     ret
Line 4642... Line 4651...
4642
 
4651
 
Line 4643... Line -...
4643
align 4
-
 
4644
 
-
 
4645
syscall_system:                         ; System
-
 
4646
 
-
 
4647
     call  sys_system
-
 
4648
     mov   [esp+36],eax
-
 
4649
     ret
-
 
4650
 
-
 
4651
align 4
4652
align 4
4652
 
4653
 
4653
syscall_startapp:                       ; StartApp
4654
syscall_startapp:                       ; StartApp
4654
     mov   edi,[0x3010]
4655
     mov   edi,[0x3010]
4655
     add   edi,0x10
4656
     add   edi,0x10
Line 4671... Line 4672...
4671
 
4672
 
4672
     call  sys_cd_audio
4673
     call  sys_cd_audio
4673
     mov   [esp+36],eax
4674
     mov   [esp+36],eax
Line -... Line 4675...
-
 
4675
     ret
4674
     ret
4676
 
4675
 
4677
;  ReadHd and StartHdApp functions are obsolete. Use 58 or 70 functions instead.
4676
align 4
4678
;align 4
4677
 
4679
;
4678
syscall_readhd:                         ; ReadHd
4680
;syscall_readhd:                         ; ReadHd
4679
 
4681
;
4680
     mov   edi,[0x3010]
4682
;     mov   edi,[0x3010]
4681
     add   edi,0x10
4683
;     add   edi,0x10
4682
     add   esi,[edi]
4684
;     add   esi,[edi]
4683
     add   eax,[edi]
4685
;     add   eax,[edi]
4684
     call  read_hd_file
4686
;     call  read_hd_file
4685
     mov   [esp+36],eax
4687
;     mov   [esp+36],eax
4686
     mov   [esp+24],ebx
-
 
4687
     ret
-
 
4688
 
-
 
4689
align 4
-
 
Line -... Line 4688...
-
 
4688
;     mov   [esp+24],ebx
-
 
4689
;     ret
-
 
4690
 
-
 
4691
;align 4
4690
 
4692
;
4691
syscall_starthdapp:                     ; StartHdApp
4693
;syscall_starthdapp:                     ; StartHdApp
4692
 
4694
;
4693
     mov   edi,[0x3010]
4695
;     mov   edi,[0x3010]
4694
     add   edi,0x10
4696
;     add   edi,0x10
4695
     add   eax,[edi]
4697
;     add   eax,[edi]
4696
     add   ecx,[edi]
4698
;     add   ecx,[edi]
4697
     xor   ebp,ebp
4699
;     xor   ebp,ebp
4698
     xor   edx,edx      ; compatibility - flags=0
4700
;     xor   edx,edx      ; compatibility - flags=0
Line 4699... Line 4701...
4699
     call  start_application_hd
4701
;     call  start_application_hd
Line 4700... Line 4702...
4700
     mov   [esp+36],eax
4702
;     mov   [esp+36],eax
Line 4767... Line 4769...
4767
     jmp   [draw_line]
4769
     jmp   [draw_line]
Line 4768... Line 4770...
4768
 
4770
 
Line 4769... Line 4771...
4769
align 4
4771
align 4
-
 
4772
 
4770
 
4773
syscall_getirqowner:                    ; GetIrqOwner
4771
syscall_getirqowner:                    ; GetIrqOwner
4774
     cmp   eax,16
4772
 
4775
     jae   .err
4773
     shl   eax,2
4776
     shl   eax,2
4774
     add   eax,irq_owner
4777
     add   eax,irq_owner
4775
     mov   eax,[eax]
4778
     mov   eax,[eax]
-
 
4779
     mov   [esp+36],eax
-
 
4780
     ret
-
 
4781
.err:
Line 4776... Line 4782...
4776
     mov   [esp+36],eax
4782
     or    dword [esp+36], -1
Line 4777... Line 4783...
4777
     ret
4783
     ret
Line 4858... Line 4864...
4858
     add   ecx,[edi]
4864
     add   ecx,[edi]
4859
     add   edx,[edi]
4865
     add   edx,[edi]
4860
     call  file_write
4866
     call  file_write
4861
     ret
4867
     ret
Line -... Line 4868...
-
 
4868
 
4862
 
4869
;  Sysfunction 57, delete_from_hd, is obsolete. Use 58 or 70 functions instead.
4863
align 4
4870
;align 4
4864
 
4871
;
4865
delete_from_hd:                         ; Delete a file from hd
4872
;delete_from_hd:                         ; Delete a file from hd
4866
 
4873
;
4867
     mov   edi,[0x3010]
4874
;     mov   edi,[0x3010]
4868
     add   edi,0x10
4875
;     add   edi,0x10
4869
     add   eax,[edi]
4876
;     add   eax,[edi]
4870
     add   ecx,[edi]
4877
;     add   ecx,[edi]
4871
     call  file_delete
4878
;     call  file_delete
4872
     ret
4879
;     ret
Line 4873... Line 4880...
4873
 
4880
;
Line 4874... Line 4881...
4874
 
4881