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
module Main where | |
import System.IO | |
import System.Random | |
data Move = Scissors | Paper | Rock | Unknown deriving (Eq,Show) | |
data Outcome = Winner | Draw | Loser | ND deriving (Show) | |
str2Move :: String -> Move | |
str2Move s = do |
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
module Cards where | |
import System.Random | |
import Data.Maybe | |
import Data.List | |
import Data.Function | |
import Test.HUnit | |
import Test.QuickCheck |
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
; ------ Bare syntax ------ | |
push MB_OK | |
push offset szDlgTitle | |
push offset szMsg | |
push 0 | |
call MessageBox | |
; ------ Invoke syntax ------ | |
invoke MessageBox, 0, ADDR szDlgTitle, ADDR szMsg, MB_OK |
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
include \masm32\include\windows.inc | |
include \masm32\include\user32.inc | |
include \masm32\include\kernel32.inc | |
includelib \masm32\lib\user32.lib | |
includelib \masm32\lib\kernel32.lib |
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
; ######################################################################### | |
.386 ; minimum processor needed for 32 bit | |
.model flat, stdcall ; FLAT memory model & STDCALL calling | |
option casemap :none ; set code to case sensitive | |
; ######################################################################### | |
include \masm32\include\windows.inc | |
include \masm32\include\user32.inc |
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
; ######################################################################### | |
.code | |
start: | |
invoke GetModuleHandle, NULL ; provides the instance handle | |
mov hInstance, eax | |
invoke GetCommandLine ; provides the command line address | |
mov szCommandLine, eax |
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
WinMain proc hInst :DWORD, | |
hPrevInst :DWORD, | |
szCmdLine :DWORD, | |
nCmdShow :DWORD | |
LOCAL msg :MSG | |
MessagePump_Loop: | |
; take the next message out of the queue to process |
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
.model small | |
.stack 100h | |
.code | |
start: | |
mov ax, 0013h ; set 320x200x256 mode | |
int 10h | |
mov ax, 0a000h ; we can't directly address ES so |
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
setup_palette: | |
mov cx, 255 ; 256 colour indicies to set | |
next_colour_idx: | |
mov al, 255 ; setup al so that we're setting | |
sub al, cl ; colour indicies from low to high | |
mov dx, 3c7h ; this port selects the colour index | |
; that we'll set r,g,b for |
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
randomize_lines: | |
mov cx, 640 ; we're going to set two rows of pixels | |
; at the bottom of the screen to be | |
; random colours, so that's 640 pixels | |
mov di, 63360 ; we're going to start writing these | |
; pixels on the last two lines so that's | |
; 64000 - 640 | |
OlderNewer