Assembly Programming

ScottALot

Active Member
Anybody on the forums experienced in Assembly? I can't find much stuff that's up-to-date, but I did order one book that was pretty cheap. I can't find any libraries or compilers... close to nothing! I want to learn it because it's a low-level language, something useful in computer engineering.
 
...assembly isn't fun. I've tried messing with it, enough to write a boot loader, but really, until you know you'll need it, I would just hold off. If you try to learn it now, you may get some basic knowledge, most of which you will forget when the need for it comes around. Just my suggestion.
 
I guess I'll look into other languages until then. It does seem like something that a job wouldn't expect you to have... more like something they'd teach you to use while you're there.
 
I did a lot of Assembly back in the late 80's on both System 370 (mainframe) and PC's. I haven't needed to use it in over 20 years now and can't remember much about it. I'm sure I could pick it up again if I needed to. It's kind of a dying art.
 
I downloaded a BIOS from an MSI board and I just wanted to take a look at the raw programming, but opening the file in Notepad just gives me a bunch of y's. I'm probably doing something really stupid :P
 
Did you download the BIOS binary file or the source code for the BIOS? My guess you downloaded the binary file which you can't view in notepad.
 
To get assembly code, you need to run the binary through a disassembler. Notepad is useful for at lot of things, but not that :)
 
This is just a block of code that I think is assembly... like I said before, I'm completely new to this.
So... did I do it right?
Code:
                assume cs:dseg
dseg:0000                 assume es:nothing, ss:nothing, ds:dseg, fs:nothing, gs:nothing
dseg:0000                 db 4, 0, 1, 40h, 0, 80h, 0, 2 dup(8), 20h, 2 dup(1), 3 dup(0)
dseg:0000                 db 3 dup(0FFh), 7Fh, 2 dup(0), 50h, 4Dh, 4Fh, 44h, 45h
dseg:0000                 db 2Fh, 57h, 20h, 76h, 31h, 2Eh, 2 dup(33h), 20h, 44h
dseg:0000                 db 4Fh, 53h, 20h, 65h, 78h, 74h, 65h, 6Eh, 64h, 65h, 72h
dseg:0000                 db 20h, 2Dh, 20h, 43h, 6Fh, 70h, 79h, 72h, 69h, 67h, 68h
dseg:0000                 db 74h, 20h, 31h, 2 dup(39h), 34h, 2Dh, 31h, 2 dup(39h)
dseg:0000                 db 37h, 2Ch, 20h, 44h, 61h, 72h, 65h, 64h, 65h, 76h, 69h
dseg:0000                 db 6Ch, 20h, 61h, 6Eh, 64h, 20h, 54h, 72h, 61h, 6Eh, 2Eh
dseg:0000                 db 7Dh, 4, 1Ch, 2
dseg:005E                 assume ss:seg001, ds:nothing
dseg:005E
dseg:005E ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
dseg:005E
dseg:005E
dseg:005E                 public start
dseg:005E start           proc far
dseg:005E                 cld
dseg:005F                 push    ss
dseg:0060                 pop     es
dseg:0061                 assume es:seg001
dseg:0061                 mov     di, 100h
dseg:0064                 mov     si, di
dseg:0066                 push    di
dseg:0067                 mov     cx, 165Eh
dseg:006A                 rep movsw
dseg:006C                 push    es
dseg:006D                 push    ds
dseg:006E                 pop     es
dseg:006F                 assume es:nothing
dseg:006F                 pop     ds
dseg:0070                 assume ds:dseg
dseg:0070                 pop     di
dseg:0071                 mov     si, 222h
dseg:0074                 push    es
dseg:0075                 push    cs
dseg:0076                 movsb
dseg:0077                 lodsw
dseg:0078                 mov     bp, ax
dseg:007A                 mov     dl, 10h
dseg:007C                 push    ds
dseg:007D                 mov     ax, 1D9h
dseg:0080                 push    ax
dseg:0081                 retf
dseg:0081 start           endp ; sp = -8
dseg:0081
dseg:0082
dseg:0082 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
dseg:0082
dseg:0082
dseg:0082 sub_10082       proc near               ; CODE XREF: dseg:loc_1008Ep
dseg:0082                                         ; dseg:0093p ...
dseg:0082                 shr     bp, 1
dseg:0084                 dec     dl
dseg:0086                 jnz     short locret_1008D
dseg:0088                 lodsw
dseg:0089                 mov     bp, ax
dseg:008B                 mov     dl, 10h
dseg:008D
dseg:008D locret_1008D:                           ; CODE XREF: sub_10082+4j
dseg:008D                 retn
dseg:008D sub_10082       endp
dseg:008D
dseg:008E ; ---------------------------------------------------------------------------
dseg:008E
dseg:008E loc_1008E:                              ; CODE XREF: dseg:00E9j
dseg:008E                 call    sub_10082
dseg:0091                 jnb     short loc_100A2
dseg:0093                 call    sub_10082
dseg:0096                 adc     cl, 1
dseg:0099                 shl     cl, 1
dseg:009B
dseg:009B loc_1009B:                              ; CODE XREF: dseg:00A0j
dseg:009B                 call    sub_10082
dseg:009E                 rcl     bh, 1
dseg:00A0                 loop    loc_1009B
dseg:00A2
dseg:00A2 loc_100A2:                              ; CODE XREF: dseg:0091j
dseg:00A2                 mov     dh, 2
dseg:00A4                 mov     cl, 4
dseg:00A6
dseg:00A6 loc_100A6:                              ; CODE XREF: dseg:00ADj
dseg:00A6                 inc     dh
dseg:00A8                 call    sub_10082
dseg:00AB                 jb      short loc_100CA
dseg:00AD                 loop    loc_100A6
dseg:00AF                 call    sub_10082
dseg:00B2                 jnb     short loc_100BC
dseg:00B4                 lodsb
dseg:00B5                 mov     cl, al
dseg:00B7                 add     cx, 0Fh
dseg:00BA                 jmp     short loc_100D0
dseg:00BC ; ---------------------------------------------------------------------------
dseg:00BC
dseg:00BC loc_100BC:                              ; CODE XREF: dseg:00B2j
dseg:00BC                 xor     dh, dh
dseg:00BE                 mov     cl, 3
dseg:00C0
dseg:00C0 loc_100C0:                              ; CODE XREF: dseg:00C5j
dseg:00C0                 call    sub_10082
dseg:00C3                 rcl     dh, 1
dseg:00C5                 loop    loc_100C0
dseg:00C7                 add     dh, 7
dseg:00CA
dseg:00CA loc_100CA:                              ; CODE XREF: dseg:00ABj
dseg:00CA                 mov     cl, dh
dseg:00CC                 jmp     short loc_100D0
 
Just a suggestion. I use to do assembly and everything was written in assembly. Been years since the 70's for 8080 and Z80. Besides the disassembler you will need a whip ass symbolic debugger after a disassemble. Only one i remember was a proggy called softice i think. Also visit a professional book store. Need a book on the instruction set also. Read the preface on the front from the author. Who is he catering too. Look for something like for your processor, intermediate to advanced. Good luck with your adventure.

They don't do much in assembly or machine language anymore. The computers are to fast, more ram, bigger hard drives. they use a lot of languages that are available now. Sloppy mostly, huge programs after compiling.
Its a good learning curve though and will give you the smarts if ya have the patience.
good luck.
 
Looks like you did the disassembly right but I don't think you will be able to learn Assembly language programming by looking at disassembled programs.

You should follow tremmor's advice and get a good book that is specific for the processor you want to code for.
 
I did order one book, but I'm not sure how good/on-par it is. Maybe we could create a list including
Compiler/Assembler
Debugger
Disassembler
Book(s)
Website(s)
 
You can do low level programming with C# and C++ too.And it is a lot better then using assembly.Plus you will find more informations on C# and C++ low level programming than for assembly.
You can also decompile .NET programs with Spices .NET and you will be able to see the CODE and ASSEMBLY with it.
By the way Spices .NET is pretty expensive,but I have it because it's great.It supports ALL .NET framework versions.


Cheers!
 
the problem with assembly is that it is specific for the architecture you are working with. do you really want to learn the assembly language for every mc & cpu out there?

i learned some 80x86 assembly a few years back and have never used it since. it is fairly popular though, so i would recommend that.

i'm taking a java class now and the great thing about it is that it is very portable.

good luck, mang
 
Assembly is tough to learn, but it is good knowledge to have when you are programming a high level language. You can also do funny things with a debugger - when you understand the jibberish.
 
the problem with assembly is that it is specific for the architecture you are working with. do you really want to learn the assembly language for every mc & cpu out there?

i learned some 80x86 assembly a few years back and have never used it since. it is fairly popular though, so i would recommend that.

i'm taking a java class now and the great thing about it is that it is very portable.

good luck, mang
You're right, assembly is very specific to the architecture it is written for (for obvious reasons) but I think it's important for all developers to write efficient code. Assembly is one way to do that. If you want to be good at it you are forced to understand how the hardware works. Higher level languages hide it from you and sometimes provide very inefficient constructs to achieve something that with a little effort could be done much faster (in execution time).
Assembly is tough to learn, but it is good knowledge to have when you are programming a high level language. You can also do funny things with a debugger - when you understand the jibberish.
Debuggers are powerful tools. You can find a lot of holes in a lot of software with nothing more than the general debugger if you know what you are doing. Rewriting commands on the fly can make some 'interesting' results too.
 
Learn a language instead. Im not sure which one now to learn. others will have more info on which one. I remember when i played with it i was disassembling a proggy i bought called Instant Assember. also had a a debugger. Problem was after you assembled you had to reboot to try it. I started debugging the program and was familiar with the instruction set. I modified the program and sent the block modification made to the author. John Blattner i think. You could assemble it then run it then debug it and do it again without rebooting. I requested the next revision if its used to just give me credit for it. This was for a TRS-80 and green screen. Guess what? They came out with the first color computer i remember. Commodore Amiga. I bought one. Imsai also. think it was a 8080, but not color.
its called the good old days. sat at the computer 12 hrs a day. 7 days a week for 3 mo's. And no internet, wasn't invented yet. It was bulletion boards and dial up.
 
Last edited:
Back
Top