Jump to content



2

Session 9: 6502 and DASM - Assembling the Basics


30 replies to this topic

#26 Omegamatrix OFFLINE  

Omegamatrix

    River Patroller

  • 4,796 posts
  • Location:Oh, Canada

Posted Mon Jun 2, 2008 6:09 PM

Yeah the .bin extensions are binary files. An .asm file is just a plain old text document with a different extension name, so you know it is for assembly. The compiler doesn't care about the extension name, it just has to know what value to give all those labels in the file.

Make sure you have a copy of the vcs.h and macro.h file in the same folder as DASM along with your .asm file.

#27 davyK OFFLINE  

davyK

    Chopper Commander

  • 106 posts
  • Location:Northern Ireland

Posted Tue Oct 21, 2008 4:40 PM

I don't know what I'm doing wrong here. I can't get the sample kernel1.asm to compile/assemble. (btw there is no .asm in the attachment - only a .bin so I pasted the code into an editor..

I get an error message for each and every mnemonic ... help!

---------- compile ----------

START OF PASS: 1
kernel1.asm (2): error: Unknown Mnemonic '6502'.
kernel1.asm (26): error: Unknown Mnemonic 'lda'.
kernel1.asm (28): error: Unknown Mnemonic 'sta'.
kernel1.asm (32): error: Unknown Mnemonic 'lda'.
kernel1.asm (34): error: Unknown Mnemonic 'sta'.
kernel1.asm (42): error: Unknown Mnemonic 'sta'.
kernel1.asm (44): error: Unknown Mnemonic 'sta'.

..... and so on.


EDIT Sorry - found out instructions need to be indented..... move on - nothing to see here.

Edited by davyK, Tue Oct 21, 2008 4:43 PM.


#28 Wickeycolumbus OFFLINE  

Wickeycolumbus

    River Patroller

  • 4,064 posts
  • Location:Michigan

Posted Tue Oct 21, 2008 4:47 PM

View PostdavyK, on Tue Oct 21, 2008 5:40 PM, said:

I don't know what I'm doing wrong here. I can't get the sample kernel1.asm to compile/assemble. (btw there is no .asm in the attachment - only a .bin so I pasted the code into an editor..

I get an error message for each and every mnemonic ... help!

---------- compile ----------

START OF PASS: 1
kernel1.asm (2): error: Unknown Mnemonic '6502'.
kernel1.asm (26): error: Unknown Mnemonic 'lda'.
kernel1.asm (28): error: Unknown Mnemonic 'sta'.
kernel1.asm (32): error: Unknown Mnemonic 'lda'.
kernel1.asm (34): error: Unknown Mnemonic 'sta'.
kernel1.asm (42): error: Unknown Mnemonic 'sta'.
kernel1.asm (44): error: Unknown Mnemonic 'sta'.

..... and so on.

are your instructions indented?

this will not work:

processor 6502
include "vcs.h"
include "macro.h"
org $F000
START
lda #$82
sta VBLANK
sta VSYNC

; Ect...

but this will:

		  
	  processor 6502
	  include "vcs.h"
	  include "macro.h"
	  org $F000
START
	  lda #$82
	  sta VBLANK
	  sta VSYNC

; Ect...

all instructions must be indented and labels must be all the way to the left.

also, you may want to zip the .asm file so you can upload it :)

Edited by Wickeycolumbus, Tue Oct 21, 2008 4:49 PM.


#29 thegoldenband OFFLINE  

thegoldenband

    River Patroller

  • 2,470 posts
  • Location:Long Island, NY

Posted Fri Mar 13, 2009 12:42 PM

A note for future newbies who might be tempted to skip steps:

View PostAndrew Davie, on Sun May 25, 2003 6:00 AM, said:

The other switches "-f3" and "-v5" control some internals of DASM - and for now just assume you need these whenever you assemble with DASM.
I'm going through these tutorials now, and was having problems assembling this kernel until I reread this line. If the assembler seems to work, but the .bins you create are garbage, this may well be why! :dunce: If you omit these switches, the assembler doesn't complain, but in my case, I got a .bin that emitted a high-pitched tone and did nothing else. Oops.

Edited by thegoldenband, Fri Mar 13, 2009 12:43 PM.


#30 SeaGtGruff OFFLINE  

SeaGtGruff

    River Patroller

  • 4,547 posts
  • Location:Georgia, USA

Posted Fri Mar 13, 2009 12:57 PM

View Postthegoldenband, on Fri Mar 13, 2009 1:42 PM, said:

A note for future newbies who might be tempted to skip steps:

View PostAndrew Davie, on Sun May 25, 2003 6:00 AM, said:

The other switches "-f3" and "-v5" control some internals of DASM - and for now just assume you need these whenever you assemble with DASM.
I'm going through these tutorials now, and was having problems assembling this kernel until I reread this line. If the assembler seems to work, but the .bins you create are garbage, this may well be why! :dunce: If you omit these switches, the assembler doesn't complain, but in my case, I got a .bin that emitted a high-pitched tone and did nothing else. Oops.
I don't think you need to worry about the -v5 switch ("-v" is for "verbosity")... but you absolutely, positively need the -f3 switch, or the .BIN won't be in the correct format ("-f" is for "format"). Well, I did find the -f2 format to be useful when I was customizing batari Basic to create MNetwork bankswitched ROMs, but I had to write a utility to convert the output to the proper format-- and even though I didn't realize it back then, I have since learned that there's a much, *much* easier way to do what I was trying to do (by using ORG and RORG to define the different banks), and still be able to use -f3.

Michael

#31 thegoldenband OFFLINE  

thegoldenband

    River Patroller

  • 2,470 posts
  • Location:Long Island, NY

Posted Fri Mar 13, 2009 1:25 PM

View PostSeaGtGruff, on Fri Mar 13, 2009 2:57 PM, said:

I don't think you need to worry about the -v5 switch ("-v" is for "verbosity")... but you absolutely, positively need the -f3 switch, or the .BIN won't be in the correct format ("-f" is for "format").
Thanks for that clarification! That makes a lot of sense.

Meanwhile, I'm having a fun time using this code for a purpose wholly different than what it was intended for, i.e. throwing things at the sound registers at various points in the kernel and seeing what results I get! It seems like if you're mainly interested in sound design and manipulating the sound hardware (as I am), you can dive into this stuff surprisingly quickly.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users