Op Sun, 13 Feb 2011 13:10:41 +0100 schreef Adrian Ives <adr...@acanthis.co.uk>:
250 REMark ======================================================= 260 REMark : 270 DEFine FuNction GetDWordResponse$(Cmd%) 280 LOCal Response, High%, Low% 290 USB_PUTCMD Cmd% 300 Response= USB_GETCMD 310 High%= Response DIV 65536 320 Low%= Response MOD 65536 330 RETurn High% & '/' & Low% 340 END DEFine GetDWordResponse$ 350 REMark : 360 REMark ======================================================= 370 REMark : 380 DEFine FuNction Get32BitResponse$(Cmd%) 390 LOCal Response, High%, Low% 400 USB_PUTCMD Cmd% 410 Response= USB_GETCMD 420 High%= Response DIV 65536 430 Low%= Response MOD 65536 440 RETurn BIN$(High%,16) & "/" & BIN$(Low%,16) 450 END DEFine Get32BitResponse$
I think these functions need a little adjustment. The DIV & MOD functions in S'Basic work on signed Integers and not on Longs. Value DIV 65536 will always produce zero. Value MOD 65536 will always produce value. There probably are Long DIV/MOD functions in some toolkit out there, I just happened to find one in an old Machine Code book. Otherwise just use '/' and INT to extract the high% and low% parts. high%=INT(response / 65536): low%=response -(high% * 65536) Bob -- The BSJR QL software site at: http://members.chello.nl/b.spelten/ql/ _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm