Jump to content
IGNORED

DASM - NEW RELEASE 2.20.11


Recommended Posts

First let me introduce myself: I am the Rhialto whose email got quoted some messages back. In the past I have made a number of feature additions to Dasm. I just registered here, mainly to join this thread.

I think it's great that there is still some development in Dasm.

 

Is there anyone who has write access to the dasm-dillon project on sourceforge to check these changes in? Or do we need (yet another) copy in a new location?

 


  • #6 - fixed STRLISTSIZE as suggested. 64-bit compiles of dasm now appear to work correctly.(Andrew)

 

I think this needs a few more small changes. STRLISTSIZE now occurs like this:

asm.h://#define STRLISTSIZE    4
asm.h:#define STRLISTSIZE    (sizeof(STRLIST)-4)
main.c:            sl = (STRLIST *)permalloc(STRLISTSIZE+1+strlen(buf));
ops.c:    base = (STRLIST *)ckmalloc(sizeof(STRLIST)-STRLISTSIZE+strlen(str)+1);
ops.c:        sl = (STRLIST *)ckmalloc(sizeof(STRLIST)-STRLISTSIZE+1+(str-s1));
ops.c:        newdir = (STRLIST *)permalloc(STRLISTSIZE + 1 + strlen(buf));

The ones in the middle with sizeof(STRLIST)-STRLISTSIZE are now wrong; that bit should just be STRLISTSIZE.

That's in v_execmac(), so I expect problems if you're using a macro expansion.

 

Oh, and when I looked at how this "STRLISTSIZE" got introduced and when it got used incorrectly in the first place, it seemed (from what limited past versions I could still find) that I might have been the person to introduce it, and use it incorrectly... oops!

Edited by Rhialto
  • Like 1
Link to comment
Share on other sites

Welcome Rhialto!

 

Thanks for signing up and flagging the issue! I agree it would be great to have the updates pushed back into the official version.

 

I've attached the updated code. Windows, Linux, and OS X x86 32-bit binaries are in the .zip file attached below. These builds should work on 64-bit systems.

 

[REMOVED - see later post]

Link to comment
Share on other sites

I just tried it, and it's not suppressing output properly until the final pass as my build does. I don't know if you just suppressed errors, but I suppressed everything until the last pass - for example, "echo" is not useful except at the last pass as earlier output is incorrect or at least redundant.

Link to comment
Share on other sites

I applied your patches to the code (with some translation required for code changes between dasm versions in asmerr) and I just figured error-only suppression was what you had wanted when I was testing.

 

Looking at the code with the expectation of output suppression, in your modified main.c you have an addmsg() function to build up the regular output message buffer, but it never gets called anywhere. Maybe this was an incomplete version of your patch?

Link to comment
Share on other sites

Yes, it does appear there is more. I also added stuff to ops.c and asm.h (but the only addiditon to asm.h was related to the branching fix which shouldn't be needed.)

 

The only change to ops.c is to the echo buffer:

v_echo(char *str, MNE *dummy)
{
    SYMBOL *sym = eval(str, 0);
    SYMBOL *s;
    char buf[256];

    for (s = sym; s; s = s->next) {
        if (!(s->flags & SYM_UNKNOWN)) {
            if (s->flags & (SYM_MACRO|SYM_STRING))
                sprintf(buf,"%s", s->string);
            else
                sprintf(buf,"$%lx", s->value);
            if (FI_listfile)
                fprintf(FI_listfile, " %s", buf);
           //printf(" %s", buf);
 addmsg(" ");
 addmsg(buf);
        }
    }
 addmsg("\n");
//    puts("");
    if (FI_listfile)
        putc('\n', FI_listfile);
}
I think this is a worthwhile change as it makes the output a lot cleaner (and correct!)
Link to comment
Share on other sites

Ah, echo and error suppression. I see where you're coming from now. By "everything" I was thinking the verbose pass output as well, which I was a bit confused about.

 

Here's the updated build which I believe is working as you expect.

 

[REMOVED - see later post for updated version]

Link to comment
Share on other sites

Have tried this version. I suspect the output supression is being a bit enthusiastic. For example, I have a macro that reports when a page is crossed incorrectly, and throws an ERR

The output is...

 

../dasm ./BoulderDash.asm -l../BoulderDash.txt -f3 -s../BoulderDash.sym -o../BoulderDash.bin
BANK_FIXED.asm (1240): error: ERR pseudo-op encountered.

Problem is, the macro is this...

    MAC CHECKPAGE
        LIST OFF
        IF >. != >{1}
            ECHO ""
            ECHO "ERROR: different pages! (", {1}, ",", ., ")"
            ECHO ""
            ERR
        ENDIF
        LIST ON
    ENDM

The ECHO should be output in this case. It is not.

So, IMHO the supression of output to the final pass needs reworking.

Link to comment
Share on other sites

Clearly it needs work, but I think it's a good idea. For example: without echo suppression, you'd get this:

@ $f100 : $0
 @ $f200 : $2
 @ $f300 : $4
 @ $f400 : $6
 @ $f500 : $8
 @ $f600 : $a
 @ $f700 : $c
 @ $f800 : $c
 @ $ffc7 : $71
 @ $fff4 : $71
 RAM code size:  $79  bytes
 *** Free  $71  bytes ***
 @ $f100 : $0
 @ $f200 : $2
 @ $f300 : $4
 @ $f400 : $6
 @ $f500 : $8
 @ $f600 : $a
 @ $f700 : $c
 @ $f800 : $c
old value: $00e2  new value: $00e1
old value: $00ef  new value: $00ee
old value: $0079  new value: $0078
 @ $ffc7 : $72
 @ $fff4 : $72
 RAM code size:  $78  bytes
 *** Free  $72  bytes ***
 @ $f100 : $0
 @ $f200 : $2
 @ $f300 : $4
 @ $f400 : $6
 @ $f500 : $8
 @ $f600 : $a
 @ $f700 : $c
 @ $f800 : $c
 @ $ffc7 : $72
 @ $fff4 : $72
 RAM code size:  $78  bytes
 *** Free  $72  bytes ***
There's no need for that redundant and incorrect output. What a properly-working assembler should display is this:
 @ $f100 : $0
 @ $f200 : $2
 @ $f300 : $4
 @ $f400 : $6
 @ $f500 : $8
 @ $f600 : $a
 @ $f700 : $c
 @ $f800 : $c
 @ $ffc7 : $72
 @ $fff4 : $72
 RAM code size:  $78  bytes
 *** Free  $72  bytes ***
I think that should be the goal. Obviously the method for doing that isn't working right yet.
Link to comment
Share on other sites

Yep, a preliminary glance at code shows that the message buffer is not being printed in some cases where it aborts due to errors. It's easy enough to fix, it's just a matter of finding all of the various ways that assembly can abort (there are various ways to abort and even scattered exit(1)'s in there.)

Link to comment
Share on other sites

Fixed. main.c attached [...]

Here are the binaries with your updated main.c...

 

[Removed. See later post for updated version]

 

Comments and further complaints are welcome. We already have our hands in the source, so we might as well make sure everybody feels that we've achieved progress with the fixes.

 

This might end with error-suppression (until last pass) and message-suppression (until last pass) being optional features, but I'm not sure we're at that point yet.

  • Like 1
Link to comment
Share on other sites

Any one of you kids know, which "illegal" opcodes are supported by DASM, that work on the 7800? Is there a list somewhere? :)

I believe all of the illegal opcodes are supported by DASM, at least, with some mnemonic.

 

It was suggested on the stella list that 2600 coders should stick to the opcodes marked as stable in the C64 docs. I think that likely applies to the 7800 too.

 

Here's a C64 doc with an illegal opcode list. Unstable illegals are noted.

  • Like 1
Link to comment
Share on other sites

Any one of you kids know, which "illegal" opcodes are supported by DASM, that work on the 7800? Is there a list somewhere? :)

 

I've edited the following list from DASM's mne6502.c file. It shows all the supported 6502 mnemonics in alphabetical order, followed by the hex machine codes. I edited out the addressing mode indicators to keep this simple (it's just a QAD edit), but at least it shows which abbreviations 6502 accepts for the "illegal" opcodes, which is nice to know since many of the documents about these codes use different abbreviations from each other.

 

adc - 0x69, 0x65, 0x75, 0x6D, 0x7D, 0x79, 0x61, 0x71

anc - 0x0b

and - 0x29, 0x25, 0x35, 0x2D, 0x3D, 0x39, 0x21, 0x31

ane - 0x8b

arr - 0x6b

asl - 0x0A, 0x06, 0x16, 0x0E, 0x1E

asr - 0x4b

bcc - 0x90

bcs - 0xB0

beq - 0xF0

bit - 0x24, 0x2C

bmi - 0x30

bne - 0xD0

bpl - 0x10

brk - 0x00

bvc - 0x50

bvs - 0x70

clc - 0x18

cld - 0xD8

cli - 0x58

clv - 0xB8

cmp - 0xC9, 0xC5, 0xD5, 0xCD, 0xDD, 0xD9, 0xC1, 0xD1

cpx - 0xE0, 0xE4, 0xEC

cpy - 0xC0, 0xC4, 0xCC

dcp - 0xc7, 0xd7, 0xcf, 0xdf, 0xdb, 0xc3, 0xd3

dec - 0xC6, 0xD6, 0xCE, 0xDE

dex - 0xCA

dey - 0x88

eor - 0x49, 0x45, 0x55, 0x4D, 0x5D, 0x59, 0x41,0x51

inc - 0xE6, 0xF6, 0xEE, 0xFE

inx - 0xE8

iny - 0xC8

isb - 0xe7, 0xf7, 0xef, 0xff, 0xfb, 0xe3, 0xf3

jmp - 0x4C, 0x6C

jsr - 0x20

las - 0xbb

lax - 0xa7, 0xb7, 0xaf, 0xbf, 0xa3, 0xb3

lda - 0xA9, 0xA5, 0xB5, 0xAD, 0xBD, 0xB9, 0xA1, 0xB1

ldx - 0xA2, 0xA6, 0xB6, 0xAE, 0xBE

ldy - 0xA0, 0xA4, 0xB4, 0xAC, 0xBC

lsr - 0x4A, 0x46, 0x56, 0x4E, 0x5E

lxa - 0xab

nop - 0xEA, 0x80, 0x04, 0x14, 0x0c, 0x1c

ora - 0x09, 0x05, 0x15, 0x0D, 0x1D, 0x19, 0x01, 0x11

pha - 0x48

php - 0x08

pla - 0x68

plp - 0x28

rla - 0x27, 0x37, 0x2f, 0x3f, 0x3b, 0x23, 0x33

rol - 0x2A, 0x26, 0x36, 0x2E, 0x3E

ror - 0x6A, 0x66, 0x76, 0x6E, 0x7E

rra - 0x67, 0x77, 0x6f, 0x7f, 0x7b, 0x63, 0x73

rti - 0x40

rts - 0x60

sax - 0x87, 0x97, 0x8f, 0x83

sbc - 0xE9, 0xE5, 0xF5, 0xED, 0xFD, 0xF9, 0xE1, 0xF1

sbx - 0xcb

sec - 0x38

sed - 0xF8

sei - 0x78

sha - 0x9f, 0x93

shs - 0x9b

shx - 0x9e

shy - 0x9c

slo - 0x07, 0x17, 0x0f, 0x1f, 0x1b, 0x03, 0x13

sre - 0x47, 0x57, 0x4f, 0x5f, 0x5b, 0x43, 0x53

sta - 0x85, 0x95, 0x8D, 0x9D, 0x99, 0x81, 0x91

stx - 0x86, 0x96, 0x8E

sty - 0x84, 0x94, 0x8C

tax - 0xAA

tay - 0xA8

tsx - 0xBA

txa - 0x8A

txs - 0x9A

tya - 0x98

mne6502_c.txt

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...