NASM on 2k

Discussion in 'Software' started by Vlad902, Sep 3, 2003.

  1. Vlad902

    Vlad902 Guest

    Alright, I've been trying to learn a little ASM on the sly (*snort*)... I felt like trying to do some stuff on my parents 2k box (Too little *NIX specific info, it's there, but there's more for Windows, so I'll just learn it here at first...), so I got the obligatory printing lines (Hello world! :D)... And this was what the code looked like:

    Code:
        org 100h
        mov dx,msg
        mov ah,9
        int 21h
        mov ah,4Ch
        int 21h
        msg db 'Hello, World!',0Dh,0Ah,'$' 
    So it compiles and everything works... Then I think God damn 0Dh,0Ah (\r\n) is ugly... Let's do this:

    Code:
        org 100h
        mov dx,msg
        mov ah,9
        int 21h
        mov ah,4Ch
        int 21h
        msg db 'Hello, World!',0Dh,0Ah,'$'
        break db 0Dh,0Ah 
    So that compiles... Then I try putting break instead of 0Dh,0Ah (I was making sure I didn't do something wrong with declaring the db :)) and I get...

    Weird... I tried putting break db infront of msg db, nothing... I tried doing:

    Code:
       msg db 'Hello, World!',[break],'$' 
    Now I get this:

    Anyone got any ideas? ASM is woowoo :)
     
  2. Vlad902

    Vlad902 Guest

    The hell.... This compiles:

    Code:
       org 100h
       mov dh,msg
       mov dl,break
       mov ah,9
       int 21h
       mov ah,4Ch
       int 21h
       break db 0Dh,0Ah,'$'
       msg db 'Hello, World!'
    But I get this:

    Weird...
     
  3. goldfish

    goldfish Lt. Sushi.DC

    oh my god, you brainwashed your computer and its talking giberish... eak! :D
     
  4. Vlad902

    Vlad902 Guest

    I'm guessing ax register is just full of other stuff...Another problem I'm having (One thread would be better since I'm getting trouble getting replies already :)) is the following:

    Code:
        org 100h
       mov ah,01h
       int 21h
       mov ah,al
       mov al,DOLLAR
       xchg dx,ax   ;saves me a byte
       mov  ah,09h
       int 21h
       mov ah,4Ch
       int 21h
    
       DOLLAR db 'aaaa','$'
    Echoes input to output (01h) but for some reason it prints alot of crap and doesn't have aaaa in there anywhere....

    Is ah/al/ax just full of crap? Or is there a better way to move al to dx then al to ah, '$' to al, and ax to dx?
     
  5. Vlad902

    Vlad902 Guest

    Alright, after looking at some ASM example code (Which I didn't understand at all :)) I tried xchg bx,ax xchg cx,bx etc. until I got cx into dx and it appeared to work, when I try to recreate it doesn't work anymore... It only worked partially on a side note, it echoed input to screen, printed crap, then printed aaaa and ended... I'l try to recreate it...

    EDIT: And oh, you can do xchg ah,al and save yourself a byte.
     
  6. Vlad902

    Vlad902 Guest


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds