This file contains hidden or 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
global add | |
section .text | |
add: | |
mov rax, rdi ; get the first parameter | |
add rax, rsi ; add the second parameter | |
; leaving the return value in rax | |
ret |
This file contains hidden or 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
gcc -c add.c -o add.o | |
nasm -f elf64 maths.asm -o maths.o | |
gcc -m64 add.o maths.o -o add |
This file contains hidden or 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
>>> Notes.by_distance(0) | |
<musica.notes.Note object at 0x10f961090> | |
>>> Notes.by_distance(0).__unicode__() | |
'c' |
This file contains hidden or 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
>>> Scales.scales[0] | |
<musica.scales.Scale object at 0x10f963090> | |
>>> Scales.scales[0].name | |
'Ionian' | |
>>> Scales.scales[0].intervals | |
[<musica.intervals.Interval object at 0x10f961950>, <musica.intervals.Interval object at 0x10f9619d0>, <musica.intervals.Interval object at 0x10f961a50>, <musica.intervals.Interval object at 0x10f961a90>, <musica.intervals.Interval object at 0x10f961b10>, <musica.intervals.Interval object at 0x10f961b90>, <musica.intervals.Interval object at 0x10f961c10>] |
This file contains hidden or 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
>>> steps = Scales.scales[0].voice(Notes.by_distance(0)) | |
>>> for s in steps: | |
... print 'note: ' + s['note'].__unicode__() + ', interval: ' + s['interval'].short_name | |
... | |
note: c, interval: PU | |
note: d, interval: M2 | |
note: e, interval: M3 | |
note: f, interval: P4 | |
note: g, interval: P5 | |
note: a, interval: M6 |
This file contains hidden or 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
RecreateBackBuffer PROC hWin:DWORD | |
; make sure we've destroyed anything already setup | |
invoke DestroyBackBuffer, hWin | |
; get an updated reading on the window's area | |
invoke GetClientRect, hWin, ADDR clientRect | |
; acquire a new DC for the window | |
invoke GetDC, hWin |
This file contains hidden or 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
DestroyBackBuffer PROC hWin:DWORD | |
; determine if we need to destroy the memory DC | |
cmp memDC, NULL | |
je MemoryDCDeallocated | |
; we do, so kill off these GDI objects | |
invoke SelectObject, memDC, memOldBitmap | |
invoke DeleteObject, memBitmap | |
invoke DeleteDC, memDC |
This file contains hidden or 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
FlipBackBuffer PROC hWin:DWORD | |
LOCAL hDC:HDC | |
LOCAL ps:PAINTSTRUCT | |
; start painting the window | |
invoke BeginPaint, hWin, ADDR ps | |
mov hDC, eax | |
; work out the dimensions to blit |
This file contains hidden or 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
StillRunning: | |
; check if there are messages on the queue to process | |
invoke PeekMessage, ADDR msg, NULL, 0, 0, PM_REMOVE | |
; if not, get on with rendering | |
cmp eax, 0 | |
je RenderFrame | |
; dispatch the message as needed |
This file contains hidden or 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
WndProc PROC hWin:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD | |
; determine which message we need to process | |
cmp uMsg, WM_CREATE | |
je CreateMessage | |
cmp uMsg, WM_DESTROY | |
je DestroyMessage |