houser@mcnc.org (Kevin D. Houser ) (12/15/88)
In an effort to dump data to the midi ports on my Atari ST the following code was tried: VAR i:BYTE; BEGIN i:=$90 ^ The compiler returned with a type not compatible error. So, how do I assign an 8bit value to the variable <i>? I am new to Modula2, so it may be trivial; but it is very important. Any help would be greatly appreciated. (I'm using TDI-Modula2/ST by the way) Thanx, Kevin Houser houser@mcnc.org (919) 859-5467 H (919) 248-1996 W
alan@pdn.UUCP (Alan Lovejoy) (12/17/88)
In article <3818@alvin.mcnc.org> houser@mcnc.org (Kevin D. Houser ) writes: > In an effort to dump data to the midi ports on my Atari ST the following >code was tried: > VAR > i:BYTE; > BEGIN > i:=$90 > ^ > The compiler returned with a type not compatible error. So, how do I >assign an 8bit value to the variable <i>? I am new to Modula2, so it may >be trivial; but it is very important. Any help would be greatly appreciated. >(I'm using TDI-Modula2/ST by the way) The type BYTE in TDI Modula-2 (and most other modulas that have this type) is identical in all respects to the type WORD save one: it is only one byte instead of two (or four on some machines). If the example had been VAR i: WORD; BEGIN i := 90H; then the problem might be more obvious to you: type WORD (and type BYTE) are NOT assignment compatible with ANYTHING that is not also of type WORD (or BYTE). If you want to get your code past the compiler, try: i := BYTE(90H); Hope this helps. -- Alan Lovejoy; alan@pdn; 813-530-8241; Paradyne Corporation: Largo, Florida. Disclaimer: Do not confuse my views with the official views of Paradyne Corporation (regardless of how confusing those views may be). Motto: If nanomachines will be able to reconstruct you, YOU AREN'T DEAD YET.
mandel@uxe.cso.uiuc.edu (12/17/88)
I think the following should work: VAR i : BYTE; BEGIN i := BYTE(90) _______________________ Hector Mandel, Univ. Ill. (urbana), Room 216, 1208 W. Peabody, Urbana, IL 61801 | | A skydiver is taken | mandel@uxe.cso.uiuc.edu | Internet by the gravity | mandel%uxe@uiuc.csnet | Csnet of his situation. | uunet!uiucuxc!uiucuxe!mandel | Usenet | mandel/safety/cerl | PLATO/Novanet | 1:232/413 | Fidonet -----------------------
kloppen@gmdzi.UUCP (Jelske Kloppenburg) (12/19/88)
From article <3818@alvin.mcnc.org>, by houser@mcnc.org (Kevin D. Houser ): > > In an effort to dump data to the midi ports on my Atari ST the following > code was tried: > > VAR > i:BYTE; > BEGIN > i:=$90 > ^ > > The compiler returned with a type not compatible error. So, how do I > assign an 8bit value to the variable <i>? I am new to Modula2, so it may > be trivial; but it is very important. Any help would be greatly appreciated. > (I'm using TDI-Modula2/ST by the way) > > Thanx, > Kevin Houser > houser@mcnc.org > (919) 859-5467 H > (919) 248-1996 W > First of all hexadecimal constants in Modula-2 are designed by an appended H. E.g. 90H or 0FFH. Then you write your data whith BConOut and that takes a character. If you import the appropriate items from BIOS, the following should work: VAR ch: CHAR; BEGIN ch:=CHAR(90H); BConOut(HSS,ch); You can also give character constants in octal, that is ch:=220C, but for Midi this is not so fine. --- kloppenburg@kmx.gmd.dbp.de kloppen@gmdzi.uucp A A A A A A BconOut Then you write your data to the Midi whith Bconout.