English Persian
fld1 ; TOS = 1
fadd st0, st0 ; TOS = 2
fadd st0, st0 ; TOS = 4
fld1 ; TOS = 1
faddp st1, st0 ; TOS = 5
fchs ; TOS = -5
fld1 ; TOS = 1
fadd st0, st0 ; TOS = 2
fadd st0, st0 ; TOS = 4
fld1 ; TOS = 1
faddp st1, st0 ; TOS = 5
fchs ; TOS = -5
#!/bin/sh
#!/bin/sh
%define SYS_mmap 197
%define SYS_munmap 73
%define SYS_fstat 189
%define SYS_ftruncate 201
%define SYS_mmap 197
%define SYS_munmap 73
%define SYS_fstat 189
%define SYS_ftruncate 201
%define SYS_nosys 0
%define SYS_exit 1
%define SYS_fork 2
%define SYS_read 3
%define SYS_write 4
; [etc...]
%define SYS_nosys 0
%define SYS_exit 1
%define SYS_fork 2
%define SYS_read 3
%define SYS_write 4
; [etc...]
%define SYS_open 5
%define SYS_close 6
%define SYS_open 5
%define SYS_close 6
%define stdin 0
%define stdout 1
%define stderr 2
%define stdin 0
%define stdout 1
%define stderr 2
%ifdef LINUX
%define SYS_execve 11
%else
%define SYS_execve 59
%endif
%ifdef LINUX
%define SYS_execve 11
%else
%define SYS_execve 59
%endif
%macro system 1
mov eax, %1
call access.the.bsd.kernel
%endmacro
%macro system 1
mov eax, %1
call access.the.bsd.kernel
%endmacro
(*state)(inputchar);
(*state)(inputchar);
(output[state])(inputchar);
(output[state])(inputchar);
.loop:
call getchar
not al ; Create a negative
call putchar
jmp short .loop
.loop:
call getchar
not al ; Create a negative
call putchar
jmp short .loop
0 STD NOHIDE { int nosys(void); } syscall nosys_args int
1 STD NOHIDE { void exit(int rval); } exit rexit_args void
2 STD POSIX { int fork(void); }
3 STD POSIX { ssize_t read(int fd, void *buf, size_t nbyte); }
4 STD POSIX { ssize_t write(int fd, const void *buf, size_t nbyte); }
5 STD POSIX { int open(char *path, int flags, int mode); }
6 STD POSIX { int close(int fd); }
etc...
0 STD NOHIDE { int nosys(void); } syscall nosys_args int
1 STD NOHIDE { void exit(int rval); } exit rexit_args void
2 STD POSIX { int fork(void); }
3 STD POSIX { ssize_t read(int fd, void *buf, size_t nbyte); }
4 STD POSIX { ssize_t write(int fd, const void *buf, size_t nbyte); }
5 STD POSIX { int open(char *path, int flags, int mode); }
6 STD POSIX { int close(int fd); }
etc...
189 STD POSIX { int fstat(int fd, struct stat *sb); }
189 STD POSIX { int fstat(int fd, struct stat *sb); }
197 STD BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \
int flags, int fd, long pad, off_t pos); }
197 STD BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \
int flags, int fd, long pad, off_t pos); }
1: %include 'system.inc'
2:
3: section .data
4: hello db 'Hello, World!', 0Ah
5: hbytes equ $-hello
6:
7: section .text
8: global _start
9: _start:
10: push dword hbytes
11: push dword hello
12: push dword stdout
13: sys.write
14:
15: push dword 0
16: sys.exit
1: %include 'system.inc'
2:
3: section .data
4: hello db 'Hello, World!', 0Ah
5: hbytes equ $-hello
6:
7: section .text
8: global _start
9: _start:
10: push dword hbytes
11: push dword hello
12: push dword stdout
13: sys.write
14:
15: push dword 0
16: sys.exit
201 STD BSD { int ftruncate(int fd, int pad, off_t length); }
201 STD BSD { int ftruncate(int fd, int pad, off_t length); }
D = PC * sqrt(FL)
D = PC * sqrt(FL)
Syntax error: What
Syntax error: is
Syntax error: the
Syntax error: best
Syntax error: What
Syntax error: is
Syntax error: the
Syntax error: best
call ebx
call ebx
carriage return carriage return