BTRON MicroScript Reference Manual

Sample Scripts


_____
BEEP KEYBOARD

Functions that Are Used
  • Multi-threading
  • pow function

_____This is a sample in which the BEEP sound rings out when we press the keyboard on the screen.

_____The "Note_On" function rings the BEEP sound. The argument is a numerical value that makes C3 (middle do) 60 (this is just made the same as MIDI; there is no deep reason). We calculate the frequency from the musical scale with the pow function. Because continuously ringing without limit is not possible with the BEEP statement, we have made the time 20 seconds. The "Note_Off" function stops the BEEP sound.

____When we start up, we first start up the "Release_Monitor" procedure. The "Release_Monitor" procedure waits with WAIT during sound production until the keyboard is released, and then once the keyboard is released, it performs a process that stops the sound generation. After we have started up the "Release_Monitor" procedure, we perform display in the order of white keys and then black keys (the black keys are displayed by overlaying on top of the white keys, and also at the time of pressing, the black keys are checked first).

_____When the keyboard is pressed, the "Press_Processing" function starts up. If it's in the middle of sound production, it stops the sound production, sets the pressed keyboard number in the variable "Sounding," and then calls the "Note_On" function (by lining up in keyboard order event specification segments, we easily perform the calculations). With this, the BEEP sound rings, and then the "Press_Processing" terminates it. When the keyboard is released, the WAIT condition of the "Release_Monitor" procedure is established, and the sound production stops.

SCRIPT (Text)

udqrhnm@Q
cdatf@P

cdehmd@White_Key@b@c@d@e@f@`@a@bQ
cdehmd@Black_Key@br@cr@er@fr@`r
u`qh`akd@SoundingFh

etmb@Note_OffiNoteFhj
addo@OCO
dmc

etmb@Note_OniNoteFhj
knb`k@FrequencyFh
FrequencySSOiQCiNote|TVDOj^PQDOj
addo@FrequencyCQOOOO
dmc

`bshnm@Release_Monitor
qdod`s
@v`hs@iSoundingOjiocaOj
@b`kk@Note_OffiSoundingjG
@Sounding|P
dmcqdod`s
dmc

`bshnm@Press_ProcessingiCj@oqdrr@b@br@c@cr@d@e@er@f@fr@`@`r@a@bQ
he@iSoundingOj
@b`kk@Note_OffG
dmche
Sounding{UO
b`kk@Note_OniSoundingj
dmc

oqnknftd
Sounding|P
dwdbtsd@Release_Monitor
`ood`q@White_Key@Black_Key
dmc

dohknftd
he
@iSoundingOj
@b`kk@Note_OffiSoundingj
dmche
dmc

292, 293

_____
MIDI KEYBOARD

Functions that Are Used
  • Multi-threading
  • RS-232C (transmission only)

_____This is a sample in which a MIDI sound source connected to the RS-232C rings out when we press the keyboard on the screen.

_____The "Note_On" function rings the BEEP sound. The argument is a numerical value that makes C3 (middle do) 60 (this is the same for the numerical values we transmit to MIDI). This transmits the Note_On message to the RS-232C. The "Note_Off" message similarly transmits the Note_Off message.

____When we start up, we first start up the "Release_Monitor" procedure. The "Release_Monitor" procedure waits with WAIT during sound production until the keyboard is released, and then once the keyboard is released, it performs a process that stops the sound generation. After we have started up the "Release_Monitor" procedure, we perform display in the order of white keys and then black keys (the black keys are displayed by overlaying on top of the white keys, and also at the time of pressing, the black keys are checked first).

_____When the keyboard is pressed, the "Press_Processing" function starts up. If it's in the middle of sound production, it stops the sound production, sets the pressed keyboard number in the variable "Sounding," and then calls the "Note_On" function (by lining up in keyboard order event specification segments, we easily perform the calculations). With this, the BEEP sound rings, and then the "Press_Processing" terminates it. When the keyboard is released, the WAIT condition of the "Release_Monitor" procedure is established, and the sound production stops.

SCRIPT (Text)

udqrhnm@Q
cdatf@P

cdehmd@White_Key@b@c@d@e@f@`@a@bQ
cdehmd@Black_Key@br@cr@er@fr@`r
cdehmd@Port_Number@P
u`qh`akd@SoundingFh

etmb@Note_OffiNoteFhj
qrots@Port_NumberCOXOCNoteCO
dmc

etmb@Note_OniNoteFhj
qrots@Port_NumberCOXOCNoteCUS
dmc

`bshnm@Release_Monitor
qdod`s
@v`hs@iSoundingOjiocaOj
@b`kk@Note_OffiSoundingjG
@Sounding|P
dmcqdod`s
dmc

`bshnm@Press_ProcessingiCj@oqdrr@b@br@c@cr@d@e@er@f@fr@`@`r@a@bQ
he@iSoundingOj
@b`kk@Note_OffG
dmche
Sounding{UO
b`kk@Note_OniSoundingj
dmc

oqnknftd
qrhmhs
@Port_NumberCOQOPWCRWSOO
Sounding|P
dwdbtsd@Release_Monitor
`ood`q@White_Key@Black_Key
dmc

dohknftd
he
@iSoundingOj
@b`kk@Note_OffiSoundingj
dmche
dmc

294, 295

_____
FALLING SIMULATION

Functions that Are Used
  • Animation
  • Multi-threading
  • Drag movement

_____This is a simulation in which a ball falls and is reflected on an inclined surface. Because it processes with integer values, there are also some unnatural points; for the time being it moves like that.

_____The "Location_Calculation" function carries out falling processing in one-step increments. Even the reflection for a case where the ball collides with a wall is processed here. Calculation for the processing in which the ball collides with the inclined surface is complicated, but it can be derived from basic matrix calculations.

_____When the program is started up, first it displays the segments, and then it starts up the "Ball_Falling" procedure.

_____The "Ball_Falling" procedure carries out the simulation by continuously calling up the "Location_Calculation" function. It initializes the speed to 0, and after that it just repeatedly calls up the "Location_Calculation" function.

_____The "Move_Ball" procedure starts up when the ball has been pressed. First, it terminates the "Ball_Falling" procedure (because the "Location_Calculation" is CALLed from the "Ball_Falling" procedure, it is necessary to terminate the "Ball_Falling" procedure to terminate the "Location_Calculation" function), and then it makes the pointer into the "Grip." We save the slippage between the ball's location and the pointer's location in "Slippage_X" and "Slippage_Y," and every time the pointer moves, the location of the ball also moves. This repeats until release, and once released, we return the pointer to its source and start up the "Ball_Falling" procedure.

SCRIPT (Text)

udqrhnm@Q
cdatf@P

cdehmd@Radius@iBallDv^Qj
cdehmd@Gravity_Acceleration@S
cdehmd@Reflectance@|PX^PO
@@With |Q, complete reflection; with |P, no reflection

u`qh`akd@SpeedwFhCSpeedxFh
u`qh`akd@New_wFhCNew_xFh
u`qh`akd@Reflection_Speed_wFhCReflection_Speed_xFh
u`qh`akd@For_WorkFh

Calculation processing one step at a time
etmb@Location_Calculation
SpeedxSpeedx{Gravity_Acceleration
New_wBallDw{Radius{Speedw^S
New_xBallDx{Radius{Speedx^S
Reflection_Speed_wO
Reflection_Speed_xO
Left wall processing
he@New_wSlopeDw{Radius
@Reflection_Speed_wSpeedw
@New_wSlopeDw{Radius
dmche
Right wall processing
he@New_wSlopeDw{SlopeDv|Radius
@Reflection_Speed_wSpeedw
@New_wSlopeDw{SlopeDv|Radius
dmche
Top wall processing
he@New_xRadius
@Reflection_Speed_xSpeedx
@New_xRadius
dmche
Bottom wall processing
he@New_x{iNew_w|SlopeDwjSlopeDg^SlopeDvSlopeDx{SlopeDg|Radius
@For_WorkSlopeDvSlopeDv{SlopeDgSlopeDg
@Reflection_Speed_wiSlopeDgSlopeDgSpeedw{SlopeDgSlopeDvSpeedxj^For_Work
@Reflection_Speed_xiSlopeDgSlopeDvSpeedw{SlopeDvSlopeDvSpeedxj^For_Work
@New_xSlopeDx{SlopeDg|Radius|iNew_w|SlopeDwjSlopeDg^SlopeDv
dmche
SpeedwSpeedw{Reflection_Speed_wReflectance
SpeedxSpeedx{Reflection_Speed_xReflectance
Moving the ball
lnud@BallFNew_w|RadiusCNew_x|Radius@
dmc

Loop
`bshnm@Ball_Falling
SpeedwO
SpeedxO
qdod`s
@b`kk@Location_Calculation
@rkddo@QO
dmcqdod`s
dmc

Processing for grasping the ball
`bshnm@Move_Ball@oqdrr@Ball
knb`k@Location_wFhCLocation_xFh
knb`k@Slippage_wFhCSlippage_xFh
Stopping the falling processing one time
sdqlhm`sd@Ball_Falling
Making the point into the "Grip"
ocrT
Location_w|P
Slippage_wocw|BallDw
Slippage_xocx|BallDx
Repeat while the button is being pressed
qdod`s
Acquire the pointer coordinates
@New_wocw|Slippage_wG
@New_xocx|Slippage_x
If the location has changed, move the ball also
@he@iNew_wILocation_wjbbiNew_xILocation_xj
@@Location_wNew_w
@@Location_xNew_x
@@lnud@BallFNew_wCNew_x@
@dmche
If the button has been released, terminate repetition
@he@ocaO
@@aqd`j
@dmche
dmcqdod`s

Return the pointer to the source
ocrO
Restart falling processing
dwdbtsd@Ball_Falling
dmc

Startup processing
oqnknftd
Background preparation
`ood`q@Slope@Ball
Start of calculation processing
dwdbtsd@Ball_Falling
dmc

296, 297

_____
ANIMATION SWITCH

Functions that Are Used
  • Animation
  • Multi-threading
  • Press processing
  • Scene switching

_____This is a sample in which a switch display is made up in the form of animation and switches to a different scene when someone presses a switch.

_____For animation processing, we utilize the SETSEG statement. We substitute temporarily with the SETSEG statement "anime region" segments in variable segment variables. Through this, anime region locations are set in the variable segment variables (the anime region segments are used only in showing locations; they are not displayed).

_____Each thread of the anime processing changes by the SETSEG statement the variable segment, if the variable segment variable has been displayed. As for the SETSEG statement, because only the segment contents are changed with the location as is from the second time onward, the various figures of the animation can be laid out in free locations. Also, when we display with APPEAR, that segment comes to the forefront, but because the front-back relationship of the segments does not change with SETSEG, we can continue to place in the forefront a frame for press judgment use.

_____For press processing, we have collected together in one procedure the processing of each screen (because this is substituted into a symbol variable, it has been declared in the SCRIPT statement at the beginning). This is because when we create a separate procedure for each switch, there is the possibility that in the middle of executing one procedure, another switch will be pressed and a procedure will start up. If we utilize the fact that only one thread can be executed at a time in the ACTION statement, and make it so that we enter inside a single procedure processing that would be troublesome if run simultaneously, then a script with high reliability can be created.

_____The processing for when the screen switch is pressed is complicated at a glance, but this is because we made it so that we can create multiple screens with the smallest modifications possible, and after the script has branched in the beginning with the SWITCH statement, everything is made up completely the same. With the SWITCH statement, we divide the scene switching processing and the press processing. The scene switching processing just displays the necessary segments with the SCENE statement (it is also possible to add effects here). The press processing substitutes segments being pressed and corresponding procedures in symbol variables, and it loops until the button has been released. When the location of the pointer is inside a segment, it displays the segment being pressed; and when the location of the pointer comes outside of the segment, it erases the segment being pressed. When a segment being pressed has been displayed at the time the pointer has been released, the script calls up the corresponding procedure, and it switches the scene.

Translator's Note: On the @Startup_Background panel some writing is barely visible at the bottom of the white squares labeled Anime_A_Region and Anime_B_Region. The writing is A and B, which is Japanese for "Process A" and "Process B." These become visible when one starts up the Japanese-language sample program.

SCRIPT (Text)

udqrhnm@Q
cdatf@P

rdfldms@Anime_ACAnime_BCAnime_CCAnime_D
rCRIPT Startup_Screen_ProcessingCProcess_A_Screen_Processing,\
Process_B_Screen_Processing

Threads used for animation

`bshnm@Anime_A_Processing
knb`k@Anime_A_ArrayFrmUn
Anime_A_ArraymFnAnime_AOCAnime_APCAnime_AQCAnime_ARCAnime_ASCAnime_AT
qdod`s
@qdod`s@U
@@rdsrdf@Anime_AAnime_A_Arraymbmsn
@@rkddo@POO
@@v`hs@Anime_ADr
@dmcqdod`s
dmcqdod`s
dmc

`bshnm@Anime_B_Processing
knb`k@Anime_B_ArrayFrmUn
Anime_B_ArraymFnAnime_BOCAnime_BPCAnime_BQCAnime_BRCAnime_BSCAnime_BT
qdod`s
@qdod`s@U
@@rdsrdf@Anime_BAnime_B_Arraymbmsn
@@rkddo@POO
@@v`hs@Anime_BDr
@dmcqdod`s
dmcqdod`s
dmc

`bshnm@Anime_C_Processing
knb`k@Anime_C_ArrayFrmUn
Anime_C_ArraymFnAnime_AOCAnime_APCAnime_AQCAnime_ARCAnime_ASCAnime_AT
qdod`s
@qdod`s@U
@@rdsrdf@Anime_CAnime_C_Arraymbmsn
@@rkddo@POO
@@v`hs@Anime_CDr
@dmcqdod`s
dmcqdod`s
dmc

`bshnm@Anime_D_Processing
knb`k@Anime_D_ArrayFrmUn
Anime_D_ArraymFnAnime_BOCAnime_BPCAnime_BQCAnime_BRCAnime_BSCAnime_BT
qdod`s
@qdod`s@U
@@rdsrdf@Anime_DAnime_D_Arraymbmsn
@@rkddo@POO
@@v`hs@Anime_DDr
@dmcqdod`s
dmcqdod`s
dmc

Processing in each scene
In a case where you have called up with iOC|Pjrespectively, the scene switches

`bshnm@Startup_Screen_ProcessingiPress_SegmentCNumberj\@
oqdrr@Press_Frame_Startup_ACPress_Frame_Startup_B
knb`k@Pressed_SegmentFrCCorresponding_ProcedureFr
rvhsbg@Number
@b`rd@|P Scene switching
@@rbdmd@Startup_BackgroundCAnime_ACAnime_BCPress_Frame_Startup_A,\
Press_Frame_Startup_B
@@dwhs
@b`rd@O A press
@@Pressed_SegmentPressed_Startup_A
@@Corresponding_ProcedureProcess_A_Screen_Processing
@@aqd`j
@b`rd@P B press
@@Pressed_SegmentPressed_Startup_B
@@Corresponding_ProcedureProcess_B_Screen_Processing
@@aqd`j
dmcb`rd
vghkd
@oca
@he@iPress_SegmentDwocwjiPress_SegmentDxocxjiocwPress_SegmentDw{Press_SegmentDvjiocxPress_SegmentDx{Press_SegmentDgj
@@`ood`q@Pressed_Segment
@dkrd
@@chr`ood`q@Pressed_Segment
@dmche
@rkddo@SO
dmcvghkd
he
@Pressed_SegmentDr
@chr`ood`q@Pressed_Segment
@dwdbtsd@Corresponding_ProcedureiOC|Pj
@rtrodmc@Corresponding_Procedure
dmche
dmc
`bshnm@Process_A_Screen_ProcessingiPress_SegmentCNumberj\@
oqdrr@Cancel_Press_Frame_Process_A
knb`k@Pressed_SegmentFrCCorresponding_ProcedureFr
rvhsbg@Number
@b`rd@|P Scene switching
@@rbdmd@Process_A_BackgroundCAnime_CCCancel_Press_Frame_Process_A
@@dwhs
@b`rd@O Cancel press
@@Pressed_SegmentCancel_Pressed_Process_A
@@Corresponding_ProcedureStartup_Screen_Processing
@@aqd`j
dmcb`rd
vghkd
@oca
@he@iPress_SegmentDwocwjiPress_SegmentDxocxjiocwPress_SegmentDw{Press_SegmentDvjiocxPress_SegmentDx{Press_SegmentDgj
@@`ood`q@Pressed_Segment
@dkrd
@@chr`ood`q@Pressed_Segment
@dmche
@rkddo@SO
dmcvghkd
he
@Pressed_SegmentDr
@chr`ood`q@Pressed_Segment
@dwdbtsd@Corresponding_ProcedureiOC|Pj
@rtrodmc@Corresponding_Procedure
dmche
dmc
`bshnm@Process_B_Screen_ProcessingiPress_SegmentCNumberj\@
oqdrr@Cancel_Press_Frame_Process_B
knb`k@Pressed_SegmentFrCCorresponding_ProcedureFr
rvhsbg@Number
@b`rd@|P Scene switching
@@rbdmd@Process_B_BackgroundCAnime_DCCancel_Press_Frame_Process_B
@@dwhs
@b`rd@O Cancel press
@@Pressed_SegmentCancel_Pressed_Process_B
@@Corresponding_ProcedureStartup_Screen_Processing
@@aqd`j
dmcb`rd
vghkd
@oca
@he@iPress_SegmentDwocwjiPress_SegmentDxocxjiocwPress_SegmentDw{Press_SegmentDvjiocxPress_SegmentDx{Press_SegmentDgj
@@`ood`q@Pressed_Segment
@dkrd
@@chr`ood`q@Pressed_Segment
@dmche
@rkddo@SO
dmcvghkd
he
@Pressed_SegmentDr
@chr`ood`q@Pressed_Segment
@dwdbtsd@Corresponding_ProcedureiOC|Pj
@rtrodmc@Corresponding_Procedure
dmche
dmc
oqnknftd
rdsrdf
@Anime_AAnime_A_Region
rdsrdf@Anime_BAnime_B_Region
rdsrdf@Anime_CAnime_C_Region
rdsrdf@Anime_DAnime_D_Region
dwdbtsd@Anime_A_ProcessingCAnime_B_ProcessingCAnime_C_Processing,\
Anime_D_Processing
dwdbtsd@Startup_Screen_ProcessingiOC|Pj
dmc
298-301

_____
MIDI PLAYBACK

Functions that Are Used
  • Real-time processing
  • File read-in
  • Special format read-in
  • RS-232C (transmission only)

_____This is a sample in which we interpret a Standard MIDI File (SMF), which is a standard music file type, and then play it. However, it will not be of practical use for processing in a case where the tempo changes in multiple tracks, and there are deficiencies in fine error checking. Please treat it as a sample that handles files of a special type.

_____We take in the SMF using the 1B MIDI player. After naming the just made real object "Target," we load it into the real object of the script.

_____In PROLOGUE, we read in the file. First, we search for the record in which the beginning starts in the order 0xe7, 0xff. This is the specification fusen that is used in the MIDI player. Once it is found, it is judged as to whether it is a large segment or not, and then we hand over the beginning location of the main body to the "SMF_Analysis" procedure.

_____The "SMF_Analysis" function, after initially checking whether it's really SMF or not, takes out the necessary information from the header portion. It seeks the number of tracks, and then starts up "Track_Processing" for each track. For this reason, the "Track_Processing" procedure is declared with MACTION.

_____The "Track_Processing" procedure checks the information of each track, and then it takes out the length of the track. Because multiple tracks execute simultaneously with this procedure, variables are declared with LOCAL so that there will be no interference among the threads. Afterward, while waiting for a time, data are interpreted and output to the RS-232C. Since there is the possibility of outputting simultaneously from multiple threads, we output the individual commands in their entirety once, and thus we make it so that the outputs do not get mixed together.

_____Furthermore, there is a line that begins with "#LOG;" this is what remains from when we first debugged using using the LOG statement. Once it became unnecessary, we made it invalid by attaching "#" at the beginning. When a problem occurs again, obtaining the necessary information becomes easy.

SCRIPT (Text)

udqrhnm@Q
cdatf@P

cdehmd@Port_Number@P
cdehmd@Max_Size@POOOOOO

u`qh`akd@rleFamMax_Sizen
u`qh`akd@rle_SizeFh

u`qh`akd@Tempo_ResolutionFh
u`qh`akd@Time_UnitFh second units
u`qh`akd@Base_TimeFh second units

etmb@Time_WaitiTarget_TimeFhj
knb`k@DifferenceFh

DifferenceTarget_Time|lrdbPOOO
he@iDifferenceOj
@rkddo@Difference^POOO
dmche
dmc

l`bshnm@Track_ProcessingiLocationFhj
knb`k@Final_LocationFh
knb`k@Present_LocationFh second units
knb`k@Running_StatusFh
knb`k@LengthFh

Present_LocationBase_Time
knf@hOQ@OQ@OQ@OQhCrlemLocationnCrlemLocation{PnCrlemLocation{QnCrlemLocation{Rn
he@rlemLocationnIOS
@knf@hThese are data outside processing targeth
@ehmhrg
dkrdhe
@rlemLocation{PnIOTS
@knf@hThese are data outside processing targeth
@ehmhrg
dkrdhe
@rlemLocation{QnIOVQ
@knf@hThese are data outside processing targeth
@ehmhrg
dkrdhe
@rlemLocation{RnIOU
@knf@hThese are data outside processing targeth
@ehmhrg
dmche

Final_LocationLocation{W{irlemLocation{SnQSj{irlemLocation{TnPUj{irlemLocation{UnWj{rlemLocation{Vn
LocationLocation{W
vghkd@LocationFinal_Location Play processing
@LengthO
@qdod`s Variable length type expression
@@LengthiLengthVj{irlemLocationnOVj
@@LocationLocation{P
@@he@rlemLocation|PnOWO
@@@aqd`j
@@dmche
@dmcqdod`s
@Present_LocationPresent_Location{LengthTime_Unit
@b`kk@Time_WaitiPresent_Locationj
@
@he@rlemLocationnOO Voice/mode message
@@he@rlemLocationnOWO Not running status
@@@Running_StatusrlemLocationn
@@@LocationLocation{P
@@dmche
@@rvhsbg@Running_StatusOO
@@@b`rd@OO
@@@b`rd@OO
@@@@qrots@Port_NumberCRunning_StatusCrlemLocationn
@@@@LocationLocation{P
@@@@aqd`j
@@@b`rd@OWO
@@@b`rd@OXO
@@@b`rd@OO
@@@b`rd@OO
@@@b`rd@OO
@@@@qrots@Port_NumberCRunning_StatusCrlemLocationFQn
@@@@LocationLocation{Q
@@@@aqd`j
@@dmcb`rd
@dkrdhe@irlemLocationnOj MetaEevent
@@rvhsbg@rlemLocation{Pn
@@@b`rd@OQ Track termination
@@@@dwhs
@@@b`rd@OTP Tempo modification
@@@@Time_UnitiirlemLocation{RnPUj{irlemLocation{SnWj{rlemLocation{Tnj^Tempo_Resolution
@@@@aqd`j
@@dmcb`rd
@@LocationLocation{Q
@@LengthO
@@qdod`s Variable length type expression
@@@LengthiLengthVj{irlemLocationnOVj
@@@LocationLocation{P
@@@he@rlemLocation|PnOWO
@@@@aqd`j
@@@dmche
@@dmcqdod`s
@@LocationLocation{Length
@dkrd
@@rvhsbg@rlemLocationn CommonEreal-time message
@@@b`rd@OO
@@@@LocationLocation{P
@@@@LengthO
@@@@qdod`s Variable length type expression
@@@@@LengthiLengthVj{irlemLocationnOVj
@@@@@LocationLocation{P
@@@@@he@rlemLocation|PnOWO
@@@@@@aqd`j
@@@@@dmche
@@@@dmcqdod`s
@@@@qrots@Port_NumberCOOCrlemLocationFLengthn
@@@@LocationLocation{Length
@@@@aqd`j
@@@b`rd@OP
@@@b`rd@OR
@@@@qrots@Port_NumberCRunning_StatusCrlemLocationn
@@@@LocationLocation{P
@@@@aqd`j
@@@b`rd@OQ
@@@@qrots@Port_NumberCRunning_StatusCrlemLocationFQn
@@@@LocationLocation{Q
@@@@aqd`j
@@@b`rd@OV
@@@@LocationLocation{P
@@@@LengthO
@@@@qdod`s Variable length type expression
@@@@@LengthiLengthVj{irlemLocationnOVj
@@@@@LocationLocation{P
@@@@@he@rlemLocation|PnOWO
@@@@@@aqd`j
@@@@@dmche
@@@@dmcqdod`s
@@@@qrots@Port_NumberCrlemLocationFLengthn
@@@@LocationLocation{Length
@@@@aqd`j
@@@cde`tks
@@@@qrots@Port_NumberCrlemLocationn
@@dmcb`rd
@dmche
dmcvghkd
dmc

etmb@SMF_AnalysisiLocationFhj
u`qh`akd@Track_NumberFh

knf@hOQ@OQ@OQ@OQhCrlemLocationnCrlemLocation{PnCrlemLocation{QnCrlemLocation{Rn

ls check
he@rlemLocationnIOS
@knf@hThese are data outside processing targeth
@ehmhrg
dkrdhe
@rlemLocation{PnIOTS
@knf@hThese are data outside processing targeth
@ehmhrg
dkrdhe
@rlemLocation{QnIOUW
@knf@hThese are data outside processing targeth
@ehmhrg
dkrdhe
@rlemLocation{RnIOUS
@knf@hThese are data outside processing targeth
@ehmhrg
dmche

Track_NumberirlemLocation{POnWj{rlemLocation{PPn
Tempo_ResolutionirlemLocation{PQnWj{rlemLocation{PRn
LocationLocation{W{irlemLocation{SnQSj{irlemLocation{TnPUj{irlemLocation{UnWj{rlemLocation{Vn
Time_UnitTOOOOO^Tempo_Resolution
knf@hTrack_Numberij@Tempo_ResolutionijhCTrack_NumberCTempo_Resolution

ls search
qdod`s@Track_Number
@dwdbtsd@Track_ProcessingiLocationj
@LocationLocation{W{irlemLocation{SnQSj{irlemLocation{TnPUj{irlemLocation{UnWj{rlemLocation{Vn
dmcqdod`s
dmc

oqnknftd
knb`k
@LocationFh

qrhmhs@Port_NumberCOOOPWCRWSOO
qdod`s
@eqd`c@TargetCbmsCOCMax_SizeCrleCrle_Size
@he@rlemOnIOV
@@bnmshmtd
@dkrdhe@rlemPnIO
@@bnmshmtd
@dmche
@aqd`j
dmcqdod`s

Base_Timeilrdb{POOOjPOOO
he@irlemQnOjirlemRnOj
@b`kk@SMF_AnalysisiUU{Wj
dkrd
@b`kk@SMF_AnalysisiUU{Sj
dmche
dmc

Cho Kanji Samples' Note: The SMF real object has not been entered. For that reason, when you start up as is in MicroScript, an error will be displayed. Please take in the SMF using the 1B MIDI player, attach the name "Target" to the script real object, and then load it inside the script real object.
302-304

II Samples Section

SERIAL TRANSMISSION

Functions that Are Used
  • File read-in
  • TAD read-in
  • Code conversion
  • RS-232C (transmission only)

_____This is a sample in which we read in only characters from a TAD-type real object created with the Basic Text Editor, convert the codes, and then transmit them to the RS-232C.

_____With the function "Read_Real_Object," we read in a real object with the name "Input." We find a record in which the beginning is made up as 0xff80`0xffff, and then we go on to load into the character array of "Copy_Object" only the character segments inside that. Because things other than characters are also included inside TAD, we read the length of the segments and skip.

_____Once we have read in the real object, we convert the character codes using the srconv function. Here, we are making it ASCII+EUC, but we can convert to the necessary character codes by changing the argument of the srconv function.

_____Because the RSPUT statement can only transmit up to 512 bytes at a time, we are transmitting one byte each using the REPEAT statement.

SCRIPT (Text)

udqrhnm@Q
cdatf@P

cdehmd@Port_Number@O
cdehmd@smtkk@O
cdehmd@Max_Size@QOOOOO

u`qh`akd@Copy_ObjectFbmMax_Sizen
u`qh`akd@Transmission_BufferFamMax_Sizen
u`qh`akd@Character_LocationFh

Open the "Input" real object, and then read only characters into the "Copy_Object"
character array up to the "Max_Size" characters
etmb@Read_Real_Object
knb`k@SegmentFbmSn
knb`k@Record_NumberFhC@Record_SizeFh
knb`k@Read_LocationFhC@Write_LocationFh

Read_LocationO
Write_LocationO
Record_NumberO
qdod`s
@eqd`c@InputCRecord_NumberCOCQCSegmentCRecord_Size
@he@idqqIOj
@@dwhs@dqq
@dmche
@he@iSegmentmOnOWOj
@@aqd`j
@dmche
@Record_NumberRecord_Number{P
dmcqdod`s
ldrf@hRecord_NumberF@Record_SizeFhCRecord_NumberCRecord_Size
vghkd@iiRead_LocationRecord_SizejiWrite_LocationMax_Size|Pjj
@eqd`c@InputCRecord_NumberCRead_LocationCWCSegment
knf@hSegment@TypeFOS@LengthFOSh@SegmentmOn@SegmentmPn
@he@iSegmentmOnOWOj In the case of a character segment
@@Copy_ObjectmWrite_LocationnSegmentmOn
@@Write_LocationWrite_Location{P
@@Read_LocationRead_Location{Q
@@bnmshmtd
@dmche In the case of a variable length segment
@he@iSegmentmPnIOj Ordinary segment
@@Read_LocationRead_Location{SegmentmPn{S
@dkrd Large segment
@@Read_LocationRead_Location{iiSegmentmRnPUj{SegmentmQnj{W
@dmche
dmcvghkd

Copy_ObjectmWrite_Locationnsmtkk
dmc

oqnknftd
knb`k
@LengthFh

`ood`q@Status_Display
sdws@Status_DisplayChReadingh
qrhmhs@Port_NumberCPWCXUOO
Copy_ObjectmFnsmtkk
b`kk@Read_Real_Object
sdws@Status_DisplayChReading Finishedh
LengthiTransmission_BufferCOCCopy_ObjectCOCOCffj
sdws@Status_DisplayChTransmittingibytesjhCLength
qdod`s@Length
@qrots@Port_NumberCTransmission_Buffermbmsn
dmcqdod`s
sdws
@Status_DisplayChTransmission Finishedh

dmc

305, 306


The above contents of BTRON MicroScript Reference Manual were translated and loaded onto this Web page with the permission of Personal Media Corporation.

Copyright (c) 1997 Personal Media Corporation

Copyright (c) 2010 Sakamura Laboratory, University Museum, University of Tokyo