Skip to content

Instantly share code, notes, and snippets.

View castleberrysam's full-sized avatar

Sam Castleberry castleberrysam

View GitHub Profile
acl 2.2.52-2
adwaita-icon-theme 3.18.0-1
alleyoop 0.9.8-3
alsa-lib 1.1.0-1
alsa-plugins 1.1.0-1
archlinux-keyring 20160123-1
at-spi2-atk 2.18.1-1
at-spi2-core 2.18.3-1
atk 2.18.0-1
attr 2.4.47-1
Instruction Set:
PSH C push a constant onto the stack
POP N remove N values from the top of the stack
POP pop value N, POP N
STO N pop value, store into Nth slot down in the stack
STO pop value N, STO N
RCL N push value in Nth slot down in the stack
RCL pop value N, RCL N
AND C logical AND C with the top value
AND logical AND the top two values
What is I2C?
- Communication protocol
- Two wires (SDA, SCL) also needs GND
- Serial, data is transmitted one bit at a time
- Half duplex, one device talks at a time
- Synchronous, must receive response before moving on
- Master/slave, master controls clock and who can talk
- 1 byte word size, every ninth bit contains ACK or NACK
- 100kb/s baud rate, but it allows slave to stretch the clock by pulling SCL low
- SDA can only change when SCL is low (except start/stop)
(.macro movx)
(movl $1 (logand $2 #xff))
(movh $1 (ash $2 -8))
(.endmacro)
(.print "Testing the .print macro!\n")
(movx :sp #xffff)
(.macro push-reg)
(movl %sp #xff)
(movh %sp #xff)
(movl %ax 7)
(movh %ax 0)
(mov (@+ %sp 0) %ax)
(add %sp -1)
(movl %ax 19)
uint16_t fibonacci(uint16_t n)
{
uint16_t first = 1;
uint16_t second = 1;
while(n > 1) {
uint16_t tmp = first + second;
second = first;
first = tmp;
All registers are 16 bits and are initialized to all zeros.
Registers: pc, sp, fp, ax, bx, cx, dx, ex
pc (000): program counter
sp (001): stack pointer
fp (010): frame pointer
ax (011): general purpose A
bx (100): general purpose B
cx (101): general purpose C
dx (110): general purpose D
ex (111): general purpose E
16 registers
R0-R15
R0: program counter
R1: stack pointer
R15: link register
PUSH R 0000rrrr
CALL R, C 1001rrrr cccccccc cccccccc
POP R 0001rrrr
(mov %r4 0) ; zero KEY input buffer count
(mov (@+ %r4 #xffe0) %r4)
(mov (@+ %r4 #x8014) %r4) ; zero end of CONTEXT
(mov %r5 (@+ %r4 |FORTH-PTR|)) ; initialize FORTH dictionary
(mov (@+ %r4 #x8018) %r5)
(mov %r5 (@+ %r4 |ROOT-PTR|)) ; initialize ROOT dictionary
(mov (@+ %r4 #x801a) %r5)
@castleberrysam
castleberrysam / curl_flags.txt
Last active March 17, 2018 06:45
Commonly used cURL flags
-o, --output write to file instead of stdout
-s, --silent silent mode, no progress meter or error messages on stdout
-S, --show-error still print error messages in silent mode
-i, --include include the response header in the output
-I, --head output response header only
-O, --remote-name give output file the same name as the remote file
-A, --user-agent user agent string, use single quotes
-e, --referer send given URL as referer
-u, --user send given <username>:<password> when making the request