選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

3140 行
73 KiB

5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
4年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
4年前
4年前
4年前
4年前
4年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
4年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
4年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
5年前
4年前
4年前
5年前
5年前
4年前
4年前
5年前
5年前
5年前
4年前
5年前
4年前
4年前
5年前
  1. push bp
  2. mov bp,sp
  3. push 10[bp]
  4. push 8[bp]
  5. push 6[bp]
  6. call _main
  7. add sp, #0x6
  8. pop bp
  9. retf
  10. ! 1
  11. ! 1 # 1 "main.c"
  12. ! 1 # 1 "std_singos/stdio.h"
  13. ! 1 void print(string);
  14. !BCC_EOS
  15. ! 2 void* dump_ax_return(input);
  16. !BCC_EOS
  17. ! 3
  18. ! 4 void print(string)
  19. ! 5 char* string;
  20. export _print
  21. _print:
  22. !BCC_EOS
  23. ! 6 {
  24. ! 7 #asm
  25. !BCC_ASM
  26. _print.string set 2
  27. push bp
  28. mov bp,sp
  29. mov si,4[bp]
  30. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  31. new_print_print:
  32. ; Prints string in si
  33. ; IN si: zero terminated string to print
  34. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  35. mov ah, #0xE ; Specify 'int 0x10' 'teletype output' function
  36. ; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
  37. .new_print_printchar:
  38. lodsb ; Load byte at address SI into AL, and increment SI
  39. test al, al
  40. jz .new_print_done ; If the character is zero (NUL), stop writing the string
  41. int #0x10 ; Otherwise, print the character via 'int 0x10'
  42. jmp .new_print_printchar ; Repeat for the next character
  43. .new_print_done:
  44. pop bp
  45. ! 28 endasm
  46. !BCC_ENDASM
  47. ! 29 }
  48. ret
  49. ! 30
  50. ! 31
  51. ! 32 void print_stack(argument)
  52. ! 33 {
  53. export _print_stack
  54. _print_stack:
  55. ! 34 #asm
  56. !BCC_ASM
  57. _print_stack.argument set 2
  58. push bp
  59. mov bp,sp
  60. push ds
  61. push ax
  62. mov ax, ss
  63. mov ds, ax
  64. mov si,4[bp]
  65. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  66. print_stack_print:
  67. ; Prints string in si
  68. ; IN si: zero terminated string to print
  69. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  70. mov ah, #0xE ; Specify 'int 0x10' 'teletype output' function
  71. ; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
  72. .print_stack_printchar:
  73. lodsb ; Load byte at address SI into AL, and increment SI
  74. test al, al
  75. jz .print_stack_done ; If the character is zero (NUL), stop writing the string
  76. int #0x10 ; Otherwise, print the character via 'int 0x10'
  77. jmp .print_stack_printchar ; Repeat for the next character
  78. .print_stack_done:
  79. pop ax
  80. pop ds
  81. pop bp
  82. ! 61 endasm
  83. !BCC_ENDASM
  84. ! 62 }
  85. ret
  86. ! 63
  87. ! 64 void* dump_ax_return(input)
  88. ! 65 void* input;
  89. export _dump_ax_return
  90. _dump_ax_return:
  91. !BCC_EOS
  92. ! 66 {
  93. ! 67 return
  94. ! 67 input;
  95. push bp
  96. mov bp,sp
  97. push di
  98. push si
  99. mov ax,4[bp]
  100. pop si
  101. pop di
  102. pop bp
  103. ret
  104. !BCC_EOS
  105. ! 68 }
  106. ! 69
  107. ! 70 void dump_ax(input)
  108. ! 71 void* input;
  109. export _dump_ax
  110. _dump_ax:
  111. !BCC_EOS
  112. ! 72 {
  113. ! 73 dump_ax_return(input)
  114. push bp
  115. mov bp,sp
  116. push di
  117. push si
  118. ! 74 #asm
  119. ! Debug: list * void input = [S+6+2] (used reg = )
  120. push 4[bp]
  121. ! Debug: func () * void = dump_ax_return+0 (used reg = )
  122. call _dump_ax_return
  123. inc sp
  124. inc sp
  125. !BCC_EOS
  126. !BCC_ASM
  127. _dump_ax.input set 8
  128. .dump_ax.input set 4
  129. push bp
  130. mov bp,sp
  131. pusha ; save registers
  132. mov bx, ax
  133. mov ah, #0xE ; Teletype output
  134. mov cx, #4 ; 4 nipples in a 16 bit word
  135. .dump_ax_loop:
  136. rol bx, #4 ; rotate to next nipple
  137. mov al, bl ; we copy to al because we need to mask only the low 4 bits
  138. and al, #%1111 ; Do the masking
  139. add al, #48 ; convert to ASCII
  140. cmp al, #57 ; If we are greater than 9 ascii, we add 7 to make digit 10 be represented as 'A'
  141. jbe .dump_ax_skip ; -|-
  142. add al, #7 ; -|-
  143. .dump_ax_skip: ; -|-
  144. int #0x10 ; BIOS call 'output'
  145. loop .dump_ax_loop
  146. popa ; restore registers
  147. pop bp
  148. ! 98 endasm
  149. !BCC_ENDASM
  150. !BCC_EOS
  151. ! 99 }
  152. pop si
  153. pop di
  154. pop bp
  155. ret
  156. ! 100
  157. ! 101 void print_newline()
  158. ! 102 {
  159. export _print_newline
  160. _print_newline:
  161. ! 103 #asm
  162. !BCC_ASM
  163. printCRLF:
  164. mov ah, #0xE
  165. mov al, #13
  166. int #0x10
  167. mov al, #10
  168. int #0x10
  169. ret
  170. ! 111 endasm
  171. !BCC_ENDASM
  172. ! 112 }
  173. ret
  174. ! 113 # 1 "std_singos/stdlib.h"
  175. ! 1 unsigned int global_heap_start = 0;
  176. export _global_heap_start
  177. _global_heap_start:
  178. .word 0
  179. !BCC_EOS
  180. ! 2 unsigned int global_heap_end = 0;
  181. export _global_heap_end
  182. _global_heap_end:
  183. .word 0
  184. !BCC_EOS
  185. ! 3 unsigned int global_heap_next = 0;
  186. export _global_heap_next
  187. _global_heap_next:
  188. .word 0
  189. !BCC_EOS
  190. ! 4
  191. ! 5 void* malloc(num_bytes);
  192. !BCC_EOS
  193. ! 6 void* calloc(number_elements, size);
  194. !BCC_EOS
  195. ! 7 int set_heap_settings(param_start, param_end);
  196. !BCC_EOS
  197. ! 8 unsigned int get_heap_next();
  198. !BCC_EOS
  199. ! 9
  200. ! 10 void* malloc(num_bytes)
  201. ! 11 int num_bytes;
  202. .text
  203. export _malloc
  204. _malloc:
  205. !BCC_EOS
  206. ! 12 {
  207. ! 13 unsigned int allocated_pointer = global_heap_next;
  208. push bp
  209. mov bp,sp
  210. push di
  211. push si
  212. dec sp
  213. dec sp
  214. ! Debug: eq unsigned int = [global_heap_next+0] to unsigned int allocated_pointer = [S+8-8] (used reg = )
  215. mov ax,[_global_heap_next]
  216. mov -6[bp],ax
  217. !BCC_EOS
  218. ! 14 global_heap_next = global_heap_next + num_bytes;
  219. ! Debug: add int num_bytes = [S+8+2] to unsigned int = [global_heap_next+0] (used reg = )
  220. mov ax,[_global_heap_next]
  221. add ax,4[bp]
  222. ! Debug: eq unsigned int = ax+0 to unsigned int = [global_heap_next+0] (used reg = )
  223. mov [_global_heap_next],ax
  224. !BCC_EOS
  225. ! 15 if (global_heap_next > global_heap_end)
  226. ! Debug: gt unsigned int = [global_heap_end+0] to unsigned int = [global_heap_next+0] (used reg = )
  227. mov ax,[_global_heap_next]
  228. cmp ax,[_global_heap_end]
  229. jbe .1
  230. .2:
  231. ! 16 {
  232. ! 17 return 0;
  233. xor ax,ax
  234. inc sp
  235. inc sp
  236. pop si
  237. pop di
  238. pop bp
  239. ret
  240. !BCC_EOS
  241. ! 18 }
  242. ! 19
  243. ! 20 return allocated_pointer;
  244. .1:
  245. mov ax,-6[bp]
  246. inc sp
  247. inc sp
  248. pop si
  249. pop di
  250. pop bp
  251. ret
  252. !BCC_EOS
  253. ! 21 }
  254. ! 22
  255. ! 23 void* calloc(number_elements, size)
  256. ! 24 unsigned int number_elements;
  257. export _calloc
  258. _calloc:
  259. !BCC_EOS
  260. ! 25 unsigned int size;
  261. !BCC_EOS
  262. ! 26 {
  263. ! 27 int i;
  264. !BCC_EOS
  265. ! 28 char* temp_pointer;
  266. !BCC_EOS
  267. ! 29 unsigned int num_bytes = number_elements * size;
  268. push bp
  269. mov bp,sp
  270. push di
  271. push si
  272. add sp,*-6
  273. ! Debug: mul unsigned int size = [S+$C+4] to unsigned int number_elements = [S+$C+2] (used reg = )
  274. mov ax,4[bp]
  275. mov cx,6[bp]
  276. imul cx
  277. ! Debug: eq unsigned int = ax+0 to unsigned int num_bytes = [S+$C-$C] (used reg = )
  278. mov -$A[bp],ax
  279. !BCC_EOS
  280. ! 30 void* allocated_pointer = global_heap_next;
  281. dec sp
  282. dec sp
  283. ! Debug: eq unsigned int = [global_heap_next+0] to * void allocated_pointer = [S+$E-$E] (used reg = )
  284. mov bx,[_global_heap_next]
  285. mov -$C[bp],bx
  286. !BCC_EOS
  287. ! 31 global_heap_next = global_heap_next + num_bytes;
  288. ! Debug: add unsigned int num_bytes = [S+$E-$C] to unsigned int = [global_heap_next+0] (used reg = )
  289. mov ax,[_global_heap_next]
  290. add ax,-$A[bp]
  291. ! Debug: eq unsigned int = ax+0 to unsigned int = [global_heap_next+0] (used reg = )
  292. mov [_global_heap_next],ax
  293. !BCC_EOS
  294. ! 32 if (global_heap_next > global_heap_end)
  295. ! Debug: gt unsigned int = [global_heap_end+0] to unsigned int = [global_heap_next+0] (used reg = )
  296. mov ax,[_global_heap_next]
  297. cmp ax,[_global_heap_end]
  298. jbe .3
  299. .4:
  300. ! 33 {
  301. ! 34 return 0;
  302. xor ax,ax
  303. add sp,*8
  304. pop si
  305. pop di
  306. pop bp
  307. ret
  308. !BCC_EOS
  309. ! 35 }
  310. ! 36
  311. ! 37
  312. ! 38 temp_pointer = allocated_pointer;
  313. .3:
  314. ! Debug: eq * void allocated_pointer = [S+$E-$E] to * char temp_pointer = [S+$E-$A] (used reg = )
  315. mov bx,-$C[bp]
  316. mov -8[bp],bx
  317. !BCC_EOS
  318. ! 39 for (i = 0; i < num_bytes; ++i)
  319. ! Debug: eq int = const 0 to int i = [S+$E-8] (used reg = )
  320. xor ax,ax
  321. mov -6[bp],ax
  322. !BCC_EOS
  323. !BCC_EOS
  324. ! 40 {
  325. jmp .7
  326. .8:
  327. ! 41 *temp_pointer = 0;
  328. mov bx,-8[bp]
  329. ! Debug: eq int = const 0 to char = [bx+0] (used reg = )
  330. xor al,al
  331. mov [bx],al
  332. !BCC_EOS
  333. ! 42 temp_pointer++;
  334. ! Debug: postinc * char temp_pointer = [S+$E-$A] (used reg = )
  335. mov bx,-8[bp]
  336. inc bx
  337. mov -8[bp],bx
  338. !BCC_EOS
  339. ! 43 }
  340. ! 44
  341. ! 45 return allocated_pointer;
  342. .6:
  343. ! Debug: preinc int i = [S+$E-8] (used reg = )
  344. mov ax,-6[bp]
  345. inc ax
  346. mov -6[bp],ax
  347. .7:
  348. ! Debug: lt unsigned int num_bytes = [S+$E-$C] to int i = [S+$E-8] (used reg = )
  349. mov ax,-6[bp]
  350. cmp ax,-$A[bp]
  351. jb .8
  352. .9:
  353. .5:
  354. mov ax,-$C[bp]
  355. add sp,*8
  356. pop si
  357. pop di
  358. pop bp
  359. ret
  360. !BCC_EOS
  361. ! 46 }
  362. ! 47
  363. ! 48 int set_heap_settings(param_start, param_end)
  364. ! Register BX used in function calloc
  365. ! 49 unsigned int param_start;
  366. export _set_heap_settings
  367. _set_heap_settings:
  368. !BCC_EOS
  369. ! 50 unsigned int param_end;
  370. !BCC_EOS
  371. ! 51 {
  372. ! 52 global_heap_start = param_start;
  373. push bp
  374. mov bp,sp
  375. push di
  376. push si
  377. ! Debug: eq unsigned int param_start = [S+6+2] to unsigned int = [global_heap_start+0] (used reg = )
  378. mov ax,4[bp]
  379. mov [_global_heap_start],ax
  380. !BCC_EOS
  381. ! 53 global
  382. ! 53 _heap_next = param_start;
  383. ! Debug: eq unsigned int param_start = [S+6+2] to unsigned int = [global_heap_next+0] (used reg = )
  384. mov ax,4[bp]
  385. mov [_global_heap_next],ax
  386. !BCC_EOS
  387. ! 54 global_heap_end = param_end;
  388. ! Debug: eq unsigned int param_end = [S+6+4] to unsigned int = [global_heap_end+0] (used reg = )
  389. mov ax,6[bp]
  390. mov [_global_heap_end],ax
  391. !BCC_EOS
  392. ! 55 return 0;
  393. xor ax,ax
  394. pop si
  395. pop di
  396. pop bp
  397. ret
  398. !BCC_EOS
  399. ! 56 }
  400. ! 57
  401. ! 58 unsigned int get_heap_next()
  402. ! 59 {
  403. export _get_heap_next
  404. _get_heap_next:
  405. ! 60 return global_heap_next;
  406. push bp
  407. mov bp,sp
  408. push di
  409. push si
  410. mov ax,[_global_heap_next]
  411. pop si
  412. pop di
  413. pop bp
  414. ret
  415. !BCC_EOS
  416. ! 61 # 19 "main.h"
  417. ! 19 }
  418. ! 20 # 2 "std_singos/string.h"
  419. ! 2 typedef struct Length_String {
  420. ! 3 short dynamic;
  421. !BCC_EOS
  422. ! 4 unsigned int length;
  423. !BCC_EOS
  424. ! 5 char *chars;
  425. !BCC_EOS
  426. ! 6 } Length_String;
  427. !BCC_EOS
  428. ! 7
  429. ! 8 typedef struct String_Array {
  430. ! 9 unsigned int length;
  431. !BCC_EOS
  432. ! 10 Length_String **strings;
  433. !BCC_EOS
  434. ! 11 } String_Array;
  435. !BCC_EOS
  436. ! 12
  437. ! 13 void strcpy (destination, destination_segment, source, source_segment );
  438. !BCC_EOS
  439. ! 14 int strlen (source, source_segment);
  440. !BCC_EOS
  441. ! 15 void memcpy (destination, destination_segment, source, source_segment, num_bytes );
  442. !BCC_EOS
  443. ! 16
  444. ! 17
  445. ! 18 String_Array *string_split_c(string, delim, keep_delim);
  446. !BCC_EOS
  447. ! 19 Length_String *make_length_string(length, chars);
  448. !BCC_EOS
  449. ! 20 Length_String *make_length_string_c(cstring);
  450. !BCC_EOS
  451. ! 21 String_Array *length_string_split(string, delim, keep_delim);
  452. !BCC_EOS
  453. ! 22 String_Array *create_length_string_array(array_size);
  454. !BCC_EOS
  455. ! 23 Length_String *create_length_string(length, chars);
  456. !BCC_EOS
  457. ! 24
  458. ! 25
  459. ! 26
  460. ! 27 int strlen (source, source_segment)
  461. ! 28 {
  462. export _strlen
  463. _strlen:
  464. ! 29 #asm
  465. !BCC_ASM
  466. _strlen.source set 2
  467. _strlen.source_segment set 4
  468. push bp
  469. mov bp,sp
  470. push ds
  471. push bx
  472. mov ax, 6[bp];
  473. mov ds, ax
  474. mov bx, 4[bp];
  475. label_strlen:
  476. mov cx, #0x0 ; Set counte to zero
  477. .label_strlen_loop:
  478. mov BYTE al, [bx]
  479. cmp al, #0x0
  480. je .label_strlen_done
  481. inc cx ; Count 1
  482. inc bx ; Look at next char
  483. jmp .label_strlen_loop
  484. .label_strlen_done:
  485. mov ax, cx
  486. pop bx
  487. pop ds
  488. pop bp
  489. ! 57 endasm
  490. !BCC_ENDASM
  491. ! 58 }
  492. ret
  493. ! 59
  494. ! 60 void strcpy (destination, destination_segment, source, source_segment )
  495. ! 61 char *destination;
  496. export _strcpy
  497. _strcpy:
  498. !BCC_EOS
  499. ! 62 int destination_segment;
  500. !BCC_EOS
  501. ! 63 char *source;
  502. !BCC_EOS
  503. ! 64 int source_segment;
  504. !BCC_EOS
  505. ! 65 {
  506. ! 66 #asm
  507. !BCC_ASM
  508. _strcpy.source set 6
  509. _strcpy.destination set 2
  510. _strcpy.source_segment set 8
  511. _strcpy.destination_segment set 4
  512. ; copy two strings
  513. ; IN si: the first (zero terminated) string
  514. ; IN di: the second (zero terminated) string
  515. ; OUT SF and ZF (same semantics as cmp)
  516. ! 72 76
  517. push bp
  518. mov bp,sp
  519. label_strcpy:
  520. push ax
  521. push bx
  522. push di
  523. push es
  524. push si
  525. push ds
  526. mov ax, 4[bp]; ;
  527. mov di, ax
  528. mov ax, 6[bp]; ;
  529. mov es, ax
  530. mov ax, 8[bp]; ;
  531. mov si, ax
  532. mov ax, 10[bp]; ;
  533. mov ds, ax
  534. mov cx, 0x050 ;TODO(Jrn) Hardcded number of bytes to copy
  535. .label_strcpy_loop:
  536. movsb
  537. cmp cx, 0x0
  538. je .label_strcpy_end
  539. dec cx
  540. jmp .label_strcpy_loop
  541. .label_strcpy_end:
  542. pop ds
  543. pop si
  544. pop es
  545. pop di
  546. pop bx
  547. pop ax
  548. pop bp
  549. ! 110 endasm
  550. !BCC_ENDASM
  551. ! 111 }
  552. ret
  553. ! 112
  554. ! 113 void memcpy (destination, destination_segment, source, source_segment, num_bytes)
  555. ! 114 void *destination;
  556. export _memcpy
  557. _memcpy:
  558. !BCC_EOS
  559. ! 115 int destination_segment;
  560. !BCC_EOS
  561. ! 116 void *source;
  562. !BCC_EOS
  563. ! 117 int source_segment;
  564. !BCC_EOS
  565. ! 118 int num_bytes;
  566. !BCC_EOS
  567. ! 119 {
  568. ! 120 #asm
  569. !BCC_ASM
  570. _memcpy.source set 6
  571. _memcpy.destination set 2
  572. _memcpy.num_bytes set $A
  573. _memcpy.source_segment set 8
  574. _memcpy.destination_segment set 4
  575. ; copy two strings
  576. ; IN si: the first (zero terminated) string
  577. ; IN di: the second (zero terminated) string
  578. ; OUT SF and ZF (same semantics as cmp)
  579. ! 126 131
  580. push bp
  581. mov bp,sp
  582. label_memcpy:
  583. push ax
  584. push bx
  585. push di
  586. push es
  587. push si
  588. push ds
  589. mov ax, 4[bp]; ;
  590. mov di, ax
  591. mov ax, 6[bp]; ;
  592. mov es, ax
  593. mov ax, 8[bp]; ;
  594. mov si, ax
  595. mov ax, 10[bp]; ;
  596. mov ds, ax
  597. mov cx, 12[bp];
  598. .label_memcpy_loop:
  599. movsb
  600. cmp cx, 0x0
  601. je .label_memcpy_end
  602. dec cx
  603. jmp .label_memcpy_loop
  604. .label_memcpy_end:
  605. pop ds
  606. pop si
  607. pop es
  608. pop di
  609. pop bx
  610. pop ax
  611. pop bp
  612. ! 165 endasm
  613. !BCC_ENDASM
  614. ! 166 }
  615. ret
  616. ! 167
  617. ! 168 int strcmp(source_1, source_2)
  618. ! 169 char* source_1;
  619. export _strcmp
  620. _strcmp:
  621. !BCC_EOS
  622. ! 170 char* source_2;
  623. !BCC_EOS
  624. ! 171 {
  625. ! 172 int i;
  626. !BCC_EOS
  627. ! 173 int count;
  628. !BCC_EOS
  629. ! 174
  630. ! 175 count = strlen(source_1, 0x7e0);
  631. push bp
  632. mov bp,sp
  633. push di
  634. push si
  635. add sp,*-4
  636. ! Debug: list int = const $7E0 (used reg = )
  637. mov ax,#$7E0
  638. push ax
  639. ! Debug: list * char source_1 = [S+$C+2] (used reg = )
  640. push 4[bp]
  641. ! Debug: func () int = strlen+0 (used reg = )
  642. call _strlen
  643. add sp,*4
  644. ! Debug: eq int = ax+0 to int count = [S+$A-$A] (used reg = )
  645. mov -8[bp],ax
  646. !BCC_EOS
  647. ! 176 if (count != strlen(source_2, 0x7e0))
  648. ! Debug: list int = const $7E0 (used reg = )
  649. mov ax,#$7E0
  650. push ax
  651. ! Debug: list * char source_2 = [S+$C+4] (used reg = )
  652. push 6[bp]
  653. ! Debug: func () int = strlen+0 (used reg = )
  654. call _strlen
  655. add sp,*4
  656. ! Debug: ne int = ax+0 to int count = [S+$A-$A] (used reg = )
  657. ! Debug: expression subtree swapping
  658. cmp ax,-8[bp]
  659. je .A
  660. .B:
  661. ! 177 {
  662. ! 178 return -1;
  663. mov ax,*-1
  664. add sp,*4
  665. pop si
  666. pop di
  667. pop bp
  668. ret
  669. !BCC_EOS
  670. ! 179 }
  671. ! 180
  672. ! 181
  673. ! 182 for (i = 0; i < count; i++)
  674. .A:
  675. ! Debug: eq int = const 0 to int i = [S+$A-8] (used reg = )
  676. xor ax,ax
  677. mov -6[bp],ax
  678. !BCC_EOS
  679. !BCC_EOS
  680. ! 183 {
  681. jmp .E
  682. .F:
  683. ! 184 if(source_1[i] != source_2[i])
  684. ! Debug: ptradd int i = [S+$A-8] to * char source_2 = [S+$A+4] (used reg = )
  685. mov ax,-6[bp]
  686. add ax,6[bp]
  687. mov bx,ax
  688. ! Debug: ptradd int i = [S+$A-8] to * char source_1 = [S+$A+2] (used reg = bx)
  689. mov ax,-6[bp]
  690. add ax,4[bp]
  691. mov si,ax
  692. ! Debug: ne char = [bx+0] to char = [si+0] (used reg = )
  693. mov al,[si]
  694. cmp al,[bx]
  695. je .10
  696. .11:
  697. ! 185 {
  698. ! 186 return -1;
  699. mov ax,*-1
  700. add sp,*4
  701. pop si
  702. pop di
  703. pop bp
  704. ret
  705. !BCC_EOS
  706. ! 187 }
  707. ! 188 }
  708. .10:
  709. ! 189
  710. ! 190 return 0;
  711. .D:
  712. ! Debug: postinc int i = [S+$A-8] (used reg = )
  713. mov ax,-6[bp]
  714. inc ax
  715. mov -6[bp],ax
  716. .E:
  717. ! Debug: lt int count = [S+$A-$A] to int i = [S+$A-8] (used reg = )
  718. mov ax,-6[bp]
  719. cmp ax,-8[bp]
  720. jl .F
  721. .12:
  722. .C:
  723. xor ax,ax
  724. add sp,*4
  725. pop si
  726. pop di
  727. pop bp
  728. ret
  729. !BCC_EOS
  730. ! 191 # 223
  731. ! 223
  732. ! 224 }
  733. ! 225
  734. ! 226 String_Array *string_split_c(string, delim, keep_delim)
  735. ! Register BX SI used in function strcmp
  736. ! 227 char *string;
  737. export _string_split_c
  738. _string_split_c:
  739. !BCC_EOS
  740. ! 228 char delim;
  741. !BCC_EOS
  742. ! 229 short keep_delim;
  743. !BCC_EOS
  744. ! 230 {
  745. ! 231 return length_string_split(make_length_string_c(string), delim, keep_delim);
  746. push bp
  747. mov bp,sp
  748. push di
  749. push si
  750. ! Debug: list short keep_delim = [S+6+6] (used reg = )
  751. push 8[bp]
  752. ! Debug: list char delim = [S+8+4] (used reg = )
  753. mov al,6[bp]
  754. xor ah,ah
  755. push ax
  756. ! Debug: list * char string = [S+$A+2] (used reg = )
  757. push 4[bp]
  758. ! Debug: func () * struct Length_String = make_length_string_c+0 (used reg = )
  759. call _make_length_string_c
  760. inc sp
  761. inc sp
  762. ! Debug: list * struct Length_String = ax+0 (used reg = )
  763. push ax
  764. ! Debug: func () * struct String_Array = length_string_split+0 (used reg = )
  765. call _length_string_split
  766. add sp,*6
  767. ! Debug: cast * struct String_Array = const 0 to * struct String_Array = ax+0 (used reg = )
  768. pop si
  769. pop di
  770. pop bp
  771. ret
  772. !BCC_EOS
  773. ! 232 }
  774. ! 233
  775. ! 234 Length_String *make_length_string_c(cstring)
  776. ! 235 char *cstring;
  777. export _make_length_string_c
  778. _make_length_string_c:
  779. !BCC_EOS
  780. ! 236 {
  781. ! 237 return make_length_string(strlen(cstring, 0x7e0), cstring);
  782. push bp
  783. mov bp,sp
  784. push di
  785. push si
  786. ! Debug: list * char cstring = [S+6+2] (used reg = )
  787. push 4[bp]
  788. ! Debug: list int = const $7E0 (used reg = )
  789. mov ax,#$7E0
  790. push ax
  791. ! Debug: list * char cstring = [S+$A+2] (used reg = )
  792. push 4[bp]
  793. ! Debug: func () int = strlen+0 (used reg = )
  794. call _strlen
  795. add sp,*4
  796. ! Debug: list int = ax+0 (used reg = )
  797. push ax
  798. ! Debug: func () * struct Length_String = make_length_string+0 (used reg = )
  799. call _make_length_string
  800. add sp,*4
  801. ! Debug: cast * struct Length_String = const 0 to * struct Length_String = ax+0 (used reg = )
  802. pop si
  803. pop di
  804. pop bp
  805. ret
  806. !BCC_EOS
  807. ! 238 }
  808. ! 239
  809. ! 240 Length_S
  810. ! 240 tring *make_length_string(length, chars)
  811. ! 241 unsigned int length;
  812. export _make_length_string
  813. _make_length_string:
  814. !BCC_EOS
  815. ! 242 char *chars;
  816. !BCC_EOS
  817. ! 243 {
  818. ! 244
  819. ! 245 Length_String *legth_string = malloc(sizeof(Length_String));
  820. push bp
  821. mov bp,sp
  822. push di
  823. push si
  824. dec sp
  825. dec sp
  826. ! Debug: list int = const 6 (used reg = )
  827. mov ax,*6
  828. push ax
  829. ! Debug: func () * void = malloc+0 (used reg = )
  830. call _malloc
  831. inc sp
  832. inc sp
  833. ! Debug: eq * void = ax+0 to * struct Length_String legth_string = [S+8-8] (used reg = )
  834. mov -6[bp],ax
  835. !BCC_EOS
  836. ! 246 char *copy = malloc(length + 1);
  837. dec sp
  838. dec sp
  839. ! Debug: add int = const 1 to unsigned int length = [S+$A+2] (used reg = )
  840. mov ax,4[bp]
  841. ! Debug: list unsigned int = ax+1 (used reg = )
  842. inc ax
  843. push ax
  844. ! Debug: func () * void = malloc+0 (used reg = )
  845. call _malloc
  846. inc sp
  847. inc sp
  848. ! Debug: eq * void = ax+0 to * char copy = [S+$A-$A] (used reg = )
  849. mov -8[bp],ax
  850. !BCC_EOS
  851. ! 247 memcpy(copy, 0x7e0, chars, 0x7e0, length);
  852. ! Debug: list unsigned int length = [S+$A+2] (used reg = )
  853. push 4[bp]
  854. ! Debug: list int = const $7E0 (used reg = )
  855. mov ax,#$7E0
  856. push ax
  857. ! Debug: list * char chars = [S+$E+4] (used reg = )
  858. push 6[bp]
  859. ! Debug: list int = const $7E0 (used reg = )
  860. mov ax,#$7E0
  861. push ax
  862. ! Debug: list * char copy = [S+$12-$A] (used reg = )
  863. push -8[bp]
  864. ! Debug: func () void = memcpy+0 (used reg = )
  865. call _memcpy
  866. add sp,*$A
  867. !BCC_EOS
  868. ! 248 copy[length] = '';
  869. ! Debug: ptradd unsigned int length = [S+$A+2] to * char copy = [S+$A-$A] (used reg = )
  870. mov ax,4[bp]
  871. add ax,-8[bp]
  872. mov bx,ax
  873. ! Debug: eq int = const 0 to char = [bx+0] (used reg = )
  874. xor al,al
  875. mov [bx],al
  876. !BCC_EOS
  877. ! 249
  878. ! 250 legth_string->dynamic = 0;
  879. mov bx,-6[bp]
  880. ! Debug: eq int = const 0 to short = [bx+0] (used reg = )
  881. xor ax,ax
  882. mov [bx],ax
  883. !BCC_EOS
  884. ! 251 legth_string->length = length;
  885. mov bx,-6[bp]
  886. ! Debug: eq unsigned int length = [S+$A+2] to unsigned int = [bx+2] (used reg = )
  887. mov ax,4[bp]
  888. mov 2[bx],ax
  889. !BCC_EOS
  890. ! 252 legth_string->chars = (char *)chars;
  891. mov bx,-6[bp]
  892. ! Debug: eq * char chars = [S+$A+4] to * char = [bx+4] (used reg = )
  893. mov si,6[bp]
  894. mov 4[bx],si
  895. !BCC_EOS
  896. ! 253
  897. ! 254 return legth_string;
  898. mov ax,-6[bp]
  899. add sp,*4
  900. pop si
  901. pop di
  902. pop bp
  903. ret
  904. !BCC_EOS
  905. ! 255 }
  906. ! 256
  907. ! 257 String_Array *length_string_split(string, delim, keep_delim)
  908. ! Register BX SI used in function make_length_string
  909. ! 258 Length_String *string;
  910. export _length_string_split
  911. _length_string_split:
  912. !BCC_EOS
  913. ! 259 char delim;
  914. !BCC_EOS
  915. ! 260 short keep_delim;
  916. !BCC_EOS
  917. ! 261 {
  918. ! 262 unsigned int i;
  919. !BCC_EOS
  920. ! 263 unsigned int last;
  921. !BCC_EOS
  922. ! 264
  923. ! 265 unsigned int count = 0;
  924. push bp
  925. mov bp,sp
  926. push di
  927. push si
  928. add sp,*-6
  929. ! Debug: eq int = const 0 to unsigned int count = [S+$C-$C] (used reg = )
  930. xor ax,ax
  931. mov -$A[bp],ax
  932. !BCC_EOS
  933. ! 266 unsigned int insert_index = 0;
  934. dec sp
  935. dec sp
  936. ! Debug: eq int = const 0 to unsigned int insert_index = [S+$E-$E] (used reg = )
  937. xor ax,ax
  938. mov -$C[bp],ax
  939. !BCC_EOS
  940. ! 267 String_Array *result;
  941. !BCC_EOS
  942. ! 268 int k;
  943. !BCC_EOS
  944. ! 269
  945. ! 270 i = 0;
  946. add sp,*-4
  947. ! Debug: eq int = const 0 to unsigned int i = [S+$12-8] (used reg = )
  948. xor ax,ax
  949. mov -6[bp],ax
  950. !BCC_EOS
  951. ! 271 last = 0;
  952. ! Debug: eq int = const 0 to unsigned int last = [S+$12-$A] (used reg = )
  953. xor ax,ax
  954. mov -8[bp],ax
  955. !BCC_EOS
  956. ! 272 while(i < string->length) {
  957. jmp .14
  958. .15:
  959. ! 273 if (string->chars[i] == delim) {
  960. mov bx,4[bp]
  961. ! Debug: ptradd unsigned int i = [S+$12-8] to * char = [bx+4] (used reg = )
  962. mov ax,-6[bp]
  963. add ax,4[bx]
  964. mov bx,ax
  965. ! Debug: logeq char delim = [S+$12+4] to char = [bx+0] (used reg = )
  966. mov al,[bx]
  967. cmp al,6[bp]
  968. jne .16
  969. .17:
  970. ! 274 if (i > last+1) {
  971. ! Debug: add int = const 1 to unsigned int last = [S+$12-$A] (used reg = )
  972. mov ax,-8[bp]
  973. ! Debug: gt unsigned int = ax+1 to unsigned int i = [S+$12-8] (used reg = )
  974. inc ax
  975. cmp ax,-6[bp]
  976. jae .18
  977. .19:
  978. ! 275 ++count;
  979. ! Debug: preinc unsigned int count = [S+$12-$C] (used reg = )
  980. mov ax,-$A[bp]
  981. inc ax
  982. mov -$A[bp],ax
  983. !BCC_EOS
  984. ! 276 }
  985. ! 277 last = i;
  986. .18:
  987. ! Debug: eq unsigned int i = [S+$12-8] to unsigned int last = [S+$12-$A] (used reg = )
  988. mov ax,-6[bp]
  989. mov -8[bp],ax
  990. !BCC_EOS
  991. ! 278 }
  992. ! 279 ++i;
  993. .16:
  994. ! Debug: preinc unsigned int i = [S+$12-8] (used reg = )
  995. mov ax,-6[bp]
  996. inc ax
  997. mov -6[bp],ax
  998. !BCC_EOS
  999. ! 280 }
  1000. ! 281 if (i > last+1) {
  1001. .14:
  1002. mov bx,4[bp]
  1003. ! Debug: lt unsigned int = [bx+2] to unsigned int i = [S+$12-8] (used reg = )
  1004. mov ax,-6[bp]
  1005. cmp ax,2[bx]
  1006. jb .15
  1007. .1A:
  1008. .13:
  1009. ! Debug: add int = const 1 to unsigned int last = [S+$12-$A] (used reg = )
  1010. mov ax,-8[bp]
  1011. ! Debug: gt unsigned int = ax+1 to unsigned int i = [S+$12-8] (used reg = )
  1012. inc ax
  1013. cmp ax,-6[bp]
  1014. jae .1B
  1015. .1C:
  1016. ! 282 ++count;
  1017. ! Debug: preinc unsigned int count = [S+$12-$C] (used reg = )
  1018. mov ax,-$A[bp]
  1019. inc ax
  1020. mov -$A[bp],ax
  1021. !BCC_EOS
  1022. ! 283 }
  1023. ! 284
  1024. ! 285 result = create_length_string_array(count);
  1025. .1B:
  1026. ! Debug: list unsigned int count = [S+$12-$C] (used reg = )
  1027. push -$A[bp]
  1028. ! Debug: func () * struct String_Array = create_length_string_array+0 (used reg = )
  1029. call _create_length_string_array
  1030. inc sp
  1031. inc sp
  1032. ! Debug: eq * struct String_Array = ax+0 to * struct String_Array result = [S+$12-$10] (used reg = )
  1033. mov -$E[bp],ax
  1034. !BCC_EOS
  1035. ! 286
  1036. ! 287 if (keep_delim)
  1037. mov ax,8[bp]
  1038. test ax,ax
  1039. je .1D
  1040. .1E:
  1041. ! 288 {
  1042. ! 289 k = 0;
  1043. ! Debug: eq int = const 0 to int k = [S+$12-$12] (used reg = )
  1044. xor ax,ax
  1045. mov -$10[bp],ax
  1046. !BCC_EOS
  1047. ! 290 }
  1048. ! 291 else
  1049. ! 292 {
  1050. jmp .1F
  1051. .1D:
  1052. ! 293 k = 1;
  1053. ! Debug: eq int = const 1 to int k = [S+$12-$12] (used reg = )
  1054. mov ax,*1
  1055. mov -$10[bp],ax
  1056. !BCC_EOS
  1057. ! 294 }
  1058. ! 295
  1059. ! 296 i = 0;
  1060. .1F:
  1061. ! Debug: eq int = const 0 to unsigned int i = [S+$12-8] (used reg = )
  1062. xor ax,ax
  1063. mov -6[bp],ax
  1064. !BCC_EOS
  1065. ! 297 last = 0;
  1066. ! Debug: eq int = const 0 to unsigned int last = [S+$12-$A] (used reg = )
  1067. xor ax,ax
  1068. mov -8[bp],ax
  1069. !BCC_EOS
  1070. ! 298 while(i < string->length) {
  1071. jmp .21
  1072. .22:
  1073. ! 299 if (string->chars[i] == delim) {
  1074. mov bx,4[bp]
  1075. ! Debug: ptradd unsigned int i = [S+$12-8] to * char = [bx+4] (used reg = )
  1076. mov ax,-6[bp]
  1077. add ax,4[bx]
  1078. mov bx,ax
  1079. ! Debug: logeq char delim = [S+$12+4] to char = [bx+0] (used reg = )
  1080. mov al,[bx]
  1081. cmp al,6[bp]
  1082. jne .23
  1083. .24:
  1084. ! 300 if (i > last+1) {
  1085. ! Debug: add int = const 1 to unsigned int last = [S+$12-$A] (used reg = )
  1086. mov ax,-8[bp]
  1087. ! Debug: gt unsigned int = ax+1 to unsigned int i = [S+$12-8] (used reg = )
  1088. inc ax
  1089. cmp ax,-6[bp]
  1090. jae .25
  1091. .26:
  1092. ! 301 result->strings[insert_index++] = create_length_string(i-(last+k), string->chars+(last+k));
  1093. ! Debug: add int k = [S+$12-$12] to unsigned int last = [S+$12-$A] (used reg = )
  1094. mov ax,-8[bp]
  1095. add ax,-$10[bp]
  1096. mov bx,4[bp]
  1097. ! Debug: ptradd unsigned int = ax+0 to * char = [bx+4] (used reg = )
  1098. add ax,4[bx]
  1099. ! Debug: list * char = ax+0 (used reg = )
  1100. push ax
  1101. ! Debug: add int k = [S+$14-$12] to unsigned int last = [S+$14-$A] (used reg = )
  1102. mov ax,-8[bp]
  1103. add ax,-$10[bp]
  1104. ! Debug: sub unsigned int = ax+0 to unsigned int i = [S+$14-8] (used reg = )
  1105. push ax
  1106. mov ax,-6[bp]
  1107. sub ax,-$14[bp]
  1108. inc sp
  1109. inc sp
  1110. ! Debug: list unsigned int = ax+0 (used reg = )
  1111. push ax
  1112. ! Debug: func () * struct Length_String = create_length_string+0 (used reg = )
  1113. call _create_length_string
  1114. add sp,*4
  1115. push ax
  1116. ! Debug: postinc unsigned int insert_index = [S+$14-$E] (used reg = )
  1117. mov ax,-$C[bp]
  1118. inc ax
  1119. mov -$C[bp],ax
  1120. mov bx,-$E[bp]
  1121. ! Debug: ptradd unsigned int = ax-1 to * * struct Length_String = [bx+2] (used reg = )
  1122. dec ax
  1123. shl ax,*1
  1124. add ax,2[bx]
  1125. mov bx,ax
  1126. ! Debug: eq * struct Length_String (temp) = [S+$14-$14] to * struct Length_String = [bx+0] (used reg = )
  1127. mov si,-$12[bp]
  1128. mov [bx],si
  1129. inc sp
  1130. inc sp
  1131. !BCC_EOS
  1132. ! 302 }
  1133. ! 303 last = i;
  1134. .25:
  1135. ! Debug: eq unsigned int i = [S+$12-8] to unsigned int last = [S+$12-$A] (used reg = )
  1136. mov ax,-6[bp]
  1137. mov -8[bp],ax
  1138. !BCC_EOS
  1139. ! 304 }
  1140. ! 305 ++i;
  1141. .23:
  1142. ! Debug: preinc unsigned int i = [S+$12-8] (used reg = )
  1143. mov ax,-6[bp]
  1144. inc ax
  1145. mov -6[bp],ax
  1146. !BCC_EOS
  1147. ! 306 }
  1148. ! 307 if (i > last+1) {
  1149. .21:
  1150. mov bx,4[bp]
  1151. ! Debug: lt unsigned int = [bx+2] to unsigned int i = [S+$12-8] (used reg = )
  1152. mov ax,-6[bp]
  1153. cmp ax,2[bx]
  1154. jb .22
  1155. .27:
  1156. .20:
  1157. ! Debug: add int = const 1 to unsigned int last = [S+$12-$A] (used reg = )
  1158. mov ax,-8[bp]
  1159. ! Debug: gt unsigned int = ax+1 to unsigned int i = [S+$12-8] (used reg = )
  1160. inc ax
  1161. cmp ax,-6[bp]
  1162. jae .28
  1163. .29:
  1164. ! 308 result->strings[insert_index++] = create_length_string(i-(last+k), ((string->chars)+(last+k)));
  1165. ! Debug: add int k = [S+$12-$12] to unsigned int last = [S+$12-$A] (used reg = )
  1166. mov ax,-8[bp]
  1167. add ax,-$10[bp]
  1168. mov bx,4[bp]
  1169. ! Debug: ptradd unsigned int = ax+0 to * char = [bx+4] (used reg = )
  1170. add ax,4[bx]
  1171. ! Debug: list * char = ax+0 (used reg = )
  1172. push ax
  1173. ! Debug: add int k = [S+$14-$12] to unsigned int last = [S+$14-$A] (used reg = )
  1174. mov ax,-8[bp]
  1175. add ax,-$10[bp]
  1176. ! Debug: sub unsigned int = ax+0 to unsigned int i = [S+$14-8] (used reg = )
  1177. push ax
  1178. mov ax,-6[bp]
  1179. sub ax,-$14[bp]
  1180. inc sp
  1181. inc sp
  1182. ! Debug: list unsigned int = ax+0 (used reg = )
  1183. push ax
  1184. ! Debug: func () * struct Length_String = create_length_string+0 (used reg = )
  1185. call _create_length_string
  1186. add sp,*4
  1187. push ax
  1188. ! Debug: postinc unsigned int insert_index = [S+$14-$E] (used reg = )
  1189. mov ax,-$C[bp]
  1190. inc ax
  1191. mov -$C[bp],ax
  1192. mov bx,-$E[bp]
  1193. ! Debug: ptradd unsigned int = ax-1 to * * struct Length_String = [bx+2] (used reg = )
  1194. dec ax
  1195. shl ax,*1
  1196. add ax,2[bx]
  1197. mov bx,ax
  1198. ! Debug: eq * struct Length_String (temp) = [S+$14-$14] to * struct Length_String = [bx+0] (used reg = )
  1199. mov si,-$12[bp]
  1200. mov [bx],si
  1201. inc sp
  1202. inc sp
  1203. !BCC_EOS
  1204. ! 309 }
  1205. ! 310
  1206. ! 311 return result;
  1207. .28:
  1208. mov ax,-$E[bp]
  1209. add sp,*$C
  1210. pop si
  1211. pop di
  1212. pop bp
  1213. ret
  1214. !BCC_EOS
  1215. ! 312
  1216. ! 313 }
  1217. ! 314
  1218. ! 315 String_Array *create_length_string_array(array_size)
  1219. ! Register BX SI used in function length_string_split
  1220. ! 316 int array_size;
  1221. export _create_length_string_array
  1222. _create_length_string_array:
  1223. !BCC_EOS
  1224. ! 317 {
  1225. ! 318 String_Array *result = malloc(sizeof(String_Array));
  1226. push bp
  1227. mov bp,sp
  1228. push di
  1229. push si
  1230. dec sp
  1231. dec sp
  1232. ! Debug: list int = const 4 (used reg = )
  1233. mov ax,*4
  1234. push ax
  1235. ! Debug: func () * void = malloc+0 (used reg = )
  1236. call _malloc
  1237. inc sp
  1238. inc sp
  1239. ! Debug: eq * void = ax+0 to * struct String_Array result = [S+8-8] (used reg = )
  1240. mov -6[bp],ax
  1241. !BCC_EOS
  1242. ! 319 result->length = array_size;
  1243. mov bx,-6[bp]
  1244. ! Debug: eq int array_size = [S+8+2] to unsigned int = [bx+0] (used reg = )
  1245. mov ax,4[bp]
  1246. mov [bx],ax
  1247. !BCC_EOS
  1248. ! 320 result->strings = malloc(array_size * sizeof(Length_String));
  1249. ! Debug: mul int = const 6 to int array_size = [S+8+2] (used reg = )
  1250. mov ax,4[bp]
  1251. mov dx,ax
  1252. shl ax,*1
  1253. add ax,dx
  1254. shl ax,*1
  1255. ! Debug: list int = ax+0 (used reg = )
  1256. push ax
  1257. ! Debug: func () * void = malloc+0 (used reg = )
  1258. call _malloc
  1259. inc sp
  1260. inc sp
  1261. mov bx,-6[bp]
  1262. ! Debug: eq * void = ax+0 to * * struct Length_String = [bx+2] (used reg = )
  1263. mov 2[bx],ax
  1264. !BCC_EOS
  1265. ! 321 return result;
  1266. mov ax,-6[bp]
  1267. inc sp
  1268. inc sp
  1269. pop si
  1270. pop di
  1271. pop bp
  1272. ret
  1273. !BCC_EOS
  1274. ! 322 }
  1275. ! 323
  1276. ! 324
  1277. ! 325 Length_String *create_length_string(length, chars)
  1278. ! Register BX used in function create_length_string_array
  1279. ! 326 unsigned int length;
  1280. export _create_length_string
  1281. _create_length_string:
  1282. !BCC_EOS
  1283. ! 327 char *chars;
  1284. !BCC_EOS
  1285. ! 328 {
  1286. ! 329
  1287. ! 330 Length_String *legth_string = malloc(sizeof(Length_String));
  1288. push bp
  1289. mov bp,sp
  1290. push di
  1291. push si
  1292. dec sp
  1293. dec sp
  1294. ! Debug: list int = const 6 (used reg = )
  1295. mov ax,*6
  1296. push ax
  1297. ! Debug: func () * void = malloc+0 (used reg = )
  1298. call _malloc
  1299. inc sp
  1300. inc sp
  1301. ! Debug: eq * void = ax+0 to * struct Length_String legth_string = [S+8-8] (used reg = )
  1302. mov -6[bp],ax
  1303. !BCC_EOS
  1304. ! 331 char *copy = malloc(length + 1);
  1305. dec sp
  1306. dec sp
  1307. ! Debug: add int = const 1 to unsigned int length = [S+$A+2] (used reg = )
  1308. mov ax,4[bp]
  1309. ! Debug: list unsigned int = ax+1 (used reg = )
  1310. inc ax
  1311. push ax
  1312. ! Debug: func () * void = malloc+0 (used reg = )
  1313. call _malloc
  1314. inc sp
  1315. inc sp
  1316. ! Debug: eq * void = ax+0 to * char copy = [S+$A-$A] (used reg = )
  1317. mov -8[bp],ax
  1318. !BCC_EOS
  1319. ! 332 memcpy(copy, 0x7e0, chars, 0x7e0, length);
  1320. ! Debug: list unsigned int length = [S+$A+2] (used reg = )
  1321. push 4[bp]
  1322. ! Debug: list int = const $7E0 (used reg = )
  1323. mov ax,#$7E0
  1324. push ax
  1325. ! Debug: list * char chars = [S+$E+4] (used reg = )
  1326. push 6[bp]
  1327. ! Debug: list int = const $7E0 (used reg = )
  1328. mov ax,#$7E0
  1329. push ax
  1330. ! Debug: list * char copy = [S+$12-$A] (used reg = )
  1331. push -8[bp]
  1332. ! Debug: func () void = memcpy+0 (used reg = )
  1333. call _memcpy
  1334. add sp,*$A
  1335. !BCC_EOS
  1336. ! 333 copy[length] = '';
  1337. ! Debug: ptradd unsigned int length = [S+$A+2] to * char copy = [S+$A-$A] (used reg = )
  1338. mov ax,4[bp]
  1339. add ax,-8[bp]
  1340. mov bx,ax
  1341. ! Debug: eq int = const 0 to char = [bx+0] (used reg = )
  1342. xor al,al
  1343. mov [bx],al
  1344. !BCC_EOS
  1345. ! 334
  1346. ! 335 legth_
  1347. ! 335 string->dynamic = 1;
  1348. mov bx,-6[bp]
  1349. ! Debug: eq int = const 1 to short = [bx+0] (used reg = )
  1350. mov ax,*1
  1351. mov [bx],ax
  1352. !BCC_EOS
  1353. ! 336 legth_string->length = length;
  1354. mov bx,-6[bp]
  1355. ! Debug: eq unsigned int length = [S+$A+2] to unsigned int = [bx+2] (used reg = )
  1356. mov ax,4[bp]
  1357. mov 2[bx],ax
  1358. !BCC_EOS
  1359. ! 337 legth_string->chars = copy;
  1360. mov bx,-6[bp]
  1361. ! Debug: eq * char copy = [S+$A-$A] to * char = [bx+4] (used reg = )
  1362. mov si,-8[bp]
  1363. mov 4[bx],si
  1364. !BCC_EOS
  1365. ! 338
  1366. ! 339 return legth_string;
  1367. mov ax,-6[bp]
  1368. add sp,*4
  1369. pop si
  1370. pop di
  1371. pop bp
  1372. ret
  1373. !BCC_EOS
  1374. ! 340 # 21 "main.h"
  1375. ! 21 }
  1376. ! 22 # 1 "driver/disk.h"
  1377. ! 1 int data_from_disk(index, number_sectors, data_buffer, data_buffer_segment);
  1378. ! Register BX SI used in function create_length_string
  1379. !BCC_EOS
  1380. ! 2 int disk_service_read_data_from_disk(index, number_sectors, data_buffer, data_buffer_segment);
  1381. !BCC_EOS
  1382. ! 3
  1383. ! 4 int disk_service_read_data_from_disk(index, number_sectors, data_buffer, data_buffer_segment)
  1384. ! 5 long index;
  1385. export _disk_service_read_data_from_disk
  1386. _disk_service_read_data_from_disk:
  1387. !BCC_EOS
  1388. ! 6 long number_sectors;
  1389. !BCC_EOS
  1390. ! 7 void* data_buffer;
  1391. !BCC_EOS
  1392. ! 8 unsigned int data_buffer_segment;
  1393. !BCC_EOS
  1394. ! 9 {
  1395. ! 10
  1396. ! 11 #asm
  1397. !BCC_ASM
  1398. _disk_service_read_data_from_disk.data_buffer set $A
  1399. _disk_service_read_data_from_disk.number_sectors set 6
  1400. _disk_service_read_data_from_disk.data_buffer_segment set $C
  1401. _disk_service_read_data_from_disk.index set 2
  1402. ! 12 16
  1403. push bp
  1404. mov bp,sp
  1405. pusha
  1406. lsfs_load_data:
  1407. mov ax, 4[bp];
  1408. mov WORD [DAPACK.lba_addr_dw_low], ax
  1409. mov bx, 8[bp];
  1410. mov WORD [DAPACK.blkcnt], bx
  1411. mov cx, 14[bp];
  1412. mov WORD [DAPACK.db_addr_segment], cx
  1413. mov dx, 12[bp]; ;
  1414. mov WORD [DAPACK.db_addr_offset], dx
  1415. mov si, #DAPACK ; address of
  1416. mov ah, #0x42 ; READ
  1417. mov dl, [global_disk_identifier]
  1418. int #0x13
  1419. popa
  1420. pop bp
  1421. ret
  1422. DAPACK:
  1423. DAPACK.dap_Size: db 0x10
  1424. DAPACK.rev_byte: db 0x0
  1425. DAPACK.blkcnt: dw 0x0
  1426. DAPACK.db_addr_offset: dw 0x0
  1427. DAPACK.db_addr_segment: dw 0x0
  1428. DAPACK.lba_addr_dw_low: dd 0x0
  1429. DAPACK.lba_addr_dw_high: dd 0x0
  1430. global_disk_identifier: db 0x80
  1431. ! 49 endasm
  1432. !BCC_ENDASM
  1433. ! 50 }
  1434. ret
  1435. ! 51 # 24 "main.h"
  1436. ! 24 void dump_ax(input);
  1437. !BCC_EOS
  1438. ! 25 void print_stack(argument);
  1439. !BCC_EOS
  1440. ! 26 void print_newline();
  1441. !BCC_EOS
  1442. ! 27
  1443. ! 28 typedef struct struct_partition_control partition_control;
  1444. !BCC_EOS
  1445. ! 29 typedef struct File_System_Control_Information FSCI;
  1446. !BCC_EOS
  1447. ! 30 typedef struct meta_information_format mif;
  1448. !BCC_EOS
  1449. ! 31 typedef struct tag_record tag_record;
  1450. !BCC_EOS
  1451. ! 32 typedef struct Parameter_Struct Parameter_Struct;
  1452. !BCC_EOS
  1453. ! 33
  1454. ! 34
  1455. ! 35 typedef enum Service_Action
  1456. ! 36 {
  1457. ! 37 SERIVCE_LOAD_DISK = 1,
  1458. ! 38 SERVICE_FIND_ENTRY = 2,
  1459. ! 39 SERIVCE_READ_DATA = 3,
  1460. ! 40 SERIVCE_WRITE_DATA = 4,
  1461. ! 41 SERIVCE_WRITE_FS_INFO = 10,
  1462. ! 42
  1463. ! 43 } Service_Action;
  1464. !BCC_EOS
  1465. ! 44
  1466. ! 45 struct File_System_Control_Information
  1467. ! 46 {
  1468. ! 47 char filesystem_information[256];
  1469. !BCC_EOS
  1470. ! 48 long master_table_index[2];
  1471. !BCC_EOS
  1472. ! 49 long this_partition_offset_on_disk[2];
  1473. !BCC_EOS
  1474. ! 50 long next_free_sector[2];
  1475. !BCC_EOS
  1476. ! 51
  1477. ! 51 long next_uniqe_id[2];
  1478. !BCC_EOS
  1479. ! 52 long next_sector_reuse_pointer[2];
  1480. !BCC_EOS
  1481. ! 53 long last_sector_index_on_partition[2];
  1482. !BCC_EOS
  1483. ! 54 long maximum_sectors_on_disk[2];
  1484. !BCC_EOS
  1485. ! 55 long sector_size_on_disk[2];
  1486. !BCC_EOS
  1487. ! 56 long not_used[48];
  1488. !BCC_EOS
  1489. ! 57
  1490. ! 58 };
  1491. !BCC_EOS
  1492. ! 59
  1493. ! 60
  1494. ! 61 struct Parameter_Struct
  1495. ! 62 {
  1496. ! 63 char* path;
  1497. !BCC_EOS
  1498. ! 64 char* new_path;
  1499. !BCC_EOS
  1500. ! 65 unsigned int buffer_segment;
  1501. !BCC_EOS
  1502. ! 66 unsigned int buffer_address;
  1503. !BCC_EOS
  1504. ! 67 unsigned int buffer_size;
  1505. !BCC_EOS
  1506. ! 68 unsigned int data_length;
  1507. !BCC_EOS
  1508. ! 69 unsigned int byte_offset_into_file;
  1509. !BCC_EOS
  1510. ! 70 short entry_kind;
  1511. !BCC_EOS
  1512. ! 71 };
  1513. !BCC_EOS
  1514. ! 72 # 6 "implementation/lsfs.h"
  1515. ! 6 typedef struct lsfs_file lsfs_file;
  1516. !BCC_EOS
  1517. ! 7 typedef struct Directory_Table Directory_Table;
  1518. !BCC_EOS
  1519. ! 8 typedef struct Table_Entry Table_Entry;
  1520. !BCC_EOS
  1521. ! 9
  1522. ! 10 int lsfs_disk_getattr(find_file, path, fsci);
  1523. !BCC_EOS
  1524. ! 11 int lsfs_disk_read_data_from_file(file, buffer_size, data, offset_to_next_entry);
  1525. !BCC_EOS
  1526. ! 12 Directory_Table* lsfs_find_directory(path, drop_filename, fsci);
  1527. !BCC_EOS
  1528. ! 13
  1529. ! 14 typedef enum Table_Entry_Kind
  1530. ! 15 {
  1531. ! 16
  1532. ! 17 ENTRY_EMPTY = 0,
  1533. ! 18 ENTRY_FILE = 1,
  1534. ! 19 ENTRY_DIRECTORY = 2,
  1535. ! 20 } Table_Entry_Kind;
  1536. !BCC_EOS
  1537. ! 21
  1538. ! 22 struct Table_Entry
  1539. ! 23 {
  1540. ! 24 char filename[256];
  1541. !BCC_EOS
  1542. ! 25 unsigned long file_id[2];
  1543. !BCC_EOS
  1544. ! 26 unsigned long file_size[2];
  1545. !BCC_EOS
  1546. ! 27 void* ext_file_data_low;
  1547. !BCC_EOS
  1548. ! 28 void* ext_file_data_high;
  1549. !BCC_EOS
  1550. ! 29 long number_sector_s;
  1551. !BCC_EOS
  1552. ! 30 short entry_kind;
  1553. !BCC_EOS
  1554. ! 31 short extra_control_bits1;
  1555. !BCC_EOS
  1556. ! 32 short extra_control_bits2;
  1557. !BCC_EOS
  1558. ! 33 short extra_control_bits3;
  1559. !BCC_EOS
  1560. ! 34 long table_entry_sector_index[2];
  1561. !BCC_EOS
  1562. ! 35 long data_pointer[27 * 2];
  1563. !BCC_EOS
  1564. ! 36 };
  1565. !BCC_EOS
  1566. ! 37
  1567. ! 38 struct lsfs_file {
  1568. ! 39 unsigned long file_id[2];
  1569. !BCC_EOS
  1570. ! 40 long table_entry_pointer[2];
  1571. !BCC_EOS
  1572. ! 41 Table_Entry_Kind entry_kind;
  1573. !BCC_EOS
  1574. ! 42 char* filename;
  1575. !BCC_EOS
  1576. ! 43 long owner_id;
  1577. !BCC_EOS
  1578. ! 44 unsigned long size[2];
  1579. !BCC_EOS
  1580. ! 45 long creation_date[2];
  1581. !BCC_EOS
  1582. ! 46 long access_time[2];
  1583. !BCC_EOS
  1584. ! 47 long modification_time[2];
  1585. !BCC_EOS
  1586. ! 48 long number_sector;
  1587. !BCC_EOS
  1588. ! 49 long table_entry_sector_index[2];
  1589. !BCC_EOS
  1590. ! 50 long data_pointer[27 * 2];
  1591. !BCC_EOS
  1592. ! 51 };
  1593. !BCC_EOS
  1594. ! 52
  1595. ! 53 struct Directory_Table
  1596. ! 54 {
  1597. ! 55 Table_Entry entries[8 ];
  1598. !BCC_EOS
  1599. ! 56
  1600. ! 57 };
  1601. !BCC_EOS
  1602. ! 58 # 75
  1603. ! 75 int lsfs_disk_getattr(find_file, path, fsci)
  1604. ! 76 lsfs_file* find_file;
  1605. export _lsfs_disk_getattr
  1606. _lsfs_disk_getattr:
  1607. !BCC_EOS
  1608. ! 77 char *path;
  1609. !BCC_EOS
  1610. ! 78 FSCI *fsci;
  1611. !BCC_EOS
  1612. ! 79 {
  1613. ! 80 int i;
  1614. !BCC_EOS
  1615. ! 81 String_Array *split_path = string_split_c(path, '/', 0 );
  1616. push bp
  1617. mov bp,sp
  1618. push di
  1619. push si
  1620. add sp,*-4
  1621. ! Debug: list int = const 0 (used reg = )
  1622. xor ax,ax
  1623. push ax
  1624. ! Debug: list int = const $2F (used reg = )
  1625. mov ax,*$2F
  1626. push ax
  1627. ! Debug: list * char path = [S+$E+4] (used reg = )
  1628. push 6[bp]
  1629. ! Debug: func () * struct String_Array = string_split_c+0 (used reg = )
  1630. call _string_split_c
  1631. add sp,*6
  1632. ! Debug: eq * struct String_Array = ax+0 to * struct String_Array split_path = [S+$A-$A] (used reg = )
  1633. mov -8[bp],ax
  1634. !BCC_EOS
  1635. ! 82 Length_String *filename = split_path->strings[split_path->length-1];
  1636. dec sp
  1637. dec sp
  1638. mov bx,-8[bp]
  1639. ! Debug: sub int = const 1 to unsigned int = [bx+0] (used reg = )
  1640. mov bx,[bx]
  1641. mov si,-8[bp]
  1642. ! Debug: ptradd unsigned int = bx-1 to * * struct Length_String = [si+2] (used reg = )
  1643. mov ax,bx
  1644. dec ax
  1645. shl ax,*1
  1646. add ax,2[si]
  1647. mov bx,ax
  1648. ! Debug: eq * struct Length_String = [bx+0] to * struct Length_String filename = [S+$C-$C] (used reg = )
  1649. mov bx,[bx]
  1650. mov -$A[bp],bx
  1651. !BCC_EOS
  1652. ! 83
  1653. ! 84
  1654. ! 85 Directory
  1655. ! 85 _Table *dir_table = lsfs_find_directory(path, 1 , fsci);
  1656. dec sp
  1657. dec sp
  1658. ! Debug: list * struct File_System_Control_Information fsci = [S+$E+6] (used reg = )
  1659. push 8[bp]
  1660. ! Debug: list int = const 1 (used reg = )
  1661. mov ax,*1
  1662. push ax
  1663. ! Debug: list * char path = [S+$12+4] (used reg = )
  1664. push 6[bp]
  1665. ! Debug: func () * struct Directory_Table = lsfs_find_directory+0 (used reg = )
  1666. call _lsfs_find_directory
  1667. add sp,*6
  1668. ! Debug: eq * struct Directory_Table = ax+0 to * struct Directory_Table dir_table = [S+$E-$E] (used reg = )
  1669. mov -$C[bp],ax
  1670. !BCC_EOS
  1671. ! 86
  1672. ! 87 for (i = 0; i < 8 ; i++)
  1673. ! Debug: eq int = const 0 to int i = [S+$E-8] (used reg = )
  1674. xor ax,ax
  1675. mov -6[bp],ax
  1676. !BCC_EOS
  1677. !BCC_EOS
  1678. ! 88 {
  1679. br .2C
  1680. .2D:
  1681. ! 89 int j;
  1682. !BCC_EOS
  1683. ! 90 # 99
  1684. ! 99
  1685. ! 100 if(strcmp( filename->chars, dir_table->entries[i].filename ) == 0) {
  1686. dec sp
  1687. dec sp
  1688. ! Debug: ptradd int i = [S+$10-8] to [8] struct Table_Entry dir_table = [S+$10-$E] (used reg = )
  1689. mov ax,-6[bp]
  1690. mov cx,#$200
  1691. imul cx
  1692. add ax,-$C[bp]
  1693. mov bx,ax
  1694. ! Debug: cast * char = const 0 to [$100] char = bx+0 (used reg = )
  1695. ! Debug: list * char = bx+0 (used reg = )
  1696. push bx
  1697. mov bx,-$A[bp]
  1698. ! Debug: list * char = [bx+4] (used reg = )
  1699. push 4[bx]
  1700. ! Debug: func () int = strcmp+0 (used reg = )
  1701. call _strcmp
  1702. add sp,*4
  1703. ! Debug: logeq int = const 0 to int = ax+0 (used reg = )
  1704. test ax,ax
  1705. bne .2E
  1706. .2F:
  1707. ! 101 find_file->file_id[0] = dir_table->entries[i].file_id[0];
  1708. ! Debug: ptradd int i = [S+$10-8] to [8] struct Table_Entry dir_table = [S+$10-$E] (used reg = )
  1709. mov ax,-6[bp]
  1710. mov cx,#$200
  1711. imul cx
  1712. add ax,-$C[bp]
  1713. mov bx,ax
  1714. ! Debug: ptradd int = const 0 to [2] unsigned long = bx+$100 (used reg = )
  1715. ! Debug: ptradd int = const 0 to [2] unsigned long find_file = [S+$10+2] (used reg = bx)
  1716. mov si,4[bp]
  1717. ! Debug: eq unsigned long = [bx+$100] to unsigned long = [si+0] (used reg = )
  1718. mov ax,$100[bx]
  1719. mov bx,$102[bx]
  1720. mov [si],ax
  1721. mov 2[si],bx
  1722. !BCC_EOS
  1723. ! 102 find_file->entry_kind = dir_table->entries[i].entry_kind;
  1724. ! Debug: ptradd int i = [S+$10-8] to [8] struct Table_Entry dir_table = [S+$10-$E] (used reg = )
  1725. mov ax,-6[bp]
  1726. mov cx,#$200
  1727. imul cx
  1728. add ax,-$C[bp]
  1729. mov bx,ax
  1730. mov si,4[bp]
  1731. ! Debug: eq short = [bx+$118] to int = [si+$10] (used reg = )
  1732. mov bx,$118[bx]
  1733. mov $10[si],bx
  1734. !BCC_EOS
  1735. ! 103 find_file->table_entry_pointer[0] = i;
  1736. mov bx,4[bp]
  1737. ! Debug: ptradd int = const 0 to [2] long = bx+8 (used reg = )
  1738. ! Debug: eq int i = [S+$10-8] to long = [bx+8] (used reg = )
  1739. mov ax,-6[bp]
  1740. cwd
  1741. mov si,dx
  1742. mov 8[bx],ax
  1743. mov $A[bx],si
  1744. !BCC_EOS
  1745. ! 104 find_file->filename = dir_table->entries[i].filename;
  1746. ! Debug: ptradd int i = [S+$10-8] to [8] struct Table_Entry dir_table = [S+$10-$E] (used reg = )
  1747. mov ax,-6[bp]
  1748. mov cx,#$200
  1749. imul cx
  1750. add ax,-$C[bp]
  1751. mov bx,ax
  1752. mov si,4[bp]
  1753. ! Debug: eq [$100] char = bx+0 to * char = [si+$12] (used reg = )
  1754. mov $12[si],bx
  1755. !BCC_EOS
  1756. ! 105 find_file->table_entry_sector_index[0] = dir_table->entries[i].table_entry_sector_index;
  1757. ! Debug: ptradd int i = [S+$10-8] to [8] struct Table_Entry dir_table = [S+$10-$E] (used reg = )
  1758. mov ax,-6[bp]
  1759. mov cx,#$200
  1760. imul cx
  1761. add ax,-$C[bp]
  1762. mov bx,ax
  1763. mov si,4[bp]
  1764. ! Debug: ptradd int = const 0 to [2] long = si+$3C (used reg = bx)
  1765. ! Debug: eq [2] long = bx+$120 to long = [si+$3C] (used reg = )
  1766. mov ax,bx
  1767. add ax,#$120
  1768. xor bx,bx
  1769. mov $3C[si],ax
  1770. mov $3E[si],bx
  1771. !BCC_EOS
  1772. ! 106 find_file->owner_id = 1;
  1773. mov bx,4[bp]
  1774. ! Debug: eq int = const 1 to long = [bx+$14] (used reg = )
  1775. mov ax,*1
  1776. xor si,si
  1777. mov $14[bx],ax
  1778. mov $16[bx],si
  1779. !BCC_EOS
  1780. ! 107 find_file->size[0] = dir_table->entries[i].file_size[0];
  1781. ! Debug: ptradd int i = [S+$10-8] to [8] struct Table_Entry dir_table = [S+$10-$E] (used reg = )
  1782. mov ax,-6[bp]
  1783. mov cx,#$200
  1784. imul cx
  1785. add ax,-$C[bp]
  1786. mov bx,ax
  1787. ! Debug: ptradd int = const 0 to [2] unsigned long = bx+$108 (used reg = )
  1788. mov si,4[bp]
  1789. ! Debug: ptradd int = const 0 to [2] unsigned long = si+$18 (used reg = bx)
  1790. ! Debug: eq unsigned long = [bx+$108] to unsigned long = [si+$18] (used reg = )
  1791. mov ax,$108[bx]
  1792. mov bx,$10A[bx]
  1793. mov $18[si],ax
  1794. mov $1A[si],bx
  1795. !BCC_EOS
  1796. ! 108 find_file->creation_date[0] = 0;
  1797. mov bx,4[bp]
  1798. ! Debug: ptradd int = const 0 to [2] long = bx+$20 (used reg = )
  1799. ! Debug: eq int = const 0 to long = [bx+$20] (used reg = )
  1800. xor ax,ax
  1801. xor si,si
  1802. mov $20[bx],ax
  1803. mov $22[bx],si
  1804. !BCC_EOS
  1805. ! 109 find_file->access_time[0] = 0;
  1806. mov bx,4[bp]
  1807. ! Debug: ptradd int = const 0 to [2] long = bx+$28 (used reg = )
  1808. ! Debug: eq int = const 0 to long = [bx+$28] (used reg = )
  1809. xor ax,ax
  1810. xor si,si
  1811. mov $28[bx],ax
  1812. mov $2A[bx],si
  1813. !BCC_EOS
  1814. ! 110 find_file->modification_time[0] = 0;
  1815. mov bx,4[bp]
  1816. ! Debug: ptradd int = const 0 to [2] long = bx+$30 (used reg = )
  1817. ! Debug: eq int = const 0 to long = [bx+$30] (used reg = )
  1818. xor ax,ax
  1819. xor si,si
  1820. mov $30[bx],ax
  1821. mov $32[bx],si
  1822. !BCC_EOS
  1823. ! 111
  1824. ! 112 for (j = 0; j < 27 ; j = j + 2)
  1825. ! Debug: eq int = const 0 to int j = [S+$10-$10] (used reg = )
  1826. xor ax,ax
  1827. mov -$E[bp],ax
  1828. !BCC_EOS
  1829. !BCC_EOS
  1830. ! 113 {
  1831. jmp .33
  1832. .34:
  1833. ! 114 find_file->data_pointer[j] = dir_table->entries[i].data_pointer[j];
  1834. ! Debug: ptradd int i = [S+$10-8] to [8] struct Table_Entry dir_table = [S+$10-$E] (used reg = )
  1835. mov ax,-6[bp]
  1836. mov cx,#$200
  1837. imul cx
  1838. add ax,-$C[bp]
  1839. mov bx,ax
  1840. ! Debug: ptradd int j = [S+$10-$10] to [$36] long = bx+$128 (used reg = )
  1841. mov ax,-$E[bp]
  1842. shl ax,*1
  1843. shl ax,*1
  1844. add bx,ax
  1845. mov si,4[bp]
  1846. ! Debug: ptradd int j = [S+$10-$10] to [$36] long = si+$44 (used reg = bx)
  1847. mov ax,-$E[bp]
  1848. shl ax,*1
  1849. shl ax,*1
  1850. add si,ax
  1851. ! Debug: eq long = [bx+$128] to long = [si+$44] (used reg = )
  1852. mov ax,$128[bx]
  1853. mov bx,$12A[bx]
  1854. mov $44[si],ax
  1855. mov $46[si],bx
  1856. !BCC_EOS
  1857. ! 115 }
  1858. ! 116
  1859. ! 117
  1860. ! 118 find_file->number_sector = 1;
  1861. .32:
  1862. ! Debug: add int = const 2 to int j = [S+$10-$10] (used reg = )
  1863. mov ax,-$E[bp]
  1864. ! Debug: eq int = ax+2 to int j = [S+$10-$10] (used reg = )
  1865. inc ax
  1866. inc ax
  1867. mov -$E[bp],ax
  1868. .33:
  1869. ! Debug: lt int = const $1B to int j = [S+$10-$10] (used reg = )
  1870. mov ax,-$E[bp]
  1871. cmp ax,*$1B
  1872. jl .34
  1873. .35:
  1874. .31:
  1875. mov bx,4[bp]
  1876. ! Debug: eq int = const 1 to long = [bx+$38] (used reg = )
  1877. mov ax,*1
  1878. xor si,si
  1879. mov $38[bx],ax
  1880. mov $3A[bx],si
  1881. !BCC_EOS
  1882. ! 119 return 1;
  1883. mov ax,*1
  1884. add sp,*$A
  1885. pop si
  1886. pop di
  1887. pop bp
  1888. ret
  1889. !BCC_EOS
  1890. ! 120 }
  1891. ! 121 }
  1892. .2E:
  1893. inc sp
  1894. inc sp
  1895. ! 122 return 0;
  1896. .2B:
  1897. ! Debug: postinc int i = [S+$E-8] (used reg = )
  1898. mov ax,-6[bp]
  1899. inc ax
  1900. mov -6[bp],ax
  1901. .2C:
  1902. ! Debug: lt int = const 8 to int i = [S+$E-8] (used reg = )
  1903. mov ax,-6[bp]
  1904. cmp ax,*8
  1905. blt .2D
  1906. .36:
  1907. .2A:
  1908. xor ax,ax
  1909. add sp,*8
  1910. pop si
  1911. pop di
  1912. pop bp
  1913. ret
  1914. !BCC_EOS
  1915. ! 123 }
  1916. ! 124
  1917. ! 125 Directory_Table* lsfs_find_directory(path, drop_filename, fsci)
  1918. ! Register BX SI used in function lsfs_disk_getattr
  1919. ! 126 char *path;
  1920. export _lsfs_find_directory
  1921. _lsfs_find_directory:
  1922. !BCC_EOS
  1923. ! 127 short drop_filename;
  1924. !BCC_EOS
  1925. ! 128 FSCI *fsci;
  1926. !BCC_EOS
  1927. ! 129 {
  1928. ! 130 int number_of_traversal;
  1929. !BCC_EOS
  1930. ! 131 int i, j;
  1931. !BCC_EOS
  1932. ! 132 String_Array *split_path;
  1933. !BCC_EOS
  1934. ! 133 Directory_Table *dir_table = calloc(1, sizeof(Directory_Table));
  1935. push bp
  1936. mov bp,sp
  1937. push di
  1938. push si
  1939. add sp,*-$A
  1940. ! Debug: list int = const $1000 (used reg = )
  1941. mov ax,#$1000
  1942. push ax
  1943. ! Debug: list int = const 1 (used reg = )
  1944. mov ax,*1
  1945. push ax
  1946. ! Debug: func () * void = calloc+0 (used reg = )
  1947. call _calloc
  1948. add sp,*4
  1949. ! Debug: eq * void = ax+0 to * struct Directory_Table dir_table = [S+$10-$10] (used reg = )
  1950. mov -$E[bp],ax
  1951. !BCC_EOS
  1952. ! 134
  1953. ! 135 disk_service_read_data_from_disk(fsci->master_table_index[0], (long) 8 , dir_table, 0x7e0);
  1954. ! Debug: list int = const $7E0 (used reg = )
  1955. mov ax,#$7E0
  1956. push ax
  1957. ! Debug: list * struct Directory_Table dir_table = [S+$12-$10] (used reg = )
  1958. push -$E[bp]
  1959. ! Debug: list long = const 8 (used reg = )
  1960. mov ax,*8
  1961. xor bx,bx
  1962. push bx
  1963. push ax
  1964. mov bx,8[bp]
  1965. ! Debug: ptradd int = const 0 to [2] long = bx+$100 (used reg = )
  1966. ! Debug: list long = [bx+$100] (used reg = )
  1967. push $102[bx]
  1968. push $100[bx]
  1969. ! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
  1970. call _disk_service_read_data_from_disk
  1971. add sp,*$C
  1972. !BCC_EOS
  1973. ! 136 split_path = string_split_c(path, '/', 0 );
  1974. ! Debug: list int = const 0 (used reg = )
  1975. xor ax,ax
  1976. push ax
  1977. ! Debug: list int = const $2F (used reg = )
  1978. mov ax,*$2F
  1979. push ax
  1980. ! Debug: list * char path = [S+$14+2] (used reg = )
  1981. push 4[bp]
  1982. ! Debug: func () * struct String_Array = string_split_c+0 (used reg = )
  1983. call _string_split_c
  1984. add sp,*6
  1985. ! Debug: eq * struct String_Array = ax+0 to * struct String_Array split_path = [S+$10-$E] (used reg = )
  1986. mov -$C[bp],ax
  1987. !BCC_EOS
  1988. ! 137
  1989. ! 138 number_of_traversal = split_path->length;
  1990. mov bx,-$C[bp]
  1991. ! Debug: eq unsigned int = [bx+0] to int number_of_traversal = [S+$10-8] (used reg = )
  1992. mov bx,[bx]
  1993. mov -6[bp],bx
  1994. !BCC_EOS
  1995. ! 139
  1996. ! 140
  1997. ! 141 if (drop_filename)
  1998. mov ax,6[bp]
  1999. test ax,ax
  2000. je .37
  2001. .38:
  2002. ! 142 {
  2003. ! 143 number_of_traversal -= 1;
  2004. ! Debug: subab int = const 1 to int number_of_traversal = [S+$10-8] (used reg = )
  2005. mov ax,-6[bp]
  2006. dec ax
  2007. mov -6[bp],ax
  2008. !BCC_EOS
  2009. ! 144 }
  2010. ! 145
  2011. ! 146
  2012. ! 147 for (i = 0; i < number_of_traversal; ++i)
  2013. .37:
  2014. ! Debug: eq int = const 0 to int i = [S+$10-$A] (used reg = )
  2015. xor ax,ax
  2016. mov -8[bp],ax
  2017. !BCC_EOS
  2018. !BCC_EOS
  2019. ! 148 {
  2020. br .3B
  2021. .3C:
  2022. ! 149 for (j = 0; j < 8 ; ++j)
  2023. ! Debug: eq int = const 0 to int j = [S+$10-$C] (used reg = )
  2024. xor ax,ax
  2025. mov -$A[bp],ax
  2026. !BCC_EOS
  2027. !BCC_EOS
  2028. ! 150 {
  2029. jmp .3F
  2030. .40:
  2031. ! 151 # 158
  2032. ! 158
  2033. ! 159 if (strcmp(dir_table->entries[j].filename, split_path->strings[i]->chars) == 0)
  2034. mov bx,-$C[bp]
  2035. ! Debug: ptradd int i = [S+$10-$A] to * * struct Length_String = [bx+2] (used reg = )
  2036. mov ax,-8[bp]
  2037. shl ax,*1
  2038. add ax,2[bx]
  2039. mov bx,ax
  2040. mov bx,[bx]
  2041. ! Debug: list * char = [bx+4] (used reg = )
  2042. push 4[bx]
  2043. ! Debug: ptradd int j = [S+$12-$C] to [8] struct Table_Entry dir_table = [S+$12-$10] (used reg = )
  2044. mov ax,-$A[bp]
  2045. mov cx,#$200
  2046. imul cx
  2047. add ax,-$E[bp]
  2048. mov bx,ax
  2049. ! Debug: cast * char = const 0 to [$100] char = bx+0 (used reg = )
  2050. ! Debug: list * char = bx+0 (used reg = )
  2051. push bx
  2052. ! Debug: func () int = strcmp+0 (used reg = )
  2053. call _strcmp
  2054. add sp,*4
  2055. ! Debug: logeq int = const 0 to int = ax+0 (used reg = )
  2056. test ax,ax
  2057. jne .41
  2058. .42:
  2059. ! 160 {
  2060. ! 161 long index_sector = dir_table->entries[j].data_pointer[0];
  2061. add sp,*-4
  2062. ! Debug: ptradd int j = [S+$14-$C] to [8] struct Table_Entry dir_table = [S+$14-$10] (used reg = )
  2063. mov ax,-$A[bp]
  2064. mov cx,#$200
  2065. imul cx
  2066. add ax,-$E[bp]
  2067. mov bx,ax
  2068. ! Debug: ptradd int = const 0 to [$36] long = bx+$128 (used reg = )
  2069. ! Debug: eq long = [bx+$128] to long index_sector = [S+$14-$14] (used reg = )
  2070. mov ax,$128[bx]
  2071. mov bx,$12A[bx]
  2072. mov -$12[bp],ax
  2073. mov -$10[bp],bx
  2074. !BCC_EOS
  2075. ! 162
  2076. ! 163
  2077. ! 164 disk_service_read_data_from_disk(index_sector, (long) 8 , dir_table, 0x7e0);
  2078. ! Debug: list int = const $7E0 (used reg = )
  2079. mov ax,#$7E0
  2080. push ax
  2081. ! Debug: list * struct Directory_Table dir_table = [S+$16-$10] (used reg = )
  2082. push -$E[bp]
  2083. ! Debug: list long = const 8 (used reg = )
  2084. mov ax,*8
  2085. xor bx,bx
  2086. push bx
  2087. push ax
  2088. ! Debug: list long index_sector = [S+$1C-$14] (used reg = )
  2089. push -$10[bp]
  2090. push -$12[bp]
  2091. ! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
  2092. call _disk_service_read_data_from_disk
  2093. add sp,*$C
  2094. !BCC_EOS
  2095. ! 165 break;
  2096. add sp,*4
  2097. jmp .3D
  2098. !BCC_EOS
  2099. ! 166 }
  2100. add sp,*4
  2101. ! 167
  2102. ! 167 }
  2103. .41:
  2104. ! 168 }
  2105. .3E:
  2106. ! Debug: preinc int j = [S+$10-$C] (used reg = )
  2107. mov ax,-$A[bp]
  2108. inc ax
  2109. mov -$A[bp],ax
  2110. .3F:
  2111. ! Debug: lt int = const 8 to int j = [S+$10-$C] (used reg = )
  2112. mov ax,-$A[bp]
  2113. cmp ax,*8
  2114. jl .40
  2115. .43:
  2116. .3D:
  2117. ! 169 return dir_table;
  2118. .3A:
  2119. ! Debug: preinc int i = [S+$10-$A] (used reg = )
  2120. mov ax,-8[bp]
  2121. inc ax
  2122. mov -8[bp],ax
  2123. .3B:
  2124. ! Debug: lt int number_of_traversal = [S+$10-8] to int i = [S+$10-$A] (used reg = )
  2125. mov ax,-8[bp]
  2126. cmp ax,-6[bp]
  2127. blt .3C
  2128. .44:
  2129. .39:
  2130. mov ax,-$E[bp]
  2131. add sp,*$A
  2132. pop si
  2133. pop di
  2134. pop bp
  2135. ret
  2136. !BCC_EOS
  2137. ! 170 }
  2138. ! 171
  2139. ! 172 int lsfs_disk_read_data_from_file(file, buffer_size, data, offset_to_next_entry, data_segment)
  2140. ! Register BX used in function lsfs_find_directory
  2141. ! 173 lsfs_file *file;
  2142. export _lsfs_disk_read_data_from_file
  2143. _lsfs_disk_read_data_from_file:
  2144. !BCC_EOS
  2145. ! 174 unsigned int buffer_size;
  2146. !BCC_EOS
  2147. ! 175 char *data;
  2148. !BCC_EOS
  2149. ! 176 long offset_to_next_entry;
  2150. !BCC_EOS
  2151. ! 177 unsigned int data_segment;
  2152. !BCC_EOS
  2153. ! 178 {
  2154. ! 179 unsigned int integer_file_size = file->size[0];
  2155. push bp
  2156. mov bp,sp
  2157. push di
  2158. push si
  2159. dec sp
  2160. dec sp
  2161. mov bx,4[bp]
  2162. ! Debug: ptradd int = const 0 to [2] unsigned long = bx+$18 (used reg = )
  2163. ! Debug: eq unsigned long = [bx+$18] to unsigned int integer_file_size = [S+8-8] (used reg = )
  2164. mov bx,$18[bx]
  2165. mov -6[bp],bx
  2166. !BCC_EOS
  2167. ! 180 unsigned int integer_offset = offset_to_next_entry;
  2168. dec sp
  2169. dec sp
  2170. ! Debug: eq long offset_to_next_entry = [S+$A+8] to unsigned int integer_offset = [S+$A-$A] (used reg = )
  2171. mov ax,$A[bp]
  2172. mov -8[bp],ax
  2173. !BCC_EOS
  2174. ! 181 unsigned int integer_datapointer = 0;
  2175. dec sp
  2176. dec sp
  2177. ! Debug: eq int = const 0 to unsigned int integer_datapointer = [S+$C-$C] (used reg = )
  2178. xor ax,ax
  2179. mov -$A[bp],ax
  2180. !BCC_EOS
  2181. ! 182 unsigned int data_length = integer_file_size - integer_offset;
  2182. dec sp
  2183. dec sp
  2184. ! Debug: sub unsigned int integer_offset = [S+$E-$A] to unsigned int integer_file_size = [S+$E-8] (used reg = )
  2185. mov ax,-6[bp]
  2186. sub ax,-8[bp]
  2187. ! Debug: eq unsigned int = ax+0 to unsigned int data_length = [S+$E-$E] (used reg = )
  2188. mov -$C[bp],ax
  2189. !BCC_EOS
  2190. ! 183 unsigned int amount_read = 0;
  2191. dec sp
  2192. dec sp
  2193. ! Debug: eq int = const 0 to unsigned int amount_read = [S+$10-$10] (used reg = )
  2194. xor ax,ax
  2195. mov -$E[bp],ax
  2196. !BCC_EOS
  2197. ! 184 unsigned int amount_to_read = 0;
  2198. dec sp
  2199. dec sp
  2200. ! Debug: eq int = const 0 to unsigned int amount_to_read = [S+$12-$12] (used reg = )
  2201. xor ax,ax
  2202. mov -$10[bp],ax
  2203. !BCC_EOS
  2204. ! 185 unsigned int remaining_offset = offset_to_next_entry;
  2205. dec sp
  2206. dec sp
  2207. ! Debug: eq long offset_to_next_entry = [S+$14+8] to unsigned int remaining_offset = [S+$14-$14] (used reg = )
  2208. mov ax,$A[bp]
  2209. mov -$12[bp],ax
  2210. !BCC_EOS
  2211. ! 186 void *next_data;
  2212. !BCC_EOS
  2213. ! 187
  2214. ! 188
  2215. ! 189
  2216. ! 190
  2217. ! 191
  2218. ! 192 int data_pointer_index = 0;
  2219. add sp,*-4
  2220. ! Debug: eq int = const 0 to int data_pointer_index = [S+$18-$18] (used reg = )
  2221. xor ax,ax
  2222. mov -$16[bp],ax
  2223. !BCC_EOS
  2224. ! 193
  2225. ! 194
  2226. ! 195
  2227. ! 196 if (data_length > buffer_size)
  2228. ! Debug: gt unsigned int buffer_size = [S+$18+4] to unsigned int data_length = [S+$18-$E] (used reg = )
  2229. mov ax,-$C[bp]
  2230. cmp ax,6[bp]
  2231. jbe .45
  2232. .46:
  2233. ! 197 {
  2234. ! 198 data_length = buffer_size;
  2235. ! Debug: eq unsigned int buffer_size = [S+$18+4] to unsigned int data_length = [S+$18-$E] (used reg = )
  2236. mov ax,6[bp]
  2237. mov -$C[bp],ax
  2238. !BCC_EOS
  2239. ! 199 }
  2240. ! 200
  2241. ! 201 while(data_length > 0)
  2242. .45:
  2243. ! 202 {
  2244. br .48
  2245. .49:
  2246. ! 203
  2247. ! 204 if (remaining_offset == 0)
  2248. ! Debug: logeq int = const 0 to unsigned int remaining_offset = [S+$18-$14] (used reg = )
  2249. mov ax,-$12[bp]
  2250. test ax,ax
  2251. bne .4A
  2252. .4B:
  2253. ! 205 {
  2254. ! 206 char *tmp_buffer = calloc(8 , 512 );
  2255. dec sp
  2256. dec sp
  2257. ! Debug: list int = const $200 (used reg = )
  2258. mov ax,#$200
  2259. push ax
  2260. ! Debug: list int = const 8 (used reg = )
  2261. mov ax,*8
  2262. push ax
  2263. ! Debug: func () * void = calloc+0 (used reg = )
  2264. call _calloc
  2265. add sp,*4
  2266. ! Debug: eq * void = ax+0 to * char tmp_buffer = [S+$1A-$1A] (used reg = )
  2267. mov -$18[bp],ax
  2268. !BCC_EOS
  2269. ! 207
  2270. ! 208
  2271. ! 209 if (data_length < (8 * 512 ))
  2272. ! Debug: lt int = const $1000 to unsigned int data_length = [S+$1A-$E] (used reg = )
  2273. mov ax,-$C[bp]
  2274. cmp ax,#$1000
  2275. jae .4C
  2276. .4D:
  2277. ! 210 {
  2278. ! 211 amount_to_read = data_length;
  2279. ! Debug: eq unsigned int data_length = [S+$1A-$E] to unsigned int amount_to_read = [S+$1A-$12] (used reg = )
  2280. mov ax,-$C[bp]
  2281. mov -$10[bp],ax
  2282. !BCC_EOS
  2283. ! 212 }
  2284. ! 213 else
  2285. ! 214 {
  2286. jmp .4E
  2287. .4C:
  2288. ! 215 amount_to_read = (8 * 512 );
  2289. ! Debug: eq int = const $1000 to unsigned int amount_to_read = [S+$1A-$12] (used reg = )
  2290. mov ax,#$1000
  2291. mov -$10[bp],ax
  2292. !BCC_EOS
  2293. ! 216 }
  2294. ! 217
  2295. ! 218 integer_datapointer = file->data_pointer[data_pointer_index];
  2296. .4E:
  2297. mov bx,4[bp]
  2298. ! Debug: ptradd int data_pointer_index = [S+$1A-$18] to [$36] long = bx+$44 (used reg = )
  2299. mov ax,-$16[bp]
  2300. shl ax,*1
  2301. shl ax,*1
  2302. add bx,ax
  2303. ! Debug: eq long = [bx+$44] to unsigned int integer_datapointer = [S+$1A-$C] (used reg = )
  2304. mov bx,$44[bx]
  2305. mov -$A[bp],bx
  2306. !BCC_EOS
  2307. ! 219 if (integer_datapointer == 0)
  2308. ! Debug: logeq int = const 0 to unsigned int integer_datapointer = [S+$1A-$C] (used reg = )
  2309. mov ax,-$A[bp]
  2310. test ax,ax
  2311. jne .4F
  2312. .50:
  2313. ! 220 {
  2314. ! 221 break;
  2315. inc sp
  2316. inc sp
  2317. br .47
  2318. !BCC_EOS
  2319. ! 222 }
  2320. ! 223 next_data = data + amount_read;
  2321. .4F:
  2322. ! Debug: ptradd unsigned int amount_read = [S+$1A-$10] to * char data = [S+$1A+6] (used reg = )
  2323. mov ax,-$E[bp]
  2324. add ax,8[bp]
  2325. ! Debug: eq * char = ax+0 to * void next_data = [S+$1A-$16] (used reg = )
  2326. mov -$14[bp],ax
  2327. !BCC_EOS
  2328. ! 224 disk_service_read_data_from_disk(file->data_pointer[data_pointer_index], (long) 8 , next_data, data_segment);
  2329. ! Debug: list unsigned int data_segment = [S+$1A+$C] (used reg = )
  2330. push $E[bp]
  2331. ! Debug: list * void next_data = [S+$1C-$16] (used reg = )
  2332. push -$14[bp]
  2333. ! Debug: list long = const 8 (used reg = )
  2334. mov ax,*8
  2335. xor bx,bx
  2336. push bx
  2337. push ax
  2338. mov bx,4[bp]
  2339. ! Debug: ptradd int data_pointer_index = [S+$22-$18] to [$36] long = bx+$44 (used reg = )
  2340. mov ax,-$16[bp]
  2341. shl ax,*1
  2342. shl ax,*1
  2343. add bx,ax
  2344. ! Debug: list long = [bx+$44] (used reg = )
  2345. push $46[bx]
  2346. push $44[bx]
  2347. ! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
  2348. call _disk_service_read_data_from_disk
  2349. add sp,*$C
  2350. !BCC_EOS
  2351. ! 225
  2352. ! 226
  2353. ! 227
  2354. ! 228 data_length -= amount_to_read;
  2355. ! Debug: subab unsigned int amount_to_read = [S+$1A-$12] to unsigned int data_length = [S+$1A-$E] (used reg = )
  2356. mov ax,-$C[bp]
  2357. sub ax,-$10[bp]
  2358. mov -$C[bp],ax
  2359. !BCC_EOS
  2360. ! 229 amount_read += amount_to_read;
  2361. ! Debug: addab unsigned int amount_to_read = [S+$1A-$12] to unsigned int amount_read = [S+$1A-$10] (used reg = )
  2362. mov ax,-$E[bp]
  2363. add ax,-$10[bp]
  2364. mov -$E[bp],ax
  2365. !BCC_EOS
  2366. ! 230 data_pointer_index = data_pointer_index + 2;
  2367. ! Debug: add int = const 2 to int data_pointer_index = [S+$1A-$18] (used reg = )
  2368. mov ax,-$16[bp]
  2369. ! Debug: eq int = ax+2 to int data_pointer_index = [S+$1A-$18] (used reg = )
  2370. inc ax
  2371. inc ax
  2372. mov -$16[bp],ax
  2373. !BCC_EOS
  2374. ! 231
  2375. ! 232 }
  2376. inc sp
  2377. inc sp
  2378. ! 233 else if (remaining_offset < (8 * 512 ))
  2379. br .51
  2380. .4A:
  2381. ! Debug: lt int = const $1000 to unsigned int remaining_offset = [S+$18-$14] (used reg = )
  2382. mov ax,-$12[bp]
  2383. cmp ax,#$1000
  2384. bhis .52
  2385. .53:
  2386. ! 234 {
  2387. ! 235 char *tmp_buffer = calloc(1, (8 * 512 ));
  2388. dec sp
  2389. dec sp
  2390. ! Debug: list int = const $1000 (used reg = )
  2391. mov ax,#$1000
  2392. push ax
  2393. ! Debug: list int = const 1 (used reg = )
  2394. mov ax,*1
  2395. push ax
  2396. ! Debug: func () * void = calloc+0 (used reg = )
  2397. call _calloc
  2398. add sp,*4
  2399. ! Debug: eq * void = ax+0 to * char tmp_buffer = [S+$1A-$1A] (used reg = )
  2400. mov -$18[bp],ax
  2401. !BCC_EOS
  2402. ! 236
  2403. ! 237
  2404. ! 238 if (data_length < ((8 * 512 ) - remaining_offset) )
  2405. ! Debug: sub unsigned int remaining_offset = [S+$1A-$14] to int = const $1000 (used reg = )
  2406. mov ax,#$1000
  2407. sub ax,-$12[bp]
  2408. ! Debug: lt unsigned int = ax+0 to unsigned int data_length = [S+$1A-$E] (used reg = )
  2409. cmp ax,-$C[bp]
  2410. jbe .54
  2411. .55:
  2412. ! 239 {
  2413. ! 240 amount_to_read = data_length;
  2414. ! Debug: eq unsigned int data_length = [S+$1A-$E] to unsigned int amount_to_read = [S+$1A-$12] (used reg = )
  2415. mov ax,-$C[bp]
  2416. mov -$10[bp],ax
  2417. !BCC_EOS
  2418. ! 241 }
  2419. ! 242 else
  2420. ! 243 {
  2421. jmp .56
  2422. .54:
  2423. ! 244 amount_to_read = ((8 * 512 ) - remaining_off
  2424. ! 244 set);
  2425. ! Debug: sub unsigned int remaining_offset = [S+$1A-$14] to int = const $1000 (used reg = )
  2426. mov ax,#$1000
  2427. sub ax,-$12[bp]
  2428. ! Debug: eq unsigned int = ax+0 to unsigned int amount_to_read = [S+$1A-$12] (used reg = )
  2429. mov -$10[bp],ax
  2430. !BCC_EOS
  2431. ! 245 }
  2432. ! 246
  2433. ! 247 disk_service_read_data_from_disk(file->data_pointer[data_pointer_index], (long) 8 , tmp_buffer, 0x7e0);
  2434. .56:
  2435. ! Debug: list int = const $7E0 (used reg = )
  2436. mov ax,#$7E0
  2437. push ax
  2438. ! Debug: list * char tmp_buffer = [S+$1C-$1A] (used reg = )
  2439. push -$18[bp]
  2440. ! Debug: list long = const 8 (used reg = )
  2441. mov ax,*8
  2442. xor bx,bx
  2443. push bx
  2444. push ax
  2445. mov bx,4[bp]
  2446. ! Debug: ptradd int data_pointer_index = [S+$22-$18] to [$36] long = bx+$44 (used reg = )
  2447. mov ax,-$16[bp]
  2448. shl ax,*1
  2449. shl ax,*1
  2450. add bx,ax
  2451. ! Debug: list long = [bx+$44] (used reg = )
  2452. push $46[bx]
  2453. push $44[bx]
  2454. ! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
  2455. call _disk_service_read_data_from_disk
  2456. add sp,*$C
  2457. !BCC_EOS
  2458. ! 248
  2459. ! 249 memcpy(data, data_segment, (tmp_buffer + remaining_offset), 0x7e0, amount_to_read);
  2460. ! Debug: list unsigned int amount_to_read = [S+$1A-$12] (used reg = )
  2461. push -$10[bp]
  2462. ! Debug: list int = const $7E0 (used reg = )
  2463. mov ax,#$7E0
  2464. push ax
  2465. ! Debug: ptradd unsigned int remaining_offset = [S+$1E-$14] to * char tmp_buffer = [S+$1E-$1A] (used reg = )
  2466. mov ax,-$12[bp]
  2467. add ax,-$18[bp]
  2468. ! Debug: list * char = ax+0 (used reg = )
  2469. push ax
  2470. ! Debug: list unsigned int data_segment = [S+$20+$C] (used reg = )
  2471. push $E[bp]
  2472. ! Debug: list * char data = [S+$22+6] (used reg = )
  2473. push 8[bp]
  2474. ! Debug: func () void = memcpy+0 (used reg = )
  2475. call _memcpy
  2476. add sp,*$A
  2477. !BCC_EOS
  2478. ! 250 data_length -= amount_to_read;
  2479. ! Debug: subab unsigned int amount_to_read = [S+$1A-$12] to unsigned int data_length = [S+$1A-$E] (used reg = )
  2480. mov ax,-$C[bp]
  2481. sub ax,-$10[bp]
  2482. mov -$C[bp],ax
  2483. !BCC_EOS
  2484. ! 251 amount_read += amount_to_read;
  2485. ! Debug: addab unsigned int amount_to_read = [S+$1A-$12] to unsigned int amount_read = [S+$1A-$10] (used reg = )
  2486. mov ax,-$E[bp]
  2487. add ax,-$10[bp]
  2488. mov -$E[bp],ax
  2489. !BCC_EOS
  2490. ! 252 remaining_offset -= amount_to_read;
  2491. ! Debug: subab unsigned int amount_to_read = [S+$1A-$12] to unsigned int remaining_offset = [S+$1A-$14] (used reg = )
  2492. mov ax,-$12[bp]
  2493. sub ax,-$10[bp]
  2494. mov -$12[bp],ax
  2495. !BCC_EOS
  2496. ! 253
  2497. ! 254 data_pointer_index = data_pointer_index + 2;
  2498. ! Debug: add int = const 2 to int data_pointer_index = [S+$1A-$18] (used reg = )
  2499. mov ax,-$16[bp]
  2500. ! Debug: eq int = ax+2 to int data_pointer_index = [S+$1A-$18] (used reg = )
  2501. inc ax
  2502. inc ax
  2503. mov -$16[bp],ax
  2504. !BCC_EOS
  2505. ! 255
  2506. ! 256 }
  2507. inc sp
  2508. inc sp
  2509. ! 257 else
  2510. ! 258 {
  2511. jmp .57
  2512. .52:
  2513. ! 259
  2514. ! 260 remaining_offset -= (8 * 512 );
  2515. ! Debug: subab int = const $1000 to unsigned int remaining_offset = [S+$18-$14] (used reg = )
  2516. mov ax,-$12[bp]
  2517. add ax,#-$1000
  2518. mov -$12[bp],ax
  2519. !BCC_EOS
  2520. ! 261 data_pointer_index = data_pointer_index + 2;
  2521. ! Debug: add int = const 2 to int data_pointer_index = [S+$18-$18] (used reg = )
  2522. mov ax,-$16[bp]
  2523. ! Debug: eq int = ax+2 to int data_pointer_index = [S+$18-$18] (used reg = )
  2524. inc ax
  2525. inc ax
  2526. mov -$16[bp],ax
  2527. !BCC_EOS
  2528. ! 262 }
  2529. ! 263
  2530. ! 264 }
  2531. .57:
  2532. .51:
  2533. ! 265 # 269
  2534. ! 269
  2535. ! 270 return amount_read;
  2536. .48:
  2537. ! Debug: gt int = const 0 to unsigned int data_length = [S+$18-$E] (used reg = )
  2538. mov ax,-$C[bp]
  2539. test ax,ax
  2540. bne .49
  2541. .58:
  2542. .47:
  2543. mov ax,-$E[bp]
  2544. add sp,*$12
  2545. pop si
  2546. pop di
  2547. pop bp
  2548. ret
  2549. !BCC_EOS
  2550. ! 271
  2551. ! 272 }
  2552. ! 273 # 3 "main.c"
  2553. ! 3 int main(selector, pointer_parameter_segment, pointer_parameter_struct)
  2554. ! Register BX used in function lsfs_disk_read_data_from_file
  2555. ! 4 int selector;
  2556. export _main
  2557. _main:
  2558. !BCC_EOS
  2559. ! 5 void* pointer_parameter_segment;
  2560. !BCC_EOS
  2561. ! 6 void* pointer_parameter_struct;
  2562. !BCC_EOS
  2563. ! 7 {
  2564. ! 8
  2565. ! 9
  2566. ! 10
  2567. ! 11
  2568. ! 12 Service_Action service_action;
  2569. !BCC_EOS
  2570. ! 13 Directory_Table current_table;
  2571. !BCC_EOS
  2572. ! 14 Parameter_Struct parameter_struct;
  2573. !BCC_EOS
  2574. ! 15 int* local_segment;
  2575. !BCC_EOS
  2576. ! 16 unsigned int heap_start = 0x2200;
  2577. push bp
  2578. mov bp,sp
  2579. push di
  2580. push si
  2581. add sp,#-$1016
  2582. ! Debug: eq int = const $2200 to unsigned int heap_start = [S+$101C-$101C] (used reg = )
  2583. mov ax,#$2200
  2584. mov -$101A[bp],ax
  2585. !BCC_EOS
  2586. ! 17 unsigned int heap_end = 0xffff;
  2587. dec sp
  2588. dec sp
  2589. ! Debug: eq unsigned int = const $FFFF to unsigned int heap_end = [S+$101E-$101E] (used reg = )
  2590. mov ax,#$FFFF
  2591. mov -$101C[bp],ax
  2592. !BCC_EOS
  2593. ! 18 int stack_segment = 0x8fc0;
  2594. dec sp
  2595. dec sp
  2596. ! Debug: eq unsigned int = const $8FC0 to int stack_segment = [S+$1020-$1020] (used reg = )
  2597. mov ax,#$8FC0
  2598. mov -$101E[bp],ax
  2599. !BCC_EOS
  2600. ! 19 int path_length;
  2601. !BCC_EOS
  2602. ! 20 long index_as_long = 0;
  2603. add sp,*-6
  2604. ! Debug: eq int = const 0 to long index_as_long = [S+$1026-$1026] (used reg = )
  2605. xor ax,ax
  2606. xor bx,bx
  2607. mov -$1024[bp],ax
  2608. mov -$1022[bp],bx
  2609. !BCC_EOS
  2610. ! 21
  2611. ! 22 char *local_path = 0;
  2612. dec sp
  2613. dec sp
  2614. ! Debug: eq int = const 0 to * char local_path = [S+$1028-$1028] (used reg = )
  2615. xor ax,ax
  2616. mov -$1026[bp],ax
  2617. !BCC_EOS
  2618. ! 23 FSCI *fsci = global_heap_start - 0x200;
  2619. dec sp
  2620. dec sp
  2621. ! Debug: sub int = const $200 to unsigned int = [global_heap_start+0] (used reg = )
  2622. mov ax,[_global_heap_start]
  2623. ! Debug: eq unsigned int = ax-$200 to * struct File_System_Control_Information fsci = [S+$102A-$102A] (used reg = )
  2624. add ax,#-$200
  2625. mov -$1028[bp],ax
  2626. !BCC_EOS
  2627. ! 24 service_action = selector;
  2628. ! Debug: eq int selector = [S+$102A+2] to int service_action = [S+$102A-8] (used reg = )
  2629. mov ax,4[bp]
  2630. mov -6[bp],ax
  2631. !BCC_EOS
  2632. ! 25
  2633. ! 26 switch (service_action)
  2634. mov ax,-6[bp]
  2635. ! 27 {
  2636. br .5B
  2637. ! 28 case SERIVCE_LOAD_DISK:
  2638. ! 29 {
  2639. .5C:
  2640. ! 30
  2641. ! 31
  2642. ! 32
  2643. ! 33
  2644. ! 34 memcpy(&parameter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
  2645. ! Debug: list int = const $10 (used reg = )
  2646. mov ax,*$10
  2647. push ax
  2648. ! Debug: list * void pointer_parameter_segment = [S+$102C+4] (used reg = )
  2649. push 6[bp]
  2650. ! Debug: list * void pointer_parameter_struct = [S+$102E+6] (used reg = )
  2651. push 8[bp]
  2652. ! Debug: list int stack_segment = [S+$1030-$1020] (used reg = )
  2653. push -$101E[bp]
  2654. ! Debug: list * struct Parameter_Struct parameter_struct = S+$1032-$1018 (used reg = )
  2655. lea bx,-$1016[bp]
  2656. push bx
  2657. ! Debug: func () void = memcpy+0 (used reg = )
  2658. call _memcpy
  2659. add sp,*$A
  2660. !BCC_EOS
  2661. ! 35
  2662. ! 36 local_segment = parameter_struct.buffer_segment;
  2663. ! Debug: eq unsigned int parameter_struct = [S+$102A-$1014] to * int local_segment = [S+$102A-$101A] (used reg = )
  2664. mov bx,-$1012[bp]
  2665. mov -$1018[bp],bx
  2666. !BCC_EOS
  2667. ! 37 heap_start = parameter_struct.buffer_address + 0x200;
  2668. ! Debug: add int = const $200 to unsigned int parameter_struct = [S+$102A-$1012] (used reg = )
  2669. mov ax,-$1010[bp]
  2670. ! Debug: eq unsigned int = ax+$200 to unsigned int heap_start = [S+$102A-$101C] (used reg = )
  2671. add ax,#$200
  2672. mov -$101A[bp],ax
  2673. !BCC_EOS
  2674. ! 38 heap_end = parameter_struct.buffer_size;
  2675. ! Debug: eq unsigned int parameter_struct = [S+$102A-$1010] to unsigned int heap_end = [S+$102A-$101E] (used reg = )
  2676. mov ax,-$100E[bp]
  2677. mov -$101C[bp],ax
  2678. !BCC_EOS
  2679. ! 39 index_as_long = parameter_struct.data_length;
  2680. ! Debug: eq unsigned int parameter_struct = [S+$102A-$100E] to long index_as_long = [S+$102A-$1026] (used reg = )
  2681. mov ax,-$100C[bp]
  2682. xor bx,bx
  2683. mov -$1024[bp],ax
  2684. mov -$1022[bp],bx
  2685. !BCC_EOS
  2686. ! 40 set_heap_settings(heap_start, heap_end);
  2687. ! Debug: list unsigned int heap_end = [S+$102A-$101E] (used reg = )
  2688. push -$101C[bp]
  2689. ! Debug: list unsigned int heap_start = [S+$102C-$101C] (used reg = )
  2690. push -$101A[bp]
  2691. ! Debug: func () int = set_heap_settings+0 (used reg = )
  2692. call _set_heap_settings
  2693. add sp,*4
  2694. !BCC_EOS
  2695. ! 41 fsci = global_heap_start - 0x200;
  2696. ! Debug: sub int = const $200 to unsigned int = [global_heap_start+0] (used reg = )
  2697. mov ax,[_global_heap_start]
  2698. ! Debug: eq unsigned int = ax-$200 to * struct File_System_Control_Information fsci = [S+$102A-$102A] (used reg = )
  2699. add ax,#-$200
  2700. mov -$1028[bp],ax
  2701. !BCC_EOS
  2702. ! 42 disk_service_read_data_from_disk(index_as_long, (long) 1, fsci, local_segment);
  2703. ! Debug: list * int local_segment = [S+$102A-$101A] (used reg = )
  2704. push -$1018[bp]
  2705. ! Debug: list * struct File_System_Control_Information fsci = [S+$102C-$102A] (used reg = )
  2706. push -$1028[bp]
  2707. ! Debug: list long = const 1 (used reg = )
  2708. mov ax,*1
  2709. xor bx,bx
  2710. push bx
  2711. push ax
  2712. ! Debug: list long index_as_long = [S+$1032-$1026] (used reg = )
  2713. push -$1022[bp]
  2714. push -$1024[bp]
  2715. ! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
  2716. call _disk_service_read_data_from_disk
  2717. add sp,*$C
  2718. !BCC_EOS
  2719. ! 43 print("File System has been loaded: ");
  2720. ! Debug: list * char = .5D+0 (used reg = )
  2721. mov bx,#.5D
  2722. push bx
  2723. ! Debug: func () void = print+0 (used reg = )
  2724. call _print
  2725. inc sp
  2726. inc sp
  2727. !BCC_EOS
  2728. ! 44 print_newline();
  2729. ! Debug: func () void = print_newline+0 (used reg = )
  2730. call _print_newline
  2731. !BCC_EOS
  2732. ! 45 print(fsci->filesystem_information);
  2733. ! Debug: cast * char = const 0 to [$100] char fsci = [S+$102A-$102A] (used reg = )
  2734. ! Debug: list * char fsci = [S+$102A-$102A] (used reg = )
  2735. push -$1028[bp]
  2736. ! Debug: func () void = print+0 (used reg = )
  2737. call _print
  2738. inc sp
  2739. inc sp
  2740. !BCC_EOS
  2741. ! 46 p
  2742. ! 46 rint("16-bit implementation v0.2.1");
  2743. ! Debug: list * char = .5E+0 (used reg = )
  2744. mov bx,#.5E
  2745. push bx
  2746. ! Debug: func () void = print+0 (used reg = )
  2747. call _print
  2748. inc sp
  2749. inc sp
  2750. !BCC_EOS
  2751. ! 47 print_newline();
  2752. ! Debug: func () void = print_newline+0 (used reg = )
  2753. call _print_newline
  2754. !BCC_EOS
  2755. ! 48 } break;
  2756. br .59
  2757. !BCC_EOS
  2758. ! 49 case SERVICE_FIND_ENTRY:
  2759. ! 50 {
  2760. .5F:
  2761. ! 51 String_Array *path_array;
  2762. !BCC_EOS
  2763. ! 52 lsfs_file* find_file;
  2764. !BCC_EOS
  2765. ! 53 int i;
  2766. !BCC_EOS
  2767. ! 54 disk_service_read_data_from_disk(fsci->master_table_index[0], (long) 8 , &current_table, stack_segment);
  2768. ! Debug: list int stack_segment = [S+$1030-$1020] (used reg = )
  2769. push -$101E[bp]
  2770. ! Debug: list * struct Directory_Table current_table = S+$1032-$1008 (used reg = )
  2771. lea bx,-$1006[bp]
  2772. push bx
  2773. ! Debug: list long = const 8 (used reg = )
  2774. mov ax,*8
  2775. xor bx,bx
  2776. push bx
  2777. push ax
  2778. mov bx,-$1028[bp]
  2779. ! Debug: ptradd int = const 0 to [2] long = bx+$100 (used reg = )
  2780. ! Debug: list long = [bx+$100] (used reg = )
  2781. push $102[bx]
  2782. push $100[bx]
  2783. ! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
  2784. call _disk_service_read_data_from_disk
  2785. add sp,*$C
  2786. !BCC_EOS
  2787. ! 55 # 64
  2788. ! 64
  2789. ! 65
  2790. ! 66 memcpy(&parameter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
  2791. ! Debug: list int = const $10 (used reg = )
  2792. mov ax,*$10
  2793. push ax
  2794. ! Debug: list * void pointer_parameter_segment = [S+$1032+4] (used reg = )
  2795. push 6[bp]
  2796. ! Debug: list * void pointer_parameter_struct = [S+$1034+6] (used reg = )
  2797. push 8[bp]
  2798. ! Debug: list int stack_segment = [S+$1036-$1020] (used reg = )
  2799. push -$101E[bp]
  2800. ! Debug: list * struct Parameter_Struct parameter_struct = S+$1038-$1018 (used reg = )
  2801. lea bx,-$1016[bp]
  2802. push bx
  2803. ! Debug: func () void = memcpy+0 (used reg = )
  2804. call _memcpy
  2805. add sp,*$A
  2806. !BCC_EOS
  2807. ! 67 path_length = strlen(parameter_struct.path, pointer_parameter_segment);
  2808. ! Debug: list * void pointer_parameter_segment = [S+$1030+4] (used reg = )
  2809. push 6[bp]
  2810. ! Debug: list * char parameter_struct = [S+$1032-$1018] (used reg = )
  2811. push -$1016[bp]
  2812. ! Debug: func () int = strlen+0 (used reg = )
  2813. call _strlen
  2814. add sp,*4
  2815. ! Debug: eq int = ax+0 to int path_length = [S+$1030-$1022] (used reg = )
  2816. mov -$1020[bp],ax
  2817. !BCC_EOS
  2818. ! 68 local_path = malloc(256);
  2819. ! Debug: list int = const $100 (used reg = )
  2820. mov ax,#$100
  2821. push ax
  2822. ! Debug: func () * void = malloc+0 (used reg = )
  2823. call _malloc
  2824. inc sp
  2825. inc sp
  2826. ! Debug: eq * void = ax+0 to * char local_path = [S+$1030-$1028] (used reg = )
  2827. mov -$1026[bp],ax
  2828. !BCC_EOS
  2829. ! 69 memcpy(local_path, local_segment, parameter_struct.path, pointer_parameter_segment, path_length);
  2830. ! Debug: list int path_length = [S+$1030-$1022] (used reg = )
  2831. push -$1020[bp]
  2832. ! Debug: list * void pointer_parameter_segment = [S+$1032+4] (used reg = )
  2833. push 6[bp]
  2834. ! Debug: list * char parameter_struct = [S+$1034-$1018] (used reg = )
  2835. push -$1016[bp]
  2836. ! Debug: list * int local_segment = [S+$1036-$101A] (used reg = )
  2837. push -$1018[bp]
  2838. ! Debug: list * char local_path = [S+$1038-$1028] (used reg = )
  2839. push -$1026[bp]
  2840. ! Debug: func () void = memcpy+0 (used reg = )
  2841. call _memcpy
  2842. add sp,*$A
  2843. !BCC_EOS
  2844. ! 70 local_path[path_length] = 0;
  2845. ! Debug: ptradd int path_length = [S+$1030-$1022] to * char local_path = [S+$1030-$1028] (used reg = )
  2846. mov ax,-$1020[bp]
  2847. add ax,-$1026[bp]
  2848. mov bx,ax
  2849. ! Debug: eq int = const 0 to char = [bx+0] (used reg = )
  2850. xor al,al
  2851. mov [bx],al
  2852. !BCC_EOS
  2853. ! 71 print("Read file: ");
  2854. ! Debug: list * char = .60+0 (used reg = )
  2855. mov bx,#.60
  2856. push bx
  2857. ! Debug: func () void = print+0 (used reg = )
  2858. call _print
  2859. inc sp
  2860. inc sp
  2861. !BCC_EOS
  2862. ! 72 print(local_path);
  2863. ! Debug: list * char local_path = [S+$1030-$1028] (used reg = )
  2864. push -$1026[bp]
  2865. ! Debug: func () void = print+0 (used reg = )
  2866. call _print
  2867. inc sp
  2868. inc sp
  2869. !BCC_EOS
  2870. ! 73 print_newline();
  2871. ! Debug: func () void = print_newline+0 (used reg = )
  2872. call _print_newline
  2873. !BCC_EOS
  2874. ! 74
  2875. ! 75 path_array = string_split_c(local_path, '/', 0);
  2876. ! Debug: list int = const 0 (used reg = )
  2877. xor ax,ax
  2878. push ax
  2879. ! Debug: list int = const $2F (used reg = )
  2880. mov ax,*$2F
  2881. push ax
  2882. ! Debug: list * char local_path = [S+$1034-$1028] (used reg = )
  2883. push -$1026[bp]
  2884. ! Debug: func () * struct String_Array = string_split_c+0 (used reg = )
  2885. call _string_split_c
  2886. add sp,*6
  2887. ! Debug: eq * struct String_Array = ax+0 to * struct String_Array path_array = [S+$1030-$102C] (used reg = )
  2888. mov -$102A[bp],ax
  2889. !BCC_EOS
  2890. ! 76
  2891. ! 77 find_file = calloc(sizeof(lsfs_file), 1);
  2892. ! Debug: list int = const 1 (used reg = )
  2893. mov ax,*1
  2894. push ax
  2895. ! Debug: list int = const $11C (used reg = )
  2896. mov ax,#$11C
  2897. push ax
  2898. ! Debug: func () * void = calloc+0 (used reg = )
  2899. call _calloc
  2900. add sp,*4
  2901. ! Debug: eq * void = ax+0 to * struct lsfs_file find_file = [S+$1030-$102E] (used reg = )
  2902. mov -$102C[bp],ax
  2903. !BCC_EOS
  2904. ! 78 if ( !lsfs_disk_getattr(find_file, local_path, fsci) )
  2905. ! Debug: list * struct File_System_Control_Information fsci = [S+$1030-$102A] (used reg = )
  2906. push -$1028[bp]
  2907. ! Debug: list * char local_path = [S+$1032-$1028] (used reg = )
  2908. push -$1026[bp]
  2909. ! Debug: list * struct lsfs_file find_file = [S+$1034-$102E] (used reg = )
  2910. push -$102C[bp]
  2911. ! Debug: func () int = lsfs_disk_getattr+0 (used reg = )
  2912. call _lsfs_disk_getattr
  2913. add sp,*6
  2914. test ax,ax
  2915. jne .61
  2916. .62:
  2917. ! 79 {
  2918. ! 80 print("File not found");
  2919. ! Debug: list * char = .63+0 (used reg = )
  2920. mov bx,#.63
  2921. push bx
  2922. ! Debug: func () void = print+0 (used reg = )
  2923. call _print
  2924. inc sp
  2925. inc sp
  2926. !BCC_EOS
  2927. ! 81 print_newline();
  2928. ! Debug: func () void = print_newline+0 (used reg = )
  2929. call _print_newline
  2930. !BCC_EOS
  2931. ! 82 }
  2932. ! 83 else
  2933. ! 84 {
  2934. jmp .64
  2935. .61:
  2936. ! 85 print("File has been read");
  2937. ! Debug: list * char = .65+0 (used reg = )
  2938. mov bx,#.65
  2939. push bx
  2940. ! Debug: func () void = print+0 (used reg = )
  2941. call _print
  2942. inc sp
  2943. inc sp
  2944. !BCC_EOS
  2945. ! 86 print_newline();
  2946. ! Debug: func () void = print_newline+0 (used reg = )
  2947. call _print_newline
  2948. !BCC_EOS
  2949. ! 87 }
  2950. ! 88 # 95
  2951. ! 95
  2952. ! 96 lsfs_disk_read_data_from_file(find_file, parameter_struct.buffer_size, parameter_struct.buffer_address, (long) 0x0, parameter_struct.buffer_segment);
  2953. .64:
  2954. ! Debug: list unsigned int parameter_struct = [S+$1030-$1014] (used reg = )
  2955. push -$1012[bp]
  2956. ! Debug: list long = const 0 (used reg = )
  2957. xor ax,ax
  2958. xor bx,bx
  2959. push bx
  2960. push ax
  2961. ! Debug: list unsigned int parameter_struct = [S+$1036-$1012] (used reg = )
  2962. push -$1010[bp]
  2963. ! Debug: list unsigned int parameter_struct = [S+$1038-$1010] (used reg = )
  2964. push -$100E[bp]
  2965. ! Debug: list * struct lsfs_file find_file = [S+$103A-$102E] (used reg = )
  2966. push -$102C[bp]
  2967. ! Debug: func () int = lsfs_disk_read_data_from_file+0 (used reg = )
  2968. call _lsfs_disk_read_data_from_file
  2969. add sp,*$C
  2970. !BCC_EOS
  2971. ! 97
  2972. ! 98
  2973. ! 99 } break;
  2974. jmp .59
  2975. !BCC_EOS
  2976. ! 100 case SERIVCE_READ_DATA:
  2977. ! 101 {
  2978. .66:
  2979. ! 102 # 110
  2980. ! 110
  2981. ! 111 print("Hit READ case");
  2982. ! Debug: list * char = .67+0 (used reg = )
  2983. mov bx,#.67
  2984. push bx
  2985. ! Debug: func () void = print+0 (used reg = )
  2986. call _print
  2987. inc sp
  2988. inc sp
  2989. !BCC_EOS
  2990. ! 112 } break;
  2991. jmp .59
  2992. !BCC_EOS
  2993. ! 113 case SERIVCE_WRITE_DATA:
  2994. ! 114 {
  2995. .68:
  2996. ! 115 print("Hit WRITE case");
  2997. ! Debug: list * char = .69+0 (used reg = )
  2998. mov bx,#.69
  2999. push bx
  3000. ! Debug: func () void = print+0 (used reg = )
  3001. call _print
  3002. inc sp
  3003. inc sp
  3004. !BCC_EOS
  3005. ! 116 } break;
  3006. jmp .59
  3007. !BCC_EOS
  3008. ! 117 case SERIVCE_WRITE_FS_INFO:
  3009. ! 118 {
  3010. .6A:
  3011. ! 119
  3012. ! 120 print(fsci->filesystem_information);
  3013. ! Debug: cast * char = const 0 to [$100] char fsci = [S+$102A-$102A] (used reg = )
  3014. ! Debug: list * char fsci = [S+$102A-$102A] (used reg = )
  3015. push -$1028[bp]
  3016. ! Debug: func () void = print+0 (used reg = )
  3017. call _print
  3018. inc sp
  3019. inc sp
  3020. !BCC_EOS
  3021. ! 121
  3022. ! 122 } break;
  3023. jmp .59
  3024. !BCC_EOS
  3025. ! 123
  3026. ! 124 default:
  3027. ! 125 {
  3028. .6B:
  3029. ! 126 print("Default case: ");
  3030. ! Debug: list * char = .6C+0 (used reg = )
  3031. mov bx,#.6C
  3032. push bx
  3033. ! Debug: func () void = print+0 (used reg = )
  3034. call _print
  3035. inc sp
  3036. inc sp
  3037. !BCC_EOS
  3038. ! 127 dump_ax(service_action);
  3039. ! Debug: list int service_action = [S+$102A-8] (used reg = )
  3040. push -6[bp]
  3041. ! Debug: func () void = dump_ax+0 (used reg = )
  3042. call _dump_ax
  3043. inc sp
  3044. inc sp
  3045. !BCC_EOS
  3046. ! 128 }
  3047. ! 129 }
  3048. ! 130
  3049. ! 131 return 0;
  3050. jmp .59
  3051. .5B:
  3052. add sp,*-6
  3053. sub ax,*1
  3054. beq .5C
  3055. sub ax,*1
  3056. beq .5F
  3057. sub ax,*1
  3058. je .66
  3059. sub ax,*1
  3060. je .68
  3061. sub ax,*6
  3062. je .6A
  3063. jmp .6B
  3064. .59:
  3065. ..FFFF = -$1030
  3066. add sp,*6
  3067. xor ax,ax
  3068. lea sp,-4[bp]
  3069. pop si
  3070. pop di
  3071. pop bp
  3072. ret
  3073. !BCC_EOS
  3074. ! 132
  3075. ! 133 }
  3076. ! 134
  3077. ! Register BX used in function main
  3078. .6C:
  3079. .6D:
  3080. .ascii "Default case: "
  3081. .byte 0
  3082. .69:
  3083. .6E:
  3084. .ascii "Hit WRITE case"
  3085. .byte 0
  3086. .67:
  3087. .6F:
  3088. .ascii "Hit READ case"
  3089. .byte 0
  3090. .65:
  3091. .70:
  3092. .ascii "File has been read"
  3093. .byte 0
  3094. .63:
  3095. .71:
  3096. .ascii "File not found"
  3097. .byte 0
  3098. .60:
  3099. .72:
  3100. .ascii "Read file: "
  3101. .byte 0
  3102. .5E:
  3103. .73:
  3104. .ascii "16-bit implementation v0.2.1"
  3105. .byte 0
  3106. .5D:
  3107. .74:
  3108. .ascii "File System has been loaded: "
  3109. .byte 0
  3110. .bss
  3111. ! 0 errors detected