Jump to content
IGNORED

Need help compiling. Is correct indenting required?


Recommended Posts

This to me is a bit strange, but here goes. With the code below I get loads of Unknown Mnemonic errors. But that's just the beginning..

 

(This is from Davie's Tutorial btw)

 

     processor 6502 
            include vcs.h
            include macro.h 

            SEG 
            ORG $F000 

Reset 
StartOfFrame 

   ; Start of vertical blank processing 

            lda #0 
            sta VBLANK 

            lda #2 
            sta VSYNC 
            
               ; 3 scanlines of VSYNCH signal... 

                sta WSYNC 
                sta WSYNC 
                sta WSYNC 

            lda #0 
            sta VSYNC            

               ; 37 scanlines of vertical blank... 

                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
            


               ; 192 scanlines of picture... 

        ldx #0 
        ldy #0 
        REPEAT 192; scanlines 

              inx 
              stx COLUBK 

              nop 
              nop 
              nop 

              dey 
              sty COLUBK 

              sta WSYNC 

        REPEND 

            lda #%01000010 
            sta VBLANK                     ; end of screen - enter blanking 

               ; 30 scanlines of overscan... 

                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 
                sta WSYNC 

            jmp StartOfFrame 


            ORG $FFFA 

            .word Reset          ; NMI 
            .word Reset          ; RESET 
            .word Reset          ; IRQ 

       END

 

I know it's to big to fit in 4k and I have to throw in some loops. But I'll get to that in a moment once I figure out what I am doing wrong.

 

So next if I copy and paste this code:

 

       processor 6502
       include vcs.h
SEG
       org $F000

 

replacing the what's there I don't get any errors other then:

picd.asm (8): error: Unknown Mnemonic 'Reset'.
picd.asm (9): error: Unknown Mnemonic 'StartOfFrame'.
Unrecoverable error(s) in pass, aborting assembly!
Complete.

 

The only major difference is that I don't include the macro.h file and even if I do I still just get these last few errors. So is there perhaps required indenting like with Python? Or what is going on here?

 

I have had the same problems with the Unknown Mnemonic 'LabelName' thing before, and had to copy and past the original code and then it worked. I'm just confused.. This should work just fine right??

Link to comment
Share on other sites

That din't seem to make a difference:

 

START OF PASS: 1
picd.asm (9): error: Unknown Mnemonic 'Reset:'.
picd.asm (10): error: Unknown Mnemonic 'StartOfFrame:'.

----------------------------------------------------------------------
SEGMENT NAME                 INIT PC  INIT RPC FINAL PC FINAL RPC
                            f000                            f000
RIOT                     [u] 0280                            0280
TIA_REGISTERS_READ       [u] 0000                            0000
TIA_REGISTERS_WRITE      [u] 0000                            0000
INITIAL CODE SEGMENT         0000 ????                       0000 ????
----------------------------------------------------------------------
7 references to unknown symbols.
4 events requiring another assembler pass.
- Expression in mnemonic not resolved.
- Expression in a DC not resolved.

--- Unresolved Symbol List
StartOfFrame             0000 ????         (R )
Reset                    0000 ????         (R )
--- 2 Unresolved Symbols

Unrecoverable error(s) in pass, aborting assembly!
Complete.

 

I'm using the lastest version of DASM, and the header files. I tried it on my wifes Windows box and I get the same errors.

Link to comment
Share on other sites

Alright well there was a space, but know there is nothing and it still gives the same error. Perhaps I'm not getting it, but I also removed the tab, and still nothing.

 

I can't attached the file for some reason. I zipped it up but it keeps telling me it's not valid.. ??? Anyway I uploaded here:

http://home.comcast.net/~nintend0/picd.zip

Link to comment
Share on other sites

I adjusted the jmp and it compiled for me. Seems strange though. Anyway thanks for the help. :)

 

There's no black-magic involved. Labels and symbol *DEFINITIONS* must start in the very first column (that is, no whitespace before them). Opcodes and assembler directives (eg: LDA or ORG) must NOT start in the very first column. They *MUST* have whitespace before them, and optionally a label (which, again, MUST start in the first column).

 


OPTIONALLABELHERE(whitespace)opcode(whitespace)OPTIONALOPERAND(optional comment/whitespace)

 

for example...

 


LABEL jmp LABEL ;this is correct

LABEL jmp LABEL; this is incorrect (note the whitespace at the start of the line)

jmp LABEL;this is incorrect (opcodes can't start at column 1 -- we should have whitespace before jmp)

jmp jmp jmp; this is correct but VERY bad form!

 

Why is the last line correct? It defines a label at the start of the line which just HAPPENS to be the same as an opcode, called 'jmp'. But since the assembler is expecting a label here, it doesn't care if it's the same as an opcode! Next the label 'jmp' is followed by a jmp instruciton (opcode) with a destination address/label of 'jmp' (which is the 'jmp' LABEL defined at the start of the line). This is incredibly bad style. I haven't tested this, and I don't intend to!

 

**DO NOT TRY THIS AT HOME!!**

 

The rules are;

 

  • definitions of symbols (=labels) MUST start in the first column
    directives to the assembler, and opcodes, MUST have some whitespace before them (ie: they must NOT start in the first column).
    symbol definitions and opcodes can appear together on a single line.

    •  
      Cheers
      A

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...