More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
post
page
Python IDE Dashboard

String Slicing in Python

String?


In computer science, a string is a piece of text or a collection of characters.
string-manipulation-1

String Length?


The length of a string represents the number of characters it contains. In pyhon you can use the function len() to find out the length of a string.

pasword = input("Enter your password:")
if len(password)<8:
   print("Your password is not long enough!")

String Slicing?


string-sliceOn occasions, you will want your program to extract a few characters from a string. This is called string slicing.

You may for instance extract the first 5 characters of a phone number to retrieve the area code. Or you may need to extract the last 4 characters of a date to extract the year part.

Extracting a single character at a given position:

You can retrieve a character at a given position as follows:

string[position]

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
firstCharacter = alphabet[0]
lastCharacter = alphabet[25]

Note: The first character is always at position 0!

Extracting a substring (multiples characters) from a string:

To slice a string in python you have to think about the starting position and the ending position and use the following syntax:

string[start:end]

This syntax will extract all the characters from position start up to but not including position end.

If start is left empty, the substring will start from position 0.
If end is left empty, the substring will end at the last character of the string.

A negative start value or end value is used to identify a position (number of characters) from the end of the string. This can be useful to extract the last few characters of a string.

Try it yourself
Enter a string below and use the two handles to change the start and end position and slice your string accordingly. The resulting substring will appear in purple.

Slicing the alphabet:

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
print("The first 5 letters of the alphabet are: " + alphabet[:5])
print("The last 5 letters of the alphabet are: " + alphabet[-5:])
print("The letters in between are: "  + alphabet[5:-5])

Slicing a date:

date = "05 January 2019"
day = date[:2]  #First 2 characters
year = date[-4:] #Last 4 characters
month = date[3:-5] #The remaining characters in the middle

Locating if a substring is in a string (and retrieving its position)?


You can easily find if a substring is in a string using the keyword in.

dateOfBirth = "15 January 2000"
if "January" in  dateOfBirth:
   print("You were born in January!")

You can also retrieve the exact position of a substring in a string using the find() function:

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
pos = alphabet.find("C")
print("Letter C is at position: " + str(pos))

This script would tell us that letter “C” is at position 2. (Even though it is the third letter of the alphabet). That’s because the first letter in a string is always at position 0, not 1!

Note that if the substring is not found in the string, the find() function will return the value -1.

String Concatenation?


The act of joining two strings together is called string concatenation.
string-Concatenation

In Python string concatenation is done using the + sign:

firstname = "James"
print("Hello " + firstname)

Python Code:


Python Challenge


Your challenge is write a program to ask the user to enter their school username in the following format:

  • Year Group Using two digits (e.g. “07” for year 7, “11” for year 11, “00” for staff members)
  • 1 character for their initial (first letter of their firstname)
  • The user’s lastname
  • A 2-digit code: “_S” for students, “_T” for teachers, “_A” for admin staff.

For instance the following usernames are valid usernames:


07jFox_S
09kJohnson_S
11rTaylor_S
00pJones_T
00jOliver_A

Your program should read the username and decide:

    If the username is less than 6 characters long the program should ask the user to enter a valid username.
    If the username does not contain the character “_” it should also ask the user to enter a valid username.
    If the username is valid, the program should decide if the user is a member of staff or a student.
    If they are a student the programme should find out their year group.
    The program should also display the initial of the student as well as their lastname.
    Finally the program should display whether the user is a Student, a Teacher or an Admin member of staff.
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area
Tagged with:

Floating Point Binary Converter

The purpose of this challenge is to write a Python program that will receive, as an input, a binary number expressed using a normalised floating point representation (using a 5-bit mantissa and a 3-bit exponent). The program will then calculate the decimal value matching the input.

The following conversion tool will help you work out the formula used to convert a normalised floating point binary number to a decimal number.

Python Code


Extension


Adapt your code to let the user input the number of bits used for the mantissa and the number of bits used for the exponent. Your program will then use these inputs to validate and convert a binary number entered by the user.

Higher or Lower Number Game

Higher-Or-LowerFor this challenge you will design and write a program to play against the computer. The computer will display a random number between 1 and 100. The user will have to try to guess this number. For each guess the computer will inform the user if the number to guess is higher or lower than the user guess. The program will end once the user guess matches the number to guess.

Learning Objectives


By completing this challenge you are going to use selection (IF statements) and iteration (While loop). You will use comparison operators such as > , < and == to compare numbers. You will use variables to store the value of a random number and retrieve user inputs.

Task 1: Flowchart


Use our online Flowchart Studio tool to create the flowchart for this algorithm:
Online Flowchart Creator guess-the-number-while-loop-flowchart

Task #2: Complete the Python Code


unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area
Tagged with: , ,

Higher or Lower LMC Challenge

Higher-Or-LowerFor this challenge you will write a program of Guess the number (Higher or Lower?) using LMC assembly language.

Your program will be used by two users (player A and player B) as follows:

  • Ask player A to input a number between 1 and 100 (without player B looking at what player A is inputting)
  • Ask player B to guess player A’s number. For each guess, the program will give feedback to the player as to whether their guess is too high or to low.
  • Let player B carry on guessing till they guess the right number.

Below is the flowchart for this game designed to be implemented with a high level programming language such as Visual Basic. Note that if this flowchart was to be implemented in Python it would have to be changed slightly to replace the repeat until loop with a while loop as there is no repeat until loop in Python.
guess-the-number-flowchart-repeat-until

Little Man Computer


Your challenge is to redesign this algorithm for a low level assembly language (See LMC instruction set below). You will then be able to code this game using one of the following online LMC Simulators:

Note that these LMC similators only manipulate numbers so you will have to use the following values for your output messages:

  • “Higher!” will output number 1
  • “Lower!” will output number 0
  • “You win!” will output number 9

LMC Instruction Set


Note that in the following table “xx” refers to a memory address (aka mailbox) in the RAM. The online LMC simulator has 100 different mailboxes in the RAM ranging from 00 to 99.

Mnemonic Name Description Op Code
INP INPUT Retrieve user input and stores it in the accumulator. 901
OUT OUTPUT Output the value stored in the accumulator. 902
LDA LOAD Load the Accumulator with the contents of the memory address given. 5xx
STA STORE Store the value in the Accumulator in the memory address given. 3xx
ADD ADD Add the contents of the memory address to the Accumulator 1xx
SUB SUBTRACT Subtract the contents of the memory address from the Accumulator 2xx
BRP BRANCH IF POSITIVE Branch/Jump to the address given if the Accumulator is zero or positive. 8xx
BRZ BRANCH IF ZERO Branch/Jump to the address given if the Accumulator is zero. 7xx
BRA BRANCH ALWAYS Branch/Jump to the address given. 6xx
HLT HALT Stop the code 000
DAT DATA LOCATION Used to associate a label to a free memory address. An optional value can also be used to be stored at the memory address.
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area
Tagged with: ,

Network Design

In this post we will investigate the different components needed to set up a network. We will investigate their purpose and how all the devices are connected together to create a basic network diagram/design.

Your task will then to design the network diagram for your school or organisation.

LAN & WANNetwork TopologiesNetwork ComponentsClient Server NetworksVPNDesign Your Own Network

LAN vs WAN


A LAN (Local Area Network) is a network located on one site, where all the computers are geographically close to each others.

A WAN (Wide Area Network) is a network that is spread across multiple sites sometimes geographically remote to one another. A WAN consists of several LANs connected together, often using third party equipment and cables. (e.g. BT lines in the UK or AT&T lines in the US)

The Internet is an example of WAN (the largest of all WANs!).

A router is needed to connect a LAN to a WAN (or to the Internet).
LAN-Router-WAN

Star Topology

A network topology defines the layout of a network. It describes how different components/nodes of a network are connected together. One of the most frequent topology used in a LAN is the star topology where all computers and other devices are all connected to a central node: either a hub or a switch.Star-Topology-HubBoth a hub or a switch have the same purposes: to connect multiple computers or devices in a star topology. A hub is not as efficient as a switch and would often have less ethernet ports (e.g. typically 4 or 8 ports)Star-Topology-SwitchA switch being more efficient than a hub could have a larger number of devices connected (e.g. up to 28 Ethernet ports).

Switch-Star Topology

To build a larger network, it is possible to combine multiple star networks using a central switch. This creates a “switch-star” topology:
switch-star-topology

Other Topologies


Note that there are other types of topologies which are not based on the star topology. (e.g. bus topology, ring topology, full and partial mesh topologies).

Full Mesh Topology

Full Mesh Topology

Partial Mesh Topology

Partial Mesh Topology

However, for now, we will focus on star based topologies as these are the most frequently used topologies to build a LAN for a school or a small business.

Network Components (Hardware)

At this stage, we have already looked at three of the main types of network components: router, hub and switch. Other devices can also be used on a network such as a Wireless Access Point (WAP) and a Firewall.

Router

A router is needed to connect a LAN to a WAN (or to the Internet). A router scans data packets and redirects them towards the LAN or towards other routers depending on their origin and their destination.
LAN-Router-WAN

Switches and Hubs
A switch is a network component used to connect multiple devices together in a star topology. A switch would have a number of Ethernet ports (typically between 8 and 28 ports) to connect to other devices such as workstations and servers, WAPs, other hubs or switches or to a firewall or a router.
Star-Topology-SwitchA switch is more efficient than a hub as it can redirect traffic towards the device it is aimed at. Switches can hence be used on larger networks where hubs would be inefficient. (e.g. school network, hospital network, etc).

A hub is a network component used to connect multiple devices together in a star topology. A hub would have a number of Ethernet ports (typically between 5 and 8 ports) to connect to other devices such as workstations and servers, WAPs, other hubs or switches or to a firewall or a router.Star-Topology-Hub
A hub is not as efficient as a switch and hence should only be used on a small network. (e.g. home network).

Wireless Access Point (WAP)

A Wireless Access Point (WAP) is a network component used to connect multiple devices together without using wires. A WAP could hence be described as being a wireless hub! It provides WiFi access to a network.

Most WAPs have a fairly small coverage area (10 to 30 meters) hence several WAPs may be required to cover a large building.
wireless-access-point-WAP
Devices equipped with a wireless Network Interface Card (NIC) can connect to a WAP.

Wireless data can easily be intercepted by potential hackers hence the need to encrypt wireless transmissions and to set a network key to restrict access to a wireless network (WiFi).

Firewall

A firewall is a network component that usually “sits” just after the main router. It scans all incoming traffic to identify/block and report potential security threats coming from “outside” (e.g. the Internet) before they can reach the rest of the Local Area Network. A firewall is a necessary precaution to minimise the risk of hackers illegally accessing a network.
network-firewall

NIC Cards

To connect a workstation to a LAN, the workstation needs to be equipped with a Network Interface Card (NIC). The NIC card will have a wired connection (e.g. Ethernet port) and/or a wireless connection to connect wirelessly to a WAP (Wireless Access Point).

Ethernet Cables

Networking cables are used to connect one network device to other network devices or to connect two or more computers to share printers, scanners etc.

The most widely used network cables are Ethernet Cables of different categories (Cat3, Cat5, Cat6, etc). These are fairly cheap, strong and can support a bandwidth of either 10 Mbps, 100 Mbps, 1000 Mbps (1 Gbps) or even 10Gbps.

Other types of cables that can be used on a network include coaxial cables (10 Mbps) and optic fibre cables (10 Gbps).

Did you know?

On a home network, a router is often an “all in one” device which includes a router, a hub or a switch, a Wireless Access Point (WAP) and a firewall, all in one box called router (or home hub).

A computer on a network is called a workstation. Two types of network can be setup.

  • Peer-to-peer networks
  • Client-server networks
Peer-to-peer networks

In a peer-to-peer network, all computers are sharing files and other resources between each other without the use of a central server. This makes it easy to setup the network as there is no need to acquire and setup expensive servers. However, this can be difficult to manage as maintenance and computer upgrades (including security patches, virus protection) have to be performed on each single computer instead of being done centrally. This is the main reason why peer-to-peer networks are considered as less secure than client-server networks.

Client-Server networks

In a client-server network, end-users access the network by logging on a client computer/workstation. Other computers called servers (often with higher specifications) are also connected to the network and provide a dedicated and centralised service to all the workstations. There are different types of servers as described below. On a small network, a single server can have multiple purposes (e.g. web server and e-mail server or a proxy and a cache server)

File server
A server with large storage capacity used to store all the files from all the network users as well as from shared network areas.
E-Mail server
A server that manages all e-mail accounts and transfers (sending/receiving) of e-mails for all network users.
Backup server
A server with large storage capacity used to store backups (copies) of files and data from other servers/workstations. Should the live data be corrupted or deleted, backed up data can be recovered from the backup server.
Print server
A server that manage all print requests from network users, manage print queues and end-user print credits.
Application server
A server that has all the applications and software upgrades files so that they can be centrally managed and centrally applied to all workstations that connect to the applications server to receive and install the latest upgrades when relevant. On occasion applications can also run directly from an application server, reducing the need to install these on each workstation of the network.
Multimedia server
A server with large storage capacity used to store all multimedia content (video clips, audio files, etc.).
Web server
A server used to host a website or internal webpages. The server contains all the necessary files (web pages, graphics, etc.) and processes all web requests from web users.
Cache server
A server that temporary stores recently accessed data/files so that they can be retrieved from the cache server at a faster rate.
Proxy server
A proxy server functions as an intermediary between a client and a server.

It can be used to monitor access to the Internet and apply necessary restrictions and filters to allow or block access to specific websites (e.g. educational filters).

DNS server
A server on the Internet used to lookup domain names to retrieve their matching IP addresses. These are necessary as end-users prefer to type web addresses or e-mail addresses using domain names such as www.101computing.net as these are easier to remember than IP addresses. The domain name servers will convert/lookup such domain names to find their matching IP addresses needed to connect to the relevant servers.
On occasions, a company may need its employees to access its network remotely (e.g. for employees working from home or on a business trip).

To do so, employees will connect to the company LAN using their own Internet connection. They will then authenticate to access to the company network as if they were on site and hence have access to the company’s private network.

network-design-virtual-private-network-vpn

To enable remote access to its network via the Internet, which is a public network, the company has to set up and configure a VPN (Virtual Private Network). This will also mean that all the communications between the remote user and the company network will have to be encrypted and the remote users will have to authenticate (e.g. enter their username and password) to gain access to the VPN, so that only authorised users can do so.

Design Your Own Network


Use our network designer tool to create the layout of the network used in your school/organisation:
LAN-Network-Design
Design Your Own Network Online
Tagged with:

Code breaking using Trace Tables

In the following set of challenges, you will use a trace table to workout the secret code of the following six padlocks. Before attempting this challenge, you may want to find out mode about the use of trace tables when testing or predicting the output of an algorithm.

Padlock #1Padlock #2Padlock #3Padlock #4Padlock #5Padlock #6

Padlock #1:


The following code will help you work out the combination (code) to open padlock #1 (see below)

code = ""
FOR i FROM 1 TO 3
   digit = i * 2
   code = code + STR(digit)
NEXT i
OUTPUT(code)

Trace Table

 Line NumberidigitcodeOUTPUT
1“”
21
32
4“2”
22
34
4“24”
23
36
4“246”
6246

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #2:


The following code will help you work out the combination (code) to open padlock #2 (see below)

code = ""
code = code + "9" 
code = code + "7"
code = code + "1"
OUTPUT(code)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line NumbercodeOUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #3:


The following code will help you work out the combination (code) to open padlock #3 (see below)

code = ""
code = code + "7" 
code = "4" + code
code = code + "3"
OUTPUT(code)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line NumbercodeOUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #4:


The following code will help you work out the combination (code) to open padlock #4 (see below)

code = 61 
IF code MOD 2 == 0 THEN
   code = code * 3
ELSE
   code = code * 2
END IF
OUTPUT(code)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line Numbercodecode MOD 2 == 0 ?OUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #5:


The following code will help you work out the combination (code) to open padlock #5 (see below)

code = 24 
IF code > 20 AND code <= 10 THEN
   code = code * 3
ELSE IF code > 20 OR code <= 10 THEN 
   code = code * 10
ELSE 
   code = code * 4
END IF
OUTPUT(code)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line Numbercodecode>20 ?code<=10 ?OUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #6:


The following code will help you work out the combination (code) to open padlock #6 (see below)

code = 245 
WHILE code < 1000
   code = code + 200
END WHILE
code = code - 200
OUTPUT(code)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line Numbercodecode<1000 ?OUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Using Trace Tables

A trace table is a technique used to test an algorithm and predict step by step how the computer will run the algorithm. It can be used to understand or predict what an algorithm is doing and to identify potential logic errors (when the program compiles but does not produce the expected output).

The animation below demonstrate the use of a trace table used to track the values of variables as they change while the program is running. trace-table-s

Using a trace table to test an algorithm is called dry run testing.

Your Task


Check the following algorithms and complete their trace tables. (Click on any cells of these tables to add content)
Algorithm #1Algorithm #2Algorithm #3Algorithm #4

Algorithm #1: While Loop

i = 0
j = 10

WHILE i < j
   i = i + 1
   j = j - 1
END WHILE

OUTPUT(i)
OUTPUT(j)

Trace Table

 Line Numberiji < jOUTPUT
10
210
4True
51
69
4True

Algorithm #2: Factorial

number = 5
factorial = number

WHILE number>2
   number = number - 1
   factorial = factorial * number
END WHILE

OUTPUT(factorial)

Trace Table

 Line Numbernumberfactorialnumber > 2OUTPUT
15
25

Algorithm #3: Fizz-Buzz Sequence

FOR i FROM 1 TO 20
   IF i MOD 3 == 0 AND i MOD 5 == 0 THEN
      OUTPUT "Fizz-Buzz"
   ELSE IF i MOD 3 == 0 THEN
      OUTPUT "Fizz"
   ELSE IF i MOD 5 == 0 THEN
      OUTPUT "Buzz"
   ELSE
      OUTPUT i
   END IF
NEXT i

OUTPUT("The End")

Trace Table

 Line Numberii MOD 3 == 0i MOD 5 == 0OUTPUT
11
2FalseFalse
4False
6False
8
91
12

Algorithm #4: Max Function

FUNCTION max(a, b)
   IF a>b THEN
      RETURN a
   ELSE 
      RETURN b
   END IF
END FUNCTION

number1 = 7
number2 = 12
number3 = max(number1, number2)
OUTPUT(number3)

Trace Table

 Line Numbernumber1number2number3aba>bRETURNOUTPUT
97
1012
11712
1712

Fibonacci Sequence using LMC

fibonacci-sequence

Did you know?


The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 … where the next number is found by adding up the two numbers just before it.

number-sequence-diagram-5

The first 10 numbers of the Fibonacci number sequence are:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34

The following table shows how we can calculate each Fibonacci number from this sequence:

Fibonacci Number Calculation
0
1
1 = 0 + 1
2 = 1 + 1
3 = 1 + 2
5 = 2 + 3
8 = 3 + 5
13 = 5 + 8
21 = 8 + 13
34 = 13 + 21

Little Man Computer


Your challenge is to write a program using one of the following online LMC Simulators to calculate and output the first 10 numbers of the Fibonacci sequence.

LMC Instruction Set


Note that in the following table “xx” refers to a memory address (aka mailbox) in the RAM. The online LMC simulator has 100 different mailboxes in the RAM ranging from 00 to 99.

Mnemonic Name Description Op Code
INP INPUT Retrieve user input and stores it in the accumulator. 901
OUT OUTPUT Output the value stored in the accumulator. 902
LDA LOAD Load the Accumulator with the contents of the memory address given. 5xx
STA STORE Store the value in the Accumulator in the memory address given. 3xx
ADD ADD Add the contents of the memory address to the Accumulator 1xx
SUB SUBTRACT Subtract the contents of the memory address from the Accumulator 2xx
BRP BRANCH IF POSITIVE Branch/Jump to the address given if the Accumulator is zero or positive. 8xx
BRZ BRANCH IF ZERO Branch/Jump to the address given if the Accumulator is zero. 7xx
BRA BRANCH ALWAYS Branch/Jump to the address given. 6xx
HLT HALT Stop the code 000
DAT DATA LOCATION Used to associate a label to a free memory address. An optional value can also be used to be stored at the memory address.
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area
Tagged with: ,

Hardware Contest

In this hardware contest, you will be presented with two computers at a time (desktops or laptops). Your task is to compare the technical specifications of both computers and discuss and justify which computer seems to have the highest specifications. You should discuss your findings with your peers.

Computer #1
CPU Clock Speed
Number of Cores
CPU Cache
RAM
Graphic Card
Hard Drive
Optical Drive
NIC Card
Screen Size
Computer #2
CPU Clock Speed
Number of Cores
CPU Cache
RAM
Graphic Card
Hard Drive
Optical Drive
NIC Card
Screen Size

LMC Simulator

LMC900
LMC simulators are based on the Little Man Computer (LMC) model of a computer, created by Dr. Stuart Madnick in 1965. The LMC simulator is generally used to for educational purposes, because it models a simple Von Neumann architecture computer which has all of the basic features of a modern computer. It is programmed using assembly code.

The LMC simulator demonstrates how assembly code is processed by the CPU using the Fetch, Decode and Execute (FDE) Cycle. It shows the impact of the FDE cycles on the main registers found inside the CPU:

  • The PC (Program Counter),
  • The CIR (Current Instruction Register),
  • The MAR (Memory Address Register),
  • The MDR (Memory Data Register),
  • The Accumulator.

The LMC simulator also demonstrates how the CPU interacts with the Random Access Memory (RAM) and how both data and instructions are stored in the RAM. On our LMC simulator the RAM consists of 100 memory cells (also called mailboxes). Each cell has a unique memory location (a number between 00 and 99).

Most assembly instructions consist of an opcode and an operand.
When coding in assembly code we use mnemonics (e.g. INP, ADD, SUB, LDA, STA, etc.) for the opcode of the instruction. A lookup table (See at the end of this blog post) is used to check the corresponding opcode matching a mnemonic. With the LMC simulator, the operand is a memory location (Direct Addressing) of where the data used by the instruction can be fetched from (e.g. LDA, ADD, SUB instructions) or needs to be stored (e.g. STA instruction).

Labels can also be used instead of hard coding memory locations in the code. Labels are extremely useful when using branching instructions (BRA, BRZ, BRP), as they can be used to locate a specific instruction in the code/RAM. They can also be used to name memory cells in the RAM used to temporary store values. (Similar to the use of variables in a high level code).

LMC simulators can be used to implement simple programs to perform basic mathematical operations such as adding or subtracting numbers, comparing or sorting numbers, etc.

Launch our online LMC SimulatorOpen in new tab/window

You will find on this blog a range of LMC challenges that you can complete using our online LMC simulator:

LMC Instruction Set / Lookup Table


Note that in the following table “xx” refers to a memory address (aka mailbox) in the RAM. The online LMC simulator has 100 different mailboxes in the RAM ranging from 00 to 99.

Mnemonic Name Description Op Code
INP INPUT Retrieve user input and stores it in the accumulator. 901
OUT OUTPUT Output the value stored in the accumulator. 902
LDA LOAD Load the Accumulator with the contents of the memory address given. 5xx
STA STORE Store the value in the Accumulator in the memory address given. 3xx
ADD ADD Add the contents of the memory address to the Accumulator 1xx
SUB SUBTRACT Subtract the contents of the memory address from the Accumulator 2xx
BRP BRANCH IF POSITIVE Branch/Jump to the address given if the Accumulator is zero or positive. 8xx
BRZ BRANCH IF ZERO Branch/Jump to the address given if the Accumulator is zero. 7xx
BRA BRANCH ALWAYS Branch/Jump to the address given. 6xx
HLT HALT Stop the code 000
DAT DATA LOCATION Used to associate a label to a free memory address. An optional value can also be used to be stored at the memory address.
Tagged with: ,