From: j8takagi <info@j8takagi.net> Date: Sun, 28 Oct 2012 16:47:59 +0000 (+0900) Subject: CASL版の修正 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27d8dcae4d2f5427ae9a542b7a819121f76d9593;p=fizzbuzz.git CASL版の修正 --- diff --git a/casl/.gitignore b/casl/.gitignore new file mode 100644 index 0000000..5761abc --- /dev/null +++ b/casl/.gitignore @@ -0,0 +1 @@ +*.o diff --git a/casl/casl2lib/outa.casl b/casl/casl2lib/outa.casl deleted file mode 100644 index 6f8f84d..0000000 --- a/casl/casl2lib/outa.casl +++ /dev/null @@ -1,44 +0,0 @@ -;;; GR1ã«æ ¼ç´ãããå¤ãã10é²æ°ã®æ´æ°å¤ï¼-32768ã32767ï¼ã¨ãã¦è¡¨ç¤º -OUTA START - RPUSH - LAD GR2,10 ; GR2ã«10é²æ°ã®ã10ããæ ¼ç´ã - LAD GR0,0 ; GR0 <- 0 - LAD GR4,0 ; è² æ°ãã©ã°ãGR1ãè² æ°ã®å ´åãGR4ã¯1 - LAD GR5,0 ; æ´æ°å¤ã®é·ã - AND GR1,GR1 ; GR1ããã¹ã - JZE ZPRT ; GR1ã0ã®å ´åãZPRTã«ã¸ã£ã³ã - JPL STI ; GR1ãæ£æ°ã®å ´åãSTIã«ã¸ã£ã³ã - LAD GR4,1 ; GR1ãè² æ°ã®å ´åãGR4ããªã³ - CALL ABS ; GR1ãæ£æ°ã«å¤æ -STI CPL GR1,GR2 ; ã«ã¼ãå é ã(GR1 < GR2)ã®å ´åã¯ãã«ã¼ãè±åº - JMI STLST ; â - CALL DIVL ; GR1ã¨GR2ã®ãåãGR0ãå°ä½ãGR3ã«æ ¼ç´ - LD GR1,GR3 ; GR1ã«GR3ãã³ãã¼ - LD GR1,NCHAR,GR1 ; GR1ãæåã«å¤æ - ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - LD GR1,GR0 ; GR0ãGR1ã«ã³ãã¼ - JUMP STI ; ã«ã¼ãçµç«¯ -STLST LD GR1,NCHAR,GR1 ; GR1ãæåã«å¤æ - ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - AND GR4,GR4 ; æ£æ°ã®å ´å - JZE PRT ; â - LD GR1,='-' ; è² æ°ã®å ´åãã-ããSTRé åã«æ ¼ç´ - ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - JUMP PRT ; PRTã«ã¸ã£ã³ã -ZPRT LD GR1,NCHAR ; ã0ããSTRé åã«æ ¼ç´ - ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -PRT ST GR5,LEN ; LEN <- GR5 - LD GR2,LEN ; GR2ã«LENã®å¤ãæ ¼ç´ - LAD GR1,STR ; GR1ã«æååã®ã¢ãã¬ã¹ãæ ¼ç´ - CALL REV ; æååãéé ã«ä¸¦ã¹æ¿ã - OUT STR,LEN ; æååãåºå - RPOP - RET -STR DS 17 -LEN DS 1 -NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - END diff --git a/casl/casl2lib/outl.casl b/casl/casl2lib/outl.casl new file mode 100644 index 0000000..a2967d8 --- /dev/null +++ b/casl/casl2lib/outl.casl @@ -0,0 +1,36 @@ +;;; GR1ã«æ ¼ç´ãããå¤ãã10é²æ°ã®æ´æ°å¤ï¼0ã65535ï¼ã¨ãã¦è¡¨ç¤º +;;; ä¾åããã°ã©ã : DIVL, REV +OUTL START + RPUSH + LAD GR2,10 ; GR2ã«10é²æ°ã®ã10ããæ ¼ç´ã + LAD GR0,0 ; GR0 <- 0 + XOR GR4,GR4 ; æ´æ°å¤ã®é·ã + AND GR1,GR1 ; GR1ããã¹ã + JZE ZERO ; GR1ã0ã®å ´åãZEROã«ã¸ã£ã³ã +STI CPL GR1,GR2 ; ã«ã¼ãå é ã(GR1 < GR2)ã®å ´åã¯ãã«ã¼ãè±åº + JMI STLST ; â + CALL DIVL ; GR1ã¨GR2ã®ãåãGR0ãå°ä½ãGR3ã«æ ¼ç´ + LD GR1,GR3 ; GR1ã«GR3ãã³ãã¼ + LD GR1,NCHAR,GR1 ; GR1ãæåã«å¤æ + ST GR1,STR,GR4 ; (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; GR4 <- GR4 + 1 + LD GR1,GR0 ; GR0ãGR1ã«ã³ãã¼ + JUMP STI ; ã«ã¼ãçµç«¯ +STLST LD GR1,NCHAR,GR1 ; GR1ãæåã«å¤æ + ST GR1,STR,GR4 ; (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; GR4 <- GR4 + 1 + JUMP PRT ; PRTã«ã¸ã£ã³ã +ZERO LD GR1,NCHAR ; ã0ããSTRé åã«æ ¼ç´ + ST GR1,STR,GR4 ; â (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; â GR4 <- GR4 + 1 +PRT ST GR4,LEN ; LEN <- GR4 + LD GR2,LEN ; GR2ã«LENã®å¤ãæ ¼ç´ + LAD GR1,STR ; GR1ã«æååã®ã¢ãã¬ã¹ãæ ¼ç´ + CALL REV ; æååãéé ã«ä¸¦ã¹æ¿ã + OUT STR,LEN ; æååãåºå + RPOP + RET +STR DS 17 ; 符å·ä»ã2é²æ°ã§è¡¨è¨ããå ´åãæ³å® +LEN DS 1 +NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + END diff --git a/casl/fizzbuzz.casl b/casl/fizzbuzz.casl index 6c23dd3..fff05f0 100644 --- a/casl/fizzbuzz.casl +++ b/casl/fizzbuzz.casl @@ -46,7 +46,7 @@ CHKBUZ LD GR5,GR5 ; GR5ã®ãã©ã°å¤ãåå¾ PUTBUZ ST GR5,LEN ; LEN <- GR4 OUT BUZZ,LEN ;ãBuzzããåºå JUMP FIN ; FINã¸ã¸ã£ã³ã -PUTNUM CALL OUTA ; GR1ã®æ°å¤ã表示 +PUTNUM CALL OUTL ; GR1ã®æ°å¤ã表示 FIN RPOP RET FIZNUM DC 3