anew 張燕南的中文符式系統 : 版本 cls cr ." 張燕南的中文符式系統 v1.89.08.30 " cr ; ( Q: 如何使用張燕南的中文符式系統 ? A: 首先 執行 Win32Forth fload CynForth.f bye 之後 執行 CynForth.exe 版本 如正確進入,則可看見如下訊息: " _ 張燕南的中文符式系統 v1.89.08.30 ok " Q: 如何擴大 Win32Forth 的應用記憶體空間為 4M Byte? A: 首先修改 Meta.f 中的 1024 1024 * 4 * sseparation \ 宣告為 4M Byte 執行 Win32forth fload meta.f setsize bye 或 捷徑 Meta Compile Kernel 將 application 改為 4194304 之後按下 save 會自動compile離開. 再執行 Fkernel.exe fload extend.f bye 或 捷徑 Make Win32Forth 即完成. Setting the available dictionary space to a very large value will cause slowdowns and possible crashes. You will need machine with at least 32 megabytes of memory. ) \ 必備的視窗物件 0 value 檔案選單視窗_ID FileOpenDialog 檔案選單文字 "檔案選單" "All Files|*.*|" FileOpenDialog 來源檔案選單文字 "來源檔案選單" "All Files|*.*|" FileOpenDialog 目標檔案選單文字 "目標檔案選單" "All Files|*.*|" :Object 檔案選單視窗 abs temp$ 1+ rel>abs NULL Call MessageBox drop ; ( ----------------------原 Win32Forth_v4.0 的詞 中文翻譯名詞---------------- ) \ 數值宣告的詞群 : 常數 constant ; : 變數 variable ; : 變值 value ; \ 用法如常數 , 但可用to 來改變內容 \ 操縱堆疊的詞群 ( 堆疊頂元素視為第零個元素 ) : 複製 dup ; \ 複製堆疊頂元素 : 丟棄 drop ; \ 除去堆疊頂元素 : 抽出 roll ; \ 抽出第n個元素放至堆疊頂 ( 2 roll 即同 rot ) \ Compiler and Interpreter Words : 更新 anew ; : 保留 allot ; : 字彙 vocabulary ; : 備妥 turnkey ; : 置放 place ; \ 字串處理 : 跳過 skip ; : 掃瞄 scan ; : 填字 ( 起始位置 字數 欲填字元 --- ) fill ; : 字元取代 ( 起始位置 字數 欲取代字元 取代字元 --- ) here temp$ ! c, c, begin temp$ @ 1 + c@ scan dup 0<> while over temp$ @ c@ swap c! repeat 2drop temp$ @ dp ! ; : 字串分割 ( 起始位置 長度 表位置 --- ) \ 使用前儘可能 push Temp$的內容;執行之後再 pop Temp$ dup 0 swap ! rot rot 2dup 13 32 字元取代 2dup 10 32 字元取代 rot here temp$ ! , over , begin 32 scan dup 0 <> while 32 skip temp$ @ @ dup @ 1 + swap ! temp$ @ 1 cells+ @ temp$ @ @ dup @ cells+ ! over temp$ @ 1 cells+ ! repeat 2drop temp$ @ dp ! ; : 補白 ( 起始位置 字數 --- ) blank ; : 擦清 ( 起始位置 字數 --- ) erase ; : 尋找字串 ( 起始位置 字數 欲找字串 欲找字串字數 --- 欲找字串起始位置 剩餘字數 旗號 ) search ; \ 操縱檔案的詞群 : 開檔 ( 檔名存放位置 檔名長度 檔案屬性 --- 檔頭序號 ) \ 2000/08/30_高凱科技 rot rot drop 1 - swap 2dup swap count rot open-file 0 <> if drop swap count rot create-file 0 <> if s" 開檔失敗!" 顯示錯誤訊息 then else rot rot 2drop then ; : 開舊檔 ( 檔名存放位置 檔名長度 檔案屬性 --- 檔頭序號 ) \ 2000/08/30_高凱科技 open-file 0 <> if s" 開舊檔失敗!" 顯示錯誤訊息 then ; : 關檔 ( 檔頭序號 --- ) \ 2000/08/30_高凱科技 close-file 0 <> if s" 關檔失敗!" 顯示錯誤訊息 then ; : 檔案大小? ( 檔頭序號 --- 低32爻 高32爻 ) \ 2000/08/30_高凱科技 file-size 0 <> if s" 檔案操作有誤!" 顯示錯誤訊息 bye then ; : 讀檔 ( 存放位置 長度 檔頭序號 --- 此次讀入的長度 ) \ 2000/08/30_高凱科技 read-file 0 <> if s" 讀檔失敗!" 顯示錯誤訊息 bye then ; : 寫檔 ( 起始位置 長度 檔頭序號 --- ) \ 2000/08/30_高凱科技 write-file 0 <> if s" 寫檔失敗!" 顯示錯誤訊息 bye then ; : 移動檔案指標 ( 低32爻位移值 高32爻位移值 檔頭序號 --- ) \ 2000/08/30_高凱科技 reposition-file 0 <> if s" 移動失敗!" 顯示錯誤訊息 bye then ; : 檔案選單 ( --- 檔名存放位置 檔名長度 ) \ 2000/08/30_高凱科技 GetHandle: 檔案選單視窗_ID Start: 檔案選單文字 dup c@ if count ( 2dup cr ." You are choosed " type cr ) else drop s" 檔案選擇錯誤" 顯示錯誤訊息 bye then Close: 檔案選單視窗 ; : 來源檔案選單 ( --- 檔名存放位置 檔名長度 ) \ 2000/08/30_高凱科技 GetHandle: 檔案選單視窗_ID Start: 來源檔案選單文字 dup c@ if count ( 2dup cr ." You are choosed " type cr ) else drop s" 來源檔案選擇錯誤" 顯示錯誤訊息 bye then Close: 檔案選單視窗 ; : 目標檔案選單 ( --- 檔名存放位置 檔名長度 ) \ 2000/08/30_高凱科技 GetHandle: 檔案選單視窗_ID Start: 目標檔案選單文字 dup c@ if count ( 2dup cr ." You are choosed " type cr ) else drop s" 目標檔案選擇錯誤" 顯示錯誤訊息 bye then Close: 檔案選單視窗 ; : 取新延伸檔名 ( 檔名起始位置 檔名長度 延伸檔名起始位置 延伸檔名長度 新檔名位置 --- ) dup 5 roll 5 roll 2dup ascii . scan swap drop - 1 + 2 roll place +place ; \ 系統 : 找詞 ( addr length --- cfa -1 | addr 0 ) drop 1- find ; \ 硬體界面 code pc! ( 資料 I/O_Port#number --- ) pop eax push dx mov dx, bx out dx, al pop dx pop ebx next c; code pc@ ( I/O_Port#number --- 資料 ) mov ax, bx push dx mov dx, ax in al, dx pop dx mov ebx, eax and ebx, # 0xff next c; ( ----------------------新系統執行檔名稱 : CynForth.exe & CynForth.img------ ) \ fsave CynForth