Skip to content

Commit

Permalink
TAG019 2020/05/04 5th
Browse files Browse the repository at this point in the history
  Compiler
    ・数値指定マクロも文字指定マクロも同じバッファを使用してしまっていたバグを修正
  • Loading branch information
kumatan committed May 4, 2020
1 parent b139c44 commit c47f6f0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
�X�V����
TAG019 2020/05/04 5th
Compiler
�E���l�w��}�N���������w��}�N���������o�b�t�@���g�p���Ă��܂��Ă����o�O���C��

TAG018 2020/05/04 4th
Compiler
�E���U�a�������̒����v�Z�̃o�O���C��
Expand Down
2 changes: 1 addition & 1 deletion PMDDotNETCompiler/hs_seg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public class hs_seg
public byte[] hsbuf2 = new byte[2 * 256];
public byte[] hsbuf3 = new byte[32 * 256];// hs_length * 256];
public int hsbuf_end;// label byte

internal byte[] currentBuf;
}
}
26 changes: 17 additions & 9 deletions PMDDotNETCompiler/mc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,10 @@ private void InitVariableBuffer()
{
hs_seg.hsbuf2[i] = 0;
}
for (int i = 0; i < hs_seg.hsbuf3.Length; i++)
{
hs_seg.hsbuf3[i] = 0;
}

for (int i = 0; i < 128 * 8; i++)
{
Expand Down Expand Up @@ -3155,6 +3159,7 @@ private enmPass2JumpTable hsset()
//hsset2:;
int ax = work.al * 2;
ax += 0;//offset hsbuf2
hs_seg.currentBuf = hs_seg.hsbuf2;
work.bx = ax;
goto hsset_main;

Expand All @@ -3164,12 +3169,13 @@ private enmPass2JumpTable hsset()
work.si = si_pp;
if (!cy) goto hsset_main;// 上書き
work.bx = 0;//offset hsbuf3
hs_seg.currentBuf = hs_seg.hsbuf3;

int cx = 256;
//hsset3_loop:;
do
{
if ((hs_seg.hsbuf3[work.bx] | hs_seg.hsbuf3[work.bx + 1]) == 0) goto hsset3b;
if ((hs_seg.currentBuf[work.bx] | hs_seg.currentBuf[work.bx + 1]) == 0) goto hsset3b;
work.bx += hs_seg.hs_length;
cx--;
} while (cx > 0);
Expand All @@ -3187,7 +3193,7 @@ private enmPass2JumpTable hsset()
{
alc = (work.si < mml_seg.mml_buf.Length ? mml_seg.mml_buf[work.si++] : (char)0x1a);
if (alc < '!') goto hsset3c;
hs_seg.hsbuf3[work.di++] = (byte)alc;
hs_seg.currentBuf[work.di++] = (byte)alc;
cx--;
} while (cx > 0);
//hsset3b_loop2:;
Expand All @@ -3213,8 +3219,8 @@ private enmPass2JumpTable hsset()
goto hsset_fin;
}
} while (alc >= (char)(' ' + 1));
hs_seg.hsbuf3[work.bx + 0] = (byte)work.si;
hs_seg.hsbuf3[work.bx + 1] = (byte)(work.si >> 8);
hs_seg.currentBuf[work.bx + 0] = (byte)work.si;
hs_seg.currentBuf[work.bx + 1] = (byte)(work.si >> 8);
hsset_fin:;
work.si = si_p;

Expand Down Expand Up @@ -8998,6 +9004,7 @@ private enmPass2JumpTable hscom()
//hscom2:;
ax = work.al * 2;
work.bx = 0;//offset hsbuf2
hs_seg.currentBuf = hs_seg.hsbuf2;
work.bx += ax;
goto hscom_main;

Expand All @@ -9018,7 +9025,7 @@ private enmPass2JumpTable hscom()
work.bx = work.dx;

hscom_main:;
ax = hs_seg.hsbuf3[work.bx] + hs_seg.hsbuf3[work.bx + 1] * 0x100;
ax = hs_seg.currentBuf[work.bx] + hs_seg.currentBuf[work.bx + 1] * 0x100;

// assume es:m_seg

Expand Down Expand Up @@ -9060,6 +9067,7 @@ private bool search_hs3()
byte ah = 0;
work.dx = -1;
work.bx = 0;//offset hsbuf3
hs_seg.currentBuf = hs_seg.hsbuf3;
work.di = work.bx + 2;
int cx = 256;
//hscom3_loop:;
Expand All @@ -9068,7 +9076,7 @@ private bool search_hs3()
int cx_p = cx;
int si_p = work.si;

if ((hs_seg.hsbuf3[work.bx] | hs_seg.hsbuf3[work.bx + 1]) == 0) goto hscom3_next;
if ((hs_seg.currentBuf[work.bx] | hs_seg.currentBuf[work.bx + 1]) == 0) goto hscom3_next;
cx = hs_seg.hs_length - 2;
work.al = 0;

Expand All @@ -9078,10 +9086,10 @@ private bool search_hs3()
{
ch = work.si < mml_seg.mml_buf.Length ? mml_seg.mml_buf[work.si] : (char)0x1a;
if (ch < '!') goto hscom3_chk;
if (hs_seg.hsbuf3[work.di] == 0) goto hscom3_next2;// 変数定義側が先に終わった場合は最小確認
if (hs_seg.currentBuf[work.di] == 0) goto hscom3_next2;// 変数定義側が先に終わった場合は最小確認

byte s = (byte)(work.si < mml_seg.mml_buf.Length ? mml_seg.mml_buf[work.si++] : (char)0x1a);
byte d = hs_seg.hsbuf3[work.di++];
byte d = hs_seg.currentBuf[work.di++];
if (s != d) goto hscom3_next;

work.al++;
Expand All @@ -9098,7 +9106,7 @@ private bool search_hs3()
goto hscom3_found;

hscom3_chk:;
if (hs_seg.hsbuf3[work.di] == 0) goto hscom3_found;
if (hs_seg.currentBuf[work.di] == 0) goto hscom3_found;
goto hscom3_next;

hscom3_next2:;
Expand Down
2 changes: 1 addition & 1 deletion PMDDotNETConsole/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"PMDDotNETConsole": {
"commandName": "Project",
"commandLineArgs": "/v C:\\Users\\kuma\\Desktop\\pmd\\nch_time.mml"
"commandLineArgs": "/v C:\\Users\\kuma\\Desktop\\pmd\\GSKID05.mml"
}
}
}

0 comments on commit c47f6f0

Please sign in to comment.