Created
June 11, 2010 08:44
-
-
Save mattn/434256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ; hello world on win32 writen in asm. | |
// ; compile: 8a helloworld.s | |
// ; link : 8l -o helloworld.exe helloworld.8 | |
// ; run : helloworld.exe | |
// ; | |
// ; if you get the following compile error, | |
// ; maybe, namespace separator was broken by copy-and-paste. | |
// ; open this file with text editor as utf-8 encoding, and fix following... | |
// ; | |
// ; main!main | |
// ; main!init | |
// ; runtime!printstring | |
// ; | |
// ; ! should be code point 183 in unicode. | |
// ; main.main | |
TEXT main·main+0(SB),$16-0 | |
LEAL gstring+0(SB),SI | |
LEAL (SP),DI | |
CLD , | |
MOVSL , | |
MOVSL , | |
CALL ,runtime·printstring+0(SB) | |
RET | |
// ; main.init | |
TEXT main·init+0(SB),$4-0 | |
RET | |
// ; data for native | |
GLOBL string+0(SB),$14 | |
DATA string+0(SB)/8,$"hello, w" | |
DATA string+8(SB)/7,$"orld!\n\z" | |
// ; data for gostring | |
GLOBL gstring+0(SB),$8 | |
DATA gstring+0(SB)/4,$string+0(SB) | |
DATA gstring+4(SB)/4,$13 | |
END , |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment