OpenLLM-France/wikimedia huggingface dataset:
# X86 Assembly/X86 Interrupts

Interrupts are special routines that are defined on a per-system basis. This means that the interrupts on one system might be different from the interrupts on another system. Therefore, it is usually a bad idea to rely heavily on interrupts when you are writing code that needs to be portable.

## What is an Interrupt?

In modern operating systems, the programmer often doesn't need to use interrupts. In Windows, for example, the programmer conducts business with the Win32 API. However, these API calls interface with the kernel, and the kernel will often trigger interrupts to perform different tasks. In older operating systems (specifically DOS), the programmer didn't have an API to use, and so they had to do all their work through interrupts.

## Interrupt Instruction

int arg
This instruction issues the specified interrupt. For instance:
Calls interrupt 10 (0x0A (hex) = 10 (decimal)).

## Types of Interrupts

There are 3 types of interrupts: Hardware Interrupts, Software Interrupts and Exceptions.

### Hardware Interrupts

Hardware interrupts are triggered by hardware devices. For instance, when you type on your keyboard, the keyboard triggers a hardware interrupt. The processor stops what it is doing, and executes the code that handles keyboard input (typically reading the key you pressed into a buffer in memory). Hardware interrupts are typically asynchronous - their occurrence is unrelated to the instructions being executed at the time they are raised.

### Software Interrupts

There are also a series of software interrupts that are usually used to transfer control to a function in the operating system kernel. Software interrupts are triggered by the instruction int. For example, the instruction "int 14h" triggers interrupt 0x14. The processor then stops the current program, and jumps to the code to handle interrupt 14. When interrupt handling is complete, the processor returns flow to the original program.

### Exceptions

Exceptions are caused by exceptional conditions in the code which is executing, for example an attempt to divide by zero or access a protected memory area. The processor will detect this problem, and transfer control to a handler to service the exception. This handler may re-execute the offending code after changing some value (for example, the zero dividend), or if this cannot be done, the program causing the exception may be terminated.

## Further Reading

We discuss advanced details in a later chapter of this book, Advanced Interrupts.
A great list of interrupts for DOS and related systems is at Ralf Brown's Interrupt List.
* Operating System Design/Processes/Interrupt
* Embedded Systems/Interrupts
* Microprocessor Design/Interrupts
# X86 Disassembly

| Ever wonder what the relationship was between the C programming language, Assembly Language, and machine code on the x86 family of microprocessors? Learn the art of disassembly and reverse engineering on the x86 platform with the x86 Disassembly wikibook! Image credit | This book is intended for advanced readers. |

## Preface

The act of program creation, using common compilers and assemblers, takes software from an information-rich source code format and transforms it into a difficult-to-read machine code format. The reverse process, trying to convert machine code into a human-readable format, is significantly more difficult and requires high-level intuition and pattern matching skills.
This book is going to discuss the disassembly and decompilation of x86 machine code and x86 assembly code.
    This book is new and could use your help. We need help with proof-reading, content authoring, editing and more. This is a wiki, so feel free to join in.

## Table of Contents

* Cover
* Introduction

### Tools

* Assemblers and Compilers
* Disassemblers and Decompilers
* Disassembly Examples
* Analysis Tools

### Platforms

* Microsoft Windows
** Windows Executable Files
* GNU/Linux
** Linux Executable Files
* OS X
** OS X Executable Files

### Code Patterns

* The Stack
* Functions and Stack Frames
** Functions and Stack Frame Examples
* Calling Conventions
** Calling Convention Examples
* Branches
** Branch Examples
* Loops
** Loop Examples

### Data Patterns

* Variables
** Variable Examples
* Data Structures
* Objects and Classes
* Floating Point Numbers
** Floating Point Examples

### Difficulties

* Code Optimization
** Optimization Examples
* Code Obfuscation
* Debugger Detectors

## Resources and Licensing

* Resources
* Licensing
* Manual of Style
# A-level Computing/AQA/Paper 2/Consequences of uses of computing/Code of conduct

A Code of Conduct is not law, but it is a set of rules that apply when you are in an organisation such as your college. Examples might include "Don't look at pornography at work". This would be legal at home, but if you did it at work you could be sacked. In addition, a code of conduct may contain laws such as "Don't install pirated software".
The British Computer Society has produced a list of standards for the training and development of Information Technology workers.
It covers the following issues:
* The Public Interest - safeguarding public health; respecting rights of 3rd parties, applying a knowledge of relevant regulation.
* Duty to employers and clients - carrying out work according to the requirements, and not abusing employers' or clients' trust in any way.
* Professional duty - uphold the reputation of the profession through good practice, support fellow members in professional development
* Professional Integrity and Competence - maintain standards of professional skill and practice, accepting responsibility for work done, avoiding conflicts of interest with clients.
An example of a code of conduct in use in an office is as follows:
* Don't play games
* Don't look at pornography
* Don't gamble
* Don't plug your own peripherals into your computer
* Don't install software on work machines without permission
Each of these might be perfectly legal at home, but they might get you sacked at work
* Exercise: Laws and Codes of Conduct
* What is the difference between a Code of Conduct and a Law?
* Answer:
* A Law is applicable in all and every situation. A Code of Conduct is relevant only within the confines of an office, organisation or school.
* In a work place which of the following would be code of conduct rules only and which are laws. If a law name the law applicable:
* Don't look at pornography
* Don't download commercial MP3s from pirate websites
* Don't use email for personal messages
* Don't look at pirate software websites
* Don't use other company's logo on your work without permission
* Don't copy other company's ideas
* Don't give friends copies of CVs that have been sent to you
* Answer:
* Don't look at pornography (Code of Conduct)
* Don't download commercial MP3s from pirate websites (Law) - Copyright, Design and Patents Act 1988
* Don't use email for personal messages (Code of Conduct)
* Don't look at pirate software websites (Code of Conduct)
* Don't use other company's logo on your work without permission (Law) - Copyright, Design and Patents Act 1988
* Don't copy other company's ideas (Law) - Copyright, Design and Patents Act 1988
* Don't give friends copies of CVs that have been sent to you (Law) - Data Protection Act 1998
# A-level Computing/AQA/Paper 2/Consequences of uses of computing/Digital rights management

With the emergence of digital technology and the internet, it has become easier than ever to make exact copies of data or use other peoples work in your own work. This might involve copying files, images, games, music and videos; it might involve using well known songs in videos you make; it might involve using images you find on the web in your own work. For all of this there are legal issues you must consider.
* Is it fair to give a copy of an MP3 to a friend when they haven't paid for it?
* Will piracy kill the film and music industries?
* Is taking images off the internet fair use, shouldn't we reward people for their work?
* If I bought something on one format (e.g. tape), shouldn't I automatically have access to it in other formats for free?
* Does Piracy actually aid some forms of media, as it increases the audience reach of that artist, making it more likely for them to buy it officially?
A way that companies try to control the use of media and programs is through the use of digital rights management systems. These systems may do the following:
* Prevent playback on 'unauthorised' devices, using encryption keys
* Use a database of approved devices
* Prevent copying of files in some media managers (such as iTunes)
* Exercise: Digital Rights Management
* Give the arguments for and against using Digital Rights Management:
* Answer:
* Defends the intellectual property rights of creators
* Users are not able to use purchased products in the ways they might wish
* People who download illegally are more likely to buy a product in the long run

## References

* ↑ http://www.theguardian.com/music/2009/apr/21/study-finds-pirates-buy-more-music
# A-level Computing/AQA/Paper 2/Consequences of uses of computing/Hacking

The term hacking can have two meanings:
* The term might mean that you have taken some existing code and hacked it to do what you want it to. For example you take pre-existing open-source game code and use it to make your own game with. This is legal.
* The other meaning is the more common, this is the idea that you break through some security system, bypass a copy protection, get access to data you shouldn't have access to etc. All this is illegal and sometimes termed cracking. Online financial and identity thefts are growing massively around the world.
| Richard Stallman is an example of an early day hacker, in the legal sense of the word | Gary McKinnon is an example of a cracker, having hacked into the US Military |
* Hacking Hats
* Within the hacking community, in the second sense of the term, there are two main groups.
* The term white hat in Internet slang refers to an ethical hacker, or a computer security expert who specializes in ensuring the security of an organization's information systems. White hats may flag up security vulnerabilities on corporate websites and bring them to the attention of companies or organisations before the bad guys can make use of them. Recently companies have recognised the use of white hats, with companies such as Facebook and google offering bug bounty for people who can bring their attention to security flaws in their products
* A black hat is a hacker who "violates computer security for little reason beyond maliciousness or for personal gain" Black Hat Hackers are what the media will often talk about when talking about 'hackers'. Black Hats break into secure networks to destroy data or make the network unusable for those who are authorized to use the network. Examples include the Lulzsec hacking group that hacked corporate websites for the 'lulz', releasing thousands of user account details of companies such as Sony.

## References

* ↑ What is white hat? - a definition from Whatis.com
* ↑ R. Moore, Cybercrime: Investigating High Technology Computer Crime, 2005, Matthew Bender & Company, p258
# A-level Computing/AQA/Paper 2/Consequences of uses of computing/Legal and ethical issues

With the growth of Information Technology a host of legal and ethical issues have arisen. These range from the laws that protect the work people create using computers, to the ethical and legal problems brought about by the use of robots in modern warfare.
# A-level Computing/AQA/Paper 2/External hardware devices

* 4.7.4.1 Input and output devices
** Input devices
** Output devices
* 4.7.4.2 Secondary storage devices
# A-level Computing/AQA/Paper 2/External hardware devices/Input and output devices

You should already have met the internal components of the computer and the peripherals, that sit outside. We are now going to look at two different categories of peripherals. Those that input data into a computer, and those that output data from the computer.
How do we tell what is an input and what is an output device? Think about it from the computer's perspective. If a device is putting data into the computer in the form of text, sound, images, button presses etc. then it is an input device, if the device is outputting things from the computer such as sound, movement, printing, images etc., then it is an output device. It really is that easy to tell the difference, but be warned, some devices can be both input and output!
Let's take a look at two examples:
* Example: Telling the difference between input and output devices
* An LG LCD monitor
* When you are using the monitor it displays things that you are doing, such as moving windows and clicking on website links. At no point do you click on the screen or put anything into the monitor. The only thing it does is output information, therefore it is an output device. Easy!
* An optical mouse
* A mouse is used to move a little cursor around the screen, clicking and dragging as you go. if you let go of the mouse, the cursor will stop. The computer is relying on you to move the mouse, the mouse won't move on its own! Therefore it is an input device.
* Exercise: Input and output devices
* Note whether the following devices are input or output devices (or both!)
* Printer
* Mouse
* Keyboard
* Monitor
* Web cam
* Scanner
* USB thumb drive
* Graphics tablet
* Joypad
* Speakers
* Answer:
* Printer - output
* Mouse - input
* Keyboard - input
* Monitor - output
* Web cam - input
* Scanner - input
* USB thumb drive - input and output (read and write!)
* Graphics tablet - input or output (if there is a screen on it)
* Joypad - input (output as well if it rumbles!)
* Speakers - output
# A-level Computing/AQA/Paper 2/Fundamentals of data representation/Binary number system/Binary fractions
## Binary Fractions using Fixed Point

Fixed point is a method used to represent a fractional number in binary form. This means that it can be used to represent number such as 2 & 1/2 or 6 & 15/16. This section shows how fixed point can represent fractional numbers.
Assume we want to convert the binary code 11000110$_2$ into decimal using fixed point:
Step 1
Write out the decimal (or denary, if you prefer) equivalent as show:
$8$$4$$2$$1$ .$1/2$$1/4$$1/8$$1/16$
11000110 :
Step 2
Add the numbers together so in this case: 8+4+1/4+1/8 = 12 & 3/8 :
# A-level Computing/AQA/Paper 2/Fundamentals of data representation/Character form of decimal digit

Binary patterns are used to represent more than just numbers. They can be for characters, text, sounds and images.
All the characters on the keyboard can be given a character code which can be represented as a binary pattern inside the computer. They can be:
* Numbers
* Letters (capitals and lower case are separate)
* Punctuation (?/|\£$ etc.)
* non-printing commands (enter, escape, F1)
You will find out about two different character code systems (ASCII and Unicode) on the next page.
* From the Specification : Introduction to Principles of Computation
* Differentiate between the character code representation of a decimal digit and its pure binary representation.
It is important that you can tell the difference between the binary representation of a decimal number and the different binary pattern for that number when it is stored as a character.

## Example

Using ASCII the character digits 0 to 9 are assigned the decimal number codes 48 to 57.
The string or character digits 46 are represented in ASCII as 00110100 00110110. This is worked out as the ASCII for the character 4 is the denary code 52 which is 00110100; and the ASCII for the character 6 is 54 which is 00110110.
Whereas the decimal number 46 if stored in a 16-bit word is 00000000 00101110. This is worked out as with all binary to decimal conversions as 32 + 8 + 4 + 2 = 46
* Exercise: Building circuits
* What is the decimal number 42 as a 16 bit binary pattern?
* Answer:
* The number 42 = 32 + 8 + 2, so in binary 00000000 00101010.
* If in ASCII the character digit 4 is given the number code 52, what is the string 42 in binary?
* Answer:
* The string 42 is made up of the characters 4 and 2. If 4 is the ASCII code 52 then 2 should be 50, so calculate binary pattern for 52 and then 50.
* 52 = 32 + 16 + 4, so 00110100
* 50 = 32 + 16 + 2, so 00110010, therefore the answer is 00110100 00110010
* Convert the number 27 into a 16 bit binary pattern.
* Answer:
* The number 27 = 16 + 8 + 2 + 1, so in binary 00000000 00011011.
* What is the string 27 as a binary pattern? Note: the ASCII code for the character 0 is 48.
* Answer:
* The string 27 is made up of the characters 2 and 7. If 0 is the ASCII code 48 then 2 will be 50 and 7 will be 55. Therefore calculate binary pattern for 50 and then 55.
* 50 = 32 + 16 + 2, so 00110010,
* 55 = 32 + 16 + 4 + 2 + 1, so 00110111, therefore the answer is 00110010 00110111
# A-level Computing/AQA/Paper 2/Fundamentals of data representation/Comparison between vector and bitmaps

* Vector images scale without file size increase / decrease
* Bitmap images scale resulting in file size increase / decrease
* Vector images scale without distortion to the image
* Bitmap images distort (pixellate) when scaling
* Bitmaps are better for photo editing
* Bitmaps require less processing power to display
* Exercise: Vector vs Bitmap
* You wish to create an image that will be made into a giant banner for the side of a building. What type should you use and why?
* Answer:
* Vector, as it allows for scaling without distortion and retaining its file size
* You wish to create an image that will be used in a game, that will run on a mobile phone and a home console. What type should you use and why?
* Answer:
* Vector, as it allows for scaling without distortion and retaining its file size. You would only need one image to use on all the different systems.
* You want to take an image of a local cat stuck in a tree. What type should you use and why?
* Answer:
* Bitmap as it is better for photographs.
# A-level Computing/AQA/Paper 2/Fundamentals of data representation/Error checking
## Parity Checking

Parity checking is only able to detect an odd number of errors and cannot correct the errors detected.

### Even Parity

The number of 1s is counted, and if the number of 1s is even then the parity bit is set to 0, else it is set to 1.

### Odd Parity

The number of 1s is counted, and if the number of 1s is odd then the parity bit is set to 0, else it is set to 1.

## Majority Vote

Interference can occur which can cause 1's to be received as 0's and vice versa. Therefore, a system called majority voting is used.
'Majority voting is where each bit is represented by three bits to try and curb damage from interference.'
-Found from AQA Computer Science AS Level Textbook

## Check Digits

Check digits are digits added to identification numbers (e.g. bank numbers and product codes (e.g. UPC)) where the number will sometimes be entered manually. They are similar to parity bits but are intended to detect human entry error.
# A-level Computing/AQA/Paper 2/Fundamentals of data representation/Analogue and digital

For a computer to store sound files we need to get the continuous analogue sound waves into discrete binary values:
* Exercise: Analogue and digital
* What is the difference between analogue and digital data?
* Answer:
* Analogue data is continuous, allowing for an infinite number of possible values. Digital data is discrete, allowing for a finite set of values
* Name the device used by computers to convert sound files into sound coming out of the speaker
* Answer:
* Digital to Analogue converter
* Name a peripheral that could be used to feed sound into a ADC
* Answer:
* A microphone
* This is a diagram of a system set up for recording, storing and saving sound. Fill in the numbers from the following options
* ADC
* DAC
* Headphones
* Main Memory
* Microphone
* Secondary Storage
* Answer:
* Microphone
* ADC
* DAC
* Main Memory
* Headphones
* Secondary Storage
* Why is it difficult to save analogue sound waves in a digital format?
* Answer:
* Analogue is continuous data, converting continuous data to discrete values may lose some of the accuracy
# America's Army: Special Forces/SF Recon Tactics

This is a large map and often will take all the available time if skilled stalkers are playing! There are a lot of hills, so if you're seen you're probably already dead, because you're easy to pick out against the night sky or sand with night vision on... Prone crawling is a must. Be patient and stalk....
DCMan{FSS}
# America's Army: Special Forces/SF Taiga Tactics
## Basic Information

Weapons: M4A1 SOPMOD, RPK (IF), AKS-74U (IF), RPG-7 (IF), VSS Vintorez (IF), fragmentation, flashbang, smoke, and incendiary grenades
Mission Type: Live Fire.
Version Deployment: America's Army: Special Forces (Vanguard) (v2.2)
Spawn Points: 26
Description: Enemy forces purchased a small number of SAGGER anti-armor missiles for use by insurgent forces. They are hiding these missiles within civilian camps skirting a mountain road. These missiles will enable the insurgency to ambush both civilian and government convoys at extended ranges. A Special Forces ODA along with Indigenous Forces have been deployed to locate and destroy SAGGER missile caches in order to disrupt enemy combat operations within the area of operations.
# America's Army: Special Forces/SPR Special Purpose Rifle

Quote from www.americasarmy.com:
"The Special Purpose Rifle is the primary weapon of the Special Forces Advanced Marksman. A variant on the M16, this is a semi-auto sniper/counter-sniper weapon utilized for its long-range shots and greater accuracy."
A silencer is available and may be attached by pressing "L".
It is reported that if the SPR is not silenced, it appears to OPFOR as a VSS which has the sound of an M82.
It is also reported that the SPR causes low damage relative to other rifles available to Advanced Marksmen (M24 and M82). Consequently, hitting the head is recommended as a hit to the torso may not be fatal and may allow OPFOR to retaliate or find cover. Another option is to pull the trigger repeatedly; when used in conjunction of the silencer, most enemies won't even realize where the shots come from until they are dead by 5 bullets.
# America's Army: Special Forces/SF Oasis Tactics

Attacking: Sometimes if you have teammates engaging the enemies you can make a break straight down the river to the extraction point.
# America's Army: Special Forces/SVD Sniper Rifle

The SVD is the opfor equivalent of the American M82. This gun is a little less accurate due to no cross hairs and no bipod. But it does have less recoil than the M-82
Because it has no bipod and high sensitivity to breathing, it is extremely hard to aim.
More information may be found at http://world.guns.ru/sniper/sn18-e.htm