gpt4 book ai didi

programming-languages - 这个旧程序是用什么语言编写的?

转载 作者:行者123 更新时间:2023-12-01 07:33:29 25 4
gpt4 key购买 nike

“嗨,你能为我重写一些东西吗”,我的老板说,“一些遗留代码”。是的,在中生代早期的某个地方编写的遗留代码。

我还有30个小时,我还是不知道,这是什么语法! VHLD? VBA?程序是专门用来做一些带有音频文件的,专门用来在DOS下运行的。

你能给我一个提示这是什么吗?如何编译它?

代码片段:

enter \ Load - main screen
empty forth definitions decimal
application warning on

: TITLE ." KCS version 0.8 28-Jan-06" cr ;

cr .( Compiling: ) title 2 load

cr .( Save to disk? ) y/n
[if]
\ pad reserve @ + 256 + limit s0 @ - + set-limit
turnkey program KCS
[then]



\ Load - defaults
variable RESERVE 0 reserve ! \ reserved memory tally
defer ?BREAK ' noop is ?break \ break check off
defer SET-IO ' bios-io is set-io \ default console mode
defer ERRFIX ' noop is errfix \ reset on-error handler

blk @ 1+ #screens 1- thru \ load electives & application

' (?break) is ?break \ enable user break
\ ' dos-io is set-io \ enable console redirection
\ ' deloutfile +is errfix \ delete outfile on error
\ wrtchk off \ disable overwrite check




\ Load - electives
1 fload DOSLIB \ load DOSLIB library

_Errors \ error handler
_Inout1 \ number output
_Inout2 \ string & number input
_String1 \ basic strings
\ _String2 \ extra strings
_Parsing \ command-line parsing
_Fileprims \ file primitives
_Files \ default files
_Bufinfile \ buffered input file
_Bufoutfile \ buffered output file


\ DECODE
\ Convert wave file to program
: DECODE ( -- )
0. decodecount 2! 0. paritycount 2! 0 errors !
skipheader
begin
['] decodebyte 1 ?catch 0=
while ( not EOF )


conout @ if emit else writechar then
1 decodecount m+!
repeat
.decoded ;




\ SETMODE
\ Select Kansas City Standard or Processor Tech. CUTS mode
: SETMODE ( -- )
mode @ if ( CUTS )
8 to databits 2 sbits ! 4 speed ! parity off pace off
nullcnt off
['] 0bit-sqr-cuts is 0bit-sqr ['] 1bit-sqr-cuts is 1bit-sqr
['] 0bit-sin-cuts is 0bit-sin ['] 1bit-sin-cuts is 1bit-sin
['] seekstart-cuts is seekstart ['] getbit-cuts is getbit
else ( KCS )
['] 0bit-sqr-kcs is 0bit-sqr ['] 1bit-sqr-kcs is 1bit-sqr
['] 0bit-sin-kcs is 0bit-sin ['] 1bit-sin-kcs is 1bit-sin
['] seekstart-kcs is seekstart ['] getbit-kcs is getbit
then ;


\ (RUN)
\ Run application
: (RUN) ( -- )
setmode
r/o openinfile
decoding @ if
conout @ 0= if r/w makeoutfile then
cr decode
else
r/w makeoutfile
cr encode
then
closefiles
;


\ DEFAULTS
\ Set application defaults
: DEFAULTS ( -- )
mode off decoding on strict off ignore off conout off
1 speed ! 2 sbits ! parity off 5 leadtime ! 10 nullchar !
pace off nullcnt off wave off tone off inverted off ;

defaults








\ RUN PROGRAM
\ Run application with error handling
: RUN ( -- )
['] (run) catch ?dup if >r errfix r> throw then ;

\ Main
: PROGRAM ( -- )
set-io \ set console mode
defaults \ set defaults
cr title \ show application name
parsecmd \ get options/filenames
run \ run application
cr ." done" \ show success
;

最佳答案

它写在 Forth ,可能是 DX-Forth 方言。程序解码和编码WAVE files包含 Kansas City standard format 中的数据.这种格式用于在早期 S-100 CP/M 机器的盒式磁带上记录数据。在网上搜索发现有一个 program written in DX-Forth可以解码和编码这种格式的 WAVE 文件,所以我猜这是你要重写的程序。

然而,与其重写这段代码,更简单的做法是使用已经完成这项工作的现有免费软件。例如有一个程序叫 py-kcs用 Python 编写,应该是一个功能性替代品,名为 hx-kcs用 Haxe 编写,可以进行解码。

关于programming-languages - 这个旧程序是用什么语言编写的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51349526/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com