Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added some more assembly languages and Squirrel #75

Merged
merged 1 commit into from

3 participants

@u8sand

btw, my computer deleted brainfk because of the '' in the name. Sorry about that..

@mdickie

I think in Git you can unstage commit files. Maybe you try again to commit and unstage changes on this file.

@leachim6 leachim6 merged commit 7988080 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 29, 2012
  1. Added some more ASM languages and Squirrel.

    Daniel Clarke authored
This page is out of date. Refresh to see the latest.
View
16 a/assembler_fasm_dos.asm
@@ -0,0 +1,16 @@
+format MZ
+
+entry .code: start
+
+segment .code
+start:
+ mov ax, .data ; put data segment into ax
+ mov ds, ax ; there, I setup the DS for you
+ mov dx, msg ; now I give you the offset in DX. DS:DX now completed.
+ mov ah, 9h
+ int 21h
+ mov ah, 4ch
+ int 21h
+
+segment .data
+ msg db 'Hello World', '$'
View
17 a/assembler_masm_dos.asm
@@ -0,0 +1,17 @@
+; 16 bit dos assembly
+.model small
+.stack
+.data
+ message db "Hello world!", "$"
+.code
+ main proc
+ mov ax,seg message
+ mov ds,ax
+ mov ah,09
+ lea dx,message
+ int 21h
+
+ mov ax,4c00h
+ int 21h
+ main endp
+end main
View
31 a/assembler_nasm_freebsd.asm
@@ -0,0 +1,31 @@
+section .text
+ global _start ;must be declared for linker (ld)
+
+_syscall:
+ int 0x80 ;system call
+ ret
+
+_start: ;tell linker entry point
+
+ push dword len ;message length
+ push dword msg ;message to write
+ push dword 1 ;file descriptor (stdout)
+ mov eax,0x4 ;system call number (sys_write)
+ call _syscall ;call kernel
+
+ ;the alternate way to call kernel:
+ ;push eax
+ ;call 7:0
+
+ add esp,12 ;clean stack (3 arguments * 4)
+
+ push dword 0 ;exit code
+ mov eax,0x1 ;system call number (sys_exit)
+ call _syscall ;call kernel
+
+ ;we do not return from sys_exit,
+ ;there's no need to clean stack
+section .data
+
+msg db "Hello, world!",0xa ;our string
+len equ $ - msg ;length of our string
View
18 a/assembler_nasm_linux.asm
@@ -0,0 +1,18 @@
+section .text
+ global _start ;must be declared for linker (ld)
+
+_start: ;tell linker entry point
+
+ mov edx,len ;message length
+ mov ecx,msg ;message to write
+ mov ebx,1 ;file descriptor (stdout)
+ mov eax,4 ;system call number (sys_write)
+ int 0x80 ;call kernel
+
+ mov eax,1 ;system call number (sys_exit)
+ int 0x80 ;call kernel
+
+section .data
+
+msg db 'Hello, world!',0xa ;our string
+len equ $ - msg ;length of our string
View
1  b/brainf*ck.bf
@@ -1 +0,0 @@
- ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
View
1  s/squirrel.nut
@@ -0,0 +1 @@
+print("Hello World!");
Something went wrong with that request. Please try again.