Difference between revisions of "Tutorial Moodle VPL Assembly Language with Output"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- <br /> {| style="width:100%;" | style="width:60%;" | __TOC__ | Image:MoodleVPLLogo.png |} <br /> <bluebox> This tutorial presents a simple VPL activity to tes...")
 
(VPL Activity)
 
(8 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
[[Image:MoodleVPLLogo.png]]
 
[[Image:MoodleVPLLogo.png]]
 
|}
 
|}
 +
<br />
 +
----
 +
<center>[[Tutorials#Moodle_Virtual-Programming-Lab_.28VPL.29|Moodle VPL Tutorials]]</center>
 +
----
 +
<br />
 
<br />
 
<br />
 
<bluebox>
 
<bluebox>
This tutorial presents a simple VPL activity to test an assembly language program that displays a fixed string of characters.
+
This tutorial builds on the [[Tutorial: Moodle VPL Hello World -- Python|first one in the series]], which should be done first, as the present tutorial skips some steps.  In this tutorial I present a simple VPL activity to test an assembly language program that displays a fixed string of characters.
 
</bluebox>
 
</bluebox>
 +
<br />
 +
=Setup=
 +
<br />
 +
* Moodle Version 2.7 + (Build: 20140529)
 +
* VPL Version 3.0.1
 +
* For details on how Moodle and VPL were installed, go to this [[Moodle VPL Server Setup| page]].
 
<br />
 
<br />
 
=VPL Activity=
 
=VPL Activity=
Line 20: Line 31:
 
  Type of work: Individual work
 
  Type of work: Individual work
 
  Grade settings: Maximum grade: 100
 
  Grade settings: Maximum grade: 100
  Run: No Evaluate: No
+
  Run: Yes Evaluate: Yes
  Assembly Language program that display stars
+
  Assembly Language program that displays stars
 
==Execution files==
 
==Execution files==
 
===vpl_run.sh===
 
===vpl_run.sh===
Line 49: Line 60:
 
*********************
 
*********************
 
"
 
"
 +
</source>
 
<br />
 
<br />
 +
 
=Testing=
 
=Testing=
 
<br />
 
<br />
 +
* In the '''VPL Administration''' box, click on '''Test activity''', '''Edit''', and enter the solution program below in the edit box:
 +
<br />
 +
:<source lang="asm">
 +
 +
                        section .data
 +
        stars          db      "*********************", 10
 +
                        db      "*********************", 10
 +
                        db      "*********************", 10
 +
                        db      "*********************", 10
 +
                        db      "*********************", 10
 +
                        db      "*********************", 10
 +
 +
                                section .text
 +
                                global _start
 +
_start:
 +
 +
;;; print stars
 +
                                mov    eax, 4
 +
                                mov    ebx, 1
 +
                                mov    ecx, stars
 +
                                mov    edx, 132
 +
                                int    0x80
 +
 +
;;; ; exit
 +
 +
                                mov    ebx, 0
 +
                                mov    eax, 1
 +
                                int    0x80
 +
</source>
 +
<br />
 +
* Click on '''Run''' and verify that you get an array of stars in the terminal window.
 +
<br /><center>[[Image:MoodleVPLAssemblyStarArrayRun.png|700px]]</center>
 +
<br />
 +
* Click on '''Evaluate''' and verify that you get 100/100.
 +
<br /><center>[[Image:MoodleVPLAssemblyStarArrayEvaluate.png|700px]]</center>
 +
<br />
 +
<br />
 +
This concludes this tutorial.
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
[[Category:Tutorials]][[Category:Moodle]][[Category:VPL]][[Category:Python]]

Latest revision as of 08:08, 13 June 2014

--D. Thiebaut (talk) 08:25, 12 June 2014 (EDT)



MoodleVPLLogo.png



Moodle VPL Tutorials



This tutorial builds on the first one in the series, which should be done first, as the present tutorial skips some steps. In this tutorial I present a simple VPL activity to test an assembly language program that displays a fixed string of characters.


Setup


  • Moodle Version 2.7 + (Build: 20140529)
  • VPL Version 3.0.1
  • For details on how Moodle and VPL were installed, go to this page.


VPL Activity


Assembly Language: print stars
Due date: Monday, 20 June 2016, 8:00 PM
Requested files: hw2.asm (Download)
Type of work: Individual work
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Assembly Language program that displays stars

Execution files

vpl_run.sh


#! /bin/bash
 
cat > vpl_execution <<EOF
#! /bin/bash
nasm -f elf -F stabs hw2.asm
ld -melf_i386 -o hw2 hw2.o
./hw2
EOF

chmod +x vpl_execution


vpl_evaluate.cases


case = Test 1
output = "*********************
*********************
*********************
*********************
*********************
*********************
"


Testing


  • In the VPL Administration box, click on Test activity, Edit, and enter the solution program below in the edit box:


                        section .data
        stars           db      "*********************", 10
                        db      "*********************", 10
                        db      "*********************", 10
                        db      "*********************", 10
                        db      "*********************", 10
                        db      "*********************", 10

                                section .text
                                global _start
_start:

;;; print stars
                                mov     eax, 4
                                mov     ebx, 1
                                mov     ecx, stars
                                mov     edx, 132
                                int     0x80

;;; ; exit

                                mov     ebx, 0
                                mov     eax, 1
                                int     0x80


  • Click on Run and verify that you get an array of stars in the terminal window.

MoodleVPLAssemblyStarArrayRun.png


  • Click on Evaluate and verify that you get 100/100.

MoodleVPLAssemblyStarArrayEvaluate.png



This concludes this tutorial.