SirPython
SirPython

Reputation: 647

Getting an error about a ", but there is no "

I'm writing some assembler code for the ATmega8, and I am getting a rather weird error.

Here is an example-ized sample of the line in which the error is happening:

ldi A, B%C

Where A, B, and C are defined like this at the top of my code:

.DEF A = r1
.DEF B = r0
.EQU C = 15

This is the error I am getting(this originally was a table):

Description: syntax error, unexpected "

File: test.asm

Line: 120

Col: 0

Project: Testing

What is strange is that there is not a single " in my entire code. However, I has suspicions that the " could be coming from the included file m8def.inc. This was assembled using Atmel Studio's assembler.

Upvotes: 0

Views: 110

Answers (1)

Jester
Jester

Reputation: 58762

Why do you need to know why I need to find out what the value in r0 mod 15 is?

I needeed to know that you wanted to find out what the value in r0 mod 15 is... That's not the way to do it, since ldi can only load compile time constants. To do mod 15 you need a division, but atmega8 doesn't have that. You could do repeated subtraction or magic number multiply.

However, given your additional information about B being a counter, the simplest solution is to keep a mod 15 counter in A, which gets reset to 0 when it hits 15.

Upvotes: 1

Related Questions