Welcome, Guest. Please login or register.

Author Topic: AmiBlitz (Blitz Basic) "Type not found" error  (Read 1808 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
AmiBlitz (Blitz Basic) "Type not found" error
« on: May 24, 2006, 06:46:09 PM »
I'm trying to compile this example in AmiBlitz:

;-- Parallel port Blitz example..
;-- No more stupid Poking/peeking...
;-- remember to use all.res !
NEWTYPE .byte
b.b
End NEWTYPE

*PPort_Dir.byte = $BFE301
*PPort_Bits.byte = $BFE101

If AllocMiscResource_(#MR_PARALLELPORT,"MyAppName") = 0

*PPort_Dir\b= %11111111 ; set all bits direction to output

;-- Ready to rock and roll..

*PPort_Bits\b=%01010101 ; set the little buggers

FreeMiscResource_ #MR_PARALLELPORT
Else
NPrint "Crap, somethings already got the port :("
EndIf

End


I added blitzlibs:all.res in the compiler options and tried to compile, but I just get an error message with a title of "0", stating "Type Not Found". When I click OK I get "program failed (error #80000003)".

I'm completely new to AmiBlitz so have no idea what I can do :-(

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline Doobrey

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 1876
    • Show only replies by Doobrey
    • http://www.doobreynet.co.uk
Re: AmiBlitz (Blitz Basic) "Type not found" error
« Reply #1 on: May 24, 2006, 07:28:05 PM »
Gah... looks like somethings wrong with the way blitz calls the two misc.resource functions :-(
 They were only added for completeness, and don't stop you from banging the hardware.
This is really all you need for testing your relay

NEWTYPE .byte
b.b
End NEWTYPE

*PPort_Dir.byte = $BFE301
*PPort_Bits.byte = $BFE101

*PPort_Dir\b= %11111111 ; set all bits direction to output
*PPort_Bits\b=%01010101 ; set the output of each pin
End

On schedule, and suing
 

Offline Doobrey

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 1876
    • Show only replies by Doobrey
    • http://www.doobreynet.co.uk
Re: AmiBlitz (Blitz Basic) "Type not found" error
« Reply #2 on: May 24, 2006, 07:52:27 PM »
Yup, it's a bug in the way Blitz calls the resource.
I just cobbled together 2 funcs that call it directly and it doesn't crash.

Code: [Select]

Function.l AllocMiscResource{unit.l,name.l}
 SHARED MiscBase.l
 GetReg d0,unit
 GetReg a1,name
 GetReg a6,MiscBase
 JSR -6(a6)
 AsmExit
End Function

Statement FreeMiscResource{unit.l}
 SHARED MiscBase.l
  GetReg d0,unit
  GetReg a6,MiscBase
  JSR -12(a6)
End Statement

 ;-- No more stupid Poking/peeking...
 NEWTYPE .byte
  b.b
 End NEWTYPE

 MiscBase.l=0
 
 *PPort_Dir.byte=$bfe301
 *PPort_Bits.byte=$bfe101
                                                                                                                                                                                                                                                         

 MiscBase.l=OpenResource_("misc.resource")
 If MiscBase

  If AllocMiscResource{#MR_PARALLELPORT,"MyAppName"}=0

    *PPort_Dir\b= %11111111   ; set all bits to output
    *PPort_Bits\b=%01010101


    FreeMiscResource {#MR_PARALLELPORT}

  Else
    NPrint "Crap!"
  EndIf

 EndIf

End


On schedule, and suing
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: AmiBlitz (Blitz Basic) "Type not found" error
« Reply #3 on: May 24, 2006, 08:16:59 PM »
You rock :-) Your first example worked!!! I'll try the longer one later - first thing I have to try to get user input working so I can specify the state of the relays in an argument  :idea:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: AmiBlitz (Blitz Basic) "Type not found" error
« Reply #4 on: May 24, 2006, 08:45:54 PM »
How can I convert between types in Blitz? I want to pass a string variable to the port, e.g. *PPort_Bits\b=bits$, but when I try this I get an "incompatible types" error. I also want to convert back the other way so I can read the bits from the port, but I get the same error when doing bits$=*PPort_Bits\b

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline Doobrey

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 1876
    • Show only replies by Doobrey
    • http://www.doobreynet.co.uk
Re: AmiBlitz (Blitz Basic) "Type not found" error
« Reply #5 on: May 24, 2006, 09:18:50 PM »
Bin$(number) converts from an integar to string showing the binary representation.
Str$(number) converts from integar to string.
bit$=Right$(Bin$(*PPort_Bits\b),8) should give you the lower 8 bits...assuming you're trying to read the current state of the relays.
If you're using the relays the other way around to input into the Amiga, then you'll need to set each direction bit to 0  (*PPort_Dir\b=%xxxxxxxx) before reading the bits

As for the other way around, I dunno if blitz has a function to do it..been a while since I did anything with it.
 I'll have a look and see what I can find, but I'm a bit preoccupied with Remus at the moment.... it might not live to see v1.0  :madashell:

BTW, why's this page soooooo wide?
On schedule, and suing
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: AmiBlitz (Blitz Basic) "Type not found" error
« Reply #6 on: May 25, 2006, 08:40:41 AM »
Great, thanks! One more question and then I should be able to work the rest out for myself. I have looked through the Blitz II manual, but I can't find out how to read arguments from the command line.

What's going wrong with Remus then? I'm still meaning to create a v3.9 ROM but can't quite find the time :-)

No idea why the page has gone so wide. I can't see anything making it like that  :-?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10