Skip to main content

Posts

Showing posts with the label Week 6

Hello World in Assembly

Photo by  Martin Sanchez  on  Unsplash Assembly alert! I promised to talk more about the compiler, but before it, more assembly. It is for a good reason, though. I was surprised to see my professor doing the “hello world” in assembly! Not only on x86_64 but also in the ARMv8 – different source code. He coded just like C or C++, saved, compiled and run it. The output was exactly like any other language. Nobody knew, but he was doing the Lab 5! I wish I were recording it. Our goal in this class was to compare the compiler output with the hand-crafted assembly. As expected, the compiler produced non-optimal executables even when we played with some fine-tuning options that I mentioned in the last post. How to compile an assembly code? Here are the commands: - Using GNU Assembler > as -g -o test.o test.s > ld -o test test.o - Using NASM Assembler > nasm -g -f elf64 -o test.o test.s > ld -o test test.o - Using GCC > gcc -g -o test.o test.S ...

Data Input Form

Photo by  Marvin Meyer  on  Unsplash Continuing the Lab 4, we are going to develop the option 2, data input form. The goal is to prompt the user to enter its name, address, city, province and postal code. Also, letting the user use up, down, left, and right arrows to navigate throughout the fields. After finishing the data input, a summary is presented at the end. Using the ROM routines, wasn’t too hard to allow users to type data into the character display. Then, I decided to make the filed names with the same width, 14 characters, limiting the input to 40 characters. So, the user is not allowed to type in the first 14 and after 54 characters. When the user presses enter at the last field, the summary is shown. I could display the fixed message, but I couldn’t copy the inserted data. I’m still working on that, and I’ll update this post as soon I figure it out. It is frustrating for me to spend days in basic problems that could be solved quickly using other langu...