All pastes #984951 Raw Edit

Something

public text v1 · immutable
·published 2008-04-14 17:45 UTC
rendered paste body
class PtrTest {
	unsafe static byte *PutChar(char ch, byte *ptr) {
		*ptr = (byte) ch;
		ptr++;
		*ptr = 0x0F;
		ptr++;
		return ptr;
	}
	
	unsafe static public void Main() {
		byte *ptr = (byte *) 0xB8000U;
		ptr = PutChar('H', ptr);
		ptr = PutChar('e', ptr);
		ptr = PutChar('l', ptr);
		ptr = PutChar('l', ptr);
		ptr = PutChar('o', ptr);
		ptr = PutChar(' ', ptr);
		ptr = PutChar('W', ptr);
		ptr = PutChar('o', ptr);
		ptr = PutChar('r', ptr);
		ptr = PutChar('l', ptr);
		ptr = PutChar('d', ptr);
		
		while(true) {}
	}
}


	call method_Main
method_Main:
	.begin:
		push ebp
		mov ebp, esp
		sub esp, 8
		jmp .block_0
	.block_6D:
		push 1
		pop eax
		mov [ebp-8], eax
		jmp .block_6D
	.block_6F:
		push 1
		pop eax
		mov [ebp-8], eax
		jmp .block_6D
	.block_0:
		push 753664
		pop eax
		mov [ebp-4], eax
		push 72
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 101
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 108
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 108
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 111
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 32
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 87
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 111
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 114
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 108
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		push 100
		mov eax, [ebp-4]
		push eax
		call method_PutChar
		push eax
		pop eax
		mov [ebp-4], eax
		jmp .block_6F
	.end:
		pop eax
		mov esp, ebp
		pop ebp
		ret 0
method_PutChar:
	.begin:
		push ebp
		mov ebp, esp
		sub esp, 4
		jmp .block_0
	.block_19:
		mov eax, [ebp-4]
		push eax
		jmp .end
	.block_0:
		mov eax, [ebp+8]
		push eax
		mov eax, [ebp+12]
		push eax
		pop eax
		pop ebx
		mov [ebx], al
		mov eax, [ebp+8]
		push eax
		push 1
		pop ebx
		pop eax
		add eax, ebx
		push eax
		pop eax
		mov [ebp+8], eax
		mov eax, [ebp+8]
		push eax
		push 15
		pop eax
		pop ebx
		mov [ebx], al
		mov eax, [ebp+8]
		push eax
		push 1
		pop ebx
		pop eax
		add eax, ebx
		push eax
		pop eax
		mov [ebp+8], eax
		mov eax, [ebp+8]
		push eax
		pop eax
		mov [ebp-4], eax
		jmp .block_19
	.end:
		pop eax
		mov esp, ebp
		pop ebp
		ret 8