With more specifics regarding exactly which directory you are in I could help you better, but here's one thing that might be going wrong:
in the DASM directory structure on my machine there's a demo.asm file:
peapod:~/ataridev/DASM/test amw$ pwd
/Users/amw/ataridev/DASM/test
peapod:~/ataridev/DASM/test amw$ ls
demo.asm example.asm locals.asm suite6303.asm suite6502.asm suite68705.asm suite68HC11.asm
The ~ is a short form to indicate my home directory.
If I go to that directory (~/ataridev/DASM/test) and type ./demo.asm I see your error:
peapod:~/ataridev/DASM/test amw$ ./demo.asm
-bash: ./demo.asm: Permission denied
I don't know if your permissions error is due to a scenario like the above, but in case it is I'll explain why it's not working --
First, demo.asm is a text file, not an executable program. typing its name or ./demo.asm tells the shell to try to execute that file, but since this is just a text file your shell has no idea what to do with it.
What you need to do is invoke DASM using demo.asm as an input. DASM will produce a binary for you. In order to see the demo run you'll need to install a program called Stella, which thankfully works from the GUI .. all you'll need to to is go to Open and select the DASM output file and it'll run.
When I assemble code I do it from the directory in which the executable dasm lives. You don't necessarily have to do it that way, but this method works fine for me and it keeps things simple. So, when I want to assemble a .asm file, I go here:
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ pwd
/Users/amw/ataridev/DASM/bin/Mac/OSX
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ ls
#kernel.asm# VCS.H ftohex kernel.bin macro.h
README.txt dasm kernel.asm kernel.txt
From here I can invoke the assembler by typing ./dasm
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ ./dasm
redistributable for non-profit only
DASM sourcefile [options]
-f# output format
-oname output file
-lname list file
-Lname list file, containing all passes
-sname symbol dump
-v# verboseness
-t# Symbol Table sorting preference (#1 = by address. default #0 = alphabetic)
-Dname=exp define label
-Mname=exp define label as in EQM
-Idir search directory for include and incbin
-p# max number of passes
-P# max number of passes, with less checks
Fatal assembly error: Check command-line format.
peapod:~/ataridev/DASM/bin/Mac/OSX amw$
Let's say I want to assemble kernel.asm. First, I make sure it's in the same directory as the dasm binary :
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ pwd
/Users/amw/ataridev/DASM/bin/Mac/OSX
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ ls
#kernel.asm# README.txt VCS.H dasm ftohex kernel.asm macro.h
peapod:~/ataridev/DASM/bin/Mac/OSX amw$
Then I invoke dasm :
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ ./dasm kernel.asm -f3 -v5 -okernel.bin
Here's what happens :
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ ./dasm kernel.asm -f3 -v5 -okernel.bin
DASM V2.20.07, Macro Assembler (C)1988-2003
START OF PASS: 1
----------------------------------------------------------------------
SEGMENT NAME INIT PC INIT RPC FINAL PC FINAL RPC
0000 ???? 0000 ????
RIOT [u] 0000 ???? 0000 ????
TIA_REGISTERS_READ [u] 0000 ???? 0000 ????
TIA_REGISTERS_WRITE [u] 0000 ???? 0000 ????
INITIAL CODE SEGMENT 0000 ???? 0000 ????
----------------------------------------------------------------------
3 references to unknown symbols.
0 events requiring another assembler pass.
--- Symbol List (sorted by symbol)
AUDC0 0015
AUDC1 0016
AUDF0 0017
AUDF1 0018
AUDV0 0019
AUDV1 001a
COLUBK 0009 (R )
COLUP0 0006
COLUP1 0007
COLUPF 0008
CTRLPF 000a
CXBLPF 0006
CXCLR 002c
CXM0FB 0004
CXM0P 0000
CXM1FB 0005
CXM1P 0001
CXP0FB 0002
CXP1FB 0003
CXPPMM 0007
ENABL 001f
ENAM0 001d
ENAM1 001e
GRP0 001b
GRP1 001c
HMBL 0024
HMCLR 002b
HMM0 0022
HMM1 0023
HMOVE 002a
HMP0 0020
HMP1 0021
INPT0 0008
INPT1 0009
INPT2 000a
INPT3 000b
INPT4 000c
INPT5 000d
INTIM 0284
NUSIZ0 0004
NUSIZ1 0005
PF0 000d
PF1 000e
PF2 000f
REFP0 000b
REFP1 000c
RESBL 0014
Reset f000 (R )
RESM0 0012
RESM1 0013
RESMP0 0028
RESMP1 0029
RESP0 0010
RESP1 0011
RSYNC 0003
StartOfFrame f000 (R )
SWACNT 0281
SWBCNT 0283
SWCHA 0280
SWCHB 0282
T1024T 0297
TIA_BASE_ADDRESS 0000 (R )
TIA_BASE_READ_ADDRESS 0000 (R )
TIA_BASE_WRITE_ADDRESS 0000 (R )
TIM1T 0294
TIM64T 0296
TIM8T 0295
TIMINT 0285
VBLANK 0001 (R )
VDELBL 0027
VDELP0 0025
VDELP1 0026
VERSION_MACRO 0069
VERSION_VCS 0069
VSYNC 0000 (R )
WSYNC 0002 (R )
--- End of Symbol List.
Complete.
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ ls
#kernel.asm# VCS.H demo.asm kernel.asm macro.h
README.txt dasm ftohex kernel.bin
peapod:~/ataridev/DASM/bin/Mac/OSX amw$
Note that now there's a kernel.bin file in my directory -- that's what the -o option in the command invoking dasm specified.
Now I can run my Stella emulator and using the regular Mac GUI tell it to open the kernel.bin final --- and that's where you get to see the fruits of your programming labor.
Incidentally, right after I assembled the kernel above I copied demo.asm into my dasm directory and tried to assemble it .... it didn't work and I haven't looked into why yet. Here's what dasm said as it barfed:
peapod:~/ataridev/DASM/bin/Mac/OSX amw$ ./dasm demo.asm -f3 -v5 -odemo.bin
DASM V2.20.07, Macro Assembler (C)1988-2003
START OF PASS: 1
segment: code 0000 ???? vs current org: 0005
demo.asm (46): error: Origin Reverse-indexed.
Aborting assembly