Code Monkey home page Code Monkey logo

Comments (4)

ped7g avatar ped7g commented on May 24, 2024

Thank you for report, but seems a bit inaccurate.

add a,32 does produce C6 20 in default mode, so no, it does not produce two add instructions.

What you have maybe seen is sub a,32 which in official Zilog syntax should be sub 32 (add a,32 is Zilog syntax).

Anyway, you are hitting the "multi-argument" default, I added --syntax option to fine tune some of the default behaviour, because I didn't like it either. You can apply them directly from the source code by OPT directive, like this:

# file opened: <stdin>
1     0000              start:  ; default mode will produce this:
2     0000 97 D6 20       sub a,32
3     0003 06 00          ld b,(start)
4     0005 62 6B          ld hl,de
5     0007                OPT --syntax=abf ; multi-arg delimiter ",,", warn about extra parentheses and fake instr.
6     0007 D6 20          sub a,32
<stdin>(7): error: Illegal instruction (can't access memory): (start)
7     0009 06 00          ld b,(start)
<stdin>(8): warning[fake]: Fake instruction: ld hl,de
8     000B 62 6B          ld hl,de
9     000D
# file closed: <stdin>

I always suggest to use --syntax=abf for new projects, but I can't change the default without making several old users angry (already tried it :) ).

I hope this is sufficient for you and helps, let me know (close the issue if this is what you were looking for and works as needed).

Check http://z00m128.github.io/sjasmplus/documentation.html#s_cli for --syntax options list.

from sjasmplus.

RobChaferDID avatar RobChaferDID commented on May 24, 2024

Ah, sorry, yes it was sub and not add. I tried your options and it didn't seem to produce any error for sub, even explicit in the source

CHARDATA PUSH DE
 OPT --syntax=abf ;
 SUB A,32
 LD H,0
 LD L,A
Executing task: c:\specnext\sjasmplus.exe C:\SpecNext\sources\Utility.asm --raw=c:\specnext\sources\scripts\Utility --zxnext=cspect --syntax=abf 

SjASMPlus Z80 Cross-Assembler v1.20.3 (https://github.com/z00m128/sjasmplus)
Pass 1 complete (0 errors)
Pass 2 complete (0 errors)
Utility.asm(107): warning[fake]: Fake instruction: SUB HL,DE
Utility.asm(327): warning[fake]: Fake instruction: LD IX,HL
Pass 3 complete
Errors: 0, warnings: 2, compiled: 375 lines, work time: 0.016 seconds

from sjasmplus.

ped7g avatar ped7g commented on May 24, 2024

It will not produce error, but it will produce only sub 32 accepting the explicit A silently.

To get multi-arg sub with the "--syntax=a" option you would have to write sub a,,32 (double comma), so you can't use the multi-arg by accident so easily. The only exception are push/pop/dec/inc which will accept single comma multi-arg even in syntax=a mode (as there's no ambiguity about these).

Whether you write the implicit A is optional, sjasmplus has pretty relaxed syntax to accept all common variants where possible and guess what you wanted to achieve.

Again see my example listing, the sub a,32 in default setting does produce machine code 97 D6 20 which is two sub instructions, after the OPT line it does produce only D6 20 which is the sub 32.

from sjasmplus.

RobChaferDID avatar RobChaferDID commented on May 24, 2024

Thanks for the clarification ... and the excellent assembler.

from sjasmplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.