Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: ben_g on May 08, 2011, 03:10:54 pm

Title: compiletime errors
Post by: ben_g on May 08, 2011, 03:10:54 pm
Hi everybody!

I recently started with asm, and i have some compiletime errors of which i don't know how to solve them.

my code:
Code: [Select]
InitView:
  ;call once every frame, before 3DTo2D
  ld hl, (xto)
  ld bc, hl
  ld hl, (xfrom)
  ld de, hl
  call SubFP
  ld hl, de
  ld (xto), hl
  ld hl, (yto)
  ld bc, hl
  ld hl, (yfrom)
  ld de, hl
  call SubFP
  ld hl, de
  ld (yto), hl
  ld hl, (zto)
  ld bc, hl
  ld hl, (zfrom)
  ld de, hl
  call SubFP
  ld hl, de
  ld (zto), hl
  ld hl, (xto)
  ld bc, hl
  call MulFP
  ld ix, de
  ld hl, (yto)
  ld bc, hl
  call MulFP
  ld hl, de
  ld bc, ix
  add hl, bc
  ld ix, hl
  ld hl, (zto)
  ld bc, hl
  call MulFP
  ld hl, de
  ld de, ix
  add hl, de
  call sqrtFP
  ld de, hl
  ld hl, (xto)
  push de
  call DivFP
  pop de
  ld (xto), hl
  push de
  ld hl, (yto)
  call DivFP
  pop de
  ld (yto), hl
  ld hl, (zto)
  call DivFP
  ld (zto), hl
  ld hl, (xto)
  ld bc, hl
  ld hl, (xup)
  call MulFP
  ld ix, de
  ld hl, (yto)
  ld bc, hl
  ld hl, (yup)
  call MulFP
  ld hl, de
  ld bc, ix
  add hl, bc
  ld ix, hl
  ld hl, (zto)
  ld bc, hl
  ld hl, (zup)
  call MulFP
  ld hl, af
  add hl, de
  push hl
  ld hl, (xto)
  ld bc, hl
  pop hl
  push hl
  call MulFP
  ld hl, (xup)
  ld bc, hl
  call SubFP
  ld hl, de
  ld (xup), hl
  ld hl, (yto)
  ld bc, hl
  pop hl
  push hl
  call MulFP
  ld hl, (yup)
  ld bc, hl
  call SubFP
  ld hl, de
  ld (yup), hl
  ld hl, (zto)
  ld bc, hl
  pop hl
  call MulFP
  ld hl, (zup)
  ld bc, hl
  call SubFP
  ld hl, de
  ld (zup), hl
the errors:
Assembling...
Pass 1 complete. (330ms).
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:61]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:63]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:65]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:68]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:70]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:72]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:75]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:77]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:79]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:82]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:84]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:86]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:88]
Error: Could not parse expression 'ix' (Invalid number). [zztemp.asm:89]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:91]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:93]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:95]
Error: Could not parse expression 'ix' (Invalid number). [zztemp.asm:96]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:99]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:114]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:117]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:119]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:122]
Error: Could not parse expression 'ix' (Invalid number). [zztemp.asm:123]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:125]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:127]
Error: Could not parse expression 'af' (Invalid number). [zztemp.asm:130]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:134]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:139]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:141]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:144]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:149]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:151]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:154]
Error: Could not parse expression 'hl' (Invalid number). [zztemp.asm:158]
Error: Could not parse expression 'de' (Invalid number). [zztemp.asm:160]
Pass 2 complete. (163ms).
Errors: 36, Warnings: 0.
Build failed.

Title: Re: compiletime errors
Post by: Deep Toaster on May 08, 2011, 03:26:12 pm
Whoa... Seems like you're not assembling for Z80. What assembler are you using? Make sure you're using either TASM (with tasm80.tab table file), ZDS, or Spasm (http://wabbit.codeplex.com/releases/view/45088).

And welcome to Omnimaga, ben_g :)
Title: Re: compiletime errors
Post by: ben_g on May 08, 2011, 03:38:24 pm
What assembler are you using?
I use latenite z80 editor for both editing and compiling.
And welcome to Omnimaga, ben_g :)
thanks

btw: thanks for the quick reply
Title: Re: compiletime errors
Post by: Ashbad on May 08, 2011, 03:42:24 pm
yeah, whatever you're doing, the syntax the assembler expects is not present.  I would read the documentation for latenite z80 and/or get a better assembler ;)
Title: Re: compiletime errors
Post by: DrDnar on May 08, 2011, 03:45:22 pm
I hope that's not your entire source code. It needs some header and footer stuff to assemble correctly. Also, Latenite is not being actively developed and might be a little buggy.
Title: Re: compiletime errors
Post by: ben_g on May 08, 2011, 03:51:43 pm
the doorscs assembler gives the same errors

the strangest abouth this: all of the other routines works (i only posted the part that gave the errors) while some of those lines are exactely the same as the ones that give errors in the initView routine
Title: Re: compiletime errors
Post by: DJ Omnimaga on May 08, 2011, 03:55:48 pm
If I remember, Doors CS SDK pretty much includes Latenite, but I could be wrong. I unfortunately cannot help you, though, because I only ever used TASM when I tried learning assembly and it doesn't run on 64 bit OSes.

Welcome on the forums by the way.
Title: Re: compiletime errors
Post by: ben_g on May 08, 2011, 04:03:42 pm
I only ever used TASM when I tried learning assembly and it doesn't run on 64 bit OSes.
that's why i searched for other assemblers, and i got latenite to work, untill it gave those errors...
Title: Re: compiletime errors
Post by: Deep Toaster on May 08, 2011, 04:13:02 pm
Maybe Latenite requires you to use a table file or something? I've never used it, so I'm not sure.

Try using Spasm (http://wabbit.codeplex.com/releases/view/45088). It's the easiest to use I've found so far, and it's being actively developed.
Title: Re: compiletime errors
Post by: ben_g on May 08, 2011, 04:23:00 pm
pretty much the same...

Pass one...
Pass two...
source/invasion.z80:60: error: 'hl' isn't a macro or label
source/invasion.z80:62: error: 'hl' isn't a macro or label
source/invasion.z80:64: error: 'de' isn't a macro or label
source/invasion.z80:67: error: 'hl' isn't a macro or label
source/invasion.z80:69: error: 'hl' isn't a macro or label
source/invasion.z80:71: error: 'de' isn't a macro or label
source/invasion.z80:74: error: 'hl' isn't a macro or label
source/invasion.z80:76: error: 'hl' isn't a macro or label
source/invasion.z80:78: error: 'de' isn't a macro or label
source/invasion.z80:81: error: 'hl' isn't a macro or label
source/invasion.z80:83: error: 'de' isn't a macro or label
source/invasion.z80:85: error: 'hl' isn't a macro or label
source/invasion.z80:87: error: 'de' isn't a macro or label
source/invasion.z80:88: error: 'ix' isn't a macro or label
source/invasion.z80:90: error: 'hl' isn't a macro or label
source/invasion.z80:92: error: 'hl' isn't a macro or label
source/invasion.z80:94: error: 'de' isn't a macro or label
source/invasion.z80:95: error: 'ix' isn't a macro or label
source/invasion.z80:98: error: 'hl' isn't a macro or label
source/invasion.z80:113: error: 'hl' isn't a macro or label
source/invasion.z80:116: error: 'de' isn't a macro or label
source/invasion.z80:118: error: 'hl' isn't a macro or label
source/invasion.z80:121: error: 'de' isn't a macro or label
source/invasion.z80:122: error: 'ix' isn't a macro or label
source/invasion.z80:124: error: 'hl' isn't a macro or label
source/invasion.z80:126: error: 'hl' isn't a macro or label
source/invasion.z80:129: error: 'af' isn't a macro or label
source/invasion.z80:133: error: 'hl' isn't a macro or label
source/invasion.z80:138: error: 'hl' isn't a macro or label
source/invasion.z80:140: error: 'de' isn't a macro or label
source/invasion.z80:143: error: 'hl' isn't a macro or label
source/invasion.z80:148: error: 'hl' isn't a macro or label
source/invasion.z80:150: error: 'de' isn't a macro or label
source/invasion.z80:153: error: 'hl' isn't a macro or label
source/invasion.z80:157: error: 'hl' isn't a macro or label
source/invasion.z80:159: error: 'de' isn't a macro or label
Done
Assembly time: 0.021 seconds
Title: Re: compiletime errors
Post by: DrDnar on May 08, 2011, 05:01:27 pm
Many of your instructions aren't valid.

Code: [Select]
InitView:
  ;call once every frame, before 3DTo2D
  ld hl, (xto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  ld hl, (xfrom)
  ld de, hl ; 16-bit register-to-register transfer illegal
  call SubFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld (xto), hl
  ld hl, (yto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  ld hl, (yfrom)
  ld de, hl ; 16-bit register-to-register transfer illegal
  call SubFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld (yto), hl
  ld hl, (zto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  ld hl, (zfrom)
  ld de, hl ; 16-bit register-to-register transfer illegal
  call SubFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld (zto), hl
  ld hl, (xto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  call MulFP
  ld ix, de ; 16-bit register-to-register transfer illegal
  ld hl, (yto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  call MulFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld bc, ix ; 16-bit register-to-register transfer illegal
  add hl, bc
  ld ix, hl ; 16-bit register-to-register transfer illegal
  ld hl, (zto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  call MulFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld de, ix ; 16-bit register-to-register transfer illegal
  add hl, de
  call sqrtFP
  ld de, hl ; 16-bit register-to-register transfer illegal
  ld hl, (xto)
  push de
  call DivFP
  pop de
  ld (xto), hl
  push de
  ld hl, (yto)
  call DivFP
  pop de
  ld (yto), hl
  ld hl, (zto)
  call DivFP
  ld (zto), hl
  ld hl, (xto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  ld hl, (xup)
  call MulFP
  ld ix, de ; 16-bit register-to-register transfer illegal
  ld hl, (yto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  ld hl, (yup)
  call MulFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld bc, ix ; 16-bit register-to-register transfer illegal
  add hl, bc
  ld ix, hl ; 16-bit register-to-register transfer illegal
  ld hl, (zto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  ld hl, (zup)
  call MulFP
  ld hl, af ; 16-bit register-to-register transfer illegal, and ridiculous
  add hl, de
  push hl
  ld hl, (xto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  pop hl
  push hl
  call MulFP
  ld hl, (xup)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  call SubFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld (xup), hl
  ld hl, (yto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  pop hl
  push hl
  call MulFP
  ld hl, (yup)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  call SubFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld (yup), hl
  ld hl, (zto)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  pop hl
  call MulFP
  ld hl, (zup)
  ld bc, hl ; 16-bit register-to-register transfer illegal
  call SubFP
  ld hl, de ; 16-bit register-to-register transfer illegal
  ld (zup), hl
Title: Re: compiletime errors
Post by: Deep Toaster on May 09, 2011, 09:27:48 am
Oh wow, I didn't actually read the code... Yeah, you can't load a 16-bit reg into another 16-bit reg. You have to load the individual 8-bit regs, as in ld h,d \ ld l,e.
Title: Re: compiletime errors
Post by: ZippyDee on May 09, 2011, 09:28:30 am
If you reeeeeeally wanted to you could write macros for it. That could let you use those for some slightly faster typing in the future :P
Title: Re: compiletime errors
Post by: FloppusMaximus on May 09, 2011, 10:22:59 pm
Note that LD BC,(abc) is faster and smaller than LD HL,(abc) / LD B,H / LD C,L.

Also note that in some cases you might be able to use EX DE,HL instead of LD.  LD HL,(abc) / EX DE,HL is the same size and speed as LD DE,(abc).

Also also note that while there are undocumented instructions to load the two halves of IX to and from other registers, those instructions don't work on buggy emulators like the Nspire.  So for compatibility you should probably stick to using, e.g., PUSH DE / POP IX to load DE into IX.
Title: Re: compiletime errors
Post by: ben_g on May 10, 2011, 01:40:14 pm
thanks everybody