Skip to content

Instantly share code, notes, and snippets.

all:
mkdir -p isofs
nasm -g -f bin -l boot.lst -o isofs/boot boot.asm
genisoimage -r -b boot -no-emul-boot -boot-load-size 4 -o boot.iso isofs
# cat ${ASM_FILENAME}.lst
clean:
rm -rf isofs boot boot.iso
rm *.o
all:
mkdir -p isofs
nasm -g -f bin -l ${ASM_FILENAME}.lst -o isofs/boot ${ASM_FILENAME}.asm
genisoimage -r -b boot -no-emul-boot -boot-load-size 4 -o boot.iso isofs
cat ${ASM_FILENAME}.lst
clean:
rm -rf isofs boot boot.iso
rm *.o
;;; Length of a null terminated string.
;;; Input:
;;; DS:ESI = first char of string.
;;; Modified: ECX
;;; Return:
;;; EAX = length of string.
cstrlen:
xor ecx, ecx
.strlen:
all:
nasm -f elf -g -l ${ASM_FILENAME}.lst ${ASM_FILENAME}.asm
ld -melf_i386 ${ASM_FILENAME}.o -o ${ASM_FILENAME}
cat ${ASM_FILENAME}.lst
./${ASM_FILENAME}
clean:
rm *.o
(setq slime-lisp-implementations
'((sbcl ("sbcl"))
(ccl64 ("/home/james/bin/ccl64" "-K" "utf-8"))
(clisp ("clisp" "-W"))))
(test (reg-reg :suite root)
"Should return values between #xC0 and #xFF only"
(loop repeat 10
do (let ((reg (nutils:random-elt
(remove :RESERVED
(remove :INVALID nass.x86oid.opcodes::+register-list+)))))
(is (<= #xC0 (nass.x86oid.opcodes::reg-reg reg reg) #xFF)
"~A ~X" reg (nass.x86oid.opcodes::reg-reg reg reg)))))
(test (encode-reg-bits :suite root)
(with-fbound (nass.x86oid.opcodes::encode-reg-bits)
(:ax) => 0
(:eax) => 0
(:al) => 0
(:r15d) => 7))
(test (integer->little-octets :suite root)
(is
(equals '(10) (nass.x86oid.opcodes::integer->little-octets 10))))
(is
(equals '(0 1) (nass.x86oid.opcodes::integer->little-octets 256))
"reverse of what is expected as this is for writing to disk.")
(is
(equals '(0 0) (nass.x86oid.opcodes::integer->little-octets 0 :size 2))
"reverse of what is expected as this is for writing to disk.")
(is (equals '(0 1 0 0) (nass.x86oid.opcodes::integer->little-octets 256 :size
(test (integer->little-octets :suite root)
(with-fbound (nass.x86oid.opcodes::integer->little-octets)
(10) => '(10)
"Reverse of what is expected as this is for writing to disk."
(256) => '(0 1)
(0 :size 2) => '(0 0)
(256 :size 4) => '(0 1 0 0)
(0 :size 0) :signals simple-type-error
"Vectorp is not yet implemented, so should error."
(0 :vectorp t) :signals error))
(hexize (asm (:x86oid)
(mov :ah #xe) (mov :si 14)
(lodsb) (or :al :al)
(jz 9) (int #x10)
(jmp 0)))
;;=> "F4 0E | FE 0E 00 | AC | 08 C0 | 74 09 | CD 10 | EB 00"