Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Illegal Character "."
I was playing with putChars to tighten it and add attribs...

This comes back with "illegal character "." in line 52. There is indeed one in that line. It's in a comment. If you remove it (I already removed all the others) it freaks into "Too many errors. Giving up".

Line 52:
; gets screen address in HL, and bytes address in DE. [<<<< This . is apparently an error] Copies the 8 bytes to the screen

I have no idea why!

SUB Baspaint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
    dim i,j as ubyte
    FOR i=x to x+width-1
        for j=y to y+height-1
        poke (22528+(CAST(uinteger,32)*j)+i),attribute
        next j
    next i
    SUB paint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
    print x,y,width,height,attribute
    SUB putChars(x as uByte,y as uByte, width as uByte, height as uByte, dataAddress as uInteger)
             LD      a,(IX+5)
             ;AND     31
             ld      l,a
             ld      a,(IX+7) ; Y value
             ld      d,a
             AND     24
             add     a,64
             ld      h,a
             ld      a,d
             AND     7
             OR      l
             ld      l,a

    PUSH HL ; save our address

    LD E,(IX+12) ; Marker - This will be poked for the data address by the subroutine
    LD D,(IX+13)
    LD B,(IX+9) ; Marker - this will be poked for the width
    PUSH BC ; save our column count


    LD B,(IX+11) ; Marker - this will be poked for the height by the subroutine

    ; gets screen address in HL, and bytes address in DE. Copies the 8 bytes to the screen
    ld a,(DE) ; First Row
    LD (HL),a
    INC DE
    INC H
    ld a,(DE)
    LD (HL),a ; second Row
    INC DE
    INC H
    ld a,(DE)
    LD (HL),a ; Third Row
    INC DE
    INC H
    ld a,(DE)
    LD (HL),a ; Fourth Row
    INC DE
    INC H
    ld a,(DE)
    LD (HL),a ; Fifth Row
    INC DE
    INC H
    ld a,(DE)
    LD (HL),a ; Sixth Row
    INC DE
    INC H
    ld a,(DE)
    LD (HL),a ; Seventh Row
    INC DE
    INC H
    ld a,(DE)
    LD (HL),a ; Eigth Row
    INC DE ; Move to next data item.
    DEC B
    JR Z,BLPutCharNextColumn
    ;The following code calculates the address of the next line down below current HL address.
    PUSH DE ; save DE
             ld   a,l  
             and  224  
             cp   224  
             jp   z,BLPutCharNextThird

             ld   de,-1760
             ;and  a        
             add  hl,de      
             POP DE ; get our data point back.
             jp BLPutCharInColumnLoop

             ld   de,32      
             ;and  a
             add  hl,de  
             POP DE ; get our data point back.
    JP BLPutCharInColumnLoop

    POP BC
    POP HL
    DEC B
    JP Z BLPutCharsEnd

    INC HL
    JP BLPutCharColumnLoop

    end asm


    goto start

defb 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
defb 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
defb 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96
defb 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128
end asm

I saved your program as "dotbug.bas". Compiling it, gives the following errors:
Quote:dotbug.bas:23: Syntax Error. Unexpected token 'a' <ID>
dotbug.bas:39: warning: Variable 'our' declared as 'float'
dotbug.bas:39: Expected a 'string' type expression, got 'float' instead
dotbug.bas:39: Unexpected "address" ID. Expected "SCREEN$" instead
dotbug.bas:41: Syntax Error. Unexpected token 'E' <ID>
dotbug.bas:44: Syntax Error. Unexpected token 'count' <ID>
dotbug.bas:48: Syntax Error. Unexpected token 'B' <ID>
dotbug.bas:52: Syntax Error. Unexpected token ';' <SC>
dotbug.bas:52: illegal character '.'
The 1st error says It gets an "unexpected 'a' token". And this is your code:
britlion Wrote:
20:     SUB putChars(x as uByte,y as uByte, width as uByte, height as uByte, dataAddress as uInteger)
22:     BLPutChar:
23:              LD      a,(IX+5)
24:              ;AND     31
25:              ld      l,a
26:              ld      a,(IX+7) ; Y value
This is because you forgot to add "ASM" in line 21, so the compiler thinks it's still parsing in BASIC context. Hence the syntax errors.
The "dot error" is because in BASIC context, ; does not comment the line (as you already know).

The compiler cannot report "You forgot to start 'ASM'". In fact this is why you have to write it yourself. Instead of focusing in the last error, you should pay attention to the 1st one. In many compilers, the 1st error reported is usually the most important one as subsequent errors might be a consequence of the 1st one.
Ahh, bitten by the IDE.

In the default setup, if I'd seen that list, I'd have been much clearer.

You're absolutely right - error treacing should go back to the source; but in tommygun all I could see was the last one. *ahem*. My real error was assuming it was the only one, since I got used to it tending towards issuing single errors and stopping - and in fact it only does seem to stop at the "." characters before calling it a failed build.

I was sure I'd made a programming error - I just couldn't see why it lead to that statement.

It was a head scratcher - especially since the code was a move-around to speed it up; and it ought to work. And in fact, with "asm" in line 21, it does. :-)

Thanks for looking at it, Boriel. I do appreciate it, even if it makes me look like an idiot :-)
Tommy Gun Reported just the last one???
Ok, there are a flag to tell the compiler to output only the first N errors. I will check if that option is already enabled in the command line (the feature is internally implemented). Then you should configure TommyGun to invoke the compiler with --max-errors=N (or the like).
Nono - ZXB basic reported them all, but tommygun's default setup just leaves enough space to exactly see the last one.

Scrolling up shows the others. It was me that was the idiot. I've made the window section a little bigger, and boom, there they all are.

I was mislead by the "." problem, because I went to the line with a "." in it, and removed it, and the error moved. And given that was a comment, I was then baffled! Smile
This problem will not appear in BorIDE as it displays all errors or warnings sent by ZXBC in e editor gadget.
------------------------------------------------------------ redirector is dead
Visit my home page!

Forum Jump:

Users browsing this thread: 1 Guest(s)