Commit 3c0f89af authored by Dmitry Bogatov's avatar Dmitry Bogatov

Import Upstream version 2.61

parent 4aab39ab
......@@ -3,7 +3,7 @@ for any purpose without royalty or fees in accordance with the terms of the
Copyright (c) 2000,01,02 Albrecht Kleine
Copyright (c) 2000-2004 Albrecht Kleine
All rights reserved.
You may distribute under the terms of the GNU General Public License.
Mon Jan 3 18:00:48 2005 Albrecht Kleine <>
-e3.asm, e3.h: continued 64 bit version, i. e.
fixed bugs in commandline reading and numerics
-e3.asm:added push ecx / pop ecx pair to save register ECX
during the Wait4 system call:
Linux kernel 2.6.8 seems to need that (unlike 2.6.5)
This crashed sed filtering, e.g. by ^KP in WS mode.
***** released as v2.6.1 *****
Mon Dec 27 11:43:41 2004 Albrecht Kleine <>
-e3.asm, e3.h, Makefile: prepared e3.asm for generating
64 bit files by using the YASM 0.4 assembler for the
AMD-64 CPU (Linux only.)
-The AMD-64 code is built from e3.asm by running
sed converter script "e3_yasm_yasm64.sed"
This script is now part of e3 distribution archive.
*** Use it by entering "make yasm64" ***
Sun Oct 03 17:00:00 2004 Albrecht Kleine <>
- e3.asm, Makefile: prepared e3.asm for YASM assembler.
Due ugly problems in jecxz op by "near jmp" vs "short jmp"
we need a sed converter script: so added file
"e3_nasm_yasm.sed" to distribution
*** Use it by entering "make yasm" ***
Sun Jun 27 21:34:00 2004 Albrecht Kleine <>
e3.asm: clean up for next release
***** released as v2.6.0 *****
Sun Jun 18 19:45:00 2004 Albrecht Kleine <>
e3.asm: trial for runtime detection of UTF-8 console
(switch via %ifdef UTF8RTS) ** not yet continued **
Fri Jun 18 21:14:55 2004 Albrecht Kleine <>
e3.asm: optimizing previous builds
Thu Jun 3 20:50:17 2004 Albrecht Kleine <>
e3.asm,e3.h: special cursor control, switch it via
%define NEW_CURSOR_MGNT in e3.h
see also:
Thu Jun 3 20:50:17 2004 Albrecht Kleine <>
-e3.asm: added initial UNICODE UTF-8
stuff via checking the bits 7 and 8
Mon Apr 12 09:44:27 2004 Albrecht Kleine <>
-e3.asm: for easier line input just added some
readline edit functions in InputString:
home / end / insert / delete / go_left / go_right
-Makefile: removed default usage of "gzexe":
seems to be broken
***** released as v2.5 *****
Sun Apr 4 21:29:07 2004 Albrecht Kleine <>
-e3.h,e3.asm: make e3/OpenBSD work again by adding
some ELF file specials needed for OpenBSD version 4.3.
Many thanks to Benjamin Pineau!
Fri Nov 14 00:00:00 2003 Albrecht Kleine <>
-e3.asm: a patch for Scott Swanson's vt420
use via %ifdef VT420SPECIAL
Fri Aug 09 00:00:00 2003 Albrecht Kleine <>
-e3.asm: check file name linkage also in dynamic linked
file versions
Mon Apr 21 18:22:36 2003 Albrecht Kleine <>
-e3.asm: bugfix (a certain combination of
sed-piping followed by UNDO operation could cause a
crash with core dump)
Many thanks for bug report to:
basti at
***** released as v2.43 *****
Mon Mar 24 17:17:17 2003 Albrecht Kleine <>
- e3-16.asm: fixed bug in IsShowBlock
replaced "cmp dword ...." with "cmp word ....."
This makes e3-16 running on elks at old 8086 PC.
- e3-16.asm: LESSWRITEOPS are now switched on by default.
- e3.asm: added fchmod call to prevent file
permissions modified by umask
(was bug report on freshmeat site)
***** released as v2.42 *****
Sat Mar 1 10:00:00 2003 Albrecht Kleine <>
- e3.asm: fixed heavy bug in FreeBSD version of e3,
(core dump with newer FreeBSD kernels due ugly
workaround in e3 / now replaced by a real solution
for sed child program piping, see also: )
Thanks to joseph at randomnetworks dot com for
his patience and assistance.
***** released as v2.41 *****
Tue Oct 8 20:55:00 2002 Albrecht Kleine <>
- e3.asm: fixed bug in Pico mode
(repeated search&replace could hang e3:
Thanks for bug report to Roy Sutton!)
- added NO_AUTO_INDENT assemble time option
***** released as v2.4 *****
Sat Oct 5 18:13:13 2002 Albrecht Kleine <>
- NEW: added e3.s to the e3 distribution
(NATIVE StrongARM assembler code for gnu assembler)
Also included helper macros and emulayer.s.
Also adjusted Makefile.
- e3-16.asm: added a %define for bypassing BIOS int 10h,
function 1302h. Very slow, but running on some
very old 1980's PC.
Sat Sep 14 15:44:02 2002 Albrecht Kleine <>
e3.asm/e3.h: initial assembler version for
the ARM CPU produced (for gnu-as,gnu-ld)
and running on the Zaurus PDA
(control by %define ARMCPU)
Wed Jul 31 00.00.00 2002 Albrecht Kleine <>
e3-16.asm: changed some opcodes to pure 16 bit
e.g. replaced pusha with a sequence of
push ax,push bx,.... etc for running on 8088 CPU.
Sun May 19 17:30:59 2002 Albrecht Kleine <>
e3.asm: bug fixed: search in Pico mode could
cause inf-loop if string was not found
MANY thanks to Robin Green!
***** released as v2.33 *****
Thu May 2 09:01:11 2002 Albrecht Kleine <>
-e3c.c, e3c/Makefile : patch for running on PDAs
running Linux on the StrongARM CPU
***** ARM binary released as v2.32 *****
Sat Apr 20 21:44:31 2002 Albrecht Kleine <>
-e3.asm: some adjustments to assemble again in Win9x
-e3-16.asm: added ^QI key (go line#)
to the ELKS and DOS versions
-Makefile, e3.asm, e3.h changed variable errno to ErrNo
for better linking to libc, if desired.
Now this is also in FreeBSD possible,
see build #169 for make details.
***** released as v2.31 *****
Tue Apr 16 20:31:28 2002 Albrecht Kleine <>
-e3.asm refined cursor position after vi's p and P cmds
-e3.asm vi mode: now also cmd x and X pasteable
-e3.asm bugfix in WS ^QY (introduced in #175
due vi command D changing)
-e3-16.asm: removed most of useless screen redrawing
for the ELKS version
Sat Apr 13 20:57:41 2002 Albrecht Kleine <>
-e3-16.asm bugfix (^KR did not work in ELKS)
added special handling code of lseek
offset (32 bit arg #2) via I/O-pointer
-e3-16.asm bugfix (^KV did not work in ELKS and DOS)
(Tnx for report to Tim Pearce)
-e3.asm [libc versions] fixed bug in error handling:
now using extern [_errno]
-e3.asm added UNDO information collector for Emacs ^T
Wed Apr 10 18:11:42 2002 Albrecht Kleine <>
-e3.asm added command dw (delete word) in vi mode
(by Matthias's suggestion)
-e3.asm after pasting now changing cursor position
by using [EmaKiSize] (old was call CountToLineEnd)
-e3.asm vi command mode
added cursor left motion after D command
-e3.asm bugfix: vi command r was not undoable
(Tnx for report to Tim Pearce)
Sun Apr 7 19:30:36 2002 Albrecht Kleine <>
e3-16: added color support for e3-16/ELKS (*) ,
......@@ -3,12 +3,13 @@
#OS=W32 ** please use a separate make.bat for W9x **
# Set this to gzexe or upx if you want compression
# COMPRESS=gzexe
# 2. edit dest dir prefix if you want....
......@@ -79,20 +80,24 @@ endif
# next three are for testing purpose: linking w libc
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -DLINUX -DLIBC -D$(EXMODE)
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -D$(OS) -DLIBC -D$(EXMODE)
ld -s -static -o e3statc e3.o -lc
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -DLINUX -DLIBC -DDYN -D$(EXMODE)
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -D$(OS) -DLIBC -DDYN -D$(EXMODE)
gcc e3.o -o e3dync
# strip e3dync
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -DLINUX -DLIBC -DDYN -D$(EXMODE)
ifeq ($(OS),LINUX)
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -D$(OS) -DLIBC -DDYN -D$(EXMODE)
ld -s -m elf_i386 -o e3dync2 e3.o \
-lc -dynamic-linker /lib/ \
/usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtn.o
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -D$(OS) -DLIBC -DDYN -D$(EXMODE)
ld -m elf_i386 -o e3dync2 e3.o -lc -e _start /usr/lib/crt1.o
# next for running in gnu debugger
debug: $(ASOURCES) Makefile
......@@ -105,6 +110,34 @@ debug: $(ASOURCES) Makefile
ln -sf e3 e3vi
ln -sf e3 e3ne
# L I N U X only
# Experimental stuff for using YASM assembler
# needs some sed changes (jmp vs jmp near) due heavy bugs in YASM optimizer
# (how to switch off that optimizer ?)
yasm: $(ASOURCES) Makefile
cat e3.asm | sed -f e3_nasm_yasm.sed \
| yasm -f elf -p nasm $(AFLAGS) -l e3.lstyasm -o e3.o -DLINUX -DSED -DYASM
ld -s -o e3 e3.o
ln -sf e3 e3ws
ln -sf e3 e3em
ln -sf e3 e3pi
ln -sf e3 e3vi
ln -sf e3 e3ne
# L I N U X / AMD-64 only
# ditto YASM stuff
yasm64: $(ASOURCES) Makefile
cat e3.asm | sed -f e3_nasm_yasm.sed \
| sed -f e3_yasm_yasm64.sed \
| yasm -m amd64 -f elf -p nasm $(AFLAGS) -l e3.lstyasm64 -o e3.o -DLINUX -DSED -DYASM -DAMD64
ld -s -o e3 e3.o
ln -sf e3 e3ws
ln -sf e3 e3em
ln -sf e3 e3pi
ln -sf e3 e3vi
ln -sf e3 e3ne
# selftest, linux only, assembled with a special option for using an input pipe
ifeq ($(OS),LINUX)
......@@ -164,6 +197,12 @@ else
install -m 644 $(MANDIR)/e3.$(MANSEC)
armlinux: e3
@cd armlinux && make all
rm -f e3*.o e3*.lst e3 e3em e3pi e3vi e3ws e3ne *~ \
PIPE_IN e3test~ e3test e3dync e3dync2 e3statc
PIPE_IN e3test~ e3test e3dync e3dync2 e3statc \
armlinux/*.o armlinux/e3arm
This diff is collapsed.
Some notes on UTF-8 for the Linux/ASM-version:
By default now e3 does does support UTF-8 coding of unicode
characters like this: α (should be a greek alpha).
You could disable UTF-8 support in e3 by editing e3.h at line 16:
%define UTF8 ;for UTF8 console or xterm e.g. @ Suse 9.1
;;; %define UTF8 ;for UTF8 console or xterm e.g. @ Suse 9.1
and run 'make' again.
Running e3_with_disabled_UTF-support at a UTF-8 console
you will see two points .. for UTF-8 characters e.g. the greek alpha.
If you terminal does _not_ support UTF-8 it is strongly
recommended to _disable_ UTF8-support in e3.h,
because output of some characters could be scrambled.
e3 will _not_ convert your files from/to UTF-8 coding.
It does simply _use_ your terminal encodings.
UTF-8 characters like © (c) will look very false on non-UTF-8 terminals,
but e3 can't help here. (So at first use a file converter.)
If you simply call e3 without file argument the initial screen of e3
will tell you whether UTF8-support is built in:
MicroEditor e3 v2.6.0-UTF8 GPL © 2000-04
MicroEditor e3 v2.6.0 GPL (C) 2000-04
BTW a runtime detection of UTF-8 console is planned, but not yet ready to use.
all: ../e3.asm e3.s
# $(AS) --defsym LINUX=1 --defsym ARMCPU=1 -a=e3arm.lst -gstabs e3.s -o e3.o
# $(AS) --defsym LINUX=1 --defsym ARMCPU=1 -a=emulayer.lst -gstabs emulayer.s -o emulayer.o
$(AS) --defsym LINUX=1 --defsym ARMCPU=1 e3.s -o e3.o
$(AS) --defsym LINUX=1 --defsym ARMCPU=1 emulayer.s -o emulayer.o
$(LD) e3.o emulayer.o -o e3arm
$(STRIP) e3arm
This diff is collapsed.
@ Copyright (C) 2002 Albrecht Kleine <>
@ This program is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 2 of the License, or
@ (at your option) any later version.
@ This program is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ GNU General Public License for more details.
@ You should have received a copy of the GNU General Public License
@ along with this program; if not, write to the Free Software
@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
.global _INT
_INT: adr r12,.table
cmp r0,#((.endtable-.table)/8)
movhi pc,r14
add r12,r12,r0, lsl #3
mov r0,r1
mov r1,r2
mov r2,r3
mov r3,r4
mov r4,r5
mov r5,r6
mov pc,r12 @ jump
.table: swi 0x900000;mov pc,r14
swi 0x900001;mov pc,r14
swi 0x900002;mov pc,r14
swi 0x900003;mov pc,r14
swi 0x900004;mov pc,r14
swi 0x900005;mov pc,r14
swi 0x900006;mov pc,r14
swi 0x900007;mov pc,r14
swi 0x900008;mov pc,r14
swi 0x900009;mov pc,r14
swi 0x90000a;mov pc,r14
swi 0x90000b;mov pc,r14
swi 0x90000c;mov pc,r14
swi 0x90000d;mov pc,r14
swi 0x90000e;mov pc,r14
swi 0x90000f;mov pc,r14
swi 0x900010;mov pc,r14
swi 0x900011;mov pc,r14
swi 0x900012;mov pc,r14
swi 0x900013;mov pc,r14
swi 0x900014;mov pc,r14
swi 0x900015;mov pc,r14
swi 0x900016;mov pc,r14
swi 0x900017;mov pc,r14
swi 0x900018;mov pc,r14
swi 0x900019;mov pc,r14
swi 0x90001a;mov pc,r14
swi 0x90001b;mov pc,r14
swi 0x90001c;mov pc,r14
swi 0x90001d;mov pc,r14
swi 0x90001e;mov pc,r14
swi 0x90001f;mov pc,r14
swi 0x900020;mov pc,r14
swi 0x900021;mov pc,r14
swi 0x900022;mov pc,r14
swi 0x900023;mov pc,r14
swi 0x900024;mov pc,r14
swi 0x900025;mov pc,r14
swi 0x900026;mov pc,r14
swi 0x900027;mov pc,r14
swi 0x900028;mov pc,r14
swi 0x900029;mov pc,r14
swi 0x90002a;mov pc,r14
swi 0x90002b;mov pc,r14
swi 0x90002c;mov pc,r14
swi 0x90002d;mov pc,r14
swi 0x90002e;mov pc,r14
swi 0x90002f;mov pc,r14
swi 0x900030;mov pc,r14
swi 0x900031;mov pc,r14
swi 0x900032;mov pc,r14
swi 0x900033;mov pc,r14
swi 0x900034;mov pc,r14
swi 0x900035;mov pc,r14
swi 0x900036;mov pc,r14
swi 0x900037;mov pc,r14
swi 0x900038;mov pc,r14
swi 0x900039;mov pc,r14
swi 0x90003a;mov pc,r14
swi 0x90003b;mov pc,r14
swi 0x90003c;mov pc,r14
swi 0x90003d;mov pc,r14
swi 0x90003e;mov pc,r14
swi 0x90003f;mov pc,r14
swi 0x900040;mov pc,r14
swi 0x900041;mov pc,r14
swi 0x900042;mov pc,r14
swi 0x900043;mov pc,r14
swi 0x900044;mov pc,r14
swi 0x900045;mov pc,r14
swi 0x900046;mov pc,r14
swi 0x900047;mov pc,r14
swi 0x900048;mov pc,r14
swi 0x900049;mov pc,r14
swi 0x90004a;mov pc,r14
swi 0x90004b;mov pc,r14
swi 0x90004c;mov pc,r14
swi 0x90004d;mov pc,r14
swi 0x90004e;mov pc,r14
swi 0x90004f;mov pc,r14
swi 0x900050;mov pc,r14
swi 0x900051;mov pc,r14
swi 0x900052;mov pc,r14
swi 0x900053;mov pc,r14
swi 0x900054;mov pc,r14
swi 0x900055;mov pc,r14
swi 0x900056;mov pc,r14
swi 0x900057;mov pc,r14
swi 0x900058;mov pc,r14
swi 0x900059;mov pc,r14
swi 0x90005a;mov pc,r14
swi 0x90005b;mov pc,r14
swi 0x90005c;mov pc,r14
swi 0x90005d;mov pc,r14
swi 0x90005e;mov pc,r14
swi 0x90005f;mov pc,r14
swi 0x900060;mov pc,r14
swi 0x900061;mov pc,r14
swi 0x900062;mov pc,r14
swi 0x900063;mov pc,r14
swi 0x900064;mov pc,r14
swi 0x900065;mov pc,r14
swi 0x900066;mov pc,r14
swi 0x900067;mov pc,r14
swi 0x900068;mov pc,r14
swi 0x900069;mov pc,r14
swi 0x90006a;mov pc,r14
swi 0x90006b;mov pc,r14
swi 0x90006c;mov pc,r14
swi 0x90006d;mov pc,r14
swi 0x90006e;mov pc,r14
swi 0x90006f;mov pc,r14
swi 0x900070;mov pc,r14
swi 0x900071;mov pc,r14
swi 0x900072;mov pc,r14
swi 0x900073;mov pc,r14
swi 0x900074;mov pc,r14
swi 0x900075;mov pc,r14
swi 0x900076;mov pc,r14
swi 0x900077;mov pc,r14
swi 0x900078;mov pc,r14
swi 0x900079;mov pc,r14
swi 0x90007a;mov pc,r14
swi 0x90007b;mov pc,r14
swi 0x90007c;mov pc,r14
swi 0x90007d;mov pc,r14
swi 0x90007e;mov pc,r14
swi 0x90007f;mov pc,r14
swi 0x900080;mov pc,r14
swi 0x900081;mov pc,r14
swi 0x900082;mov pc,r14
swi 0x900083;mov pc,r14
swi 0x900084;mov pc,r14
swi 0x900085;mov pc,r14
swi 0x900086;mov pc,r14
swi 0x900087;mov pc,r14
swi 0x900088;mov pc,r14
swi 0x900089;mov pc,r14
swi 0x90008a;mov pc,r14
swi 0x90008b;mov pc,r14
swi 0x90008c;mov pc,r14
swi 0x90008d;mov pc,r14
swi 0x90008e;mov pc,r14
swi 0x90008f;mov pc,r14
swi 0x900090;mov pc,r14
swi 0x900091;mov pc,r14
swi 0x900092;mov pc,r14
swi 0x900093;mov pc,r14
swi 0x900094;mov pc,r14
swi 0x900095;mov pc,r14
swi 0x900096;mov pc,r14
swi 0x900097;mov pc,r14
swi 0x900098;mov pc,r14
swi 0x900099;mov pc,r14
swi 0x90009a;mov pc,r14
swi 0x90009b;mov pc,r14
swi 0x90009c;mov pc,r14
swi 0x90009d;mov pc,r14
swi 0x90009e;mov pc,r14
swi 0x90009f;mov pc,r14
swi 0x9000a0;mov pc,r14
swi 0x9000a1;mov pc,r14
swi 0x9000a2;mov pc,r14
swi 0x9000a3;mov pc,r14
swi 0x9000a4;mov pc,r14
swi 0x9000a5;mov pc,r14
swi 0x9000a6;mov pc,r14
swi 0x9000a7;mov pc,r14
swi 0x9000a8;mov pc,r14
swi 0x9000a9;mov pc,r14
swi 0x9000aa;mov pc,r14
swi 0x9000ab;mov pc,r14
swi 0x9000ac;mov pc,r14
swi 0x9000ad;mov pc,r14
swi 0x9000ae;mov pc,r14
swi 0x9000af;mov pc,r14
swi 0x9000b0;mov pc,r14
swi 0x9000b1;mov pc,r14
swi 0x9000b2;mov pc,r14
swi 0x9000b3;mov pc,r14
swi 0x9000b4;mov pc,r14
swi 0x9000b5;mov pc,r14
swi 0x9000b6;mov pc,r14
swi 0x9000b7;mov pc,r14
swi 0x9000b8;mov pc,r14
swi 0x9000b9;mov pc,r14
swi 0x9000ba;mov pc,r14
swi 0x9000bb;mov pc,r14
swi 0x9000bc;mov pc,r14
swi 0x9000bd;mov pc,r14
swi 0x9000be;mov pc,r14
swi 0x9000bf;mov pc,r14
swi 0x9000c0;mov pc,r14
swi 0x9000c1;mov pc,r14
swi 0x9000c2;mov pc,r14
swi 0x9000c3;mov pc,r14
swi 0x9000c4;mov pc,r14
swi 0x9000c5;mov pc,r14
swi 0x9000c6;mov pc,r14
swi 0x9000c7;mov pc,r14
swi 0x9000c8;mov pc,r14
swi 0x9000c9;mov pc,r14
swi 0x9000ca;mov pc,r14
swi 0x9000cb;mov pc,r14
swi 0x9000cc;mov pc,r14
swi 0x9000cd;mov pc,r14
swi 0x9000ce;mov pc,r14
swi 0x9000cf;mov pc,r14
swi 0x9000d0;mov pc,r14
swi 0x9000d1;mov pc,r14
swi 0x9000d2;mov pc,r14
swi 0x9000d3;mov pc,r14
swi 0x9000d4;mov pc,r14
swi 0x9000d5;mov pc,r14
swi 0x9000d6;mov pc,r14
swi 0x9000d7;mov pc,r14
swi 0x9000d8;mov pc,r14
swi 0x9000d9;mov pc,r14
swi 0x9000da;mov pc,r14
swi 0x9000db;mov pc,r14
swi 0x9000dc;mov pc,r14
swi 0x9000dd;mov pc,r14
swi 0x9000de;mov pc,r14
swi 0x9000df;mov pc,r14
swi 0x9000e0;mov pc,r14
swi 0x9000e1;mov pc,r14
swi 0x9000e2;mov pc,r14
swi 0x9000e3;mov pc,r14
swi 0x9000e4;mov pc,r14
swi 0x9000e5;mov pc,r14
swi 0x9000e6;mov pc,r14
swi 0x9000e7;mov pc,r14
swi 0x9000e8;mov pc,r14
swi 0x9000e9;mov pc,r14
swi 0x9000ea;mov pc,r14
swi 0x9000eb;mov pc,r14
swi 0x9000ec;mov pc,r14
swi 0x9000ed;mov pc,r14
swi 0x9000ee;mov pc,r14
swi 0x9000ef;mov pc,r14
swi 0x9000f0;mov pc,r14
swi 0x9000f1;mov pc,r14
swi 0x9000f2;mov pc,r14
swi 0x9000f3;mov pc,r14
swi 0x9000f4;mov pc,r14
swi 0x9000f5;mov pc,r14
swi 0x9000f6;mov pc,r14
swi 0x9000f7;mov pc,r14
swi 0x9000f8;mov pc,r14
swi 0x9000f9;mov pc,r14
swi 0x9000fa;mov pc,r14
swi 0x9000fb;mov pc,r14
swi 0x9000fc;mov pc,r14
swi 0x9000fd;mov pc,r14
swi 0x9000fe;mov pc,r14
swi 0x9000ff;mov pc,r14
.global _DIV
@ this code is not GPL, but free
@ expects divisor in r10 and divident in r9
@ returns quotient in r12 and remainder in r9
@ uses r11
_DIV: MOV r11,#1
.div1: CMP r10,#0x80000000 @ shift divisor left until top bit set
CMPCC r10,r9 @ ...or divisor>divident
MOVCC r10,r10,ASL#1 @ shift divisor left if required
MOVCC r11,r11,ASL#1 @ shift r11 left if required
BCC .div1 @ repeat whilst more shifting required
MOV r12,#0 @ ip used to store result
.div2: CMP r9,r10 @ test for possible subtraction
SUBCS r9,r9,r10 @ subtract if divident>divisor
ADDCS r12,r12,r11 @ put relivant bit into result
MOVS r11,r11,LSR#1 @ shift control bit
MOVNE r10,r10,LSR#1 @ halve unless finished
BNE .div2 @ loop if there is more to do
@ remainder r9
@ result in r12
mov pc,r14
@ Copyright (C) 2002 Albrecht Kleine <>
@ This program is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 2 of the License, or
@ (at your option) any later version.
@ This program is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ GNU General Public License for more details.
@ You should have received a copy of the GNU General Public License
@ along with this program; if not, write to the Free Software
@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
.equ ARMCPU, 1
.macro A_DR,reg,val
adr \reg, 0f
ldr \reg,[\reg]
b 1f
0: .word \val
.macro CALL,address
stmfd r13!,{r14}
bl \address
ldmfd r13!,{r14}
.macro RET
mov pc,r14
NEW in 2.4:
Here is an e3 binary running on the Z and other ARM Linux computers.
The binary is built from native assembler code
in e3.s using gnu-as. The assembler code is