lego rcx assembler and a case study n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Lego RCX Assembler and a Case Study PowerPoint Presentation
Download Presentation
Lego RCX Assembler and a Case Study

Loading in 2 Seconds...

play fullscreen
1 / 16

Lego RCX Assembler and a Case Study - PowerPoint PPT Presentation


  • 548 Views
  • Uploaded on

Lego RCX Assembler and a Case Study. Luis Paris Dept. of Computer Science University of Mississippi. Java C, C++, Pascal Forth MindScript, NQC, Lego ASM. TinyVM, leJOS brickOS pbForth Standard Lego RCX. Supported Languages/Firmwares. Language. Firmware. RCX Internals.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Lego RCX Assembler and a Case Study' - elina


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
lego rcx assembler and a case study

Lego RCX Assembler and a Case Study

Luis Paris

Dept. of Computer Science

University of Mississippi

supported languages firmwares
Java

C, C++, Pascal

Forth

MindScript, NQC, Lego ASM

TinyVM, leJOS

brickOS

pbForth

Standard Lego RCX

Supported Languages/Firmwares

Language

Firmware

rcx internals
RCX Internals
  • Hitachi H8 microcontroller
    • On-chip 16K ROM
    • External 32K RAM
  • I/O devices
    • Three motor ports
    • Three sensor ports
    • IR communications port
rcx virtual machine
RCX Virtual Machine
  • Implemented by the Lego RCX firmware
  • Virtual Machine Characteristics
  • Byte Code Interpreter
  • Sources and values
  • Byte Code Command Set
case study lego rcx assembler
Case Study: Lego RCX Assembler
  • Motivation
    • Project for CSCI-450 Programming Languages
    • Lego Assembler hides output object file
      • Result: Byte code nor object format can’t be studied
    • Does not support definition list
      • Result: Programs hard to read and maintain
  • Project: Create a Lego RCX Assembler
    • More robust
    • Runs standalone
solution strategy
Solution Strategy
  • Two stages:
    • Lexical/Syntax analysis (Parsing)
      • Finite State Machine
      • Library functions (scanf, string.tokenizer)
    • Code generation (one-to-one)
      • No one-to-many semantic analysis (as in compilers)
      • Mnemonic to Opcode conversion
      • Parameters to Byte Code conversion
which language c c or java
Which language C/C++ or Java?
  • Java is a powerful OOP language but…not really suitable for system programming
    • No bit-fields support
    • No operator overloading
  • Both C/C++ support bit-fields
  • However, C++ has unnecessary, confusing features (multiple inheritance)
bit fields
Bit-fields
  • After parsing ASM command “out 6, 23”:
  • Variables contain: instr = “out”; param1 = 6; param2 = 23
  • Problem: encode “out param1, param2” into above data structure
  • C/C++ can declare P1 and P2 as bit-fields as follows:
  • Java can NOT declare bit-fields so it must merge P1 and P2:
  • Therefore, Java programmer must perform bit shifting and masking operations;whereas the C/C++ compiler does it for us.

then do:

then do:

prelab instructions
PreLab Instructions

Part 1:

  • Click StartRun
  • Type \\luis\lego\
  • Move “workshop” folder to your “desktop”
  • Close \\luis\lego\ folder

Part 2:

  • Open “workshop” folder in your desktop
  • Install “LEGOMindstormsSDK25.exe”
  • Install “bricxcc_setup_3377.exe” (if not installed)
  • Download Lego RCX Firmware (if not installed)
open the scripted application
Open the ScriptEd application
  • Click StartLEGO SoftwareAll ProgramsMindStorms SDKToolsScriptEd
  • On the ScriptEd application,Click OpenPort
  • Select your Tower Port (COM1, or USB1)
  • On the toolbar select LASM (2nd combo box)
download pathfind asm file to rcx
Download “pathfind.asm” file to RCX

Part 1:

  • On the ScriptEd application,Click FileOpen
  • Browse to “workshop” folder
  • In File name, type *.asm (instead of *.rcx2)
  • Select “pathfind.asm” and open it

Part 2:

  • Click on ScriptDownload
  • Test your RCX
open the bricxcc application
Open the BricxCC application
  • Click StartAll ProgramsBricx Command CenterBricx Command Center
  • On the “Searching for the Brick” window,Select your Tower Port (COM1, or USB1)
compile download pathfind nqc
Compile & Download “pathfind.nqc”

Part 1:

  • On the BricxCC application,Click FileOpen
  • Browse to “workshop” folder
  • Select “pathfind.nqc” and open it

Part 2:

  • Click on CompileDownload
  • Test your RCX
references
References
  • The Bricx Command Center (BricxCC)http://bricxcc.sourceforge.net/
  • The Lego Mindstorms SDK 2.5 (ScriptEd)http://mindstorms.lego.com/eng/community/resources/