Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. use32
  2.         org 0
  3.         db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
  4.         dd 1, start, i_end, mem, stacktop, 0, sys_path
  5.  
  6. include '../../../../macros.inc'
  7. include '../../../../proc32.inc'
  8. include '../../../../KOSfuncs.inc'
  9. include '../../../../load_img.inc'
  10. include '../../../../load_lib.mac'
  11. include '../../../../develop/libraries/box_lib/trunk/box_lib.mac'
  12.  
  13. @use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  14. caption db 'NNP example 28.05.22',0 ;¯®¤¯¨áì ®ª­ 
  15.  
  16. run_file_70 FileInfoBlock
  17.  
  18. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  19. image_data_toolbar dd 0
  20.  
  21. memory_file_size dd 512*1024 ;à §¬¥à ¯ ¬ï⨠¤«ï ®âªàëâ¨ï ä ©«®¢ (¢ ­ ç «¥ 512 Kb, ­® ¬®¦¥â 㢥«¨ç¨¢ âáï ¯à¨ ­¥®¡å®¤¨¬®áâ¨)
  22.  
  23. NNP_FF_BIN  equ 0x6e6962
  24. NNP_FF_JSON equ 0x6e6f736a
  25.  
  26. struct NeuralNetwork
  27.         learningRate  dq ? ;+ 0 ᪮à®áâì ®¡ã祭¨ï
  28.         layers        dd ? ;+ 8 [] á«®¨
  29.         layers_length dd ? ;+12 ç¨á«® á«®¥¢
  30.         activation    dd ? ;+16 㪠§ â¥«ì ­  äã­ªæ¨î  ªâ¨¢ æ¨¨
  31.         derivative    dd ? ;+20 㪠§ â¥«ì ­  äã­ªæ¨î
  32.         errors        dd ? ;+24 ¬ áᨢ ¤«ï ¢ëç¨á«¥­¨©
  33.         errorsNext    dd ? ;+28
  34.         gradients     dd ? ;+32
  35.         deltas        dd ? ;+36
  36. ends
  37.  
  38. struct Point
  39.         x dq ? ;double
  40.         y dq ?
  41.         t dd ? ;long
  42. ends
  43.  
  44. align 4
  45. NNLOPT_LEN equ 4
  46. nnlopt dd 2,3,3,2
  47. _nn NeuralNetwork
  48. lea_rate dq 0.01
  49.  
  50. POINTS_COUNT equ 8 ;ç¨á«® â®ç¥ª
  51. _p rb sizeof.Point*POINTS_COUNT
  52.  
  53. _cycles_st dd 0
  54. _r_op rb 128
  55. txt_error  db '"Error open: ',39,'%s',39,'" -tE',0
  56. txt_cycles db 'Cycles = %i000',0
  57.  
  58. ;Œ ªà®á ¤«ï ¯ à ¬¥â஢ ⨯  double (8 ¡ ©â)
  59. macro glpush double_v {
  60.         push dword[double_v+4]
  61.         push dword[double_v]
  62. }
  63.  
  64. align 8
  65. proc __ftol
  66.         sub   esp,12
  67.         wait
  68.         fstcw word[esp+8]
  69.         wait
  70.         mov   al,[esp+9]
  71.         or    byte[esp+9],0x0c
  72.         fldcw word[esp+8]
  73.         fistp qword[esp]
  74.         mov   [esp+9],al
  75.         fldcw word[esp+8]
  76.         mov   eax,[esp]
  77.         mov   edx,[esp+4]
  78.         add   esp,12
  79.         ret
  80. endp
  81.  
  82. align 16
  83. Math_random:
  84.         imul  eax,dword[_rand_x],22695477
  85.         inc   eax
  86.         push  ecx
  87.         mov   dword[_rand_x],eax
  88.         and   eax,65535
  89.         mov   dword[esp],eax
  90.         fild  dword[esp]
  91.         fmul  dword[@f]
  92.         pop   edx
  93.         ret
  94. align 4
  95. @@:
  96.         db 0,0,128,55 ;dd 1.0/65536.0
  97. _rand_x dd 0
  98.  
  99.  
  100. align 8
  101. start:
  102.         load_libraries l_libs_start,l_libs_end
  103.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  104.         mov     ebp,lib_0
  105.         cmp     dword [ebp+ll_struc_size-4],0
  106.         jz      @f
  107.                 mcall SF_TERMINATE_PROCESS
  108.         @@:
  109.         mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
  110.         mcall SF_SET_EVENTS_MASK,0xC0000027
  111.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  112.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  113.  
  114.         include_image_file 'toolbar.png', image_data_toolbar
  115.  
  116.         stdcall mem.Alloc,[memory_file_size]
  117.         mov dword[open_file],eax
  118.  
  119.         push NNLOPT_LEN
  120.         push nnlopt
  121.         push 0
  122.         push 0
  123.         glpush lea_rate
  124.         stdcall [NNP_Create], _nn
  125.         call but_update
  126.  
  127. align 8
  128. red_win:
  129.         call draw_window
  130.  
  131. align 16
  132. still:
  133.         mcall SF_WAIT_EVENT
  134.  
  135.         cmp al,1
  136.         jz red_win
  137.         cmp al,2
  138.         jz key
  139.         cmp al,3
  140.         jz button
  141.         cmp al,6 ;¬ëèì
  142.         jne @f
  143.                 jmp mouse
  144.         @@:
  145.         jmp still
  146.  
  147. align 8
  148. draw_window:
  149. pushad
  150.         mcall SF_REDRAW,SSF_BEGIN_DRAW
  151.  
  152.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  153.         mov edx,[sc.work]
  154.         or  edx,(3 shl 24)+0x30000000
  155.         mov edi,caption
  156.         mcall SF_CREATE_WINDOW, (20 shl 16)+590, (20 shl 16)+540
  157.  
  158.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  159.         mov esi,[sc.work_button]
  160.         mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (5 shl 16)+20, 3
  161.  
  162.         add ebx,(25 shl 16)
  163.         mov edx,4
  164.         int 0x40
  165.  
  166.         add ebx,(25 shl 16)
  167.         mov edx,5
  168.         int 0x40
  169.  
  170.         add ebx,(30 shl 16)
  171.         mov edx,6
  172.         int 0x40
  173.  
  174.         add ebx,(25 shl 16)
  175.         mov edx,7
  176.         int 0x40
  177.  
  178.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  179.         mcall SF_PUT_IMAGE, [image_data_toolbar], (16 shl 16)+16, (7 shl 16)+7 ;icon new
  180.  
  181.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  182.         add edx,(25 shl 16) ;icon open
  183.         int 0x40
  184.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  185.         add edx,(25 shl 16) ;icon save
  186.         int 0x40
  187.  
  188.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  189.         add edx,(30 shl 16) ;icon update points
  190.         int 0x40
  191.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  192.         add edx,(25 shl 16) ;icon calculate
  193.         int 0x40
  194.  
  195.         call PointsDraw
  196.         ; *** à¨á®¢ ­¨¥ ¡ãä¥à  ***
  197.         stdcall [buf2d_draw], buf_0
  198.  
  199.         mcall SF_REDRAW,SSF_END_DRAW
  200. popad
  201.         ret
  202.  
  203. align 8
  204. key:
  205.         mcall SF_GET_KEY
  206.         jmp still
  207.  
  208. align 8
  209. mouse:
  210.  
  211.         jmp still
  212.  
  213. align 8
  214. button:
  215.         mcall SF_GET_BUTTON
  216.         cmp ah,3
  217.         jne @f
  218.                 call but_new_file
  219.                 jmp red_win
  220.         @@:
  221.         cmp ah,4
  222.         jne @f
  223.                 call but_open_file
  224.                 jmp red_win
  225.         @@:
  226.         cmp ah,5
  227.         jne @f
  228.                 call but_save_file
  229.                 jmp red_win
  230.         @@:
  231.         cmp ah,6
  232.         jne @f
  233.                 call but_update
  234.                 jmp red_win
  235.         @@:
  236.         cmp ah,7
  237.         jne @f
  238.                 call but_calc
  239.                 jmp red_win
  240.         @@:
  241.         cmp ah,1
  242.         jne still
  243. .exit:
  244.         stdcall [buf2d_delete],buf_0
  245.         stdcall mem.Free,[image_data_toolbar]
  246.         stdcall mem.Free,[open_file]
  247.         stdcall [NNP_Destroy], _nn
  248.         mcall SF_TERMINATE_PROCESS
  249.  
  250. align 8
  251. but_calc:
  252.         push      esi edi ebp
  253.         add       esp,-32
  254.         mov       ebp,_p
  255.         xor       edi,edi ;i=0
  256. .cycle_0: ;for(i=0;i<50000;i++)
  257.         call      Math_random
  258.         fimul     dword[.172]
  259.         call      __ftol
  260.         mov       esi,eax ;k=(long)(Math_random()*POINTS_COUNT)
  261.         imul      esi,sizeof.Point
  262.         fld       qword[ebp+esi+Point.x]
  263.         fsub      dword[f_0_5]
  264.         fstp      qword[esp] ;v[0]=p[k].x-.5
  265.         fld       qword[ebp+esi+Point.y]
  266.         fsub      dword[f_0_5]
  267.         fstp      qword[esp+8] ;v[1]=p[k].y-.5
  268.         stdcall   [NNP_FeedForward], _nn,esp ;r=NNP_FeedForward(&nn,v)
  269.  
  270.         xor       eax,eax
  271.         mov       dword[esp+16],eax
  272.         mov       dword[esp+20],eax ;t[0]=0.0
  273.         mov       dword[esp+24],eax
  274.         mov       dword[esp+28],eax ;t[1]=0.0
  275.         cmp       dword[ebp+esi+Point.t],eax
  276.         je        .173
  277.         mov       dword[esp+16],eax
  278.         mov       dword[esp+20],1072693248 ;if(p[k].t) t[0]=1.0
  279.         jmp       .174
  280. .173:
  281.         mov       dword[esp+24],eax
  282.         mov       dword[esp+28],1072693248 ;else t[1]=1.0
  283. .174:
  284.         lea       edx,dword[esp+16]
  285.         stdcall   [NNP_BackPropagation], _nn,edx ;NNP_BackPropagation(&nn,t)
  286.         inc       edi ;i++
  287.         cmp       edi,50000
  288.         jl        .cycle_0
  289.         add       dword[_cycles_st],50
  290.         stdcall   [sprintf], _r_op,txt_cycles,[_cycles_st]
  291.         add       esp,12
  292.         call      NNP_DrawInBuf
  293.         call      PointsDraw
  294. ;               SaveNN("/tmp0/1/nnp_end.txt")
  295.         ;push       s@+835
  296.         ;call      @@SaveNN$qpxc
  297.         ;pop       ecx
  298.         mcall     SF_SET_CAPTION,1,_r_op
  299.         add       esp,32
  300.         pop       ebp edi esi
  301.         ret
  302. align 4        
  303. .172:
  304.         dd POINTS_COUNT
  305.  
  306. align 8
  307. but_new_file:
  308.         mov dword[_cycles_st],0
  309.         stdcall [NNP_Reset], _nn
  310.         call NNP_DrawInBuf
  311.         call PointsDraw
  312.         ret
  313.  
  314. align 8
  315. but_update:
  316.         mov dword[_cycles_st],0
  317.         call PointsInit
  318.         call NNP_DrawInBuf
  319.         call PointsDraw
  320.         ret
  321.  
  322. align 8
  323. PointsInit:
  324.         push      ebx esi
  325.         xor       esi,esi ;i=0
  326.         mov       ebx,_p
  327. .cycle_0: ;for(i=0;i<POINTS_COUNT;i++)
  328.         call      Math_random
  329.         fstp      qword[ebx+Point.x] ;p[i].x=Math_random()
  330.         call      Math_random
  331.         fstp      qword[ebx+Point.y] ;p[i].y=Math_random()
  332.         mov       eax,esi
  333.         and       eax,1
  334.         mov       dword[ebx+Point.t],eax ;p[i].t=i&1
  335.         add       ebx,sizeof.Point
  336.         inc       esi ;i++
  337.         cmp       esi,POINTS_COUNT
  338.         jl        .cycle_0
  339.         pop       esi ebx
  340.         ret
  341.  
  342. align 8
  343. PointsDraw:
  344.         push      ebx ecx esi edi ebp
  345.         xor       ecx,ecx
  346.         mov       ebx,_p
  347. align 4
  348. .cycle_0: ;for(i=0;i<POINTS_COUNT;i++)
  349.         fild      dword[buf_0.w]
  350.         fmul      qword[ebx+Point.x]
  351.         call      __ftol
  352.         fild      dword[buf_0.h]
  353.         mov       esi,eax ;x=p[i].x*buf0.w
  354.         fmul      qword[ebx+Point.y]
  355.         call      __ftol
  356.         mov       edi,eax ;y=p[i].y*buf0.h
  357.  
  358.         mov       ebp,255 ;c=0xff
  359.         cmp       dword[ebx+Point.t],0
  360.         je        @f
  361.         shl       ebp,8 ;if(p[i].t) c<<=8
  362. @@:
  363.         sub       esi,4
  364.         sub       edi,4
  365.         stdcall   [buf2d_rect_by_size], buf_0,esi,edi,7,7,0xffffff
  366.         inc       esi
  367.         inc       edi
  368.         stdcall   [buf2d_filled_rect_by_size], buf_0,esi,edi,5,5,ebp
  369.         inc       ecx
  370.         add       ebx,sizeof.Point
  371.         cmp       ecx,POINTS_COUNT
  372.         jl        .cycle_0
  373.         pop       ebp edi esi ecx ebx
  374.         ret
  375.  
  376. align 8
  377. NNP_DrawInBuf:
  378.         push      ebx esi ebp
  379.         add       esp,-32
  380.         lea       ebp,dword [esp+16]
  381. ; ebp = &v
  382.         xor       eax,eax
  383.         mov       dword [esp+8],eax
  384.         mov       dword [esp+12],eax
  385.         jmp       .cycle_0_end
  386. .cycle_0: ;for(y=0;y<buf0.h;y++)
  387.         fild      dword [buf_0.h]
  388.         fdivr     qword [esp+8]
  389.         fsub      dword [f_0_5]
  390.         fstp      qword [ebp+8] ;v[1]=(double)y/buf0.h-.5
  391.         xor       eax,eax
  392.         mov       dword [esp],eax
  393.         mov       dword [esp+4],eax
  394.         jmp       .cycle_1_end
  395. .cycle_1: ;for(x=0;x<buf0.w;x++)
  396.         fild      dword [buf_0.w]
  397.         fdivr     qword [esp]
  398.         fsub      dword [f_0_5]
  399.         fstp      qword [ebp] ;v[0]=(double)x/buf0.w-.5
  400.         stdcall   [NNP_FeedForward], _nn,ebp
  401.         mov       esi,eax ;r=NNP_FeedForward(&nn,v)
  402.         fld       qword [esi]
  403.         fmul      dword [f_255_0]
  404.         call      __ftol
  405.         movzx     ebx,al ;k=(unsigned char)(r[0]*255.0)
  406.         shl       ebx,8 ;k<<=8
  407.         fld       qword [esi+8]
  408.         fmul      dword [f_255_0]
  409.         call      __ftol
  410.         and       eax,0xff
  411.         add       ebx,eax ;k+=(unsigned char)(r[1]*255.0)
  412.         push      ebx
  413.         fld       qword [esp+12]
  414.         call      __ftol
  415.         push      eax
  416.         fld       qword [esp+8]
  417.         call      __ftol
  418.         stdcall   [buf2d_set_pixel], buf_0,eax ;buf2d_set_pixel(&buf0,x,y,k)
  419.         fld1
  420.         fadd      qword [esp]
  421.         fstp      qword [esp]
  422. .cycle_1_end:
  423.         fild      dword [buf_0.w]
  424.         fcomp     qword [esp]
  425.         fnstsw ax
  426.         sahf
  427.         ja        .cycle_1
  428.         fld1
  429.         fadd      qword [esp+8]
  430.         fstp      qword [esp+8]
  431. .cycle_0_end:
  432.         fild      dword [buf_0.h]
  433.         fcomp     qword [esp+8]
  434.         fnstsw ax
  435.         sahf
  436.         ja        .cycle_0
  437.         add       esp,32
  438.         pop       ebp esi ebx
  439.         ret
  440.  
  441. align 4
  442. f_0_5 dd 0.5
  443. f_255_0 dd 255.0
  444. open_file dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢
  445. open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©«  (¤®«¦¥­ ¡ëâì ­¥ ¡®«ìè¥ memory_file_size)
  446.  
  447. align 8
  448. but_open_file:
  449.         pushad
  450.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  451.         mov [OpenDialog_data.type],0
  452.         stdcall [OpenDialog_Start],OpenDialog_data
  453.         cmp [OpenDialog_data.status],2
  454.         je .end_open_file
  455.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  456.  
  457.         mov [run_file_70.Function], SSF_GET_INFO
  458.         mov [run_file_70.Position], 0
  459.         mov [run_file_70.Flags], 0
  460.         mov dword[run_file_70.Count], 0
  461.         m2m [run_file_70.Buffer], [open_file]
  462.         mov byte[run_file_70+20], 0
  463.         mov dword[run_file_70.FileName], openfile_path
  464.         mcall SF_FILE,run_file_70
  465.         cmp eax,0
  466.         jne .end_open_file
  467.  
  468.         mov eax,[open_file]
  469.         mov ebx,[eax+32] ;dword[eax+32] - à §¬¥à ®âªà뢠¥¬®£® ä ©« 
  470.         mov [open_file_size],ebx ;ebx - à §¬¥à ®âªà뢠¥¬®£® ä ©« 
  471.         ;memory_file_size - à §¬¥à ¢ë¤¥«¥­­®© ¯ ¬ï⨠¤«ï ä ©« 
  472.         cmp [memory_file_size],ebx
  473.         jge @f
  474.                 ;㢥«¨ç¨¢ ¥¬ ¯ ¬ïâì ¥á«¨ ­¥ 墠⨫®
  475.                 mov [memory_file_size],ebx
  476.                 stdcall mem.ReAlloc, [open_file],ebx
  477.                 mov [open_file],eax
  478.         @@:
  479.  
  480.         mov [run_file_70.Function], SSF_READ_FILE
  481.         mov [run_file_70.Position], 0
  482.         mov [run_file_70.Flags], 0
  483.         m2m dword[run_file_70.Count], dword[open_file_size]
  484.         m2m dword[run_file_70.Buffer],dword[open_file]
  485.         mov byte[run_file_70+20], 0
  486.         mov dword[run_file_70.FileName], openfile_path
  487.         mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©«
  488.         cmp ebx,0xffffffff
  489.         je .end_open_file
  490.  
  491.         mov [open_file_size],ebx
  492.         mcall SF_SET_CAPTION,1,openfile_path
  493.  
  494.         stdcall [NNP_SetMemData], _nn,NNP_FF_JSON,[open_file]
  495.         or eax,eax
  496.         jnz @f
  497.                 mov dword[_cycles_st],0
  498.                 call NNP_DrawInBuf
  499.                 call PointsDraw
  500.                 jmp .end_open_file
  501.         @@:
  502.                 stdcall [sprintf], _r_op,txt_error,eax
  503.                 add esp,12
  504.                 notify_window_run _r_op
  505.         .end_open_file:
  506.         popad
  507.         ret
  508.  
  509. align 8
  510. but_save_file:
  511.         pushad
  512.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  513.         mov [OpenDialog_data.type],1
  514.         stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1
  515.         stdcall [OpenDialog_Start],OpenDialog_data
  516.         cmp [OpenDialog_data.status],2
  517.         je .end_save_file
  518.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  519.  
  520.         mov [run_file_70.Function], SSF_CREATE_FILE
  521.         mov [run_file_70.Position], 0
  522.         mov [run_file_70.Flags], 0
  523.  
  524.         stdcall [NNP_GetMemData], _nn,NNP_FF_JSON,[open_file]
  525.         stdcall [strlen], [open_file]
  526.         pop ebx ;add esp,4
  527.         mov ebx, [open_file]
  528.         mov [run_file_70.Buffer], ebx
  529.         mov [open_file_size],eax
  530.  
  531.         mov dword[run_file_70.Count], eax ;à §¬¥à ä ©« 
  532.         mov byte[run_file_70+20], 0
  533.         mov dword[run_file_70.FileName], openfile_path
  534.         mcall SF_FILE,run_file_70 ;á®å࠭塞 ä ©«
  535.         ;cmp ebx,0xffffffff
  536.         ;je .end_save_file
  537.         ; ... á®®¡é¥­¨¥ ® ­¥ã¤ ç­®¬ á®åà ­¥­¨¨ ...
  538.  
  539.         .end_save_file:
  540.         popad
  541.         ret
  542.  
  543.  
  544. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  545. align 4
  546. OpenDialog_data:
  547. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  548. .procinfo               dd procinfo     ;+4
  549. .com_area_name          dd communication_area_name      ;+8
  550. .com_area               dd 0    ;+12
  551. .opendir_path           dd plugin_path  ;+16
  552. .dir_default_path       dd default_dir ;+20
  553. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  554. .draw_window            dd draw_window  ;+28
  555. .status                 dd 0    ;+32
  556. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  557. .filename_area          dd filename_area        ;+40
  558. .filter_area            dd Filter
  559. .x:
  560. .x_size                 dw 420 ;+48 ; Window X size
  561. .x_start                dw 10 ;+50 ; Window X position
  562. .y:
  563. .y_size                 dw 320 ;+52 ; Window y size
  564. .y_start                dw 10 ;+54 ; Window Y position
  565.  
  566. default_dir db '/sys',0
  567.  
  568. communication_area_name:
  569.         db 'FFFFFFFF_open_dialog',0
  570. open_dialog_name:
  571.         db 'opendial',0
  572. communication_area_default_path:
  573.         db '/sys/File managers/',0
  574.  
  575. Filter:
  576. dd Filter.end - Filter ;.1
  577. .1:
  578. db 'TXT',0
  579. db 'JSON',0
  580. db 'BIN',0
  581. .end:
  582. db 0
  583.  
  584.  
  585. system_dir_0 db '/sys/lib/'
  586. lib_name_0 db 'proc_lib.obj',0
  587. system_dir_1 db '/sys/lib/'
  588. lib_name_1 db 'libimg.obj',0
  589. system_dir_2 db '/sys/lib/'
  590. lib_name_2 db 'buf2d.obj',0
  591. system_dir_3 db '/sys/lib/'
  592. lib_name_3 db 'nnp.obj',0
  593. system_dir_4 db '/sys/lib/'
  594. lib_name_4 db 'libc.obj',0
  595.  
  596. l_libs_start:
  597.         lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib
  598.         lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg
  599.         lib_2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d
  600.         lib_3 l_libs lib_name_3, file_name, system_dir_3, import_nnp
  601.         lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libc
  602. l_libs_end:
  603.  
  604. sz_lib_init db 'lib_init',0
  605.  
  606. align 4
  607. import_libimg:
  608.         dd sz_lib_init
  609.         img_is_img  dd aimg_is_img
  610.         img_info    dd aimg_info
  611.         img_from_file dd aimg_from_file
  612.         img_to_file dd aimg_to_file
  613.         img_from_rgb dd aimg_from_rgb
  614.         img_to_rgb  dd aimg_to_rgb
  615.         img_to_rgb2 dd aimg_to_rgb2
  616.         img_decode  dd aimg_decode
  617.         img_encode  dd aimg_encode
  618.         img_create  dd aimg_create
  619.         img_destroy dd aimg_destroy
  620.         img_destroy_layer dd aimg_destroy_layer
  621.         img_count   dd aimg_count
  622.         img_lock_bits dd aimg_lock_bits
  623.         img_unlock_bits dd aimg_unlock_bits
  624.         img_flip    dd aimg_flip
  625.         img_flip_layer dd aimg_flip_layer
  626.         img_rotate  dd aimg_rotate
  627.         img_rotate_layer dd aimg_rotate_layer
  628.         img_draw    dd aimg_draw
  629.  
  630.         dd 0,0
  631.         aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
  632.         aimg_info    db 'img_info',0
  633.         aimg_from_file db 'img_from_file',0
  634.         aimg_to_file db 'img_to_file',0
  635.         aimg_from_rgb db 'img_from_rgb',0
  636.         aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
  637.         aimg_to_rgb2 db 'img_to_rgb2',0
  638.         aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
  639.         aimg_encode  db 'img_encode',0
  640.         aimg_create  db 'img_create',0
  641.         aimg_destroy db 'img_destroy',0
  642.         aimg_destroy_layer db 'img_destroy_layer',0
  643.         aimg_count   db 'img_count',0
  644.         aimg_lock_bits db 'img_lock_bits',0
  645.         aimg_unlock_bits db 'img_unlock_bits',0
  646.         aimg_flip    db 'img_flip',0
  647.         aimg_flip_layer db 'img_flip_layer',0
  648.         aimg_rotate  db 'img_rotate',0
  649.         aimg_rotate_layer db 'img_rotate_layer',0
  650.         aimg_draw    db 'img_draw',0
  651.  
  652. align 4
  653. import_proclib: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
  654.         OpenDialog_Init dd aOpenDialog_Init
  655.         OpenDialog_Start dd aOpenDialog_Start
  656.         ;OpenDialog_Set_file_name dd aOpenDialog_Set_file_name
  657.         OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext
  658. dd 0,0
  659.         aOpenDialog_Init db 'OpenDialog_init',0
  660.         aOpenDialog_Start db 'OpenDialog_start',0
  661.         ;aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
  662.         aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
  663.  
  664. align 4
  665. import_buf2d:
  666.         dd sz_lib_init
  667.         buf2d_create dd sz_buf2d_create
  668.         buf2d_create_f_img dd sz_buf2d_create_f_img
  669.         buf2d_clear  dd sz_buf2d_clear
  670.         buf2d_draw   dd sz_buf2d_draw
  671.         buf2d_delete dd sz_buf2d_delete
  672.         buf2d_resize dd sz_buf2d_resize
  673.         buf2d_rect_by_size dd sz_buf2d_rect_by_size
  674.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  675.         buf2d_circle dd sz_buf2d_circle
  676.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  677.         buf2d_bit_blt dd sz_buf2d_bit_blt
  678.         ;buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  679.         ;buf2d_draw_text dd sz_buf2d_draw_text
  680.         buf2d_set_pixel dd sz_buf2d_set_pixel
  681.         dd 0,0
  682.         sz_buf2d_create db 'buf2d_create',0
  683.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  684.         sz_buf2d_clear  db 'buf2d_clear',0
  685.         sz_buf2d_draw   db 'buf2d_draw',0
  686.         sz_buf2d_delete db 'buf2d_delete',0
  687.         sz_buf2d_resize db 'buf2d_resize',0
  688.         sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
  689.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  690.         sz_buf2d_circle db 'buf2d_circle',0
  691.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  692.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  693.         ;sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  694.         ;sz_buf2d_draw_text db 'buf2d_draw_text',0
  695.         sz_buf2d_set_pixel db 'buf2d_set_pixel',0
  696.  
  697. align 4
  698. import_nnp:
  699.         dd sz_lib_init
  700.         NNP_Create      dd sz_create
  701.         NNP_Reset       dd sz_reset
  702.         NNP_FeedForward dd sz_feedforward
  703.         NNP_BackPropagation dd sz_backpropagation
  704.         NNP_GetMemData  dd sz_getmemdata
  705.         NNP_SetMemData  dd sz_setmemdata
  706.         NNP_Destroy     dd sz_destroy
  707. dd 0,0
  708.         sz_create       db 'NNP_Create',0
  709.         sz_reset        db 'NNP_Reset',0
  710.         sz_feedforward  db 'NNP_FeedForward',0
  711.         sz_backpropagation db 'NNP_BackPropagation',0
  712.         sz_getmemdata   db 'NNP_GetMemData',0
  713.         sz_setmemdata   db 'NNP_SetMemData',0
  714.         sz_destroy      db 'NNP_Destroy',0
  715.  
  716. align 4
  717. import_libc:
  718.         strlen dd sz_strlen
  719.         sprintf dd sz_sprintf
  720. dd 0,0
  721.         sz_strlen db 'strlen',0
  722.         sz_sprintf db 'sprintf',0
  723.  
  724. sc system_colors
  725.  
  726. align 16
  727. procinfo process_information
  728.  
  729. align 4
  730. buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  731.         dw 5 ;+4 left
  732.         dw 31 ;+6 top
  733. .w: dd 570 ;+8 w
  734. .h: dd 480 ;+12 h
  735. .color: dd 0xffffd0 ;+16 color
  736.         db 24 ;+20 bit in pixel
  737.  
  738. align 16
  739. i_end:
  740.         rb 2048
  741. stacktop:
  742.         sys_path rb 1024
  743.         file_name rb 4096
  744.         plugin_path rb 4096
  745.         openfile_path rb 4096
  746.         filename_area rb 256
  747. mem:
  748.