Skip to content

Instantly share code, notes, and snippets.

View pinglunliao's full-sized avatar

pinglunliao pinglunliao

View GitHub Profile
//----------------------------------------------------------------
// first.s: Output "Welcome to Assembly World."
//
// compile using: $ as first.s -o first.o
// link using: $ ld first.o -o first
// execute using: $ ./first
//
//----------------------------------------------------------------
.section .data
//----------------------------------------------------------------
// Holan.s: print the 'Holan' in ascii code
//
// compile using: $ as Holan.s -o Holan.o
// link using: $ ld Holan.o -o Holan
// execute using: $ ./Holan
//
//----------------------------------------------------------------
.text # this section is program
.global _start # entry point
//----------------------------------------------------------------
// sum.s:
//
// compile using: $ as sum.s -o sum.o
// link using: $ ld sum.o -o sum
// execute using: $ ./sum
//
//----------------------------------------------------------------
.text # this section is program
.global _start # entry point
public class Expressive {
public static void main(String args[]) {
Expressive puzzler = new Expressive();
puzzler.Oddity();
puzzler.Chage();
puzzler.LongDivision();
puzzler.Elementary();
puzzler.JoyOfHex();
.text
.globl start
.code16
start:
movb $0xE, %ah # write character in text mode for int 10h
movb $'H', %al # write 'H', 'o', 'l', 'a', 'n', ' ', 'w', 'o', 'r', 'l', 'd'
int $0x10
movb $'o', %al
int $0x10
AS = as
LD = ld
OBJCOPY = objcopy
.s.o:
$(AS) -a $< -o $*.o > $*.map
all: disk.img
disk.img: holanBoot.out
qemu-system-i386 -hda disk.img
#include <stdio.h>
int power(int x); // 這叫函式原型,是用來騙編譯器的
int main(void) {
int result = power(3);
printf("printf本身就是函數囉!\n");
printf("3^2 = %d", result);
return 0;
}
package holan.tw;
import java.awt.Graphics;
import java.awt.Graphics2D;
public class GameBoard extends javax.swing.JPanel {
public GameBoard() {
}
package holan.tw;
import javax.swing.JFrame;
public class GameForm extends JFrame {
public GameForm() {
createUI();
}