Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
8
Task/Loops-Continue/Haxe/loops-continue.haxe
Normal file
8
Task/Loops-Continue/Haxe/loops-continue.haxe
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for (i in 1...11) {
|
||||
Sys.print(i);
|
||||
if (i % 5 == 0) {
|
||||
Sys.print('\n');
|
||||
continue;
|
||||
}
|
||||
Sys.print(', ');
|
||||
}
|
||||
8
Task/Loops-Continue/Vala/loops-continue.vala
Normal file
8
Task/Loops-Continue/Vala/loops-continue.vala
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for (int i = 1; i <= 10; i++) {
|
||||
stdout.printf("%d", i);
|
||||
if (i % 5 == 0) {
|
||||
stdout.printf("\n");
|
||||
continue;
|
||||
}
|
||||
stdout.printf(", ");
|
||||
}
|
||||
87
Task/Loops-Continue/X86-Assembly/loops-continue.x86
Normal file
87
Task/Loops-Continue/X86-Assembly/loops-continue.x86
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
extern _printf
|
||||
|
||||
section .data
|
||||
output db 0,0,0,0
|
||||
reversedOutput db 0,0
|
||||
|
||||
section .text
|
||||
global _main
|
||||
_main:
|
||||
mov ecx, 0
|
||||
looping:
|
||||
inc ecx
|
||||
mov eax, ecx
|
||||
push ecx
|
||||
cmp ecx, 5
|
||||
je do5
|
||||
cmp ecx, 10
|
||||
je do10
|
||||
don:
|
||||
call createOutput
|
||||
mov [eax+1], byte 0x2c
|
||||
mov [eax+2], byte 0x20
|
||||
push eax
|
||||
call _printf
|
||||
add esp, 4
|
||||
pop ecx
|
||||
jmp looping
|
||||
do5:
|
||||
call createOutput
|
||||
mov [eax+1], byte 0x0a
|
||||
push eax
|
||||
call _printf
|
||||
add esp, 4
|
||||
pop ecx
|
||||
jmp looping
|
||||
do10:
|
||||
call createOutput
|
||||
mov [eax+2], byte 0x0a
|
||||
push eax
|
||||
call _printf
|
||||
add esp, 4
|
||||
pop ecx
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
|
||||
createOutput: ;parameter in eax
|
||||
;eax between 1 and 99
|
||||
push ebx
|
||||
mov ecx, 0
|
||||
clearOutput:
|
||||
mov [output+ecx], byte 0
|
||||
cmp ecx, 3
|
||||
je next
|
||||
inc ecx
|
||||
jmp clearOutput
|
||||
next:
|
||||
mov ecx, 0
|
||||
mov ebx, 10
|
||||
cOlooping:
|
||||
xor edx, edx
|
||||
div ebx
|
||||
mov [reversedOutput+ecx], dl
|
||||
add [reversedOutput+ecx], byte 0x30
|
||||
cmp eax, 0
|
||||
je reverse
|
||||
cmp ecx, 1
|
||||
je reverse
|
||||
inc ecx
|
||||
jmp cOlooping
|
||||
reverse:
|
||||
mov ecx, -1
|
||||
mov ebx, 0
|
||||
name:
|
||||
inc ecx
|
||||
neg ecx
|
||||
mov dl, [reversedOutput+ecx+1]
|
||||
neg ecx
|
||||
cmp dl, 0
|
||||
je name
|
||||
mov [output + ebx], dl
|
||||
inc ebx
|
||||
cmp ecx, 1
|
||||
jl name
|
||||
mov eax, output
|
||||
pop ebx
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue