Thread: Assembley

  1. #1
    Xterria
    Guest

    Angry Assembley

    What the heck is assembley? I know it's some weird language, but what's it have to do with C++? I'm Sick and tired of seeing the 'asm' tag all over the place. How do I program assembley in C++? Thanks

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    you probably dont need to use assembly especially yet.

    It is not portable.It is processor specific.Using it in c++ is compiler specific.Learn c++ and windows api's before anything else. You will probably never need to use assembly unless you are writing an operating system or device drivers.
    After learning the windows api you can then move onto directx and opengl. This will allow you to make some nifty games.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    if you really want to learn asm then you should download the a86 assembler.This comes with a good x86 assembly tutorial.

    I dont have the link for it but do a search at google for it.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    6
    there are asm tutorials all over the web.

    check out spyko's demo coding page (search cos i forgot the link!)

    assembly gives you complete control over your computer.

    in fact, all of the standard asm commands can be used on the 386 above, so it is portable, but only on certain cpus.

    assembly is FAST. think of a game in 640 x 480 resolution.

    it will perform a lot of calculations, and put 307200 pixels on the screen.

    use a function and this will takes AGES

    use asm and it takes milliseconds....

    the basics of asm are that the cpu has registers. think of these like variables already defined.

    the first asm statement people learn is this

    MOV <dest>, <source>

    which moves a value from place to place

    eg.

    MOV ax, A000h
    MOV es, ax

    which actually sets up the es reg with the pointer to the vga

    some registers are

    ax - accumilator, used a lot. safe to play with, as long as you dont call asm funcs with it

    bx - base reg

    cx - counter

    dx - displacement reg

    values can be put in these without 2 much trouble

    i cant give a complete tutorial here but..

    here is how to go into 320x200 video mode

    asm mov ax, 0013h
    asm int 10h

    and go back to console mode (text mode) 80x25

    asm mov ax, 0003h
    asm int 10h

    learn it and use it to speed up sections of slow code

    hope this helps

    UncleG

  5. #5
    Registered User Gwargh's Avatar
    Join Date
    Aug 2001
    Posts
    7
    Assembly is the lowest of low-level programming.

    You'll only need it if there is a part of your program that is absolutely speed-critical.

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    6

    Question binary

    to Gwargh>

    assembly is low level, but if you were to create a driver file for a device which sent pulses if 0s and 1s through the input processor port, couldn't you program your cpu in binary?

    if i could build the device..... (the driver would be easy to write...)

    do you know a lot about assmebly?
    i have only known it for a short time.

    you can convert entire programs to assembly as i have done on parts of my 3d engine in c++. 81% of it is inline asm and the only thing c++ is used for is pointers and arrays.

    i'm not sure the slight speed improvement will affect it greatly, or be even worth it, but i have tried it, and i will probably leave it out as it won't be as portable.

    Can you solve this problem:

    I use DevC++ which uses the GNU compiler and so uses LINUX assembly, so i have had to convert it in my head to linux asm, but the asm interupts (INT xxh) crash my system. i have a feeling its because im using ms win98. i decided to download Borland c++ builder 5.5 (search on lycos) and i tried to compile it without success. I downloaded octopod, an IDE for borland 5.5 (which meant i didnt have to work with command lines) and tried again. I can now compile all of my code except the

    asm {

    }

    blocks. It said i required tasm, which i downloaded! but tasm said it did not recognise instruction MOV !!!?!?!?!?!?!?!?!?! after i had ran it with the .asm file my compiler produced

    this is like c++ telling you it doesnt know what void or if is!

    the compiler had generated this .asm file so it should have worked, but it didn't

    What compiler do you use and does it support asm?

    Thanks

    UncleG

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. i want to print number on scrren via assembley
    By planet_abhi in forum C Programming
    Replies: 2
    Last Post: 03-26-2003, 06:12 PM