Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 39

Thread: assembly -- where would you begin

  1. #11
    Join Date
    Mar 2009
    Location
    pennslyvania
    Beans
    122
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: assembly -- where would you begin

    does it make a difference that my cpu is:"AMD Athlon(tm) II X2 240 Processor"?

    I am really not sure what X86 means I noticed that under capabilities it list x86-64.

    Code:
    *-cpu
              product: AMD Athlon(tm) II X2 240 Processor
              vendor: Advanced Micro Devices [AMD]
              physical id: 6
              bus info: cpu@0
              version: 15.6.2
              size: 800MHz
              capacity: 800MHz
              width: 64 bits
              capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp x86-64 3dnowext 3dnow constant_tsc nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save cpufreq

  2. #12
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: assembly -- where would you begin

    Hi

    does it make a difference that my cpu is:"AMD Athlon(tm) II X2 240 Processor"?
    No. It's still the X86 instruction set (with a couple of minor instruction changes).

    I am really not sure what X86 means I noticed that under capabilities it list x86-64.
    Have a read of this.

    http://en.wikipedia.org/wiki/X86

    x86-64
    is a 64 bit processor based on the X86 architecture and instruction set.

    Kind regards
    Last edited by matt_symes; January 21st, 2011 at 05:11 PM.
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  3. #13
    Join Date
    May 2007
    Beans
    245
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: assembly -- where would you begin

    Start by reading some decent books/tutorials.

    This one uses Nasm in combination with the C standard library:
    http://www.drpaulcarter.com/pcasm/

    Install Nasm from here: http://www.nasm.us/

    For an easy introduction from a High-Level perspective, check out 'Art of Assembly' in combination with High-Level Assembler:
    http://homepage.mac.com/randyhyde/we...edu/index.html
    [very cross-platform: Mac OSX, FreeBSD, Linux, and Windows]

    On Linux, you probably already have G(as) {GNU's "as" assembler} installed (do a 'apt-get install build-essential' if you don't), in which case, this is a great introduction:
    http://programminggroundup.blogspot....ground-up.html

    Since you have a 64-bit CPU, this one tells you how to deal with that issue:
    http://www.duntemann.com/assembly.html

  4. #14
    Join Date
    Jan 2011
    Beans
    3

    Re: assembly -- where would you begin

    Learning assembler is an excellent way to learn How Computers Work from a software POV. It's also (just about) the only way to really learn why high level languages do what they do and the trade-offs of doing it using X rather then Y.

    A neat thing is: once you've grasped one assembly you've pretty much grasped them all except for microprocessor (or Bit Slice!) specific dongles. (Tho' why anyone would learn micro-coding in 2011 escapes me.)

    "How to Do It" depends on your tolerance for frustration.

    Working with current machines requires a level of knowledge you may not have. Yes, they are more powerful and, yes, they will get you to the current State-of-the-Art with fewer purchases. Using current machines also pose a higher barrier, in terms of necessary knowledge, e.g., you've really GOT to know what a linker is and how it works in a "deep" way. This is the High Frustration Path. It's also a path to some REALLY nasty problems when you ... putting it bluntly ... screw up. (As you will. EVERYBODY does!) Inadvertently overwriting disk storage isn't the disaster it can be if the operating system is in ROM rather than disk-resident.

    (Trust me on this one. I've done it. Crapped a VAX 11/780 by an "oopsie" in an indirect pointer.)

    A slightly more expensive (but much, much, safer) way is to find yourself a system using a Z80, 6502, 6809 or other, obsolete, processor. One advantage is you'll learn the basic steps and concepts of assembler without having a bunch of "cruft" in the way. A second is these older machines were designed when hobbyists used assembler on a regular basis and, thus, there is a ton of supporting documentation, examples, and tools (using the word loosely) for writing assembler. Plus you should get, with the machine, a ton of books, documentation, & etc. on the specifics of the machine - such as the exact address of where keyboard input is shoved - as well as documents, etc., on the microprocessor the machine is built around. You should get all of those pluses with one purchase price.

    An IBM PC would learn you the of the How's & Why's of Segmentation Faults from a hardware POV as well as software procedure(s) for detecting them, getting around them, managing them, & etc.

    Granted learning specifics of an obsolete microprocessor seems a bit of a waste of time. But learning to "think" assembler is, I submit, the most important thing and that will carry across.

  5. #15
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: assembly -- where would you begin

    Hi

    But learning to "think" assembler is, I submit, the most important thing and that will carry across.
    Very nicely put. I cut my teeth on 6502 on the BBC Micro. It never did me any harm

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  6. #16
    Join Date
    Mar 2009
    Location
    pennslyvania
    Beans
    122
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: assembly -- where would you begin

    It's also a path to some REALLY nasty problems when you ... putting it bluntly ... screw up. (As you will. EVERYBODY does!) Inadvertently overwriting disk storage isn't the disaster it can be if the operating system is in ROM rather than disk-resident.
    Ok--this comment scared me. I've lost operating systems before--I can handle that, but is it possible I could make my computer unusable?

  7. #17
    Join Date
    Sep 2007
    Location
    Christchurch, New Zealand
    Beans
    1,328
    Distro
    Ubuntu

    Re: assembly -- where would you begin

    Quote Originally Posted by audit View Post
    Ok--this comment scared me. I've lost operating systems before--I can handle that, but is it possible I could make my computer unusable?
    IMO you are quite safe running programs on Linux without super user privileges.

    You are completely right in what you plan to do and surely universities would have recognized the merits of teaching how computers actually work with a bit of assembler

    What I would say is that it would be much better to start with a RISC processor instruction set or with one that is "orthogonal" so that every addressing mode is consistently available to every instruction. Do have a google for an emulator of something simpler than the convoluted x86 with it's mind-boggling segmented memory architecture.
    Last edited by worksofcraft; January 22nd, 2011 at 12:22 AM. Reason: orthogonal linked to explanation about instruction sets

  8. #18
    Join Date
    Jan 2011
    Beans
    3

    Re: assembly -- where would you begin

    You're not going to harm the hardware, if that's the worry.

    Any decent manual coming with your assembler should give the various "safe" and "Don't Touch!" areas specific to your computer. The operating system manual should, somewhere, give you the same information for the OS. I'm a newbie to Ubuntu so I can't point you to it.

    Do remember, tho', with assembler you're in charge. If you tell the machine to write at disk sector 175, it WILL write at sector 175. The effect(s) - if any - depends on what is - or is supposed to be - at sector 175. Same thing with memory, plopping data at address #FD6237A may, or may not, affect the OS or another working program's function.

    At worst, you'll hose the OS and have to re-install.

    Which is what I did with the 11/780. Essentially, I took the file names-to-physical sector information and turned a bunch of different programs, device drivers, & etc on the hard disk into one All Inclusive file so system calls to the programs, devices drivers, & etc. got ... confused. (Shall I say.) The system went down and I had to re-install the stuff.

    Annoying but recoverable.

  9. #19
    Join Date
    May 2007
    Beans
    245
    Distro
    Ubuntu 10.04 Lucid Lynx

    Arrow Re: assembly -- where would you begin

    Quote Originally Posted by worksofcraft View Post
    IMO you are quite safe running programs on Linux without super user privileges.
    That is correct. Don't run as 'root' while playing with system calls (this goes for C hackers too). I made the mistake once and screwed-up the file-system.
    You are completely right in what you plan to do and surely universities would have recognized the merits of teaching how computers actually work with a bit of assembler
    They do.
    What I would say is that it would be much better to start with a RISC processor instruction set or with one that is "orthogonal" so that every addressing mode is consistently available to every instruction. Do have a google for an emulator of something simpler than the convoluted x86 with it's mind-boggling segmented memory architecture.
    "segmented memory architecture" has been obsolete for at least two decades (although there are some who still use DOS). All modern Operating Systems (excluding FreeDOS and related projects) use virtual memory and operate the CPU in protected mode.

    http://en.wikipedia.org/wiki/Protected_mode
    http://en.wikipedia.org/wiki/Virtual_memory
    http://en.wikipedia.org/wiki/Paging

    After you read those, worksofcraft, you will no longer be living in 1992.

  10. #20
    Join Date
    May 2007
    Beans
    245
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: assembly -- where would you begin

    Quote Originally Posted by AThornton View Post
    Do remember, tho', with assembler you're in charge. If you tell the machine to write at disk sector 175, it WILL write at sector 175. The effect(s) - if any - depends on what is - or is supposed to be - at sector 175. Same thing with memory, plopping data at address #FD6237A may, or may not, affect the OS or another working program's function.
    Modern OS'en will not allow you to do so. Protected Mode means that the OS will complain if a user program attempts to access something it shouldn't.

Page 2 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •