Jump to content



0

Need help compiling. Is correct indenting required?


11 replies to this topic

#1 JesterDev OFFLINE  

JesterDev

    Space Invader

  • 18 posts

Posted Wed Jul 21, 2004 5:40 PM

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

#2 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 20,458 posts
  • Location:The land of Gorch

Posted Wed Jul 21, 2004 5:51 PM

I always use colon characters at the end of labels...

Reset:
StartOfFrame:

...for example.


Maybe that's the problem? It's thinking that the labels are instructions (which it has no record for).

#3 JesterDev OFFLINE  

JesterDev

    Space Invader

  • 18 posts

Posted Wed Jul 21, 2004 6:09 PM

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.

#4 DEBRO OFFLINE  

DEBRO

    Stargunner

  • 1,862 posts
  • Location:Atlanta, GA

Posted Wed Jul 21, 2004 6:52 PM

Make sure these labels (Reset and StartOfFrame) are all the way on the left with no spacing or tabbing.

I assume these are subroutine labels. If so they need to start with no tabbing.

#5 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 20,458 posts
  • Location:The land of Gorch

Posted Wed Jul 21, 2004 7:01 PM

Not according to the listing at the top. Looks like they should both be equal to $F000...bur the error shows them being interpreted as ram addresses (R ) :?


Can you post a file?

#6 DEBRO OFFLINE  

DEBRO

    Stargunner

  • 1,862 posts
  • Location:Atlanta, GA

Posted Wed Jul 21, 2004 7:22 PM

Quote

Not according to the listing at the top. Looks like they should both be equal to $F000...bur the error shows them being interpreted as ram addresses (R ) :?
The ® means the symbol was referenced.

#7 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 20,458 posts
  • Location:The land of Gorch

Posted Wed Jul 21, 2004 7:26 PM

Oh :lol:


So for some reason, both of those tags remain at -null- instead of being equal to $F000 - when that ORG appears right above them.... :?

#8 DEBRO OFFLINE  

DEBRO

    Stargunner

  • 1,862 posts
  • Location:Atlanta, GA

Posted Wed Jul 21, 2004 7:38 PM

Right, there must be a space to the left of them in his file because DASM doesn't see them as labels.

If you copied his post to a file and made sure there was no space to the left of these labels it would compile successfully.

#9 JesterDev OFFLINE  

JesterDev

    Space Invader

  • 18 posts

Posted Wed Jul 21, 2004 8:50 PM

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....ntend0/picd.zip

#10 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 20,458 posts
  • Location:The land of Gorch

Posted Wed Jul 21, 2004 9:00 PM

Hm...it works over here. No probs.

#11 JesterDev OFFLINE  

JesterDev

    Space Invader

  • 18 posts

Posted Sat Jul 24, 2004 1:21 AM

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

#12 Andrew Davie OFFLINE  

Andrew Davie

    Stargunner

  • 1,314 posts
  • Location:Tasmania

Posted Sat Jul 24, 2004 3:38 AM

JesterDev said:

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.
    [list]

    Cheers
    A





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users