8085 assembly #4: Task #3
Excercise 3 is a simple yet important one. Jumping around code like a 'goto' statement in C isn't always the best way to go about doing things. The difference between jumping and calling is when you jump, the program never returns to the instruction after the jump, instead it flows on from that memory location. With a call to a subroutine you are able to 'RET' (return) either on condition or unconditionally. This is very similar to a function call in C. This program is a simple counter that utlises a subroutine call.
; CALL ACTS LIKE A FUNCTION CALL IN C, A SUBROUTINE ; CALL COUNT AND COUNT TO C FROM B JMP START START: MVI B,00H ; COUNT FROM 0 MVI C,05H ; COUNT TO 5 MOV A,B ; COUNT FROM B CALL CNT ; CALL COUNT SUBROUTINE HLT ; HALT CNT: CMP C ; COMPARE C TO A RZ ; RETURN IF C==A INR A ; A++ JMP CNT ; LOOP
8085 assembly #3: Task #2
For excercise 2 and a few in the future I wanted to focus on implementing basic math functions. This task focuses on multiplication. Multiplication is nothing more than repeated addition, so, when broken down it's really quite simple. This implementation focuses on a two number operation, you need a multiplicand and a multiplier. In my program N1 stores the multiplican, N2 the multiplier. The steps to achieve N1*N2 are simple, add N1 to itself N2 times. I do not determine which number is bigger and reduce the number of iterations, although this may be a task for another day.
I produced two versions of todays task. The first is longer and over complicated, the second more simple and shorter. After I completed version #1 I realised a few things I could change and came up with version #2.
In particular I realised using a branching instructor is not the only way to determine if a number is zero, the status flags are in fact set when I do my DCR (decrement) operation. So the second interation does that, which saves a few lines of instructions (storing A, putting 00H in its place, comparing it to C and loading the original A back).
; MULTIPLY TWO NUMBERS TOGETHER, STORE IN MEMORY AT 00H ; MULTIPLICATION IS NOTHING MORE THAN REPEATED ADDITION JMP START N1: EQU 05H ; MULTIPLICAND N2: EQU 03H ; MULTIPLIER N3: EQU 00H ; MEMORY LOCATION TO STORE RESULT START: LXI H,N3 ; H AS MEMORY POINTER TO OUTPUT LOCATION 00H MVI C,0 ; CLEAR C MOV B,C ; CLEAR B MOV A,B ; CLEAR A MVI C,N2 ; MOVE N2 INTO C, THIS IS OUR COUNTER ADD: MOV B,A ; STORE A IN B MVI A,00H ; STORE 00H IN A CMP C ; COMPARE C TO A MOV A,B ; PUT B BACK INTO A JZ END ; IF C == 0 JUMP TO END ADI N1 ; ADD N1 TO A DCR C ; DECREMENT C JMP ADD ; JUMP TO ADD END: STA N3 ; STORE A HLT ; HALTIteration #2 (the better way)
; MULTIPLY TWO NUMBERS TOGETHER, STORE IN MEMORY AT 00H ; MULTIPLICATION IS NOTHING MORE THAN REPEATED ADDITION JMP START N1: EQU 05H ; MULTIPLICAND N2: EQU 03H ; MULTIPLIER N3: EQU 00H ; MEMORY LOCATION TO STORE RESULT START: LXI H,N3 ; H AS MEMORY POINTER TO OUTPUT LOCATION 00H MVI C,0 ; CLEAR C MOV A,C ; CLEAR A MVI C,N2 ; MOVE N2 INTO C, THIS IS OUR COUNTER ADD: ADI N1 ; ADD N1 TO A DCR C ; DECREMENT C JNZ ADD ; IF C == 0 JUMP TO END STA N3 ; STORE A IN MEMORY AT N3 HLT ; HALT
8085 assembly #2: Task #1
For my first task/learning excercise I wanted to start learning about using memory. To do this I came up with a simple goal: add the numbers together in memory from the memory location 0x00 until the first 0x00 byte is read. While a simple task in a language I am use to like C, I found it difficult to picture how I should control the registers to store and move around the bytes.
The final code to achieve this task (memory filled in manually inside the simulator):
; ADD NUMBERS IN MEMORY 00H -> NEXT 00H BYTE, STORE RESULT IN C JMP START START: LXI H,00H ; HL AS MEMORY POINTER MVI C,00H ; CLEAR C MOV B,C ; CLEAR B NEXT: MOV A,M ; SET ACCUMULATOR TO VALUE AT MEMORY ADDRESS CPI 00H ; COMPARE ACCUMULATOR WITH 00H JZ END ; JUMP IF ZERO INX H ; INCREASE POINTER JMP SAVE ; JUMP TO SAVE SAVE: MOV B,A ; STORE ACCUMULATOR IN B MOV A,C ; MOVE C INTO ACCUMULATOR ADD B ; ADD B MOV C,A ; STORE NEW ADDED VALUED IN B MVI A,00H ; CLEAR ACCUMULATOR MOV B,A ; CLEAR B JMP NEXT ; NEXT BYTE END: HLT ; HALT
8085 assembly #0
Recently I have been interested in assembly programming after coming across a new series of videos on the r/programming subreddit by Davy Wybiral (you can find the series here). In which, he focuses on x86 assembly using NASM. Using this and after personal research, in particular this x86 introduction series (namely the first day/part), my interest was peaked and I began playing around with simple 'hello world' programs. However I was finding it difficult to grasp the basic concepts, I had to try something different, a simpler architecture.
I was interested heavily in having an all in one compiler, editor, debugger, memory/register/stack viewer. The IDE also had to be completely open source and free software. I began looking for something that would meet these criteria. I quickly came across a simulator named GNUSim8085 (you can find the projects website here). This particular simulator and all-in-one IDE simulates the Intel 8085 micro processor, an 8-bit processor designed in 1977. After minor experimentation and researching the 8085 processor, I settled on learning and becoming comfortable with this IDE and eventually the instruction set. Meanwhile, I still have not completely grasped the assembly basics, however that will resolve itself over time.
Using the included example projects, heavily referring to an 8085 instruction set listing and other various resources found online, I began experimenting and slowly started understanding the basic concepts behind assembly languages.
Currently, I am able to produce very basic programs using some of the most basic instructions (mov, add, jmp, cmp etc), an example program I am able to write and understand is a simple countdown.
; COUNT DOWN FROM TOSTART -> TOEND TOSTART: EQU 0AH ; HEX 10 TO START COUNTDOWN FROM TOEND: EQU 00H ; HEX 0 TO COUNT DOWN TO JMP START ; JUMP TO START START: MVI A,TOSTART ; MOVE TOSTART INTO ACCUMULATOR MVI B,TOEND ; MOVE TOEND INTO REGISTER B LOOP: CMP B ; COMPARE REGISTER TO ACCUMULATOR JZ END ; JUMP TO END IF ZERO FLAG SET DCR A ; DECREMENT A JMP LOOP ; JUMP BACK TO LOOP END: HLT ; HALT EXECUTIONI hope to continue these posts as I further my understanding and abilities in 8085 assembly.
I'm back home now, feeling better than ever with more motivation to move on with life. 2018 is the year, I just know it. Let's hope it goes to plan.
As for website changes, I have altered the theme a bit, added a gray box to hold the page content and increased the left and right padding to focus the text more.
My IRC server is now running miniircd, a small simple IRC server written in python. I am maintaining my own fork here in order to add features I desire and change things up. You can connect via irc.danieljon.es port +6697 (SSL only). I hang out in #bukkake (not my choice in names).
Here's to another year.
git and cgit
For a while at least i'm experimenting using git and cgit locally in order to replace GitHub. You can check out the repos I have transitioned here.
Had a user from the r/GlobalOffensive Discord offer to draw a character from a series I like after being shown some of their work, naturally I selected Chi and Yuu from Shoujo Shuumatsu Ryokou, the drawing is beautiful.
I've been changing and improving my website for a while now - I seem to be really enjoying it. The latest changes are an all-white color theme and the blog improvements which include navigation buttons for the pages. I'm really loving the system I have in place for generating the static pages, however the python script for it is messy and needs to be re-written. That's a project for another day.
You can keep up with my websites changes here.
I've spent most of my life, from primary school all throughout high school as a quiet, shy kid. I spent the majority of the time at school alone and never since I was 10+ had interactions with "friends" outside of school. I didn't have friends, I don't think I have since I moved from Melbourne as a small child. There were people i'd call my friends, but they weren't at all. Recess break, lunch - i'd spend this time following those groups to not look like a complete outcast, but I didn't really care about them. In my later high schol years (year 10+) this began taking a toll on me - I wanted to have people to care about and talk to, but I didn't know how to approach anyone. This was a big part of why I finally broke and gave up on school at the end of year 11. I'm yet to tell anyone this - nobody really knew why I gave up. I gave excuses, and while they were factors in my decision, they certainly were not major ones. I remember my last day at high school vividly and the moment I snapped. It wasn't premeditated - I had no plans to do it, but I was sent over the edge. People will assume bullying was a factor, it wasn't and hasn't been since I can remember. People generally liked me, I don't know why, I assume my reserved and quiet nature played a big part. Although people only really approached me when they needed help with something computer related, I was always the go-to guy in classes, maybe I avoided bullying because I was useful.
From year 6 onwards I was always a mid-high grade student. I never caused trouble, I never did anything wrong. My work was always good and on time. I was never really faulted. Funny side story, during 9th grade I had an asignment to hand in, I did a terrible job, and I knew it. I didn't want to hand that in. It was a Photoshop based project, I had opened the .psd file in notepad and deleted a section of the file, resaved it and approached the teacher about my suddenly corrupt work. They had me get the IT guys to try and solve it (they were never going to solve it) and I was eventually let off from handing in the project.
One of my final projects to complete year 12 was handed in a week or so ago, and it was bad. The project itself was around the creation of a C++ application for CS:GO data tracking - the application was fine, I had actually already created it myself as a hobby project. The failing work was the written side that the school actually cares about. It was rushed, done in a fraction of the time I should have spent on it and was of terrible quality. Today I was told this in a passive agressive way over email by my teacher, and it felt really good. I've handed in something that was bad and they made sure I knew it. I call this a success. They require me to work on it further and want to meet with me about it, too bad for them i'm not in town for a few more weeks.
I have lost my passion for programming - it's gone and has been for months. Who knows what the road ahead looks like. What do I enjoy now?
I don't care about school, I don't care about achieving my SACE. I'm not going to finish in 2017.
List of anime that i've enjoyed and recommend
While not a hobby I outwardly put on display in real life, I often enjoy watching anime every now and then. I've started and will continue to add and mantain a list of series I consider worth checking out.
You can view the list here.
Everyone has their own taste in entertainment and mine may not be the same as yours, and that's ok.