From: j8takagi Date: Thu, 7 Jun 2018 12:56:34 +0000 (+0900) Subject: 基本情報処理試験のフォルダを変更し、2018年春の分を追加 X-Git-Tag: v0.3p4~1 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bce17a4fab0759bd0818c44bdf3cd17edb388267;p=YACASL2.git 基本情報処理試験のフォルダを変更し、2018年春の分を追加 --- diff --git a/as/fe_tests/2008_04/Q09/token.casl b/as/exam_fe/2008_04/Q09/token.casl similarity index 100% rename from as/fe_tests/2008_04/Q09/token.casl rename to as/exam_fe/2008_04/Q09/token.casl diff --git a/as/fe_tests/2008_04/Q09/token_call.casl b/as/exam_fe/2008_04/Q09/token_call.casl similarity index 100% rename from as/fe_tests/2008_04/Q09/token_call.casl rename to as/exam_fe/2008_04/Q09/token_call.casl diff --git a/as/fe_tests/2008_10/Q09/ptn1.casl b/as/exam_fe/2008_10/Q09/ptn1.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/ptn1.casl rename to as/exam_fe/2008_10/Q09/ptn1.casl diff --git a/as/fe_tests/2008_10/Q09/ptn2.casl b/as/exam_fe/2008_10/Q09/ptn2.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/ptn2.casl rename to as/exam_fe/2008_10/Q09/ptn2.casl diff --git a/as/fe_tests/2008_10/Q09/ptn3.casl b/as/exam_fe/2008_10/Q09/ptn3.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/ptn3.casl rename to as/exam_fe/2008_10/Q09/ptn3.casl diff --git a/as/fe_tests/2008_10/Q09/ptn4.casl b/as/exam_fe/2008_10/Q09/ptn4.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/ptn4.casl rename to as/exam_fe/2008_10/Q09/ptn4.casl diff --git a/as/fe_tests/2008_10/Q09/test_ptn1/0.txt b/as/exam_fe/2008_10/Q09/test_ptn1/0.txt similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn1/0.txt rename to as/exam_fe/2008_10/Q09/test_ptn1/0.txt diff --git a/as/fe_tests/2008_10/Q09/test_ptn1/Makefile b/as/exam_fe/2008_10/Q09/test_ptn1/Makefile similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn1/Makefile rename to as/exam_fe/2008_10/Q09/test_ptn1/Makefile diff --git a/as/fe_tests/2008_10/Q09/test_ptn1/test_ptn1.casl b/as/exam_fe/2008_10/Q09/test_ptn1/test_ptn1.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn1/test_ptn1.casl rename to as/exam_fe/2008_10/Q09/test_ptn1/test_ptn1.casl diff --git a/as/fe_tests/2008_10/Q09/test_ptn2/0.txt b/as/exam_fe/2008_10/Q09/test_ptn2/0.txt similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn2/0.txt rename to as/exam_fe/2008_10/Q09/test_ptn2/0.txt diff --git a/as/fe_tests/2008_10/Q09/test_ptn2/Makefile b/as/exam_fe/2008_10/Q09/test_ptn2/Makefile similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn2/Makefile rename to as/exam_fe/2008_10/Q09/test_ptn2/Makefile diff --git a/as/fe_tests/2008_10/Q09/test_ptn2/test_ptn2.casl b/as/exam_fe/2008_10/Q09/test_ptn2/test_ptn2.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn2/test_ptn2.casl rename to as/exam_fe/2008_10/Q09/test_ptn2/test_ptn2.casl diff --git a/as/fe_tests/2008_10/Q09/test_ptn3/0.txt b/as/exam_fe/2008_10/Q09/test_ptn3/0.txt similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn3/0.txt rename to as/exam_fe/2008_10/Q09/test_ptn3/0.txt diff --git a/as/fe_tests/2008_10/Q09/test_ptn3/Makefile b/as/exam_fe/2008_10/Q09/test_ptn3/Makefile similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn3/Makefile rename to as/exam_fe/2008_10/Q09/test_ptn3/Makefile diff --git a/as/fe_tests/2008_10/Q09/test_ptn3/test_ptn3.casl b/as/exam_fe/2008_10/Q09/test_ptn3/test_ptn3.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn3/test_ptn3.casl rename to as/exam_fe/2008_10/Q09/test_ptn3/test_ptn3.casl diff --git a/as/fe_tests/2008_10/Q09/test_ptn4/0.txt b/as/exam_fe/2008_10/Q09/test_ptn4/0.txt similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn4/0.txt rename to as/exam_fe/2008_10/Q09/test_ptn4/0.txt diff --git a/as/fe_tests/2008_10/Q09/test_ptn4/Makefile b/as/exam_fe/2008_10/Q09/test_ptn4/Makefile similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn4/Makefile rename to as/exam_fe/2008_10/Q09/test_ptn4/Makefile diff --git a/as/fe_tests/2008_10/Q09/test_ptn4/test_ptn4.casl b/as/exam_fe/2008_10/Q09/test_ptn4/test_ptn4.casl similarity index 100% rename from as/fe_tests/2008_10/Q09/test_ptn4/test_ptn4.casl rename to as/exam_fe/2008_10/Q09/test_ptn4/test_ptn4.casl diff --git a/as/fe_tests/2008_10/Q13/summary.casl b/as/exam_fe/2008_10/Q13/summary.casl similarity index 100% rename from as/fe_tests/2008_10/Q13/summary.casl rename to as/exam_fe/2008_10/Q13/summary.casl diff --git a/as/fe_tests/2008_10/Q13/testsummary/0.txt b/as/exam_fe/2008_10/Q13/testsummary/0.txt similarity index 100% rename from as/fe_tests/2008_10/Q13/testsummary/0.txt rename to as/exam_fe/2008_10/Q13/testsummary/0.txt diff --git a/as/fe_tests/2008_10/Q13/testsummary/Makefile b/as/exam_fe/2008_10/Q13/testsummary/Makefile similarity index 100% rename from as/fe_tests/2008_10/Q13/testsummary/Makefile rename to as/exam_fe/2008_10/Q13/testsummary/Makefile diff --git a/as/fe_tests/2008_10/Q13/testsummary/testsummary.casl b/as/exam_fe/2008_10/Q13/testsummary/testsummary.casl similarity index 100% rename from as/fe_tests/2008_10/Q13/testsummary/testsummary.casl rename to as/exam_fe/2008_10/Q13/testsummary/testsummary.casl diff --git a/as/fe_tests/2009_04/Q12/muls.casl b/as/exam_fe/2009_04/Q12/muls.casl similarity index 100% rename from as/fe_tests/2009_04/Q12/muls.casl rename to as/exam_fe/2009_04/Q12/muls.casl diff --git a/as/fe_tests/2009_04/Q12/muls2.casl b/as/exam_fe/2009_04/Q12/muls2.casl similarity index 100% rename from as/fe_tests/2009_04/Q12/muls2.casl rename to as/exam_fe/2009_04/Q12/muls2.casl diff --git a/as/fe_tests/2009_04/Q12/muls2_call.casl b/as/exam_fe/2009_04/Q12/muls2_call.casl similarity index 100% rename from as/fe_tests/2009_04/Q12/muls2_call.casl rename to as/exam_fe/2009_04/Q12/muls2_call.casl diff --git a/as/fe_tests/2009_04/Q12/muls_call.casl b/as/exam_fe/2009_04/Q12/muls_call.casl similarity index 100% rename from as/fe_tests/2009_04/Q12/muls_call.casl rename to as/exam_fe/2009_04/Q12/muls_call.casl diff --git a/as/fe_tests/2009_10/Q12/outb.casl b/as/exam_fe/2009_10/Q12/outb.casl similarity index 100% rename from as/fe_tests/2009_10/Q12/outb.casl rename to as/exam_fe/2009_10/Q12/outb.casl diff --git a/as/fe_tests/2009_10/Q12/replace.casl b/as/exam_fe/2009_10/Q12/replace.casl similarity index 100% rename from as/fe_tests/2009_10/Q12/replace.casl rename to as/exam_fe/2009_10/Q12/replace.casl diff --git a/as/fe_tests/2009_10/Q12/replace_call.casl b/as/exam_fe/2009_10/Q12/replace_call.casl similarity index 100% rename from as/fe_tests/2009_10/Q12/replace_call.casl rename to as/exam_fe/2009_10/Q12/replace_call.casl diff --git a/as/fe_tests/2010_04/Q12/fadd.casl b/as/exam_fe/2010_04/Q12/fadd.casl similarity index 100% rename from as/fe_tests/2010_04/Q12/fadd.casl rename to as/exam_fe/2010_04/Q12/fadd.casl diff --git a/as/fe_tests/2010_10/Q12/lrevrs.casl b/as/exam_fe/2010_10/Q12/lrevrs.casl similarity index 100% rename from as/fe_tests/2010_10/Q12/lrevrs.casl rename to as/exam_fe/2010_10/Q12/lrevrs.casl diff --git a/as/fe_tests/2010_10/Q12/prevrs.casl b/as/exam_fe/2010_10/Q12/prevrs.casl similarity index 100% rename from as/fe_tests/2010_10/Q12/prevrs.casl rename to as/exam_fe/2010_10/Q12/prevrs.casl diff --git a/as/fe_tests/2010_10/Q12/revl.casl b/as/exam_fe/2010_10/Q12/revl.casl similarity index 100% rename from as/fe_tests/2010_10/Q12/revl.casl rename to as/exam_fe/2010_10/Q12/revl.casl diff --git a/as/fe_tests/2011_06/Q12/.gitignore b/as/exam_fe/2011_06/Q12/.gitignore similarity index 100% rename from as/fe_tests/2011_06/Q12/.gitignore rename to as/exam_fe/2011_06/Q12/.gitignore diff --git a/as/fe_tests/2011_06/Q12/Q12.txt b/as/exam_fe/2011_06/Q12/Q12.txt similarity index 100% rename from as/fe_tests/2011_06/Q12/Q12.txt rename to as/exam_fe/2011_06/Q12/Q12.txt diff --git a/as/fe_tests/2011_06/Q12/call_rotate.casl b/as/exam_fe/2011_06/Q12/call_rotate.casl similarity index 100% rename from as/fe_tests/2011_06/Q12/call_rotate.casl rename to as/exam_fe/2011_06/Q12/call_rotate.casl diff --git a/as/fe_tests/2011_06/Q12/call_rotate2.casl b/as/exam_fe/2011_06/Q12/call_rotate2.casl similarity index 100% rename from as/fe_tests/2011_06/Q12/call_rotate2.casl rename to as/exam_fe/2011_06/Q12/call_rotate2.casl diff --git a/as/fe_tests/2011_06/Q12/graph_five.casl b/as/exam_fe/2011_06/Q12/graph_five.casl similarity index 100% rename from as/fe_tests/2011_06/Q12/graph_five.casl rename to as/exam_fe/2011_06/Q12/graph_five.casl diff --git a/as/fe_tests/2011_06/Q12/out_pbm.casl b/as/exam_fe/2011_06/Q12/out_pbm.casl similarity index 100% rename from as/fe_tests/2011_06/Q12/out_pbm.casl rename to as/exam_fe/2011_06/Q12/out_pbm.casl diff --git a/as/fe_tests/2011_06/Q12/pbm16.casl b/as/exam_fe/2011_06/Q12/pbm16.casl similarity index 100% rename from as/fe_tests/2011_06/Q12/pbm16.casl rename to as/exam_fe/2011_06/Q12/pbm16.casl diff --git a/as/fe_tests/2011_06/Q12/rotate.casl b/as/exam_fe/2011_06/Q12/rotate.casl similarity index 100% rename from as/fe_tests/2011_06/Q12/rotate.casl rename to as/exam_fe/2011_06/Q12/rotate.casl diff --git a/as/fe_tests/2011_06/Q12/rotate2.casl b/as/exam_fe/2011_06/Q12/rotate2.casl similarity index 100% rename from as/fe_tests/2011_06/Q12/rotate2.casl rename to as/exam_fe/2011_06/Q12/rotate2.casl diff --git a/as/fe_tests/2011_10/Q12/Q12.txt b/as/exam_fe/2011_10/Q12/Q12.txt similarity index 100% rename from as/fe_tests/2011_10/Q12/Q12.txt rename to as/exam_fe/2011_10/Q12/Q12.txt diff --git a/as/fe_tests/2011_10/Q12/btod1.casl b/as/exam_fe/2011_10/Q12/btod1.casl similarity index 100% rename from as/fe_tests/2011_10/Q12/btod1.casl rename to as/exam_fe/2011_10/Q12/btod1.casl diff --git a/as/fe_tests/2011_10/Q12/btod2.casl b/as/exam_fe/2011_10/Q12/btod2.casl similarity index 100% rename from as/fe_tests/2011_10/Q12/btod2.casl rename to as/exam_fe/2011_10/Q12/btod2.casl diff --git a/as/fe_tests/2011_10/Q12/call_btod.casl b/as/exam_fe/2011_10/Q12/call_btod.casl similarity index 100% rename from as/fe_tests/2011_10/Q12/call_btod.casl rename to as/exam_fe/2011_10/Q12/call_btod.casl diff --git a/as/fe_tests/2011_10/Q12/call_div.casl b/as/exam_fe/2011_10/Q12/call_div.casl similarity index 100% rename from as/fe_tests/2011_10/Q12/call_div.casl rename to as/exam_fe/2011_10/Q12/call_div.casl diff --git a/as/fe_tests/2011_10/Q12/div.casl b/as/exam_fe/2011_10/Q12/div.casl similarity index 100% rename from as/fe_tests/2011_10/Q12/div.casl rename to as/exam_fe/2011_10/Q12/div.casl diff --git a/as/exam_fe/2018_04/call_mult.casl b/as/exam_fe/2018_04/call_mult.casl new file mode 100644 index 0000000..0d6c96b --- /dev/null +++ b/as/exam_fe/2018_04/call_mult.casl @@ -0,0 +1,12 @@ +MAIN START + LAD GR1,WD + CALL MULT + LD GR1,GR0 + LAD GR2,STR + CALL L2STR + ST GR0,LEN + OUT STR,LEN + RET +WD DC '12 45.' +STR DS 5 +LEN DS 1 diff --git a/as/exam_fe/2018_04/dtob.casl b/as/exam_fe/2018_04/dtob.casl new file mode 100644 index 0000000..91d4ca3 --- /dev/null +++ b/as/exam_fe/2018_04/dtob.casl @@ -0,0 +1,18 @@ +DTOB START + RPUSH + ADDL GR2,GR1 + LAD GR0,0 ; 戻り値の初期化 +LP CPL GR1,GR2 ; 変換終了? + JZE FIN + LD GR4,0,GR1 ; 数字1文字の取出し + SUBL GR4,='0' ; 1 桁を数値に変換 + SLL GR0,1 ; GR0を10倍してGR4を加算 + LD GR5,GR0 + SLL GR5,2 + ADDL GR0,GR5 + ADDL GR0,GR4 + LAD GR1,1,GR1 + JUMP LP +FIN RPOP + RET + END diff --git a/as/exam_fe/2018_04/getwd.casl b/as/exam_fe/2018_04/getwd.casl new file mode 100644 index 0000000..47e69cd --- /dev/null +++ b/as/exam_fe/2018_04/getwd.casl @@ -0,0 +1,34 @@ +GETWD START + RPUSH + LD GR6,GR1 + LD GR7,GR2 + LD GR3,=-1 ; 数字列の処理状態フラグの初期化 + LAD GR6,-1,GR6 +LP LAD GR6,1,GR6 + LD GR4,0,GR6 ; 1文字の取出し + CPL GR4,='.' + JZE FIN + CPL GR4,=' ' + JNZ NUM + CALL SETWD + JUMP LP +NUM LD GR3,GR3 ; 数字列の処理中? + JZE LP + LD GR3,=0 ; 次の数字列の処理開始 + LD GR1,GR6 ; 数字列の先頭アドレスを退避 + JUMP LP +FIN CALL SETWD + LD GR2,=-1 + ST GR2,0,GR7 ; 数値の終わりを示す印を格納 + RPOP + RET +SETWD LD GR3,GR3 + JNZ FIN2 + LD GR2,GR6 + SUBL GR2,GR1 + CALL DTOB ; 数字列を数値に変換 + ST GR0,0,GR7 + LD GR3,=-1 ; 数字列の処理中状態を解除 + LAD GR7,1,GR7 +FIN2 RET + END diff --git a/as/exam_fe/2018_04/l2str.casl b/as/exam_fe/2018_04/l2str.casl new file mode 120000 index 0000000..c64e894 --- /dev/null +++ b/as/exam_fe/2018_04/l2str.casl @@ -0,0 +1 @@ +../../casl2lib/l2str.casl \ No newline at end of file diff --git a/as/exam_fe/2018_04/mult.casl b/as/exam_fe/2018_04/mult.casl new file mode 100644 index 0000000..255cd5a --- /dev/null +++ b/as/exam_fe/2018_04/mult.casl @@ -0,0 +1,20 @@ +MULT START + RPUSH + LAD GR2,CTBL + CALL GETWD + LD GR4,0,GR2 ; GR4 ← 被乗数 + LD GR5,1,GR2 ; GR5 ← 乗数 + LD GR0,=0 + LD GR5,GR5 +LP JZE FIN + LD GR3,GR5 + AND GR3,=#0001 ; 乗数の最下位ビットのチェック + JZE NEXT + ADDL GR0,GR4 +NEXT SLL GR4,1 ; 被乗数を1ビット左論理シフト + SRL GR5,1 + JUMP LP +FIN RPOP + RET +CTBL DS 3 ; GETWD用管理テーブル + END diff --git a/as/fe_tests/2011_10/Q12/call_div.o.casl b/as/fe_tests/2011_10/Q12/call_div.o.casl deleted file mode 100644 index 400f320..0000000 --- a/as/fe_tests/2011_10/Q12/call_div.o.casl +++ /dev/null @@ -1,37 +0,0 @@ -MAIN START - LAD GR1,#0000 ; #0000: #1210 #0000 - LAD GR2,#000F ; #0002: #1220 #000F - LAD GR3,#0009 ; #0004: #1230 #0009 - CALL #000B ; #0006: #8000 #000B - RET ; #0008: #8100 - NOP ; #0009: #0000 - DC 3 ; #000A: #0003 :: 3 = #0003 = 0000000000000011 - PUSH #0000,GR6 ; #000B: #7006 #0000 - PUSH #0000,GR7 ; #000D: #7007 #0000 - LD GR6,GR1 ; #000F: #1461 - LD GR7,GR2 ; #0010: #1472 - LD GR1,#0032 ; #0011: #1010 #0032 - LD GR2,#0033 ; #0013: #1020 #0033 - LD GR4,GR6 ; #0015: #1446 - LD GR5,GR7 ; #0016: #1457 - ADDL GR2,#0034 ; #0017: #2220 #0034 - JOV #001D ; #0019: #6600 #001D - JUMP #001F ; #001B: #6400 #001F - ADDL GR1,#0035 ; #001D: #2210 #0035 - SUBL GR6,#0000,GR3 ; #001F: #2363 #0000 - JOV #002F ; #0021: #6600 #002F - SUBL GR7,#0001,GR3 ; #0023: #2373 #0001 - JOV #0029 ; #0025: #6600 #0029 - JUMP #0015 ; #0027: #6400 #0015 - SUBL GR6,#0036 ; #0029: #2360 #0036 - JOV #002F ; #002B: #6600 #002F - JUMP #0015 ; #002D: #6400 #0015 - POP GR7 ; #002F: #7170 - POP GR6 ; #0030: #7160 - RET ; #0031: #8100 - DC 65535 ; #0032: #FFFF :: 65535 = #FFFF = 1111111111111111 - DC 65535 ; #0033: #FFFF :: 65535 = #FFFF = 1111111111111111 - DC 1 ; #0034: #0001 :: 1 = #0001 = 0000000000000001 - DC 1 ; #0035: #0001 :: 1 = #0001 = 0000000000000001 - DC 1 ; #0036: #0001 :: 1 = #0001 = 0000000000000001 - END diff --git a/doc/casl2_spec/casl2_spec.texi b/doc/casl2_spec/casl2_spec.texi index a28ed7a..2bde49e 100644 --- a/doc/casl2_spec/casl2_spec.texi +++ b/doc/casl2_spec/casl2_spec.texi @@ -413,15 +413,15 @@ COUNT1 START ; ; 処理 ; GR1 中の'1'のビットの個数を求める ; 出力 ; GR0:GR1 中の'1'のビットの個数 PUSH 0,GR1 ; - PUSH 0,GR2 ; Count = 0 - SUBA GR2,GR2 ; 全部のビットが'0'? - AND GR1,GR1 ; 全部のビットが'0'なら終了 - JZE RETURN ; Count = Count + 1 -MORE LAD GR2,1,GR2 ; 最下位の'1'のビット 1 個を - LAD GR0,-1,GR1 ; '0'に変える - AND GR1,GR0 ; '1'のビットが残っていれば繰返し - JNZ MORE ; GR0 = Count -RETURN LD GR0,GR2 ; + PUSH 0,GR2 ; + SUBA GR2,GR2 ; Count = 0 + AND GR1,GR1 ; 全部のビットが'0'? + JZE RETURN ; 全部のビットが'0'なら終了 +MORE LAD GR2,1,GR2 ; Count = Count + 1 + LAD GR0,-1,GR1 ; 最下位の'1'のビット 1 個を + AND GR1,GR0 ; '0'に変える + JNZ MORE ; '1'のビットが残っていれば繰返し +RETURN LD GR0,GR2 ; GR0 = Count POP GR2 ; POP GR1 ; RET ; 呼出しプログラムへ戻る diff --git a/doc/casl2_spec/images.mk b/doc/casl2_spec/images.mk deleted file mode 100644 index 96e21e4..0000000 --- a/doc/casl2_spec/images.mk +++ /dev/null @@ -1,8 +0,0 @@ -INKSCAPE := inkscape -z -CONVERT := convert - -%.png: %.svg - $(INKSCAPE) -y 0.0 -e $@ $< >$<2png.log 2>&1 - -%.eps: %.svg - $(INKSCAPE) -E $@ $< >$<2eps.log 2>&1 diff --git a/doc/casl2_spec/images.mk b/doc/casl2_spec/images.mk new file mode 120000 index 0000000..206aad6 --- /dev/null +++ b/doc/casl2_spec/images.mk @@ -0,0 +1 @@ +../images.mk \ No newline at end of file diff --git a/doc/exam_fe/.gitignore b/doc/exam_fe/.gitignore new file mode 100644 index 0000000..8ba3bd6 --- /dev/null +++ b/doc/exam_fe/.gitignore @@ -0,0 +1,3 @@ +*.html +*.pdf +*.eps diff --git a/doc/exam_fe/2018_04/Makefile b/doc/exam_fe/2018_04/Makefile new file mode 100644 index 0000000..3f46ec9 --- /dev/null +++ b/doc/exam_fe/2018_04/Makefile @@ -0,0 +1,21 @@ +VPATH := img + +CSS := ../style.css + +TEXITARGETS := fe_2018_04.html fe_2018_04.pdf + +.PHONY: all clean distclean + +all: $(TEXITARGETS) + +clean: texinfo-clean + $(RM) *.bak + $(MAKE) -C img clean + +distclean: clean texinfo-distclean + $(RM) *.d *.html *.pdf + $(MAKE) -C img distclean + +include ../texinfo_exam.mk + +include ../../images.mk diff --git a/doc/exam_fe/2018_04/fe_2018_04.texi b/doc/exam_fe/2018_04/fe_2018_04.texi new file mode 100644 index 0000000..e9f6a12 --- /dev/null +++ b/doc/exam_fe/2018_04/fe_2018_04.texi @@ -0,0 +1,289 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@ifnottex +@documentlanguage ja_JP +@end ifnottex +@setfilename exam_fe_2018h.info +@documentencoding UTF-8 +@settitle 基本技術情報者試験 2018å¹´ 春期 午後問題 +@firstparagraphindent insert +@paragraphindent 0 +@ifhtml +@exampleindent 0 +@end ifhtml +@c %**end of header + +@indicateurl{https://www.jitec.ipa.go.jp/1_04hanni_sukiru/mondai_kaitou_2018h30_1/2018h30h_fe_pm_qs.pdf} P.62〜P.66より + +@unnumbered 問12 +次のアセンブラプログラムの説明及びプログラムを読んで,設問1~3に答えよ。 + +@unnumberedsec 〔プログラム1の説明〕 +0~65534の整数を表す数字から成る文字列(以下,数字列という)を数値に変換する副プログラムDTOBである。 + +(1) 文字列は,DC命令の文字定数と同じ形式で主記憶に格納される。数字列567を 格納した例を,図1に示す。 + +@center @image{img/fig1,15cm,,,.svg} + +@center 図1 数字列の格納例 + +(2) 主プログラムは,数字列が格納されている領域の先頭アドレスをGR1に,数字列の長さをGR2に設定して,DTOBを呼ぶ。DTOBは,数値に変換して得た値をGR0に格納して呼出し元に戻る。 + +(3) 副プログラムDTOBから戻るとき,汎用レジスタGR1~GR7の内容は元に戻す。 + + +@unnumberedsubsec〔プログラム1〕 + +@verbatim +DTOB START + RPUSH + ADDL GR2,GR1 + LAD GR0,0 ; 戻り値の初期化 +LP CPL GR1,GR2 ; 変換終了? + JZE FIN + LD GR4,0,GR1 ; 数字1文字の取出し + SUBL GR4,='0' ; 1 桁を数値に変換 + SLL GR0,1 ; GR0を10倍してGR4を加算 + LD GR5,GR0 + ::ansbox:8:a:: + ADDL GR0,GR5 + ADDL GR0,GR4 + LAD GR1,1,GR1 + JUMP LP +FIN RPOP + RET + END +@end verbatim + +@unnumberedsec 設問1 + +プログラム1中の::ansbox:4::に入れる正しい答えを,解答群の中から選べ。 + +aに関する解答群 +@itemize @w{} + +@item +ア @code{ADDL GR5,GR4} + +@item +イ @code{SLL GR4,1} + +@item +ウ @code{SLL GR4,2} + +@item +エ @code{SLL GR5,1} + +@item +オ @code{SLL GR5,2} +@end itemize + +@unnumberedsec 設問2 + +文字列の先頭から数字列を探索し,順に,対応する数値を管理テーブルに格納する副プログラムGETWDを,DTOBを使用して作成した。プログラム2中の::ansbox:4::に入れる正しい答えを,解答群の中から選べ。 + + +@unnumberedsubsec 〔プログラム2の説明〕 + +(1) 文字列は,一つ以上の空白文字で区切られた任意の個数の数字列を含み,最後はピリオドで終わる。最後の数字列とピリオドの間,又は文字列の先頭に一つ以上の空白文字があってもよい。文字列の例を,図2に示す。 + + +@center @image{img/fig2,15cm,,,.svg} + +@center 図2 文字列の例 + +(2) 管理テーブルには,文字列中に数字列が現れるごとに,順に1 語から成る要素を追加し,数字列を数値に変換して得た値を格納する。数字列の探索が終了したとき,管理テーブルの最後に1 語から成る要素を追加し,数値の終わりを示す印として-1を格納する。図2の文字列をGETWDで処理して得た管理テーブルを,図3に示す。 + +@center @image{img/fig3,15cm,,,.svg} + +@center 図3 GETWDで処理して得た管理テーブル + +(3) 主プログラムは,文字列が格納されている領域の先頭アドレスをGR1に,管理テーブルの先頭アドレスをGR2に設定して,GETWDを呼ぶ。 + +(4) 副プログラムGETWDから戻るとき,汎用レジスタGR1~GR7の内容は元に戻す。 + +@unnumberedsubsec 〔プログラム2〕 + +@verbatim +GETWD START + RPUSH + LD GR6,GR1 + LD GR7,GR2 + LD GR3,=-1 ; 数字列の処理状態フラグの初期化 + LAD GR6,-1,GR6 +LP LAD GR6,1,GR6 + LD GR4,0,GR6 ; 1文字の取出し + CPL GR4,='.' + JZE FIN + CPL GR4,=' ' + ::ansbox:8:b:: + CALL SETWD + JUMP LP +NUM LD GR3,GR3 ; 数字列の処理中? + JZE LP + LD GR3,=0 ; 次の数字列の処理開始 + LD GR1,GR6 ; 数字列の先頭アドレスを退避 + JUMP LP +FIN CALL SETWD + LD GR2,=-1 + ST GR2,0,GR7 ; 数値の終わりを示す印を格納 + RPOP + RET +SETWD LD GR3,GR3 + ::ansbox:8:c:: + LD GR2,GR6 + SUBL GR2,GR1 + CALL DTOB ; 数字列を数値に変換 + ST GR0,0,GR7 + LD GR3,=-1 ; 数字列の処理中状態を解除 + ::ansbox:8:d:: +FIN2 RET + END +@end verbatim + + +bに関する解答群 +@itemize @w{} + +@item +ア @code{JNZ FIN} + +@item +イ @code{JNZ LP} + +@item +ウ @code{JNZ NUM} + +@item +エ @code{JZE FIN} + +@item +オ @code{JZE LP} + +@item +カ @code{JZE NUM} +@end itemize + +cに関する解答群 +@itemize @w{} + +@item +ア @code{JNZ FIN} + +@item +イ @code{JNZ FIN2} + +@item +ウ @code{JNZ NUM} + +@item +エ @code{JZE FIN} + +@item +オ @code{JZE FIN2} + +@item +カ @code{JZE NUM} +@end itemize + +d に関する解答群 + +@itemize @w{} +@item +ア @code{LAD GR6,1,GR1} + +@item +イ @code{LAD GR6,1,GR6} + +@item +ウ @code{LAD GR7,1,GR2} + +@item +エ @code{LAD GR7,1,GR7} + +@item +オ @code{LD GR6,GR1} + +@item +カ @code{LD GR7,GR2} +@end itemize + +@unnumberedsec 設問3 + +GETWDを使用して,二つの整数の積を求める副プログラムMULTを作成した。プログラム3中の::ansbox:4::に入れる正しい答えを,解答群の中から選べ。 + +@unnumberedsubsec 〔プログラム3の説明〕 + +(1) MULTは,数字列を二つだけ含む,〔プログラム2の説明〕の(1)で示した形式の文字列について,最初の数字列に対応する数値を被乗数とし,2番目の数字列に対応する数値を乗数として乗算を行う。乗算においてあふれは発生しないものとする。 + +(2) 主プログラムは,文字列が格納されている領域の先頭アドレスをGR1に設定して,MULTを呼ぶ。MULTは,演算結果をGR0に格納して呼出し元に戻る。 + +(3) 副プログラムMULTから戻るとき,汎用レジスタGR1~GR7の内容は元に戻す。 + +@unnumberedsubsec 〔プログラム3〕 + +@verbatim +MULT START + RPUSH + LAD GR2,CTBL + CALL GETWD + LD GR4,0,GR2 ; GR4 ← 被乗数 + LD GR5,1,GR2 ; GR5 ← 乗数 + LD GR0,=0 + LD GR5,GR5 +LP ::ansbox:8:e:: + LD GR3,GR5 + AND GR3,=#0001 ; 乗数の最下位ビットのチェック + JZE NEXT + ADDL GR0,GR4 +NEXT SLL GR4,1 ; 被乗数を1ビット左論理シフト + ::ansbox:8:f:: + JUMP LP +FIN RPOP + RET +CTBL DS 3 ; GETWD用管理テーブル + END +@end verbatim + +eに関する解答群 + +@itemize @w{} +@item +ア @code{JMI FIN} + +@item +イ @code{JMI NEXT} + +@item +ウ @code{JPL FIN} + +@item +エ @code{JPL NEXT} + +@item +オ @code{JZE FIN} + +@item +カ @code{JZE NEXT} +@end itemize + + +fに関する解答群 + +@itemize @w{} +@item +ア @code{ADDL GR0,GR5} + +@item +イ @code{ADDL GR5,GR4} + +@item +ウ @code{LD GR5,GR4} + +@item +エ @code{SLL GR5,1} + +@item +オ @code{SRL GR5,1} +@end itemize +@bye diff --git a/doc/exam_fe/2018_04/img/Makefile b/doc/exam_fe/2018_04/img/Makefile new file mode 100644 index 0000000..f54721f --- /dev/null +++ b/doc/exam_fe/2018_04/img/Makefile @@ -0,0 +1,9 @@ +all: $(foreach ext,.png .eps,$(addsuffix $(ext),$(basename $(wildcard *.svg)))) + +clean: + $(RM) *.log + +distclean: clean + $(RM) *.png *.eps *.jpg + +include ../../../images.mk diff --git a/doc/exam_fe/2018_04/img/fig1.svg b/doc/exam_fe/2018_04/img/fig1.svg new file mode 100644 index 0000000..f376f72 --- /dev/null +++ b/doc/exam_fe/2018_04/img/fig1.svg @@ -0,0 +1,20 @@ + + + + + + + + + + #0035 + #0036 + #0037 + + + (1語目) + (2語目) + (3語目) + + + diff --git a/doc/exam_fe/2018_04/img/fig2.svg b/doc/exam_fe/2018_04/img/fig2.svg new file mode 100644 index 0000000..af1cdb3 --- /dev/null +++ b/doc/exam_fe/2018_04/img/fig2.svg @@ -0,0 +1,11 @@ + + + + + △△1234△56789△△△9876△. + + 注記 + 空白文字は“△”と表示する + + + diff --git a/doc/exam_fe/2018_04/img/fig3.svg b/doc/exam_fe/2018_04/img/fig3.svg new file mode 100644 index 0000000..9ae0372 --- /dev/null +++ b/doc/exam_fe/2018_04/img/fig3.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + 1234 + 56789 + 9876 + -1 + + + 注記 + 数値は,10進数で表記している。 + + + diff --git a/doc/exam_fe/style.css b/doc/exam_fe/style.css new file mode 100644 index 0000000..b1d8a2c --- /dev/null +++ b/doc/exam_fe/style.css @@ -0,0 +1,174 @@ +body { + margin-left: 6em; + margin-right: 12em; + color: black; + background-color: #EEE; + font-family: sans-serif; +} + +h1, h2, h3, h4, h5, h6 { + color: navy; + background-color: inherit; +} + +h1, h2 { + margin-left: -2em; +} + +.node{ + margin-left: -3em; + color: inherit; + background-color: #DDF; +} + +.menu, .node { + color: inherit; + background-color: #DDF; +} + +table.menu, table.menu th, table.menu td { + border-style: none; +} + +h2 { + padding: 0.25em; +} + +.contents { + background-color: #DDF; + border: 4px double #000; + padding: 0.5em 1em 0.5em 1em; +} + +.contents h2 { + margin-left: 0; + color: black; + background-color: #DDF; +} + +.contents li { + list-style-type: none; +} + +.shortcontents { + background-color: #DDF; + border: 4px double #000; + } + +.shortcontents h2{ + display: none; +} + +h1.node-heading { + display: none; +} + +h2.contents-heading{ + display: none; +} + +h2.shortcontents-heading{ + display: none; +} + +.shortcontents a { + margin-right: 1em; +} + +h3, h4, h5 { + margin-left: -1em; +} + +h5 { + font-size: 100%; +} + +p { + line-height: 1.25em; + margin-top: 0; + margin-bottom: 0.5em; +} + +a:hover { + color: red; + text-decoration: underline; +} + +pre.example, pre.verbatim { + padding: 0.5em 1em 0.5em 1em; + border: 1px solid #CCC; + font-size: 120%; +} + +a { + text-decoration: none; +} + +blockquote { + line-height: 1.25em; + border: 1px solid #00F; +} + +kbd, code, .file, var { + font-style: normal; + font-weight: normal; + font-family: monospace; + font-size: 120%; + margin-left:0.25em; + margin-right: 0.25em; +} + +table, th, td { + border: 1px solid black; + border-collapse: collapse; /* 枠線の表示方法 */ + margin-bottom: 1em; +} + +table.cartouche, table.cartouche th, table.cartouche td { + border: none; +} + +pre.example .command, pre.example .option, pre.example kbd { + font-weight: bold; + font-family: monospace; + font-size: 110%; + background-color: inherit; + font-style: normal; + margin-left:0; + margin-right: 0; +} + +pre.example strong { + font: inherit; + border: 2px solid green; +} + +th, em { + font-style: normal; + font-weight: bold; + font-family: sans-serif; +} + +th { + text-align: center; +} + +dfn { + font-style: normal; +} + +.header, .menu { + display: none; +} + +.selection { + color: navy; + font-weight: bold; + margin-right: 1em; +} + +.ansbox { + border: 2px solid navy; + text-align: center; + display: inline-block; +} diff --git a/doc/exam_fe/texinfo_exam.mk b/doc/exam_fe/texinfo_exam.mk new file mode 100644 index 0000000..56c8cd1 --- /dev/null +++ b/doc/exam_fe/texinfo_exam.mk @@ -0,0 +1,78 @@ +.PHONY: texinfo-distclean texinfo-clean texinfo-textmp-clean + +CP := cp +DVIPDFMX := dvipdfmx +DVIPDFMX_FLAGS ?= +ECHO := echo +INSTALL-INFO := install-info +MAKEINFO_FLAGS ?= +MKDIR := mkdir +RMR := rm -rf +SED := sed +TEX := ptex +TEXI2DVI := TEX=$(TEX) texi2dvi +TEXI2DVI_FLAGS ?= -q --texinfo=@afourpaper +MV := mv + +# \includeコマンドで読み込まれるファイル +intexi = $(strip $(shell $(SED) -n -e 's/@include \(.*\)/\1/pg' $<)) + +# \imageコマンドで読み込まれるファイル +imagetexi = $(strip $(shell $(SED) -n -e 's/.*@image{\([^,]*\)\(,[^,]*,[^,]*,[^,]*,\([^,}]*\)\)}.*/\1\3/p' $<)) + +# 依存関係を自動生成し、dファイルに格納 +%.d: %.texi + @$(ECHO) '$@ is created by scanning $<.' + # texiファイルと出力ファイルの依存関係 + @$(ECHO) '$(foreach ext,.html _html .pdf .xml .info .txt .d,$(subst .texi,$(ext),$<)): $<' >$@ + # includeファイルの依存関係 + $(if $(intexi),@( \ + $(ECHO) >>$@; \ + $(ECHO) '# Include Files' >>$@; \ + $(ECHO) '$(foreach ext,.html _html .info .pdf .xml .txt,$<),$(subst .texi,$(ext),$<): $(intexi)') >>$@) + # imageファイルの依存関係 + # Docbookは未定義 + $(if $(imagetexi),@( \ + $(ECHO) >>$@; \ + $(ECHO) '# Image Files: HTML, HTML split, Info' >>$@; \ + $(ECHO) '$(foreach ext,.html _html .info,$(subst .texi,$(ext),$<)): $(imagetexi)' >>$@)) + $(if $(imagetexi),@( \ + $(ECHO) >>$@; \ + $(ECHO) '# Imagefiles: DVI -> PDF' >>$@; \ + $(ECHO) '$(subst .texi,.pdf,$<): $(addsuffix .eps,$(basename $(imagetexi)))' >>$@)) + +# 変数TEXITARGETSで指定されたターゲットファイルに対応するdファイルをインクルード +# .dファイルからヘッダファイルの依存関係を取得する +# ターゲットに clean が含まれている場合は除く +ifeq (,$(filter %clean,$(MAKECMDGOALS))) + -include $(addsuffix .d,$(basename $(TEXITARGETS))) +endif + +%.info: %.texi + $(MAKEINFO) $(MAKEINFO_FLAGS) -o $@ $< + +%.html: %.texi + $(MAKEINFO) -o $@ --no-split --html --css-include=$(CSS) $< + $(SED) -i '' -e 's%]*>%&%g' $@ + $(SED) -i '' -e 's% \([アイウエオカキクケコ]\)%\1%g' $@ + $(SED) -i '' -e 's%::ansbox:\([0-9]*\):*\([a-zA-Z]\)*::%\2\ %g' $@ + +%.html %_html: $(CSS) + +%.pdf: %.dvi + $(DVIPDFMX) $(DVIPDFMXFLAGS) $< + +%.txt: %.texi + $(MAKEINFO) --no-headers --disable-encoding -o $@ $< + +%.xml: %.texi + @$(MAKEINFO) --docbook -o $@ $< + +texinfo-distclean: texinfo-clean + $(RMR) *_html *.info *.html *.pdf *.dvi *.txt + +texinfo-clean: texinfo-textmp-clean + $(RM) *.d + +texinfo-textmp-clean: + $(RM) *.aux *.cp *.cps *.fn *.ky *.log *.pg *.pgs *.tmp *.toc *.tp *.vr diff --git a/doc/images.mk b/doc/images.mk new file mode 100644 index 0000000..96e21e4 --- /dev/null +++ b/doc/images.mk @@ -0,0 +1,8 @@ +INKSCAPE := inkscape -z +CONVERT := convert + +%.png: %.svg + $(INKSCAPE) -y 0.0 -e $@ $< >$<2png.log 2>&1 + +%.eps: %.svg + $(INKSCAPE) -E $@ $< >$<2eps.log 2>&1 diff --git a/doc/texinfo.mk b/doc/texinfo.mk index bd3c4d4..728091e 100644 --- a/doc/texinfo.mk +++ b/doc/texinfo.mk @@ -53,13 +53,13 @@ endif %.html: %.texi $(MAKEINFO) -o $@ --no-split --html --css-include=$(CSS) $< - $(SED) -i '' -e 's%[^%%g' $@ + $(SED) -i '' -e 's%]*>%&%g' $@ %_html: %.texi if test ! -e $@; then $(MKDIR) $@; fi $(CP) $(CSS) $@/ $(MAKEINFO) -o $@ --html --css-ref=$(CSS) $< - $(SED) -i '' -e 's%[^%%g' $@ + $(SED) -i '' -e 's%]*>%&%g' $@ %.html %_html: $(CSS)