1. MD to HTML with MS VSC +
2. Markdown All in One by Yu Zhang
Google Chrome -> print to pdf -> A4, Portrait,
Margins: top, bottom .4" left, right 0", Scale 130%
[ ] Headers and Footers
[ ] Background Graphics
234567891123456789212345678931234567894123456789512345678961
--------|---------|---------|---------|---------|---------|-
Discrete math:
BINARY (2):
digit | value |
---|---|
0 | nulla |
1 | I |
Example. Binary Counter:
n = int( input('bits as dec. number: '))
s = ['0','1'];
for k in range(n-1):
for i in range(len(s)):
s.append('1'+s[i])
s[i]='0'+s[i]
print(s)
output:
>>> %Run draft.py
bits as dec. number: 4
['0000', '0001', '0010', '0011',
'0100', '0101', '0110', '0111',
'1000', '1001', '1010', '1011',
'1100', '1101', '1110', '1111']
>>>
OCTAL (8):
digit | value |
---|---|
0 | nulla |
1 | I |
2 | II |
3 | III |
4 | IV |
5 | V |
6 | VI |
7 | VII |
Example: chmod
DECIMAL (10):
digit | value |
---|---|
0 | nulla |
1 | I |
2 | II |
3 | III |
4 | IV |
5 | V |
6 | VI |
7 | VII |
8 | VIII |
9 | IX |
Example. Decimal Counter:
n = 2 # digits in number
b = 10 # base 2 8 10 16
s = "%o" if b == 8 else "%d" if b == 10 else "%x"
[
print(
('' if i // b else '0') + s % i,
end=('\n' if i % b == (b - 1) else ' ')
)
for i in range( b**n)
]
output:
>>> %Run draft.py
00 01 02 03 04 05 06 07 08 09
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59
60 61 62 63 64 65 66 67 68 69
70 71 72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87 88 89
90 91 92 93 94 95 96 97 98 99
>>>
HEXADECIMAL (16):
digit | value | digit | value |
---|---|---|---|
0 | nulla | 8 | VIII |
1 | I | 9 | IX |
2 | II | A | X |
3 | III | B | XI |
4 | IV | C | XII |
5 | V | D | XIII |
6 | VI | E | XIV |
7 | VII | F | XV |
Example: xxd
$ wget https://flatassembler.net/fasm-1.73.30.tgz
$ tar xf fasm-1.73.30.tgz
$ sudo mv fasm/fasm* /usr/local/bin
$ fasm fasm/examples/elfexe/hello.asm hello
$ ./hello
Hello world!
$ ls -l hello
-rwxr-xr-x 1 it it 160 Nov 26 18:59 hello
$ nl fasm/examples/elfexe/hello.asm
1 ; fasm demonstration of writing simple ELF executable
2 format ELF executable 3
3 entry start
4 segment readable executable
5 start:
6 mov eax,4
7 mov ebx,1
8 mov ecx,msg
9 mov edx,msg_size
10 int 0x80
11 mov eax,1
12 xor ebx,ebx
13 int 0x80
14 segment readable writeable
15 msg db 'Hello world!',0xA
16 msg_size = $-msg
$ cat hello | xxd
00: 7f45 4c46 0101 0103 0000 0000 0000 0000 .ELF............
10: 0200 0300 0100 0000 7480 0408 3400 0000 ........t...4...
20: 0000 0000 0000 0000 3400 2000 0200 2800 ........4. ...(.
30: 0000 0000 0100 0000 0000 0000 0080 0408 ................
40: 0080 0408 9300 0000 9300 0000 0500 0000 ................
50: 0010 0000 0100 0000 9300 0000 9390 0408 ................
60: 9390 0408 0d00 0000 0d00 0000 0600 0000 ................
70: 0010 0000 b804 0000 00bb 0100 0000 b993 ................
80: 9004 08ba 0d00 0000 cd80 b801 0000 0031 ...............1
90: dbcd 8048 656c 6c6f 2077 6f72 6c64 210a ...Hello world!.
https://www.youtube.com/watch?v=caCITY-craM
Install avr compiler and header files
sudo apt install avr-libc gcc-avr pkg-config avrdude
curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"
cargo install cargo-generate
sudo apt install libudev-dev
https://packages.ubuntu.com/bionic/amd64/libreadline7/download
Type: avr-objcopy -O ihex myfile.elf myfile.hex
for converting a elf file to a hex file
https://microchipsupport.force.com/s/article/Creating-bin-hex-file-from-elf-file-for-AVR-devices