Subject: Re: Q:GSoft & MemManager Newsgroups: comp.sys.apple2.programmer From: dempson@actrix.gen.nz (David Empson) Date: Fri, 24 Dec 1999 11:49:45 +1300 Message-ID: <1e3ber3.d2ccn91787xnN%dempson@actrix.gen.nz> References: <83ti5t$a9u$1@sylvester.vcn.bc.ca> Organization: Empsoft User-Agent: MacSOUP/2.4.2 NNTP-Posting-Host: 202.49.157.176 X-Original-NNTP-Posting-Host: 202.49.157.176 X-Trace: 24 Dec 1999 11:47:37 NZST, 202.49.157.176 Lines: 67 Path: lobby!newstf02.news.aol.com!portc05.blue.aol.com!supernews.com.MISMATCH!remarQ-easT!remarQ.com!supernews.com!feeder.qis.net!newsfeed.direct.ca!usenet.net.nz!news.iprolink.co.nz!news.actrix.gen.nz!dempson Al Crout wrote: > I would like to use the SUB BlockMove in a program but my code > produces "parameter type mismatch at parameter 1" error msg. > DIM MEM AS LONG > MEM(1) = $00E19E00:! COLOR PALETTE 0 > MEM(2) = $00E19E20:! COLOR PALETTE 1 > MEM(3) = $00000005:! MOVE $20 BYTES > > BLOCKMOVE (@MEM(1), @MEM(2), MEM(3)) Forgive me if I've missed some details, since I'm not familiar with GSoft, but I don't think this would work (even if there wasn't a "parameter mismatch" error). For starters, why are you claiming that a count of 5 will move $20 (32) bytes? Secondly, if I'm correct in assuming that the '@' operator means the same as Pascal's '@' operator and C's '&' operator (get the address of a variable), then you are actually trying to move the contents of the MEM array itself, not the colour palettes. I don't understand why it is claiming a type mismatch, unless BlockMove is prototyped as expecting a "Ptr", which is a "pointer to a byte" (like in C), not a generic "pointer to anything". In this case, the '@' operator may be resulting in a type of "pointer to long". You need to type-cast MEM(1) and MEM(2) into a pointer, not get the address of them. Another possibility might be if you've neglected to include a file which provides GSoft with a prototype of the BlockMove function. In C, it would be necessary to include or (I forget its exact name), and in Pascal, it would be necessary to refer to the corresponding interface unit in a Uses directive. This is how I would do it in C, sticking to the array: void demo(void) { long MEM[3]; MEM[0] = 0x00E19E00; MEM[1] = 0x00E19E20; MEM[2] = 0x00000020; BlockMove((Ptr)MEM[0], (Ptr)MEM[1], MEM[2]); } In Pascal (I'm a little rusty, so some details may be slightly off): Procedure Demo; Var MEM : Array[1..3] of Longint; Begin MEM[1] := $00E19E00; MEM[2] := $00E19E20; MEM[3] := $00000020; BlockMove(Ptr(MEM[1]), Ptr(MEM[2]), MEM[3]); End; You'll need to work out the corresponding syntax for GSoft to do a "typecast to Ptr". -- David Empson dempson@actrix.gen.nz Snail mail: P O Box 27-103, Wellington, New Zealand