Search

Assembly sourse code

free source code
;

Assembly Language Source Codes

Assembler Source Code for emu8086 microprocessor emulator and compatible assemblers (16 bit)
To copy codes to a text editor just press Ctrl+A (simultaneously), then press Ctrl+C and in the editor press Ctrl+V



  • bin2dec.asm

    Input 8 bit binary number and print out its decimal equivalent.

  • Make your own Micro Operating System
    (source with tutorial)

    This is a very basic example of a tiny OS. Your own Operating System that runs from floppy drive - easy!

  • 0_sample_add_huge_numbers.asm

    This example shows how to add huge unpacked BCD numbers

  • 0_sample_vga_graphics.asm

    And this program draws a tiny geometrical figure in VGA mode.

  • 1_sample.asm

    Another "Hello World!" example
    This example prints out "HELLO WORLD!" by writing directly to the video memory.

  • 2_sample.asm

    Simple Add/Subtract

  • 3_sample.asm

    Calculate the sum
    Calculate the sum of elements in V1 array, store result in V2.

  • 4_sample.asm

    How CMP instruction sets the flags.
    Usually CMP instruction is followed by any relative jump instruction such as: JE, JA, JL, JAE... It is recommended to open: "Lexical Flag Analyzer" and "Flags" from emulator's "View" menu before running this code.

  • 5_sample.asm

    Octal, Binary and Decimal
    See how to operate with Octal, Binary and Decimal values.

  • add_two_arrays.asm

    This example calculates the sum of one array with another and saves result in third array. In emu8086 you can see the result in "View" -> "Variables" menu. (set Elements for SEG1, SEG2 and SEG3 to 4 and Show as "SIGNED"). Not only variables but arrays can be seen in memory. It's required to set correct data type (size) and number of elements in that array:

    assembler sum array

  • attrib.asm

    Learn how to set and get file attributes, in other words how to make file Read Only or Hidden.

  • bcd_aaa.asm

    BCD - AAA instruction example - bcd_aaa.asm
    This example shows the use of AAA instruction (ASCII Adjust after Addition). It is used to add huge BCD numbers.

  • bcd_aas.asm

    BCD - AAS instruction example - bcd_aas.asm
    This is an example of AAS instruction, it is used to subtract huge BCD numbers.

  • bintest.asm

    Bin file - bintest.asm
    This is an example of how to make a ".BIN" file.

  • calc.asm

    Simple Calculator - calc.asm
    This sample gets two numbers from the user, calculates the sum of these numbers, and prints it out.

  • Calculator.asm

    Command prompt based simple calculator (+,-,*,/) for 8086.

  • cmpsb.asm

    How to use CMPSB instruction - cmpsb.asm
    This sample shows how to use CMPSB instruction to compare strings.

  • cmpsw.asm

    How to use CMPSW instruction - cmpsw.asm
    This sample shows how to use CMPSW instruction to compare strings.

  • colors.asm

    16x16 color map example - color.asm
    This sample prints 16x16 color map, it uses all possible colors.

  • convert_string_number_to_binary.asm

    This program written in 8086 Assembly Language to convert string value to binary form. When I run this program on emu8086 it proves that '-1234' is actually 0FB2Eh in hexadecimal (or binary: 1111101100101110b). This code supports both positive and negative numbers as input. Based on original (much more complicated) input routine taken from emu8086.inc

    Convert string number to binary in assembly language

  • convert_string_to_packed_bcd.asm

    This program uses a subroutine written in 8086 assembly language that can be used for converting a string of number (Max of 4 ASCII digit) to equivalent packed BCD digits. (BCD is "Binary Coded Decimal Numbers"). As seen in emu8086 variables window:

    packed BCD digits

  • convert_to_upper_case.asm

    This is a program in 8086 assembly language that accepts a character string from keyboard input stores it in an array. The program then converts all the lower case characters in the string to upper case. If the string is empty (null), it does not do anything. Done as part of my school assignment.

  • count_chars.asm

    counter_chars.asm
    This source code shows how we can count the number of letters in some statment without using string instructions, that means by using the loop and READING ONE CHARACTER in each time of loop ...

  • Count_Key_Presses.asm

    Count number of key presses - Count_Key_Presses.asm
    Counts number of key presses, and stores the result is in BX register. You need to open "User Screen" to type.

  • Custom_Interrupt.asm

    Make your own interrupts - Custom_Interrupt.asm
    This examples shows how to modify Interrupt Vector and create your own custom interrupts.

  • datefile.asm

    This code prints out current date and time and saves it to a file.
    Emulator saves this file to emulated file system.

  • encrypt_subrotine.asm

    Encryption in Assembly Language
    8086 subroutine to encrypt only lower case alphabets of a string using XLAT and also decrypt the same. The main principle behind this algorithm is because tables are precoded manually to decode one another. for example if first table sets letter 'a' to be 'k', the second table does the reverse, it sets letter 'k' to be 'a'... etc.... only lower case letters are encoded (but this program can be improved to convert full abc if required).

  • exetest.asm

    Another "Hello, World!" example - exetest.asm
    "Hello World", this time as an EXE file.

  • factorial.asm

    Factorial - factorial.asm
    This sample gets the number from the user, and calculates factorial for it. Supported input from 0 to 8 inclusive!

  • fahrenheit.asm

    Centigrade (Celsius) to Fahrenheit calculation and vice-versa. - fahrenheit.asm
    Not very accurate, since using integer divide, it may not work for some values as well.... This program has no input/output from the user, so in order to see the result it maybe useful to select "Variables" from "View" menu of the emulator. Another way to see the output is to use PRINT_NUM procedure from "emu8086.inc", see "Part 5" in tutorials. (since we get result in AL, you should use CBW instruction before printing out, because PRINT_NUM prints a signed number in AX register).

  • far_call.asm

    Call a procedure from another segment or interrupt.

  • far_call_advanced.asm

    A more detailed example, it's interesting to see what happens with the stack when it runs slowly. If you run it to fast you may not see anything.

  • far_call-2.asm

    A far procedure that prints out "hello" using a very tricky way. It knows where to search for characters because it knows who called it. It gets all the information from the stack.

  • file-operations.asm

    See how file system operates. Open existing file, create file and subdirectory, rename subdirectory, delete file and subdirectory. You can run it in step-by-step mode and explore the virtual file system.
    C:\emu8086\vdrive\C
    C:\emu8086\MyBuild

    This little program does some mess by creating subdirectory and file, and then it cleans for itself by deleting everything. If it runs fast you won't even notice a thing. If you stop the program in the middle you shall notice that it writes into C:\emu8086\vdrive\C\test1\ this text "lazy dog jumps over red fox", then it renames the file, creates another files, does some more things, and deletes everything very quickly.

  • float.asm

    Float on 8086! - float.asm
    This program calculates linear equation: ax + b = 0 The result is printed with floating point.
    For example: a = 7, b = 2
    x = -0.28571428....

  • hello.asm

    Yet another, "Hello World" example - hello.asm
    This example prints "Hello, World!" into the screen, char by char using INT 10h.

  • HelloWorld.asm

    Basic "Hello World!" example in Assembly Language
    This example prints out The easiest and the fastest way to print "Hello World!" using DOS INT 21h (still works under Windows XP in Dos prompt).

    Assembler Hello World

  • HexConvertor.asm

    This example converts 2 digit Hex value into numeric value and decimal string representation (so that it can be easily printed if required).

  • include.asm

    How to use emu8086.inc lib - include.asm
    This sample shows the correct use of "emu8086.inc" library of predefined macros and procedures.

  • int10_13.asm

    Print "Hello world" in color - int10_13.asm
    This is an example of INT 10h / AH=13h function.

  • int21.asm

    example of int 21h functions.

  • keybrd.asm

    Keyboard example - keybrd.asm
    This sample shows the use of keyboard functions. Try typing something to "User Screen". When "step delay" is too long, keyboard buffer is used. Try setting "step delay" to 1, for more realistic emulation. This code will loop until you press ESC key, other keys will be printed.

  • LED_display_test.asm

    This sample shows how to access virtual ports (000F to FFFF). This new technology allows to make external add-on devices for emu8086, such as led displays, thermostat, stepper-motor, etc... "DEVICES" folder contains sample device that works with this sample.

  • loops.asm

    just a few simple loops

  • matrix.asm

    Matrix - matrix.asm
    Matrix transpose sample (reverse rows with columns).

  • micro-os_kernel.asm

    OS Kernel module - micro-os_kernel.asm
    This is a very basic example of a tiny operating system. This is Kernel module! It is assumed that this machine code is loaded by 'micro-os_loader.asm' from floppy drive from: cylinder: 0 sector: 2 head: 0

  • micro-os_loader.asm

    OS loader example - micro-os_loader.asm
    This is a very basic example of a tiny Operating System. This is an OS loader only!

  • mouse.asm

    simple mouse code

  • mouse2.asm

    drawing program

  • no-close.asm

    windows users may need it.

  • pages.asm

    Video buffering example - pages.asm
    This example demonstrates the use of pages (double-buffering). This program uses first 4 pages of video memory by setting some data on them, and waits for any key, pressing any key will show all pages one after another.

  • palindrome.asm

    Palindrome - palindrome.asm
    This sample checks if string is a palindrome.

  • param.asm

    Command line parameters example - param.asm
    This sample prints out the command line parameters. In DOS you simply add this line after an executable: param.com my parameters In emulator you should set them by selecting "Set command line paramters" from "File" menu of emulator window.

  • paramexe.asm

    Command line parameters for EXE file - paramexe.asm
    This sample prints out the command line parameters. In DOS you simply add this line after an executable: paramexe.exe my parameters

  • pixel.asm

    How to show single pixel on screen using assembly language.
    Everything that you see on screen is actually a lot of single dots called pixels, all high level languages and DirectX eventually use this or similar method to draw anything on the screen. 13h video mode is just 320x200 pixels, but it does not require any special graphics card and works on all computers and VGA compatible graphic cards (even the very old ones).

  • print.asm

    Cool Print Method - print.asm
    This sample shows how to print string defined just after the CALL instruction without using 'emu8086.inc' library.

  • print_al.asm

    the code prints out a decimal value out of AL

  • print_char_by_char.asm

    the code prints out as many chars from top to bottom as you enter from left to right.

  • print_hex_digit.asm

    Print HEX digit - print_hex_digit.asm
    This sample prints out a hex value of DL register.

  • PrinterDemo.asm

    Printer Demo - PrinterDemo.asm
    PrinterDemo.asm - Andrew Nelis. Simple demonstration of the printer.

  • reverse.asm

    8086 assembly language program to reverse a string.

  • robot.asm

    Robot example - robot.asm
    This is an example of controlling the robot attached to a computer. This code randomly moves the robot and makes it to switch on/off the lamps. Keep in mind that robot is a mechanical creature and it takes some time for it to complete a task.

  • scasb.asm

    SCASB example - scasb.asm
    This sample shows how to use SCASB instruction to find a symbol.

  • scasw.asm

    SCASW example - scasw.asm
    This sample shows how to use SCASW instruction to find a WORD (2 bytes).

  • scroll.asm

    Scroll Example - scroll.asm
    This example shows the used of scrolling functions. It prints some test strings, and scrolls up/down the window at (1,1)-(8,5).

  • simple_io.asm

    Simple I/O - simple_io.asm
    This sample shows how to access virtual ports (00000Fh to 0FFFFh).

  • simplest.asm

    Demonstration of a virtual device in assembly language.

  • snake.asm

    Snake game in Assembler - snake.asm
    This is the snake game... It's better to set the "step delay" to "0" before running, it requires fast processing. You can control the snake using arrow keys on your keyboard. All other keys will stop the snake. Press ESC to exit.

  • sort.asm

    Simple Sort - sort.asm
    This program inputs 3 numbers and sorts them from largest to smallest.

  • stack.asm

    Stack - stack.asm
    This sample shows how the stack works. Click "Stack" button in emulator to see the contents of the stack.

  • stepper_motor.asm

    Stepper Motor - stepper_motor.asm
    This is a sample of OUT instruction. It writes values to virtual I/O port that controls the stepper-motor. Try using datCCW, datCW_FS or datCCW_FS instead of datCW to get different behavior of the motor.

  • string.asm

    Input and output string - string.asm
    This sample shows the use of input and output string functions of emu8086.inc

  • thermometer.asm

    Temperature Control - This short program for emu8086 shows how to keep constant temperature using heater and thermometer (between 60 F to 80 F), it is assumed that air temperature is lower 60 F. the emulator is required to run this example.

  • timer.asm

    Timer - timer.asm>
    This sample shows the use of a timer function (INT 15h / 86h) This code prints some chars with 1 second delay.

  • ToBin.asm

    Convert to bin - ToBin.asm
    This program inputs a decimal number and prints out its binary equivalent. Convertion is done by CONVERT_TO_BIN procedure, all other stuff is just for input/output.

  • traffic_lights.asm

    Traffic Lights Intersection - traffic_lights.asm
    This is a sample of OUT instruction. It writes values to virtual I/O port of Traffic Lights Intersection, by setting bits we can turn all the lights on and off.

  • traffic_lights2.asm

    Semaphores.... demonstration of turning the lights only. Unlike the previous example this code is the cause of far more traffic accidents.

  • writebin.asm

    A very handy code that can be assembled into a very tiny utility to make floppy boot records and tiny operating systems.

  • emu8086.inc

    This file is an open source include library that allows to print and input strings and numbers using simple predefined macro functions for 8086 assembler. Procedures to input and output numeric values and strings, clear screen. All macros and procedures avoid using MS-DOS interrupts (it is useful for designing your own independent operating systems).

  • fasm_compatibility.asm

    Compatibility issues of MASM/TASM (emu8086) and FASM assembler syntax.
  • 33 comments:

    Anonymous said...

    Great work.

    fREE Sharing LoVeR! said...

    Hello!
    The snake source code is not working...
    i managed to fix few errors but cant fix the rest...
    so if any one have a full working code it will be good to have!

    Anonymous said...

    Limassol has a great deal to offer the holidaymaker. [url=http://www.mulberryhandbagssale.co.uk]http://www.mulberryhandbagssale.co.uk[/url This is the scene from Silence of the lambs.. [url=http://www.goosecoatsale.ca]canada goose chilliwack[/url] Qcwawiehh
    [url=http://www.pandorajewelryvip.co.uk]pandora bracelets sale[/url] Wjdttvvzq [url=http://www.officialcanadagooseparkae.com]canada goose chilliwack[/url] oxwkaffuy

    Anonymous said...

    They do the required assessments before marketing your carrier to ensure that the bags tend to be traditional and unique. ghd I also said that a famous outgoing chief executive complained that researchers, designers, scientists, software engineers and engineers at Dell, HP, M$ to name a few were complaining that anything they designed, they found that Apple inc. ugg boots The collection itself was a mix of everything luxurious you could find cozy…Fuzzy tweeds, cashmere knits, leather and (faux) fur… While the concept was amusing, many bordered on abominable snowman or territory. ugg Designed by the renowned architect Tadao Ando, the museum is situated on top of a hill, but built entirely underground, to avoid spoiling the natural landscape of Naoshima. north face jackets Just attempt your best to make and begin a great picture for your self to enable you to feel great throughout your way of life..

    Anonymous said...

    www.bulberryfashion2013.com qfwjhw ywrr burberry uk leccvh oudb burberry sale outlet asygri dmqa uggs sale elfjsu cdhg ugg boots outlet gcrnwl cven ugg on sale fdxigo hsrq ugg factory outlet qorbfi zbmi ugg boots cheap ufkxxd rfob michael kors handbags on sale omxsue sfyj michael kors outlet store urbuqx vcjd michael kors 2012 mwyukf srdm longchamp outlet online ykvuaz gjms http://www.9dcu.com krfrlq ovdl longchamp bag jvgvhz rzwg burberry handbags losslb ombh

    Anonymous said...

    burberry handbags oyukdh jblh burberry yunxjw bcdj burberry bags kjeenu hoao www.specjerseys.com tmpsta sxrw www.numbjerseys.com jqeyrb ocyw http://www.2lv6.com bwogfe ygng ugg boots cheap otkttv fgno ugg usa wwupcs ldgq michael kors outlet store fcyndw oncm http://www.02s8.com jurbcs ndld michael kors diaper bag yijkez kjwo longchamp on sale tergwp orvx longchamp bags on sale axzmpt ecwm longchamp handbags uvaxvq orcq burberry outlet rsxrkl jodx

    Anonymous said...

    burberry nszimp ewql www.fashionbulberryoutlet.com ainubo gmos burberry outlet store bgakvb srqo www.specjerseys.com gpyupv oqxe www.numbjerseys.com vifoxs plbw ugg outlet store uzqhwl ltoh ugg boots cheap wbomwj nwlq ugg sale lzkrsq nfce michael kors handbags outlet nlzerz zmhv michael kors 2012 tsbeso bzcu michael kors 2013 aeukcd epii longchamp handbags outlet vivzpa otay longchamp sale sapjys pcvb longchamp diaper bag uhfcgm ntik burberry diaper bag holdtq jovk

    Anonymous said...

    burberry sale uyhnia rdob www.fashionbulberryoutlet.com kulepy pxea burberry sale online upraga ornb uggs uk bhtdnw ggbz ugg outlet knclam pere ugg on sale jfalgv wfgh ugg factory outlet oyepmu jxkx ugg boots outlet jvrlbi yrwt michael kors outlet store efwtus fqfx michael kors handbags rhpxhx cjjc michael kors outlet shgobu ifef longchamp outlet online eftfbb tqdi longchamp tote lrfrdi ktam longchamp bag vhnsfj xrjj burberry diaper bag loxehd geqd

    Anonymous said...

    burberry outlet upbdqz ozkv www.fashionbulberryoutlet.com cruesz remm www.livebulberryfashion.com ujisjz wwrg ugg boots uk obinwe tihd ugg boots outlet sbasbb oher ugg outlet store jkgycz sugk http://www.8wxc.com nryqro onmo ugg usa rpjuej xnib michael kors outlet derpmo qjcj michael kors outlet store lqhqzc cbkt michael kors factory outlet cntumn eeyh longchamp handbags sale bweebx gkjg longchamp tote eloyfz vaau longchamp bag oqiyzu hctk burberry outlet online nmbxoq zwjg

    Anonymous said...

    www.bulberryfashion2013.com eclana kxxx burberry sale farsyx ttsm burberry sale 2012 fxaryx bunr uggs outlet xgxeep rtor ugg outlet online uwrscr zokg ugg outlet store lxnnyj jrej ugg factory outlet cmjmrl pwfz http://www.7jcu.com okbkvj ytpd michael kors online outlet juxnuz nsdb michael kors handbags twaiqo lekw michael kors outlet gfwrhl ocej longchamp outlet nnltug akvq longchamp outlet zuiskz hukc longchamp handbags ewcqjo lgmx http://www.e4ni.com piqlwo xzvt

    Anonymous said...

    Do you mind if I quote a few of your articles as long as I provide credit and sources back to
    your webpage? My website is in the very same niche as yours and my visitors would definitely benefit from a lot of the information
    you provide here. Please let me know if this okay with you.
    Regards!
    Also visit my page ... acupuncture needles

    Anonymous said...

    Its not my first time to visit this web site, i am visiting this site dailly and take nice
    information from here everyday.
    Also visit my webpage :: yahoodiary.com

    Anonymous said...

    Muchos pacientes tienen la propiedad de reaccionar ante" traumas" como artrite, ou Moko, feita em farmcia de manipulao, sem exageros.

    However, a serious treatment and following through with the production of acetylcholine, a major hot flash, which
    encompassesa wide variety of factors, but you've got an email receipt.
    Have a look at my homepage - lupus specialist Hooksett

    Anonymous said...

    If you're someone that suffers from Emetophobia it's probably a much smaller number actually suffer from Emetophobia, you can tell, you might catch something.
    my web site: emetophobia treatment Newport Beach

    Anonymous said...

    RecapIs Carpal Tunnel busybodied with your osteoporosis, which makes clappers brickle and more susceptible to fractures, than jr.
    hoi polloi are. Reclamation undermentioned a distal r of these types of continuative tissue
    is stirred. Continue your arm doesn't receive to impingement your character of aliveness too dramatically. The one matter that I placard a the arm are held in in an contrived military position for a drawn-out menses of clock time. This goes for all types Tendonitis, but hither's a
    connectedness for carpal tunnel symptoms.

    Also visit my blog; carpal tunnel specialist Pine Prairie
    Also visit my page :: carpal tunnel specialist Pine Prairie

    Anonymous said...

    I'm impressed, I must say. Rarely do I encounter a blog that's both equally educative and amusing, and let me tell
    you, you've hit the nail on the head. The issue is an issue that too few people are speaking intelligently about. I am very happy that I stumbled across this during my search for something concerning this.
    Here is my website ; senseo pas cher

    Anonymous said...

    Greetings! This is my first comment here so I just wanted to give a quick shout out
    and tell you I really enjoy reading your posts. Can you suggest any other blogs/websites/forums that cover the same topics?
    Thank you!
    My web blog - account billing services nampa idaho

    Anonymous said...

    Mash the papaya tree, to some of the Skin Whitening precautions you motive to find.
    hold this miscellanea on the harmful loose radicals populating in you derma.
    It is regular proven to foreclose vexation because close to approximately new skin caution
    products.

    Here is my webpage :: best bleach cream for black skin
    Also visit my weblog ... best bleach cream for black skin

    Anonymous said...

    This information is priceless. When can I find out
    more?

    my web-site hotmail account

    Anonymous said...

    While There seems to be some mild contend in the Blogging
    industry about the al; Br J Sports Med.

    Review my site; click here

    Anonymous said...

    Thanks in favor of sharing such a nice thinking, article is nice, thats why
    i have read it fully

    Visit my weblog: adobe acrobat mac
    My site - www.bestactivejobsusa.com

    Anonymous said...

    When I originally commented I clicked the "Notify me when new comments are added" checkbox and now
    each time a comment is added I get several emails with the same comment.
    Is there any way you can remove me from that service? Cheers!



    Here is my blog post: abortions clinics in wilmington de

    Anonymous said...

    buy tramadol online no prescription cod tramadol dosage for depression - tramadol hcl bluelight

    Anonymous said...

    Quality articles or reviews is the key to invite the viewers to pay a quick visit the web page, that's what this web site is providing.

    My site: ロレックス偽物

    Anonymous said...

    Wow, this article is pleasant, my younger sister
    is analyzing such things, therefore I am going to convey her.


    Look at my blog - プラダ バッグアウトレット

    Anonymous said...

    The actual coach Checkbook wallet has its entire feature! Very young children including toddlers are becoming known with extreme behavioral issues.
    However, the fairy tale ended after how the birth of your daughter.
    I'm going to play with it- because I do believe I'm
    on so that you can something! http://www.top40lyrics.

    net/members/oznmarta/activity/13778

    Anonymous said...

    Hello, I enjoy reading all of your post. I like to write a little comment to support you.


    My webpage; hotmail account

    Anonymous said...

    Heya i'm for the first time here. I came across this board and I find It really useful & it helped me out much. I hope to give something back and help others like you aided me.

    Feel free to visit my web site ... reverse hotmail search

    Anonymous said...

    Do you have a spam issue on this website; I also am a blogger, and I was
    curious about your situation; we have developed some nice practices and we are looking to swap solutions with other folks, be
    sure to shoot me an e-mail if interested.

    Have a look at my homepage day trading systems ()

    Aliabhatt said...

    Very informative post thanks...
    xmas Quotes
    happy new year messages
    rose day 2017
    hug day sms
    promise day
    happy valentines day Greetings
    Fathers Day greetings

    Vidyabalan said...

    Father's Day is a 2011 American-Canadian movement horrendousness comic dramatization film composed by Adam Brooks, Jeremy Gillespie, Matthew Kennedy, Steven Kostanski, and Conor Sweeney. Fathers Day Messages from Wife The film stars Adam Brooks as Ahab, a man set out to right requital on Chris Fuchman, the Father's Day Killer, an aggressor and serial killer who killed his father years back.
    https://en.wikipedia.org/wiki/Father

    Priya Ghosh said...

    kissanime mobile
    kiss cartoon mobile
    kissanime apk
    anime kiss mobile
    kissanime app download
    4th of july meme
    july 4th images
    fourth of july pictures
    happy 4th of july
    happy fourth of july
    tamilguns

    Unknown said...

    Republic Day Images
    Republic Day Images 2018
    26 January Republic Day Images
    Images on Republic Day
    Download Republic Day Images
    Best Republic Day Images