What is the meaning of M in the Z80 statement ADD A,M











up vote
1
down vote

favorite












Recently I have been trying to compile CP/M 2.2 from source. When I try to assemble, everything works except for the instructions ADD A,M and SBC A,M, which the assembler returns a syntax error. I have not done much Z80, so I am a little confused on what the source code means by M?



I am using the CP/M 2.2 Source (Z80 Mnemonics) from the Unofficial CP/M Website.










share|improve this question









New contributor




tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It might be helpful if you link the source in question and explain where you acquired it.
    – Raffzahn
    5 hours ago















up vote
1
down vote

favorite












Recently I have been trying to compile CP/M 2.2 from source. When I try to assemble, everything works except for the instructions ADD A,M and SBC A,M, which the assembler returns a syntax error. I have not done much Z80, so I am a little confused on what the source code means by M?



I am using the CP/M 2.2 Source (Z80 Mnemonics) from the Unofficial CP/M Website.










share|improve this question









New contributor




tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It might be helpful if you link the source in question and explain where you acquired it.
    – Raffzahn
    5 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











Recently I have been trying to compile CP/M 2.2 from source. When I try to assemble, everything works except for the instructions ADD A,M and SBC A,M, which the assembler returns a syntax error. I have not done much Z80, so I am a little confused on what the source code means by M?



I am using the CP/M 2.2 Source (Z80 Mnemonics) from the Unofficial CP/M Website.










share|improve this question









New contributor




tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Recently I have been trying to compile CP/M 2.2 from source. When I try to assemble, everything works except for the instructions ADD A,M and SBC A,M, which the assembler returns a syntax error. I have not done much Z80, so I am a little confused on what the source code means by M?



I am using the CP/M 2.2 Source (Z80 Mnemonics) from the Unofficial CP/M Website.







z80 assembly cp-m






share|improve this question









New contributor




tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 3 hours ago









Alex Hajnal

3,45031632




3,45031632






New contributor




tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 5 hours ago









tergav17

61




61




New contributor




tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






tergav17 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • It might be helpful if you link the source in question and explain where you acquired it.
    – Raffzahn
    5 hours ago


















  • It might be helpful if you link the source in question and explain where you acquired it.
    – Raffzahn
    5 hours ago
















It might be helpful if you link the source in question and explain where you acquired it.
– Raffzahn
5 hours ago




It might be helpful if you link the source in question and explain where you acquired it.
– Raffzahn
5 hours ago










2 Answers
2






active

oldest

votes

















up vote
2
down vote













In 8080 Assembler M is the memory referenced to by HL.



Depending on the assembler used this would be written as





  • ADD M (Original Intel 8080 syntax) or


  • ADD A,M (Later Intel syntax as used for example by CP/M's own ASM (*1))


The Z80 assembler equivalent would be





  • ADD A,(HL) (Zilog notation)




Are you sure the source you're compiling made for the Z80 (and a Z80 assembler) at all?



CP/M is by default writen in 8080 Assembly, not Z80 or any other substitute. It would make sense that the source you got is meant to be compiled with ASM, as this was the default assembler for CP/M. It would be unusual if it's formated for any later (Z80) assembler.



Wiki got some condensed remarks about the changes Zilog made to the 8080 Assembly Syntax, like the usage of full register as you might have expected in this example. DR's ASM was an inbetween product, adhering (mostly) to Intel syntax while supporting the Z80 as well.





*1 - Later assemblers where often able to compile 8080 as well as Z80 but using 8080 notaton.






share|improve this answer






























    up vote
    1
    down vote













    Depending on the compiler you use, you may need to explicitly state using preprocessor directives that you use 8080 commands. M80 uses .z80 and .8080 to instruct using respective instruction set mnemonics. See https://www.classic-computers.org.nz/system-80/software-manuals/manuals-Macro-80-Assembler.pdf page 20 (16 on the document's page).



    If it will not compile in 8080 mode (due to Z80 directives in the source), then it means that sources are altered.The easiest way is to replace M with (HL), but I would not be surprised if resulting executable will not work properly at all.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "648"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      tergav17 is a new contributor. Be nice, and check out our Code of Conduct.










      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f8546%2fwhat-is-the-meaning-of-m-in-the-z80-statement-add-a-m%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote













      In 8080 Assembler M is the memory referenced to by HL.



      Depending on the assembler used this would be written as





      • ADD M (Original Intel 8080 syntax) or


      • ADD A,M (Later Intel syntax as used for example by CP/M's own ASM (*1))


      The Z80 assembler equivalent would be





      • ADD A,(HL) (Zilog notation)




      Are you sure the source you're compiling made for the Z80 (and a Z80 assembler) at all?



      CP/M is by default writen in 8080 Assembly, not Z80 or any other substitute. It would make sense that the source you got is meant to be compiled with ASM, as this was the default assembler for CP/M. It would be unusual if it's formated for any later (Z80) assembler.



      Wiki got some condensed remarks about the changes Zilog made to the 8080 Assembly Syntax, like the usage of full register as you might have expected in this example. DR's ASM was an inbetween product, adhering (mostly) to Intel syntax while supporting the Z80 as well.





      *1 - Later assemblers where often able to compile 8080 as well as Z80 but using 8080 notaton.






      share|improve this answer



























        up vote
        2
        down vote













        In 8080 Assembler M is the memory referenced to by HL.



        Depending on the assembler used this would be written as





        • ADD M (Original Intel 8080 syntax) or


        • ADD A,M (Later Intel syntax as used for example by CP/M's own ASM (*1))


        The Z80 assembler equivalent would be





        • ADD A,(HL) (Zilog notation)




        Are you sure the source you're compiling made for the Z80 (and a Z80 assembler) at all?



        CP/M is by default writen in 8080 Assembly, not Z80 or any other substitute. It would make sense that the source you got is meant to be compiled with ASM, as this was the default assembler for CP/M. It would be unusual if it's formated for any later (Z80) assembler.



        Wiki got some condensed remarks about the changes Zilog made to the 8080 Assembly Syntax, like the usage of full register as you might have expected in this example. DR's ASM was an inbetween product, adhering (mostly) to Intel syntax while supporting the Z80 as well.





        *1 - Later assemblers where often able to compile 8080 as well as Z80 but using 8080 notaton.






        share|improve this answer

























          up vote
          2
          down vote










          up vote
          2
          down vote









          In 8080 Assembler M is the memory referenced to by HL.



          Depending on the assembler used this would be written as





          • ADD M (Original Intel 8080 syntax) or


          • ADD A,M (Later Intel syntax as used for example by CP/M's own ASM (*1))


          The Z80 assembler equivalent would be





          • ADD A,(HL) (Zilog notation)




          Are you sure the source you're compiling made for the Z80 (and a Z80 assembler) at all?



          CP/M is by default writen in 8080 Assembly, not Z80 or any other substitute. It would make sense that the source you got is meant to be compiled with ASM, as this was the default assembler for CP/M. It would be unusual if it's formated for any later (Z80) assembler.



          Wiki got some condensed remarks about the changes Zilog made to the 8080 Assembly Syntax, like the usage of full register as you might have expected in this example. DR's ASM was an inbetween product, adhering (mostly) to Intel syntax while supporting the Z80 as well.





          *1 - Later assemblers where often able to compile 8080 as well as Z80 but using 8080 notaton.






          share|improve this answer














          In 8080 Assembler M is the memory referenced to by HL.



          Depending on the assembler used this would be written as





          • ADD M (Original Intel 8080 syntax) or


          • ADD A,M (Later Intel syntax as used for example by CP/M's own ASM (*1))


          The Z80 assembler equivalent would be





          • ADD A,(HL) (Zilog notation)




          Are you sure the source you're compiling made for the Z80 (and a Z80 assembler) at all?



          CP/M is by default writen in 8080 Assembly, not Z80 or any other substitute. It would make sense that the source you got is meant to be compiled with ASM, as this was the default assembler for CP/M. It would be unusual if it's formated for any later (Z80) assembler.



          Wiki got some condensed remarks about the changes Zilog made to the 8080 Assembly Syntax, like the usage of full register as you might have expected in this example. DR's ASM was an inbetween product, adhering (mostly) to Intel syntax while supporting the Z80 as well.





          *1 - Later assemblers where often able to compile 8080 as well as Z80 but using 8080 notaton.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 4 hours ago

























          answered 5 hours ago









          Raffzahn

          44.5k5102179




          44.5k5102179






















              up vote
              1
              down vote













              Depending on the compiler you use, you may need to explicitly state using preprocessor directives that you use 8080 commands. M80 uses .z80 and .8080 to instruct using respective instruction set mnemonics. See https://www.classic-computers.org.nz/system-80/software-manuals/manuals-Macro-80-Assembler.pdf page 20 (16 on the document's page).



              If it will not compile in 8080 mode (due to Z80 directives in the source), then it means that sources are altered.The easiest way is to replace M with (HL), but I would not be surprised if resulting executable will not work properly at all.






              share|improve this answer

























                up vote
                1
                down vote













                Depending on the compiler you use, you may need to explicitly state using preprocessor directives that you use 8080 commands. M80 uses .z80 and .8080 to instruct using respective instruction set mnemonics. See https://www.classic-computers.org.nz/system-80/software-manuals/manuals-Macro-80-Assembler.pdf page 20 (16 on the document's page).



                If it will not compile in 8080 mode (due to Z80 directives in the source), then it means that sources are altered.The easiest way is to replace M with (HL), but I would not be surprised if resulting executable will not work properly at all.






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Depending on the compiler you use, you may need to explicitly state using preprocessor directives that you use 8080 commands. M80 uses .z80 and .8080 to instruct using respective instruction set mnemonics. See https://www.classic-computers.org.nz/system-80/software-manuals/manuals-Macro-80-Assembler.pdf page 20 (16 on the document's page).



                  If it will not compile in 8080 mode (due to Z80 directives in the source), then it means that sources are altered.The easiest way is to replace M with (HL), but I would not be surprised if resulting executable will not work properly at all.






                  share|improve this answer












                  Depending on the compiler you use, you may need to explicitly state using preprocessor directives that you use 8080 commands. M80 uses .z80 and .8080 to instruct using respective instruction set mnemonics. See https://www.classic-computers.org.nz/system-80/software-manuals/manuals-Macro-80-Assembler.pdf page 20 (16 on the document's page).



                  If it will not compile in 8080 mode (due to Z80 directives in the source), then it means that sources are altered.The easiest way is to replace M with (HL), but I would not be surprised if resulting executable will not work properly at all.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 19 mins ago









                  Anonymous

                  83316




                  83316






















                      tergav17 is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      tergav17 is a new contributor. Be nice, and check out our Code of Conduct.













                      tergav17 is a new contributor. Be nice, and check out our Code of Conduct.












                      tergav17 is a new contributor. Be nice, and check out our Code of Conduct.
















                      Thanks for contributing an answer to Retrocomputing Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f8546%2fwhat-is-the-meaning-of-m-in-the-z80-statement-add-a-m%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      數位音樂下載

                      When can things happen in Etherscan, such as the picture below?

                      格利澤436b