Monday, 26 June 2017

Assembly Language : 8086 Assembler Tutorial Part 11

Assembly Language programming : 8086 Assembler Tutorial (Part 11)

Making your own Operating System


Usually, when a computer starts it will try to load the first 512-byte sector (that's Cylinder 0, Head 0, Sector 1) from any diskette in your A: drive to memory location 0000h:7C00h and give it control. If this fails, the BIOS tries to use the MBR of the first hard drive instead.

This tutorial covers booting up from a floppy drive, the same principles are used to boot from a hard drive. But using a floppy drive has several advantages:

  • You can keep your existing operating system intact (Windows, DOS...).

  • It is easy to modify the boot record of a floppy disk.

Example of a simple floppy disk boot program:


; directive to create BOOT file:
#MAKE_BOOT#

; Boot record is loaded at 0000:7C00,
; so inform compiler to make required
; corrections:
ORG 7C00h

; load message address into SI register:
LEA SI, msg

; teletype function id:
MOV AH, 0Eh

print:   MOV AL, [SI]
         CMP AL, 0
         JZ done
         INT 10h   ; print using teletype.
         INC SI
         JMP print

; wait for 'any key':
done:      MOV AH, 0
           INT 16h


; store magic value at 0040h:0072h:
;   0000h - cold boot.
;   1234h - warm boot.
MOV     AX, 0040h
MOV     DS, AX
MOV     w.[0072h], 0000h ; cold boot.

JMP 0FFFFh:0000h  ; reboot!


new_line EQU 13, 10

msg DB  'Hello This is My First Boot Program!'
    DB  new_line, 'Press any key to reboot', 0


Copy the above example to Emu8086 source editor and press [Compile and Emulate] button. The Emulator automatically loads ".boot" file to 0000h:7C00h.

You can run it just like a regular program, or you can use the Virtual Drive menu to Write 512 bytes at 7C00h to the Boot Sector of a virtual floppy drive (FLOPPY_0 file in Emulator's folder).
After writing your program to the Virtual Floppy Drive, you can select Boot from Floppy from Virtual Drive menu.




If you are curious, you may write the virtual floppy (FLOPPY_0) or ".boot" file to a real floppy disk and boot your computer from it, I recommend using "RawWrite for Windows" from: http://www.chrysocome.net/rawwrite
(recent builds now work under all versions of Windows!)

Note: however, that this .boot file is not an MS-DOS compatible boot sector (it will not allow you to read or write data on this diskette until you format it again), so don't bother writing only this sector to a diskette with data on it. As a matter of fact, if you use any 'raw-write' programs, such at the one listed above, they will erase all of the data anyway. So make sure the diskette you use doesn't contain any important data.





".boot" files are limited to 512 bytes (sector size). If your new Operating System is going to grow over this size, you will need to use a boot program to load data from other sectors. A good example of a tiny Operating System can be found in "Samples" folder as:
micro-os_loader.asm
micro-os_kernel.asm


To create extensions for your Operating System (over 512 bytes), you can use ".bin" files (select "BIN Template" from "File" -> "New" menu).

To write ".bin" file to virtual floppy, select "Write .bin file to floppy..." from "Virtual Drive" menu of emulator:



You can also use this to write ".boot" files.

Sector at:
Cylinder: 0
Head:0
Sector: 1
is the boot sector!



Idealized floppy drive and diskette structure:



For a 1440 kb diskette:


  • Floppy disk has 2 sides, and there are 2 heads; one for each side (0..1), the drive heads move above the surface of the disk on each side.

  • Each side has 80 cylinders (numbered 0..79).

  • Each cylinder has 18 sectors (1..18).

  • Each sector has 512 bytes.

  • Total size of floppy disk is: 2 x 80 x 18 x 512 = 1,474,560 bytes.

To read sectors from floppy drive use INT 13h / AH = 02h.








  emu8086 is better than NASM, MASM or TASM

Tag: 8086 Assembler, 8086 microprocessors instruction, assembly code, Assembly coding, assembly guide, assembly instruction, assembly language, assembly language instruction set, assembly language programming, Assembly program, assembly programming, capital letter, character convert, complete 8086 instruction sets microprocessors, complete instruction timing and instruction sets for 8086 microprocessors, conversion of characters in assembly language programming 8086, convert, emu8086, instruction complete set, instruction set complete for 8086, instruction sets, instruction sets for 8086, Lower case, Lowercase, print the small character into capital letter, programming 8086 assembly language conversion of small characters to capital, small letter, text string convert, Tutorial,

Assembly Language : 8086 Assembler Tutorial Part 11

Assembly Language : 8086 Assembler Tutorial Part 10

Assembly Language : 8086 Assembler Tutorial Part 9

Assembly Language : 8086 Assembler Tutorial Part 8

Assembly Language : 8086 Assembler Tutorial Part 7

Assembly Language : 8086 Assembler Tutorial Part 6

Assembly Language : 8086 Assembler Tutorial Part 5

Assembly Language : 8086 Assembler Tutorial Part 4

Assembly Language : 8086 Assembler Tutorial Part 3

Assembly Language : 8086 Assembler Tutorial Part 2

Assembly Language : 8086 Assembler Tutorial Part 1

Assembly Language programming : Emu8086 Assembler Compiling and MASM / TASM compatibility

Assembly Language - string convert - Lowercase , Uppercase

for programming : the language of Number

Assembly Language - Complete Instruction Set and Instruction Timing of 8086 microprocessors

Assembly Language programming : A list of emulator supported interrupts

Assembly Language Programming : Emu8086 Overview, Using Emulator, Virtual Drives

Assembly Language Programming : All about Memory - Global Memory Table and Custom Memory Map

buy me  a cup of coffee

My Paypal Account is :  ksw.industries@gmail.com

Send me any small amount of money is welcome.
buy me  a cup of coffee

 ___________________________________________


Need More Detail ?   contact me !!


My Paypal Account is :   ksw.industries@gmail.com
buy me  a cup of coffee
Send me any small amount of money is welcome.

___________________________________________


Don't know how to send money ?   Click here for detail about Paypal account.
About PayPal Payment Methods

What type of PayPal accounts is better.
 


Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge




Monday, 19 June 2017

Assembly Language Programming : All about Memory - Global Memory Table and Custom Memory Map

Assembly Language Programming : 
All about Memory - Global Memory Table and Custom Memory Map


Global Memory Table

8086 CPU can access up to 1 MB of random access memory (RAM), it is limited by segment/offset construction. Since segment registers (CS, SS, ES, DS) can hold maximum value of 0FFFFh and offset registers (IP, BX, SI, DI, BP, SP) can also hold maximum value of 0FFFFh, the largest logical memory location that we can access is FFFF:FFFF or physical address: 0FFFFh * 10h + 0FFFFh = 10FFEFh = 65535 * 16 + 65535 = 1,114,095 bytes
Modern processors have a larger registers so they have much larger memory area that can be accessed, but the idea is still the same.




Memory Table of Emulator (and typical IBM PC):

Physical address of memory area in HEX Short Description
00000 - 00400 Interrupt vectors. Emulator loads "INT_VECT" file at the physical address 00000h.
00400 - 00500 System information area. We use a trick to set some parameters by loading a tiny last part (21 bytes) of "INT_VECT" in that area (the size of that file is 1,045 or 415h bytes, so when loaded it takes memory from 00000 to 00415h).
This memory block is updated by emulator when configuration changes, see System information area table below .
00500 - A0000 A free memory area. A block of 654,080 bytes. Here you can load your programs.
A0000 - B1000 Video memory for VGA, Monochrome, and other adapters. Not used by emulator!
B1000 - B8000 Reserved. Not used by emulator!
B8000 - C0000 32 KB video memory for Color Graphics Adapter (CGA). Emulator uses this memory area to keep 8 pages of video memory. The Emulator screen can be resized, so less memory is required for each page, although emulator always uses 1000h (4096 bytes) for each page (see INT 10h / AH=05h in the list of supported interrupts).
C0000 - F4000 Reserved.
F4000 - 10FFEF ROM BIOS and extensions. Emulator loads "BIOS_ROM" file at the physical address 0F4000h. Interrupt table points to this memory area to get emulation of interrupt functions.


Interrupt Vector (memory from 00000h to 00400h)

INT number       Address in              Address of
in hex           Interrupt Vector        BIOS sub-program

00               00x4 = 00               F400:0170 - CPU-generated,
                                                     divide error.

04               04x4 = 10               F400:0180 - CPU-generated,
                                                     INTO detected
                                                     overflow.

10               10x4 = 40               F400:0190 - Video functions.

11               11x4 = 44               F400:01D0 - Get BIOS
                                                     equipment list.

12               12x4 = 48               F400:01A0 - Get memory size.

13               13x4 = 4C               F400:01B0 - Disk functions.

15               15x4 = 54               F400:01E0 - BIOS functions.

16               16x4 = 58               F400:01C0 - Keyboard functions.

19               19x4 = 64               FFFF:0000 - Reboot.

1A               1Ax4 = 68               F400:0160 - Time functions.

1E               1Ex4 = 78               F400:AFC7 - Vector of Diskette
                                                     Controller Params.

20               20x4 = 80               F400:0150 - DOS function:
                                                     terminate program.

21               21x4 = 84               F400:0200 - DOS functions.

all others       ??x4 = ??               F400:0100 - The default interupt
                                                     catcher. Prints out
                                                     "Interupt not supported
                                                     yet" message.
A call to BIOS sub-system is disassembled by "BIOS DI" (it doesn't use DI register in any way, it's just because of the way the encoding is done: we are using "FF /7" for such encoding, "FFFFCD10" is used to make emulator to emulate interrupt number 10h).

F400:0100 has this code FFFFCDFF (decoded as INT 255, and error message is generated).




 
System information area (memory from 00400h to 00500h)

Address (hex) Size Description
0040h:0010 WORD BIOS equipment list.

Bit fields for BIOS-detected installed hardware:
Bit(s) Description
 15-14  number of parallel devices.
 13     not supported.
 12     game port installed.
 11-9   number of serial devices.
 8      reserved.
 7-6    number of floppy disk drives (minus 1):
          00 single floppy disk;
          01 two floppy disks;
          10 three floppy disks;
          11 four floppy disks.
 5-4    initial video mode:
          00 EGA,VGA,PGA, or other with on-board video BIOS;
          01 40x25 CGA color;
          10 80x25 CGA color (emulator default);
          11 80x25 mono text.
 3    not supported.
 2    not supported.
 1    math coprocessor installed.
 0    set when booted from floppy (always set by emulator).
This word is also returned in AX by INT 11h.
Default value: 0021h or 0000 0000 0010 0001b
0040h:0013 WORD Kilobytes of contiguous memory starting at absolute address 00000h.
This word is also returned in AX by INT 12h.
This value is set to: 0280h (640KB).
0040h:004A WORD Number of columns on screen.
Default value: 0032h (50 columns).
0040h:004E WORD Current video page start address in video memory (after 0B800:0000).
Default value: 0000h.
0040h:0050 8 WORDs Contains row and column position for the cursors on each of eight video pages.
Default value: 0000h (for all 8 WORDs).
0040h:0062 BYTE Current video page number.
Default value: 00h (first page).
0040h:0084 BYTE Rows on screen minus one.
Default value: 13h (19+1=20 columns).








Custom Memory Map


You can define your own memory map (different from IBM-PC). It is required to create "CUSTOM_MEMORY_MAP.inf" file in the same folder where Emu8086.exe is located. Using the following format add information into that configuration file:

address - filename
...


For example:

0000:0000 - System.bin
F000:0000 - Rom.bin
12AC - Data.dat


Address can be both physical (without ":") or logical, value must be in hexadecimal form. Emulator will look for the file name after the "-" and load it into the memory at the specified address.

Emulator will not update System information area (memory from 00400h to 00500h) if your configuration file has "NO_SYS_INFO" directive (on a separate line). For example:

NO_SYS_INFO
0000:0000 - System.bin
F000:0000 - Rom.bin
12AC - Data.dat


Emulator will allow you to load ".bin" files to any memory address (be careful not to load them over your custom system/data area).

Warning! standard interrupts will not work when you change the memory map, unless you provide your own replacement for them. To disable changes just delete or rename "CUSTOM_MEMORY_MAP.inf" file, and restart the program.









  emu8086 is better than NASM, MASM or TASM

Tag: 8086 Assembler, 8086 microprocessors instruction, assembly code, Assembly coding, assembly guide, assembly instruction, assembly language, assembly language instruction set, assembly language programming, Assembly program, assembly programming, capital letter, character convert, complete 8086 instruction sets microprocessors, complete instruction timing and instruction sets for 8086 microprocessors, conversion of characters in assembly language programming 8086, convert, emu8086, instruction complete set, instruction set complete for 8086, instruction sets, instruction sets for 8086, Lower case, Lowercase, print the small character into capital letter, programming 8086 assembly language conversion of small characters to capital, small letter, text string convert, Tutorial,

Assembly Language : 8086 Assembler Tutorial Part 11

Assembly Language : 8086 Assembler Tutorial Part 10

Assembly Language : 8086 Assembler Tutorial Part 9

Assembly Language : 8086 Assembler Tutorial Part 8

Assembly Language : 8086 Assembler Tutorial Part 7

Assembly Language : 8086 Assembler Tutorial Part 6

Assembly Language : 8086 Assembler Tutorial Part 5

Assembly Language : 8086 Assembler Tutorial Part 4

Assembly Language : 8086 Assembler Tutorial Part 3

Assembly Language : 8086 Assembler Tutorial Part 2

Assembly Language : 8086 Assembler Tutorial Part 1

Assembly Language programming : Emu8086 Assembler Compiling and MASM / TASM compatibility

Assembly Language - string convert - Lowercase , Uppercase

for programming : the language of Number

Assembly Language - Complete Instruction Set and Instruction Timing of 8086 microprocessors

Assembly Language programming : A list of emulator supported interrupts

Assembly Language Programming : Emu8086 Overview, Using Emulator, Virtual Drives

Assembly Language Programming : All about Memory - Global Memory Table and Custom Memory Map

buy me  a cup of coffee

My Paypal Account is :  ksw.industries@gmail.com

Send me any small amount of money is welcome.
buy me  a cup of coffee

 ___________________________________________


Need More Detail ?   contact me !!


My Paypal Account is :   ksw.industries@gmail.com
buy me  a cup of coffee
Send me any small amount of money is welcome.

___________________________________________


Don't know how to send money ?   Click here for detail about Paypal account.
About PayPal Payment Methods

What type of PayPal accounts is better.
 


Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge




Monday, 15 May 2017

Assembly Language programming : Emu8086 and MASM / TASM compatibility


Emu8086 - Assembly Code Compiling and MASM / TASM compatibility


Compiling Assembly Code



Type your code inside the text area, and click [Compile] button. You will be asked for a place where to save the compiled file.
After successful compilation you can click [Emulate] button to load the compiled file in emulator.



The Output File Type Directives:



      #MAKE_COM#
      #MAKE_BIN#
      #MAKE_BOOT#
      #MAKE_EXE#
You can insert these directives in the source code to specify the required output type for the file. Only if compiler cannot find any of these directives it will ask you for output type before creating the file.


Description of Output File Types:


  • #MAKE_COM# - the oldest and the simplest format of an executable file, such files are loaded with 100h prefix (256 bytes). Select Clean from the New menu if you plan to compile a COM file. Compiler directive ORG 100h should be added before the code. Execution always starts from the first byte of the file.
    Supported by DOS and Windows Command Prompt.



  • #MAKE_EXE# - more advanced format of an executable file. Not limited by size and number of segments. Stack segment should be defined in the program. You may select EXE Template from the New menu in to create a simple EXE program with defined Data, Stack, and Code segments.
    Entry point (where execution starts) is defined by a programmer.
    Supported by DOS and Windows Command Prompt.



  • #MAKE_BIN# - a simple executable file. You can define the values of all registers, segment and offset for memory area where this file will be loaded. When loading "MY.BIN" file to emulator it will look for a "MY.BINF" file, and load "MY.BIN" file to location specified in "MY.BINF" file, registers are also set using information in that file (open this file in a text editor to edit or investigate).
    In case emulator is not able to find "MY.BINF" file, current register values are used and "MY.BIN" file is loaded at current CS:IP.
    Execution starts from values in CS:IP.
    This file type is unique to Emu8086 emulator.

    ".BINF file is created automatically by compiler if it finds #MAKE_BIN# directive.
    WARNING! any existing ".binf" file is overwritten!

    
     #LOAD_SEGMENT=1234#
     #LOAD_OFFSET=0000#
     #AL=12#
     #AH=34#
     #BH=00#
     #BL=00#
     #CH=00#
     #CL=00#
     #DH=00#
     #DL=00#
     #DS=0000#
     #ES=0000#
     #SI=0000#
     #DI=0000#
     #BP=0000#
     #CS=1234#
     #IP=0000#
     #SS=0000#
     #SP=0000#

    Values must be in HEX!

    When not specified these values are set by default:
    LOAD_SEGMENT = 0100
    LOAD_OFFSET = 0000
    CS = ES = SS = DS = 0100
    IP = 0000

    If LOAD_SEGMENT and LOAD_OFFSET are not defined, then CS and IP values are used and vice-versa.


    In case Load to offset value is not zero (0000), ORG ????h should be added to the source of a .BIN file where ????h is the loading offset, this should be done to allow compiler calculate correct addresses.



  • #MAKE_BOOT# - this type is a copy of the first track of a floppy disk (boot sector).
    You can write a boot sector of a virtual floppy (FLOPPY_0) via menu in emulator:
    [Virtual Drive] -> [Write 512 bytes at 7C00 to Boot Sector]
    First you should compile a ".boot" file and load it in emulator (see "micro-os_loader.asm" and "micro-os_kernel.asm" in "Samples" for more info).

    Then select [Virtual Drive] -> [Boot from Floppy] menu to boot emulator from a virtual floppy.

    Then, if you are curious, you may write the virtual floppy to real floppy and boot your computer from it, I recommend using "RawWrite for Windows"

    (note that "micro-os_loader.asm" is not using MS-DOS compatible boot sector, so it's better to use and empty floppy, although it should be IBM (MS-DOS) formatted).
    Compiler directive ORG 7C00h should be added before the code, when computer starts it loads first track of a floppy disk at the address 0000:7C00.
    The size of a .BOOT file should be less then 512 bytes (limited by the size of a disk sector).
    Execution always starts from the first byte of the file.
    This file type is unique to Emu8086 emulator.




Error Processing

Compiler reports about errors in a separate information window:



MOV DS, 100 - is illegal instruction because segment registers cannot be set directly, general purpose register should be used:
MOV AX, 100
MOV DS, AX


MOV AL, 300 - is illegal instruction because AL register has only 8 bits, and thus maximum value for it is 255 (or 11111111b), and the minimum is -128.





Compiler makes several passes before generating the correct machine code, if it finds an error and does not complete the required number of passes it may show incorrect error messages. For example:

#make_COM#
ORG 100h

MOV AX, 0
MOV CX, 5
m1: INC AX
LOOP m1                ; not a real error!

MOV AL, 0FFFFh         ; error is here.

RET
List of generated errors:
(7) Condition Jump out of range!: LOOP m1
(9) Wrong parameters: MOV AL, 0FFFFh
(9) Operands do not match: Second operand is over 8 bits!

First error message (7) is incorrect, compiler did not finish calculating the offsets for labels, so it presumes that the offset of m1 label is 0000, that address is out of the range because we start at offset 100h.

Make correction to this line: MOV AL, 0FFFFh (AL cannot hold 0FFFFh value). This fixes both errors! For example:


#make_COM#
ORG 100h

MOV AX, 0
MOV CX, 5
m1: INC AX
LOOP m1                ; same code no error!

MOV AL, 0FFh           ; fixed!

RET



When saving a compiled file, compiler also saves 2 other files that are used for Emulator to show actual source when you run it, and select corresponding lines.

  • *.~asm - this file contains the original source code that was used to make an executable file.
  • *.debug - this file has information that enables the emulator select lines of original source code while running the machine code.
  • *.symbol - Symbol Table, it contains information that enables to show the "Variables" window. It is a text file, so you may view it in any text editor.
  • *.binf - this file contains information that is used by emulator to load BIN file at specified location, and set register values prior execution; (created only if an executable is a BIN file).








MASM / TASM compatibility


Syntax of Emu8086 is fully compatible with all major assemblers including MASM and TASM;   though some directives are unique to Emu8086.   If required to compile using any other assembler you may need to comment out these directives, and any other directives that start with a '#' sign:

#MAKE_COM#
#MAKE_EXE#
#MAKE_BIN#
#MAKE_BOOT#




Emu8086 does not support the ASSUME directive, actually most programmers agree that this directive just causes some mess in your code.   Manual attachment of CS:, DS:, ES: or SS: segment prefixes is preferred, and required by Emu8086 when data is in segment other then DS. For example:

MOV AX, [BX]        ; same as MOV AX, DS:[BX]
MOV AX, ES:[BX]




Emu8086 does not require to define segment when you compile a COM file, though MASM and TASM may require this, for example:


CSEG    SEGMENT     ; code segment starts here.

; #MAKE_COM#        ; uncomment for Emu8086.

ORG 100h

start:  MOV AL, 5   ; some sample code...
        MOV BL, 2
        XOR AL, BL
        XOR BL, AL
        XOR AL, BL

        RET

CSEG    ENDS        ; code segment ends here.

END     start       ; stop compiler, and set entry point.


Entry point for COM file should always be at 0100h (first instruction after ORG 100h directive), though in MASM and TASM you may need to manually set an entry point using END directive. Emu8086 works just fine, with or without it.

In order to test the above code, save it into test.asm file (or any other) and run these commands from command prompt:

For MASM 6.0:

  MASM test.asm
  LINK test.obj, test.com,,, /TINY
For TASM 4.1:
  TASM test.asm
  TLINK test.obj /t
We should get test.com file (11 bytes), right click it and select Send To and emu8086. You can see that the disassembled code doesn't contain any directives and it is identical to code that Emu8086 produces even without all those tricky directives.




A template used by Emu8086 to create EXE files is fully compatible with MASM and TASM, just comment out #MAKE_EXE# directive to avoid Unknown character error at line 11.

EXE files produced by MASM are identical to those produced by emu8086.   TASM does not calculate the checksum, and has slightly different EXE file structure, but it produces quite the same machine code.

Note: there are several ways to encode the same machine instructions for the 8086 CPU, so generated machine code may vary when compiled on different compilers.




Emu8086 assembler supports shorter versions of BYTE PTR and WORD PTR, these are: B. and W.

For MASM and TASM you have to replace B. and W. with BYTE PTR and WORD PTR accordingly.

For example:

LEA BX, var1
MOV WORD PTR [BX], 1234h ; works everywhere.
MOV w.[BX], 1234h        ; same instruction, but works in Emu8086 only.
HLT

var1  DB  0
var2  DB  0







  emu8086 is better than NASM, MASM or TASM

Tag: 8086 Assembler, 8086 microprocessors instruction, assembly code, Assembly coding, assembly guide, assembly instruction, assembly language, assembly language instruction set, assembly language programming, Assembly program, assembly programming, capital letter, character convert, complete 8086 instruction sets microprocessors, complete instruction timing and instruction sets for 8086 microprocessors, conversion of characters in assembly language programming 8086, convert, emu8086, instruction complete set, instruction set complete for 8086, instruction sets, instruction sets for 8086, Lower case, Lowercase, print the small character into capital letter, programming 8086 assembly language conversion of small characters to capital, small letter, text string convert, Tutorial,


Assembly Language : 8086 Assembler Tutorial Part 10

Assembly Language : 8086 Assembler Tutorial Part 9

Assembly Language : 8086 Assembler Tutorial Part 8

Assembly Language : 8086 Assembler Tutorial Part 7

Assembly Language : 8086 Assembler Tutorial Part 6

Assembly Language : 8086 Assembler Tutorial Part 5

Assembly Language : 8086 Assembler Tutorial Part 4

Assembly Language : 8086 Assembler Tutorial Part 3

Assembly Language : 8086 Assembler Tutorial Part 2

Assembly Language : 8086 Assembler Tutorial Part 1

Assembly Language programming : Emu8086 Assembler Compiling and MASM / TASM compatibility

Assembly Language - string convert - Lowercase , Uppercase

for programming : the language of Number

Assembly Language - Complete Instruction Set and Instruction Timing of 8086 microprocessors

Assembly Language programming : A list of emulator supported interrupts

Assembly Language Programming : Emu8086 Overview, Using Emulator, Virtual Drives


Assembly Language Programming : All about Memory - Global Memory Table and Custom Memory Map


buy me  a cup of coffee

My Paypal Account is :  ksw.industries@gmail.com

Send me any small amount of money is welcome.
buy me  a cup of coffee

 ___________________________________________


Need More Detail ?   contact me !!


My Paypal Account is :   ksw.industries@gmail.com
buy me  a cup of coffee
Send me any small amount of money is welcome.

___________________________________________


Don't know how to send money ?   Click here for detail about Paypal account.
About PayPal Payment Methods

What type of PayPal accounts is better.
 


Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge






Saturday, 13 May 2017

Assembly Language : 8086 Assembler Tutorial Part 10

Assembly Language programming : 8086 Assembler Tutorial (Part 10)

Macros

Macros are just like procedures, but not really. Macros look like procedures, but they exist only until your code is compiled, after compilation all macros are replaced with real instructions. If you declared a macro and never used it in your code, compiler will simply ignore it. emu8086.inc is a good example of how macros can be used, this file contains several macros to make coding easier for you.

Macro definition:

name    MACRO  [parameters,...]

             <instructions>

ENDM


Unlike procedures, macros should be defined above the code that uses it, for example:

MyMacro    MACRO  p1, p2, p3

     MOV AX, p1
     MOV BX, p2
     MOV CX, p3

ENDM

ORG 100h

MyMacro 1, 2, 3

MyMacro 4, 5, DX

RET


The above code is expanded into:

MOV AX, 00001h
MOV BX, 00002h
MOV CX, 00003h
MOV AX, 00004h
MOV BX, 00005h
MOV CX, DX




Some important facts about macros and procedures:
  • When you want to use a procedure you should use CALL instruction, for example:
    CALL MyProc
  • When you want to use a macro, you can just type its name. For example:
    MyMacro
  • Procedure is located at some specific address in memory, and if you use the same procedure 100 times, the CPU will transfer control to this part of the memory. The control will be returned back to the program by RET instruction. The stack is used to keep the return address. The CALL instruction takes about 3 bytes, so the size of the output executable file grows very insignificantly, no matter how many time the procedure is used.

  • Macro is expanded directly in program's code. So if you use the same macro 100 times, the compiler expands the macro 100 times, making the output executable file larger and larger, each time all instructions of a macro are inserted.

  • You should use stack or any general purpose registers to pass parameters to procedure.

  • To pass parameters to macro, you can just type them after the macro name. For example:
    MyMacro 1, 2, 3
  • To mark the end of the macro ENDM directive is enough.

  • To mark the end of the procedure, you should type the name of the procedure before the ENDP directive.


Macros are expanded directly in code, therefore if there are labels inside the macro definition you may get "Duplicate declaration" error when macro is used for twice or more. To avoid such problem, use LOCAL directive followed by names of variables, labels or procedure names. For example:


MyMacro2    MACRO
 LOCAL label1, label2

 CMP  AX, 2
 JE label1
 CMP  AX, 3
 JE label2
 label1:
   INC  AX
 label2:
   ADD  AX, 2
ENDM


ORG 100h

MyMacro2

MyMacro2

RET


If you plan to use your macros in several programs, it may be a good idea to place all macros in a separate file. Place that file in Inc folder and use INCLUDE file-name directive to use macros. See Library of common functions - emu8086.inc for an example of such file.









  emu8086 is better than NASM, MASM or TASM

Tag: 8086 Assembler, 8086 microprocessors instruction, assembly code, Assembly coding, assembly guide, assembly instruction, assembly language, assembly language instruction set, assembly language programming, Assembly program, assembly programming, capital letter, character convert, complete 8086 instruction sets microprocessors, complete instruction timing and instruction sets for 8086 microprocessors, conversion of characters in assembly language programming 8086, convert, emu8086, instruction complete set, instruction set complete for 8086, instruction sets, instruction sets for 8086, Lower case, Lowercase, print the small character into capital letter, programming 8086 assembly language conversion of small characters to capital, small letter, text string convert, Tutorial,


Assembly Language : 8086 Assembler Tutorial Part 10

Assembly Language : 8086 Assembler Tutorial Part 9

Assembly Language : 8086 Assembler Tutorial Part 8

Assembly Language : 8086 Assembler Tutorial Part 7

Assembly Language : 8086 Assembler Tutorial Part 6

Assembly Language : 8086 Assembler Tutorial Part 5

Assembly Language : 8086 Assembler Tutorial Part 4

Assembly Language : 8086 Assembler Tutorial Part 3

Assembly Language : 8086 Assembler Tutorial Part 2

Assembly Language : 8086 Assembler Tutorial Part 1

Assembly Language programming : Emu8086 Assembler Compiling and MASM / TASM compatibility

Assembly Language - string convert - Lowercase , Uppercase

for programming : the language of Number

Assembly Language - Complete Instruction Set and Instruction Timing of 8086 microprocessors

Assembly Language programming : A list of emulator supported interrupts

Assembly Language Programming : Emu8086 Overview, Using Emulator, Virtual Drives


Assembly Language Programming : All about Memory - Global Memory Table and Custom Memory Map

buy me  a cup of coffee

My Paypal Account is :  ksw.industries@gmail.com

Send me any small amount of money is welcome.
buy me  a cup of coffee

 ___________________________________________


Need More Detail ?   contact me !!


My Paypal Account is :   ksw.industries@gmail.com
buy me  a cup of coffee
Send me any small amount of money is welcome.

___________________________________________


Don't know how to send money ?   Click here for detail about Paypal account.
About PayPal Payment Methods

What type of PayPal accounts is better.
 


Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge






Friday, 28 April 2017

Assembly Language : 8086 Assembler Tutorial Part 9

Assembly Language programming : 8086 Assembler Tutorial (Part 9)

The Stack

Stack is an area of memory for keeping temporary data. Stack is used by CALL instruction to keep return address for procedure, RET instruction gets this value from the stack and returns to that offset. Quite the same thing happens when INT instruction calls an interrupt, it stores in stack flag register, code segment and offset. IRET instruction is used to return from interrupt call.

We can also use the stack to keep any other data,
there are two instructions that work with the stack:

PUSH - stores 16 bit value in the stack.

POP - gets 16 bit value from the stack.

Syntax for PUSH instruction:

PUSH REG
PUSH SREG
PUSH memory
PUSH immediate
REG: AX, BX, CX, DX, DI, SI, BP, SP.

SREG: DS, ES, SS, CS.

memory: [BX], [BX+SI+7], 16 bit variable, etc...

immediate: 5, -24, 3Fh, 10001101b, etc...


Syntax for POP instruction:

POP REG
POP SREG
POP memory
REG: AX, BX, CX, DX, DI, SI, BP, SP.

SREG: DS, ES, SS, (except CS).

memory: [BX], [BX+SI+7], 16 bit variable, etc...



Notes:

  • PUSH and POP work with 16 bit values only!
  • Note: PUSH immediate works only on 80186 CPU and later!


The stack uses LIFO (Last In First Out) algorithm,
this means that if we push these values one by one into the stack:
1, 2, 3, 4, 5
the first value that we will get on pop will be 5, then 4, 3, 2, and only then 1.



It is very important to do equal number of PUSHs and POPs, otherwise the stack maybe corrupted and it will be impossible to return to operating system. As you already know we use RET instruction to return to operating system, so when program starts there is a return address in stack (generally it's 0000h).

PUSH and POP instruction are especially useful because we don't have too much registers to operate with, so here is a trick:

  • Store original value of the register in stack (using PUSH).
  • Use the register for any purpose.
  • Restore the original value of the register from stack (using POP).

Here is an example:


ORG    100h

MOV    AX, 1234h
PUSH   AX          ; store value of AX in stack.

MOV    AX, 5678h   ; modify the AX value.

POP    AX          ; restore the original value of AX.

RET

END


Another use of the stack is for exchanging the values,
here is an example:


ORG    100h

MOV    AX, 1212h   ; store 1212h in AX.
MOV    BX, 3434h   ; store 3434h in BX


PUSH   AX          ; store value of AX in stack.
PUSH   BX          ; store value of BX in stack.

POP    AX          ; set AX to original value of BX.
POP    BX          ; set BX to original value of AX.

RET

END

The exchange happens because stack uses LIFO (Last In First Out) algorithm, so when we push 1212h and then 3434h, on pop we will first get 3434h and only after it 1212h.




The stack memory area is set by SS (Stack Segment) register, and SP (Stack Pointer) register. Generally operating system sets values of these registers on program start.

"PUSH source" instruction does the following:

  • Subtract 2 from SP register.
  • Write the value of source to the address SS:SP.

"POP destination" instruction does the following:

  • Write the value at the address SS:SP to destination.
  • Add 2 to SP register.

The current address pointed by SS:SP is called the top of the stack.

For COM files stack segment is generally the code segment, and stack pointer is set to value of 0FFFEh. At the address SS:0FFFEh stored a return address for RET instruction that is executed in the end of the program.

You can visually see the stack operation by clicking on [Stack] button on emulator window. The top of the stack is marked with "<" sign.








  emu8086 is better than NASM, MASM or TASM

Tag: 8086 Assembler, 8086 microprocessors instruction, assembly code, Assembly coding, assembly guide, assembly instruction, assembly language, assembly language instruction set, assembly language programming, Assembly program, assembly programming, capital letter, character convert, complete 8086 instruction sets microprocessors, complete instruction timing and instruction sets for 8086 microprocessors, conversion of characters in assembly language programming 8086, convert, emu8086, instruction complete set, instruction set complete for 8086, instruction sets, instruction sets for 8086, Lower case, Lowercase, print the small character into capital letter, programming 8086 assembly language conversion of small characters to capital, small letter, text string convert, Tutorial,


Assembly Language : 8086 Assembler Tutorial Part 10

Assembly Language : 8086 Assembler Tutorial Part 9

Assembly Language : 8086 Assembler Tutorial Part 8

Assembly Language : 8086 Assembler Tutorial Part 7

Assembly Language : 8086 Assembler Tutorial Part 6

Assembly Language : 8086 Assembler Tutorial Part 5

Assembly Language : 8086 Assembler Tutorial Part 4

Assembly Language : 8086 Assembler Tutorial Part 3

Assembly Language : 8086 Assembler Tutorial Part 2

Assembly Language : 8086 Assembler Tutorial Part 1


Assembly Language - string convert - Lowercase , Uppercase

for programming : the language of Number

Assembly Language - Complete Instruction Set and Instruction Timing of 8086 microprocessors

Assembly Language programming : A list of emulator supported interrupts

Assembly Language Programming : Emu8086 Overview, Using Emulator, Virtual Drives


buy me  a cup of coffee

My Paypal Account is :  ksw.industries@gmail.com

Send me any small amount of money is welcome.
buy me  a cup of coffee

 ___________________________________________


Need More Detail ?   contact me !!


My Paypal Account is :   ksw.industries@gmail.com
buy me  a cup of coffee
Send me any small amount of money is welcome.

___________________________________________


Don't know how to send money ?   Click here for detail about Paypal account.
About PayPal Payment Methods

What type of PayPal accounts is better.
 


Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge







Assembly Language - string convert - Lowercase , Uppercase

Assembly code : Convert String  - Lower Case , Upper Case

Assembly program, Assembly code, Assembly coding, convert, Lowercase, Uppercase, Lower case, Upper case, capital letter, string convert, character convert, print the small character into capital letter, conversion of characters in assembly language programming 8086, emu8086, programming 8086 assembly language conversion of small characters to capital, assembly language programming, assembly language, assembly programming.

Assembly Language 8086 convert small character to capital letter






;CREATE A PROGRAM THAT WILL ASK FOR A SMALL LETTER
;AND OUTPUT IT IN CAPITAL LETTER



@pc macro char
mov ah,02h
mov dl,char
int 21h
endm

@ps macro st
mov ah,09h
lea dx,st
int 21h
endm


cseg segment para 'code'
assume cs:cseg;ss:cseg;ds:cseg;es:cseg
org 100h

start: jmp begin

dianacustodio db ?
str1 db 'Input a character: $'
str2 db 10,13,'Output: $'


begin:
mov ax,03h    ;clear
int 10h        ;clear

@ps str1    ;input a char

mov ah,01h    ;interrupt for inputing a char
int 21h


mov dianacustodio,al ;put the character from al register to dianacustodio variable

cmp dianacustodio,97    ;compare if the character inside the dianacustodio variable is greaterthan or equal to 97(ASCII)
jge covert_now ;if greater than or equal to 97,then jump to convert_now label.

cmp dianacustodio,123
jge exit ;if 123 or greater, terminate the program

cmp dianacustodio,96
jle exit ;exit again if the input is not a small character

convert_now:
sub dianacustodio,32 ;subtract 32 decimal to convert the character to capital
@ps str2
@pc dianacustodio ;then print

exit:

int 20h
cseg ends
end start






  emu8086 is better than NASM, MASM or TASM

Tag: 8086 Assembler, 8086 microprocessors instruction, assembly code, Assembly coding, assembly guide, assembly instruction, assembly language, assembly language instruction set, assembly language programming, Assembly program, assembly programming, capital letter, character convert, complete 8086 instruction sets microprocessors, complete instruction timing and instruction sets for 8086 microprocessors, conversion of characters in assembly language programming 8086, convert, emu8086, instruction complete set, instruction set complete for 8086, instruction sets, instruction sets for 8086, Lower case, Lowercase, print the small character into capital letter, programming 8086 assembly language conversion of small characters to capital, small letter , string convert, Tutorial, Upper case, Uppercase, Text string



Assembly Language : 8086 Assembler Tutorial Part 10

Assembly Language : 8086 Assembler Tutorial Part 9

Assembly Language : 8086 Assembler Tutorial Part 8

Assembly Language : 8086 Assembler Tutorial Part 7

Assembly Language : 8086 Assembler Tutorial Part 6

Assembly Language : 8086 Assembler Tutorial Part 5

Assembly Language : 8086 Assembler Tutorial Part 4

Assembly Language : 8086 Assembler Tutorial Part 3

Assembly Language : 8086 Assembler Tutorial Part 2

Assembly Language : 8086 Assembler Tutorial Part 1

Assembly Language programming : Emu8086 Assembler Compiling and MASM / TASM compatibility

Assembly Language - string convert - Lowercase , Uppercase

for programming : the language of Number

Assembly Language - Complete Instruction Set and Instruction Timing of 8086 microprocessors

Assembly Language programming : A list of emulator supported interrupts

Assembly Language Programming : Emu8086 Overview, Using Emulator, Virtual Drives

Assembly Language Programming : All about Memory - Global Memory Table and Custom Memory Map


buy me  a cup of coffee

My Paypal Account is :  ksw.industries@gmail.com

Send me any small amount of money is welcome.
buy me  a cup of coffee

 ___________________________________________


Need More Detail ?   contact me !!


My Paypal Account is :   ksw.industries@gmail.com
buy me  a cup of coffee
Send me any small amount of money is welcome.

___________________________________________


Don't know how to send money ?   Click here for detail about Paypal account.
About PayPal Payment Methods

What type of PayPal accounts is better.
 


Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge







Friday, 21 April 2017

a Free and very simple vector graphics editor for web and desktop




The Complete Blogger’s Guide To Vector Graphics Design

a free and very simple vector graphics editor for web and desktop. It's much more powerful than Canva and allows you to create/edit without limitations icons, logotypes, charts, infographics etc.
The success of every blog depends not only on great content and copywriting - but also on the beautiful and conveying graphics and visual branding.
Your logo must be clear and sized correctly on your web page. Blog articles covers must be simple and yet informative. Newsletters and infographics you are sharing with your users must contain well formatted graphics.
All these elements of your blog must be vectors - scalable and clear kind of graphics that use mathematical equations to draw out your designs. Fear not though - they are much easier to use them than it sounds! πŸ˜‰
Many bloggers and content marketers are getting confused how to approach vector graphics design. Which tools to use for different graphic design projects, how to choose typography, which colors match well together?
In this guide we will approach these and other common questions bloggers are facing with graphics design. With just one aim in mind - taking your blog to the next level with new shiny vector graphics! πŸš€

What Are Vector Graphics ⁉

Vector graphics are drawn using mathematical equations. These mathematical equations are translated into points that are tied up by lines or curves, also known as vector paths, and they make up all the different shapes you see in a vector graphic.
This allows vector graphics to be scaled to any size without sacrificing image quality as well as maintain a small file size. Amazing, right? Common vector file formats are .svg, .cgm, .odg, .eps, and .xml.
vector vs raster
Raster graphics on the other hand are optimal for digital photo editing because raster graphics are able to portray better color depth. Each pixel can be any one of the 16 million different colors available. But if you’re not working with photographs, vector graphics editor must be your #1 choice especially because vector graphics are able to be scaled and manipulated at any size with clarity.
vector vs raster tables

Things Bloggers Use Vector Graphics For

Bloggers and content marketers would need to use vector graphics for a range of different activities while establishing, developing and growing their blogs.
There are multiple things you can visualize: charts, quotes, numbers, lists. Most of the things you put in graphics are more appealing to your readers and therefore generate more engagement, which quickly transforms into revenues too.

1. Logotypes

Logotypes are essential. They are the most powerful element of personal branding present at about every important page of your website.
Do not make the mistake of using Photoshop of any other raster graphics editor to create or edit your logotype. Always use vector graphics editor like Vectr for your logos - this way you can make sure it is clear and sharp no matter how you resize it.
logotype example

2. Blog Cover Images

Vector graphics are sharper and sometimes much more expressive than raster images. Even though normally you upload PNG or JPEG to WordPress, it is always a good idea to use images created in vector graphics software for your articles’ covers.
You can easily and intuitively manipulate text and images in vector graphics editor, as well as other powerful tools like a pen tool.
Here is an example of a great graphic article cover image from AhRefs marketing blog.
example of an article cover

3. Collages

Creating collages is really easy and fun. Collages are great both for social media and blog articles - you can republish them easily and generate even more attention of your readers.
collages in vectr

4. Social Media Graphics

Indeed there are plenty of tools for creating social media graphics. But vector software ain’t any worse than any of them! Since you have already been working in one tool with your logotypes and blog cover images - it makes a lot of sense to use the same tool for social media too.
Vector graphics editor allows you to create cool custom icons which you could use for Facebook, Twitter or Pinterest. There is also no better software for creating memes! :)
gif doge meme

5. Website UI MockUps

Yes of course you are a blogger not a developer. Yet still when redesigning your website it is great to be able to prepare some basic user interface mockups to convey your vision.
Vector graphics software makes it really easy to prototype your ideal website. That would make developer’s life easier and save you lots of time and surely some money too.
Check this great short tutorial on how to use Vectr for web UI prototyping. Easy, right?

6. Business Cards

Time comes and you become famous! πŸ˜‰ Your readers and fans start stalking you. Fellow writers start sending you praising emails. Means that it is time to create business cards.
Vector graphics editor is a perfect tool for creating such projects. Anything that needs to be printed must be top quality and clarity. It is pretty easy to design your business cards yourself, all you need is to play around with some fonts, backgrounds and your logotype.

Images And Icons Resources πŸ–Ό

There are multiple resources bloggers could use to source some great images, graphics and icons for their work. It is always more efficient to download some ready-made pieces and then modify them than creating everything from scratch.
We are going to list the best of them here:

Royalty Free Images

Free Vector Icons

Typography Rules πŸ” 

There are some simple typography rules to follow when designing vector graphics. They do differ of course depending on the type of a project you are creating. We are going to list here a couple of generic foundational rules worth following anytime.

Don’t use fancy fonts

Try to keep it as simple as possible. Don’t use fancy fonts if you do not know what you are doing.

Forget About Comic Sans

Pretend you never seen it.

Don’t mix more than two fonts

It doesn’t look too consistent when you mix up more than two fonts in one vector graphic piece or text. Just check the example below, does not look good right?
1-NE0uJOMDgEmS8Khnpn969A

Mix only contrasting fonts

Preserving contrast is the way to go when mixing up fonts. Mix Serif + Sans-Serif, that would always work best.
1-lpw0CNATsIlG0hrbj81OCA

Spell Numbers πŸ”’

Unless your blog is about mathematics or physics, spell the numbers. It is more aesthetic and makes reading easier.

Picking The Right Colors 🎨

Picking and mixing the right colors for your vector graphics ain’t easy. However there are many great tools out there which could be helpful.
We recommend using a tool like Coolors.co to create your color palettes. Coolors is very intuitive and does not require any knowledge of graphic design or color theory, it just straightforwardly helps you pick the colors that match well together.
coolors color choosing

RYB Color Wheel

If you are serious about graphic design though, it is always easy and fun learning a bit about color theory. The first circular color diagram in fact was designed by Sir Isaac Newton in 1666.
color wheel
In the RYB (an abbreviation of red–yellow–blue) color model, the primary colors are considered red 🌹, yellow 🌻 and blue πŸ’™.
The three secondary colors are green, orange and purple. They are created by mixing two primary colors.
Another six tertiary colors are formed by mixing primary and secondary colors.
Colors that are located opposite of each other on the color wheel are called complementary colors. For example - red and green. The high contrast of the complementary colors creates a bright and vibrant look especially when displayed at full saturation. Be careful however not to make it too jarring. Complementary colors are really bad for text.
Analogous color schemes use colors that are right next to each other on the color wheel. They usually match really well and create natural and good-looking designs. Be sure to have enough of contrast however when using analogous colors.
A triadic color scheme includes the colors that are evenly spaced around the color wheel. For example - purple, green and orange. Triadic color schemes tend to be quite bright, even if you use the colors which are paler.

Vectr - Intuitive And Powerful Tool To Bring Your Designs To Life

Vectr is the best vector graphics tool available for bloggers and content marketers to bring their projects into reality.

* Free

Vectr is free, forever. Our mission has always been making vector graphics design accessible to everyone - therefore Vectr is to remain free forever. We are going to develop a PRO account though which is have plenty of advanced functions. Check roadmap page for more!

* Powerful

Vectr is packed with powerful tools able of producing top-notch graphics.
  • Create icons, website UI designs, logotypes, brochures, banners
  • Easy to use pen tool - create curved and straight paths and modify them
  • Intuitive freehand drawing tool - draw custom shapes
  • Easily add lines, circles, rectangles and manipulate them
  • Canvas size templates for most popular projects
  • Grouping layers - group layers and modify them together
  • Corner radius - change the radius of any corners

* Intuitive

Vectr is simple and intuitive. See what our users are saying about Vectr:

* Cross-platform

Vectr works both on the web and desktop - Mac, Windows, Linux or Chromebook. So now you can start designing on the web and then continue on a different computer’s desktop app - all your progress will be synced automatically.

* Vectr WordPress Plugin

For those bloggers using WordPress content management system - Vectr has a plugin for WordPress allowing you to edit graphics straight from your browser window! All your designs will of course sync with your account.
You can download it for free from the official WordPress directory.

Summary

Each blogger and content marketer should embrace vector graphics design. It is a professional way to approach designing most of your marketing materials which would make you stand out of the crowd.
Vector graphics design is easy and fun too. There are plenty of resources to learn from and intuitive tools available for free which enable you to create anything.
Good luck designing! πŸ˜‰


My Paypal Account is :  ksw.industries@gmail.com

Send me any small amount of money is welcome.
buy me  a cup of coffee

 ___________________________________________


Need More Detail ?   contact me !!

My Paypal Account is :   ksw.industries@gmail.com
buy me  a cup of coffee
Send me any small amount of money is welcome.

___________________________________________


Don't know how to send money ?   Click here for detail about Paypal account.
About PayPal Payment Methods

What type of PayPal accounts is better.
 


Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge