Noteworthy without this article is Lockless (http://locklessinc.com/) for the great super-technical write-ups that they do.
Inlining assembly language using the GNU toolset has always escaped me (until now). It’s not so much that I didn’t know how to do it, I just felt it much more comfortable to write my assembly in a separately linked object. This article has put my mind, stomach and C blending assembly fingers at ease.
So, I’m a tragic for assembly language. I’ve finally gotten around to sharpening up my skills to attack Linux with some assembly language and why not upgrade the skills into the 64bit world at the same time.
“Hello world” follows:
section.datahello:db'Hello world!',10; text plus a linefeed charhelloLen:equ$-hello; length of the stringsection.textglobal_start_start:movrax,4; system call for "write" (sys_write)movrbx,1; file descriptor (stdout = 1)movrcx,hello; offset to writemovrdx,helloLen; number of bytes to writeint0x80; syscallmovrax,1; system call for exit (sys_exit)movrbx,0; error code (no error = 0)int0x80; syscall
Here’s a bookmark set (3 links) that have all got me out of trouble from time to time. If times and spaces were a little different around home here, I’d probably have these printed out and pinned to the wall.
All of the items with an “n” in their execution can either be removed (to operate on the most recent item) or replaced with a number indicating the item in the stack the operation is to effect.
Action
Command
Viewing your command history
.L
Executing a command from the stack
.Xn
Delete an item from the stack
.Dn
Recall an older command to the head of the stack
.Rn
Change a string in a command on the stack
.Cn/oldstring/newstring
Change all occurences of a string in a command on the stack
.Cn/oldstring/newstring/G
Appending something to the end of a command on the stack
.An extra
Files
Creating a new file
CREATE.FILE filename filetype other
Filenames should be uppercase with words divided by periods (.)
File type
Type
Description
1 & 19
directory
2
static
Keys end with numbers.
3
static
Keys end mainly with numbers.
4
static
Keys end with letters.
5
static
Keys end with full range of ASCII characters.
6
static
Keys begin with numbers.
7
static
Keys begin mainly with numbers.
8
static
Keys begin with letters.
9
static
Keys begin with full range of ASCII characters.
10
static
Keys are numbers.
11
static
Keys are mainly numbers.
12
static
Keys are letters.
13
static
Keys are full range of ASCII characters.
14
static
Entire keys are numbers.
15
static
Entire keys are mainly numbers.
16
static
Entire keys are letters.
17
static
Entire keys are full range of ASCII characters.
18
static
Entire keys are of arbitrary form.
30
dynamic
other depends on the filetype being created Creating a new directory file
CREATE.FILE filename 1
CREATE.FILE filename 19
Creating a new static file
CREATE.FILE filename (2-18) modulo separation
modulo is the number of groups the file has.
separation is the number of 512 bytes disk frames are allocated to each group
Maintaining a file
RESIZE filename newtype newmodulo newseparation
Creating a dynamic file
CREATE.FILE filename 30
Copy a file
COPY FROM sourcefile TO destfile ALL OVERWRITING
Editing Records
Action
Command
Invoking the Editor
ED filename recordkey
Display a pageful of the record
P
Qutting a record
Q
Inserting lines
I
Moving between lines
n (move to line n)
+n (move forward n lines)
-n (move backward n lines)
t (move to top)
b (move to bottom)
Changing lines (/G for global)
C/oldstring/newstring/G
Undo
OOPS
Appending to a line
A extra-string
Breaking a line
B word-to-break-on
Concatenating lines
CAT
Deleting lines
D
Duplicating lines
DUP
Locating and finding
L something
F something
Setting editing blocks
< (sets the starting block)
> (sets the ending block)
Copy, move or drop blocks
COPY
MOVE
DROP
Saving your record
SAVE
Editor Macros
Creating a new ED macro
@FILE variable can be used to be the existing file being edited. @ID variable can be used to be the key of the current record being edited. Example usage of @FILE and @ID within a macro
> ED &ED& MACRONAME
----: I
0001= E
0002= SAVE
0003= XEQ BASIC @FILE @ID
0004= XEQ RUN @FILE @ID
0005=
The VOC File
Creating a verb (command word)
> ED VOC verbname
----: I
0001= V
0002= programname
0003= type
0004=
All verbs start with a V. The name of the program to execute is specified by the second line. The type of the program is specified on the third line. Possible options are:
Letter
Language
B
UniVerse Basic
C
C shell script
D
DOS batch file
E
External
I
Internal
P
Primitive
Q
Query command
S
Bourne sheel script
B
Operating system command
Creating a keyword (parameter or modified applied to verbs)
> ED VOC keywordname
----: I
0001= K
0002= value
0003= verbcommand (optional)
Keywords start with a K. Their second parameter is the value that gets substituted for the word. Creating a paragraph (script)
> ED VOC paragraphname
----: I
0001= PA
0002= script ....
0003= script ....
Paragraphs start with PA, then continue to define the script itself. For variables that are unknown at runtime the «…» syntax can be used to prompt the user inline for the value. Creating a sentence (a one line paragraph)
> ED VOC sentencename
----: I
0001= PA
0002= script ....
Creating a file pointer
> ED VOC filename
----: I
0001= F
0002= directoryname
0003= filename
Creating a qpointer
> ED VOC synonymname
----: I
0001= Q
0002= (space)
0003= filename
Creating a remote command
> ED VOC remotecommandname
----: I
0001= R
0002= filename that contains the command record
0003= key of the command record
Dictionaries
A description of common fields for a dictionary record
Field
Description
Conversion
Blank unless a conversion is required. e.g. D DMY[2,A3,4] would store 1 for 01 JAN 1968
Column Header
Title that appears at the head of the column
Format
The number of characters to display and alignment. 10R - 10 characters, right aligned.
10T - 10 characters, text aligned. 10L - 10 characters, left aligned.
Single or Multi
S for single value, M for multi-value
Creating a data field
> ED DICT filename fieldname
----: I
0001= D Description of the field
0002= field number
0003= conversion
0004= header
0005= format
0006= single or multi
Creating an imaginary field
> ED DICT filename fieldname
----: I
0001= I Description of the field
0002= formula
0003= conversion
0004= header
0005= format
0006= single or multi
Creating a phrase field
> ED DICT filename fieldname
----: I
0001= PH Description of the field
0002= fieldnames