佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 23726|回复: 225

【闲聊】心情故事,咖啡座~

  [复制链接]
发表于 5-3-2011 12:50 AM | 显示全部楼层 |阅读模式
本帖最后由 pic 于 25-3-2011 12:30 PM 编辑

帖子本来是楼主分享控制SB16声霸卡 的PC源码, 但到后面跑题, 闲聊起来了, 大家也写起了自专, 侃侃而谈。
现在改主题, 大家来写自己的心情故事吧。。。毕竟, 要有知己才看懂, 才有共鸣的。。

欢迎大家写自己的心情故事。。。
如果是要发问题的, 可以发到
[交流] 电子技术交流区
PIC
25 Mar 2011

==========================================
这是我利用Turbo Pascal 7根据Creative Labs Sound Blaster 16的Technical Reference编写的模块。

不想白白浪费,特意公开给大家参考:相信对于拿SB16来Digital - Analog有用处。里面也有Timing的环节。


  1. unit Sound;
  2. {
  3.   Sound Service Unit
  4.   Revision 2 (1997-1998)
  5.   Developed by Boo Khan Ming

  6.   Provide direct access to Sound Blaster compatible sound card.

  7.   Featuring hardware diagnostic, full control of mixer settings and various
  8.   recording preferences.

  9.   Support sample playing and recording.
  10. }

  11. interface

  12. const
  13.   DirectSoundFormatID='DLS';

  14.   Mic=0;
  15.   CD=1;
  16.   Line=3;

  17. type
  18.   DirectSoundFormatType=record
  19.     ID:string[3];
  20.     Version:word;
  21.     Description:string;
  22.     HardwareRevision:word;
  23.     Frequency:word;
  24.     MasterVolume:word;
  25.     VoiceVolume:word;
  26.   end;

  27. var
  28.   MasterSignal,SlaveSignal:boolean;
  29.   VoicePointer,VoiceLength:longint;
  30.   RecordLength:word;
  31.   SoundCardBasePort:word;
  32.   DirectSoundFormat:DirectSoundFormatType;

  33. function AutoDetectSoundCard(var BasePort:word):boolean;
  34. procedure ResetDSP;
  35. procedure OutputDataDSP(Data:byte);
  36. function InputDataDSP:byte;
  37. procedure CheckDSPVersion(var Major,Minor:byte);
  38. function CheckSoundCardType:string;
  39. procedure NewTimerHandler; interrupt;
  40. procedure ChangeTimerFrequency(Frequency:word);
  41. procedure StartTimerHandler(NewVector:pointer;Frequency:word);
  42. procedure RestoreTimerHandler;

  43. procedure ResetVolumeSettings;
  44. procedure ChangeMasterVolume(Left,Right:byte);
  45. procedure ChangeVoiceVolume(Left,Right:byte);
  46. procedure ChangeMIDIVolume(Left,Right:byte);
  47. procedure ChangeCDVolume(Left,Right:byte);
  48. procedure ChangeLineVolume(Left,Right:byte);
  49. procedure ChangeMicVolume(Balance:byte);
  50. procedure CheckMasterVolume(var Left,Right:byte);
  51. procedure CheckVoiceVolume(var Left,Right:byte);
  52. procedure CheckMIDIVolume(var Left,Right:byte);
  53. procedure CheckCDVolume(var Left,Right:byte);
  54. procedure CheckLineVolume(var Left,Right:byte);
  55. procedure CheckMicVolume(var Balance:byte);

  56. procedure SelectVoiceInput(Source:byte);
  57. procedure EnableInputFilter;
  58. procedure DisableInputFilter;
  59. procedure EnableOutputFilter;
  60. procedure DisableOutputFilter;
  61. procedure SelectStereoOutput;
  62. procedure SelectMonoOutput;
  63. procedure SelectHighPassFilter;
  64. procedure SelectLowPassFilter;
  65. procedure ChangeSamplingRate(Rate:longint);

  66. function PrepareRecordVoice:boolean;
  67. procedure ShutRecordVoice;
  68. procedure RecordVoice;
  69. procedure PlayVoice;
  70. function SaveVoice(FileName:string;Description:string):boolean;
  71. function OpenVoice(FileName:string;Manual:boolean;var Description:string):boolean;

  72. implementation

  73. uses DOS,Swap,Mouse,Error;

  74. const
  75.   TemporaryVector=100;

  76.   ResetRegister=$06;
  77.   ReadDataRegister=$0a;
  78.   WriteCommandRegister=$0c;
  79.   WriteBufferRegister=$0c;
  80.   DataAvailableRegister=$0e;

  81.   ChannelRegister=$02;
  82.   MasterRegister=$22;
  83.   VoiceRegister=$04;
  84.   MIDIRegister=$26;
  85.   CDRegister=$28;
  86.   LineRegister=$2e;
  87.   MicRegister=$0a;

  88. var
  89.   Counter:word;
  90.   VoiceData:byte;
  91.   DirectSoundFile:file of byte;

  92. function AutoDetectSoundCard(var BasePort:word):boolean;
  93. const
  94.   RetryTime1=10;
  95.   RetryTime2=100;

  96. var
  97.   Counter1,Counter2:word;
  98.   Found:boolean;

  99. begin
  100.   BasePort:=$210;
  101.   Found:=False;
  102.   Counter1:=RetryTime1;

  103.   while (BasePort<=$260) and (not Found) do
  104.   begin
  105.     Port[BasePort+ResetRegister]:=1;
  106.     Port[BasePort+ResetRegister]:=0;

  107.     while (Counter2>RetryTime2) and (Port[BasePort+DataAvailableRegister]<128) do
  108.       Dec(Counter2);

  109.     if (Counter2=0) or (Port[BasePort+$a]<>$aa) then
  110.     begin
  111.       Dec(Counter1);

  112.       if Counter1=0 then
  113.       begin
  114.         Counter1:=RetryTime1;
  115.         BasePort:=BasePort+$10;
  116.       end;
  117.     end
  118.     else
  119.     begin
  120.       Found:=True;
  121.       SoundCardBasePort:=BasePort;
  122.     end;
  123.   end;

  124.   AutoDetectSoundCard:=Found;
  125. end;

  126. procedure ResetDSP;
  127. begin
  128.   Port[SoundCardBasePort+ResetRegister]:=1;
  129.   Port[SoundCardBasePort+ResetRegister]:=0;

  130.   while (Port[SoundCardBasePort+DataAvailableRegister] and 128)=0 do;
  131.   while not (Port[SoundCardBasePort+ReadDataRegister]=$aa) do;
  132. end;

  133. procedure OutputDataDSP(Data:byte);
  134. begin
  135.   while (Port[SoundCardBasePort+WriteBufferRegister] and 128)<>0 do;
  136.   Port[SoundCardBasePort+WriteCommandRegister]:=Data;
  137. end;

  138. function InputDataDSP:byte;
  139. begin
  140.   while (Port[SoundCardBasePort+DataAvailableRegister] and 128)=0 do;
  141.   InputDataDSP:=Port[SoundCardBasePort+ReadDataRegister];
  142. end;

  143. procedure CheckDSPVersion(var Major,Minor:byte);
  144. begin
  145.   OutputDataDSP($e1);
  146.   Major:=InputDataDSP;
  147.   Minor:=InputDataDSP;
  148. end;

  149. function CheckSoundCardType:string;
  150. var
  151.   Major,Minor:byte;

  152. begin
  153.   CheckDSPVersion(Major,Minor);

  154.   case Major of
  155.     1:CheckSoundCardType:='Sound Blaster';
  156.     2:CheckSoundCardType:='Sound Blaster Pro';
  157.     else
  158.       CheckSoundCardType:='Sound Blaster 16';
  159.   end;
  160. end;

  161. procedure ChangeTimerFrequency(Frequency:word);
  162. var
  163.   Counter:word;

  164. begin
  165.   Inline($fa);
  166.   Counter:=1193180 div Frequency;

  167.   Port[$43]:=$36;
  168.   Port[$40]:=Lo(Counter);
  169.   Port[$40]:=Hi(Counter);

  170.   Inline($fb);

  171.   DirectSoundFormat.Frequency:=Frequency;
  172. end;

  173. procedure StartTimerHandler(NewVector:pointer;Frequency:word);
  174. var
  175.   OldVector:pointer;

  176. begin
  177.   Inline($fa);

  178.   GetIntVec(8,OldVector);
  179.   SetIntVec(TemporaryVector,OldVector);
  180.   SetIntVec(8,NewVector);

  181.   ChangeTimerFrequency(Frequency);

  182.   Inline($fb);
  183. end;

  184. procedure RestoreTimerHandler;
  185. var
  186.   OldVector:pointer;

  187. begin
  188.   Inline($fa);

  189.   Port[$43]:=$36;
  190.   Port[$40]:=0;
  191.   Port[$40]:=0;

  192.   GetIntVec(TemporaryVector,OldVector);
  193.   SetIntVec(8,OldVector);

  194.   Inline($fb);
  195. end;

  196. procedure NewTimerHandler; {interrupt;}
  197. var
  198.   Register:Registers;

  199. begin
  200.   Dec(Counter);
  201.   if Counter=0 then
  202.   begin
  203.     Intr(TemporaryVector,Register);
  204.     Counter:=100 div 18;
  205.   end
  206.   else
  207.     Port[$20]:=$20;

  208.   MasterSignal:=not MasterSignal;
  209. end;

  210. procedure ResetVolumeSettings;
  211. begin
  212.   Port[SoundCardBasePort+$04]:=0;
  213.   Port[SoundCardBasePort+$05]:=0;
  214. end;

  215. procedure ChangeVolumeSettings(Left,Right:byte);
  216. begin
  217.   Port[SoundCardBasePort+$04]:=ChannelRegister;
  218.   Port[SoundCardBasePort+$05]:=(Left shl 4)+Right;
  219. end;

  220. procedure ChangeMasterVolume(Left,Right:byte);
  221. begin
  222.   Port[SoundCardBasePort+$04]:=MasterRegister;
  223.   Port[SoundCardBasePort+$05]:=(Left shl 4)+Right;
  224. end;

  225. procedure ChangeVoiceVolume(Left,Right:byte);
  226. begin
  227.   Port[SoundCardBasePort+$04]:=VoiceRegister;
  228.   Port[SoundCardBasePort+$05]:=(Left shl 4)+Right;
  229. end;

  230. procedure ChangeMIDIVolume(Left,Right:byte);
  231. begin
  232.   Port[SoundCardBasePort+$04]:=MIDIRegister;
  233.   Port[SoundCardBasePort+$05]:=(Left shl 4)+Right;
  234. end;

  235. procedure ChangeCDVolume(Left,Right:byte);
  236. begin
  237.   Port[SoundCardBasePort+$04]:=CDRegister;
  238.   Port[SoundCardBasePort+$05]:=(Left shl 4)+Right;
  239. end;

  240. procedure ChangeLineVolume(Left,Right:byte);
  241. begin
  242.   Port[SoundCardBasePort+$04]:=LineRegister;
  243.   Port[SoundCardBasePort+$05]:=(Left shl 4)+Right;
  244. end;

  245. procedure ChangeMicVolume(Balance:byte);
  246. begin
  247.   Port[SoundCardBasePort+$04]:=MicRegister;
  248.   Port[SoundCardBasePort+$05]:=Balance;
  249. end;

  250. procedure CheckMasterVolume(var Left,Right:byte);
  251. begin
  252.   Port[SoundCardBasePort+$04]:=MasterRegister;
  253.   Left:=(Port[SoundCardBasePort+$05] and $f0) shr 4;
  254.   Right:=Port[SoundCardBasePort+$05] and $0f;
  255. end;

  256. procedure CheckVoiceVolume(var Left,Right:byte);
  257. begin
  258.   Port[SoundCardBasePort+$04]:=VoiceRegister;
  259.   Left:=(Port[SoundCardBasePort+$05] and $f0) shr 4;
  260.   Right:=Port[SoundCardBasePort+$05] and $0f;
  261. end;

  262. procedure CheckMIDIVolume(var Left,Right:byte);
  263. begin
  264.   Port[SoundCardBasePort+$04]:=MIDIRegister;
  265.   Left:=(Port[SoundCardBasePort+$05] and $f0) shr 4;
  266.   Right:=Port[SoundCardBasePort+$05] and $0f;
  267. end;

  268. procedure CheckCDVolume(var Left,Right:byte);
  269. begin
  270.   Port[SoundCardBasePort+$04]:=CDRegister;
  271.   Left:=(Port[SoundCardBasePort+$05] and $f0) shr 4;
  272.   Right:=Port[SoundCardBasePort+$05] and $0f;
  273. end;

  274. procedure CheckLineVolume(var Left,Right:byte);
  275. begin
  276.   Port[SoundCardBasePort+$04]:=LineRegister;
  277.   Left:=(Port[SoundCardBasePort+$05] and $f0) shr 4;
  278.   Right:=Port[SoundCardBasePort+$05] and $0f;
  279. end;

  280. procedure CheckMicVolume(var Balance:byte);
  281. begin
  282.   Port[SoundCardBasePort+$04]:=MicRegister;
  283.   Balance:=Port[SoundCardBasePort+$05];
  284. end;

  285. procedure SelectVoiceInput(Source:byte);
  286. begin
  287.   Port[SoundCardBasePort+$04]:=$0c;
  288.   Port[SoundCardBasePort+$05]:=(Port[SoundCardBasePort+$05] and (not 7)) or ((Source shl 1) and 7);
  289. end;

  290. procedure EnableInputFilter;
  291. begin
  292.   Port[SoundCardBasePort+$04]:=$0c;
  293.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or 32;
  294. end;

  295. procedure DisableInputFilter;
  296. begin
  297.   Port[SoundCardBasePort+$04]:=$0c;
  298.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or (not 32);
  299. end;

  300. procedure EnableOutputFilter;
  301. begin
  302.   Port[SoundCardBasePort+$04]:=$0e;
  303.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or 64;
  304. end;

  305. procedure DisableOutputFilter;
  306. begin
  307.   Port[SoundCardBasePort+$04]:=$0e;
  308.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or (not 64);
  309. end;

复制代码



……待续
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 5-3-2011 12:51 AM | 显示全部楼层

……续上

本帖最后由 FlierMate_ 于 5-3-2011 12:52 AM 编辑
  1. procedure SelectStereoOutput;
  2. begin
  3.   Port[SoundCardBasePort+$04]:=$0e;
  4.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or 2;
  5. end;

  6. procedure SelectMonoOutput;
  7. begin
  8.   Port[SoundCardBasePort+$04]:=$0e;
  9.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or (not 2);
  10. end;

  11. procedure SelectHighPassFilter;
  12. begin
  13.   Port[SoundCardBasePort+$04]:=$0c;
  14.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or 8;
  15. end;

  16. procedure SelectLowPassFilter;
  17. begin
  18.   Port[SoundCardBasePort+$04]:=$0c;
  19.   Port[SoundCardBasePort+$05]:=Port[SoundCardBasePort+$05] or (not 8);
  20. end;

  21. procedure ChangeSamplingRate(Rate:longint);
  22. begin
  23.   Port[SoundCardBasePort+WriteBufferRegister]:=$40;
  24.   repeat until Port[SoundCardBasePort+WriteBufferRegister]<128;
  25.   Port[SoundCardBasePort+WriteBufferRegister]:=Round(256-1000000/Rate);
  26. end;

  27. function PrepareRecordVoice:boolean;
  28. begin
  29.   DefineDefaultSwapFile('SOUND.SWP');

  30.   if EstablishVirtualMemory(ByteType,60*4*1024*RecordLength,1)<>0 then
  31.   begin
  32.     PrepareRecordVoice:=False;
  33.     Exit;
  34.   end;

  35.   PrepareRecordVoice:=True;
  36. end;

  37. procedure ShutRecordVoice;
  38. begin
  39.   DisposeVirtualMemory;

  40.   VoicePointer:=0;
  41.   VoiceLength:=0;
  42. end;

  43. procedure RecordVoice;
  44. begin
  45.   VoicePointer:=0;

  46.   repeat
  47.     Port[SoundCardBasePort+WriteBufferRegister]:=$20;
  48.     repeat until Port[SoundCardBasePort+DataAvailableRegister]>=128;

  49.     EnterDataByte(0,VoicePointer,Port[SoundCardBasePort+ReadDataRegister]);
  50.     Inc(VoicePointer);

  51.     repeat until SlaveSignal=not MasterSignal;
  52.     SlaveSignal:=MasterSignal;

  53.     if GetMouseEvent<>0 then
  54.       Break;
  55.   until VoicePointer>=(60*4*1024*RecordLength);

  56.   VoiceLength:=VoicePointer;
  57.   repeat until GetMouseEvent=0;
  58. end;

  59. procedure PlayVoice;
  60. begin
  61.   VoicePointer:=0;

  62.   repeat
  63.     Port[SoundCardBasePort+WriteBufferRegister]:=$10;
  64.     repeat until Port[SoundCardBasePort+WriteBufferRegister]<128;

  65.     Port[SoundCardBasePort+WriteBufferRegister]:=EnquireDataByte(0,VoicePointer);
  66.     Inc(VoicePointer);

  67.     repeat until SlaveSignal=not MasterSignal;
  68.     SlaveSignal:=MasterSignal;

  69.     if GetMouseEvent<>0 then
  70.       Break;
  71.   until VoicePointer>=VoiceLength;

  72.   repeat until GetMouseEvent=0;
  73. end;

  74. function SaveVoice(FileName:string;Description:string):boolean;
  75. var
  76.   Major,Minor:byte;
  77.   Left,Right:byte;
  78.   Counter:word;

  79. begin
  80.   SaveVoice:=False;
  81.   VoicePointer:=0;

  82.   {$I-}
  83.   Assign(DirectSoundFile,FileName);
  84.   Rewrite(DirectSoundFile);
  85.   {$I+}
  86.   if IOResult<>0 then
  87.     Exit;

  88.   CheckDSPVersion(Major,Minor);

  89.   DirectSoundFormat.ID:=DirectSoundFormatID;
  90.   DirectSoundFormat.Version:=(1 shl 8) or (0);
  91.   DirectSoundFormat.HardwareRevision:=(Major shl 8) or (Minor);
  92.   DirectSoundFormat.Description:=Description;

  93.   CheckMasterVolume(Left,Right);
  94.   DirectSoundFormat.MasterVolume:=(Left shl 8) or Right;
  95.   CheckVoiceVolume(Left,Right);
  96.   DirectSoundFormat.VoiceVolume:=(Left shl 8) or Right;

  97.   {$I-}
  98.   for Counter:=1 to 3 do
  99.   begin
  100.     VoiceData:=Ord(DirectSoundFormat.ID[Counter]);
  101.     Write(DirectSoundFile,VoiceData);
  102.   end;

  103.   VoiceData:=Hi(DirectSoundFormat.Version);
  104.   Write(DirectSoundFile,VoiceData);
  105.   VoiceData:=Lo(DirectSoundFormat.Version);
  106.   Write(DirectSoundFile,VoiceData);

  107.   for Counter:=1 to 255 do
  108.   begin
  109.     VoiceData:=Ord(DirectSoundFormat.Description[Counter]);
  110.     Write(DirectSoundFile,VoiceData);
  111.   end;

  112.   VoiceData:=Hi(DirectSoundFormat.HardwareRevision);
  113.   Write(DirectSoundFile,VoiceData);
  114.   VoiceData:=Lo(DirectSoundFormat.HardwareRevision);
  115.   Write(DirectSoundFile,VoiceData);

  116.   VoiceData:=Hi(DirectSoundFormat.Frequency);
  117.   Write(DirectSoundFile,VoiceData);
  118.   VoiceData:=Lo(DirectSoundFormat.Frequency);
  119.   Write(DirectSoundFile,VoiceData);

  120.   VoiceData:=Hi(DirectSoundFormat.MasterVolume);
  121.   Write(DirectSoundFile,VoiceData);
  122.   VoiceData:=Lo(DirectSoundFormat.MasterVolume);
  123.   Write(DirectSoundFile,VoiceData);

  124.   VoiceData:=Hi(DirectSoundFormat.VoiceVolume);
  125.   Write(DirectSoundFile,VoiceData);
  126.   VoiceData:=Lo(DirectSoundFormat.VoiceVolume);
  127.   Write(DirectSoundFile,VoiceData);

  128.   repeat
  129.     VoiceData:=EnquireDataByte(0,VoicePointer);
  130.     Inc(VoicePointer);

  131.     Write(DirectSoundFile,VoiceData);
  132.   until VoicePointer>=VoiceLength;

  133.   Close(DirectSoundFile);
  134.   {$I+}
  135.   if IOResult<>0 then
  136.     Exit;

  137.   SaveVoice:=True;
  138. end;

  139. function OpenVoice(FileName:string;Manual:boolean;var Description:string):boolean;
  140. var
  141.   Counter:word;

  142. begin
  143.   OpenVoice:=False;
  144.   VoicePointer:=0;

  145.   {$I-}
  146.   Assign(DirectSoundFile,FileName);
  147.   Reset(DirectSoundFile);
  148.   {$I+}
  149.   if IOResult<>0 then
  150.     Exit;

  151.   {$I-}
  152.   for Counter:=1 to 3 do
  153.   begin
  154.     Read(DirectSoundFile,VoiceData);
  155.     DirectSoundFormat.ID:=DirectSoundFormat.ID+Chr(VoiceData);
  156.   end;

  157.   if DirectSoundFormat.ID<>DirectSoundFormatID then
  158.     Exit;

  159.   Read(DirectSoundFile,VoiceData);
  160.   DirectSoundFormat.Version:=VoiceData shl 8;
  161.   Read(DirectSoundFile,VoiceData);
  162.   DirectSoundFormat.Version:=DirectSoundFormat.Version or VoiceData;

  163.   Description:='';

  164.   for Counter:=1 to 255 do
  165.   begin
  166.     Read(DirectSoundFile,VoiceData);
  167.     Description:=Description+Chr(VoiceData);
  168.   end;

  169.   Read(DirectSoundFile,VoiceData);
  170.   DirectSoundFormat.HardwareRevision:=VoiceData shl 8;
  171.   Read(DirectSoundFile,VoiceData);
  172.   DirectSoundFormat.HardwareRevision:=DirectSoundFormat.Version or VoiceData;

  173.   Read(DirectSoundFile,VoiceData);
  174.   DirectSoundFormat.Frequency:=VoiceData shl 8;
  175.   Read(DirectSoundFile,VoiceData);
  176.   DirectSoundFormat.Frequency:=DirectSoundFormat.Version or VoiceData;

  177.   Read(DirectSoundFile,VoiceData);
  178.   DirectSoundFormat.MasterVolume:=VoiceData shl 8;
  179.   Read(DirectSoundFile,VoiceData);
  180.   DirectSoundFormat.MasterVolume:=DirectSoundFormat.Version or VoiceData;

  181.   Read(DirectSoundFile,VoiceData);
  182.   DirectSoundFormat.VoiceVolume:=VoiceData shl 8;
  183.   Read(DirectSoundFile,VoiceData);
  184.   DirectSoundFormat.VoiceVolume:=DirectSoundFormat.Version or VoiceData;

  185.   if not Manual then
  186.   begin
  187.     ChangeTimerFrequency(DirectSoundFormat.Frequency);
  188.     {if Hi(DirectSoundFormat.HardwareRevision)>=2 then
  189.     begin
  190.       ChangeMasterVolume(Hi(DirectSoundFormat.MasterVolume),Lo(DirectSoundFormat.MasterVolume));
  191.       ChangeVoiceVolume(Hi(DirectSoundFormat.VoiceVolume),Lo(DirectSoundFormat.VoiceVolume));
  192.     end;}
  193.   end;

  194.   repeat
  195.     Read(DirectSoundFile,VoiceData);

  196.     EnterDataByte(0,VoicePointer,VoiceData);
  197.     Inc(VoicePointer);
  198.   until (VoicePointer>=(60*4*1024*RecordLength)) or (EOF(DirectSoundFile));

  199.   VoiceLength:=VoicePointer;

  200.   Close(DirectSoundFile);
  201.   {$I+}
  202.   if IOResult<>0 then
  203.     Exit;

  204.   OpenVoice:=True;
  205. end;

  206. begin
  207.   SoundCardBasePort:=$220;
  208.   RecordLength:=5;
  209. end.
复制代码


--完--
回复

使用道具 举报

 楼主| 发表于 5-3-2011 12:57 AM | 显示全部楼层
忘了,那个SOUND.TPU模块需要SWAP.TPU(自编Virtual Memory R/W)

  1. unit Swap;
  2. {
  3.   Virtual Memory Service Unit
  4.   Revision 1997-1998
  5.   Developed by Boo Khan Ming

  6.   Enhanced Unit Version 2.0
  7.   Unit Version 2.1
  8.   Unit Version 3.0
  9.   Unit Version 4.0

  10.   Provides free virtual memory up to 2GB by establish links to swap file.
  11.   Employs independent data structure access.
  12.   Supports all types of data with variable string size.

  13.   Supported VM Data Types

  14.       Component
  15.                       Lo          Hi              Size
  16.       ?Byte           1           X               1
  17.       ?Char           2           X               1
  18.       ?Word           3           X               2
  19.       ?String         4           1-255, 0=255    1-255
  20.       ?Real           5           X               6

  21.       Chunk (Block Access)

  22.       ?Byte           1024


  23.   Allows unlimited capacity by using page switching technique.
  24.   Each page is handled separately.

  25.   Maximum virtual memory size allowed is 4.6 Exa bytes (18)
  26. }

  27. interface

  28. const
  29.   ByteType=1;
  30.   CharType=2;
  31.   WordType=3;
  32.   StringType=4;
  33.   RealType=5;
  34.   ByteChunkType=6;

  35. type
  36.   DataByteChunkType=array [0..1023] of byte;

  37. function EstablishVirtualMemory(PrVMType:word;PrVMSize:longint;PrVMPage:longint):byte;
  38. function DisposeVirtualMemory:boolean;
  39. procedure DefineDefaultSwapFile(NewFile:string);
  40. function EnquireDataByte(Page:longint;Index:longint):byte;
  41. function EnterDataByte(Page:longint;Index:longint;DataByte:byte):boolean;
  42. procedure EnquireDataByteChunk(Page:longint;Index:longint;var DataByteChunk:DataByteChunkType);
  43. function EnterDataByteChunk(Page:longint;Index:longint;DataByteChunk:DataByteChunkType):boolean;
  44. function EnquireDataChar(Page:longint;Index:longint):char;
  45. function EnterDataChar(Page:longint;Index:longint;DataChar:char):boolean;
  46. function EnquireDataWord(Page:longint;Index:longint):word;
  47. function EnterDataWord(Page:longint;Index:longint;DataWord:word):boolean;
  48. function EnquireDataString(Page:longint;Index:longint):string;
  49. function EnterDataString(Page:longint;Index:longint;DataString:string):boolean;
  50. function EnquireDataReal(Page:longint;Index:longint):real;
  51. function EnterDataReal(Page:longint;Index:longint;DataReal:real):boolean;

  52. implementation

  53. uses DOS,Disk;

  54. const
  55. {  DefaultSwapFile='SYSTEM.SWP';}
  56.   DefaultSwapDrive=3;
  57.   MaxVirtualMemorySize=2147483647;
  58.   MaxVirtualMemoryPage=2147483647;

  59. var
  60.   VMType:byte;              { Data types }
  61.   VMStringSize:byte;        { Size of string }
  62.   VMSize:longint;           { Size of data }
  63.   VMSwapFile:file;          { File handler }
  64.   VMSwapFilePath:string;    { Wwap file location }
  65.   VMSwapFilePtr:longint;    { File pointer }
  66.   VMLinkActive:boolean;     { Link active status }
  67.   DefaultSwapFile:string;   { Swap filename }
  68.   VMPage:longint;           { Total page }
  69.   VMPagePtr:longint;        { Selected page }
  70.   VMChunkSize:longint;

  71. function EstablishVirtualMemory(PrVMType:word;PrVMSize:longint;PrVMPage:longint):byte;

  72. {
  73.   Error codes   0 Successful
  74.                 1 Link violation error
  75.                 2 VM size overflow
  76.                 3 Invalid VM type
  77.                 4 Insufficient disk space
  78.                 5 Cannot create swap file
  79.                 255 Unknown error

  80.   Data structure subscript ranging from 0 to VMSize-1
  81.   Page subscript ranging from 0 to VMPage-1
  82. }

  83. begin
  84.   EstablishVirtualMemory:=255;
  85. {
  86.   if VMLinkActive then
  87.   begin
  88.     EstablishVirtualMemory:=1;
  89.     Exit;
  90.   end;
  91. }
  92.   VMPage:=PrVMPage;
  93.   if VMPage=0 then
  94.     VMPage:=1;

  95.   VMType:=Lo(PrVMType);
  96.   VMStringSize:=Hi(PrVMType);

  97.   if VMStringSize=0 then
  98.     VMStringSize:=255;
  99.   VMChunkSize:=1024;

  100.   case VMType of
  101.     ByteType:VMSize:=PrVMSize;
  102.     CharType:VMSize:=PrVMSize;
  103.     WordType:VMSize:=PrVMSize*2;
  104.     StringType:VMSize:=PrVMSize*VMStringSize;
  105.     RealType:VMSize:=PrVMSize*6;
  106.     ByteChunkType:VMSize:=PrVMSize*VMChunkSize;
  107.     else
  108.     begin
  109.       EstablishVirtualMemory:=3;
  110.       Exit;
  111.     end;
  112.   end;

  113.   VMSize:=Abs(VMSize);

  114.   if VMSize>MaxVirtualMemorySize then
  115.   begin
  116.     EstablishVirtualMemory:=2;
  117.     Exit;
  118.   end;

  119.   if DiskFree(0)<(VMSize*VMPage) then
  120.   begin
  121.     EstablishVirtualMemory:=4;
  122.     Exit;
  123.   end;

  124.   VMSwapFilePath:=CurrentFolder;
  125.   if VMSwapFilePath[Length(VMSwapFilePath)]='\' then
  126.     Dec(VMSwapFilePath[0]);
  127.   VMSwapFilePath:=VMSwapFilePath+'\'+DefaultSwapFile;

  128.   {$I-}
  129.   Assign(VMSwapFile,VMSwapFilePath);
  130.   Rewrite(VMSwapFile,1);
  131.   {$I+}
  132.   if IOResult<>0 then
  133.   begin
  134.     EstablishVirtualMemory:=5;
  135.     Exit;
  136.   end;

  137.   VMLinkActive:=True;
  138.   EstablishVirtualMemory:=0;
  139. end;

  140. function DisposeVirtualMemory:boolean;
  141. begin
  142.   if not VMLinkActive then
  143.   begin
  144.     DisposeVirtualMemory:=False;
  145.     Exit;
  146.   end;

  147.   {$I-}
  148.   Close(VMSwapFile);
  149.   Erase(VMSwapFile);
  150.   {$I+}
  151.   if IOResult<>0 then
  152.     DisposeVirtualMemory:=False
  153.   else
  154.     DisposeVirtualMemory:=True;

  155.   VMLinkActive:=False;
  156. end;

  157. procedure DefineDefaultSwapFile(NewFile:string);
  158. begin
  159.   DefaultSwapFile:=NewFile;
  160. end;

  161. function EnquireDataByte(Page:longint;Index:longint):byte;
  162. var
  163.   DataByte:byte;

  164. begin
  165.   EnquireDataByte:=0;

  166.   VMPagePtr:=Page;

  167.   if not VMLinkActive then
  168.     Exit;
  169.   if VMType<>ByteType then
  170.     Exit;
  171.   if VMPagePtr>VMPage-1 then
  172.     Exit;

  173.   Index:=Abs(Index);

  174.   if Index>VMSize-1 then
  175.   begin
  176.     {RunErrror(201);}
  177.     Exit;
  178.   end;

  179.   {$I-}
  180.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  181.   BlockRead(VMSwapFile,DataByte,1);
  182.   {$I+}
  183.   if IOResult=0 then
  184.     EnquireDataByte:=DataByte;
  185. end;

  186. function EnterDataByte(Page:longint;Index:longint;DataByte:byte):boolean;
  187. begin
  188.   EnterDataByte:=False;

  189.   VMPagePtr:=Page;

  190.   if not VMLinkActive then
  191.     Exit;
  192.   if VMType<>ByteType then
  193.     Exit;
  194.   if VMPagePtr>VMPage-1 then
  195.     Exit;

  196.   Index:=Abs(Index);

  197.   if Index>VMSize-1 then
  198.   begin
  199.     {RunErrror(201);}
  200.     Exit;
  201.   end;

  202.   {$I-}
  203.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  204.   BlockWrite(VMSwapFile,DataByte,1);
  205.   {$I+}
  206.   if IOResult=0 then
  207.     EnterDataByte:=True;
  208. end;

  209. procedure EnquireDataByteChunk(Page:longint;Index:longint;var DataByteChunk:DataByteChunkType);
  210. begin
  211.   VMPagePtr:=Page;

  212.   if not VMLinkActive then
  213.     Exit;
  214.   if VMType<>ByteChunkType then
  215.     Exit;
  216.   if VMPagePtr>VMPage-1 then
  217.     Exit;

  218.   Index:=Abs(Index*VMChunkSize);

  219.   if Index>VMSize-1 then
  220.   begin
  221.     {RunErrror(201);}
  222.     Exit;
  223.   end;

  224.   {$I-}
  225.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  226.   BlockRead(VMSwapFile,DataByteChunk,VMChunkSize);
  227.   {$I+}
  228.   if IOResult=0 then
  229.     Exit;
  230. end;

  231. function EnterDataByteChunk(Page:longint;Index:longint;DataByteChunk:DataByteChunkType):boolean;
  232. begin
  233.   EnterDataByteChunk:=False;

  234.   VMPagePtr:=Page;

  235.   if not VMLinkActive then
  236.     Exit;
  237.   if VMType<>ByteChunkType then
  238.     Exit;
  239.   if VMPagePtr>VMPage-1 then
  240.     Exit;

  241.   Index:=Abs(Index*VMChunkSize);

  242.   if Index>VMSize-1 then
  243.   begin
  244.     {RunErrror(201);}
  245.     Exit;
  246.   end;

  247.   {$I-}
  248.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  249.   BlockWrite(VMSwapFile,DataByteChunk,VMChunkSize);
  250.   {$I+}
  251.   if IOResult=0 then
  252.     EnterDataByteChunk:=True;
  253. end;

  254. function EnquireDataChar(Page:longint;Index:longint):char;
  255. var
  256.   DataChar:char;

  257. begin
  258.   EnquireDataChar:=#0;

  259.   VMPagePtr:=Page;

  260.   if not VMLinkActive then
  261.     Exit;
  262.   if VMType<>CharType then
  263.     Exit;
  264.   if VMPagePtr>VMPage-1 then
  265.     Exit;

  266.   Index:=Abs(Index);

  267.   if Index>VMSize-1 then
  268.   begin
  269.     {RunErrror(201);}
  270.     Exit;
  271.   end;

  272.   {$I-}
  273.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  274.   BlockRead(VMSwapFile,DataChar,1);
  275.   {$I+}
  276.   if IOResult=0 then
  277.     EnquireDataChar:=DataChar;
  278. end;

  279. function EnterDataChar(Page:longint;Index:longint;DataChar:char):boolean;
  280. begin
  281.   EnterDataChar:=False;

  282.   VMPagePtr:=Page;

  283.   if not VMLinkActive then
  284.     Exit;
  285.   if VMType<>CharType then
  286.     Exit;
  287.   if VMPagePtr>VMPage-1 then
  288.     Exit;

  289.   Index:=Abs(Index);

  290.   if Index>VMSize-1 then
  291.   begin
  292.     {RunErrror(201);}
  293.     Exit;
  294.   end;

  295.   {$I-}
  296.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  297.   BlockWrite(VMSwapFile,DataChar,1);
  298.   {$I+}
  299.   if IOResult=0 then
  300.     EnterDataChar:=True;
  301. end;
复制代码
回复

使用道具 举报

 楼主| 发表于 5-3-2011 12:59 AM | 显示全部楼层

……续上

  1. function EnquireDataWord(Page:longint;Index:longint):word;
  2. var
  3.   DataWord:word;

  4. begin
  5.   EnquireDataWord:=0;

  6.   VMPagePtr:=Page;

  7.   if not VMLinkActive then
  8.     Exit;
  9.   if VMType<>WordType then
  10.     Exit;
  11.   if VMPagePtr>VMPage-1 then
  12.     Exit;

  13.   Index:=Abs(Index*2);

  14.   if Index>VMSize-1 then
  15.   begin
  16.     {RunErrror(201);}
  17.     Exit;
  18.   end;

  19.   {$I-}
  20.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  21.   BlockRead(VMSwapFile,DataWord,2);
  22.   {$I+}
  23.   if IOResult=0 then
  24.     EnquireDataWord:=DataWord;
  25. end;

  26. function EnterDataWord(Page:longint;Index:longint;DataWord:word):boolean;
  27. begin
  28.   EnterDataWord:=False;

  29.   VMPagePtr:=Page;

  30.   if not VMLinkActive then
  31.     Exit;
  32.   if VMType<>WordType then
  33.     Exit;
  34.   if VMPagePtr>VMPage-1 then
  35.     Exit;

  36.   Index:=Abs(Index*2);

  37.   if Index>VMSize-1 then
  38.   begin
  39.     {RunErrror(201);}
  40.     Exit;
  41.   end;

  42.   {$I-}
  43.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  44.   BlockWrite(VMSwapFile,DataWord,2);
  45.   {$I+}
  46.   if IOResult=0 then
  47.     EnterDataWord:=True;
  48. end;

  49. function EnquireDataString(Page:longint;Index:longint):string;
  50. var
  51.   DataString:string;

  52. begin
  53.   EnquireDataString:='';

  54.   VMPagePtr:=Page;

  55.   if not VMLinkActive then
  56.     Exit;
  57.   if VMType<>StringType then
  58.     Exit;
  59.   if VMPagePtr>VMPage-1 then
  60.     Exit;

  61.   Index:=Abs(Index*VMStringSize);

  62.   if Index>VMSize-1 then
  63.   begin
  64.     {RunErrror(201);}
  65.     Exit;
  66.   end;

  67.   {$I-}
  68.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  69.   BlockRead(VMSwapFile,DataString,VMStringSize);
  70.   {$I+}
  71.   if IOResult=0 then
  72.     EnquireDataString:=DataString;
  73. end;

  74. function EnterDataString(Page:longint;Index:longint;DataString:string):boolean;
  75. begin
  76.   EnterDataString:=False;

  77.   VMPagePtr:=Page;

  78.   if not VMLinkActive then
  79.     Exit;
  80.   if VMType<>StringType then
  81.     Exit;
  82.   if VMPagePtr>VMPage-1 then
  83.     Exit;

  84.   Index:=Abs(Index*VMStringSize);

  85.   if Index>VMSize-1 then
  86.   begin
  87.     {RunErrror(201);}
  88.     Exit;
  89.   end;

  90.   {$I-}
  91.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  92.   BlockWrite(VMSwapFile,DataString,VMStringSize);
  93.   {$I+}
  94.   if IOResult=0 then
  95.     EnterDataString:=True;
  96. end;

  97. function EnquireDataReal(Page:longint;Index:longint):real;
  98. var
  99.   DataReal:real;

  100. begin
  101.   EnquireDataReal:=0;

  102.   VMPagePtr:=Page;

  103.   if not VMLinkActive then
  104.     Exit;
  105.   if VMType<>RealType then
  106.     Exit;
  107.   if VMPagePtr>VMPage-1 then
  108.     Exit;

  109.   Index:=Abs(Index*6);

  110.   if Index>VMSize-1 then
  111.   begin
  112.     {RunErrror(201);}
  113.     Exit;
  114.   end;

  115.   {$I-}
  116.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  117.   BlockRead(VMSwapFile,DataReal,6);
  118.   {$I+}
  119.   if IOResult=0 then
  120.     EnquireDataReal:=DataReal;
  121. end;

  122. function EnterDataReal(Page:longint;Index:longint;DataReal:real):boolean;
  123. begin
  124.   EnterDataReal:=False;

  125.   VMPagePtr:=Page;

  126.   if not VMLinkActive then
  127.     Exit;
  128.   if VMType<>RealType then
  129.     Exit;
  130.   if VMPagePtr>VMPage-1 then
  131.     Exit;

  132.   Index:=Abs(Index*6);

  133.   if Index>VMSize-1 then
  134.   begin
  135.     {RunErrror(201);}
  136.     Exit;
  137.   end;

  138.   {$I-}
  139.   Seek(VMSwapFile,(VMPagePtr*VMSize)+Index);
  140.   BlockWrite(VMSwapFile,DataReal,6);
  141.   {$I+}
  142.   if IOResult=0 then
  143.     EnterDataReal:=True;
  144. end;

  145. begin
  146.   DefaultSwapFile:='SYSTEM.SWP';
  147.   VMLinkActive:=False;
  148.   VMPagePtr:=0;
  149. end.
复制代码
回复

使用道具 举报

发表于 5-3-2011 12:10 PM | 显示全部楼层
SB16, SB16 AWE32,AWE64, SB16 PCI, SB Live, 这些声卡, 我再熟悉不过了。。 因为, 是在马六甲生产的, 我当年在哪里工作。

SB Pro, SB16 , 当时是玩游戏必备的, 到了SB 16 AWE32, 就注重在音乐的播放。。
SB Live, 专注在音效, 环绕声。

你提供的源码, 在当时会是很有用的, 但是现在可能只是作为参考而已了。。
对了, 我2年前才回收了一些SB16的书,Programming reference, 要知道这些是当年很珍贵的资源啊。。
回复

使用道具 举报

发表于 5-3-2011 10:08 PM | 显示全部楼层
回复 5# pic

很好,不愧是有才干的版主。
我以前也很沉迷电子,但是纯属兴趣,今不昔比,结果最终选择了电脑。

对了,你所说SB16的Programming Reference不知道是不是我当年用RM10买的那本。


(posted by mobile)
回复

使用道具 举报

Follow Us
发表于 6-3-2011 10:17 AM | 显示全部楼层
我以前也很沉迷电子,但是纯属兴趣,今不昔比,结果最终选择了电脑。

我从小到大的兴趣就是电子, 电脑。。。QuickBasic, VisualBasic。。。
现在是偏向Microchip PIC MCU + C 编程。。。
但是, 我在想, 我还能做多久才? 老了~可能再3~5 年, 我就被淘汰了。。。现在要计划转型了。。

对了,你所说SB16的Programming Reference不知道是不是我当年用RM10买的那本。
FlierMate.. 发表于 5-3-2011 10:08 PM

RM10 买的? 正版?哪里买的?
我的是白色底,黑色字封面的书~, 从新加坡Creative Lab那里死讨才拿到的。。
我的编程很差, 只是做一些Direct ADC, Direct DAC,什么是DMA, IRQ 还是傻傻不会的。。。

实话说, 那时的新加坡人很看不起我们, 很多东西都是不分享的, 那时, 我最想学的是FFT, 但是门都没有。。。很感慨的说。。
那是用一张优质的SB16,通过FFT 演算,  来测试另一张Production生产的SB16 的音量, 失真等等。。
后来是用System One AP (Audio Precision)测试声卡


我到现在, 还保留AWE32, AWE64 Gold 的那些宣传呢~
我的厨有够乱的。。。那时有什么贴纸,我都用来遮丑 。。



回复

使用道具 举报

发表于 6-3-2011 04:53 PM | 显示全部楼层
回复 7# pic


    首先,謝謝你放上來你的珍藏,想不到你這傢伙挺會收藏!(對不起,語氣粗魯點。:-)

DAC,ADC,大家都好吧。DMA,IRQ當年會(現在可忘了沒有八成也有九成了,嘿)。FFT你會我不懂是啥。

C編程,你是用Turbo C嗎?PIC我還不知道全名呢,只知道Programmable Interrupt(?) Controller??好像電腦的主機板也有一個哦?

說起那些Technical Reference,除了SB16(我忘了是什麽顔色,我早弄丟了,哈),還有IBM PC Technical Reference,那個裏面什麽都有,連玩驅動器(Disk Drive)的指示燈一閃一亮都可以。電子嘛,去過最盡的是自製一排LED接去Parallel Port,然後用自製程序控制要怎麽閃怎麽亮(當時還未讀電腦工程係)---有一個弊端,我沒有用任何電阻在裏面!(哈,我不會計算電阻值)

大家自誇了一番,歸根究底,大家都是喜歡研究,喜歡科學的人。
回复

使用道具 举报


ADVERTISEMENT

发表于 6-3-2011 05:02 PM | 显示全部楼层
補充:那個SB16書本是吉隆坡Kotaraya樓上一閒電腦店擺放二手書那邊買的。不懂是不是正版。還有啊,不知道Ralf Brown's的PC Interrupts大全對大家有幫助嗎?以前RM70買,現在有在綫版本了。
回复

使用道具 举报

发表于 7-3-2011 06:24 PM | 显示全部楼层
FFT你會我不懂是啥。
FlierMate.. 发表于 6-3-2011 04:53 PM

Fast Fourier Transform
一种演算法~

C編程,你是用Turbo C嗎?

不是, 是PIC MCU 专用的CCS C.

PIC我還不知道全名呢,只知道Programmable Interrupt(?) Controller??好像電腦的主機板也有一個哦?
PIC (Peripheral Interface Controller), 是一种 MCU (Microcontroller unit)。



說起那些Technical Reference,除了SB16(我忘了是什麽顔色,我早弄丟了,哈),還有IBM PC Technical Reference,那個裏面什麽都有,連玩驅動器(Disk Drive)的指示燈一閃一亮都可以。

嗯, 你要是会ASM, 你是神了。。。在当时。。。



電子嘛,去過最盡的是自製一排LED接去Parallel Port,然後用自製程序控制要怎麽閃怎麽亮(當時還未讀電腦工程係)---有一個弊端,我沒有用任何電阻在裏面!(哈,我不會計算電阻值)

不妨参考看看:
【DIY】(初/中级):电脑遥控~~走马灯(电子跑灯)更新:26/12/06
http://cforum3.cari.com.my/viewthread.php?tid=447773&highlight=


大家自誇了一番,歸根究底,大家都是喜歡研究,喜歡科學的人。

知音难寻~


補充:那個SB16書本是吉隆坡Kotaraya樓上一閒電腦店擺放二手書那邊買的。不懂是不是正版。還有啊,不知道Ralf Brown's的PC Interrupts大全對大家有幫助嗎?以前RM70買,現在有在綫版本了。

现在没有人理Interrupt了。。都是Windows 在控制。。。

那个年代, 很喜欢一个软件, 叫SideKick。。。 你还有吗?
回复

使用道具 举报

发表于 7-3-2011 07:40 PM | 显示全部楼层
回复 10# pic


    沒你那麽程度高,你的確很本領。

那個LED跑燈,我確實那麽做(也是8粒),只是沒放1K Ohm的電阻啊?你的VB6 App還真厲害,可以Add Pattern(8粒LED的排陣)等等。那個.DLL是你自製的嗎?你也會Crystal Reports哦,利害,佩服。我沒有你那麽深,除了最厲害會一般的匯編(不過現在忘記了七七八八了),就是自製的程序語言編譯器(.COM Compiler)。後來,我比較偏向Business Logic Programming。

    SideKick我不知道是啥,它是什麽?關於電子的?你有沒有嘗試設計自己的操作系統OS?(先聲名我沒有。)

你有玩Mobile Windows編程嗎?還是Embedded編程就是Microcontroller的編程?恕我無知。
回复

使用道具 举报

发表于 7-3-2011 10:45 PM | 显示全部楼层
那個.DLL是你自製的嗎?你也會Crystal Reports哦,利害,佩服。
FlierMate.. 发表于 7-3-2011 07:40 PM

DLL 不是我做的。。老外写的, Window 98 以上, 不能直接控制I/O, 要通过DLL。
Crystal Reports 我没有用, 都是用VB 里的report, 难用到死。。。


除了最厲害會一般的匯編(不過現在忘記了七七八八了),就是自製的程序語言編譯器(.COM Compiler)。後來,我比較偏向Business Logic Programming。

ASM, 学黑客技术时, 摸过一点点, 也忘光了。。。
当时用MASM。。。

SideKick我不知道是啥,它是什麽?

哦。。你是8年纪的?

http://zh.wikipedia.org/wiki/SideKick
1984年 Borland 發佈了SideKick,這是一個結合了日程表、記事本和計算器功能的工具軟體,其顯著的特點是記憶體駐留(Terminate and Stay Resident -TSR),從而可以打斷正在正常執行的前臺程序,這個技術在 DOS 時代是獨一無二的。


   

關於電子的?你有沒有嘗試設計自己的操作系統OS?(先聲名我沒有。)

其实也是有, 如RTOS, uCLinux 之类的。。但是我没有用到那些OS。
只是有自己的Task Scheduler, 用来做简单的“伪”Multitasking。

你有玩Mobile Windows編程嗎?

用VB.net 写的玩过一次。。


還是Embedded編程就是Microcontroller的編程?恕我無知。

Embedded編程就是针对某种特定功能的电板写程序。。。
好象洗衣机, 冷气机, 里面不是有微电脑控制的吗?
就是编程来控制。。。 很类似。。

写出来的, 我们叫Firmware 。(PC 用的, 叫software)
回复

使用道具 举报

发表于 8-3-2011 01:51 AM | 显示全部楼层
回复 12# pic


    那麽囘事,Win98不能直接控制……,就像USB那樣需要驅動程序吧。

SideKick不太有印象。我是7字輩的,PCTools,Norton Utilities啊,還有那個能夠將1.44MB軟盤格式化后提升容量的忘記它的程序名稱了。還有CShow (Compuserve)的用來看圖片,當然少不了DOS Shell,太多,忘記了。我自己也有自製TSR的Text Mode Screen Capture和Viewer,等等,都是喜歡Technical多一點。怎知踏入社會,什麽都講Promotion,Price,Qty,Stock+Payroll+Billing,那些的Business Logic---都是我討厭的。你現在是幫人打工嗎?還是單靠興趣養活自己呢?

    原來Firmware也是Software。說起BASIC,當年還有BASIC-A,GW-BASIC呢!很想用VB1.0 for DOS,可是沒機會(我是VB2 for Win用起的)。

    我差一點就要製造自己的簡單Network Protocol,就是一條16比特的電纜,連接2架電腦,然後有Receiver,Transmitter.
可是放棄了。也差一點要製作基於MS-DOS的Operating Environment(Text Mode的Windows 95/98),裏面有各類工具,有File Manager,Text Viewer,Picture Viewer, Movie Maker, Sound Recorder,Calculater, Address Book等等(因爲這些個別程序已經有了),而且還有設定顔色、風格等等,可以鼠標操作,甚至還有‘Run...'(Exit to DOS),就是不會寫Device Driver才放棄,而且工程太大,一個人搞不定。當年的夢想沒有實現。

現在,Windows控制到完,我都沒什麽興趣。WinAPI不會,UI要跟Windows的,不然可以自創。


看看我的UI的其中2种風格(上邊是自創,仿效MS-EDIT;中閒是Turbo Vision提供,我改了顔色而已;下邊是Turbo Vision,沒改顔色)





全部都是本人僅有的收藏(那時大規模丟失了)

你也是7字輩?怎麽聼你說會被淘汰?
回复

使用道具 举报

发表于 8-3-2011 02:21 AM | 显示全部楼层


我以前也設計了一個LPT Monitor,只能看圖,不能用了吧(不可能Bypass Windows)
回复

使用道具 举报

发表于 8-3-2011 11:53 AM | 显示全部楼层
那麽囘事,Win98不能直接控制……,就像USB那樣需要驅動程序吧。

SideKick不太有印象。我是7字輩的,PCTools,Norton Utilities啊,還有那個能夠將1.44MB軟盤格式化后提升容量的忘記它的程序名稱了。還有CShow (Compuserve)的用來看圖片,當然少不了DOS Shell,太多,忘記了。我自己也有自製TSR的Text Mode Screen Capture和Viewer,等等,都是喜歡Technical多一點。怎知踏入社會,什麽都講Promotion,Price,Qty,Stock+Payroll+Billing,那些的Business Logic---都是我討厭的。你現在是幫人打工嗎?還是單靠興趣養活自己呢?
FlierMate.. 发表于 8-3-2011 01:51 AM

PCTools,Norton Utilities 再熟悉不过了。。
提升harddisk 的容量是“Stacker” program
CShow,当时著名的秀图软体, 开GIF, jpg 那时还没问世。

GWBasic, 也是再熟悉不过了。。 后来用Quickbasic,Visualbasic, 那些书还有在呢。。。
之前的书厨照片, 右下角, 右起第3,4本书。。。Visual basic, Advanced Quickbasic
我当宝的书。。。不舍得丢

VB basic for DOS, 不好用。。。
以前有写很多Quickbasic 的应用程序, 但是这些软件,我完全没了。。。 在一次的CIH virus 攻击下没了。。。
CIH, 你知道吧。。。  


    我差一點就要製造自己的簡單Network Protocol,就是一條16比特的電纜,連接2架電腦,然後有Receiver,Transmitter.
可是放棄了。也差一點要製作基於MS-DOS的Operating Environment(Text Mode的Windows 95/98),裏面有各類工具,有File Manager,Text Viewer,Picture Viewer, Movie Maker, Sound Recorder,Calculater, Address Book等等(因爲這些個別程序已經有了),而且還有設定顔色、風格等等,可以鼠標操作,甚至還有‘Run...'(Exit to DOS),就是不會寫Device Driver才放棄,而且工程太大,一個人搞不定。當年的夢想沒有實現。

没有玩到Network, 最常用是Laplink, FX, 用parallel port 链接两台电脑, 或Com port

現在,Windows控制到完,我都沒什麽興趣。WinAPI不會,UI要跟Windows的,不然可以自創。

WinAPI, 其实现在还会用。。当VB6没有那个功能的时候。。

看看我的UI的其中2种風格(上邊是自創,仿效MS-EDIT;中閒是Turbo Vision提供,我改了顔色而已;下邊是Turbo Vision,沒改顔色)

我quickbasic 的program 也有做到类似的, 不过, 我的Window 是固定, 不能移动。。
VB for DOS 的就可以。。 但是吃很多内存, 我不喜欢VB for DOS。

全部都是本人僅有的收藏(那時大規模丟失了)
你也是7字輩?怎麽聼你說會被淘汰?

我的收藏, 被CIH 干掉了。。。
CD 里可能有一些, 懒惰去翻了。。

7字輩的, 如果现在还在写程序, 不担忧吗?被淘汰是迟早的事。。
何况我是早7字的, 8088 年代的。。。360kB 5.25“ 软盘, DOS 3.0, 可以知道我很老了。。

上面我们讲的东西,这里没有几个人知道。。。哈哈。。。
回复

使用道具 举报

发表于 8-3-2011 05:09 PM | 显示全部楼层
回复 15# pic


    是啊,我也是8088 XT啊,當年是父親到吉隆坡的金河廣場買囘生平第一架價值RM4000多的電腦,父親還問我要熒幕有顔色還是沒有顔色的,我選了有顔色的(CGA 4-color啊!)。那時候打中文字還要靠RichWin等等的軟件,也是360kb/1.2mb的5.25" Floppy(古董店好像有比這更大張的Floppy Disk,我就沒有用過了),也當3.5" 1.44mb是最佳媒介---跟朋友交換文件啊等等。那時候的PC還沒有Hard Disk,只能用Floppy來boot呢。VBuster,檳城的Uncle Looi(還是Lim,不太記得)勒!CIH我確實不知道是什麽病毒,只知道那時候電腦中Stone病毒就開不到機了。那時電腦還有I/O Card,Joystick的端口。那時候要買VB3(喲,出了新版本哦),就到Imbi Plaza(那時候已經有了)買十多張3.5"的磁片回來Install......那時候沒有CD來burn。哈!

    看來你軟硬都行,我是說電子去到I.C.,PCB,那些你都很了不起(看了一些你其他的教學帖),電腦去到Windows的API,VB6和Reporting已經很不錯了。

    後來,有了BBS,我並沒有玩,等到14.4kbps的數據機出了,才簽購TMnet的1515,好慢哦,即使後來去到56kbps,也只是最快3KB/sec。Networking我比較差,WinSock是什麽基本上我也不太懂,只知道要使用同樣的Protocol兩架電腦以上才能溝通。

    你有聼過當時的教育部舉辦SOFTCOM嗎?我參加了1993年和1995年的,其實也是用Quick Basic(QB好像不能生成EXE,QuickBasic才能夠,是嗎?)寫了天文科學的軟体,結果SOFTCOM'93年我那隊拿了安慰獎(吉隆坡中華囯中),一人還拿到RM50(還是RM100)的獎金呢!
回复

使用道具 举报


ADVERTISEMENT

发表于 8-3-2011 07:00 PM | 显示全部楼层
本帖最后由 pic 于 8-3-2011 07:11 PM 编辑

我的也是CGA,8088 4Mhz, Turbo 10Mhz, (现在我的MCU 都32Mhz了) 只有两个360k的 5.25软盘, 640kB RAM, 那个mother board 还有在呢~
我考SPM前2~3星期前, 爸爸买回来的。。他说很便宜。。好像RM1200?
害我一直玩游戏。。

那时, 我有看少年周报。。 里面有一个叫电脑狂的教电脑。。basic
我就纸上谈兵的学起来了。。 我剪报, 到现在还有在呢。。。迟些拍上来看看。。

学校那时有一台Apple, 一台IBM, 但不是我这种小咖可以接触到的了。。。
后来, 马六甲有电脑公司, 出祖电脑, 按小时, 好像是RM3/小时。。很贵下。。
那时云吞面大的才卖RM1.50, 小的RM1.10, 我一个穷学生, 只是进去里面看人家玩游戏。。。
或朋友玩, 一起玩那种。。总之, 很高档就是了。。。

中文, 去买Disk, 然后请电脑公司copy汉威, 唯一能够在DOS 跑的。不会用。。。
只是玩算命的软件,看中文。。这样而已。。那时【倚天】 好像还没有推出。。
Richwin 是Win 3.1/98 的时候了的吧。。。除了立方TRichwin, 就是用CStar, NJStar

同学里, 有一个家里有电脑的, 就向他要软件。。 PCTools, GWbasic 等等。。
有一次开机, 显示: ”Your PC is now Stone“, 中Stone virus了, 不知道是什么。
去问同学, 他说, “什么? 你中Stone 了? 完蛋了。。你死定了。。” |||
当时, 还没有解毒软件。。。
后来就毕业了。。。没有继续问同学

后来, 去拉曼读书了。。 才找到McAfee xxx scan。。
Uncle Looi :Virusbuster:
“when you see virus, call Uncle looi”。。记得吧。。要钱买的。。
如果你去copy 他的disk, 他会放Virus 的。。。

关于 C.I.H virus, 那么出名。。你回忆一下吧。。。
http://zh.wikipedia.org/wiki/CIH%E7%97%85%E6%AF%92
它被认为是最有害的广泛传播的病毒之一,会破坏用户系统上的全部信息,在某些情况下,会重写系统的BIOS。因為CIH病毒的1.2和1.3版發作日期為4月26日(第一版本病毒創造出來的時間),正好是前蘇聯(位於今日烏克蘭)核電廠災害“切尔诺贝利核事故”的紀念日,故曾被認為病毒作者撰寫動機和切尔诺贝利事件有關,因此CIH病毒也被稱作切尔诺贝利(Chernobyl)病毒。
我的bios 没事, 但是harddisk 完蛋。。。要Fdisk, format 过


就这样, 我用8088 , 很长的一个时间。。
只是玩GWbasic, 玩游戏, 用GWbasic 写小游戏。。
拉曼第二年, 我开始了Industry Training。
我在taman Tun 一间电脑公司打工, EL-SYS Computer, 在这家公司, 学了很多的基本电脑硬件常识。。
如何Fdisk, format, install DOS, Lotus 123, havard Graphic, WordStar, CorelDraw, AutoCad R9,Win3.0 如何用Flying dutch man, 用parallel port copy file, 后来才是用FX link。
那时流行是。。80286, 80386-16 SX,80386-DX40
我生日时, 向爸爸要求升级电脑, 买了80386-DX40 (40Mhz),4M SIMM RAM, 80MB harddisk,1.2MB drive..VGA monitor, 在当时, 很高级, 很高兴了。。。
有了好的电脑, 硬碟里除了应用软件如 DOS 附的Qbasic, Autocad 2.18 , 很多游戏, 还有很少量,很珍贵的色情照片 (CShow)。

Turbo pascal, 没有学到。。。那时醉心在Autocad 绘图, protel AutoTrax 电路版。

毕业后,爸爸买了 SBPro + CDROM 2x, 哇~不得了。。。游戏玩到更凶了。。。
那时打工了, 1993有一点钱了。。为了玩游戏DOOM II
花RM400, 买了 RM100 x 1MB RAM, 我的386电脑就有8MB RAM 了。。。 疯狂~~RM400 不是小钱叻。。。



第一个 Joystick,是生日礼物~好像借给了表弟, 到现在都没有还。。。

后来, 开始有了Internet。。在工厂打工的时候, 用Netscape。。 www.Jumbo.com, tucows, 下载了很多源码。。
这时, 开始接触QuickBasic, 能编译exe了。。很高兴。。
Window 3.1 是当时比较流行的, 但是都喜欢用DOS。 (Win3.1 是跑在DOS 上面)

后来, Jaring 1515 来了。。去KL 的PC fair, 买了14.4Kbps Fax modem, 账号是朋友的, 没有上BBS。。
因为不会。。 都是email, IRC, ICQ后来也来了。。
一直到TMNet 1511,我才有TM net 的账号, 到今天还是Active的, 给TM RM24/年。。
那时,56kmodem 是很昂贵的东西, 有两种, k56Flex, X2。。。
后来买的是V90 还是什么, 忘了, 不过我记得买RM260, 那个Modem。
network 方面, 是工厂用ethernet cable, 用LanSmart 软件 链接了3台电脑,跑我的Quickbasic program,  很了不起了。。。


后来。。。后来。。。
呵呵。。。 好像写自传。。。算了。。够了。。呵呵。。。
回复

使用道具 举报

发表于 9-3-2011 12:36 AM | 显示全部楼层
本帖最后由 pic 于 9-3-2011 09:01 AM 编辑

在交换了彼此的联系方式后,以下是短消息对话:(彼此同意公开)

FlierMate..:

你有沒有聼過I.T.人(不知道電子的人)都自認Nerd?(就是不喜歡社交,喜歡靜靜一個人鑽研)

pic:

学电子的人, 要分享才会进步, 比如WKLoh, Chan314, flizlizt, 都是有分享的, 尤其是Wkloh。。
真是Nerd 的话,也不会混论坛吧。。呵呵

FlierMate..:

有時候我覺得自己分享其實是在自誇,可是有時候關鍵技術卻想留給自己而不願分享。
那我該不是Nerd,不過現實生活中我連一位朋友也沒有呢。論壇是我唯一與外界接觸的管道。我得好好看看你所介紹的網友的帖才行。說起來我還真的是發錯地方,發在自己也不知道的MCU單晶片的板塊,後來想起覺得應該發在第3個板塊(電技什麽的)

pic:

呵呵。。其实, 朋友多一些是好的。。互相学习。。
有关键的东西, 我也不会分享, 但是我会直接明说: 哦。。这是我的商业秘密哦, 他们也不会追问, 会醒目。。。
(有一些人不想分享的, 却说不知道, 说他不会, 这种我也不会理他了。。)
WKLoh, 我是最近才认识他的(新年前), 我们都聊很核心的问题, 那种就是一点就明, 就只是一个idea, 一句话那种。。
WK Loh,他算很强了, 某方面我不及他的, 但我也懂一些他不会的东西。。
IT 人, 是比较自私的。。。 你有源码, 只有你能做到, 你的价值在哪里, 不会轻易的告诉人的, 这种我能够理解。。。
有时候, 客户问我一些问题, 我只是大概讲, 但最关键的没有讲。。
后来他们偷抄我的东西, 我设计了硬体电路电板, Firmware他去找那些学生来重写。。。但是也是半桶水那样。。呵呵
后来的Visual Studio.net, 其实打击了很多高傲的programmer。。
一些以前你引以为傲的code, 现在一个Wizard 就轻松做到了。。。
令到一些菜鸟, 也能取代你。。虽然可能不是很完美, 但是都是达到目标了。。
我最后一份工, 就是IT enginner, 用VB6 来写程序, 控制一些机器的东西。。那时, 是很自豪的。。现在。。。唉。。。。。~~
呵呵  ~~
是~,发错帖, 其实应该是电脑联盟哪里。。
》現實生活中我連一位朋友也沒有呢
不至于啦。。朋友会有的, 同事也算啊~ 可能是没有能够交心的朋友吧
所以, 我说知音难寻~

FlierMate..:

你说的是,VS.NET真是全部一个指令包含了以前集合许多指令才能办到的事。
我不自豪了,因为我已经3年没当程序员了。现在帮忙家庭生意,可以说失业,正在申请福利局的失业救济金。惨吗?
能够设计电板在我看来真的很了不起。比起软件,硬件我觉得更加难设计和制造。我是有在攻读电脑工程设计过电板,都是参考印度出版社的电路来选然后复制出来而已,大概是那些门铃啊,计算器啊等等小型的。
知音对你来说我这个人应该是填补以上你说的同好的电脑软件部分吧?我的意思是他们是电子,而我不太懂电子,而是电脑,但是你(或许包括你介绍的那几位)却懂电子-电脑两大方面哦。很羡慕你。
回复

使用道具 举报

发表于 9-3-2011 01:13 PM | 显示全部楼层
回复 18# FlierMate..


一两个月没回来,好像多人鸟。
高手高手。

还要FFT没? 偶有源码。不错用一下。
我算是新生代,你们的电脑话题插不进。 我的第一台电脑就是windows 95, pentium mmx166鸟。
基本上windows 95的界面和现在的都差不多。

不过电脑生活都还蛮像,都是花钱打机。 upgrade这个upgrade那个。
还来玩overclock玩出火,cpu motherboard都挂掉。+_+".
回复

使用道具 举报

发表于 9-3-2011 06:26 PM | 显示全部楼层
回复 19# fritlizt


    你好,版主。

是的,我想看一看FFT的源码?可以吗?

     现在连几岁的小孩都会玩电脑了。

我的前经理(大我10多年)甚至告诉我他去过美国亲眼看过一间房这样大的电脑。

    所以,什么前有_ _,后有_ _。比不到的。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 29-3-2024 05:00 PM , Processed in 0.108488 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表