Learning ASM

A place to discuss pretty much anything related to storage, computers, data recovery or technology.
Post Reply
User avatar
CrazyTeeka
Lurker
Posts: 155
Joined: Sat Jul 20, 2019 7:12 pm
Location: UK

Learning ASM

Post by CrazyTeeka »

I'm on a mission to learn ASM. It's going to be difficult at the beginning but in a few years I guess I can master it.
lcoughey
Site Admin
Posts: 997
Joined: Thu Jan 08, 2015 7:23 pm
Location: Ontario, Canada
Contact:

Re: Learning ASM

Post by lcoughey »

I haven't written Assembly code since the mid 90's. Can't say that I miss it, though it was the one course that landed me an A+ in computer science.
fzabkar
Lurker
Posts: 126
Joined: Sun Jun 30, 2019 2:12 am

Re: Learning ASM

Post by fzabkar »

I think that a knowledge of ASM would be useful in data recovery.

In my case, I learned Motorola 6800 assembler at university. For my second data recovery case in the 1980s, I wrote a tiny routine in Data General machine code to scan a Control Data HDD for directory sectors. These days some of my FreeBasic programs incorporate ASM routines to improve computation speed.

That said, I'm an ASM novice.

BTW, are you wanting to reverse engineer SpinRite? ;-)
User avatar
CrazyTeeka
Lurker
Posts: 155
Joined: Sat Jul 20, 2019 7:12 pm
Location: UK

Re: Learning ASM

Post by CrazyTeeka »

I want to write something better. :D
Starting from beginner level might take a while.

Can I learn ASM faster than Steve can finish SR v7?
Hopefully.
User avatar
CrazyTeeka
Lurker
Posts: 155
Joined: Sat Jul 20, 2019 7:12 pm
Location: UK

Re: Learning ASM

Post by CrazyTeeka »

Simple "Hello World!" program that works under FreeDOS...

Code: Select all

org 0x100	; Code starts at offset 100h
use16		; Use 16-bit code

mov ax,0900h	; DOS function: AX = 0900h (Show Message)
mov dx,hello	; DX = "Hello World!$"
int 21h		; Call a DOS function: AX = 0900h (Show Message)

mov ax,4c00h	; DOS function: AX = 4c00h (Exit)
int 21h		; Call a DOS function: AX = 4c00h (Exit)

hello db "Hello World!$"
Compiling Code...

Code: Select all

nasm hello.asm -o hello.com
Joep
Official Product Rep
Posts: 172
Joined: Tue Feb 07, 2017 2:18 pm
Location: Netherlands
Contact:

Re: Learning ASM

Post by Joep »

CrazyTeeka wrote: Wed Apr 17, 2024 6:55 pm I want to write something better. :D
Starting from beginner level might take a while.

Can I learn ASM faster than Steve can finish SR v7?
Hopefully.
I'd say you don't have to learn any assembly for that. In essence all he does is read data and then write it back. All the rest is mumbo.

"But Steve writes in assembly!" ..

Ask yourself how much sense there is in wring assembly code if 95% of the code inside even a low level data recovery tool has nothing to do with low level hardware access but mundane stuff like writing files, sorting stuff, comparing stuff, showing stuff on screen etc.., so things that can be done 10 times easier using a different language. If there's anything the last few year 6.1 update cycle has shown it is that writing in assembly is a mess.

Like Franc it has been ages for me that I wrote assembly, for me it was code I used with PowerBasic and it was purely for interacting with drives. It was probably no more than 2% of the total code. Why would I bother with writing a logfile using assembly if PowerBasic gives me a simple means to create files, write to them, etc..
http://www.disktuna.com - video & photo repair & recovery service
fzabkar
Lurker
Posts: 126
Joined: Sun Jun 30, 2019 2:12 am

Re: Learning ASM

Post by fzabkar »

I'm hardly the person to be giving programming advice, but here is a simple FreeBASIC program that incorporates an ASM subroutine that does all the computational work.

[url]httpx://web.archive. org/web/20230522152638/httpx://www.users.on. net/~fzabkar/FreeBasic_W32/Utils/dwordrev3.bas[/url]

Admin: Space added to link due to alarms it is setting off with website security scans.
User avatar
CrazyTeeka
Lurker
Posts: 155
Joined: Sat Jul 20, 2019 7:12 pm
Location: UK

Re: Learning ASM

Post by CrazyTeeka »

So far I'm finding it easy to write code in ASM for Linux, but a bit messy writing coding in ASM for DOS. :roll:
User avatar
CrazyTeeka
Lurker
Posts: 155
Joined: Sat Jul 20, 2019 7:12 pm
Location: UK

Re: Learning ASM

Post by CrazyTeeka »

MASM32 seems to provide some nice code samples to play with...

Code: Select all

.486
.model flat,stdcall
option casemap :none

include \masm32\include\windows.inc
include \masm32\macros\macros.asm

include \masm32\include\masm32.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc

includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

.code

start:
	print chr$("SpinRust v1.0",13,10)
	print chr$("SpinRust v2.0",13,10)
	print chr$("SpinRust v3.0",13,10)
	print chr$("SpinRust v4.0",13,10)
	print chr$("SpinRust v5.0",13,10)
	print chr$("SpinRust v6.0",13,10)
	print chr$("SpinRust v6.1",13,10)
	print chr$("SpinRust v7.0",13,10)
	exit
end start
Post Reply