aweiss@pacsbb.UUCP (arnold weiss) (12/07/88)
Page 11-108 of the level II Basic09 manual states that you can pass a byte as a parameter --- page 11-145 states that you can NOT pass a byte as a parameter. To check which was true I wrote the following procedures PROCEDURE FLIP1 DIM number:BYTE number=128 RUN FLIP2(number) PROCEDURE FLIP2 PARAM number:BYTE PRINT number When I tried to run this from basic09 I got an error 056 (parameter error) in PROCEDURE FLIP2. Strangely when I packed the procedures they ran with- out error. IT seems as if the packed procedures treat the variable "number" as a one element array. Any helpful comments?
knudsen@ihlpl.ATT.COM (Knudsen) (12/10/88)
Nah, no helpful comments, just more addition to the confusion. My experience is that you can pass Bytes as parameters to functions with no problems. However, there is the quirk of Motorola's (aka Rotorooter's) "big-endian" storage of multi-byte numbers in memory. Usually this just means that you have to have perfect agreement between your calling and called procedures' declarations (don't feed a Byte to a proc expecting Integer, and the reverse). Otherwise values can get multiplied or divided by 256. The pain is that if a function foo expects Byte, you can't call it with a numeric constant, eg as RUN foo(43). Because B09 takes 43 as an Integer constant, so foo() sees only its high byte, which in this case is 0. So to do the above you need: DIM beans:BYTE ... beans = 43 foo(beans) which is a waste in an already too verbose language. I'm interested that PACKed procedures worked better for you. My experience is that PACKing ruins the system's ability to find and link to the machine-code fcns like INKEY and SYSCALL, so I never use PACK. -- Mike Knudsen Bell Labs(AT&T) att!ihlpl!knudsen "Lawyers are like nuclear bombs and PClones. Nobody likes them, but the other guy's got one, so I better get one too."