Skip to content

Instantly share code, notes, and snippets.

@DivinityArcane
DivinityArcane / 8bit_adder.py
Last active December 10, 2015 11:09
Because why not.
_hex = {'0':0, '1':1, '2':2, '3':3, '4':4, '5':5,
'6':6, '7':7, '8':8, '9':9, 'A':10, 'B':11,
'C':12, 'D':13, 'E':14, 'F':15}
def bit(n1, n2):
if str(n1).upper() not in _hex:
raise ValueError('Invalid n1')
elif str(n2).upper() not in _hex:
raise ValueError('Invalid n2')
@DivinityArcane
DivinityArcane / bootsect.asm
Created December 12, 2012 06:16
A simple bootsector/OS.
; Simple NASM bootloader, or OS, if you please.
; Boots up and displays a black screen, and prints a message.
[ORG 0x7C00] ; Specify where to load the code.
msg: db 'Hello!' ; Define the msg.
len: equ $-msg ; Define the msg length.
; Create our "PRINT" function, which takes two arguments:
; 1: The message