#: 9952 S10/OS9/6809 (CoCo)
24-Mar-91 19:59:38
Sb: #9939-#OS9 Windowing System
Fm: Kevin Darling 76703,4227
To: George Hendrickson 71071,2003 (X)
George,
As JJ mentioned, what's mainly happening to you is that the PRINT statement
does an edited write... in other words, CRs have LFs added and so on. Which
means chr$(13) or chr$(10) will add in extra data which messes you up.
The solution is to use unedited writes... with the PUT statement. For example,
a procedure to change palettes might be:
PROCEDURE setpal
(* usage: RUN setpal(path,palettenumber,palettevalue)
PARAM path,palnum,palval:INTEGER
DIM esc(4):BYTE
esc(1)=$1B
esc(2)=$31
esc(2)=palnum
esc(3)=palval
PUT #path,esc
END
The "PUT #path,esc" sends out the 4 bytes composing the "esc" array without any
output editing. Another example with two-byte values for moving the current
draw pointer might be:
PROCEDURE setdptr
(* usage: RUN setdptr(path,newx,newy)
PARAM path,x,y:INTEGER
DIM esc(6):BYTE
esc(1)=$1B
esc(2)=$40
esc(3)=x/256
esc(4)=land(x,$FF)
esc(5)=y/256
esc(6)=land(y,$FF)
PUT #path,esc
The x/256 gets the high byte of an integer, the land(x,$FF) gets the low byte.
Yell if unclear. - kev
There are 2 Replies.
|