Evenbit 52 Junior Poster

This exercise is designed to get you familiar with the Ubuntu command-line editing features. It also introduces you to the concept of command-line history.

Follow these steps

  1. Type the words "We all love Ubuntu" (without the quotation marks) but do not press Enter.
  2. Press the left arrow key to move the cursor to the letter "a" in the word "all".
  3. Press Alt+D to delete the word "all".
  4. Re-type the word "all" at the present cursor position.
  5. Press Ctrl+A to move the cursor to the beginning of the command line.
  6. Press the right arrow key to move the cursor to the letter "l" in "love".
  7. Press Ctrl+K to delete the line from the current cursor position.
  8. Press Ctrl+A and then press Ctrl+K to delete the entire line.
  9. Type "echo $SHELL" and press Enter.
  10. Type "date" and press Enter.
  11. Type "cal" and press Enter.
  12. Press the up arrow three times. You should see "echo $SHELL" on the current command line. Press the down arrow once. The current line will show "date". Now press Enter.
  13. Type "clear" and press Enter.
Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

You will want to use the numbers that are assigned to the mnuemonics. It looks like you are creating a 6502 simulator. In that case, use the information located here:

http://www.6502.org/tutorials/6502opcodes.html

Nathan.

Evenbit 52 Junior Poster

Can anyone point me to a discussion or reference tutorial, etc. on how to write a program in Assembly to reverse a simple string?

If you push the characters onto a stack and then pop them off again then you will get them in reverse order.

Nathan.

Evenbit 52 Junior Poster

Here is an example for DOS:

;
; PIANO3.ASM  [ For true DOS ]
; One-Octave 'Piano' Program
; Free from Annie
;
;   Use keyboard number keys 1 through 8 to play the notes.
;   Space bar toggles the 'sustain' function.  ESC exits.
;
;     This code assembles, as-is, with the A86 assembler.
;
;        To assemble: A86 PIANO3.ASM
;
code    segment
        org     100h            ;DOS .COM file
        jmp     start           ;go start the program
;
tog     db      0               ;our 'sustain' flag
;
start:
        mov     dx,offset msg   ;point DX to sign-on message
        call    prt_str         ;print it
;
; Get user keypress.
;
get_key:
        mov     ah,0            ;function 0 - wait for keypress
        int     16h             ;call ROM BIOS keyboard services
        cmp     al,27           ;was ESC pressed?
        jz      quit            ;yes, so go exit
        cmp     al,32           ;was SPACE pressed?
        jz      toggle          ;yes, so go toggle 'sustain' mode
;
; Filter out all keys except '1' through '8' by checking the scan code.
;
        cmp     ah,02h          ;less than '1'?
        jl      get_key         ;yes, so ignore it
        cmp     ah,09h          ;greater than '8'?
        jg      get_key         ;yes, so ignore it
;
; Set up the tone parameters.
;
        sub     al,21h          ;change scan code to to digit (0-9)
        and     al,00000111xb   ;mask off upper 5 bits
        shl     al,1            ;* by 2 (2 bytes/word)
        cbw                     ;byte --> word in AX
        mov     bx,ax           ;put in BX (for table)
        mov     ax,0            ;numerator (low word)
        mov     dx,12h          ;(high word)
        div     word ptr [table] + bx  ;divisor from table
        mov     bx,ax           ;save quotient in BX
;
; Set …
Evenbit 52 Junior Poster

Jeff added some coding puzzlers to his AsmIDE site:

http://members.save-net.com/jko%40save-net.com/asm/puzzles.htm

Anyone got any solutions, more puzzles, etc.?

Nathan.

Evenbit 52 Junior Poster

>microsoft's exe's are PE-COFF (correction)
That's not a correction. PE and PE-COFF or PE/COFF are all interchangeable terms.

The COFF part is most commonly used to talk about the format of the Object File before it is linked into the executable. Under Unix, you have several different Object File Formats (OFF) to choose from -- a.out, COFF, Elf, etc..

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

Evenbit 52 Junior Poster

<<snip>>
A .exe file is actually a file format called PE (Portable Executable).

Not necessarily! ".exe" files were very common under DOS for applications. The ".com" files were mainly used for small utilites and simple commands because they were limited to a small memory footprint . DOS ".exe" files are usually referred to as "MZ" format because they have that character sequence as their identifying signature. There was also a NE (New Executable) format which appeared during the 16-bit Windows and OS/2 days, but is now obsolete. The PE files actually contain a DOS stub as part of the header so that if you try to execute them under DOS, a message will appear telling you why it will not run.[code + data + stack all sharing the same segment]. DOS ".exe" files are usually referred to as "MZ" format because they have that character sequence as their identifying signature. There was also a NE (New Executable) format which appeared during the 16-bit Windows and OS/2 days, but is now obsolete. The PE files actually contain a DOS stub as part of the header so that if you try to execute them under DOS, a message will appear telling you why it will not run.

Evenbit 52 Junior Poster

hi all ,...
iam making a simple disk editor , and i need a methode that
convert from ascii to Hex representation
thank u all

Easy enough. Just look at your ASCII chart...

You will need the characters '0' thru '9' they are ASCII values 48 ($30) thru 57 ($39).

If you want lower case, then 'a' thru 'f' are 97 ($61) thru 102 ($66).

If you want upper, then 'A' thru 'F' are 65 ($41) thru 70 ($46).

When you get a byte of data, just divide it down the middle -- this gives you two nibbles. Take a nibble, add the value 48 ($30) to it, then check to see if it is larger than 57 ($39) - if it isn't, then you've got your ASCII representation for that nibble; if it is, then you add (97 - 57) or (65 - 57) to it to get your ASCII representation for that nibble.

Hope this helps!

Nathan.

Evenbit 52 Junior Poster

I am waiting for the release of HLA 1.82 before dumping any source on the CVS, however, all interested parties are invited to join the project {{ just let me know in what capacity -- developer, technician, project admin, etc. -- you wish to participate in }} to "kick around" your ideas and just generally get things started.

The project is at:
https://sourceforge.net/projects/hla-stdlib/

Subscribe to the mail list is at:
http://lists.sourceforge.net/lists/listinfo/hla-stdlib-talk

Description: The intention of this project is to support users of Randall Hyde's HLA (High Level Assembly) language [ http://webster.cs.ucr.edu/AsmTools/HLA/index.html ] who wish to maintain, extend, or evolve the HLA Standard Library. The current implementation of HLA is a prototype which runs on Windows and Linux -- with other platforms planned for the 2.x version. The public domain source code for the HLA stdlib portion can be obtained here: http://webster.cs.ucr.edu/AsmTools/HLA/dnld.html The intention is to keep all added/modified code in the public domain so that it may be included in future versions of HLA.

* Development Status: 5 - Production/Stable
* Intended Audience: Advanced End Users, Developers
* License: Public Domain
* Operating System: All 32-bit MS Windows (95/98/NT/2000/XP), Linux
* Programming Language: Assembly
* Topic: Compilers

Nathan.

Evenbit 52 Junior Poster

Sure, but I think maybe have it chew up memory, kill processes on the system, etc. Then at some point have the OS fail (maybe by overwriting the memory it's using?) and crash.

Well, if we are talking about Windows, the API does allow you to kill other processes...but you'll need to get their handles first.

Look for the 'winio' package - it might allow you to 'chew up memory' and fail the OS.

Nathan.

Evenbit 52 Junior Poster

That's easy to do in Assembly. There's a single command to shut down the system, issue that and your machine will stop dead in its tracks ;)
I leave it up to you to look it up in a manual as I don't have an Asm manual with me.

You will not find it in an "asm manual" because it isn't a CPU instruction. You will find it in a Windows API Reference as the "ExitWindows" call (and it can be called from C and Basic programs just as easily). However, non-valid opcodes can cause the CPU to choke (and, no, this isn't as safe or nice as "shutting down the system").

Nathan.

Evenbit 52 Junior Poster

Hi everyone, i am building a secure online voting system for my project, i really need some tips on how i can go about encrypting the information stored in a database which contains the votes submitted by the candidates. I was told by my project supervisor to try and implement public/private key encryption, i really dont know where to start. Please if u have any more ideas i could use to make the system more secure let me know. Thanks :?:

tip#1) Please DO NOT allow the 'candidates' to submit all of the votes. Wouldn't it make much more sense to allow the 'voters' to submit the votes?

tip#2) Stay away from the public/private key charade. Are you going to lock-up your house and then toss duplicates of the key into the street for anyone to pick up?

tip#3) Code for common encryption systems are widely available on the 'net -- if you can't find Java code for your favorite one(s), then it'd be an educational benefit to you to do the conversion(s).

http://csrc.nist.gov/CryptoToolkit/aes/rijndael/

Nathan.

Evenbit 52 Junior Poster

One option you can try is to write a script that launches QBasic and loads/runs your program. Check out AutoIt. It will compile to an EXE. Something like the following should work:

$ret = runwait("qbasic yourprg.bas", ... , ... )

Evenbit 52 Junior Poster

Talk about multilingual! The "99 Bottles of Beer" song is coded in something like 900 different [computer] languages here:

http://www.99-bottles-of-beer.net/

Nathan.

A little note from vegaseat:
You can look at my own version of this in Boo ...
http://www.99-bottles-of-beer.net/language-boo-947.html

Evenbit 52 Junior Poster

Compiled languages seem to be fading. :p
Yeah I heard ruby was good too tho.

No...the pendulum is swinging back the other way now. When was the last time that CPU clock speed doubled? As users continue to demand more functionality and more eye-candy multimedia, it will be up to the software to pull it off -- and that can't be done with interpreted languages and virtual machines.

Evenbit 52 Junior Poster

What you might want to do is install something like Python or Ruby and write your scripts in that.
No need for compilers.

Or you can install AutoIt. And you can optionally compile & compress your scripts too if you don't want to force your clients to download a runtime engine.

Evenbit 52 Junior Poster

I'm a newbie at writing DOS batch files. I've tried to look for it, but I can't seem to figure out how to read from an input file. Is there an equivalent of a cin statement in DOS Batch programming.

Some people have figured out how to do quite a good bit of processing work via batch files: ftp://137.193.64.130/pub/

Evenbit 52 Junior Poster

Some links and other resources that might help you newbies...

Lot of links at assemblylanguage.net:

http://www.cheapersunglasses.com//asm.html

More links at the Open Directory Project:

http://dmoz.org/Computers/Programming/Languages/Assembly/


- ASSEMBLERS -

MASM32
http://www.movsd.com

NASM: The Netwide Assembler
http://nasm.sourceforge.net

HLA: High Level Assembly Language
http://webster.cs.ucr.edu/AsmTools/HLA/index.html

FASM: The Flat Assembler
http://flatassembler.net/

GoAsm
http://www.godevtool.com/

A86 (DOS) [Free]/A386 (Windows) [Commercial]
http://eji.com/a86/

Or, you can Write Your Own!
http://webster.cs.ucr.edu/AsmTools/...rOwn/index.html


USENET

alt.comp.lang.assembler
alt.lang.asm
alt.os.assembly
alt.os.development
comp.lang.asm.x86
comp.lang.ml
comp.software.extreme-programming

WEB-BASED

http://www.tek-tips.com/threadminder.cfm?pid=272
http://win32asm.cjb.net
http://www.masmforum.com/
http://board.flatassembler.net/

GROUP-BASED

http://groups.yahoo.com/group/aoaprogramming/
http://groups.yahoo.com/group/win32-nasm-users/
http://groups.yahoo.com/group/win32masm/

- Other useful resources -

Intel Manuals and such
http://www.sandpile.org/

Ralph Brown's Interupt List
http://www-2.cs.cmu.edu/afs/cs.cmu..../ralf-home.html

ASSEMBLY LANGUAGE information, tools, forums, and other links available at:
http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.asm.x86.html

Nathan.

Evenbit 52 Junior Poster

Has anyone tried Rebol yet? The following is a GUI examp for Rebol/View:

REBOL [Title: "HW Example"]

view layout [text "Hello REBOL World!"]

Nathan.

Evenbit 52 Junior Poster

While you are at it, you might as well spray some bullets toward the other types of malware (spyware, trojans, etc.) since this would be an easy feature to add:

startup files
http://www.lafn.org/webconnect/mentor/startup/PENINDEX.HTM

trojans
http://www.megasecurity.org/files_all.html

Evenbit 52 Junior Poster

Hello !
My name is Clint, I'm learning at the Ben Gurion University in Israel, I make a research about viruses, how they work, way of operation, classify them into families.
Does any one know sites which can be helpful to my research ?

Thank you, Clint.

http://www.astalavista.com/
http://vil.nai.com/vil/content/v_125007.htm
http://securityresponse.symantec.com/avcenter/venc/data/w32.sobig.f@mm.html

Evenbit 52 Junior Poster

Something to the effect of...

LEFT CLICK on the upper-left corner of the window...
on the pop-up menu, select Properties...
on the dialog, CLICK the Screen tab...
CLICK the "Full-screen" radio button...
"Apply" button....
"OK" button...

that is it...

Evenbit 52 Junior Poster

Do a Google for "file formats" or "id3 tag specs" or something of that nature. Also, check out some conversion utilities or other id3 viewers and see if the authors hide some details in their documentation. Heck, you might even get lucky and figure some of it out just by using a hexviewer to scrutinize a few mp3 files yourself.

Evenbit 52 Junior Poster

A few examples to show how easy this is to accomplish in Assembly Language:

A) Linux console using GAS:

.text
.global _start
_start:
    movl    $4, %eax
    movl    $1, %ebx
    movl    $hello, %ecx
    movl    $14, %edx
    int $0x80

    movl    $1, %eax
    int $0x80

hello:  .string "Hello, world!\n"

ASSEMBLE: as -o hello.o hello.S
LINK: ld -o hello hello.o

B) Linux console using NASM:

;--------------------
; nasm -f elf hw.asm
; ld -s -o hw hw.o
;---------------------

global _start

section code read exec
_start:

     mov eax, 4
     mov ebx, 1
     mov ecx, msg
     mov edx, length
     int 80h

     mov eax, 1
     xor ebx, ebx
     int 80h

msg db 'Hello, world!', 10
length equ $ - msg

C) Win32 & Linux console using High Level Assembler (HLA):

program Hello;
#include( "stdlib.hhf" )

begin Hello;

stdout.puts( "Hello, world!" nl );

end Hello;

BUILD: HLA -v Hello

D) Win32 GUI using MASM32:

.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

.data
MsgCaption      db "100% ASM Win32 GUI applet",0
MsgBoxText      db "Hello, world!",0

.code
start:
	invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
	invoke ExitProcess,NULL
end start

EASY, HUH?

Evenbit 52 Junior Poster

It is certainly no trouble at all to do Internet-interface programming in ASM. Take a look at the source code for Quetannon at http://flatassembler.net/examples.php for an example of using the WinSock API at low-level. I believe that bandwidth latency is going to be the biggest factor to determine who gets the goodies. So it probably isn't going to matter what language they program their bot in. A well-written ASM routine could better monitor and retrieve the particular bit of data faster than bloated, sluggish high-level code, but a multi-player, network-bound game is going to have many other factors determining its outcome. You might want to ask that dude if he also plays the game at the lowest-quality sound/visual settings so that it doesn't hog CPU time away from his precious bot so that it can have a better chance at being quick to detect the spawn.

Evenbit 52 Junior Poster

Well, you can assemble your code in memory and run it from there...a perfect place to start for small DOS programs...you probably already have the tool (Debug), just need the tutorial:

http://www.datainstitute.com/debug1.htm

The IO.H file that your book wants is just assembly code for handling the input/output functions so you wont have to code this yourself. Actually, the book is doing you a disservice because you really should learn to code these yourself and this isn't difficult to learn. Check out Ralph Brown's Interupt List at:

http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/WWW/ralf-home.html

You will eventually discover that a lot of asmers have given up DOS in favor of Windows programming (which isn't that difficult to learn) and there are plenty of assemblers and resources available for this. Check out the links in the following thread:

http://www.daniweb.com/techtalkforums/thread22522.html

Happy asming!

Evenbit 52 Junior Poster

{guess there is nothing exciting going on in here so we are responding to old posts :D }

A few comments:

First, HLA isn't available for DOS programming. Its for Windows and Linux. Download the Windows or Linux version of 'Art of Assembly'.

Next, don't get stuck on the hardware details, boolean algebra, hex arithmatic, and all that jazz. That's just background information to help you understand what is going on inside the machine. Jump on into some actual programming examples to get a real feel for the language. You can always go back and review the hardware/boolean/whatnot if you had problems there.

Last, although AoA and HLA are good for learning, I wouldn't recommend trying to write an operating system with HLA. Try something like NASM or FASM.

Evenbit 52 Junior Poster

Some IDEs for assembly:

RadAsm (for masm/tasm/fasm/nasm/goasm/hla)
http://radasm.visualassembler.com/

WinAsm Studio (for masm/fasm)
http://www.winasm.net/

AsmEdit (for masm)
http://asmedit.massmind.org/

HIDE (for hla)
http://www.geocities.com/kahlinor/HIDE.html

Some ASM tutorials are listed here:

http://www.faqs.org/faqs/assembly-language/x86/general/part2/section-9.html

Evenbit 52 Junior Poster

Wow! I just received a personal letter from Steven King, my favorite horror author!

Ah, crap! Its just a forwarded e-mail from a stranger. No offense intended dude, but I consider such forwarded e-mail to be spam. I mean, when you fall for these e-mail forwarding gimmicks you are not really communicating with your friends. What you are really telling them is that you have nothing at all to share with them (how your day went, a funny thing that your daughter said, what happened at the mall, etc.) so you'd rather send them some spam instead (in this particular instance: a few items your friends would already know about you plus a whole lot of trivial things that your friends DON'T particularly care to know).

By the way, how long have you had your head buried in the sand? Have you not heard about the dangers of phishing? (http://www.webopedia.com/TERM/p/phishing.html) (http://en.wikipedia.org/wiki/Phishing) (http://www.consumer.gov/idtheft/) (http://en.wikipedia.org/wiki/Identity_theft) Just out of curiosity to see what I could get by with, I created a profile for you at Yahoo Personals using the info from your spam. Do you really want your neighbors, preacher, or boss to see what I wrote? Don't worry -- I deleted it, but there are a couple of outlaw bikers who are eager to become your "friend" if ya know what I mean. ;-)

If you are still intent on forwarding e-mail to strangers, you should at least read the documentation …

Evenbit 52 Junior Poster

I believe that it really doesn't matter what language you learn because your skills are easily transferable. The major difference between languages is syntax, so once you understand the syntax of a new language, you can start programming in it with ease. After you have learned a few languages, they all begin to look the same. Same way with Operating Systems/Platforms -- your skills are easily transferrable from one to another so why worry about which one you start out on?

Evenbit 52 Junior Poster

Well, after the MAIN: label you can do something like...say, read a sector:

mov DH, 0 ; set the head
mov CH, 0 ; set the track
mov CL, 1 ; set the sector
lea BX, buffer ;must define 'buffer' first
call ReadSector

Then you will want to check the value in AH and handle any errors appropriately.

If no errors, then you might want to display the sector:

mov DH, 0 ; set the head
mov CH, 0 ; set the track
mov CL, 1 ; set the sector
lea BX, buffer
call DisplaySector

Of course, you will have to write the 'DisplaySector' code first. ;)

Hope this helps!

Evenbit 52 Junior Poster

CORRECTION

alt.comp.lang.assembler
alt.lang.asm <<*popular* un-moderated>>
alt.os.assembly
alt.os.development
comp.lang.asm.x86 <<*popular* moderated>>
comp.lang.ml
comp.software.extreme-programming

Evenbit 52 Junior Poster

Greetings,

I was just curious as to where I can find any good Assembly Language compilers on the net or elsewhere.

Thanks in advance,

DeFrog777

Did you try a Google Search??? ;)

Well, you didn't specify for what CPU/platform you need the assembler for [x86, MIPS, 68K, SPARC, ARM/XScale, PowerPC, etc -- DOS, Windows, Mac OS X, Linux, etc], so I will simply assume the most likely -- x86/Windows.

These days, almost ALL assemblers (and associated tools and even online books) are free [unless otherwise noted below] and have a sizable following of an active, helpful community. The following list is not exhaustive, but is what I consider to be the "good" Assembly Language Compilers and associated links.

- ASSEMBLERS -

MASM32
http://www.movsd.com

NASM: The Netwide Assembler
http://nasm.sourceforge.net

HLA: High Level Assembly Language
http://webster.cs.ucr.edu/AsmTools/HLA/index.html

FASM: The Flat Assembler
http://flatassembler.net/

GoAsm
http://www.godevtool.com/

A86 (DOS) [Free]/A386 (Windows) [Commercial]
http://eji.com/a86/

Or, you can Write Your Own!
http://webster.cs.ucr.edu/AsmTools/RollYourOwn/index.html

- DEBUGGERS/DIS-ASSEMBLERS -

There are many to choose from [see the sites above for links], but for x86/Windows, this is all you will ever need:

OllyDbg
http://home.t-online.de/home/Ollydbg/

- TUTORIALS/BOOKS -

Paul Carter (Multi-platform)
http://www.drpaulcarter.com/pcasm/

Jonathan Bartlett (Linux)
http://savannah.nongnu.org/projects/pgubook

Randall Hyde (Multi-platform)
http://www.ArtofAsm.com

- FORUMS {to chat with peers, get help} -

USENET

alt.comp.lang.assembler

Evenbit 52 Junior Poster

hi,
I was wondering if any one knew where i could find the instructions for tasm 2.8.....i am trying to compare A TO FF(100H), if greater than FF go to loopA.........I would really appereciate, if any one knows the above instruction...please help me out. thanks

Download the 3 volumes of the Intel Architecture Software Developer's Manuals Intel Manuals (especially the Instruction Set Reference Vol.#2).

And try the TASM FAQ for TASM specific information.

Evenbit 52 Junior Poster

i m doing a program using masm 611 compiler recently but am doubt of how to use it.my program is a simple program called simple calculator,it contains functions of +,-,*,/, and modulus.user only need to input 2 numbers and the function that he/she would like to perform.but i dunno bout the full source code of it,so i need HELP.is any1 out there know bout the program source code?thanks!

You should probably ask this question at The MASM Forum because those folk are experts at MASM stuff. Come to think of it, I believe there is an example (very close to what you described) in one of the download packages there [might have to visit the main page to find it]. If not, take a browse through the source code available at Programmers Heaven Assembly Language section.

If you are having a particular problem with certain ASM instructions or syntax, feel free to post your source code and I am sure someone here will be glad to help.

Lots of luck with your coding...

Evenbit.

Evenbit 52 Junior Poster

thats nice to know. i know like the basics of programming( im talking baby steps). my uncle recommended i learn assembler first and then unix because i am chaning from ms windows to linux next year.

Cool! Sounds like you'd fit in nicely with our group Linux, X, ld, gcc, linking, shared libraries and stuff on alt.lang.asm that is learning how to code ASM on Linux using xWindows. You'll find NASM code posted in that thread. Apparently there is a myth going around that ASM coding for Linux (and other *nix) (also xWindows) is harder than for Windows -- but this simply isn't true. It is just that there isn't much in the way of documentation and little in the way of experts to learn from and answer your questions. But the programming itself is really not as complicated as for Windows.

Take a look and join in on the fun! :cheesy:

Evenbit.

Evenbit 52 Junior Poster

hi all. i am currently thinking for learning assembler and compiler language. i just wanted to know how long it will take to learn this language and how difficult is it?

There are several ASM tutorials [ x86 ASM Tutorial using A86 for DOS ] and books on the Web that can teach you ASM but it depends on how much effort you put into it that will determine how easy it will be and how long it will take. One of the most commonly referenced ASM learning books is Randall Hyde's "Art of Assembly" AoA website which is available in different formats and uses his HLA (High-Level Assembler) {also available for download at the above site} which is available for both Windows and Linux.

Evenbit.