Compare commits

...

10 Commits

Author SHA1 Message Date
davtur19 947232d0bb Update README.md 2023-10-30 01:39:11 +01:00
davtur19 974a5a16f2 Update figa.asm 2023-10-30 01:38:23 +01:00
davtur19 896669d892 Upload files to "/" 2023-10-30 01:38:03 +01:00
davtur19 24061e3fdd Upload files to "/" 2023-10-30 01:37:34 +01:00
davtur19 fdf26032d2 Update README.md 2023-10-30 01:37:05 +01:00
davtur19 e7c373f3bd Update figa.asm 2023-10-30 01:35:59 +01:00
davtur19 02812ec152 Delete Makefile 2023-10-30 01:17:13 +01:00
davtur19 b5d41addf6 Delete PKGBUILD 2023-10-30 01:17:02 +01:00
davtur19 72d270409a Update README.md 2023-10-30 01:16:50 +01:00
davtur19 f1008e49ad Update figa.s 2023-10-30 01:12:20 +01:00
6 changed files with 67 additions and 100 deletions

View File

@ -1,23 +0,0 @@
PREFIX ?= /usr
FILE = figa
EXEC = figasm
all:
@as -o $(FILE).o $(FILE).s
@ld -o $(EXEC) $(FILE).o
clean:
@rm $(FILE).o
@rm $(EXEC)
install:
@mkdir -p $(DESTDIR)$(PREFIX)/bin
@cp -p $(EXEC) $(DESTDIR)$(PREFIX)/bin/figasm
uninstall:
@rm $(DESTDIR)$(PREFIX)/bin/figasm
debug:
@as -g -o $(FILE).o $(FILE).s
@ld -o $(EXEC) $(FILE).o

View File

@ -1,19 +0,0 @@
pkgname=figasm
pkgver=69.420
pkgrel=1
pkgdesc="figasm è una semplice port in Assembly del celebre figa"
arch=('x86_64')
url="https://git.ignuranza.net/chic_luke/figasm.git"
license=('SWAG')
makedepends=('git')
build() {
git clone "${url}"
}
package() {
cd "${pkgname}"
make
make DESTDIR="$pkgdir" install
}

View File

@ -1,36 +1,19 @@
# figASM
# figASM64
`figasm` è una semplice port in Assembly del celebre [figa](github.com/crisbal/kslf.git), celebre pacchetto per Arch Linux, una volta disponibile nella AUR ma bannato dal mantenitore @il\_muflone per comprensibili ragioni politically correct:
![](https://i.imgur.com/1TQXOgX.png)
Ad ogni modo, i piĂą grandi fan di `figa` si sono prontamente forkati il repo, pronti a ripubblicare `figa` sulla AUR, eccetto che il maestro @il\_muflone disse:
![](https://i.imgur.com/P8er7Uw.png)
![](https://i.imgur.com/GFcVpPD.png)
Ma noi non lo pensavamo. A ben vedere, neanche lui stesso lo pensava:
![](https://i.imgur.com/PgENsLm.png)
Questa volta, invece, il profeta @il\_muflone ci vide giusto. Perché la `figa` avrebbe fatto il suo ritorno di botto. Ma questa volta in pieno stile arch: nessun lentissimo script interpretato. Tutto Assembly. Nativo. Super ottimizzato per l'unica architettura supportata da Arch Linux, ossia x86\_64.
## Perché dovrei usare `figasm` anziché `figa`?
Perché la matematica non è un'opinione e i numeri parlano chiaro:
![](https://i.imgur.com/PX7C4pI.png)
La figa a 64bit è meglio
# Come faccio a compilare `figasm` da sorgente?
```bash
as -o figa.o figa.s
ld -o figa figa.o
nasm -f elf64 -o figa.o figa.asm
ld figa.o -o figa
```
O, piĂą semplicemente:
# Ma a me piace windows!!1
```bash
make
```cmd
nasm -f win64 -o figa.o figawin.asm
ld -o figa.exe figa.o -entry=Start --subsystem=console -lkernel32
```
Potrebbe essere necessario disattivare l'antivirus, a quanto pare a Windows Defender non piace la figa...

16
figa.asm Normal file
View File

@ -0,0 +1,16 @@
section .data
text1 db "Che schifo la figa.",10,"Meglio Linux",10
section .text
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, text1
mov rdx, 33
syscall
mov rax, 60
mov rdi, 0
syscall

31
figa.s
View File

@ -1,31 +0,0 @@
.section .data
schifo:
.ascii "Che schifo la figa.\n"
schifo_len:
.long . - schifo
meglio:
.ascii "Meglio Linux!\n"
meglio_len:
.long . - meglio
.section .text
.global _start
_start:
movl $4, %eax
movl $1, %ebx
leal schifo, %ecx
movl schifo_len, %edx
int $0x80
movl $4, %eax
movl $1, %ebx
leal meglio, %ecx
movl meglio_len, %edx
int $0x80
movl $1, %eax
xorl %ebx, %ebx
int $0x80

41
figawin.asm Normal file
View File

@ -0,0 +1,41 @@
; Console Message, 64 bit. V1.03
NULL EQU 0 ; Constants
STD_OUTPUT_HANDLE EQU -11
extern GetStdHandle ; Import external symbols
extern WriteFile ; Windows API functions, not decorated
extern ExitProcess
global Start ; Export symbols. The entry point
section .data ; Initialized data segment
Message db "Che schifo la figa.", 0Dh, 0Ah,"Meglio Windows", 0Dh, 0Ah
MessageLength EQU $-Message ; Address of this line ($) - address of Message
section .bss ; Uninitialized data segment
alignb 8
StandardHandle resq 1
Written resq 1
section .text ; Code segment
Start:
sub RSP, 8 ; Align the stack to a multiple of 16 bytes
sub RSP, 32 ; 32 bytes of shadow space
mov ECX, STD_OUTPUT_HANDLE
call GetStdHandle
mov qword [REL StandardHandle], RAX
add RSP, 32 ; Remove the 32 bytes
sub RSP, 32 + 8 + 8 ; Shadow space + 5th parameter + align stack
; to a multiple of 16 bytes
mov RCX, qword [REL StandardHandle] ; 1st parameter
lea RDX, [REL Message] ; 2nd parameter
mov R8, MessageLength ; 3rd parameter
lea R9, [REL Written] ; 4th parameter
mov qword [RSP + 4 * 8], NULL ; 5th parameter
call WriteFile ; Output can be redirect to a file using >
add RSP, 48 ; Remove the 48 bytes
xor ECX, ECX
call ExitProcess