Family Day update

This commit is contained in:
Ingy döt Net 2020-02-17 23:21:07 -08:00
parent aac6731f2c
commit 9ad63ea473
2442 changed files with 39761 additions and 8255 deletions

View file

@ -0,0 +1,2 @@
a = "Monkey"
b = a

View file

@ -0,0 +1,22 @@
package main
import "fmt"
func main() {
// creature string
var creature string = "shark"
// point to creature
var pointer *string = &creature
// creature string
fmt.Println("creature =", creature) // creature = shark
// creature location in memory
fmt.Println("pointer =", pointer) // pointer = 0xc000010210
// creature through the pointer
fmt.Println("*pointer =", *pointer) // *pointer = shark
// set creature through the pointer
*pointer = "jellyfish"
// creature through the pointer
fmt.Println("*pointer =", *pointer) // *pointer = jellyfish
// creature string
fmt.Println("creature =", creature) // creature = jellyfish
}

View file

@ -1 +1 @@
"this is a string" dup tempString
'this_is_a_string dup s:temp

View file

@ -0,0 +1,3 @@
set "$string1" to "This is a string"
set "$string2" to "$string1"
* "&$string2&"

View file

@ -0,0 +1,20 @@
section .data
string db "Hello World", 0
section .bss
string2 resb 12
section .text
global _main
_main:
mov ecx, 0
looping:
mov al, [string + ecx]
mov [string2 + ecx], al
inc ecx
cmp al, 0 ;copy until we find the terminating 0
je end
jmp looping
end:
xor eax, eax
ret

View file

@ -0,0 +1,22 @@
section .data
string db 11,"Hello World"
section .bss
string2 resb 12
section .text
global _main
_main:
xor ecx, ecx ;clear ecx
mov cl, [string]
mov [string2], cl ;copy byte signaling length
mov edx, 1
looping: ;copy each single byte
mov al, [string + edx]
mov [string2 + edx], al
inc edx
dec ecx
cmp ecx, 0
jg looping
xor eax, eax
ret