max_stars_repo_path
stringlengths 4
261
| max_stars_repo_name
stringlengths 6
106
| max_stars_count
int64 0
38.8k
| id
stringlengths 1
6
| text
stringlengths 7
1.05M
|
---|---|---|---|---|
helloos/Kernel/kernel.vesa.graphice.asm | kbu1564/HelloOS | 15 | 6762 | ; 그래픽 전용 라이브러리 함수
; 2015-03-23
; 비디오 화면 지우기
; ebx : ColorCode ARGB
_vga_clear_screen:
push esi
push eax
push ecx
mov ax, VGADescriptor
mov es, ax
xor esi, esi
; mov esi, dword [PhysicalBasePointer]
xor eax, eax
xor ecx, ecx
mov ax, word [xResolution]
mov cx, word [yResolution]
mul ecx
; x * y
mov ecx, eax
.clear_loop:
mov dword [es:esi], ebx
add esi, 4
loop .clear_loop
pop ecx
pop eax
pop esi
ret
; push Y좌표
; push X좌표
; push 색상
; push 출력할 글자정보
; call _draw_font
; 한글자를 화면에 찍어주는 함수
_draw_font:
push ebp
mov ebp, esp
pusha
mov ax, VGADescriptor
mov es, ax
xor esi, esi
mov eax, 4
mul dword [ebp + 16]
add esi, eax
; x position
mov eax, 1024 * 4
mul dword [ebp + 20]
add esi, eax
; y position
mov edi, dword [ebp + 8]
mov eax, 16
.loop_draw:
mov ecx, 8
.loop_px:
mov edx, 1
shl edx, cl
shr edx, 1
test byte [edi], dl
jz .end_px
mov ebx, dword [ebp + 12]
mov dword [es:esi], ebx
.end_px:
add esi, 4
loop .loop_px
add esi, 4 * (1024 - 8)
dec eax
inc edi
cmp eax, 0
jne .loop_draw
popa
mov esp, ebp
pop ebp
ret 16
; 폰트 그리기 테스트
_draw_font_test:
mov ecx, 0
.font_test:
mov esi, font
mov eax, 16
mul ecx
add esi, eax
; 다음 그릴 폰트
mov eax, 8
mul ecx
; x 좌표 위치
push 0
push eax
push 0xFFFFFFFF
push esi
call _draw_font
inc ecx
cmp ecx, 62
jne .font_test
ret
; push Y좌표
; push X좌표
; push 색상
; push 그릴 커서 종류
; call _draw_font
; 화면에 마우스 커서를 찍어주는 함수
_draw_cursor:
push ebp
mov ebp, esp
pusha
mov ax, VGADescriptor
mov es, ax
xor esi, esi
mov eax, 4
mul dword [ebp + 16]
add esi, eax
; x position
mov eax, 1024 * 4
mul dword [ebp + 20]
add esi, eax
; y position
mov edi, dword [ebp + 8]
mov eax, 16
.loop_draw:
mov ecx, 16
.loop_px:
mov edx, 1
shl edx, cl
shr edx, 1
test word [edi], dx
jz .end_px
mov ebx, dword [ebp + 12]
; Masking
mov edx, 16
sub edx, ecx
add edx, dword [ebp + 16]
cmp word [xResolution], dx
jbe .end_px
mov dword [es:esi], ebx
.end_px:
add esi, 4
loop .loop_px
add esi, 4 * (1024 - 16)
dec eax
add edi, 2
cmp eax, 0
jne .loop_draw
popa
mov esp, ebp
pop ebp
ret 16
; Call Vector Table 에 등록될 GUI 모드에서의 print 함수
; _print32_gui 함수와 호환성을 마추기 위한 디버깅용
_call_print32_gui:
push ebp
mov ebp, esp
pusha
mov eax, dword [ebp+20]
shl eax, 4
push eax
mov eax, dword [ebp+16]
shl eax, 3
push eax
push dword [ebp+12]
push dword [ebp+8]
call _print32_gui
popa
mov esp, ebp
pop ebp
ret 16
; NULL 문자를 만날때 까지 출력합니다.
; ENTER 즉 개행 문자를 \n 으로 정의 합니다.
; void print32_gui(const char* str, int colorCode, int x, int y);
_print32_gui:
push ebp
mov ebp, esp
pusha
mov edi, dword [ebp+8]
; 출력할 메시지
mov esi, dword [ebp+16]
; 출력 x 좌표
mov ecx, 16
; 폰트 크기
.loop:
xor eax, eax
mov al, byte [edi]
test al, al
jz .end
; NULL 체크후 종료
cmp al, '&'
jae .chk
.chk:
cmp al, 'z'
ja .endloop
sub al, '&'
mul ecx
add eax, font.26h
push dword [ebp+20]
push esi
push dword [ebp+12]
push eax
call _draw_font
.endloop:
add esi, 8
inc edi
; 글씨 크기만큼 다음 위치로 이동
jmp .loop
.end:
popa
mov esp, ebp
pop ebp
ret 16
|
Yamaha-CL-Automated-Backup-Tool.scpt | zerbzman/Yamaha-CL-Automated-Backup | 1 | 3395 | /*
Yamaha CL Backup Console To File
Description: This is used to automate backing up of a CL5 console.
Author: <NAME>
Created on: 20190121
Modified on: 20190214
Version: 1.2
// TODO: add pattern checking for ipaddress input
// TODO: add support for duplicate save files
// TODO: Multiple console support
1.2 notes
- added save config file
- added ipaddress input
- added console name
- added path input for save files
- added a timeout if something went wrong
- added a console ipaddress checker
- added a progress indicator
- added some reliabilty to the script in case you accidentally clicked out or started doing something else
- added notifications for success and errors
- added a check to see if CL Editor is installed
1.1 notes
- added a wait for the console sync
*/
var path
var storePath
var process
var clEditor
var app = Application.currentApplication()
app.includeStandardAdditions = true
//check if CL Editor is installed
try {
clEditor = Application("CL Editor")
} catch (e) {
alert("Can't find CL Editor", "Please install CL Editor in the Applications folder. You can download it from https://usa.yamaha.com/support/updates/cl_edt_mac.html", true)
throw "Not Installed"
}
var scriptConfig = {}
main()
function main() {
//see if settings are made
try {
scriptConfig = getScriptConfig()
} catch (e) {
scriptConfig = setupScript()
}
//check to see if the console is on or responding
if (isConsoleConnected()) {
try {
var steps = 9
Progress.totalUnitCount = steps
Progress.completedUnitCount = 0
Progress.description = "Setting Up..."
Progress.additionalDescription = "Preparing to process."
//step one and two
clEditor.quit()
Progress.additionalDescription = "Quiting CL Editor just in case"
Progress.completedUnitCount++
clEditor.activate()
Progress.additionalDescription = "Opening CL Editor"
Progress.completedUnitCount++
var systemEvents = Application('System Events')
process = systemEvents.processes['CL Editor']
//step 3
Progress.additionalDescription = "Inputing Console Address"
Progress.completedUnitCount++
//maybe try to close all the windows first
delay(2)
process.menuBars[0].menuBarItems[4].menus[0].menuItems[1].click()
//first go to the setup screen
process.menuBars[0].menuBarItems[2].menus[0].menuItems[8].click()
//enter the ip Address
var split = scriptConfig.ipAddress.split(".")
clEditor.activate()
for (number of split) {
delay(.2)
systemEvents.keystroke(number)
//then tab
systemEvents.keyCode(48)
}
systemEvents.keyCode(36)
delay(3)
//step 5
Progress.additionalDescription = "Synchronizing the Console: This may take a while"
Progress.completedUnitCount++
//select the menu bar item "Synchronization"
//systemEvents.keystroke('0', { using: 'command down' }) this isn't reliable
process.menuBars[0].menuBarItems[5].menus[0].menuItems[0].click()
delay(.2)
clEditor.activate()
systemEvents.keyCode(36)
delay(.5)
process.visible = false
if (!waitForConsoleSync()) {
throw "Console Sync Timeout: Something took way too long"
}
process.visible = true
//step 6
Progress.additionalDescription = "Changing the save Settings."
Progress.completedUnitCount++
clEditor.activate()
delay(2)
process.menuBars[0].menuBarItems[2].menus[0].menuItems[3].click()
delay(1)
var saveName = ""
process.windows[0].textFields[0].value = saveName
//then click Save As...
//get the date/time
var date = new Date()
//save format
// BU-{Device Name}-{Device Location or name}-20190131
var month = (date.getMonth() + 1) + ""
var saveName = `BU-${scriptConfig.consoleName}-${date.getFullYear()}${month.padStart(2, "0")}${date.getDate()}`
delay(0.2)
process.windows[0].textFields[0].value = saveName
clEditor.activate()
delay(0.2)
systemEvents.keystroke('g', {
using: ['command down', 'shift down']
}) // Open the GoTo Dialog
delay(0.5)
//save in Documents->FOH-CL5
clEditor.activate() //make sure the screen is on top
//step 7
Progress.additionalDescription = "Saving the Console File."
Progress.completedUnitCount++
systemEvents.keystroke(scriptConfig.consoleSavePath)
delay(0.2)
systemEvents.keyCode(36)
delay(0.4)
systemEvents.keyCode(36)
//Overwrite if asked
delay(0.4)
clEditor.activate()
systemEvents.keyCode(48)
systemEvents.keyCode(36)
//close the program
//I had to do command q instead of clEditor.quit() because I couldn't get it to hit the no don't save button
//step 8
delay(1)
Progress.additionalDescription = "Quiting CL Editor"
Progress.completedUnitCount++
clEditor.activate()
systemEvents.keystroke('q', {
using: 'command down'
})
delay(.2)
systemEvents.keyCode(36)
Progress.completedUnitCount++
//show a notification or something to alert the user that the console isn't on
app.displayNotification('Continue on', {
withTitle: 'Success',
subtitle: `${saveName} was saved.`
})
} catch (e) {
app.displayNotification('The console file did not get saved.', {
withTitle: e.toString(),
subtitle: 'Error'
})
}
} else {
//show a notification or something to alert the user that the console isn't on
app.displayNotification('Check to make sure the ipAddress is correct or a cable is unplugged.', {
withTitle: 'Could not reach the console.',
subtitle: 'Connection Error'
})
}
}
function waitForConsoleSync(time = 5) {
var defaultWait = 5
var waitTime = 180 //timeout after 3 minutes
delay(defaultWait)
if (time < waitTime) {
if (process.windows.length !== 1) {
return true
} else {
return waitForConsoleSync((time + defaultWait))
}
} else {
return false
}
}
function isConsoleConnected() {
var shell = `ping -c 1 -W 1 ${scriptConfig.ipAddress} > /dev/null 2>&1 && echo "true" || echo "false";`
var result = app.doShellScript(shell)
if (result === "true") {
return true
} else {
return false
}
}
function alert(text, informationalText, critical = false) {
var options = {}
if (informationalText) options.message = informationalText
if (critical) options.as = "critical"
app.displayAlert(text, options)
}
function setupScript() {
//ask the user for the ipaddress
var ipAddress = prompt("What is the ipaddress of the mixer?")
// TODO: setup some sort of format checker
var consoleName = prompt("What do you want to name the mixer?")
//ask the user where to save the console files
var consoleSavePath = app.chooseFolder({
withPrompt: "What folder do you want to save all the console files to?"
})
var data = {
ipAddress: ipAddress,
consoleName: consoleName,
consoleSavePath: consoleSavePath.toString()
}
//store the file as a json object
writeTextToFile(JSON.stringify(data), path, true)
return data
}
function getCurrentScriptName() {
//stub until I figure out how to get the current script name
return "settings-cl-backup-tool"
}
function getScriptConfig() {
path = `${app.pathTo("home folder")}/Documents/${getCurrentScriptName()}.txt`
return JSON.parse(readFile(path))
}
function prompt(text, defaultAnswer) {
var options = {
defaultAnswer: defaultAnswer || ''
}
try {
return app.displayDialog(text, options).textReturned
} catch (e) {
return null
}
}
function readFile(file) {
// Convert the file to a string
var fileString = file.toString()
// Read the file and return its contents
return app.read(Path(fileString))
}
function writeTextToFile(text, file, overwriteExistingContent) {
try {
// Convert the file to a string
var fileString = file.toString()
// Open the file for writing
var openedFile = app.openForAccess(Path(fileString), {
writePermission: true
})
// Clear the file if content should be overwritten
if (overwriteExistingContent) {
app.setEof(openedFile, {
to: 0
})
}
// Write the new content to the file
app.write(text, {
to: openedFile,
startingAt: app.getEof(openedFile)
})
// Close the file
app.closeAccess(openedFile)
// Return a boolean indicating that writing was successful
return true
} catch (error) {
try {
// Close the file
app.closeAccess(file)
} catch (error) {
// Report the error is closing failed
console.log(`Couldn't close file: ${error}`)
}
// Return a boolean indicating that writing was successful
return false
}
}
|
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2.log_21829_1715.asm | ljhsiun2/medusa | 9 | 19205 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x16761, %r11
nop
nop
cmp $31714, %r13
mov $0x6162636465666768, %r10
movq %r10, (%r11)
nop
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_UC_ht+0x1d649, %rsi
lea addresses_UC_ht+0x1a7e1, %rdi
nop
nop
nop
inc %r13
mov $2, %rcx
rep movsw
nop
nop
dec %r13
lea addresses_A_ht+0x1d0a1, %r13
nop
nop
nop
nop
add %r10, %r10
movw $0x6162, (%r13)
nop
and %rcx, %rcx
lea addresses_A_ht+0xc961, %rdi
nop
sub %rdx, %rdx
movb (%rdi), %r10b
nop
nop
and $29398, %rdi
lea addresses_WT_ht+0x14401, %rdi
nop
nop
nop
add %r11, %r11
vmovups (%rdi), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rdx
nop
nop
xor $24230, %rcx
lea addresses_D_ht+0x7f61, %r11
nop
nop
nop
nop
and %rdi, %rdi
mov $0x6162636465666768, %r10
movq %r10, %xmm5
movups %xmm5, (%r11)
nop
nop
and %rdi, %rdi
lea addresses_UC_ht+0xdb61, %r10
nop
nop
nop
nop
nop
cmp $8678, %rsi
movl $0x61626364, (%r10)
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x12429, %r13
xor $15387, %r11
mov (%r13), %cx
nop
nop
nop
nop
inc %r10
lea addresses_WT_ht+0x18481, %rsi
nop
nop
add $30582, %r13
mov (%rsi), %dx
nop
nop
add %r13, %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r9
push %rax
push %rbx
push %rcx
push %rdx
// Faulty Load
mov $0x36902c0000000761, %r13
nop
nop
nop
xor $52206, %rax
movups (%r13), %xmm2
vpextrq $0, %xmm2, %rdx
lea oracles, %rcx
and $0xff, %rdx
shlq $12, %rdx
mov (%rcx,%rdx,1), %rdx
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 5, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/fltk-widgets-clocks-updated.adb | micahwelf/FLTK-Ada | 1 | 11239 |
with
Interfaces.C.Strings,
System;
use type
System.Address;
package body FLTK.Widgets.Clocks.Updated is
procedure clock_set_draw_hook
(W, D : in System.Address);
pragma Import (C, clock_set_draw_hook, "clock_set_draw_hook");
pragma Inline (clock_set_draw_hook);
procedure clock_set_handle_hook
(W, H : in System.Address);
pragma Import (C, clock_set_handle_hook, "clock_set_handle_hook");
pragma Inline (clock_set_handle_hook);
function new_fl_clock
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_clock, "new_fl_clock");
pragma Inline (new_fl_clock);
function new_fl_clock2
(K : in Interfaces.C.unsigned_char;
X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_clock2, "new_fl_clock2");
pragma Inline (new_fl_clock2);
procedure free_fl_clock
(F : in System.Address);
pragma Import (C, free_fl_clock, "free_fl_clock");
pragma Inline (free_fl_clock);
procedure fl_clock_draw
(W : in System.Address);
pragma Import (C, fl_clock_draw, "fl_clock_draw");
pragma Inline (fl_clock_draw);
procedure fl_clock_draw2
(C : in System.Address;
X, Y, W, H : in Interfaces.C.int);
pragma Import (C, fl_clock_draw2, "fl_clock_draw2");
pragma Inline (fl_clock_draw2);
function fl_clock_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_clock_handle, "fl_clock_handle");
pragma Inline (fl_clock_handle);
procedure Finalize
(This : in out Updated_Clock) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Updated_Clock'Class
then
free_fl_clock (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Clock (This));
end Finalize;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Updated_Clock is
begin
return This : Updated_Clock do
This.Void_Ptr := new_fl_clock
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
clock_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
clock_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
function Create
(Kind : in Box_Kind;
X, Y, W, H : in Integer;
Text : in String)
return Updated_Clock is
begin
return This : Updated_Clock do
This.Void_Ptr := new_fl_clock2
(Box_Kind'Pos (Kind),
Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
clock_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
clock_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
end Forge;
procedure Draw
(This : in out Updated_Clock) is
begin
fl_clock_draw (This.Void_Ptr);
end Draw;
procedure Draw
(This : in out Clock;
X, Y, W, H : in Integer) is
begin
fl_clock_draw2
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H));
end Draw;
function Handle
(This : in out Updated_Clock;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_clock_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Clocks.Updated;
|
programs/oeis/146/A146762.asm | neoneye/loda | 22 | 179017 | ; A146762: Numbers in A061039 ending with 0.
; 0,40,160,280,520,80,40,1360,1840,2200,2800,40,440,4480,5320,5920,6880,280,320,9400,10600,11440,12760,1520,560,16120,17680,18760,20440,800,2600,24640,26560,27880,29920,1160,1240,34960,37240,38800,41200,4760,560
mul $0,5
div $0,2
seq $0,144448 ; First bisection of A061039.
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_13586_1453.asm | ljhsiun2/medusa | 9 | 95765 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1301, %rsi
lea addresses_A_ht+0x2601, %rdi
nop
nop
nop
nop
sub %r14, %r14
mov $56, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $41465, %r11
lea addresses_normal_ht+0x300d, %r14
nop
nop
nop
nop
add $40818, %rax
mov (%r14), %rdi
nop
nop
nop
cmp %rdi, %rdi
lea addresses_D_ht+0x11081, %rsi
nop
nop
nop
nop
sub %r15, %r15
vmovups (%rsi), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %r11
nop
nop
nop
nop
nop
sub $19957, %r15
lea addresses_normal_ht+0x10581, %r14
nop
nop
nop
nop
xor %r11, %r11
movb $0x61, (%r14)
nop
nop
and $56265, %rdi
lea addresses_D_ht+0x6dcd, %rdi
nop
nop
nop
xor %rsi, %rsi
and $0xffffffffffffffc0, %rdi
vmovntdqa (%rdi), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r11
nop
nop
sub %rdi, %rdi
lea addresses_A_ht+0x7d01, %rcx
nop
nop
nop
nop
nop
sub %r14, %r14
movw $0x6162, (%rcx)
nop
add $38271, %rcx
lea addresses_WT_ht+0xdf01, %r11
inc %r14
mov (%r11), %rax
nop
add $24917, %r11
lea addresses_UC_ht+0x15701, %r11
clflush (%r11)
nop
nop
cmp %rcx, %rcx
mov (%r11), %r14w
sub %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rax
push %rbx
push %rdi
push %rdx
// Store
lea addresses_RW+0x1e381, %r14
nop
nop
nop
nop
add $46769, %rdx
mov $0x5152535455565758, %rax
movq %rax, %xmm3
vmovntdq %ymm3, (%r14)
nop
nop
nop
nop
cmp $54207, %rdi
// Store
lea addresses_D+0x5b81, %r13
clflush (%r13)
cmp %r10, %r10
movw $0x5152, (%r13)
nop
nop
nop
sub %rdx, %rdx
// Store
mov $0x441, %rdi
nop
nop
nop
nop
nop
and $41037, %rax
movw $0x5152, (%rdi)
cmp $54044, %rdx
// Faulty Load
lea addresses_WT+0x8701, %r13
nop
nop
cmp %rdi, %rdi
movups (%r13), %xmm6
vpextrq $0, %xmm6, %rdx
lea oracles, %r10
and $0xff, %rdx
shlq $12, %rdx
mov (%r10,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rbx
pop %rax
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 2, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'00': 13586}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
notes/extra/bit_shift_left.asm | feliposz/nand2tetris | 0 | 95937 | // shift left operation
// R0 = number to be shifted
// R1 = bits to shift left
// R2 = result
// calculate jump to shift sequence (skip as needed)
@R1
D=M
@INVALID
D;JLT // invalid if bits < 0
@16
D=A
@R1
D=D-M // 16 - bits
@INVALID
D;JLT // invalid if bits > 16
A=D
D=D+A // 2 * (16 - bits)
@SHIFT_INIT
D=D+A // SHIFT_INIT + 2 * (16 - bits)
// store jump address on R2 (used as a temp var)
@R2
M=D
// load value to be shifted
@R0
D=M
// initiate shift sequence
@R2
A=M
0;JMP
(SHIFT_INIT)
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
A=D
D=D+A
// store result
@R2
M=D
(END)
@END
0;JMP
(INVALID)
@R0
M=-1
@R1
M=-1
@R2
M=-1
@END
0;JMP
|
test-resources/ExamplesFromRoy/md_example6.ads | hergin/ada2fuml | 0 | 7366 | <reponame>hergin/ada2fuml<gh_stars>0
with Globals_Example1;
with Ada.Finalization;
package Md_Example6 is
type T is new Ada.Finalization.Controlled with record
Attribute : Globals_Example1.Itype;
end record;
-- Ada Rules state that all tagged operations must be defined here
function Do_It (The_T : T) return Globals_Example1.Itype;
procedure Initialize(The_T : in out T);
-- Did not declare procedure Finalize and thus there is no destructor
end Md_Example6;
|
tests/devices/amstradcpc/cpc6128_savecpcsna.asm | fengjixuchui/sjasmplus | 220 | 102495 | ; this is trivial "does it even do something" check of SAVECPCSNA with a CPC6128 device
; there's nothing to verify after the test except sjasmplus did not error out
DEVICE AMSTRADCPC6128
ORG 0x1200
start:
ld b,$7F
ld c,$8D ; disable ROMS, set mode 1
out (c),c
ld c,$10 ; PENR = BORDER
out (c),c
ld a,$FF
.borderMess:
inc a
and $1F
cp $1F
jr nz,.brd
ld a,$00
.brd:
or $40
ld c,a
out (c),a ; INKR
.mmr_paging:
; flip slot 3 in and out
nop
nop
ld c,$C1
out (c),c
nop
nop
ld c,$C0
out (c),c
jr .borderMess
SLOT 3 : PAGE 3
ORG $C000
.db $03, $03
SLOT 3 : PAGE 7
ORG $C000
.db $07, $07
SAVECPCSNA "cpc6128_savesna.sna", start
|
src/gstreamer-rtsp-url.ads | persan/A-gst | 1 | 10475 | <filename>src/gstreamer-rtsp-url.ads
private with GStreamer.GST_Low_Level.Gstreamer_0_10_Gst_Rtsp_Gstrtspurl_H;
with Glib;
with System;
with Ada.Finalization;
with GNAT.Sockets;
package GStreamer.Rtsp.url is
DEFAULT_PORT : constant := 554;
type GstRTSPUrl (<>)is tagged private;
function Get_Type return GLIB.GType;
function Parse (Urlstr : String) return GstRTSPUrl;
function Get_Request_Uri (Arg1 : GstRTSPUrl) return String;
function Decode_Path_Components (Url : GstRTSPUrl) return System.Address;
procedure Set_Port (Url : GstRTSPUrl; Port : GNAT.Sockets.Port_Type);
function Get_Port (Url : GstRTSPUrl) return GNAT.Sockets.Port_Type;
private
type GstRTSPUrl is new Ada.Finalization.Controlled with record
Data : aliased GStreamer.GST_Low_Level.Gstreamer_0_10_Gst_Rtsp_Gstrtspurl_H.GstRTSPUrl;
end record;
end GStreamer.Rtsp.url;
|
ejercicios2/prueba_eliminar_tercer_elemento_ordenada.adb | iyan22/AprendeAda | 0 | 24632 | <filename>ejercicios2/prueba_eliminar_tercer_elemento_ordenada.adb
with Ada.Text_Io; use Ada.Text_Io;
with vectores; use vectores;
with eliminar_tercer_elemento_ordenada, escribir_vector;
procedure prueba_eliminar_tercer_elemento_ordenada is
-- este programa hace llamadas al subprograma eliminar_tercer_elemento
-- para comprobar si su funcionamiento es correcto
Lista1: Vector_de_enteros(1..10);
Lista2: Vector_de_enteros(1..2);
begin
Lista1:=(1, 3, 5, 6, 7, 9, 13, 15, 17, 19);
put_line("Caso 1: lista de cuatro elementos: (1, 3, 5, 6, 7, 9, 13, 15, 17, 19)");
put_line(" la lista inicial es: ");
escribir_vector(Lista1);
new_line;
put_line(" el resultado deberia de ser 1 3 6 7 9 13 15 17 19 -1");
put_line("y la lista resultado es: ");
eliminar_tercer_elemento_ordenada(Lista1);
escribir_vector(Lista1);
new_line(3);
put_line("Pulsa return para continuar");
skip_line;
new_line(3);
-- faltan varios casos de prueba
Lista1:=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
put_line("Caso 2: lista de diez elementos: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)");
put_line(" la lista inicial es: ");
escribir_vector(Lista1);
new_line;
put_line(" el resultado deberia de ser 1 2 4 5 6 7 8 9 -1 ");
put_line("y la lista resultado es: ");
eliminar_tercer_elemento_ordenada(Lista1);
escribir_vector(Lista1);
new_line(3);
put_line("Pulsa return para continuar");
skip_line;
new_line(3);
Lista2:= (1, 2);
put_line("Caso 2: lista de dos elementos: (1, 2)");
put_line(" la lista inicial es: ");
escribir_vector(Lista2);
new_line;
put_line(" el resultado deberia de ser 1 2 ");
put_line("y la lista resultado es: ");
eliminar_tercer_elemento_ordenada(Lista2);
escribir_vector(Lista2);
new_line(3);
put_line("Pulsa return para continuar");
skip_line;
new_line(3);
end prueba_eliminar_tercer_elemento_ordenada;
|
FormalAnalyzer/models/apps/DoubleTapModeChange.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 4497 | <reponame>Mohannadcse/IoTCOM_BehavioralRuleExtractor
module app_DoubleTapModeChange
open IoTBottomUp as base
open cap_userInput
open cap_location
open cap_switch
one sig app_DoubleTapModeChange extends IoTApp {
sendPushMessage : one cap_userInput,
no_value : one cap_location_attr_mode_val,
state : one cap_state,
downMode : one cap_location_attr_mode_val,
upMode : one cap_location_attr_mode_val,
location : one cap_location,
master : one cap_switch,
} {
rules = r
}
one sig cap_userInput_attr_sendPushMessage extends cap_userInput_attr {}
{
values = cap_userInput_attr_sendPushMessage_val
}
abstract sig cap_userInput_attr_sendPushMessage_val extends cap_userInput_attr_value_val {}
one sig cap_state extends Capability {} {
attributes = cap_state_attr
}
abstract sig cap_state_attr extends Attribute {}
one sig cap_state_attr_mode extends cap_state_attr {} {
values = cap_state_attr_mode_val
}
abstract sig cap_state_attr_mode_val extends AttrValue {}
one sig cap_state_attr_mode_val_downMode extends cap_state_attr_mode_val {}
one sig cap_state_attr_mode_val_upMode extends cap_state_attr_mode_val {}
one sig cap_state_attr_modeStartTime extends cap_state_attr{} {
values = cap_state_attr_modeStartTime_val
}
abstract sig cap_state_attr_modeStartTime_val extends AttrValue {}
// application rules base class
abstract sig r extends Rule {}
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_DoubleTapModeChange.master
attribute = cap_switch_attr_switch
no value
}
abstract sig r0_cond extends Condition {}
one sig r0_cond0 extends r0_cond {} {
capabilities = app_DoubleTapModeChange.master
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r0_cond1 extends r0_cond {} {
capabilities = app_DoubleTapModeChange.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val - app_DoubleTapModeChange.upMode
}
one sig r0_cond2 extends r0_cond {} {
capabilities = app_DoubleTapModeChange.master
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val
}
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_DoubleTapModeChange.location
attribute = cap_location_attr_mode
value = app_DoubleTapModeChange.upMode
}
one sig r1 extends r {}{
triggers = r1_trig
conditions = r1_cond
commands = r1_comm
}
abstract sig r1_trig extends Trigger {}
one sig r1_trig0 extends r1_trig {} {
capabilities = app_DoubleTapModeChange.location
attribute = cap_location_attr_mode
no value
}
abstract sig r1_cond extends Condition {}
abstract sig r1_comm extends Command {}
one sig r1_comm0 extends r1_comm {} {
capability = app_DoubleTapModeChange.state
attribute = cap_state_attr_modeStartTime
value = cap_state_attr_modeStartTime_val
}
one sig r2 extends r {}{
triggers = r2_trig
conditions = r2_cond
commands = r2_comm
}
abstract sig r2_trig extends Trigger {}
one sig r2_trig0 extends r2_trig {} {
capabilities = app_DoubleTapModeChange.master
attribute = cap_switch_attr_switch
no value
}
abstract sig r2_cond extends Condition {}
one sig r2_cond0 extends r2_cond {} {
capabilities = app_DoubleTapModeChange.master
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val - cap_switch_attr_switch_val_on
}
one sig r2_cond1 extends r2_cond {} {
capabilities = app_DoubleTapModeChange.master
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r2_cond2 extends r2_cond {} {
capabilities = app_DoubleTapModeChange.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val - app_DoubleTapModeChange.downMode
}
one sig r2_cond3 extends r2_cond {} {
capabilities = app_DoubleTapModeChange.master
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val
}
abstract sig r2_comm extends Command {}
one sig r2_comm0 extends r2_comm {} {
capability = app_DoubleTapModeChange.location
attribute = cap_location_attr_mode
value = app_DoubleTapModeChange.downMode
}
|
src/wiki-attributes.ads | jquorning/ada-wiki | 18 | 387 | <filename>src/wiki-attributes.ads
-----------------------------------------------------------------------
-- wiki-attributes -- Wiki document attributes
-- Copyright (C) 2015, 2016, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Wiki.Strings;
private with Ada.Containers.Vectors;
private with Ada.Finalization;
private with Util.Refs;
-- == Attributes ==
-- The `Attributes` package defines a simple management of attributes for
-- the wiki document parser. Attribute lists are described by the `Attribute_List`
-- with some operations to append or query for an attribute. Attributes are used for
-- the Wiki document representation to describe the HTML attributes that were parsed and
-- several parameters that describe Wiki content (links, ...).
--
-- The Wiki filters and Wiki plugins have access to the attributes before they are added
-- to the Wiki document. They can check them or modify them according to their needs.
--
-- The Wiki renderers use the attributes to render the final HTML content.
package Wiki.Attributes is
pragma Preelaborate;
type Cursor is private;
-- Get the attribute name.
function Get_Name (Position : in Cursor) return String;
-- Get the attribute value.
function Get_Value (Position : in Cursor) return String;
-- Get the attribute wide value.
function Get_Wide_Value (Position : in Cursor) return Wiki.Strings.WString;
-- Returns True if the cursor has a valid attribute.
function Has_Element (Position : in Cursor) return Boolean;
-- Move the cursor to the next attribute.
procedure Next (Position : in out Cursor);
-- A list of attributes.
type Attribute_List is private;
-- Find the attribute with the given name.
function Find (List : in Attribute_List;
Name : in String) return Cursor;
-- Find the attribute with the given name and return its value.
function Get_Attribute (List : in Attribute_List;
Name : in String) return Wiki.Strings.WString;
-- Append the attribute to the attribute list.
procedure Append (List : in out Attribute_List;
Name : in Wiki.Strings.WString;
Value : in Wiki.Strings.WString);
-- Append the attribute to the attribute list.
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.WString);
-- Append the attribute to the attribute list.
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.UString);
-- Get the cursor to get access to the first attribute.
function First (List : in Attribute_List) return Cursor;
-- Get the number of attributes in the list.
function Length (List : in Attribute_List) return Natural;
-- Clear the list and remove all existing attributes.
procedure Clear (List : in out Attribute_List);
-- Iterate over the list attributes and call the <tt>Process</tt> procedure.
procedure Iterate (List : in Attribute_List;
Process : not null access procedure (Name : in String;
Value : in Wiki.Strings.WString));
private
type Attribute (Name_Length, Value_Length : Natural) is limited
new Util.Refs.Ref_Entity with record
Name : String (1 .. Name_Length);
Value : Wiki.Strings.WString (1 .. Value_Length);
end record;
type Attribute_Access is access all Attribute;
package Attribute_Refs is new Util.Refs.Indefinite_References (Attribute, Attribute_Access);
use Attribute_Refs;
subtype Attribute_Ref is Attribute_Refs.Ref;
package Attribute_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Attribute_Ref);
subtype Attribute_Vector is Attribute_Vectors.Vector;
type Cursor is record
Pos : Attribute_Vectors.Cursor;
end record;
type Attribute_List is new Ada.Finalization.Controlled with record
List : Attribute_Vector;
end record;
-- Finalize the attribute list releasing any storage.
overriding
procedure Finalize (List : in out Attribute_List);
end Wiki.Attributes;
|
qsort.ads | M1nified/Ada-Samples | 0 | 3136 | with System;
use System;
package Qsort is
type vector is array (Integer range <>) of Integer;
type vector_ptr is access vector;
task type SortTask is
entry PortIn(ValIn : in vector_ptr);
entry PortOut(ValOut : out vector);
end SortTask;
type Sort_access is access SortTask;
procedure Sort (List : in out vector_ptr);
end Qsort; |
oeis/077/A077902.asm | neoneye/loda-programs | 11 | 21129 | ; A077902: Expansion of (1-x)^(-1)/(1 + x - x^2 + x^3).
; Submitted by <NAME>(s2)
; 1,0,2,-2,5,-8,16,-28,53,-96,178,-326,601,-1104,2032,-3736,6873,-12640,23250,-42762,78653,-144664,266080,-489396,900141,-1655616,3045154,-5600910,10301681,-18947744,34850336,-64099760,117897841,-216847936,398845538,-733591314,1349284789,-2481721640
add $0,1
lpb $0
sub $0,1
sub $2,$3
mov $1,$2
mov $2,$4
mov $4,1
sub $4,$3
add $4,$1
add $3,$4
lpe
mov $0,$3
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/check_displace_generation.adb | best08618/asylo | 7 | 18610 | <gh_stars>1-10
-- { dg-do run }
procedure Check_Displace_Generation is
package Stuff is
type Base_1 is interface;
function F_1 (X : Base_1) return Integer is abstract;
type Base_2 is interface;
function F_2 (X : Base_2) return Integer is abstract;
type Concrete is new Base_1 and Base_2 with null record;
function F_1 (X : Concrete) return Integer;
function F_2 (X : Concrete) return Integer;
end Stuff;
package body Stuff is
function F_1 (X : Concrete) return Integer is
begin
return 1;
end F_1;
function F_2 (X : Concrete) return Integer is
begin
return 2;
end F_2;
end Stuff;
use Stuff;
function Make_Concrete return Concrete is
C : Concrete;
begin
return C;
end Make_Concrete;
B_1 : Base_1'Class := Make_Concrete;
B_2 : Base_2'Class := Make_Concrete;
begin
if B_1.F_1 /= 1 then
raise Program_Error with "bad B_1.F_1 call";
end if;
if B_2.F_2 /= 2 then
raise Program_Error with "bad B_2.F_2 call";
end if;
end Check_Displace_Generation;
|
src/somme_series.adb | zdimension/tdinfo302 | 0 | 19084 | <filename>src/somme_series.adb
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure somme_series is
function somme_entiers (n : Integer; impair : Boolean := False) return Integer is
res : Integer := 0;
begin
for i in 1..n loop
res := res + 2 * i - Boolean'Pos(impair);
end loop;
return res;
end somme_entiers;
function somme_entiers_2 (n : Integer; impair : Boolean := False) return Integer is
res : Integer := n * n;
begin
if not impair then res := res + n; end if;
return res;
end somme_entiers_2;
function somme_fact (n : Integer; x : Integer) return Float is
res : Float := 0.0;
fact : Integer := 1;
puiss : Integer := 1;
begin
for i in 1..n loop
fact := fact * i;
puiss := puiss * x;
res := res + Float(puiss) / Float(fact);
end loop;
return res;
end somme_fact;
N, X : Integer;
begin
Put("Entrez N : "); Get(N);
Put("Pairs : "); Put(somme_entiers(N)); New_Line;
Put("Pairs (2) : "); Put(somme_entiers_2(N)); New_Line;
Put("Impairs : "); Put(somme_entiers(N, True)); New_Line;
Put("Impairs (2) : "); Put(somme_entiers_2(N, True)); New_Line;
Put("Entrez X : "); Get(X);
Put("Résultat : "); Put(somme_fact(N, X), 2, 2, 0);
end somme_series;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1673.asm | ljhsiun2/medusa | 9 | 98566 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xb40e, %rsi
lea addresses_WT_ht+0x18ac3, %rdi
and %rax, %rax
mov $10, %rcx
rep movsw
nop
add $35599, %rdi
lea addresses_D_ht+0xd5a5, %rbx
nop
nop
xor %r12, %r12
mov $0x6162636465666768, %r13
movq %r13, %xmm6
vmovups %ymm6, (%rbx)
nop
nop
nop
and %r13, %r13
lea addresses_UC_ht+0x1e3cf, %rsi
lea addresses_A_ht+0x1efcf, %rdi
nop
nop
nop
nop
sub $38364, %rax
mov $7, %rcx
rep movsl
nop
sub $40029, %rdi
lea addresses_D_ht+0x1d08f, %rsi
clflush (%rsi)
nop
nop
nop
nop
inc %rax
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_WT_ht+0xfb4f, %rdi
clflush (%rdi)
sub $711, %rsi
mov (%rdi), %rcx
nop
cmp %r13, %r13
lea addresses_WC_ht+0x10dcf, %rax
nop
nop
dec %r13
mov $0x6162636465666768, %rbx
movq %rbx, (%rax)
nop
inc %rcx
lea addresses_WC_ht+0x1a4e7, %rsi
lea addresses_A_ht+0x191cf, %rdi
nop
nop
sub %r9, %r9
mov $122, %rcx
rep movsb
nop
nop
nop
nop
nop
and $34113, %rax
lea addresses_WC_ht+0x3e8f, %r12
nop
nop
and $17133, %r9
movb (%r12), %cl
nop
nop
and $12405, %rcx
lea addresses_D_ht+0xf1cf, %rbx
nop
nop
and $8547, %r9
mov $0x6162636465666768, %r13
movq %r13, (%rbx)
nop
nop
nop
nop
nop
dec %rcx
lea addresses_WC_ht+0x187cf, %rcx
nop
inc %r9
mov (%rcx), %eax
nop
nop
nop
add $59781, %rax
lea addresses_normal_ht+0xf0f, %rbx
nop
nop
nop
and %rsi, %rsi
mov (%rbx), %eax
nop
nop
sub %r12, %r12
lea addresses_D_ht+0x5c2f, %rbx
and %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
vmovups %ymm3, (%rbx)
nop
nop
nop
nop
nop
add $59065, %r13
lea addresses_normal_ht+0x1cacb, %rsi
nop
xor %r9, %r9
mov $0x6162636465666768, %r12
movq %r12, (%rsi)
nop
nop
nop
xor $29760, %r12
lea addresses_D_ht+0x1c947, %rbx
nop
nop
nop
nop
nop
cmp $14213, %rsi
mov (%rbx), %r13w
nop
nop
nop
nop
inc %r12
lea addresses_normal_ht+0x4ea7, %rdi
sub $51043, %r13
movups (%rdi), %xmm4
vpextrq $1, %xmm4, %rax
inc %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %r9
push %rdx
push %rsi
// Store
lea addresses_WT+0x1e7cf, %r10
nop
lfence
mov $0x5152535455565758, %r9
movq %r9, %xmm5
movups %xmm5, (%r10)
dec %r15
// Store
lea addresses_UC+0x63cf, %r12
nop
nop
nop
nop
nop
and %r11, %r11
mov $0x5152535455565758, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%r12)
nop
nop
nop
and $27722, %r10
// Store
lea addresses_WT+0x1e78f, %rdx
and %r11, %r11
movb $0x51, (%rdx)
nop
nop
nop
nop
nop
and $51930, %r10
// Load
lea addresses_UC+0x7dcf, %r15
nop
nop
nop
nop
nop
inc %rsi
vmovups (%r15), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %r12
dec %r12
// Store
lea addresses_A+0x1e9cf, %r12
and $16227, %r15
mov $0x5152535455565758, %rdx
movq %rdx, (%r12)
nop
nop
cmp $47788, %r15
// Store
lea addresses_A+0x29cf, %r9
clflush (%r9)
nop
add %rdx, %rdx
movb $0x51, (%r9)
nop
nop
nop
nop
nop
add $54368, %rdx
// Store
lea addresses_WT+0x11543, %rsi
nop
nop
add $42336, %r9
movb $0x51, (%rsi)
cmp $55998, %r15
// Store
lea addresses_WC+0x155cf, %r15
nop
add %r11, %r11
mov $0x5152535455565758, %r10
movq %r10, (%r15)
nop
nop
nop
nop
sub $5054, %r10
// Faulty Load
lea addresses_UC+0x7dcf, %rsi
nop
mfence
mov (%rsi), %rdx
lea oracles, %r12
and $0xff, %rdx
shlq $12, %rdx
mov (%r12,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %r9
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
semester-5/microprocessor/8mul.asm | saranshbht/bsc-codes | 3 | 17257 | <filename>semester-5/microprocessor/8mul.asm
.model small
.data
first db 0ffh
second db 0eeh
msg db "Result: $", 10
.code
.startup
lea dx, msg
mov ah, 09h
int 21h
mov al, first
mul second
mov cx, 4
mov bx, ax
print:
rol bx, 4
mov dl, bl
and dl, 0fh
add dl, 30h
cmp dl, 39h
jbe print1
add dl, 07h
print1:
mov ah, 02h
int 21h
loop print
.exit
end |
test/Succeed/Issue4725.agda | KDr2/agda | 0 | 13973 | <reponame>KDr2/agda
-- Andreas, 2022-06-14, issue #4725 reported by nad
-- The termination checker needs to recognize
-- dotted variable and record patterns as patterns
-- for this example to pass.
-- These should be harmless even with --cubical
-- (dotted constructor patterns are not, see #4606).
-- Keep fingers crossed.
{-# OPTIONS --cubical #-}
open import Agda.Builtin.Sigma
mutual
data D : Set where
d : S → D
S : Set
S = Σ D λ x → R x
fst′ : S → D
fst′ s = fst s
data R : D → Set where
r : ∀ x → R (fst′ x) → R (d x)
module _
(P : D → Set)
(Q : ∀ x → P x → R x → Set)
(p : ∀ s (p : P (fst s)) → Q (fst s) p (snd s) → P (d s))
(q : ∀ s rs (ps : P (fst s)) (qs : Q (fst s) ps (snd s)) →
Q (fst s) ps rs → Q (d s) (p s ps qs) (r s rs))
where
mutual
f : (x : D) → P x
f (d (x , r₁)) = p (x , r₁) (f x) (g x r₁)
g : (x : D) (x⊑y : R x) → Q x (f x) x⊑y
g (d (x , r₁)) (r .(x , r₁) r₂) =
q (x , r₁) r₂ (f x) (g x r₁) (g (fst′ (x , r₁)) r₂)
-- Should termination check.
|
programs/oeis/095/A095266.asm | neoneye/loda | 22 | 87372 | ; A095266: A sequence generated from the Narayana triangle considered as a matrix, or from Pascal's triangle.
; 1,42,303,1144,3105,6906,13447,23808,39249,61210,91311,131352,183313,249354,331815,433216,556257,703818,878959,1084920,1325121,1603162,1922823,2288064,2703025,3172026,3699567,4290328,4949169,5681130
mov $5,$0
mov $6,$0
pow $0,2
mov $2,$0
add $0,$6
mov $1,$2
lpb $1
sub $1,1
add $7,3
add $0,$7
lpe
mul $0,5
add $0,1
add $0,$5
mov $4,$5
mul $4,$5
mul $4,$5
mov $3,$4
mul $3,15
add $0,$3
|
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca_notsx.log_21829_1761.asm | ljhsiun2/medusa | 9 | 28850 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x6c14, %rcx
clflush (%rcx)
nop
dec %rdx
mov (%rcx), %eax
nop
nop
nop
nop
nop
xor %r11, %r11
lea addresses_normal_ht+0x4f14, %r12
nop
nop
and %rdi, %rdi
movw $0x6162, (%r12)
nop
nop
nop
nop
nop
dec %r11
lea addresses_WC_ht+0x174, %rsi
lea addresses_D_ht+0x13174, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp $45627, %r12
mov $15, %rcx
rep movsl
nop
nop
nop
nop
nop
and $15773, %rax
lea addresses_UC_ht+0x15574, %rsi
lea addresses_WC_ht+0x6c54, %rdi
nop
nop
nop
and %r14, %r14
mov $103, %rcx
rep movsl
nop
cmp %rcx, %rcx
lea addresses_D_ht+0x15248, %rdi
dec %rdx
movl $0x61626364, (%rdi)
nop
nop
nop
sub $64965, %r12
lea addresses_WC_ht+0x7df0, %rsi
lea addresses_A_ht+0xe94, %rdi
nop
nop
and %r12, %r12
mov $88, %rcx
rep movsl
nop
nop
nop
and %r14, %r14
lea addresses_D_ht+0x13c74, %rsi
lea addresses_UC_ht+0x13a0, %rdi
nop
lfence
mov $113, %rcx
rep movsb
nop
nop
nop
nop
nop
mfence
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rbx
push %rcx
push %rdx
push %rsi
// Store
mov $0xef8, %r10
nop
nop
nop
nop
sub $12110, %r14
movl $0x51525354, (%r10)
nop
nop
nop
nop
nop
and $27368, %r14
// Store
lea addresses_WC+0x1990a, %rcx
nop
nop
add $45911, %r14
movb $0x51, (%rcx)
nop
nop
nop
xor %r10, %r10
// Store
lea addresses_WT+0x1b174, %rbx
xor $56235, %r13
movb $0x51, (%rbx)
nop
nop
cmp $20195, %r14
// Faulty Load
mov $0x79f53a0000000474, %rsi
nop
dec %rbx
movups (%rsi), %xmm5
vpextrq $0, %xmm5, %r14
lea oracles, %r10
and $0xff, %r14
shlq $12, %r14
mov (%r10,%r14,1), %r14
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
solutions/61 - Lazy Pathways/size-18_speed-203.asm | michaelgundlach/7billionhumans | 45 | 3965 | -- 7 Billion Humans (2145) --
-- 61: Lazy Pathways --
-- Author: landfillbaby
-- Size: 18
-- Speed: 203
a:
mem4 = nearest datacube
step mem4
mem2 = foreachdir nw,w,sw,n,s,ne,e,se:
if mem2 == datacube and
mem2 < mem1 or
mem1 != datacube:
mem1 = set mem2
endif
if mem2 == 99:
mem3 = set mem2
endif
endfor
mem1 = calc mem1 + 1
if mem4 > mem1:
pickup c
write mem1
drop
endif
if mem3 == 99:
step mem3
mem3 = set 0
else:
step nw,w,sw,n,s,e
endif
jump a |
src/test/resources/data/potests/test11.asm | cpcitor/mdlz80optimizer | 36 | 175430 | <gh_stars>10-100
; Test case:
; - lines 3-6 should be optimized
ld a,(var1)
inc a
ld (var1),a
loop4:
jp loop4
var1:
db 0 |
lab_06/inter_1.asm | MrLIVB/BMSTU_MDPL | 0 | 8359 | .model tiny
.code
.186
org 100h
start proc near
mov ax, 351Ch
int 21h
mov word ptr old_int1Ch, bx
mov word ptr old_int1Ch+2, es
;mov ax, 251Ch
;mov dx, offset int1Ch_handler
;int 21h
call int1Ch_handler
mov ah, 1
int 21h
mov ax, 251Ch
mov dx, word ptr old_int1Ch+2
mov ds, dx
mov dx, word ptr cs:old_int1Ch
int 21h
ret
old_int1Ch dd ?
start_position dw 50*0 + 75*2
start endp
int1Ch_handler proc far
pusha
push es
push ds
push cs
pop ds
mov ah, 02h
int 1Ah
jc exit_handler
mov al, ch
call bcd2asc
mov byte ptr output_line[2], ah
mov byte ptr output_line[4], al
mov al, cl
call bcd2asc
mov byte ptr output_line[10], ah
mov byte ptr output_line[12], al
mov al, dh
call bcd2asc
mov byte ptr output_line[16], ah
mov byte ptr output_line[18], al
mov cx, output_line_1
push 0B800h
pop es
mov di, word ptr start_position
mov si, offset output_line
cld
rep movsb
exit_handler:
pop ds
pop es
popa
jmp cs:old_int1Ch
bcd2asc proc near
mov ah, al
and al, 0Fh
shr ah, 4
add al, '0'
add ah, '0'
ret
bcd2asc endp
output_line db ' ',1Fh,'0',1Fh,'0',1Fh,'h',1Fh
db ' ',1Fh,'0',1Fh,'0',1Fh,':',1Fh
db '0',1Fh,'0',1Fh,' ',1Fh
output_line_1 equ $-output_line
int1Ch_handler endp
end start |
Cubical/ZCohomology/CohomologyRings/Unit.agda | thomas-lamiaux/cubical | 0 | 179 | <reponame>thomas-lamiaux/cubical
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.ZCohomology.CohomologyRings.Unit where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.Isomorphism
open import Cubical.Data.Nat renaming (_+_ to _+n_ ; _·_ to _·n_)
open import Cubical.Data.Int
open import Cubical.Data.Vec
open import Cubical.Data.FinData
open import Cubical.Algebra.Group
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
open import Cubical.Algebra.Group.Instances.Int renaming (ℤGroup to ℤG)
open import Cubical.Algebra.DirectSum.DirectSumHIT.Base
open import Cubical.Algebra.Ring
open import Cubical.Algebra.CommRing
open import Cubical.Algebra.CommRing.Instances.Int renaming (ℤCommRing to ℤCR)
open import Cubical.Algebra.CommRing.FGIdeal
open import Cubical.Algebra.CommRing.QuotientRing
open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly
open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly-Quotient
open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly-notationZ
open import Cubical.Algebra.Polynomials.Multivariate.EquivCarac.A[X]X-A
open import Cubical.HITs.Truncation
open import Cubical.HITs.SetQuotients as SQ renaming (_/_ to _/sq_)
open import Cubical.HITs.PropositionalTruncation as PT
open import Cubical.ZCohomology.Base
open import Cubical.ZCohomology.GroupStructure
open import Cubical.ZCohomology.RingStructure.CupProduct
open import Cubical.ZCohomology.RingStructure.CohomologyRing
open import Cubical.ZCohomology.Groups.Unit
open Iso
module Equiv-Unit-Properties where
open CommRingStr (snd ℤCR) using ()
renaming
( 0r to 0ℤ
; 1r to 1ℤ
; _+_ to _+ℤ_
; -_ to -ℤ_
; _·_ to _·ℤ_
; +Assoc to +ℤAssoc
; +IdL to +ℤIdL
; +IdR to +ℤIdR
; +Comm to +ℤComm
; ·Assoc to ·ℤAssoc
; ·IdL to ·ℤIdL
; ·IdR to ·ℤIdR
; ·DistR+ to ·ℤDistR+
; is-set to isSetℤ )
open RingStr (snd (H*R Unit)) using ()
renaming
( 0r to 0H*
; 1r to 1H*
; _+_ to _+H*_
; -_ to -H*_
; _·_ to _cup_
; +Assoc to +H*Assoc
; +IdL to +H*IdL
; +IdR to +H*IdR
; +Comm to +H*Comm
; ·Assoc to ·H*Assoc
; ·IdL to ·H*IdL
; ·IdR to ·H*IdR
; ·DistR+ to ·H*DistR+
; is-set to isSetH* )
open CommRingStr (snd ℤ[X]) using ()
renaming
( 0r to 0Pℤ
; 1r to 1Pℤ
; _+_ to _+Pℤ_
; -_ to -Pℤ_
; _·_ to _·Pℤ_
; +Assoc to +PℤAssoc
; +IdL to +PℤIdL
; +IdR to +PℤIdR
; +Comm to +PℤComm
; ·Assoc to ·PℤAssoc
; ·IdL to ·PℤIdL
; ·IdR to ·PℤIdR
; ·DistR+ to ·PℤDistR+
; is-set to isSetPℤ )
open CommRingStr (snd ℤ[X]/X) using ()
renaming
( 0r to 0PℤI
; 1r to 1PℤI
; _+_ to _+PℤI_
; -_ to -PℤI_
; _·_ to _·PℤI_
; +Assoc to +PℤIAssoc
; +IdL to +PℤIIdL
; +IdR to +PℤIIdR
; +Comm to +PℤIComm
; ·Assoc to ·PℤIAssoc
; ·IdL to ·PℤIIdL
; ·IdR to ·PℤIIdR
; ·DistR+ to ·PℤIDistR+
; is-set to isSetPℤI )
-----------------------------------------------------------------------------
-- Direct Sens on ℤ[x]
ℤ[x]→H*-Unit : ℤ[x] → H* Unit
ℤ[x]→H*-Unit = DS-Rec-Set.f _ _ _ _ isSetH*
0H*
base-trad
_+H*_
+H*Assoc
+H*IdR
+H*Comm
base-neutral-eq
base-add-eq
where
base-trad : _
base-trad (zero ∷ []) a = base zero (inv (fst H⁰-Unit≅ℤ) a)
base-trad (suc n ∷ []) a = 0H*
base-neutral-eq : _
base-neutral-eq (zero ∷ []) = base-neutral _
base-neutral-eq (suc n ∷ []) = refl
base-add-eq : _
base-add-eq (zero ∷ []) a b = base-add _ _ _
base-add-eq (suc n ∷ []) a b = +H*IdR _
ℤ[x]→H*-Unit-pres1Pℤ : ℤ[x]→H*-Unit (1Pℤ) ≡ 1H*
ℤ[x]→H*-Unit-pres1Pℤ = refl
ℤ[x]→H*-Unit-pres+ : (x y : ℤ[x]) → ℤ[x]→H*-Unit (x +Pℤ y) ≡ ℤ[x]→H*-Unit x +H* ℤ[x]→H*-Unit y
ℤ[x]→H*-Unit-pres+ x y = refl
-- -- Proving the morphism on the cup product
T0 : (z : ℤ) → coHom 0 Unit
T0 = λ z → inv (fst H⁰-Unit≅ℤ) z
T0g : IsGroupHom (ℤG .snd) (fst (invGroupIso H⁰-Unit≅ℤ) .fun) (coHomGr 0 Unit .snd)
T0g = snd (invGroupIso H⁰-Unit≅ℤ)
-- idea : control of the unfolding + simplification of T0 on the left
pres·-base-case-00 : (a : ℤ) → (b : ℤ) →
T0 (a ·ℤ b) ≡ (T0 a) ⌣ (T0 b)
pres·-base-case-00 (pos zero) b = (IsGroupHom.pres1 T0g)
pres·-base-case-00 (pos (suc n)) b = ((IsGroupHom.pres· T0g b (pos n ·ℤ b)))
∙ (cong (λ X → (T0 b) +ₕ X) (pres·-base-case-00 (pos n) b))
pres·-base-case-00 (negsuc zero) b = IsGroupHom.presinv T0g b
pres·-base-case-00 (negsuc (suc n)) b = cong T0 (+ℤComm (-ℤ b) (negsuc n ·ℤ b)) -- ·ℤ and ·₀ are defined asymetrically !
∙ IsGroupHom.pres· T0g (negsuc n ·ℤ b) (-ℤ b)
∙ cong₂ _+ₕ_ (pres·-base-case-00 (negsuc n) b)
(IsGroupHom.presinv T0g b)
pres·-base-case-int : (n : ℕ) → (a : ℤ) → (m : ℕ) → (b : ℤ) →
ℤ[x]→H*-Unit (base (n ∷ []) a ·Pℤ base (m ∷ []) b)
≡ ℤ[x]→H*-Unit (base (n ∷ []) a) cup ℤ[x]→H*-Unit (base (m ∷ []) b)
pres·-base-case-int zero a zero b = cong (base 0) (pres·-base-case-00 a b)
pres·-base-case-int zero a (suc m) b = refl
pres·-base-case-int (suc n) a m b = refl
pres·-base-case-vec : (v : Vec ℕ 1) → (a : ℤ) → (v' : Vec ℕ 1) → (b : ℤ) →
ℤ[x]→H*-Unit (base v a ·Pℤ base v' b)
≡ ℤ[x]→H*-Unit (base v a) cup ℤ[x]→H*-Unit (base v' b)
pres·-base-case-vec (n ∷ []) a (m ∷ []) b = pres·-base-case-int n a m b
ℤ[x]→H*-Unit-pres· : (x y : ℤ[x]) → ℤ[x]→H*-Unit (x ·Pℤ y) ≡ ℤ[x]→H*-Unit x cup ℤ[x]→H*-Unit y
ℤ[x]→H*-Unit-pres· = DS-Ind-Prop.f _ _ _ _
(λ x p q i y j → isSetH* _ _ (p y) (q y) i j)
(λ y → refl)
base-case
λ {U V} ind-U ind-V y → cong₂ _+H*_ (ind-U y) (ind-V y)
where
base-case : _
base-case (n ∷ []) a = DS-Ind-Prop.f _ _ _ _ (λ _ → isSetH* _ _)
(sym (RingTheory.0RightAnnihilates (H*R Unit) _))
(λ v' b → pres·-base-case-vec (n ∷ []) a v' b)
λ {U V} ind-U ind-V → (cong₂ _+H*_ ind-U ind-V) ∙ sym (·H*DistR+ _ _ _)
-- raising to the product
ℤ[x]→H*-Unit-cancelX : (k : Fin 1) → ℤ[x]→H*-Unit (<X> k) ≡ 0H*
ℤ[x]→H*-Unit-cancelX zero = refl
ℤ[X]→H*-Unit : RingHom (CommRing→Ring ℤ[X]) (H*R Unit)
fst ℤ[X]→H*-Unit = ℤ[x]→H*-Unit
snd ℤ[X]→H*-Unit = makeIsRingHom ℤ[x]→H*-Unit-pres1Pℤ ℤ[x]→H*-Unit-pres+ ℤ[x]→H*-Unit-pres·
ℤ[X]/X→H*R-Unit : RingHom (CommRing→Ring ℤ[X]/X) (H*R Unit)
ℤ[X]/X→H*R-Unit = Quotient-FGideal-CommRing-Ring.inducedHom ℤ[X] (H*R Unit) ℤ[X]→H*-Unit <X> ℤ[x]→H*-Unit-cancelX
ℤ[x]/x→H*-Unit : ℤ[x]/x → H* Unit
ℤ[x]/x→H*-Unit = fst ℤ[X]/X→H*R-Unit
-----------------------------------------------------------------------------
-- Converse Sens on ℤ[X]
H*-Unit→ℤ[x] : H* Unit → ℤ[x]
H*-Unit→ℤ[x] = DS-Rec-Set.f _ _ _ _ isSetPℤ
0Pℤ
base-trad
_+Pℤ_
+PℤAssoc
+PℤIdR
+PℤComm
base-neutral-eq
base-add-eq
where
base-trad : (n : ℕ) → coHom n Unit → ℤ[x]
base-trad zero a = base (0 ∷ []) (fun (fst H⁰-Unit≅ℤ) a)
base-trad (suc n) a = 0Pℤ
base-neutral-eq : _
base-neutral-eq zero = base-neutral _
base-neutral-eq (suc n) = refl
base-add-eq : _
base-add-eq zero a b = base-add _ _ _
∙ cong (base (0 ∷ [])) (sym (IsGroupHom.pres· (snd H⁰-Unit≅ℤ) a b))
base-add-eq (suc n) a b = +PℤIdR _
H*-Unit→ℤ[x]-pres+ : (x y : H* Unit) → H*-Unit→ℤ[x] ( x +H* y) ≡ H*-Unit→ℤ[x] x +Pℤ H*-Unit→ℤ[x] y
H*-Unit→ℤ[x]-pres+ x y = refl
H*-Unit→ℤ[x]/x : H* Unit → ℤ[x]/x
H*-Unit→ℤ[x]/x = [_] ∘ H*-Unit→ℤ[x]
H*-Unit→ℤ[x]/x-pres+ : (x y : H* Unit) → H*-Unit→ℤ[x]/x (x +H* y) ≡ (H*-Unit→ℤ[x]/x x) +PℤI (H*-Unit→ℤ[x]/x y)
H*-Unit→ℤ[x]/x-pres+ x y = cong [_] (H*-Unit→ℤ[x]-pres+ x y)
-----------------------------------------------------------------------------
-- Section
e-sect : (x : H* Unit) → ℤ[x]/x→H*-Unit (H*-Unit→ℤ[x]/x x) ≡ x
e-sect = DS-Ind-Prop.f _ _ _ _ (λ _ → isSetH* _ _)
refl
base-case
λ {U V} ind-U ind-V → cong ℤ[x]/x→H*-Unit (H*-Unit→ℤ[x]/x-pres+ U V)
∙ IsRingHom.pres+ (snd ℤ[X]/X→H*R-Unit) (H*-Unit→ℤ[x]/x U) (H*-Unit→ℤ[x]/x V)
∙ cong₂ _+H*_ ind-U ind-V
where
base-case : _
base-case zero a = cong (base 0) (leftInv (fst H⁰-Unit≅ℤ) a)
base-case (suc n) a = (sym (base-neutral (suc n)))
∙ (cong (base (suc n)) ((isContr→isProp (isContrHⁿ-Unit n) _ a)))
-----------------------------------------------------------------------------
-- Retraction
e-retr : (x : ℤ[x]/x) → H*-Unit→ℤ[x]/x (ℤ[x]/x→H*-Unit x) ≡ x
e-retr = SQ.elimProp (λ _ → isSetPℤI _ _)
(DS-Ind-Prop.f _ _ _ _ (λ _ → isSetPℤI _ _)
refl
base-case
λ {U V} ind-U ind-V → cong₂ _+PℤI_ ind-U ind-V)
where
base-case : _
base-case (zero ∷ []) a = refl
base-case (suc n ∷ []) a = eq/ 0Pℤ (base (suc n ∷ []) a) ∣ ((λ x → base (n ∷ []) (-ℤ a)) , foo) ∣₁
where
foo : (0Pℤ +Pℤ base (suc n ∷ []) (- a)) ≡ (base (n +n 1 ∷ []) (- a · pos 1) +Pℤ 0Pℤ)
foo = (0Pℤ +Pℤ base (suc n ∷ []) (- a)) ≡⟨ +PℤIdL _ ⟩
base (suc n ∷ []) (- a) ≡⟨ cong₂ base (cong (λ X → X ∷ []) (sym ((+-suc n 0)
∙ (cong suc (+-zero n))))) (sym (·ℤIdR _)) ⟩
base (n +n suc 0 ∷ []) (- a ·ℤ 1ℤ) ≡⟨ refl ⟩
base (n +n 1 ∷ []) (- a · pos 1) ≡⟨ sym (+PℤIdR _) ⟩
(base (n +n 1 ∷ []) (- a · pos 1) +Pℤ 0Pℤ) ∎
-----------------------------------------------------------------------------
-- Computation of the Cohomology Ring
module _ where
open Equiv-Unit-Properties
open RingEquivs
Unit-CohomologyRingP : RingEquiv (CommRing→Ring ℤ[X]/X) (H*R Unit)
fst Unit-CohomologyRingP = isoToEquiv is
where
is : Iso ℤ[x]/x (H* Unit)
fun is = ℤ[x]/x→H*-Unit
inv is = H*-Unit→ℤ[x]/x
rightInv is = e-sect
leftInv is = e-retr
snd Unit-CohomologyRingP = snd ℤ[X]/X→H*R-Unit
CohomologyRing-UnitP : RingEquiv (H*R Unit) (CommRing→Ring ℤ[X]/X)
CohomologyRing-UnitP = invRingEquiv Unit-CohomologyRingP
Unit-CohomologyRingℤ : RingEquiv (CommRing→Ring ℤCR) (H*R Unit)
Unit-CohomologyRingℤ = compRingEquiv (invRingEquiv Equiv-ℤ[X]/X-ℤ) Unit-CohomologyRingP
CohomologyRing-Unitℤ : RingEquiv (H*R Unit) (CommRing→Ring ℤCR)
CohomologyRing-Unitℤ = compRingEquiv CohomologyRing-UnitP Equiv-ℤ[X]/X-ℤ
|
source/s-initia.adb | ytomino/drake | 33 | 11287 | <filename>source/s-initia.adb
with Ada.Unchecked_Deallocation;
with System.Address_To_Named_Access_Conversions;
with System.Storage_Pools.Overlaps;
package body System.Initialization is
pragma Suppress (All_Checks);
type Object_Access is access all Object;
for Object_Access'Storage_Pool use Storage_Pools.Overlaps.Pool.all;
procedure Free is
new Ada.Unchecked_Deallocation (Object, Object_Access);
package OA_Conv is
new Address_To_Named_Access_Conversions (Object, Object_Access);
-- implementation
function New_Object (Storage : not null access Object_Storage)
return Object_Pointer
is
type Storage_Access is access all Object_Storage; -- local type
for Storage_Access'Storage_Size use 0;
package SA_Conv is
new Address_To_Named_Access_Conversions (
Object_Storage,
Storage_Access);
begin
if Object'Has_Access_Values
or else Object'Has_Tagged_Values
or else Object'Size > Standard'Word_Size * 8 -- large object
then
Storage_Pools.Overlaps.Set_Address (
SA_Conv.To_Address (Storage_Access (Storage)));
return Object_Pointer (Object_Access'(new Object));
else
declare
Item : Object; -- default initialized
pragma Unmodified (Item);
Result : constant Object_Pointer :=
Object_Pointer (
OA_Conv.To_Pointer (
SA_Conv.To_Address (Storage_Access (Storage))));
begin
Result.all := Item;
return Result;
end;
end if;
end New_Object;
function New_Object (
Storage : not null access Object_Storage;
Value : Object)
return Object_Pointer
is
type Storage_Access is access all Object_Storage; -- local type
for Storage_Access'Storage_Size use 0;
package SA_Conv is
new Address_To_Named_Access_Conversions (
Object_Storage,
Storage_Access);
begin
if Object'Has_Access_Values or else Object'Has_Tagged_Values then
Storage_Pools.Overlaps.Set_Address (
SA_Conv.To_Address (Storage_Access (Storage)));
return Object_Pointer (Object_Access'(new Object'(Value)));
else
declare
Result : constant Object_Pointer :=
Object_Pointer (
OA_Conv.To_Pointer (
SA_Conv.To_Address (Storage_Access (Storage))));
begin
Result.all := Value;
return Result;
end;
end if;
end New_Object;
procedure Delete_Object (Storage : not null access Object_Storage) is
type Storage_Access is access all Object_Storage; -- local type
for Storage_Access'Storage_Size use 0;
package SA_Conv is
new Address_To_Named_Access_Conversions (
Object_Storage,
Storage_Access);
begin
if Object'Has_Access_Values or else Object'Has_Tagged_Values then
declare
A : constant Address :=
SA_Conv.To_Address (Storage_Access (Storage));
X : Object_Access := OA_Conv.To_Pointer (A);
begin
Storage_Pools.Overlaps.Set_Address (A);
Free (X);
end;
end if;
end Delete_Object;
end System.Initialization;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_2318.asm | ljhsiun2/medusa | 9 | 19183 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x14ff3, %r11
clflush (%r11)
nop
nop
nop
nop
nop
xor %rsi, %rsi
vmovups (%r11), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %r12
nop
nop
nop
cmp $33548, %rbx
lea addresses_normal_ht+0x1b04d, %rsi
lea addresses_normal_ht+0x1db73, %rdi
nop
nop
dec %rbx
mov $57, %rcx
rep movsl
nop
nop
nop
add $19186, %r11
lea addresses_D_ht+0xbef3, %rbx
nop
nop
nop
nop
nop
sub $58014, %r10
mov (%rbx), %r11
dec %r12
lea addresses_D_ht+0xf6f3, %rsi
lea addresses_UC_ht+0xad0f, %rdi
nop
xor $52434, %rbp
mov $127, %rcx
rep movsl
nop
nop
nop
nop
cmp $23609, %r11
lea addresses_normal_ht+0x42f3, %r10
nop
nop
and %r12, %r12
movb (%r10), %r11b
nop
nop
dec %rbp
lea addresses_WT_ht+0x52b3, %rdi
dec %r10
mov $0x6162636465666768, %rbx
movq %rbx, %xmm4
movups %xmm4, (%rdi)
nop
nop
add $49033, %rbx
lea addresses_UC_ht+0xcdf3, %rsi
mfence
movups (%rsi), %xmm5
vpextrq $1, %xmm5, %rbp
nop
nop
nop
xor %rsi, %rsi
lea addresses_A_ht+0x14d53, %r12
nop
inc %rbx
mov $0x6162636465666768, %rcx
movq %rcx, (%r12)
nop
nop
nop
nop
sub %rbx, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rbx
// Faulty Load
lea addresses_WC+0x22f3, %r10
nop
nop
nop
nop
nop
add %r8, %r8
movaps (%r10), %xmm6
vpextrq $0, %xmm6, %rbx
lea oracles, %r10
and $0xff, %rbx
shlq $12, %rbx
mov (%r10,%rbx,1), %rbx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/Equivalence-relation.agda | nad/equality | 3 | 13215 | ------------------------------------------------------------------------
-- Equivalence relations
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Equality
module Equivalence-relation
{e⁺} (eq : ∀ {a p} → Equality-with-J a p e⁺) where
open Derived-definitions-and-properties eq
open import Prelude
open import H-level eq
open import H-level.Closure eq
private
variable
a r r₁ r₂ : Level
A A₁ A₂ B B₁ B₂ C : Type a
R R₁ R₂ : A → B → Type r
------------------------------------------------------------------------
-- The definition
-- The definition of "equivalence relation".
record Is-equivalence-relation
{A : Type a} (R : A → A → Type r) : Type (a ⊔ r) where
field
reflexive : ∀ {x} → R x x
symmetric : ∀ {x y} → R x y → R y x
transitive : ∀ {x y z} → R x y → R y z → R x z
------------------------------------------------------------------------
-- Some examples of equivalence relations/equivalence relation
-- transformers
-- A trivial binary relation.
Trivial : A → B → Type r
Trivial _ _ = ↑ _ ⊤
-- Homogeneous instances of Trivial are equivalence relations.
Trivial-is-equivalence-relation :
Is-equivalence-relation (Trivial {A = A} {r = r})
Trivial-is-equivalence-relation = _
-- Trivial is propositional.
Trivial-is-propositional :
{x y : A} → Is-proposition (Trivial {r = r} x y)
Trivial-is-propositional = ↑-closure 1 (mono₁ 0 ⊤-contractible)
-- The superscript P used in the names of the definitions in this
-- section stands for "pointwise".
-- Lifts binary relations from B to A → B.
infix 0 _→ᴾ_
_→ᴾ_ :
(A : Type a) →
(B → C → Type r) →
((A → B) → (A → C) → Type (a ⊔ r))
(_ →ᴾ R) f g = ∀ x → R (f x) (g x)
-- _→ᴾ_ preserves equivalence relations.
→ᴾ-preserves-Is-equivalence-relation :
Is-equivalence-relation R →
Is-equivalence-relation (A →ᴾ R)
→ᴾ-preserves-Is-equivalence-relation R-equiv = record
{ reflexive = λ _ → reflexive
; symmetric = λ f∼g x → symmetric (f∼g x)
; transitive = λ f∼g g∼h x → transitive (f∼g x) (g∼h x)
}
where
open Is-equivalence-relation R-equiv
-- _→ᴾ_ preserves Is-proposition (assuming extensionality).
→ᴾ-preserves-Is-proposition :
{A : Type a} (R : B → C → Type r) →
Extensionality a r →
(∀ {x y} → Is-proposition (R x y)) →
∀ {f g} → Is-proposition ((A →ᴾ R) f g)
→ᴾ-preserves-Is-proposition _ ext R-prop =
Π-closure ext 1 λ _ →
R-prop
-- Lifts binary relations from A and B to A ⊎ B.
infixr 1 _⊎ᴾ_
_⊎ᴾ_ :
(A₁ → A₂ → Type r) →
(B₁ → B₂ → Type r) →
(A₁ ⊎ B₁ → A₂ ⊎ B₂ → Type r)
(P ⊎ᴾ Q) (inj₁ x) (inj₁ y) = P x y
(P ⊎ᴾ Q) (inj₂ x) (inj₂ y) = Q x y
(P ⊎ᴾ Q) _ _ = ⊥
-- _⊎ᴾ_ preserves Is-equivalence-relation.
⊎ᴾ-preserves-Is-equivalence-relation :
Is-equivalence-relation R₁ →
Is-equivalence-relation R₂ →
Is-equivalence-relation (R₁ ⊎ᴾ R₂)
⊎ᴾ-preserves-Is-equivalence-relation R₁-equiv R₂-equiv = record
{ reflexive = λ { {x = inj₁ _} → reflexive R₁-equiv
; {x = inj₂ _} → reflexive R₂-equiv
}
; symmetric = λ { {x = inj₁ _} {y = inj₁ _} → symmetric R₁-equiv
; {x = inj₂ _} {y = inj₂ _} → symmetric R₂-equiv
; {x = inj₁ _} {y = inj₂ _} ()
; {x = inj₂ _} {y = inj₁ _} ()
}
; transitive = λ
{ {x = inj₁ _} {y = inj₁ _} {z = inj₁ _} → transitive R₁-equiv
; {x = inj₂ _} {y = inj₂ _} {z = inj₂ _} → transitive R₂-equiv
; {x = inj₁ _} {y = inj₂ _} ()
; {x = inj₂ _} {y = inj₁ _} ()
; {y = inj₁ _} {z = inj₂ _} _ ()
; {y = inj₂ _} {z = inj₁ _} _ ()
}
}
where
open Is-equivalence-relation
-- _⊎ᴾ_ preserves Is-proposition.
⊎ᴾ-preserves-Is-proposition :
(∀ {x y} → Is-proposition (R₁ x y)) →
(∀ {x y} → Is-proposition (R₂ x y)) →
∀ {x y} → Is-proposition ((R₁ ⊎ᴾ R₂) x y)
⊎ᴾ-preserves-Is-proposition = λ where
R₁-prop R₂-prop {inj₁ _} {inj₁ _} → R₁-prop
R₁-prop R₂-prop {inj₁ _} {inj₂ _} → ⊥-propositional
R₁-prop R₂-prop {inj₂ _} {inj₁ _} → ⊥-propositional
R₁-prop R₂-prop {inj₂ _} {inj₂ _} → R₂-prop
-- Lifts a binary relation from A to Maybe A.
Maybeᴾ :
(A → B → Type r) →
(Maybe A → Maybe B → Type r)
Maybeᴾ R = Trivial ⊎ᴾ R
-- Maybeᴾ preserves Is-equivalence-relation.
Maybeᴾ-preserves-Is-equivalence-relation :
Is-equivalence-relation R →
Is-equivalence-relation (Maybeᴾ R)
Maybeᴾ-preserves-Is-equivalence-relation =
⊎ᴾ-preserves-Is-equivalence-relation Trivial-is-equivalence-relation
-- Maybeᴾ preserves Is-proposition.
Maybeᴾ-preserves-Is-proposition :
(∀ {x y} → Is-proposition (R x y)) →
∀ {x y} → Is-proposition (Maybeᴾ R x y)
Maybeᴾ-preserves-Is-proposition =
⊎ᴾ-preserves-Is-proposition λ {x} →
Trivial-is-propositional {x = x}
-- Lifts binary relations from A and B to A × B.
infixr 2 _×ᴾ_
_×ᴾ_ :
(A₁ → B₁ → Type r₁) →
(A₂ → B₂ → Type r₂) →
(A₁ × A₂ → B₁ × B₂ → Type (r₁ ⊔ r₂))
(P ×ᴾ Q) (x₁ , x₂) (y₁ , y₂) = P x₁ y₁ × Q x₂ y₂
-- _×ᴾ_ preserves Is-equivalence-relation.
×ᴾ-preserves-Is-equivalence-relation :
Is-equivalence-relation R₁ →
Is-equivalence-relation R₂ →
Is-equivalence-relation (R₁ ×ᴾ R₂)
×ᴾ-preserves-Is-equivalence-relation R₁-equiv R₂-equiv = λ where
.Is-equivalence-relation.reflexive →
E₁.reflexive , E₂.reflexive
.Is-equivalence-relation.symmetric →
Σ-map E₁.symmetric E₂.symmetric
.Is-equivalence-relation.transitive →
Σ-zip E₁.transitive E₂.transitive
where
module E₁ = Is-equivalence-relation R₁-equiv
module E₂ = Is-equivalence-relation R₂-equiv
-- _×ᴾ_ preserves Is-proposition.
×ᴾ-preserves-Is-proposition :
(∀ {x y} → Is-proposition (R₁ x y)) →
(∀ {x y} → Is-proposition (R₂ x y)) →
∀ {x y} → Is-proposition ((R₁ ×ᴾ R₂) x y)
×ᴾ-preserves-Is-proposition R₁-prop R₂-prop =
×-closure 1 R₁-prop R₂-prop
|
tpantlr2-code/code/lexmagic/ModeTagsLexer.g4 | cgonul/antlr-poc | 10 | 6807 | lexer grammar ModeTagsLexer;
// Default mode rules (the SEA)
OPEN : '<' -> mode(ISLAND) ; // switch to ISLAND mode
TEXT : ~'<'+ ; // clump all text together
mode ISLAND;
CLOSE : '>' -> mode(DEFAULT_MODE) ; // back to SEA mode
SLASH : '/' ;
ID : [a-zA-Z]+ ; // match/send ID in tag to parser
|
oeis/271/A271995.asm | neoneye/loda-programs | 11 | 22254 | ; A271995: The Pnictogen sequence: a(n) = A018227(n)-3.
; Submitted by <NAME>(s4)
; 7,15,33,51,83,115,165,215,287,359,457,555,683,811,973,1135,1335,1535,1777,2019,2307,2595,2933,3271,3663,4055,4505,4955,5467,5979,6557,7135,7783,8431,9153,9875,10675,11475,12357,13239,14207,15175,16233,17291,18443,19595,20845,22095,23447,24799,26257,27715,29283,30851,32533,34215,36015,37815,39737,41659,43707,45755,47933,50111,52423,54735,57185,59635,62227,64819,67557,70295,73183,76071,79113,82155,85355,88555,91917,95279,98807,102335,106033,109731,113603,117475,121525,125575,129807,134039,138457
add $0,4
mov $1,$0
pow $0,2
mov $2,4
gcd $2,$0
add $0,$2
sub $0,2
mul $1,$0
mov $0,$1
div $0,6
sub $0,5
|
Cubical/Algebra/Semigroup/Construct/Left.agda | bijan2005/univalent-foundations | 0 | 14162 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
open import Cubical.Core.Everything
open import Cubical.Foundations.HLevels
module Cubical.Algebra.Semigroup.Construct.Left {ℓ} (Aˢ : hSet ℓ) where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.Semigroup
import Cubical.Algebra.Magma.Construct.Left Aˢ as LMagma
open LMagma public hiding (Left-isMagma; LeftMagma)
private
A = ⟨ Aˢ ⟩
isSetA = Aˢ .snd
◂-assoc : Associative _◂_
◂-assoc _ _ _ = refl
Left-isSemigroup : IsSemigroup A _◂_
Left-isSemigroup = record
{ isMagma = LMagma.Left-isMagma
; assoc = ◂-assoc
}
LeftSemigroup : Semigroup ℓ
LeftSemigroup = record { isSemigroup = Left-isSemigroup }
|
programs/oeis/147/A147534.asm | neoneye/loda | 22 | 93271 | <gh_stars>10-100
; A147534: a(n) is congruent to (1,1,2) mod 3.
; 1,1,2,4,4,5,7,7,8,10,10,11,13,13,14,16,16,17,19,19,20,22,22,23,25,25,26,28,28,29,31,31,32,34,34,35,37,37,38,40,40,41,43,43,44,46,46,47,49,49,50,52,52,53,55,55,56,58,58,59,61,61,62,64,64,65,67,67,68,70,70,71
mov $1,$0
gcd $1,3
div $1,3
add $0,$1
|
oeis/048/A048700.asm | neoneye/loda-programs | 11 | 13323 | <gh_stars>10-100
; A048700: Binary palindromes of odd length (written in base 10).
; Submitted by <NAME>
; 1,5,7,17,21,27,31,65,73,85,93,99,107,119,127,257,273,297,313,325,341,365,381,387,403,427,443,455,471,495,511,1025,1057,1105,1137,1161,1193,1241,1273,1285,1317,1365,1397,1421,1453,1501,1533,1539,1571,1619,1651,1675,1707,1755,1787,1799,1831,1879,1911,1935,1967,2015,2047,4097,4161,4257,4321,4369,4433,4529,4593,4617,4681,4777,4841,4889,4953,5049,5113,5125,5189,5285,5349,5397,5461,5557,5621,5645,5709,5805,5869,5917,5981,6077,6141,6147,6211,6307,6371,6419
mov $1,$0
lpb $1
mul $0,2
sub $1,1
div $1,2
mov $2,1
add $2,$1
mod $2,2
add $2,1
add $0,$2
lpe
add $0,1
|
programs/oeis/128/A128428.asm | neoneye/loda | 22 | 14912 | <gh_stars>10-100
; A128428: Number of distinct prime factors of n^2+1.
; 1,1,2,1,2,1,2,2,2,1,2,2,3,1,2,1,3,2,2,1,3,2,3,1,2,1,3,2,2,2,3,2,3,2,2,1,3,2,2,1,2,2,3,2,2,2,4,2,2,2,2,2,3,1,3,1,3,2,2,2,2,2,3,2,2,1,3,2,2,2,2,3,4,1,3,2,3,2,2,2,3,2,4,1,2,2,3,2,3,1,3,2,3,1,2,2,3,3,3,2
add $0,1
pow $0,2
seq $0,1221 ; Number of distinct primes dividing n (also called omega(n)).
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_1_270.asm | ljhsiun2/medusa | 9 | 5739 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_1_270.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1e779, %rsi
lea addresses_normal_ht+0x13499, %rdi
nop
nop
nop
nop
nop
cmp $20799, %r8
mov $50, %rcx
rep movsw
nop
nop
nop
cmp %rdx, %rdx
lea addresses_UC_ht+0xd09, %r11
nop
nop
dec %r13
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
and $0xffffffffffffffc0, %r11
movaps %xmm4, (%r11)
nop
cmp %rdx, %rdx
lea addresses_WC_ht+0x1cc89, %r11
clflush (%r11)
nop
nop
nop
nop
cmp $50047, %rdi
mov $0x6162636465666768, %r8
movq %r8, %xmm2
vmovups %ymm2, (%r11)
nop
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_WC_ht+0x155b9, %r11
clflush (%r11)
xor $35795, %rdx
movb (%r11), %cl
nop
nop
nop
nop
cmp $34439, %r8
lea addresses_UC_ht+0x1d79, %rsi
lea addresses_normal_ht+0x33c7, %rdi
nop
nop
cmp %r15, %r15
mov $64, %rcx
rep movsb
nop
cmp $48467, %rdx
lea addresses_normal_ht+0x41f5, %rsi
lea addresses_normal_ht+0x9a79, %rdi
nop
nop
nop
nop
inc %r11
mov $29, %rcx
rep movsw
nop
nop
nop
and $14083, %r11
lea addresses_D_ht+0x1eca5, %r13
nop
nop
add $18360, %rdi
movl $0x61626364, (%r13)
nop
lfence
lea addresses_WC_ht+0xcf79, %r8
xor $20459, %r11
mov (%r8), %edx
nop
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_A_ht+0x14b79, %rdi
nop
nop
nop
sub $27290, %rdx
movw $0x6162, (%rdi)
nop
nop
sub %rdi, %rdi
lea addresses_UC_ht+0x1de41, %rsi
lea addresses_D_ht+0x1dd5d, %rdi
nop
nop
nop
nop
dec %r8
mov $48, %rcx
rep movsb
nop
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_normal_ht+0xf0b9, %rsi
nop
and $59739, %r8
movw $0x6162, (%rsi)
add %r11, %r11
lea addresses_UC_ht+0x5779, %rsi
lea addresses_WC_ht+0x14279, %rdi
nop
nop
nop
cmp $6716, %r13
mov $111, %rcx
rep movsl
nop
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_UC_ht+0x1b7b0, %rdi
sub %rdx, %rdx
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
add %r15, %r15
lea addresses_D_ht+0x1e481, %r8
nop
nop
inc %rsi
mov (%r8), %r13w
nop
cmp $7985, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x1b899, %rsi
lea addresses_A+0xb379, %rdi
nop
nop
nop
xor %rbx, %rbx
mov $119, %rcx
rep movsw
nop
nop
add $2181, %rbx
// Faulty Load
lea addresses_A+0xb379, %rdi
nop
nop
nop
nop
nop
and $12361, %rcx
mov (%rdi), %si
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'00': 1}
00
*/
|
4rth-Sem-Ise/Microprocessors -X86-/files.asm | mvnsia/4th_Sem_Ise | 0 | 12087 | <filename>4rth-Sem-Ise/Microprocessors -X86-/files.asm
assume cs:code, ds:data
disp macro str3
lea dx,str3
mov ah,0Dh
int 21h
mov ah,09h
int 21h
endm
data segment
fname2 db "shashi.txt"
msg1 db "File created successfully $" ;pass your own message to verify
fname1 db "emp.dat"
msg2 db "File deleted successfully$"
data ends
code segment
start:
mov ax,@data
mov ds,ax
mov ah,3ch
mov cx,00
lea dx,fname2
int 21h
disp msg1
mov ah,41h
lea dx,fname1
int 21h
disp msg2
mov ah,4ch
int 21h
code ends
end start
|
game/logic/game_states/credits_screen.asm | pompshuffle/super-tilt-bro | 2 | 81788 | init_credits_screen:
.(
.(
line_num = $0005
char_cursor_low = $0006
char_cursor_high = $0007
; Copy menus tileset in CHR-RAM
jsr set_menu_chr
SWITCH_BANK(#DATA_BANK_NUMBER)
; Construct nt buffers for palettes (to avoid changing it mid-frame)
lda #<palette_title
sta tmpfield1
lda #>palette_title
sta tmpfield2
jsr construct_palettes_nt_buffer
; Clear background
lda #$00
sta $40
sta $41
lda PPUSTATUS
lda #$20
sta PPUADDR
lda #$00
sta PPUADDR
load_background:
lda #$00
sta PPUDATA
inc $40
bne end_inc_vector
inc $41
end_inc_vector:
lda #$04
cmp $41
bne load_background
lda #$00
cmp $40
bne load_background
; Pimp nametable attributes
lda PPUSTATUS
lda #$23
sta PPUADDR
lda #$c0
sta PPUADDR
lda #%10100101
jsr fill_attributes_line
lda #%10100000
jsr fill_attributes_line
lda #%00000000
jsr fill_attributes_line
lda #%00000000
jsr fill_attributes_line
lda #%00000000
jsr fill_attributes_line
lda #%10100000
jsr fill_attributes_line
lda PPUSTATUS
lda #$23
sta PPUADDR
lda #$c0
sta PPUADDR
; Write credits
lda #1
sta line_num
lda #<credits_begin
sta char_cursor_low
lda #>credits_begin
sta char_cursor_high
ldy #0
write_one_line:
lda #32 ;
sta tmpfield1 ;
lda #0 ;
sta tmpfield2 ;
lda line_num ;
sta tmpfield3 ;
jsr multiply ;
clc ; Point PPUADDR to the line's begining
lda #$02 ;
adc tmpfield4 ; PPUADDR = $2000 + (32 * line num) + 2
sta tmpfield4 ; | | `-> Keep 2 spaces at as left margin
lda #$20 ; | `-------------------> Index of the line's leftmost tile in the nametable
adc tmpfield5 ; `---------------------------> Nametable's address
sta tmpfield5 ;
lda PPUSTATUS ;
lda tmpfield5 ;
sta PPUADDR ;
lda tmpfield4 ;
sta PPUADDR ;
write_one_char:
lda (char_cursor_low), y ;
inc char_cursor_low ; Load current character and point to
bne end_inc_cursor ; the next one
inc char_cursor_high ;
end_inc_cursor: ;
cmp #$0a ;
beq new_line ; Considere opcodes
cmp #$00 ; $0a - line break
beq end_write_credits ; $00 - end of data
cmp #$20 ; $20 - space
beq space ; $2d - filled space
cmp #$2d ;
beq filled_space ;
clc ;
adc #133 ; Generic case
sta PPUDATA ; tile_id = char_value + 133
jmp write_one_char ;
space:
lda #00 ;
sta PPUDATA ; Space character, tile $00
jmp write_one_char ;
filled_space:
lda #02 ;
sta PPUDATA ; Space filled with text-baground color, tile $02
jmp write_one_char ;
new_line:
inc line_num ; Increment line number and loop
jmp write_one_line ; to the new line
end_write_credits:
; Initialize common menus effects
jsr re_init_menu
rts
.)
fill_attributes_line:
.(
ldx #0
write_attribute_byte:
sta PPUDATA
inx
cpx #8
bne write_attribute_byte
rts
.)
.)
credits_screen_tick:
.(
SWITCH_BANK(#DATA_BANK_NUMBER)
; Play common menus effects
jsr tick_menu
; If all buttons of any controller are released on this frame, got to the next screen
lda controller_a_btns
bne check_controller_b
cmp controller_a_last_frame_btns
bne next_screen
check_controller_b:
lda controller_b_btns
bne end
cmp controller_b_last_frame_btns
bne next_screen
jmp end
next_screen:
lda #GAME_STATE_TITLE
jsr change_global_game_state
end:
rts
.)
|
oeis/040/A040156.asm | neoneye/loda-programs | 11 | 4375 | ; A040156: Continued fraction for sqrt(170).
; Submitted by <NAME>
; 13,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26
min $0,1
add $0,1
mul $0,13
|
programs/oeis/032/A032607.asm | karttu/loda | 0 | 100688 | <gh_stars>0
; A032607: Concatenation of n and n + 2 or {n,n+2}.
; 13,24,35,46,57,68,79,810,911,1012,1113,1214,1315,1416,1517,1618,1719,1820,1921,2022,2123,2224,2325,2426,2527,2628,2729,2830,2931,3032,3133,3234,3335,3436,3537,3638,3739,3840,3941,4042,4143,4244
mov $2,$0
add $2,1
mov $9,$0
lpb $2,1
mov $0,$9
sub $2,1
sub $0,$2
mov $3,2
mov $11,$0
lpb $3,1
mov $0,$11
sub $3,1
add $0,$3
add $0,3
mov $4,5
add $4,$0
trn $0,10
mov $6,2
mov $8,3
add $8,$4
lpb $0,1
div $0,18
trn $0,1
sub $8,11
mul $8,5
mul $6,$8
mul $6,9
add $6,2
lpe
mov $7,$6
mov $10,$3
lpb $10,1
mov $5,$7
sub $10,1
lpe
lpe
lpb $11,1
sub $5,$7
mov $11,0
lpe
mov $7,$5
div $7,2
mul $7,2
add $7,11
add $1,$7
lpe
|
programs/oeis/154/A154811.asm | jmorken/loda | 1 | 99686 | <filename>programs/oeis/154/A154811.asm<gh_stars>1-10
; A154811: a(n) = Fibonacci(2n+1) mod 9.
; 1,2,5,4,7,8,8,7,4,5,2,1,1,2,5,4,7,8,8,7,4,5,2,1,1,2,5,4,7,8,8,7,4,5,2,1,1,2,5,4,7,8,8,7,4,5,2,1,1,2,5,4,7,8,8,7,4,5,2,1,1,2,5,4,7,8,8,7,4,5,2,1
mov $1,1
lpb $0
sub $0,1
add $2,$1
add $1,$2
mod $1,9
lpe
|
agda/book/2015-Verified_Functional_programming_in_Agda-Stump/ial/z05-01-hc-sorted-list.agda | haroldcarr/learn-haskell-coq-ml-etc | 36 | 917 | {-# OPTIONS --allow-unsolved-metas #-}
open import bool
open import bool-thms2
open import eq
open import maybe
open import product
open import product-thms
open import bool-relations using (transitive ; total)
module z05-01-hc-sorted-list
(A : Set) -- type of elements
(_≤A_ : A → A → 𝔹) -- ordering function
(≤A-trans : transitive _≤A_) -- proof of transitivity of given ordering
(≤A-total : total _≤A_) -- proof of totality of given ordering
where
open import bool-relations _≤A_ hiding (transitive ; total)
open import minmax _≤A_ ≤A-trans ≤A-total
data slist : A → A → Set where
snil : ∀ {l u : A}
→ l ≤A u ≡ tt
→ slist l u
scons : ∀ {l u : A}
→ (d : A) -- value stored at head
→ slist l u -- elements to the right ≥ stored value
→ d ≤A l ≡ tt
→ slist (min d l) (max d u)
slist-insert : ∀ {l u : A}
→ (d : A) -- insert 'd'
→ slist l u -- into this 'bst'
→ d ≤A l ≡ tt
→ slist (min d l) (max d u) -- type might change
slist-insert d (snil l≤Au) d≤Al≡tt = scons d (snil l≤Au) d≤Al≡tt
slist-insert d (scons d' xs d'≤Al≡tt) d≤Al≡tt with keep (d ≤A d')
slist-insert d L@(scons d' xs d'≤Al≡tt) d≤Al≡tt | tt , p = scons d L d≤Al≡tt
slist-insert d L@(scons d' xs d'≤Al≡tt) d≤Al≡tt | ff , p = {!!}
|
src/Ninu.Emulator.Tests/Cpu/TestFiles/nmi.6502.asm | jorgy343/Ninu | 0 | 95859 | <filename>src/Ninu.Emulator.Tests/Cpu/TestFiles/nmi.6502.asm<gh_stars>0
.include "..\..\..\Cpu\TestFiles\std.6502.asm"
* = $0000
; cycles
ldx #$ab ; 01 - 02
ldx #$ab ; 03 - 04
inx ; 05 - 06
inx ; 07 - 08
iny ; 09 - 10
iny ; 11 - 12
brk ; 13 - 19
nop ; BRK pushes PC + 1 to the stack so RTI will actually return the instruction just after this NOP.
.done
; NMI handler.
* = $1200
sed ; The D flag should be unset when entering the NMI. Set it to test to ensure that P is loaded correctly after RTI.
rti
* = $fff0
rti
* = $fffa
nmi .addr $1200
reset .addr $0000
irq .addr $fff0 |
x64/dll/add.asm | januwA/nasm-scaffold | 0 | 19163 | <filename>x64/dll/add.asm<gh_stars>0
global dllmain
section .text
dllmain:
mov eax,1
ret
add:
push rbp
mov rbp,rsp
mov rax,rcx
add rax,rdx
mov rsp,rbp
pop rbp
ret |
Task/Simple-windowed-application/Ada/simple-windowed-application.ada | LaudateCorpus1/RosettaCodeData | 1 | 11891 | with Gdk.Event; use Gdk.Event;
with Gtk.Button; use Gtk.Button;
with Gtk.Label; use Gtk.Label;
with Gtk.Window; use Gtk.Window;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Table; use Gtk.Table;
with Gtk.Handlers;
with Gtk.Main;
procedure Simple_Windowed_Application is
Window : Gtk_Window;
Grid : Gtk_Table;
Button : Gtk_Button;
Label : Gtk_Label;
Count : Natural := 0;
package Handlers is new Gtk.Handlers.Callback (Gtk_Widget_Record);
package Return_Handlers is
new Gtk.Handlers.Return_Callback (Gtk_Widget_Record, Boolean);
function Delete_Event (Widget : access Gtk_Widget_Record'Class)
return Boolean is
begin
return False;
end Delete_Event;
procedure Destroy (Widget : access Gtk_Widget_Record'Class) is
begin
Gtk.Main.Main_Quit;
end Destroy;
procedure Clicked (Widget : access Gtk_Widget_Record'Class) is
begin
Count := Count + 1;
Set_Text (Label, "The button clicks:" & Natural'Image (Count));
end Clicked;
begin
Gtk.Main.Init;
Gtk.Window.Gtk_New (Window);
Gtk_New (Grid, 1, 2, False);
Add (Window, Grid);
Gtk_New (Label, "There have been no clicks yet");
Attach (Grid, Label, 0, 1, 0, 1);
Gtk_New (Button, "Click me");
Attach (Grid, Button, 0, 1, 1, 2);
Return_Handlers.Connect
( Window,
"delete_event",
Return_Handlers.To_Marshaller (Delete_Event'Access)
);
Handlers.Connect
( Window,
"destroy",
Handlers.To_Marshaller (Destroy'Access)
);
Handlers.Connect
( Button,
"clicked",
Handlers.To_Marshaller (Clicked'Access)
);
Show_All (Grid);
Show (Window);
Gtk.Main.Main;
end Simple_Windowed_Application;
|
programs/oeis/033/A033162.asm | jmorken/loda | 1 | 169190 | <reponame>jmorken/loda<gh_stars>1-10
; A033162: Begins with (3, 4); avoids 3-term arithmetic progressions.
; 3,4,6,7,12,13,15,16,30,31,33,34,39,40,42,43,84,85,87,88,93,94,96,97,111,112,114,115,120,121,123,124,246,247,249,250,255,256,258,259,273,274,276,277,282,283,285,286,327,328,330,331,336,337,339,340,354,355,357,358,363
mov $35,$0
mov $37,$0
lpb $37
mov $0,$35
sub $37,1
sub $0,$37
mov $31,$0
mov $33,2
lpb $33
clr $0,31
mov $0,$31
sub $33,1
add $0,$33
sub $0,1
mov $27,$0
add $27,1
mov $28,$0
lpb $27
clr $0,25
sub $27,1
sub $0,$27
lpb $0
gcd $0,1073741824
add $3,3
lpb $0
div $0,2
mul $3,3
lpe
mov $2,$3
lpe
mov $1,$2
div $1,6
add $26,$1
lpe
mov $1,$26
add $1,$28
mov $34,$33
lpb $34
mov $32,$1
sub $34,1
lpe
lpe
lpb $31
mov $31,0
sub $32,$1
lpe
mov $1,$32
mul $1,2
add $1,2
add $36,$1
lpe
mov $1,$36
div $1,6
add $1,3
|
src/rng.asm | akumanatt/2600-wordle | 1 | 89102 | ; random number generator routines
; using 8-bit lag-2 MWC PRNG with multiplier of 224
.section rng_code
rng .block
init
; seed the initial value with (hopefully) uninitalized memory and I/O reads
ldx #$2f
-
lda rng_state
eor $70,x
sta rng_state
lda rng_state+1
eor $a0,x
sta rng_state+1
lda rng_state+2
eor $d0,x
bne +
; prevent both x and c being 0 which kills the generator
adc #1
+ sta rng_state+2
dex
bpl -
rts
advance
; also returns the new RNG state to A, X and Y
ldx rng_state
lda #0 ; 256x
lsr rng_state
ror a ; 128x
lsr rng_state
ror a ; 64x
lsr rng_state
ror a ; 32x
sec
eor #$ff
adc #0
tay
txa
sbc rng_state ; 256x-32x = 224x
tax
tya
clc
adc rng_state+2 ; 224x+c
bcc +
inx
+ ldy rng_state+1
sty rng_state
sta rng_state+1
stx rng_state+2
rts
.bend
.send
|
models/tests/test51g.als | transclosure/Amalgam | 4 | 911 | module tests/test51 -- example created by <NAME> on behalf of Mr. X
------------ Points, Features, and Places ------------
-- A physical point on the ground, on a map, etc. A point
-- may be contained in a place.
sig Point {
place: lone Place
}
-- A major geographic feature: a place or a road.
abstract sig Feature {}
-- A place is defined by a set of points.
sig Place extends Feature {}
-- Returns the set of all points contained in this place
fun points [p: Place] : set Point { place.p }
------------ Roads ------------
-- A road is defined by a sequence of points.
-- Each point on a road may have connections to features.
sig Road extends Feature {
geography: seq Point,
connections: geography[Int] -> Feature
}{
all p: Point | lone geography.p -- the points on a road are unique
}
-- Returns the set of all points that define this road.
fun points [r: Road] : set Point { r.geography[Int] }
-- Returns the first point on this road.
fun first [r: Road] : lone Point { r.geography.first }
-- Returns the last point on this road.
fun last [r: Road] : lone Point { r.geography.last }
-- True if p1 is closer to the beginning of this road than p2
pred closer [r: Road, p1, p2: Point] {
let geo = r.geography | lt[geo.p1, geo.p2]
}
-- True if p1 is farther from the beginning of this road than p2
pred farther [r: Road, p1, p2: Point] {
let geo = r.geography | gt[geo.p1, geo.p2]
}
-- Returns the point closest to the beginning of this road,
-- or the empty set if none of the given points is on this road.
fun closest [r: Road, points: set Point] : lone Point {
let geo = r.geography | geo[min[geo.points]]
}
-- Returns the point farthest from the beginning of this road,
-- or the empty set if none of the given points is on the road.
fun farthest [r: Road, points: set Point] : lone Point {
let geo = r.geography | geo[max[geo.points]]
}
-- Returns the point that immediately precedes the given point
-- on this road, if any.
fun predecessor[r: Road, point: Point] : lone Point {
let geo = r.geography | geo[prev[geo.point]]
}
-- Returns the point that immediately follows the given point
-- on this road, if any.
fun successor [r: Road, point: Point] : lone Point {
let geo = r.geography | geo[next[geo.point]]
}
-- Returns the set of points on this road that
-- precede the given point
fun before [r: Road, point: Point] : set Point {
let geo = r.geography | geo[prevs[geo.point]]
}
-- Returns the set of points on this road that
-- succeed the given point
fun after [r: Road, point: Point] : set Point {
let geo = r.geography | geo[nexts[geo.point]]
}
-- Returns the set of all points on this road that have a connection to
-- the given feature. A connection to a feature is a point on this road
-- that is connected to the given feature or that is contained in the feature.
fun connections[r: Road, feature: Feature]: set Point {
r.connections.feature + r.points & (feature<:Place).points
}
|
oeis/102/A102754.asm | neoneye/loda-programs | 11 | 13986 | <reponame>neoneye/loda-programs<filename>oeis/102/A102754.asm
; A102754: Decimal expansion of (Pi^2)/2 -4.
; Submitted by <NAME>
; 9,3,4,8,0,2,2,0,0,5,4,4,6,7,9,3,0,9,4,1,7,2,4,5,4,9,9,9,3,8,0,7,5,5,6,7,6,5,6,8,4,9,7,0,3,6,2,0,3,9,5,3,1,3,2,0,6,6,7,4,6,8,8,1,1,0,0,2,2,4,1,1,2,0,9,6,0,2,6,2,1,5,0,0,8,8,6,7,0,1,8,5,9,2,7,6,1,1,5,9
add $0,1
mov $1,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $1,$3
mov $5,$3
mul $5,2
add $5,1
mul $2,$5
add $1,$2
cmp $4,0
mov $5,$0
add $5,$4
div $1,$5
div $2,$5
sub $3,1
lpe
pow $1,2
mul $1,2
pow $2,2
mov $6,10
pow $6,$0
div $2,$6
div $1,$2
mov $0,$1
mod $0,10
|
programs/oeis/137/A137445.asm | karttu/loda | 0 | 92903 | ; A137445: a(n) = 2a(n-1)-2a(n-2), with a(0)=3 and a(1)=2.
; 3,2,-2,-8,-12,-8,8,32,48,32,-32,-128,-192,-128,128,512,768,512,-512,-2048,-3072,-2048,2048,8192,12288,8192,-8192,-32768,-49152,-32768,32768,131072,196608,131072,-131072,-524288,-786432,-524288,524288
mov $2,$0
mov $0,6
mov $1,6
lpb $2,1
mul $1,2
sub $1,1
sub $1,$0
sub $1,1
add $0,$1
sub $2,1
lpe
sub $1,4
div $1,2
add $1,2
|
ADL/drivers/stm32f334/stm32-can.ads | JCGobbi/Nucleo-STM32F334R8 | 0 | 15986 | <gh_stars>0
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2018, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This file provides interfaces for the CAN modules on the
-- STM32F4 (ARM Cortex M4F) microcontrollers from ST Microelectronics.
with System;
private with STM32_SVD.CAN;
with Ada.Real_Time;
package STM32.CAN is
type CAN_Controller is limited private;
procedure Reset_CAN
(This : in out CAN_Controller);
procedure Enter_Init_Mode
(This : in out CAN_Controller)
with Post => Is_Init_Mode (This);
function Is_Init_Mode (This : CAN_Controller) return Boolean;
procedure Exit_Init_Mode
(This : in out CAN_Controller)
with Post => not Is_Init_Mode (This);
procedure Sleep
(This : in out CAN_Controller)
with Post => Is_Sleep_Mode (This);
function Is_Sleep_Mode (This : CAN_Controller) return Boolean;
procedure Wakeup
(This : in out CAN_Controller)
with Post => not Is_Sleep_Mode (This);
subtype Resynch_Quanta is Positive range 1 .. 4;
-- These bits define the maximum number of time quanta the CAN hardware is
-- allowed to lengthen or shorten a bit to perform the resynchronization.
-- This is the SJW.
subtype Segment_1_Quanta is Positive range 1 .. 16;
-- Defines the location of the sample point (number of time quanta).
-- It includes the PROP_SEG and PHASE_SEG1 of the CAN standard.
subtype Segment_2_Quanta is Positive range 1 .. 8;
-- Defines the location of the sample point (number of time quanta).
-- It represents the PHASE_SEG2 of the CAN standard.
subtype Time_Quanta_Prescaler is Positive range 1 .. 1024;
-- These bits define the length of a time quanta.
type Bit_Timing_Config is record
Resynch_Jump_Width : Resynch_Quanta;
Time_Segment_1 : Segment_1_Quanta;
Time_Segment_2 : Segment_2_Quanta;
Quanta_Prescaler : Time_Quanta_Prescaler;
end record;
Segment_Sync_Quanta : constant Positive := 1;
-- This is the SYNC_SEG segment, the time quanta for syncronism.
subtype Sample_Point_Range is Float range 50.0 .. 90.0;
-- The sample point of the start frame (at the end of PHASE_SEG1) is taken
-- between 50 to 90% of the Bit Time. The preferred value used by CANopen
-- and DeviceNet is 87.5% and 75% for ARINC 825.
-- See http://www.bittiming.can-wiki.info/#bxCAN for this calculation.
subtype Bit_Time_Quanta is Positive range 8 .. 25;
-- This is the number of time quanta in one Bit Time. So for a 1 MHz bit
-- rate and the minimum Bit_Time_Quanta = 8, the minimum prescaler input
-- frequency is 8 MHz.
-- 1 Bit time (= 1/bit rate) is defined by four time segments:
-- SYNC_SEG - 1 time quantum long;
-- PROP_SEG - 1 to 8 time quanta long;
-- PHASE_SEG1 - 1 to 8 time quanta long;
-- PHASE_SEG2 - maximum of PHASE_SEG1 and the Information processing time,
-- that is less then or equal to 2 Time Quanta long.
--
-- The sample point of start frame is taken at 87.5% maximum of
-- Bit_Time_Quanta'Last, and must not be grater then SYNC_SEG + PROP_SEG +
-- PHASE_SEG (Segment_Sync_Quanta + Segment_1_Quanta) = 17. So the maximum
-- value for Bit_Time_Quanta is 17 / 0.875 = 19.4 ~ 19.
subtype Bit_Rate_Range is Float range 1.0 .. 1_000.0;
-- This is the actual bit rate frequency of the CAN bus in kHz.
-- The standard frequencies are 10, 20, 50, 83.333, 100, 125, 250, 500, 800
-- and 1000 kHz.
subtype Clock_Tolerance is Float range 0.0 .. 1.58;
-- Clock tolerance for the bit rate in percent.
-- The tolerance range df for an oscillator’s frequency fosc around the
-- nominal frequency fnom with fosc = fnom ± df depends on the proportions
-- of Phase_Seg1, Phase_Seg2, SJW, and the bit time. The maximum tolerance
-- df is the defined by two conditions (both shall be met):
--
-- min(Phase_Seg1, Phase_Seg2) SJW
-- 1. df ≤ ----------------------------- 2. df ≤ -------------
-- 2*(13*Bit_Time-Phase_Seg2) 20*Bit_Time
--
-- The combination Prop_Seg = 1 and Phase_Seg1 = Phase_Seg2 = SJW = 4 allows
-- the largest possible oscillator tolerance of 1.58%.
-- See chapter 4 Oscillator Tolerance Range from The Configuration of the
-- CAN Bit Timing, <NAME>, <NAME>, 6th International CAN
-- Conference.
procedure Calculate_Bit_Timing
(Speed : in Bit_Rate_Range;
Sample_Point : in Sample_Point_Range;
Tolerance : in Clock_Tolerance;
Bit_Timing : in out Bit_Timing_Config);
-- Automatically calculate bit timings based on requested bit rate and
-- sample ratio.
-- 1 nominal Bit Time is defined by the time length in quanta of four time
-- segments, each one composed of 1 or more quanta: SINC_SEG, PROP_SEG,
-- PHASE_SEG1 and PHASE_SEG2.
-- The Baud Rate (the Bit frequency) is the inverse of 1 nominal Bit Time.
-- The prescaler is calculated to get the time of one quanta, so we divide
-- the bus frequency of the CAN peripheral by the baud rate and divide this
-- value by the number of quanta in one nominal Bit time.
-- See RM0364 rev. 4 chapter 30.7.7 Bit timing.
procedure Configure_Bit_Timing
(This : in out CAN_Controller;
Timing_Config : in Bit_Timing_Config)
with Pre => Is_Init_Mode (This);
type Operating_Mode is
(Normal,
Loopback,
Silent,
Silent_Loopback);
procedure Set_Operating_Mode
(This : in out CAN_Controller;
Mode : in Operating_Mode)
with Pre => Is_Init_Mode (This);
procedure Configure
(This : in out CAN_Controller;
Mode : in Operating_Mode;
Time_Triggered : in Boolean;
Auto_Bus_Off : in Boolean;
Auto_Wakeup : in Boolean;
Auto_Retransmission : in Boolean;
Rx_FIFO_Locked : in Boolean;
Tx_FIFO_Prio : in Boolean;
Timing_Config : in Bit_Timing_Config);
procedure Enter_Filter_Init_Mode;
function Is_Filter_Init_Mode return Boolean;
procedure Exit_Filter_Init_Mode;
subtype Standard_Id is UInt11;
subtype Extended_Id is UInt18;
type Filter_32 is record
Std_ID : Standard_Id;
Ext_ID : Extended_Id;
Ide : Boolean;
Rtr : Boolean;
end record
with Size => 32, Bit_Order => System.Low_Order_First;
for Filter_32 use record
Std_ID at 0 range 21 .. 31;
Ext_ID at 0 range 3 .. 20;
Ide at 0 range 2 .. 2;
Rtr at 0 range 1 .. 1;
-- Zero bit 0
end record;
type Filter_16 is record
Std_ID : Standard_Id;
Rtr : Boolean;
Ide : Boolean;
Ext_ID_Msb : UInt3; -- Upper three bits [17:15]
end record
with Size => 16, Bit_Order => System.Low_Order_First;
for Filter_16 use record
Std_ID at 0 range 5 .. 15;
Rtr at 0 range 4 .. 4;
Ide at 0 range 3 .. 3;
Ext_ID_Msb at 0 range 0 .. 2;
end record;
subtype Filter_Bank_Nr is Natural range 0 .. 13;
type Fifo_Nr is (FIFO_0, FIFO_1);
type Mode_Scale is (Mask32, List32, Mask16, List16);
type Mask32_Filter is record
Id : Filter_32;
Mask : Filter_32;
end record
with Size => 64, Bit_Order => System.Low_Order_First;
for Mask32_Filter use record
Id at 0 range 0 .. 31;
Mask at 0 range 32 .. 63;
end record;
type Mask16_Filter is record
Id_1 : Filter_16;
Mask_1 : Filter_16;
Id_2 : Filter_16;
Mask_2 : Filter_16;
end record
with Size => 64, Bit_Order => System.Low_Order_First;
for Mask16_Filter use record
Id_1 at 0 range 0 .. 15;
Mask_1 at 0 range 16 .. 31;
Id_2 at 0 range 32 .. 47;
Mask_2 at 0 range 48 .. 63;
end record;
type Id32_Filter is record
Id_1 : Filter_32;
Id_2 : Filter_32;
end record
with Size => 64, Bit_Order => System.Low_Order_First;
for Id32_Filter use record
Id_1 at 0 range 0 .. 31;
Id_2 at 0 range 32 .. 63;
end record;
type Id16_Filter is record
Id_1 : Filter_16;
Id_2 : Filter_16;
Id_3 : Filter_16;
Id_4 : Filter_16;
end record
with Size => 64, Bit_Order => System.Low_Order_First;
for Id16_Filter use record
Id_1 at 0 range 0 .. 15;
Id_2 at 0 range 16 .. 31;
Id_3 at 0 range 32 .. 47;
Id_4 at 0 range 48 .. 63;
end record;
type CAN_Filter (Mode : Mode_Scale := Mask32) is record
case Mode is
when List32 =>
-- Match two different 32bit IDs exactly
List32 : Id32_Filter;
when Mask32 =>
-- Match a single 32bit ID as given by a mask
Mask32 : Mask32_Filter;
when List16 =>
-- Match four different 16bit IDs exactly
List16 : Id16_Filter;
when Mask16 =>
-- Match two single 16bit ID as given by their masks
Mask16 : Mask16_Filter;
end case;
end record;
type CAN_Filter_Bank is record
Bank_Nr : Filter_Bank_Nr;
Activated : Boolean;
Fifo_Assignment : Fifo_Nr;
Filters : CAN_Filter;
end record;
procedure Configure_Filter
(This : in out CAN_Controller;
Bank_Config : in CAN_Filter_Bank);
procedure Set_Filter_Activation
(Bank_Nr : in Filter_Bank_Nr;
Enabled : in Boolean);
function Get_Slave_Start_Bank return Filter_Bank_Nr;
procedure Set_Slave_Start_Bank
(Bank_Nr : in Filter_Bank_Nr)
with Post => Bank_Nr = Get_Slave_Start_Bank;
subtype Data_Length_Type is UInt4 range 0 .. 8;
type Message_Data is array (Natural range <>) of UInt8;
type CAN_Message is record
Std_ID : Standard_Id;
Ext_ID : Extended_Id;
Ide : Boolean;
Rtr : Boolean;
Dlc : Data_Length_Type;
Data : Message_Data (0 .. 7);
end record;
procedure Release_Fifo
(This : in out CAN_Controller;
Fifo : in Fifo_Nr);
function Nof_Msg_In_Fifo
(This : CAN_Controller;
Fifo : Fifo_Nr)
return UInt2;
Default_Timeout : constant Ada.Real_Time.Time_Span :=
Ada.Real_Time.Milliseconds (100);
procedure Receive_Message
(This : in out CAN_Controller;
Fifo : in Fifo_Nr;
Message : out CAN_Message;
Success : out Boolean;
Timeout : in Ada.Real_Time.Time_Span := Default_Timeout);
type Mailbox_Type is (Mailbox_0, Mailbox_1, Mailbox_2);
procedure Transmit_Message
(This : in out CAN_Controller;
Message : in CAN_Message;
Success : out Boolean;
Timeout : in Ada.Real_Time.Time_Span := Default_Timeout);
procedure Get_Empty_Mailbox
(This : in out CAN_Controller;
Mailbox : out Mailbox_Type;
Empty_Found : out Boolean);
function Transmission_Successful
(This : CAN_Controller;
Mailbox : Mailbox_Type)
return Boolean;
procedure Transmission_Request
(This : in out CAN_Controller;
Mailbox : in Mailbox_Type)
with Inline;
function Transmission_OK
(This : CAN_Controller;
Mailbox : Mailbox_Type)
return Boolean
with Inline;
function Transmission_Completed
(This : CAN_Controller;
Mailbox : Mailbox_Type)
return Boolean
with Inline;
function Request_Completed
(This : CAN_Controller;
Mailbox : Mailbox_Type)
return Boolean
with Inline;
-- #define CAN_IT_TME ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */
--
-- /* Receive Interrupts */
-- #define CAN_IT_FMP0 ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */
-- #define CAN_IT_FF0 ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */
-- #define CAN_IT_FOV0 ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */
-- #define CAN_IT_FMP1 ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */
-- #define CAN_IT_FF1 ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */
-- #define CAN_IT_FOV1 ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */
--
-- /* Operating Mode Interrupts */
-- #define CAN_IT_WKU ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */
-- #define CAN_IT_SLK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */
--
-- /* Error Interrupts */
-- #define CAN_IT_EWG ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */
-- #define CAN_IT_EPV ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */
-- #define CAN_IT_BOF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */
-- #define CAN_IT_LEC ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */
-- #define CAN_IT_ERR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */
type CAN_Interrupt is
(Sleep_Acknowledge,
Wakeup,
Error,
Last_Error_Code,
Bus_Off,
Error_Passive,
Error_Warning,
FIFO_0_Overrun,
FIFO_0_Full,
FIFO_0_Message_Pending,
FIFO_1_Overrun,
FIFO_1_Full,
FIFO_1_Message_Pending,
Transmit_Mailbox_Empty);
-- /** @brief Check whether the specified CAN flag is set or not.
-- * @param __HANDLE__: CAN Handle
-- * @param __FLAG__: specifies the flag to check.
-- * This parameter can be one of the following values:
-- * @arg CAN_TSR_RQCP0: Request MailBox0 Flag
-- * @arg CAN_TSR_RQCP1: Request MailBox1 Flag
-- * @arg CAN_TSR_RQCP2: Request MailBox2 Flag
-- * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag
-- * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag
-- * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag
-- * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag
-- * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag
-- * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag
-- * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
-- * @arg CAN_FLAG_FF0: FIFO 0 Full Flag
-- * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag
-- * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
-- * @arg CAN_FLAG_FF1: FIFO 1 Full Flag
-- * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag
-- * @arg CAN_FLAG_WKU: Wake up Flag
-- * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag
-- * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag
-- * @arg CAN_FLAG_EWG: Error Warning Flag
-- * @arg CAN_FLAG_EPV: Error Passive Flag
-- * @arg CAN_FLAG_BOF: Bus-Off Flag
-- * @retval The new state of __FLAG__ (TRUE or FALSE).
function Is_Empty
(This : CAN_Controller;
Mailbox : Mailbox_Type)
return Boolean
with Inline;
function Is_Overrun
(This : CAN_Controller;
Fifo : Fifo_Nr)
return Boolean
with Inline;
function Is_Full
(This : CAN_Controller;
Fifo : Fifo_Nr)
return Boolean
with Inline;
function Interrupt_Enabled
(This : CAN_Controller;
Source : CAN_Interrupt)
return Boolean
with Inline;
procedure Enable_Interrupts
(This : in out CAN_Controller;
Source : CAN_Interrupt)
with Post => Interrupt_Enabled (This, Source),
Inline;
procedure Disable_Interrupts
(This : in out CAN_Controller;
Source : CAN_Interrupt)
with Post => not Interrupt_Enabled (This, Source),
Inline;
function Read_Rx_Message
(This : CAN_Controller;
Fifo : Fifo_Nr)
return CAN_Message;
procedure Write_Tx_Message
(This : in out CAN_Controller;
Message : in CAN_Message;
Mailbox : in Mailbox_Type)
with Pre => Is_Empty (This, Mailbox);
private
type CAN_Controller is new STM32_SVD.CAN.CAN_Peripheral;
procedure Set_Init_Mode
(This : in out CAN_Controller;
Enabled : in Boolean);
procedure Set_Sleep_Mode
(This : in out CAN_Controller;
Enabled : in Boolean);
type Filter_Union (Mode : Mode_Scale := Mask32) is record
case Mode is
when List32 =>
List32 : Id32_Filter;
when Mask32 =>
Mask32 : Mask32_Filter;
when List16 =>
List16 : Id16_Filter;
when Mask16 =>
Mask16 : Mask16_Filter;
end case;
end record
with Unchecked_Union, Size => 64;
type Filter_Reg_Union (As_Registers : Boolean := False) is record
case As_Registers is
when True =>
FxR1 : UInt32;
FxR2 : UInt32;
when False =>
Filter : Filter_Union;
end case;
end record
with Unchecked_Union, Size => 64, Bit_Order => System.Low_Order_First;
for Filter_Reg_Union use record
FxR1 at 0 range 0 .. 31;
FxR2 at 0 range 32 .. 63;
Filter at 0 range 0 .. 63;
end record;
procedure Write_FxR
(X : in Filter_Bank_Nr;
FxR1 : in UInt32;
FxR2 : in UInt32)
with Pre => Is_Filter_Init_Mode;
procedure Set_Filter_Scale
(Bank_Nr : in Filter_Bank_Nr;
Mode : in Mode_Scale)
with Pre => Is_Filter_Init_Mode;
procedure Set_Filter_Mode
(Bank_Nr : in Filter_Bank_Nr;
Mode : in Mode_Scale)
with Pre => Is_Filter_Init_Mode;
procedure Set_Fifo_Assignment
(Bank_Nr : in Filter_Bank_Nr;
Fifo : in Fifo_Nr)
with Pre => Is_Filter_Init_Mode;
end STM32.CAN;
|
alloy4fun_models/trainstlt/models/8/2KwGSuj5M7q5CJe47.als | Kaixi26/org.alloytools.alloy | 0 | 5134 | <filename>alloy4fun_models/trainstlt/models/8/2KwGSuj5M7q5CJe47.als
open main
pred id2KwGSuj5M7q5CJe47_prop9 {
all t:Train | some tk:Entry | eventually (t->tk in pos and before no t.pos)
}
pred __repair { id2KwGSuj5M7q5CJe47_prop9 }
check __repair { id2KwGSuj5M7q5CJe47_prop9 <=> prop9o } |
xv6-l/mkdir.asm | xsuler/osPlayground | 0 | 11243 |
_mkdir: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: bf 01 00 00 00 mov $0x1,%edi
13: 56 push %esi
14: 53 push %ebx
15: 51 push %ecx
16: 83 ec 08 sub $0x8,%esp
19: 8b 59 04 mov 0x4(%ecx),%ebx
1c: 8b 31 mov (%ecx),%esi
1e: 83 c3 04 add $0x4,%ebx
int i;
if(argc < 2){
21: 83 fe 01 cmp $0x1,%esi
24: 7e 3e jle 64 <main+0x64>
26: 8d 76 00 lea 0x0(%esi),%esi
29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(2, "Usage: mkdir files...\n");
exit();
}
for(i = 1; i < argc; i++){
if(mkdir(argv[i]) < 0){
30: 83 ec 0c sub $0xc,%esp
33: ff 33 pushl (%ebx)
35: e8 ff 02 00 00 call 339 <mkdir>
3a: 83 c4 10 add $0x10,%esp
3d: 85 c0 test %eax,%eax
3f: 78 0f js 50 <main+0x50>
for(i = 1; i < argc; i++){
41: 83 c7 01 add $0x1,%edi
44: 83 c3 04 add $0x4,%ebx
47: 39 fe cmp %edi,%esi
49: 75 e5 jne 30 <main+0x30>
printf(2, "mkdir: %s failed to create\n", argv[i]);
break;
}
}
exit();
4b: e8 81 02 00 00 call 2d1 <exit>
printf(2, "mkdir: %s failed to create\n", argv[i]);
50: 50 push %eax
51: ff 33 pushl (%ebx)
53: 68 ff 07 00 00 push $0x7ff
58: 6a 02 push $0x2
5a: e8 21 04 00 00 call 480 <printf>
break;
5f: 83 c4 10 add $0x10,%esp
62: eb e7 jmp 4b <main+0x4b>
printf(2, "Usage: mkdir files...\n");
64: 52 push %edx
65: 52 push %edx
66: 68 e8 07 00 00 push $0x7e8
6b: 6a 02 push $0x2
6d: e8 0e 04 00 00 call 480 <printf>
exit();
72: e8 5a 02 00 00 call 2d1 <exit>
77: 66 90 xchg %ax,%ax
79: 66 90 xchg %ax,%ax
7b: 66 90 xchg %ax,%ax
7d: 66 90 xchg %ax,%ax
7f: 90 nop
00000080 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
80: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
81: 31 d2 xor %edx,%edx
{
83: 89 e5 mov %esp,%ebp
85: 53 push %ebx
86: 8b 45 08 mov 0x8(%ebp),%eax
89: 8b 5d 0c mov 0xc(%ebp),%ebx
8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((*s++ = *t++) != 0)
90: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
94: 88 0c 10 mov %cl,(%eax,%edx,1)
97: 83 c2 01 add $0x1,%edx
9a: 84 c9 test %cl,%cl
9c: 75 f2 jne 90 <strcpy+0x10>
;
return os;
}
9e: 5b pop %ebx
9f: 5d pop %ebp
a0: c3 ret
a1: eb 0d jmp b0 <strcmp>
a3: 90 nop
a4: 90 nop
a5: 90 nop
a6: 90 nop
a7: 90 nop
a8: 90 nop
a9: 90 nop
aa: 90 nop
ab: 90 nop
ac: 90 nop
ad: 90 nop
ae: 90 nop
af: 90 nop
000000b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 56 push %esi
b4: 53 push %ebx
b5: 8b 5d 08 mov 0x8(%ebp),%ebx
b8: 8b 75 0c mov 0xc(%ebp),%esi
while(*p && *p == *q)
bb: 0f b6 13 movzbl (%ebx),%edx
be: 0f b6 0e movzbl (%esi),%ecx
c1: 84 d2 test %dl,%dl
c3: 74 1e je e3 <strcmp+0x33>
c5: b8 01 00 00 00 mov $0x1,%eax
ca: 38 ca cmp %cl,%dl
cc: 74 09 je d7 <strcmp+0x27>
ce: eb 20 jmp f0 <strcmp+0x40>
d0: 83 c0 01 add $0x1,%eax
d3: 38 ca cmp %cl,%dl
d5: 75 19 jne f0 <strcmp+0x40>
d7: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
db: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
df: 84 d2 test %dl,%dl
e1: 75 ed jne d0 <strcmp+0x20>
e3: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
e5: 5b pop %ebx
e6: 5e pop %esi
return (uchar)*p - (uchar)*q;
e7: 29 c8 sub %ecx,%eax
}
e9: 5d pop %ebp
ea: c3 ret
eb: 90 nop
ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
f0: 0f b6 c2 movzbl %dl,%eax
f3: 5b pop %ebx
f4: 5e pop %esi
return (uchar)*p - (uchar)*q;
f5: 29 c8 sub %ecx,%eax
}
f7: 5d pop %ebp
f8: c3 ret
f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000100 <strlen>:
uint
strlen(char *s)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
106: 80 39 00 cmpb $0x0,(%ecx)
109: 74 15 je 120 <strlen+0x20>
10b: 31 d2 xor %edx,%edx
10d: 8d 76 00 lea 0x0(%esi),%esi
110: 83 c2 01 add $0x1,%edx
113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
117: 89 d0 mov %edx,%eax
119: 75 f5 jne 110 <strlen+0x10>
;
return n;
}
11b: 5d pop %ebp
11c: c3 ret
11d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
120: 31 c0 xor %eax,%eax
}
122: 5d pop %ebp
123: c3 ret
124: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
12a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000130 <memset>:
void*
memset(void *dst, int c, uint n)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 57 push %edi
134: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
137: 8b 4d 10 mov 0x10(%ebp),%ecx
13a: 8b 45 0c mov 0xc(%ebp),%eax
13d: 89 d7 mov %edx,%edi
13f: fc cld
140: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
142: 89 d0 mov %edx,%eax
144: 5f pop %edi
145: 5d pop %ebp
146: c3 ret
147: 89 f6 mov %esi,%esi
149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000150 <strchr>:
char*
strchr(const char *s, char c)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 8b 45 08 mov 0x8(%ebp),%eax
157: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
15a: 0f b6 18 movzbl (%eax),%ebx
15d: 84 db test %bl,%bl
15f: 74 1d je 17e <strchr+0x2e>
161: 89 d1 mov %edx,%ecx
if(*s == c)
163: 38 d3 cmp %dl,%bl
165: 75 0d jne 174 <strchr+0x24>
167: eb 17 jmp 180 <strchr+0x30>
169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
170: 38 ca cmp %cl,%dl
172: 74 0c je 180 <strchr+0x30>
for(; *s; s++)
174: 83 c0 01 add $0x1,%eax
177: 0f b6 10 movzbl (%eax),%edx
17a: 84 d2 test %dl,%dl
17c: 75 f2 jne 170 <strchr+0x20>
return (char*)s;
return 0;
17e: 31 c0 xor %eax,%eax
}
180: 5b pop %ebx
181: 5d pop %ebp
182: c3 ret
183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000190 <gets>:
char*
gets(char *buf, int max)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 57 push %edi
194: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
195: 31 f6 xor %esi,%esi
{
197: 53 push %ebx
198: 89 f3 mov %esi,%ebx
19a: 83 ec 1c sub $0x1c,%esp
19d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
1a0: eb 2f jmp 1d1 <gets+0x41>
1a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
1a8: 83 ec 04 sub $0x4,%esp
1ab: 8d 45 e7 lea -0x19(%ebp),%eax
1ae: 6a 01 push $0x1
1b0: 50 push %eax
1b1: 6a 00 push $0x0
1b3: e8 31 01 00 00 call 2e9 <read>
if(cc < 1)
1b8: 83 c4 10 add $0x10,%esp
1bb: 85 c0 test %eax,%eax
1bd: 7e 1c jle 1db <gets+0x4b>
break;
buf[i++] = c;
1bf: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1c3: 83 c7 01 add $0x1,%edi
1c6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1c9: 3c 0a cmp $0xa,%al
1cb: 74 23 je 1f0 <gets+0x60>
1cd: 3c 0d cmp $0xd,%al
1cf: 74 1f je 1f0 <gets+0x60>
for(i=0; i+1 < max; ){
1d1: 83 c3 01 add $0x1,%ebx
1d4: 89 fe mov %edi,%esi
1d6: 3b 5d 0c cmp 0xc(%ebp),%ebx
1d9: 7c cd jl 1a8 <gets+0x18>
1db: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1dd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1e0: c6 03 00 movb $0x0,(%ebx)
}
1e3: 8d 65 f4 lea -0xc(%ebp),%esp
1e6: 5b pop %ebx
1e7: 5e pop %esi
1e8: 5f pop %edi
1e9: 5d pop %ebp
1ea: c3 ret
1eb: 90 nop
1ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1f0: 8b 75 08 mov 0x8(%ebp),%esi
1f3: 8b 45 08 mov 0x8(%ebp),%eax
1f6: 01 de add %ebx,%esi
1f8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1fa: c6 03 00 movb $0x0,(%ebx)
}
1fd: 8d 65 f4 lea -0xc(%ebp),%esp
200: 5b pop %ebx
201: 5e pop %esi
202: 5f pop %edi
203: 5d pop %ebp
204: c3 ret
205: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000210 <stat>:
int
stat(char *n, struct stat *st)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 56 push %esi
214: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
215: 83 ec 08 sub $0x8,%esp
218: 6a 00 push $0x0
21a: ff 75 08 pushl 0x8(%ebp)
21d: e8 ef 00 00 00 call 311 <open>
if(fd < 0)
222: 83 c4 10 add $0x10,%esp
225: 85 c0 test %eax,%eax
227: 78 27 js 250 <stat+0x40>
return -1;
r = fstat(fd, st);
229: 83 ec 08 sub $0x8,%esp
22c: ff 75 0c pushl 0xc(%ebp)
22f: 89 c3 mov %eax,%ebx
231: 50 push %eax
232: e8 f2 00 00 00 call 329 <fstat>
close(fd);
237: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
23a: 89 c6 mov %eax,%esi
close(fd);
23c: e8 b8 00 00 00 call 2f9 <close>
return r;
241: 83 c4 10 add $0x10,%esp
}
244: 8d 65 f8 lea -0x8(%ebp),%esp
247: 89 f0 mov %esi,%eax
249: 5b pop %ebx
24a: 5e pop %esi
24b: 5d pop %ebp
24c: c3 ret
24d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
250: be ff ff ff ff mov $0xffffffff,%esi
255: eb ed jmp 244 <stat+0x34>
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <atoi>:
int
atoi(const char *s)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 53 push %ebx
264: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
267: 0f be 11 movsbl (%ecx),%edx
26a: 8d 42 d0 lea -0x30(%edx),%eax
26d: 3c 09 cmp $0x9,%al
n = 0;
26f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
274: 77 1f ja 295 <atoi+0x35>
276: 8d 76 00 lea 0x0(%esi),%esi
279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
280: 83 c1 01 add $0x1,%ecx
283: 8d 04 80 lea (%eax,%eax,4),%eax
286: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
28a: 0f be 11 movsbl (%ecx),%edx
28d: 8d 5a d0 lea -0x30(%edx),%ebx
290: 80 fb 09 cmp $0x9,%bl
293: 76 eb jbe 280 <atoi+0x20>
return n;
}
295: 5b pop %ebx
296: 5d pop %ebp
297: c3 ret
298: 90 nop
299: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000002a0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 57 push %edi
2a4: 8b 55 10 mov 0x10(%ebp),%edx
2a7: 8b 45 08 mov 0x8(%ebp),%eax
2aa: 56 push %esi
2ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ae: 85 d2 test %edx,%edx
2b0: 7e 13 jle 2c5 <memmove+0x25>
2b2: 01 c2 add %eax,%edx
dst = vdst;
2b4: 89 c7 mov %eax,%edi
2b6: 8d 76 00 lea 0x0(%esi),%esi
2b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
*dst++ = *src++;
2c0: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
2c1: 39 fa cmp %edi,%edx
2c3: 75 fb jne 2c0 <memmove+0x20>
return vdst;
}
2c5: 5e pop %esi
2c6: 5f pop %edi
2c7: 5d pop %ebp
2c8: c3 ret
000002c9 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2c9: b8 01 00 00 00 mov $0x1,%eax
2ce: cd 40 int $0x40
2d0: c3 ret
000002d1 <exit>:
SYSCALL(exit)
2d1: b8 02 00 00 00 mov $0x2,%eax
2d6: cd 40 int $0x40
2d8: c3 ret
000002d9 <wait>:
SYSCALL(wait)
2d9: b8 03 00 00 00 mov $0x3,%eax
2de: cd 40 int $0x40
2e0: c3 ret
000002e1 <pipe>:
SYSCALL(pipe)
2e1: b8 04 00 00 00 mov $0x4,%eax
2e6: cd 40 int $0x40
2e8: c3 ret
000002e9 <read>:
SYSCALL(read)
2e9: b8 05 00 00 00 mov $0x5,%eax
2ee: cd 40 int $0x40
2f0: c3 ret
000002f1 <write>:
SYSCALL(write)
2f1: b8 10 00 00 00 mov $0x10,%eax
2f6: cd 40 int $0x40
2f8: c3 ret
000002f9 <close>:
SYSCALL(close)
2f9: b8 15 00 00 00 mov $0x15,%eax
2fe: cd 40 int $0x40
300: c3 ret
00000301 <kill>:
SYSCALL(kill)
301: b8 06 00 00 00 mov $0x6,%eax
306: cd 40 int $0x40
308: c3 ret
00000309 <exec>:
SYSCALL(exec)
309: b8 07 00 00 00 mov $0x7,%eax
30e: cd 40 int $0x40
310: c3 ret
00000311 <open>:
SYSCALL(open)
311: b8 0f 00 00 00 mov $0xf,%eax
316: cd 40 int $0x40
318: c3 ret
00000319 <mknod>:
SYSCALL(mknod)
319: b8 11 00 00 00 mov $0x11,%eax
31e: cd 40 int $0x40
320: c3 ret
00000321 <unlink>:
SYSCALL(unlink)
321: b8 12 00 00 00 mov $0x12,%eax
326: cd 40 int $0x40
328: c3 ret
00000329 <fstat>:
SYSCALL(fstat)
329: b8 08 00 00 00 mov $0x8,%eax
32e: cd 40 int $0x40
330: c3 ret
00000331 <link>:
SYSCALL(link)
331: b8 13 00 00 00 mov $0x13,%eax
336: cd 40 int $0x40
338: c3 ret
00000339 <mkdir>:
SYSCALL(mkdir)
339: b8 14 00 00 00 mov $0x14,%eax
33e: cd 40 int $0x40
340: c3 ret
00000341 <chdir>:
SYSCALL(chdir)
341: b8 09 00 00 00 mov $0x9,%eax
346: cd 40 int $0x40
348: c3 ret
00000349 <dup>:
SYSCALL(dup)
349: b8 0a 00 00 00 mov $0xa,%eax
34e: cd 40 int $0x40
350: c3 ret
00000351 <getpid>:
SYSCALL(getpid)
351: b8 0b 00 00 00 mov $0xb,%eax
356: cd 40 int $0x40
358: c3 ret
00000359 <sbrk>:
SYSCALL(sbrk)
359: b8 0c 00 00 00 mov $0xc,%eax
35e: cd 40 int $0x40
360: c3 ret
00000361 <sleep>:
SYSCALL(sleep)
361: b8 0d 00 00 00 mov $0xd,%eax
366: cd 40 int $0x40
368: c3 ret
00000369 <uptime>:
SYSCALL(uptime)
369: b8 0e 00 00 00 mov $0xe,%eax
36e: cd 40 int $0x40
370: c3 ret
00000371 <trace>:
SYSCALL(trace)
371: b8 16 00 00 00 mov $0x16,%eax
376: cd 40 int $0x40
378: c3 ret
00000379 <getsharem>:
SYSCALL(getsharem)
379: b8 17 00 00 00 mov $0x17,%eax
37e: cd 40 int $0x40
380: c3 ret
00000381 <releasesharem>:
SYSCALL(releasesharem)
381: b8 18 00 00 00 mov $0x18,%eax
386: cd 40 int $0x40
388: c3 ret
00000389 <split>:
SYSCALL(split)
389: b8 19 00 00 00 mov $0x19,%eax
38e: cd 40 int $0x40
390: c3 ret
00000391 <memo>:
SYSCALL(memo)
391: b8 1a 00 00 00 mov $0x1a,%eax
396: cd 40 int $0x40
398: c3 ret
00000399 <getmemo>:
SYSCALL(getmemo)
399: b8 1b 00 00 00 mov $0x1b,%eax
39e: cd 40 int $0x40
3a0: c3 ret
000003a1 <setmemo>:
SYSCALL(setmemo)
3a1: b8 1c 00 00 00 mov $0x1c,%eax
3a6: cd 40 int $0x40
3a8: c3 ret
000003a9 <att>:
SYSCALL(att)
3a9: b8 1d 00 00 00 mov $0x1d,%eax
3ae: cd 40 int $0x40
3b0: c3 ret
3b1: 66 90 xchg %ax,%ax
3b3: 66 90 xchg %ax,%ax
3b5: 66 90 xchg %ax,%ax
3b7: 66 90 xchg %ax,%ax
3b9: 66 90 xchg %ax,%ax
3bb: 66 90 xchg %ax,%ax
3bd: 66 90 xchg %ax,%ax
3bf: 90 nop
000003c0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
3c0: 55 push %ebp
3c1: 89 e5 mov %esp,%ebp
3c3: 57 push %edi
3c4: 56 push %esi
3c5: 53 push %ebx
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
3c6: 89 d3 mov %edx,%ebx
{
3c8: 83 ec 3c sub $0x3c,%esp
3cb: 89 45 bc mov %eax,-0x44(%ebp)
if(sgn && xx < 0){
3ce: 85 d2 test %edx,%edx
3d0: 0f 89 92 00 00 00 jns 468 <printint+0xa8>
3d6: f6 45 08 01 testb $0x1,0x8(%ebp)
3da: 0f 84 88 00 00 00 je 468 <printint+0xa8>
neg = 1;
3e0: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp)
x = -xx;
3e7: f7 db neg %ebx
} else {
x = xx;
}
i = 0;
3e9: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3f0: 8d 75 d7 lea -0x29(%ebp),%esi
3f3: eb 08 jmp 3fd <printint+0x3d>
3f5: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
3f8: 89 7d c4 mov %edi,-0x3c(%ebp)
}while((x /= base) != 0);
3fb: 89 c3 mov %eax,%ebx
buf[i++] = digits[x % base];
3fd: 89 d8 mov %ebx,%eax
3ff: 31 d2 xor %edx,%edx
401: 8b 7d c4 mov -0x3c(%ebp),%edi
404: f7 f1 div %ecx
406: 83 c7 01 add $0x1,%edi
409: 0f b6 92 24 08 00 00 movzbl 0x824(%edx),%edx
410: 88 14 3e mov %dl,(%esi,%edi,1)
}while((x /= base) != 0);
413: 39 d9 cmp %ebx,%ecx
415: 76 e1 jbe 3f8 <printint+0x38>
if(neg)
417: 8b 45 c0 mov -0x40(%ebp),%eax
41a: 85 c0 test %eax,%eax
41c: 74 0d je 42b <printint+0x6b>
buf[i++] = '-';
41e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
423: ba 2d 00 00 00 mov $0x2d,%edx
buf[i++] = digits[x % base];
428: 89 7d c4 mov %edi,-0x3c(%ebp)
42b: 8b 45 c4 mov -0x3c(%ebp),%eax
42e: 8b 7d bc mov -0x44(%ebp),%edi
431: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
435: eb 0f jmp 446 <printint+0x86>
437: 89 f6 mov %esi,%esi
439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
440: 0f b6 13 movzbl (%ebx),%edx
443: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
446: 83 ec 04 sub $0x4,%esp
449: 88 55 d7 mov %dl,-0x29(%ebp)
44c: 6a 01 push $0x1
44e: 56 push %esi
44f: 57 push %edi
450: e8 9c fe ff ff call 2f1 <write>
while(--i >= 0)
455: 83 c4 10 add $0x10,%esp
458: 39 de cmp %ebx,%esi
45a: 75 e4 jne 440 <printint+0x80>
putc(fd, buf[i]);
}
45c: 8d 65 f4 lea -0xc(%ebp),%esp
45f: 5b pop %ebx
460: 5e pop %esi
461: 5f pop %edi
462: 5d pop %ebp
463: c3 ret
464: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
468: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp)
46f: e9 75 ff ff ff jmp 3e9 <printint+0x29>
474: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
47a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000480 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
480: 55 push %ebp
481: 89 e5 mov %esp,%ebp
483: 57 push %edi
484: 56 push %esi
485: 53 push %ebx
486: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
489: 8b 75 0c mov 0xc(%ebp),%esi
48c: 0f b6 1e movzbl (%esi),%ebx
48f: 84 db test %bl,%bl
491: 0f 84 b9 00 00 00 je 550 <printf+0xd0>
ap = (uint*)(void*)&fmt + 1;
497: 8d 45 10 lea 0x10(%ebp),%eax
49a: 83 c6 01 add $0x1,%esi
write(fd, &c, 1);
49d: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
4a0: 31 d2 xor %edx,%edx
ap = (uint*)(void*)&fmt + 1;
4a2: 89 45 d0 mov %eax,-0x30(%ebp)
4a5: eb 38 jmp 4df <printf+0x5f>
4a7: 89 f6 mov %esi,%esi
4a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
4b0: 89 55 d4 mov %edx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
4b3: ba 25 00 00 00 mov $0x25,%edx
if(c == '%'){
4b8: 83 f8 25 cmp $0x25,%eax
4bb: 74 17 je 4d4 <printf+0x54>
write(fd, &c, 1);
4bd: 83 ec 04 sub $0x4,%esp
4c0: 88 5d e7 mov %bl,-0x19(%ebp)
4c3: 6a 01 push $0x1
4c5: 57 push %edi
4c6: ff 75 08 pushl 0x8(%ebp)
4c9: e8 23 fe ff ff call 2f1 <write>
4ce: 8b 55 d4 mov -0x2c(%ebp),%edx
} else {
putc(fd, c);
4d1: 83 c4 10 add $0x10,%esp
4d4: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
4d7: 0f b6 5e ff movzbl -0x1(%esi),%ebx
4db: 84 db test %bl,%bl
4dd: 74 71 je 550 <printf+0xd0>
c = fmt[i] & 0xff;
4df: 0f be cb movsbl %bl,%ecx
4e2: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
4e5: 85 d2 test %edx,%edx
4e7: 74 c7 je 4b0 <printf+0x30>
}
} else if(state == '%'){
4e9: 83 fa 25 cmp $0x25,%edx
4ec: 75 e6 jne 4d4 <printf+0x54>
if(c == 'd'){
4ee: 83 f8 64 cmp $0x64,%eax
4f1: 0f 84 99 00 00 00 je 590 <printf+0x110>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
4f7: 81 e1 f7 00 00 00 and $0xf7,%ecx
4fd: 83 f9 70 cmp $0x70,%ecx
500: 74 5e je 560 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
502: 83 f8 73 cmp $0x73,%eax
505: 0f 84 d5 00 00 00 je 5e0 <printf+0x160>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
50b: 83 f8 63 cmp $0x63,%eax
50e: 0f 84 8c 00 00 00 je 5a0 <printf+0x120>
putc(fd, *ap);
ap++;
} else if(c == '%'){
514: 83 f8 25 cmp $0x25,%eax
517: 0f 84 b3 00 00 00 je 5d0 <printf+0x150>
write(fd, &c, 1);
51d: 83 ec 04 sub $0x4,%esp
520: c6 45 e7 25 movb $0x25,-0x19(%ebp)
524: 6a 01 push $0x1
526: 57 push %edi
527: ff 75 08 pushl 0x8(%ebp)
52a: e8 c2 fd ff ff call 2f1 <write>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
52f: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
532: 83 c4 0c add $0xc,%esp
535: 6a 01 push $0x1
537: 83 c6 01 add $0x1,%esi
53a: 57 push %edi
53b: ff 75 08 pushl 0x8(%ebp)
53e: e8 ae fd ff ff call 2f1 <write>
for(i = 0; fmt[i]; i++){
543: 0f b6 5e ff movzbl -0x1(%esi),%ebx
putc(fd, c);
547: 83 c4 10 add $0x10,%esp
}
state = 0;
54a: 31 d2 xor %edx,%edx
for(i = 0; fmt[i]; i++){
54c: 84 db test %bl,%bl
54e: 75 8f jne 4df <printf+0x5f>
}
}
}
550: 8d 65 f4 lea -0xc(%ebp),%esp
553: 5b pop %ebx
554: 5e pop %esi
555: 5f pop %edi
556: 5d pop %ebp
557: c3 ret
558: 90 nop
559: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 16, 0);
560: 83 ec 0c sub $0xc,%esp
563: b9 10 00 00 00 mov $0x10,%ecx
568: 6a 00 push $0x0
56a: 8b 5d d0 mov -0x30(%ebp),%ebx
56d: 8b 45 08 mov 0x8(%ebp),%eax
570: 8b 13 mov (%ebx),%edx
572: e8 49 fe ff ff call 3c0 <printint>
ap++;
577: 89 d8 mov %ebx,%eax
579: 83 c4 10 add $0x10,%esp
state = 0;
57c: 31 d2 xor %edx,%edx
ap++;
57e: 83 c0 04 add $0x4,%eax
581: 89 45 d0 mov %eax,-0x30(%ebp)
584: e9 4b ff ff ff jmp 4d4 <printf+0x54>
589: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 10, 1);
590: 83 ec 0c sub $0xc,%esp
593: b9 0a 00 00 00 mov $0xa,%ecx
598: 6a 01 push $0x1
59a: eb ce jmp 56a <printf+0xea>
59c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, *ap);
5a0: 8b 5d d0 mov -0x30(%ebp),%ebx
write(fd, &c, 1);
5a3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
5a6: 8b 03 mov (%ebx),%eax
write(fd, &c, 1);
5a8: 6a 01 push $0x1
ap++;
5aa: 83 c3 04 add $0x4,%ebx
write(fd, &c, 1);
5ad: 57 push %edi
5ae: ff 75 08 pushl 0x8(%ebp)
putc(fd, *ap);
5b1: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
5b4: e8 38 fd ff ff call 2f1 <write>
ap++;
5b9: 89 5d d0 mov %ebx,-0x30(%ebp)
5bc: 83 c4 10 add $0x10,%esp
state = 0;
5bf: 31 d2 xor %edx,%edx
5c1: e9 0e ff ff ff jmp 4d4 <printf+0x54>
5c6: 8d 76 00 lea 0x0(%esi),%esi
5c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
putc(fd, c);
5d0: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
5d3: 83 ec 04 sub $0x4,%esp
5d6: e9 5a ff ff ff jmp 535 <printf+0xb5>
5db: 90 nop
5dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
5e0: 8b 45 d0 mov -0x30(%ebp),%eax
5e3: 8b 18 mov (%eax),%ebx
ap++;
5e5: 83 c0 04 add $0x4,%eax
5e8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
5eb: 85 db test %ebx,%ebx
5ed: 74 17 je 606 <printf+0x186>
while(*s != 0){
5ef: 0f b6 03 movzbl (%ebx),%eax
state = 0;
5f2: 31 d2 xor %edx,%edx
while(*s != 0){
5f4: 84 c0 test %al,%al
5f6: 0f 84 d8 fe ff ff je 4d4 <printf+0x54>
5fc: 89 75 d4 mov %esi,-0x2c(%ebp)
5ff: 89 de mov %ebx,%esi
601: 8b 5d 08 mov 0x8(%ebp),%ebx
604: eb 1a jmp 620 <printf+0x1a0>
s = "(null)";
606: bb 1b 08 00 00 mov $0x81b,%ebx
while(*s != 0){
60b: 89 75 d4 mov %esi,-0x2c(%ebp)
60e: b8 28 00 00 00 mov $0x28,%eax
613: 89 de mov %ebx,%esi
615: 8b 5d 08 mov 0x8(%ebp),%ebx
618: 90 nop
619: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
write(fd, &c, 1);
620: 83 ec 04 sub $0x4,%esp
s++;
623: 83 c6 01 add $0x1,%esi
626: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
629: 6a 01 push $0x1
62b: 57 push %edi
62c: 53 push %ebx
62d: e8 bf fc ff ff call 2f1 <write>
while(*s != 0){
632: 0f b6 06 movzbl (%esi),%eax
635: 83 c4 10 add $0x10,%esp
638: 84 c0 test %al,%al
63a: 75 e4 jne 620 <printf+0x1a0>
63c: 8b 75 d4 mov -0x2c(%ebp),%esi
state = 0;
63f: 31 d2 xor %edx,%edx
641: e9 8e fe ff ff jmp 4d4 <printf+0x54>
646: 66 90 xchg %ax,%ax
648: 66 90 xchg %ax,%ax
64a: 66 90 xchg %ax,%ax
64c: 66 90 xchg %ax,%ax
64e: 66 90 xchg %ax,%ax
00000650 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
650: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
651: a1 dc 0a 00 00 mov 0xadc,%eax
{
656: 89 e5 mov %esp,%ebp
658: 57 push %edi
659: 56 push %esi
65a: 53 push %ebx
65b: 8b 5d 08 mov 0x8(%ebp),%ebx
65e: 8b 10 mov (%eax),%edx
bp = (Header*)ap - 1;
660: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
663: 39 c8 cmp %ecx,%eax
665: 73 19 jae 680 <free+0x30>
667: 89 f6 mov %esi,%esi
669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
670: 39 d1 cmp %edx,%ecx
672: 72 14 jb 688 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
674: 39 d0 cmp %edx,%eax
676: 73 10 jae 688 <free+0x38>
{
678: 89 d0 mov %edx,%eax
67a: 8b 10 mov (%eax),%edx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
67c: 39 c8 cmp %ecx,%eax
67e: 72 f0 jb 670 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
680: 39 d0 cmp %edx,%eax
682: 72 f4 jb 678 <free+0x28>
684: 39 d1 cmp %edx,%ecx
686: 73 f0 jae 678 <free+0x28>
break;
if(bp + bp->s.size == p->s.ptr){
688: 8b 73 fc mov -0x4(%ebx),%esi
68b: 8d 3c f1 lea (%ecx,%esi,8),%edi
68e: 39 fa cmp %edi,%edx
690: 74 1e je 6b0 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
692: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
695: 8b 50 04 mov 0x4(%eax),%edx
698: 8d 34 d0 lea (%eax,%edx,8),%esi
69b: 39 f1 cmp %esi,%ecx
69d: 74 28 je 6c7 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
69f: 89 08 mov %ecx,(%eax)
freep = p;
}
6a1: 5b pop %ebx
freep = p;
6a2: a3 dc 0a 00 00 mov %eax,0xadc
}
6a7: 5e pop %esi
6a8: 5f pop %edi
6a9: 5d pop %ebp
6aa: c3 ret
6ab: 90 nop
6ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
6b0: 03 72 04 add 0x4(%edx),%esi
6b3: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
6b6: 8b 10 mov (%eax),%edx
6b8: 8b 12 mov (%edx),%edx
6ba: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
6bd: 8b 50 04 mov 0x4(%eax),%edx
6c0: 8d 34 d0 lea (%eax,%edx,8),%esi
6c3: 39 f1 cmp %esi,%ecx
6c5: 75 d8 jne 69f <free+0x4f>
p->s.size += bp->s.size;
6c7: 03 53 fc add -0x4(%ebx),%edx
freep = p;
6ca: a3 dc 0a 00 00 mov %eax,0xadc
p->s.size += bp->s.size;
6cf: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6d2: 8b 53 f8 mov -0x8(%ebx),%edx
6d5: 89 10 mov %edx,(%eax)
}
6d7: 5b pop %ebx
6d8: 5e pop %esi
6d9: 5f pop %edi
6da: 5d pop %ebp
6db: c3 ret
6dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000006e0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
6e0: 55 push %ebp
6e1: 89 e5 mov %esp,%ebp
6e3: 57 push %edi
6e4: 56 push %esi
6e5: 53 push %ebx
6e6: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6e9: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
6ec: 8b 3d dc 0a 00 00 mov 0xadc,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6f2: 8d 70 07 lea 0x7(%eax),%esi
6f5: c1 ee 03 shr $0x3,%esi
6f8: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
6fb: 85 ff test %edi,%edi
6fd: 0f 84 ad 00 00 00 je 7b0 <malloc+0xd0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
703: 8b 17 mov (%edi),%edx
if(p->s.size >= nunits){
705: 8b 4a 04 mov 0x4(%edx),%ecx
708: 39 ce cmp %ecx,%esi
70a: 76 72 jbe 77e <malloc+0x9e>
70c: 81 fe 00 10 00 00 cmp $0x1000,%esi
712: bb 00 10 00 00 mov $0x1000,%ebx
717: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
71a: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
721: 89 45 e4 mov %eax,-0x1c(%ebp)
724: eb 1b jmp 741 <malloc+0x61>
726: 8d 76 00 lea 0x0(%esi),%esi
729: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
730: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
732: 8b 48 04 mov 0x4(%eax),%ecx
735: 39 f1 cmp %esi,%ecx
737: 73 4f jae 788 <malloc+0xa8>
739: 8b 3d dc 0a 00 00 mov 0xadc,%edi
73f: 89 c2 mov %eax,%edx
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
741: 39 d7 cmp %edx,%edi
743: 75 eb jne 730 <malloc+0x50>
p = sbrk(nu * sizeof(Header));
745: 83 ec 0c sub $0xc,%esp
748: ff 75 e4 pushl -0x1c(%ebp)
74b: e8 09 fc ff ff call 359 <sbrk>
if(p == (char*)-1)
750: 83 c4 10 add $0x10,%esp
753: 83 f8 ff cmp $0xffffffff,%eax
756: 74 1c je 774 <malloc+0x94>
hp->s.size = nu;
758: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
75b: 83 ec 0c sub $0xc,%esp
75e: 83 c0 08 add $0x8,%eax
761: 50 push %eax
762: e8 e9 fe ff ff call 650 <free>
return freep;
767: 8b 15 dc 0a 00 00 mov 0xadc,%edx
if((p = morecore(nunits)) == 0)
76d: 83 c4 10 add $0x10,%esp
770: 85 d2 test %edx,%edx
772: 75 bc jne 730 <malloc+0x50>
return 0;
}
}
774: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
777: 31 c0 xor %eax,%eax
}
779: 5b pop %ebx
77a: 5e pop %esi
77b: 5f pop %edi
77c: 5d pop %ebp
77d: c3 ret
if(p->s.size >= nunits){
77e: 89 d0 mov %edx,%eax
780: 89 fa mov %edi,%edx
782: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
788: 39 ce cmp %ecx,%esi
78a: 74 54 je 7e0 <malloc+0x100>
p->s.size -= nunits;
78c: 29 f1 sub %esi,%ecx
78e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
791: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
794: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
797: 89 15 dc 0a 00 00 mov %edx,0xadc
}
79d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
7a0: 83 c0 08 add $0x8,%eax
}
7a3: 5b pop %ebx
7a4: 5e pop %esi
7a5: 5f pop %edi
7a6: 5d pop %ebp
7a7: c3 ret
7a8: 90 nop
7a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
7b0: c7 05 dc 0a 00 00 e0 movl $0xae0,0xadc
7b7: 0a 00 00
base.s.size = 0;
7ba: bf e0 0a 00 00 mov $0xae0,%edi
base.s.ptr = freep = prevp = &base;
7bf: c7 05 e0 0a 00 00 e0 movl $0xae0,0xae0
7c6: 0a 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7c9: 89 fa mov %edi,%edx
base.s.size = 0;
7cb: c7 05 e4 0a 00 00 00 movl $0x0,0xae4
7d2: 00 00 00
if(p->s.size >= nunits){
7d5: e9 32 ff ff ff jmp 70c <malloc+0x2c>
7da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
7e0: 8b 08 mov (%eax),%ecx
7e2: 89 0a mov %ecx,(%edx)
7e4: eb b1 jmp 797 <malloc+0xb7>
|
non_regression/other_x86_linux_28.s.asm | LRGH/plasmasm | 1 | 11081 | <reponame>LRGH/plasmasm
.file "(extract)plotport.c"
.section .rodata
.globl XX_LOWER
.type XX_LOWER, @object
XX_LOWER:
.byte 46
.size XX_LOWER, 1
# ----------------------
.globl XX_UPPER
.type XX_UPPER, @object
XX_UPPER:
.byte 39
.size XX_UPPER, 1
# ----------------------
.globl YY
.type YY, @object
YY:
.byte 124
.size YY, 1
# ----------------------
.globl BLANK
.type BLANK, @object
BLANK:
.byte 32
.align 4
.L241:
.long .L240
.long .L16
.long .L45
.long .L240
.long .L23
.long .L240
.long .L52
.long .L240
.long .L239
.size BLANK, 1
# ----------------------
.text
.p2align 2,,3
# ----------------------
.local gtofp
.type gtofp, @function
gtofp:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $44, %esp
movl %eax, %edi
movl (%eax), %eax
shrl $25, %eax
cmpl $8, %eax
movl %edx, %esi
ja .L240
jmp *.L241(,%eax,4)
.p2align 2,,3
.L240:
subl $8, %esp
pushl $.LC662
pushl $11
call pari_err
xorl %eax, %eax
.L267:
addl $16, %esp
.L14:
addl $44, %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.p2align 2,,3
.L239:
subl $8, %esp
pushl %edx
pushl %edi
call quadtofp
jmp .L267
.p2align 2,,3
.L16:
movl avma, %eax
movl %eax, %ebx
subl bot, %eax
leal 0(,%edx,4), %edx
shrl $2, %eax
subl %edx, %ebx
cmpl %esi, %eax
jb .L274
.L17:
testl $-16777216, %esi
movl %ebx, avma
jne .L275
.L19:
subl $8, %esp
orl $67108864, %esi
movl %esi, (%ebx)
pushl %ebx
pushl %edi
call affir
addl $16, %esp
.L268:
movl %ebx, %eax
.L282:
addl $44, %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.p2align 2,,3
.L45:
movl avma, %ebp
movl %ebp, %ebx
subl bot, %ebp
leal 0(,%edx,4), %ecx
shrl $2, %ebp
subl %ecx, %ebx
cmpl %edx, %ebp
jb .L276
.L46:
testl $-16777216, %esi
movl %ebx, avma
jne .L277
.L48:
subl $8, %esp
orl $67108864, %esi
movl %esi, (%ebx)
pushl %ebx
pushl %edi
call affrr
addl $16, %esp
jmp .L268
.p2align 2,,3
.L23:
movl 4(%edi), %ebx
movl avma, %ecx
movl %ebx, 40(%esp)
movl %ecx, %ebx
subl bot, %ecx
movl 8(%edi), %ebp
shrl $2, %ecx
leal 0(,%edx,4), %edi
subl %edi, %ebx
cmpl %edx, %ecx
jb .L278
.L24:
testl $-16777216, %esi
movl %ebx, avma
jne .L279
.L26:
movl %esi, %ecx
orl $67108864, %ecx
movl %ecx, (%ebx)
movl avma, %edx
movl %edx, 36(%esp)
subl $8, %esp
pushl %ebx
pushl 52(%esp)
call affir
movl 4(%ebp), %eax
andl $16777215, %eax
addl $16, %esp
cmpl $3, %eax
jg .L31
je .L280
.L242:
subl $8, %esp
pushl %ebx
subl $12, %esp
pushl 8(%ebp)
pushl %ebx
call divrs
addl $20, %esp
pushl %eax
call affrr
movl 4(%ebp), %esi
addl $16, %esp
testl %esi, %esi
js .L281
.L36:
movl 36(%esp), %eax
.L270:
movl %eax, avma
movl %ebx, %eax
jmp .L282
.p2align 2,,3
.L52:
movl 8(%edi), %ebp
movl (%ebp), %eax
shrl $25, %eax
decl %eax
movl 4(%edi), %ebx
je .L283
.L53:
movl (%ebx), %ecx
shrl $25, %ecx
decl %ecx
je .L284
.L96:
movl avma, %ebx
movl %ebx, %ebp
subl bot, %ebp
shrl $2, %ebp
leal -12(%ebx), %edx
cmpl $3, %ebp
movl %edx, 20(%esp)
jb .L285
.L153:
movl 20(%esp), %eax
movl %eax, avma
movl $201326595, -12(%ebx)
movl 4(%edi), %ebp
movl (%ebp), %eax
shrl $25, %eax
cmpl $2, %eax
je .L189
jle .L286
cmpl $4, %eax
je .L287
.L196:
subl $8, %esp
pushl $.LC660
pushl $11
call pari_err
addl $16, %esp
xorl %eax, %eax
.L166:
movl 20(%esp), %ebx
movl %eax, 4(%ebx)
movl 8(%edi), %edi
movl (%edi), %eax
shrl $25, %eax
cmpl $2, %eax
je .L229
jg .L237
decl %eax
je .L288
.L236:
subl $8, %esp
pushl $.LC660
pushl $11
call pari_err
addl $16, %esp
xorl %eax, %eax
.L206:
movl 20(%esp), %ebx
movl %eax, 8(%ebx)
addl $44, %esp
movl %ebx, %eax
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size gtofp, .-gtofp
# ----------------------
.comm pari_plot,52,32
# ----------------------
.comm pari_psplot,52,32
# ----------------------
.comm rectgraph,72,32
# ----------------------
.local current_color
.comm current_color,72,32
# ----------------------
.ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-11)"
.section .note.GNU-stack,"",@progbits
|
src/data/scoreboard.asm | jonasbantunes/tictactoe-gb | 0 | 80159 | <reponame>jonasbantunes/tictactoe-gb
scoreboard:
; db " "
db "X: O: "
db 0 |
libsrc/target/excali64/gencon/copy_font.asm | jpoikela/z88dk | 640 | 243647 | <reponame>jpoikela/z88dk<filename>libsrc/target/excali64/gencon/copy_font.asm<gh_stars>100-1000
SECTION code_graphics
PUBLIC copy_font
defc PCG_RAM = $4000
; Copy a font into page 0 of the PCG memory
; Entry: bc =font
; l = start character
; h = number of characters
copy_font:
ld a,h
push af
; Each character is 12 rows
ld h,0
add hl,hl ;x2
add hl,hl ;x4
ld d,h
ld e,l
add hl,hl ;x8
;add hl,de ;x12
add hl,hl ;x16
ld de,PCG_RAM
add hl,de ;Now points to start of hires memory
ld d,b ;
ld e,c
ex de,hl ;hl = font, de = distination
pop af ;Number of characters
ld c,a
for_each_character:
push bc
xor a
call wrbyte
call wrbyte
ld b,8
row_loop:
ld a,(hl)
call wrbyte
inc hl
djnz row_loop
xor a
ld b,6
fill_1:
call wrbyte
djnz fill_1
pop bc
dec c
jr nz,for_each_character
ret
wrbyte:
ex af,af
wait_sync:
in a,($50)
bit 4,a
jr z,wait_sync
push af
res 1,a
set 0,a
out ($70),a
ex af,af
ld (de),a
inc de
ex af,af
pop af
out ($70),a
ex af,af
ret
|
source/nodes/program-nodes-requeue_statements.ads | optikos/oasis | 0 | 1605 | -- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Expressions;
with Program.Elements.Requeue_Statements;
with Program.Element_Visitors;
package Program.Nodes.Requeue_Statements is
pragma Preelaborate;
type Requeue_Statement is
new Program.Nodes.Node
and Program.Elements.Requeue_Statements.Requeue_Statement
and Program.Elements.Requeue_Statements.Requeue_Statement_Text
with private;
function Create
(Requeue_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Entry_Name : not null Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Abort_Token : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Requeue_Statement;
type Implicit_Requeue_Statement is
new Program.Nodes.Node
and Program.Elements.Requeue_Statements.Requeue_Statement
with private;
function Create
(Entry_Name : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_With_Abort : Boolean := False)
return Implicit_Requeue_Statement
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Requeue_Statement is
abstract new Program.Nodes.Node
and Program.Elements.Requeue_Statements.Requeue_Statement
with record
Entry_Name : not null Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize (Self : aliased in out Base_Requeue_Statement'Class);
overriding procedure Visit
(Self : not null access Base_Requeue_Statement;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Entry_Name
(Self : Base_Requeue_Statement)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Requeue_Statement_Element
(Self : Base_Requeue_Statement)
return Boolean;
overriding function Is_Statement_Element
(Self : Base_Requeue_Statement)
return Boolean;
type Requeue_Statement is
new Base_Requeue_Statement
and Program.Elements.Requeue_Statements.Requeue_Statement_Text
with record
Requeue_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Abort_Token : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Requeue_Statement_Text
(Self : aliased in out Requeue_Statement)
return Program.Elements.Requeue_Statements.Requeue_Statement_Text_Access;
overriding function Requeue_Token
(Self : Requeue_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Requeue_Statement)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Abort_Token
(Self : Requeue_Statement)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Requeue_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Has_With_Abort
(Self : Requeue_Statement)
return Boolean;
type Implicit_Requeue_Statement is
new Base_Requeue_Statement
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
Has_With_Abort : Boolean;
end record;
overriding function To_Requeue_Statement_Text
(Self : aliased in out Implicit_Requeue_Statement)
return Program.Elements.Requeue_Statements.Requeue_Statement_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Requeue_Statement)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Requeue_Statement)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Requeue_Statement)
return Boolean;
overriding function Has_With_Abort
(Self : Implicit_Requeue_Statement)
return Boolean;
end Program.Nodes.Requeue_Statements;
|
array/a001.asm | czfshine/assembly-exercise | 1 | 10598 | <reponame>czfshine/assembly-exercise<filename>array/a001.asm
; 8086 assembly file
; by:czfshine
; date: 2018/04/03 13:43:26
; The Main Data segment
DATA SEGMENT
M db 1,2,-3,4,-5,6,7,-8,9,-10,8,6,8,6,81,5,45,68,65,65;
len equ $ -M
p db len dup(?)
lenp dw 0
n db len dup(?)
lenn dw 0
DATA ENDS
STACK SEGMENT
DW 256 DUP(?)
TOP LABEL WORD
STACK ENDS
;entry code segment
CODE SEGMENT
ASSUME CS:CODE ,DS:DATA,SS:STACK
START: ;entry point
MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
LEA SP,TOP
lea bx,M
mov si,0
s:
mov dl,[bx+si]
cmp dl,0
jg hig
jl lo
jmp en
hig:
push bx
push si
lea bx,p
mov si,lenp
mov dl,[bx+si]
inc si
mov lenp,si
pop si
pop bx
jmp en
lo:
push bx
push si
lea bx,n
mov si,lenn
mov dl,[bx+si]
inc si
mov lenn,si
pop si
pop bx
jmp en
en:
inc si
cmp si,len
jnz s
mov Bx,lenp
CALL s2210
MOV DL,','
MOV AH,02h
INT 21H
MOV BX,lenn
CALL S2210
MOV AH,4CH ;return
INT 21H
s2210:
;Show 2 to 10
;parm bx
;SEE P003
;use stack
push SI
PUSH cx
PUSH AX
PUSH BX
PUSH DX
;push all
MOV SI,10 ;BASE
mov cx,0;
MOV AX,BX
p2:
MOV DX,0
DIV SI ;dx ax / 10 = ax......dx
push dx
inc cl
cmp ax ,0
jnz p2
;pop & print
mov ah,02h
pr:
pop dx
add dl,'0'
int 21H
loop pr
pop dx
pop bx
pop ax
pop cx
pop si
ret
CODE ENDS
END START |
programs/oeis/217/A217400.asm | jmorken/loda | 1 | 13685 | ; A217400: Numbers starting with 7.
; 7,70,71,72,73,74,75,76,77,78,79,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013,7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042,7043,7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7071,7072,7073,7074,7075,7076,7077,7078,7079,7080,7081,7082,7083,7084,7085,7086,7087,7088,7089,7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105,7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136,7137,7138
mov $3,$0
lpb $0
sub $0,1
div $0,10
add $1,2
mov $2,$1
sub $2,3
mov $1,$2
mul $1,10
add $1,72
lpe
cal $0,142
add $1,$0
add $1,6
add $1,$3
|
break-stub.applescript | tangledhelix/breaktime-workflow | 2 | 3006 | on alfred_script(q)
-- A list of apps to quit when switching to this state
set appsToQuit to {}
-- A list of apps to close windows (not quit) when switching to this state
set appsToCloseWindows to {}
-- A list of apps to start when switching to this state
set appsToLaunch to {"Slack", "Messages"}
-- A list of URL prefixes to close (assumes Google Chrome is browser)
set urlsToClose to {}
disable_dnd()
quit_apps(appsToQuit)
close_app_windows(appsToCloseWindows)
close_google_chrome_tabs(urlsToClose)
launch_apps(appsToLaunch)
end alfred_script
|
text/TextParser.applescript | GitSyncApp/applescripts | 6 | 4389 | --property TextParser : my ScriptLoader's load_script(alias ((path to scripts folder from user domain as text) & "text:TextParser.applescript"))
(*
* Returns an array of every word in the_text
*)
on every_word(the_text)
return every word of the_text
end every_word
(*
* Returns all paragraps in a text as a list
* TODO: write an example
* // :TODO: rename to every_line?
*)
on every_paragraph(the_text)
set paragraph_list to {}
set para_list to paragraphs of the_text
repeat with next_line in para_list
if length of next_line is greater than 0 then -- this takes care of not adding an emty item at the end
copy next_line to the end of paragraph_list
end if
end repeat
return paragraph_list
end every_paragraph
(*
* Returns a list of text items by splitting a text at every delimiter
*)
on split(the_text, delimiter)
set text item delimiters to delimiter
set ret_val to every text item of the_text
set text item delimiters to "," --reset applescript delimiter to default
return ret_val
end split
(*
* Returns the length of theText
*)
on text_length(the_text)
return length of the_text
end text_length
(*
* Returns a comma delimited list like "blue, red, orange" from an array like {"blue","red","orange"}
* Example: log TextParser's comma_delimited_text({"blue", "red", "orange"}) yields "blue, red, orange"
* TODO USE THIS INSTEAD: set AppleScript's text item delimiters to {" "} -- A single space
* TODO move to ArrayParser
* AND THEN : the_list as text
*)
on comma_delimited_text(text_items)
delimited_text(text_items, "," & space)
end comma_delimited_text
--Returns a text item by stitching many text items together with the delimiter inbetween each word
on delimited_text(text_items, delimiter)
set ret_val to ""
repeat with i from 1 to (length of text_items) --Todo: store len in a variable
set the_word to item i of text_items
set head to ""
set tail to delimiter
if i = 1 then
set head to ""
end if
if i = (length of text_items) then
set tail to ""
end if
set ret_val to ret_val & head & the_word & tail
end repeat
return ret_val
end delimited_text
(*
* TODO: doesnt this add a return at the last line? maybe use delimited_text() intead?
* // :TODO: try to find a better name
*)
on to_paragraphs(the_list)
set AppleScript's text item delimiters to {return}
return the_list as text
end to_paragraphs
(*
* cardinal is one two three etc
* TODO: one could create a dynamic ordinal generator in the future, that would combine two words to generate twenthy+eigth etc
*)
on ordinal(the_number)
set ordinals to {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "seventeenth", "eigthteenth", "nineteenth", "twenteenth"}
return item the_number of ordinals
end ordinal
(*
* Returns encode text (escaped)
* Caution: encode does not handle the double quote char very well
* Note: this could also be done by creating a a method that does all the character trickery involved in unescaping/escaping text, but this method leverages the php language to do all this for us
* Example: encode("<image location:files/img/image.jpg")--%3Cimage+location%3Afiles%2Fimg%2Fimage.jpg
*)
on encode(the_text)
return do shell script "php -r 'echo urlencode(\"" & the_text & "\");'"
end encode
(*
* Returns dencode text (unescaped)
* Note this could also be done by creating a a method that does all the character trickery involved in unescaping/escaping text, but this method leverages the php language to do all this for us
* Example: decode(%3Cimage+location%3Afiles%2Fimg%2Fimage.jpg)--<image location:files/img/image.jpg
*)
on decode(the_text)
return do shell script "php -r 'echo urldecode(\"" & the_text & "\");'"
end decode
(*
* Returns a text in quoted form
* Todo: write an example
*)
on quoted_form(the_text)
return quoted form of the_text
end quoted_form
(*
* substring
* the start: 1
* the end: ((length of second_part) - 2)
* Todo: write an example
*)
on sub_string(the_start, the_end, the_text)
return text the_start thru the_end of the_text
end sub_string
(*
* Counts how many times a string appears in a text
* Note: Its splits the text by the substring and counts the items
*)
on occurrences(the_text, match)
set AppleScript's text item delimiters to match
set counter to (count of every text item of the_text) - 1
set AppleScript's text item delimiters to ""
return counter
end occurrences
(*
* Returns a text without linebreaks, a substitue replaces the linebreak char
* Note: linebreaks often come in the form of \\n or \\r
* Caution: if a line is empty it is still replaced with the_substitute
* Param: the_substitue is the replacement for the linebreak
*)
on wrap_text(the_text, the_substitue)
set the_wrapped_text to ""
set the_paragraphs to paragraphs of the_text
set the_len to length of the_paragraphs
repeat with i from 1 to the_len
set the_paragraph to item i of the_paragraphs
if (i = the_len) then
set the_wrapped_text to the_wrapped_text & the_paragraph --append the paragraph to the text
else
set the_wrapped_text to the_wrapped_text & the_paragraph & the_substitue --append the paragraph to the text and the line break replacement
end if
end repeat
return the_wrapped_text
end wrap_text |
CS21/asm/lcm.asm | rizarae/rizarae.github.io | 0 | 91231 | # Lab 4
# LCM
# lab lab
.text
main:
li $v0, 5
syscall # first int (a)
move $t0, $v0
li $v0, 5
syscall # second int (b)
move $t1, $v0
move $s0, $t0
move $s1, $t1
lcm:
beq $t0, $t1, end
bgt $t0, $t1, add_to_t1
add $t0, $t0, $s0
b lcm
add_to_t1:
add $t1, $t1, $s1
b lcm
end:
li $v0, 1
move $a0, $t0
syscall
li $v0, 10
syscall |
2A/S7/SysConc/TP/TP6/lr-synchro-basique.ads | MOUDDENEHamza/ENSEEIHT | 4 | 28593 | <reponame>MOUDDENEHamza/ENSEEIHT
package LR.Synchro.Basique is
function Nom_Strategie return String;
procedure Demander_Lecture;
procedure Demander_Ecriture;
procedure Terminer_Lecture;
procedure Terminer_Ecriture;
end LR.Synchro.Basique;
|
Source/display.adb | XMoose25X/Advanced-Dungeon-Assault | 1 | 20814 | with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
package body display is
function "=" (L, R : pixelType) return Boolean is
begin
null;
--do compare
return (L.char = R.char);
end "=";
procedure setPixel(X,Y : Integer; char : character; color : colorType := colorDefault) is
begin
begin
Screen(X,Y).char := char;
Screen(X,Y).color := color;
exception
when others =>
null;
end;
end setPixel;
procedure setPixel(X,Y : Integer; pixel : pixelType) is
begin
Screen(X,Y) := pixel;
end setPixel;
function getPixel(X,Y : Integer) return pixelType is
temp : pixelType := pixelType'('~', colorDefault);
begin
if(X >= 0 and X <= Screen_Width and Y >= 0 and Y <= Screen_Height) then
temp := screen(X,Y);
end if;
return temp;
end getPixel;
function LoadSprite(FileName : String) return SpriteType is
File : File_Type;
width : Integer;
height : Integer;
sprite : SpriteType;
line: String(1..2500);
color : colorType := colorDefault;
offset : Positive := 1;
begin
--clear garbage data
width := 127;
height := 63;
For Y in Integer range 0..height loop
For X in Integer range 0..width loop
sprite.Image(X,Y).char := ' ';
sprite.color := colorDefault;
end loop;
end loop;
--load sprite
Open(File, In_File, FileName);
Get(File => File, Item => width);
Get(File => File, Item => height);
Skip_Line(File);
sprite.Width := width;
sprite.Height := height;
For Y in Integer range 0..sprite.height loop
Get_Line(File => File, Item => line, Last => width);
--Put(line(1..width-1));
width := width;
--Skip_Line(File);
offset := 1;
color := colorDefault;
For X in Integer range 0..sprite.width-1 loop
color := Line(X+offset..X+offset+colorType'length-1);
offset := offset+colorType'length;
sprite.Image(X,Y).char := line(X+offset);
sprite.Image(X,Y).color := color;
end loop;
exit when End_of_File(File);
--Put(" <EOL> ");
new_line;
end loop;
Close(File);
Return sprite;
end LoadSprite;
procedure SetSprite(posX, posY : Integer; sprite : SpriteType) is
chr : Character;
col : colorType;
begin
For Y in Integer range 0..sprite.Height-1 loop
For X in Integer range 0..sprite.Width-1 loop
if (posX + X <= Screen_Width AND posX + X >= 0
AND posY + Y <= Screen_Height AND posY + Y >= 0) then
chr := sprite.Image(X,Y).char;
col := sprite.Image(X,Y).color;
if (Character'Pos(chr) >= 32) then
setPixel(posX + X, posY + Y, chr, col);
end if;
end if;
end loop;
end loop;
end SetSprite;
--text functions
procedure setText(posX,posY : Integer; Item : String; color : colorType := colorDefault) is
begin
for I in Integer Range 1..Item'length loop
if(posX + I >= 0 and posX + I <= Screen_Width) then
setPixel(posX + I, posY, Item(I), color);
end if;
end loop;
end setText;
procedure setText(posX,posY : Integer; Item : Character; color : colorType := colorDefault) is
begin
if(posX >= 0 and posX <= Screen_Width) then
setPixel(posX, posY, Item, color);
end if;
end setText;
procedure Initialize(width, height : Integer) is
begin
Screen_Width := width;
Screen_Height := height;
--Initialize Screen to blank
For Y in Integer Range 0..Screen_Height loop
For X in Integer Range 0..Screen_Width loop
setPixel(X,Y,' ',colorDefault);
end loop;
end loop;
end Initialize;
--Refresh Screen
procedure Refresh is
begin
--clear screen
--New_Line(100);
Put(ASCII.ESC & "[;H");
--fill screen
For Y in Integer Range 0..Screen_Height loop
For X in Integer Range 0..Screen_Width loop
begin
Put(Screen(X,Y).color);
if(Character'Pos(Screen(X,Y).char) >= 32) then
Put(Screen(X,Y).char);
else
Put(' ');
end if;
exception
when others =>
null;
end;
Flush;
end loop;
New_Line;
end loop;
end Refresh;
procedure ClearDisplay is
begin
For Y in Integer Range 0..Screen_Height loop
For X in Integer Range 0..Screen_Width loop
setPixel(X,Y,' ', colorDefault);
end loop;
end loop;
end ClearDisplay;
procedure WipeScreen is
begin
put(ASCII.ESC & "[2J");
end WipeScreen;
end display;
|
src/LibraBFT/Impl/Consensus/EpochManager/Properties.agda | LaudateCorpus1/bft-consensus-agda | 0 | 10857 | {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Base.Types
open import LibraBFT.Concrete.System
open import LibraBFT.Concrete.System.Parameters
import LibraBFT.Impl.Consensus.BlockStorage.BlockStore as BlockStore
import LibraBFT.Impl.Consensus.BlockStorage.Properties.BlockStore as BSprops
open import LibraBFT.Impl.Consensus.EpochManager as EpochManager
open import LibraBFT.Impl.Consensus.EpochManagerTypes
import LibraBFT.Impl.Consensus.MetricsSafetyRules as MetricsSafetyRules
open import LibraBFT.Impl.Consensus.Properties.MetricsSafetyRules
import LibraBFT.Impl.Consensus.RoundManager as RoundManager
open import LibraBFT.Impl.Consensus.RoundManager.Properties
import LibraBFT.Impl.Consensus.SafetyRules.SafetyRulesManager as SafetyRulesManager
open import LibraBFT.Impl.OBM.Logging.Logging
open import LibraBFT.Impl.Properties.Util
open import LibraBFT.ImplShared.Base.Types
open import LibraBFT.ImplShared.Consensus.Types
open import LibraBFT.ImplShared.Consensus.Types.EpochDep
open import LibraBFT.ImplShared.Interface.Output
open import LibraBFT.ImplShared.Util.Dijkstra.All
open import Optics.All
open import Util.Hash
open import Util.Lemmas
open import Util.PKCS
open import Util.Prelude
open import Yasm.System ℓ-RoundManager ℓ-VSFP ConcSysParms
open InitProofDefs
open Invariants
open EpochManagerInv
open SafetyRulesInv
open SafetyDataInv
module LibraBFT.Impl.Consensus.EpochManager.Properties where
module newSpec
(nodeConfig : NodeConfig)
(stateComp : StateComputer)
(persistentLivenessStorage : PersistentLivenessStorage)
(obmAuthor : Author)
(obmSK : SK)
where
-- TODO-2: May require refinement (additional requirements and/or properties)
Contract : EitherD-Post ErrLog EpochManager
Contract (Left _) = ⊤
Contract (Right em) = ∀ {sr} → em ^∙ emSafetyRulesManager ∙ srmInternalSafetyRules ≡ SRWLocal sr
→ sr ^∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVote ≡ nothing
postulate
contract : Contract (EpochManager.new nodeConfig stateComp persistentLivenessStorage obmAuthor obmSK)
module startRoundManager'Spec
(self0 : EpochManager)
(now : Instant)
(recoveryData : RecoveryData)
(epochState0 : EpochState)
(obmNeedFetch : ObmNeedFetch)
(obmProposalGenerator : ProposalGenerator)
(obmVersion : Version)
where
open startRoundManager'-ed self0 now recoveryData epochState0
obmNeedFetch obmProposalGenerator obmVersion
lastVote = recoveryData ^∙ rdLastVote
proposalGenerator = obmProposalGenerator
roundState = createRoundState-abs self0 now
proposerElection = createProposerElection epochState0
srUpdate : SafetyRules → SafetyRules
srUpdate = _& srPersistentStorage ∙ pssSafetyData ∙ sdEpoch ∙~ epochState0 ^∙ esEpoch
initProcessor : SafetyRules → BlockStore → RoundManager
initProcessor sr bs =
RoundManager∙new
obmNeedFetch
epochState0
bs
roundState
proposerElection
proposalGenerator
(srUpdate sr)
(self0 ^∙ emConfig ∙ ccSyncOnly)
ecInfo = mkECinfo (epochState0 ^∙ esVerifier) (epochState0 ^∙ esEpoch)
SRVoteEpoch≡ : SafetyRules → Epoch → Set
SRVoteEpoch≡ sr epoch = ∀ {v} → sr ^∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVote ≡ just v
→ v ^∙ vEpoch ≡ epoch
SRVoteRound≤ : SafetyRules → Set
SRVoteRound≤ sr = let sd = sr ^∙ srPersistentStorage ∙ pssSafetyData
in Meta.getLastVoteRound sd ≤ sd ^∙ sdLastVotedRound
initRMInv : ∀ {sr bs}
→ ValidatorVerifier-correct (epochState0 ^∙ esVerifier)
→ SafetyDataInv (sr ^∙ srPersistentStorage ∙ pssSafetyData)
→ sr ^∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVote ≡ nothing
→ BlockStoreInv (bs , ecInfo)
→ RoundManagerInv (initProcessor sr bs)
initRMInv {sr} vvCorr sdInv refl bsInv = mkRoundManagerInv vvCorr refl bsInv (mkSafetyRulesInv (mkSafetyDataInv refl z≤n))
contract-continue2 :
∀ {sr bs}
→ ValidatorVerifier-correct (epochState0 ^∙ esVerifier)
→ SafetyRulesInv sr
→ sr ^∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVote ≡ nothing
→ BlockStoreInv (bs , ecInfo)
→ EitherD-weakestPre (continue2-abs lastVote bs sr) (InitContract lastVote)
contract-continue2 {sr} {bs} vvCorr srInv lvNothing bsInv rewrite continue2-abs-≡
with LBFT-contract (RoundManager.start-abs now lastVote)
(Contract initRM initRMCorr)
(initProcessor sr bs)
(contract' initRM initRMCorr)
where
open startSpec now lastVote
initRM = initProcessor sr bs
initRMCorr = initRMInv {sr} {bs} vvCorr (sdInv srInv) lvNothing bsInv
...| inj₁ (_ , er≡j ) rewrite er≡j = tt
...| inj₂ (er≡n , ico) rewrite er≡n =
LBFT-post (RoundManager.start-abs now lastVote)
(initProcessor sr bs)
, refl , ico
contract-continue1
: ∀ {bs}
→ BlockStoreInv (bs , ecInfo)
→ ValidatorVerifier-correct (epochState0 ^∙ esVerifier)
→ EpochManagerInv self0
→ EitherD-weakestPre (continue1-abs lastVote bs) (InitContract lastVote)
contract-continue1 {bs} bsInv vvCorr emi rewrite continue1-abs-≡
with self0 ^∙ emSafetyRulesManager ∙ srmInternalSafetyRules | inspect
(self0 ^∙_) (emSafetyRulesManager ∙ srmInternalSafetyRules)
...| SRWLocal safetyRules | [ R ]
with emiSRI emi R
...| (sri , lvNothing)
with performInitializeSpec.contract safetyRules (self0 ^∙ emStorage) sri lvNothing
...| piProp
with MetricsSafetyRules.performInitialize-abs safetyRules (self0 ^∙ emStorage)
...| Left _ = tt
...| Right sr = contract-continue2 vvCorr (performInitializeSpec.ContractOk.srPres piProp sri)
(performInitializeSpec.ContractOk.lvNothing piProp) bsInv
contract' :
ValidatorVerifier-correct (epochState0 ^∙ esVerifier)
→ EpochManagerInv self0
→ EitherD-weakestPre
(EpochManager.startRoundManager'-ed-abs
self0 now recoveryData epochState0
obmNeedFetch obmProposalGenerator obmVersion)
(InitContract lastVote)
contract' vvCorr emi rewrite startRoundManager'-ed-abs-≡
with BSprops.new.contract (self0 ^∙ emStorage) recoveryData stateComputer
(self0 ^∙ emConfig ∙ ccMaxPrunedBlocksInMem)
...| bsprop
with BlockStore.new-e-abs (self0 ^∙ emStorage) recoveryData stateComputer
(self0 ^∙ emConfig ∙ ccMaxPrunedBlocksInMem)
...| Left _ = tt
...| Right bs = contract-continue1 bsprop vvCorr emi
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/chip/ys_chip6.asm | prismotizm/gigaleak | 0 | 13673 | <reponame>prismotizm/gigaleak<gh_stars>0
Name: ys_chip6.asm
Type: file
Size: 42891
Last-Modified: '2016-05-13T04:50:33Z'
SHA-1: 3E967CE655D20BCD5489FC23DDF5805BA17A6CC5
Description: null
|
source/amf/uml/amf-uml-transitions.ads | svn2github/matreshka | 24 | 7776 | <filename>source/amf/uml/amf-uml-transitions.ads
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A transition is a directed relationship between a source vertex and a
-- target vertex. It may be part of a compound transition, which takes the
-- state machine from one state configuration to another, representing the
-- complete response of the state machine to an occurrence of an event of a
-- particular type.
------------------------------------------------------------------------------
limited with AMF.UML.Behaviors;
limited with AMF.UML.Classifiers;
limited with AMF.UML.Constraints;
with AMF.UML.Namespaces;
with AMF.UML.Redefinable_Elements;
limited with AMF.UML.Regions;
limited with AMF.UML.State_Machines;
limited with AMF.UML.Triggers.Collections;
limited with AMF.UML.Vertexs;
package AMF.UML.Transitions is
pragma Preelaborate;
type UML_Transition is limited interface
and AMF.UML.Namespaces.UML_Namespace
and AMF.UML.Redefinable_Elements.UML_Redefinable_Element;
type UML_Transition_Access is
access all UML_Transition'Class;
for UML_Transition_Access'Storage_Size use 0;
not overriding function Get_Container
(Self : not null access constant UML_Transition)
return AMF.UML.Regions.UML_Region_Access is abstract;
-- Getter of Transition::container.
--
-- Designates the region that owns this transition.
not overriding procedure Set_Container
(Self : not null access UML_Transition;
To : AMF.UML.Regions.UML_Region_Access) is abstract;
-- Setter of Transition::container.
--
-- Designates the region that owns this transition.
not overriding function Get_Effect
(Self : not null access constant UML_Transition)
return AMF.UML.Behaviors.UML_Behavior_Access is abstract;
-- Getter of Transition::effect.
--
-- Specifies an optional behavior to be performed when the transition
-- fires.
not overriding procedure Set_Effect
(Self : not null access UML_Transition;
To : AMF.UML.Behaviors.UML_Behavior_Access) is abstract;
-- Setter of Transition::effect.
--
-- Specifies an optional behavior to be performed when the transition
-- fires.
not overriding function Get_Guard
(Self : not null access constant UML_Transition)
return AMF.UML.Constraints.UML_Constraint_Access is abstract;
-- Getter of Transition::guard.
--
-- A guard is a constraint that provides a fine-grained control over the
-- firing of the transition. The guard is evaluated when an event
-- occurrence is dispatched by the state machine. If the guard is true at
-- that time, the transition may be enabled, otherwise, it is disabled.
-- Guards should be pure expressions without side effects. Guard
-- expressions with side effects are ill formed.
not overriding procedure Set_Guard
(Self : not null access UML_Transition;
To : AMF.UML.Constraints.UML_Constraint_Access) is abstract;
-- Setter of Transition::guard.
--
-- A guard is a constraint that provides a fine-grained control over the
-- firing of the transition. The guard is evaluated when an event
-- occurrence is dispatched by the state machine. If the guard is true at
-- that time, the transition may be enabled, otherwise, it is disabled.
-- Guards should be pure expressions without side effects. Guard
-- expressions with side effects are ill formed.
not overriding function Get_Kind
(Self : not null access constant UML_Transition)
return AMF.UML.UML_Transition_Kind is abstract;
-- Getter of Transition::kind.
--
-- Indicates the precise type of the transition.
not overriding procedure Set_Kind
(Self : not null access UML_Transition;
To : AMF.UML.UML_Transition_Kind) is abstract;
-- Setter of Transition::kind.
--
-- Indicates the precise type of the transition.
not overriding function Get_Redefined_Transition
(Self : not null access constant UML_Transition)
return AMF.UML.Transitions.UML_Transition_Access is abstract;
-- Getter of Transition::redefinedTransition.
--
-- The transition that is redefined by this transition.
not overriding procedure Set_Redefined_Transition
(Self : not null access UML_Transition;
To : AMF.UML.Transitions.UML_Transition_Access) is abstract;
-- Setter of Transition::redefinedTransition.
--
-- The transition that is redefined by this transition.
not overriding function Get_Redefinition_Context
(Self : not null access constant UML_Transition)
return AMF.UML.Classifiers.UML_Classifier_Access is abstract;
-- Getter of Transition::redefinitionContext.
--
-- References the classifier in which context this element may be
-- redefined.
not overriding function Get_Source
(Self : not null access constant UML_Transition)
return AMF.UML.Vertexs.UML_Vertex_Access is abstract;
-- Getter of Transition::source.
--
-- Designates the originating vertex (state or pseudostate) of the
-- transition.
not overriding procedure Set_Source
(Self : not null access UML_Transition;
To : AMF.UML.Vertexs.UML_Vertex_Access) is abstract;
-- Setter of Transition::source.
--
-- Designates the originating vertex (state or pseudostate) of the
-- transition.
not overriding function Get_Target
(Self : not null access constant UML_Transition)
return AMF.UML.Vertexs.UML_Vertex_Access is abstract;
-- Getter of Transition::target.
--
-- Designates the target vertex that is reached when the transition is
-- taken.
not overriding procedure Set_Target
(Self : not null access UML_Transition;
To : AMF.UML.Vertexs.UML_Vertex_Access) is abstract;
-- Setter of Transition::target.
--
-- Designates the target vertex that is reached when the transition is
-- taken.
not overriding function Get_Trigger
(Self : not null access constant UML_Transition)
return AMF.UML.Triggers.Collections.Set_Of_UML_Trigger is abstract;
-- Getter of Transition::trigger.
--
-- Specifies the triggers that may fire the transition.
not overriding function Containing_State_Machine
(Self : not null access constant UML_Transition)
return AMF.UML.State_Machines.UML_State_Machine_Access is abstract;
-- Operation Transition::containingStateMachine.
--
-- The query containingStateMachine() returns the state machine that
-- contains the transition either directly or transitively.
overriding function Is_Consistent_With
(Self : not null access constant UML_Transition;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is abstract;
-- Operation Transition::isConsistentWith.
--
-- The query isConsistentWith() specifies that a redefining transition is
-- consistent with a redefined transition provided that the redefining
-- transition has the following relation to the redefined transition: A
-- redefining transition redefines all properties of the corresponding
-- redefined transition, except the source state and the trigger.
not overriding function Redefinition_Context
(Self : not null access constant UML_Transition)
return AMF.UML.Classifiers.UML_Classifier_Access is abstract;
-- Operation Transition::redefinitionContext.
--
-- The redefinition context of a transition is the nearest containing
-- statemachine.
end AMF.UML.Transitions;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_749.asm | ljhsiun2/medusa | 9 | 11597 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x89ab, %rbp
add %r13, %r13
and $0xffffffffffffffc0, %rbp
vmovntdqa (%rbp), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rax
nop
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_UC_ht+0xf1e7, %r13
xor %rdi, %rdi
movw $0x6162, (%r13)
nop
cmp %rbp, %rbp
lea addresses_WC_ht+0x186e7, %rsi
lea addresses_A_ht+0x159e7, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $104, %rcx
rep movsq
nop
nop
nop
nop
nop
add $55766, %r15
lea addresses_D_ht+0x2de7, %rcx
nop
nop
nop
nop
nop
inc %rbp
vmovups (%rcx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r13
nop
nop
nop
and $39025, %rbp
lea addresses_D_ht+0x1abe7, %rsi
lea addresses_A_ht+0x6e7, %rdi
nop
nop
and %rbp, %rbp
mov $113, %rcx
rep movsq
nop
nop
nop
nop
xor $56350, %rax
lea addresses_WT_ht+0x3fe7, %rax
nop
nop
cmp $31157, %r13
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
vmovups %ymm6, (%rax)
nop
add $29868, %r15
lea addresses_WT_ht+0x121e7, %r13
nop
nop
nop
nop
nop
xor %rsi, %rsi
movl $0x61626364, (%r13)
nop
cmp %rbp, %rbp
lea addresses_D_ht+0xa5e7, %rsi
lea addresses_WT_ht+0x69e7, %rdi
nop
nop
nop
xor $53782, %rbp
mov $34, %rcx
rep movsq
nop
nop
nop
nop
xor $12091, %rdi
lea addresses_A_ht+0x191e7, %rsi
lea addresses_WC_ht+0x1a9e7, %rdi
nop
nop
nop
nop
sub $9383, %rbp
mov $22, %rcx
rep movsw
nop
nop
nop
nop
add $3966, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rbp
push %rbx
push %rdx
push %rsi
// Store
lea addresses_normal+0x69e7, %r10
nop
nop
xor %r12, %r12
movl $0x51525354, (%r10)
xor %rdx, %rdx
// Store
lea addresses_D+0x149e7, %r12
clflush (%r12)
nop
nop
nop
nop
and %rbp, %rbp
mov $0x5152535455565758, %r10
movq %r10, (%r12)
add %r12, %r12
// Faulty Load
lea addresses_D+0xd1e7, %rbp
nop
nop
nop
nop
nop
lfence
mov (%rbp), %r14
lea oracles, %r10
and $0xff, %r14
shlq $12, %r14
mov (%r10,%r14,1), %r14
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 2, 'NT': True, 'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
y2s2/csa/practicals/prac-5/warm-up-1.asm | ouldevloper/university | 8 | 165708 | ; Write program, acepts digit, multiply itself, display result
.MODEL SMALL
.STACK 100
.DATA
pr DB "Enter a digit: $"
dig DB ?
num1 DB ?
num2 DB ?
TEN DB 10
NL DB 13, 10, "$"
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
; Accept digit
MOV AH, 09H
LEA DX, pr
INT 21H
MOV AH, 01H
INT 21H
; Multiply
SUB AL, "0"
MUL AL
MOV dig, AL
; Output it
; Divide first
DIV TEN
MOV num1, AL
MOV num2, AH
ADD num1, "0"
ADD num2, "0"
; Display both digits
MOV AH, 09H
LEA DX, NL
INT 21H
MOV AH, 02H
MOV DL, num1
INT 21H
MOV DL, num2
INT 21H
MOV AX,4C00H
INT 21H
MAIN ENDP
END MAIN |
source/oasis/program-elements-element_iterator_specifications.ads | reznikmm/gela | 0 | 14671 | <gh_stars>0
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Elements.Defining_Identifiers;
with Program.Lexical_Elements;
with Program.Elements.Subtype_Indications;
with Program.Elements.Expressions;
package Program.Elements.Element_Iterator_Specifications is
pragma Pure (Program.Elements.Element_Iterator_Specifications);
type Element_Iterator_Specification is
limited interface and Program.Elements.Declarations.Declaration;
type Element_Iterator_Specification_Access is
access all Element_Iterator_Specification'Class with Storage_Size => 0;
not overriding function Name
(Self : Element_Iterator_Specification)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is abstract;
not overriding function Subtype_Indication
(Self : Element_Iterator_Specification)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is abstract;
not overriding function Iterable_Name
(Self : Element_Iterator_Specification)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
not overriding function Has_Reverse
(Self : Element_Iterator_Specification)
return Boolean is abstract;
type Element_Iterator_Specification_Text is limited interface;
type Element_Iterator_Specification_Text_Access is
access all Element_Iterator_Specification_Text'Class
with Storage_Size => 0;
not overriding function To_Element_Iterator_Specification_Text
(Self : in out Element_Iterator_Specification)
return Element_Iterator_Specification_Text_Access is abstract;
not overriding function Colon_Token
(Self : Element_Iterator_Specification_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Of_Token
(Self : Element_Iterator_Specification_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Reverse_Token
(Self : Element_Iterator_Specification_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Element_Iterator_Specifications;
|
BFF.agda | jvoigtlaender/bidiragda | 0 | 12561 | module BFF where
open import Data.Nat using (ℕ)
open import Data.Fin using (Fin)
open import Level using () renaming (zero to ℓ₀)
import Category.Monad
import Category.Functor
open import Data.Maybe using (Maybe ; just ; nothing ; maybe′)
open Category.Monad.RawMonad {Level.zero} Data.Maybe.monad using (_>>=_)
open Category.Functor.RawFunctor {Level.zero} Data.Maybe.functor using (_<$>_)
open import Data.List using (List ; [] ; _∷_ ; map ; length)
open import Data.Vec using (Vec ; toList ; fromList ; allFin) renaming (lookup to lookupV ; map to mapV ; [] to []V ; _∷_ to _∷V_)
open import Function using (_∘_ ; flip)
open import Relation.Binary using (Setoid ; DecSetoid ; module DecSetoid)
open import FinMap
open import Generic using (sequenceV ; ≡-to-Π)
open import Structures using (Shaped ; module Shaped)
open import Instances using (VecShaped)
import CheckInsert
open import GetTypes using (VecVec-to-PartialVecVec ; PartialVecVec-to-PartialShapeShape)
module PartialShapeBFF (A : DecSetoid ℓ₀ ℓ₀) where
open GetTypes.PartialShapeShape public using (Get ; module Get)
open module A = DecSetoid A using (Carrier) renaming (_≟_ to deq)
open CheckInsert A
assoc : {n m : ℕ} → Vec (Fin n) m → Vec Carrier m → Maybe (FinMapMaybe n Carrier)
assoc []V []V = just empty
assoc (i ∷V is) (b ∷V bs) = (assoc is bs) >>= (checkInsert i b)
enumerate : {S : Set} {C : Set → S → Set} → (ShapeT : Shaped S C) → (s : S) → C (Fin (Shaped.arity ShapeT s)) s
enumerate ShapeT s = fill s (allFin (arity s))
where open Shaped ShapeT
denumerate : {S : Set} {C : Set → S → Set} → (ShapeT : Shaped S C) → {α : Set} {s : S} → (c : C α s) → Fin (Shaped.arity ShapeT s) → α
denumerate ShapeT c = flip lookupV (Shaped.content ShapeT c)
bff : (G : Get) → {i : Get.I G} → (j : Get.I G) → Get.SourceContainer G Carrier (Get.gl₁ G i) → Get.ViewContainer G Carrier (Get.gl₂ G j) → Maybe (Get.SourceContainer G (Maybe Carrier) (Get.gl₁ G j))
bff G {i} j s v = let s′ = enumerate SourceShapeT (gl₁ i)
t′ = get s′
g = fromFunc (denumerate SourceShapeT s)
g′ = delete-many (Shaped.content ViewShapeT t′) g
t = enumerate SourceShapeT (gl₁ j)
h = assoc (Shaped.content ViewShapeT (get t)) (Shaped.content ViewShapeT v)
h′ = (flip union (reshape g′ (Shaped.arity SourceShapeT (gl₁ j)))) <$> h
in ((λ f → fmapS f t) ∘ flip lookupM) <$> h′
where open Get G
sbff : (G : Get) → {i : Get.I G} → (j : Get.I G) → Get.SourceContainer G Carrier (Get.gl₁ G i) → Get.ViewContainer G Carrier (Get.gl₂ G j) → Maybe (Get.SourceContainer G Carrier (Get.gl₁ G j))
sbff G j s v = bff G j s v >>= Shaped.sequence (Get.SourceShapeT G)
module PartialVecBFF (A : DecSetoid ℓ₀ ℓ₀) where
open GetTypes.PartialVecVec public using (Get)
open module A = DecSetoid A using (Carrier) renaming (_≟_ to deq)
open CheckInsert A
open PartialShapeBFF A public using (assoc)
enumerate : {n : ℕ} → Vec Carrier n → Vec (Fin n) n
enumerate {n} _ = PartialShapeBFF.enumerate A VecShaped n
enumeratel : (n : ℕ) → Vec (Fin n) n
enumeratel = PartialShapeBFF.enumerate A VecShaped
denumerate : {n : ℕ} → Vec Carrier n → Fin n → Carrier
denumerate = PartialShapeBFF.denumerate A VecShaped
bff : (G : Get) → {i : Get.I G} → (j : Get.I G) → Vec Carrier (Get.gl₁ G i) → Vec Carrier (Get.gl₂ G j) → Maybe (Vec (Maybe Carrier) (Get.gl₁ G j))
bff G j s v = PartialShapeBFF.bff A (PartialVecVec-to-PartialShapeShape G) j s v
sbff : (G : Get) → {i : Get.I G} → (j : Get.I G) → Vec Carrier (Get.gl₁ G i) → Vec Carrier (Get.gl₂ G j) → Maybe (Vec Carrier (Get.gl₁ G j))
sbff G j s v = PartialShapeBFF.sbff A (PartialVecVec-to-PartialShapeShape G) j s v
module VecBFF (A : DecSetoid ℓ₀ ℓ₀) where
open GetTypes.VecVec public using (Get)
open module A = DecSetoid A using (Carrier) renaming (_≟_ to deq)
open CheckInsert A
open PartialVecBFF A public using (assoc ; enumerate ; denumerate)
bff : (G : Get) → {n : ℕ} → (m : ℕ) → Vec Carrier n → Vec Carrier (Get.getlen G m) → Maybe (Vec (Maybe Carrier) m)
bff G = PartialVecBFF.bff A (VecVec-to-PartialVecVec G)
sbff : (G : Get) → {n : ℕ} → (m : ℕ) → Vec Carrier n → Vec Carrier (Get.getlen G m) → Maybe (Vec Carrier m)
sbff G = PartialVecBFF.sbff A (VecVec-to-PartialVecVec G)
|
src/day-12/adventofcode-day_12-main.adb | persan/advent-of-code-2020 | 0 | 17932 | with Ada.Text_IO; use Ada.Text_IO;
procedure Adventofcode.Day_12.Main is
begin
Put_Line ("Day-12");
end Adventofcode.Day_12.Main;
|
misc/Lib/uptime_and_wifi.applescript | kinshuk4/evernote-automation | 4 | 694 | on run argv
if (do shell script "uptime") contains "mins," then
set uptime to do shell script "uptime | awk -F 'mins,' '{print $1}' | awk '{print $3}'"
else
set uptime to do shell script "uptime | awk -F ',' '{print $1}' | awk '{print $3}' | awk -F ':' '{hrs=$1; min=$2; print hrs*60 + min}'"
end if
if (uptime as integer) > 9 then
return uptime
end if
set wifi_name to do shell script "networksetup -getairportnetwork en0 | awk -F ': ' '{print $2}'"
if wifi_name = "Sina Plaza Mobile" then return do shell script "networksetup -setairportnetwork en0 'Sina Plaza Office' urtheone"
end run
|
tests/missions-test_data-tests-mission_container-test_data-tests.ads | thindil/steamsky | 80 | 9643 | <gh_stars>10-100
-- This package has been generated automatically by GNATtest.
-- Do not edit any part of it, see GNATtest documentation for more details.
-- begin read only
with Gnattest_Generated;
package Missions.Test_Data.Tests.Mission_Container.Test_Data.Tests is
type Test is new GNATtest_Generated.GNATtest_Standard.Missions.Test_Data
.Tests
.Mission_Container
.Test_Data
.New_Test with
null record;
end Missions.Test_Data.Tests.Mission_Container.Test_Data.Tests;
-- end read only
|
programs/oeis/036/A036126.asm | karttu/loda | 0 | 99291 | ; A036126: a(n) = 3^n mod 43.
; 1,3,9,27,38,28,41,37,25,32,10,30,4,12,36,22,23,26,35,19,14,42,40,34,16,5,15,2,6,18,11,33,13,39,31,7,21,20,17,8,24,29,1,3,9,27,38,28,41,37,25,32,10,30,4,12,36,22,23,26,35,19,14,42,40,34,16,5,15,2,6,18,11,33,13,39,31,7,21,20,17,8,24,29,1,3,9,27,38,28,41,37,25,32,10,30,4,12,36,22,23,26,35,19,14,42,40,34,16,5,15,2,6,18,11,33,13,39,31,7,21,20,17,8,24,29,1,3,9,27,38,28,41,37,25,32,10,30,4,12,36,22,23,26,35,19,14,42,40,34,16,5,15,2,6,18,11,33,13,39,31,7,21,20,17,8,24,29,1,3,9,27,38,28,41,37,25,32,10,30,4,12,36,22,23,26,35,19,14,42,40,34,16,5,15,2,6,18,11,33,13,39,31,7,21,20,17,8,24,29,1,3,9,27,38,28,41,37,25,32,10,30,4,12,36,22,23,26,35,19,14,42,40,34,16,5,15,2,6,18,11,33,13,39,31,7,21,20,17,8
mov $1,1
mov $2,$0
lpb $2,1
mul $1,3
mod $1,43
sub $2,1
lpe
|
Task/Nautical-bell/AppleScript/nautical-bell.applescript | LaudateCorpus1/RosettaCodeData | 1 | 4385 | <reponame>LaudateCorpus1/RosettaCodeData
repeat
set {hours:h, minutes:m} to (current date)
if {0, 30} contains m then
set bells to (h mod 4) * 2 + (m div 30)
if bells is 0 then set bells to 4
set pairs to bells div 2
repeat pairs times
say "ding dong" using "Bells"
end repeat
if (bells mod 2) is 1 then
say "dong" using "Bells"
end if
end if
delay 60
end repeat
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_12527_548.asm | ljhsiun2/medusa | 9 | 166906 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xd8d7, %rbx
nop
nop
sub %r11, %r11
movl $0x61626364, (%rbx)
nop
nop
nop
nop
inc %r14
lea addresses_UC_ht+0x166d7, %rsi
nop
nop
nop
nop
nop
add %r9, %r9
mov (%rsi), %r15d
nop
nop
nop
nop
nop
sub %rbx, %rbx
lea addresses_A_ht+0x191d7, %r14
nop
nop
nop
nop
and %r11, %r11
vmovups (%r14), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rsi
nop
and $24659, %r10
lea addresses_normal_ht+0x9b7f, %rsi
sub %rbx, %rbx
mov (%rsi), %r15
nop
nop
nop
nop
mfence
lea addresses_UC_ht+0xca97, %rsi
lea addresses_WT_ht+0x13ad7, %rdi
nop
nop
nop
xor $45592, %r10
mov $11, %rcx
rep movsb
nop
nop
nop
and %r10, %r10
lea addresses_D_ht+0x2557, %rsi
lea addresses_D_ht+0x10857, %rdi
xor $30092, %r11
mov $76, %rcx
rep movsw
nop
nop
nop
nop
nop
and %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %r9
push %rbp
push %rcx
push %rsi
// Store
lea addresses_WC+0x6ed7, %r9
nop
xor %rcx, %rcx
mov $0x5152535455565758, %rbp
movq %rbp, %xmm6
and $0xffffffffffffffc0, %r9
movaps %xmm6, (%r9)
nop
nop
nop
nop
cmp %rbp, %rbp
// Store
lea addresses_A+0x1417, %r11
nop
nop
add $45748, %rsi
movw $0x5152, (%r11)
nop
nop
nop
nop
add $42861, %r8
// Load
lea addresses_RW+0x1e8d7, %r9
cmp $53500, %r11
mov (%r9), %esi
nop
nop
nop
nop
add $54067, %rcx
// Store
lea addresses_WC+0xb8fd, %r8
nop
nop
nop
nop
and $9044, %rbp
movb $0x51, (%r8)
nop
nop
nop
and $24745, %r9
// Store
lea addresses_WC+0x6375, %r8
nop
add $45970, %rcx
movb $0x51, (%r8)
nop
nop
nop
nop
nop
sub $49404, %r9
// Store
lea addresses_D+0x277, %rbp
nop
dec %r9
mov $0x5152535455565758, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%rbp)
nop
nop
nop
nop
inc %r8
// Store
lea addresses_PSE+0x6ed7, %r12
xor %rbp, %rbp
movb $0x51, (%r12)
add $59629, %r9
// Faulty Load
lea addresses_US+0x4ed7, %r8
nop
nop
nop
nop
nop
add $18453, %r12
vmovups (%r8), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %rsi
lea oracles, %rbp
and $0xff, %rsi
shlq $12, %rsi
mov (%rbp,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}}
{'00': 12527}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
basic_associations/polymophic_pure_rdb_oriented.als | nowavailable/alloy_als_study | 0 | 2229 | sig UserProfile {
portrait: disj one Photo
}
sig Album {
photos: disj some Photo
} /*{
#photos > 0
}*/
sig Photo {
photoable_type: one PR_PhotoableTypeField
// photable_id は定義しない。
}
abstract sig PR_PhotoableTypeField {
--photos_identify: one Photo
}
sig UserProfile_Photoable extends PR_PhotoableTypeField {
user_profile: disj one UserProfile
}
sig Album_Photoable extends PR_PhotoableTypeField {
album: some Album
}
fact {
--photoable_type = ~photos_identify
all photo:Photo | photo = (Photo<:photoable_type).(photo.(Photo<:photoable_type))
Photo.photoable_type = PR_PhotoableTypeField
portrait = ~(photoable_type.user_profile)
photos = ~(photoable_type.album)
}
run {} // for 4 but 8 Photo
|
Assembler/tests/optimizations/branching.asm | karannewatia/SCALE-MAMBA | 196 | 5912 | popint r32 # 324
popint r33 # 325
ldint r37, 2 # 326
jmpeq r37, 0, 1 # 330
# Local_test-0-if-block-7
print_int r33 # 338
# Local_test-0-end-if-8
print_int r32 # 338
|
common.asm | m4t3uz/leaf-d | 0 | 175288 | ; Copyright (C) 2021 <NAME>
[bits 32]
global WritePortByte
global FlushTLB
global ReadEIP
global CopyPagePhysical
WritePortByte:
mov edx, [esp + 4] ; port
mov eax, [esp + 8] ; value
out dx, al
ret
FlushTLB:
mov eax, cr3
mov cr3, eax
ret
ReadEIP:
mov eax, [esp]
ret
CopyPagePhysical:
push ebx ; According to __cdecl, we must preserve the contents of EBX.
pushf ; push EFLAGS, so we can pop it and reenable interrupts
; later, if they were enabled anyway.
cli ; Disable interrupts, so we aren't interrupted.
; Load these in BEFORE we disable paging!
mov ebx, [esp+12] ; Source address
mov ecx, [esp+16] ; Destination address
mov edx, cr0 ; Get the control register...
and edx, 0x7fffffff ; and...
mov cr0, edx ; Disable paging.
mov edx, 1024 ; 1024*4bytes = 4096 bytes
.loop:
mov eax, [ebx] ; Get the word at the source address
mov [ecx], eax ; Store it at the dest address
add ebx, 4 ; Source address += sizeof(word)
add ecx, 4 ; Dest address += sizeof(word)
dec edx ; One less word to do
jnz .loop
mov edx, cr0 ; Get the control register again
or edx, 0x80000000 ; and...
mov cr0, edx ; Enable paging.
popf ; Pop EFLAGS back.
pop ebx ; Get the original value of EBX back.
ret
|
src/asis/a4g-a_elists.adb | My-Colaborations/dynamo | 15 | 13830 | <reponame>My-Colaborations/dynamo
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . A _ E L I S T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2007, Free Software Foundation, Inc. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adaccore.<EMAIL>). --
-- --
------------------------------------------------------------------------------
-- This is the modification of the GNAT Elists package. See spec for the
-- description of the modifications.
with A4G.A_Debug; use A4G.A_Debug;
with Output; use Output;
package body A4G.A_Elists is
----------------------
-- Add_To_Elmt_List --
----------------------
procedure Add_To_Elmt_List (Unit : Unit_Id; List : in out Elist_Id) is
begin
if No (List) then
List := New_Elmt_List;
Append_Elmt (Unit, List);
elsif not In_Elmt_List (Unit, List) then
Append_Elmt (Unit, List);
end if;
end Add_To_Elmt_List;
-----------------
-- Append_Elmt --
-----------------
procedure Append_Elmt (Unit : Unit_Id; To : Elist_Id) is
L : constant Elmt_Id := Elists.Table (To).Last;
begin
Elmts.Increment_Last;
Elmts.Table (Elmts.Last).Unit := Unit;
Elmts.Table (Elmts.Last).Next := Union_Id (To);
if L = No_Elmt then
Elists.Table (To).First := Elmts.Last;
else
Elmts.Table (L).Next := Union_Id (Elmts.Last);
end if;
Elists.Table (To).Last := Elmts.Last;
if Debug_Flag_N then
Write_Str ("Append new element Elmt_Id = ");
Write_Int (Int (Elmts.Last));
Write_Str (" to list Elist_Id = ");
Write_Int (Int (To));
Write_Str (" referencing Unit_Id = ");
Write_Int (Int (Unit));
Write_Eol;
end if;
end Append_Elmt;
------------------
-- Prepend_Elmt --
------------------
procedure Prepend_Elmt (Unit : Unit_Id; To : Elist_Id) is
F : constant Elmt_Id := Elists.Table (To).First;
begin
Elmts.Increment_Last;
Elmts.Table (Elmts.Last).Unit := Unit;
if F = No_Elmt then
Elists.Table (To).Last := Elmts.Last;
Elmts.Table (Elmts.Last).Next := Union_Id (To);
else
Elmts.Table (Elmts.Last).Next := Union_Id (F);
end if;
Elists.Table (To).First := Elmts.Last;
end Prepend_Elmt;
-----------------------
-- Insert_Elmt_After --
-----------------------
procedure Insert_Elmt_After (Unit : Unit_Id; Elmt : Elmt_Id) is
N : constant Union_Id := Elmts.Table (Elmt).Next;
begin
pragma Assert (Elmt /= No_Elmt);
Elmts.Increment_Last;
Elmts.Table (Elmts.Last).Unit := Unit;
Elmts.Table (Elmts.Last).Next := N;
Elmts.Table (Elmt).Next := Union_Id (Elmts.Last);
if N in Elist_Range then
Elists.Table (Elist_Id (N)).Last := Elmts.Last;
end if;
end Insert_Elmt_After;
-------------
-- Belongs --
-------------
function Belongs (List1 : Elist_Id; List2 : Elist_Id) return Boolean is
Curr_Elmt : Elmt_Id;
begin
if No (List1) or else Is_Empty_Elmt_List (List1) then
return True;
end if;
Curr_Elmt := First_Elmt (List1);
while Present (Curr_Elmt) loop
if not In_Elmt_List (Unit (Curr_Elmt), List2) then
return False;
end if;
Curr_Elmt := Next_Elmt (Curr_Elmt);
end loop;
return True;
end Belongs;
----------------
-- First_Elmt --
----------------
function First_Elmt (List : Elist_Id) return Elmt_Id is
begin
pragma Assert (List > Elist_Low_Bound);
return Elists.Table (List).First;
end First_Elmt;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Elists.Init;
Elmts.Init;
end Initialize;
------------------
-- In_Elmt_List --
------------------
function In_Elmt_List (U : Unit_Id; List : Elist_Id) return Boolean is
Curr_Elmt : Elmt_Id;
begin
if No (List) or else Is_Empty_Elmt_List (List) then
return False;
end if;
Curr_Elmt := First_Elmt (List);
while Present (Curr_Elmt) loop
if U = Unit (Curr_Elmt) then
return True;
end if;
Curr_Elmt := Next_Elmt (Curr_Elmt);
end loop;
return False;
end In_Elmt_List;
---------------
-- Intersect --
---------------
function Intersect (List1 : Elist_Id; List2 : Elist_Id) return Boolean is
Curr_Elmt : Elmt_Id;
begin
if No (List1) or else No (List2) or else
Is_Empty_Elmt_List (List1) or else
Is_Empty_Elmt_List (List2)
then
return False;
else
Curr_Elmt := First_Elmt (List1);
while Present (Curr_Elmt) loop
if In_Elmt_List (Unit (Curr_Elmt), List2) then
return True;
end if;
Curr_Elmt := Next_Elmt (Curr_Elmt);
end loop;
return False;
end if;
end Intersect;
------------------------
-- Is_Empty_Elmt_List --
------------------------
function Is_Empty_Elmt_List (List : Elist_Id) return Boolean is
begin
return Elists.Table (List).First = No_Elmt;
end Is_Empty_Elmt_List;
-------------------
-- Last_Elist_Id --
-------------------
function Last_Elist_Id return Elist_Id is
begin
return Elists.Last;
end Last_Elist_Id;
---------------
-- Last_Elmt --
---------------
function Last_Elmt (List : Elist_Id) return Elmt_Id is
begin
return Elists.Table (List).Last;
end Last_Elmt;
------------------
-- Last_Elmt_Id --
------------------
function Last_Elmt_Id return Elmt_Id is
begin
return Elmts.Last;
end Last_Elmt_Id;
-----------------
-- List_Length --
-----------------
function List_Length (List : Elist_Id) return Natural is
Result : Natural := 0;
Elem : Elmt_Id;
begin
Elem := First_Elmt (List);
while Present (Elem) loop
Result := Result + 1;
Elem := Next_Elmt (Elem);
end loop;
return Result;
end List_Length;
---------------
-- Move_List --
---------------
procedure Move_List
(List_From : Elist_Id;
List_To : in out Elist_Id)
is
begin
if No (List_To) then
List_To := New_Elmt_List;
end if;
if No (List_From) or else Is_Empty_Elmt_List (List_From) then
return;
end if;
-- if we are here, we have to move elements...
if Is_Empty_Elmt_List (List_To) then
Elists.Table (List_To).Last := Elists.Table (List_From).Last;
Elmts.Table (Elists.Table (List_From).Last).Next :=
Union_Id (List_To);
else
Elmts.Table (Elists.Table (List_From).Last).Next :=
Elmts.Table (Elists.Table (List_To).First).Next;
end if;
Elists.Table (List_To).First := Elists.Table (List_From).First;
Elists.Table (List_From).First := No_Elmt;
Elists.Table (List_From).Last := No_Elmt;
end Move_List;
-------------------
-- New_Elmt_List --
-------------------
function New_Elmt_List return Elist_Id is
begin
Elists.Increment_Last;
Elists.Table (Elists.Last).First := No_Elmt;
Elists.Table (Elists.Last).Last := No_Elmt;
if Debug_Flag_N then
Write_Str ("Allocate new element list, returned ID = ");
Write_Int (Int (Elists.Last));
Write_Eol;
end if;
return Elists.Last;
end New_Elmt_List;
---------------
-- Next_Elmt --
---------------
function Next_Elmt (Elmt : Elmt_Id) return Elmt_Id is
N : constant Union_Id := Elmts.Table (Elmt).Next;
begin
if N in Elist_Range then
return No_Elmt;
else
return Elmt_Id (N);
end if;
end Next_Elmt;
--------
-- No --
--------
function No (List : Elist_Id) return Boolean is
begin
return List = No_Elist;
end No;
function No (Elmt : Elmt_Id) return Boolean is
begin
return Elmt = No_Elmt;
end No;
-----------
-- Unit --
-----------
function Unit (Elmt : Elmt_Id) return Unit_Id is
begin
if Elmt = No_Elmt then
return Nil_Unit;
else
return Elmts.Table (Elmt).Unit;
end if;
end Unit;
----------------
-- Num_Elists --
----------------
function Num_Elists return Nat is
begin
return Int (Elmts.Last) - Int (Elmts.First) + 1;
end Num_Elists;
-------------
-- Present --
-------------
function Present (List : Elist_Id) return Boolean is
begin
return List /= No_Elist;
end Present;
function Present (Elmt : Elmt_Id) return Boolean is
begin
return Elmt /= No_Elmt;
end Present;
----------------
-- Print_List --
----------------
procedure Print_List (List : Elist_Id) is
Curr_Elmt : Elmt_Id;
Counter : Int := 1;
begin
if No (List) then
if Debug_Flag_N then
Write_Str (" There is no list here");
Write_Eol;
end if;
return;
end if;
if Is_Empty_Elmt_List (List) then
if Debug_Flag_N then
Write_Str (" The list is empty");
Write_Eol;
end if;
return;
end if;
if Debug_Flag_N then
Write_Str ("List contains the following Ids:");
Write_Eol;
end if;
Curr_Elmt := First_Elmt (List);
while Present (Curr_Elmt) loop
if Debug_Flag_N then
Write_Str (" Element number ");
Write_Int (Counter);
Write_Str (" is ");
Write_Int (Int (Unit (Curr_Elmt)));
Write_Eol;
end if;
Curr_Elmt := Next_Elmt (Curr_Elmt);
Counter := Counter + 1;
end loop;
end Print_List;
-----------------
-- Remove_Elmt --
-----------------
procedure Remove_Elmt (List : Elist_Id; Elmt : Elmt_Id) is
Nxt : Elmt_Id;
Prv : Elmt_Id;
begin
Nxt := Elists.Table (List).First;
-- Case of removing only element in the list
if Elmts.Table (Nxt).Next in Elist_Range then
pragma Assert (Nxt = Elmt);
Elists.Table (List).First := No_Elmt;
Elists.Table (List).Last := No_Elmt;
-- Case of removing the first element in the list
elsif Nxt = Elmt then
Elists.Table (List).First := Elmt_Id (Elmts.Table (Nxt).Next);
-- Case of removing second or later element in the list
else
loop
Prv := Nxt;
Nxt := Elmt_Id (Elmts.Table (Prv).Next);
exit when Nxt = Elmt
or else Elmts.Table (Nxt).Next in Elist_Range;
end loop;
pragma Assert (Nxt = Elmt);
Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next;
if Elmts.Table (Prv).Next in Elist_Range then
Elists.Table (List).Last := Prv;
end if;
end if;
end Remove_Elmt;
----------------------
-- Remove_Last_Elmt --
----------------------
procedure Remove_Last_Elmt (List : Elist_Id) is
Nxt : Elmt_Id;
Prv : Elmt_Id;
begin
Nxt := Elists.Table (List).First;
-- Case of removing only element in the list
if Elmts.Table (Nxt).Next in Elist_Range then
Elists.Table (List).First := No_Elmt;
Elists.Table (List).Last := No_Elmt;
-- Case of at least two elements in list
else
loop
Prv := Nxt;
Nxt := Elmt_Id (Elmts.Table (Prv).Next);
exit when Elmts.Table (Nxt).Next in Elist_Range;
end loop;
Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next;
Elists.Table (List).Last := Prv;
end if;
end Remove_Last_Elmt;
------------------
-- Replace_Elmt --
------------------
procedure Replace_Elmt (Elmt : Elmt_Id; New_Unit : Unit_Id) is
begin
Elmts.Table (Elmt).Unit := New_Unit;
end Replace_Elmt;
end A4G.A_Elists;
|
oeis/137/A137429.asm | neoneye/loda-programs | 11 | 94368 | ; A137429: a(n) = -2*a(n-1) - 2*a(n-2), with a(0)=1 and a(1)=-4.
; Submitted by <NAME>(s4)
; 1,-4,6,-4,-4,16,-24,16,16,-64,96,-64,-64,256,-384,256,256,-1024,1536,-1024,-1024,4096,-6144,4096,4096,-16384,24576,-16384,-16384,65536,-98304,65536,65536,-262144,393216,-262144,-262144,1048576,-1572864,1048576,1048576,-4194304,6291456
mov $1,2
mov $2,1
lpb $0
sub $0,1
add $1,$2
sub $2,$1
add $1,$2
mul $1,2
sub $2,$1
lpe
mov $0,$2
|
test/asset/agda-stdlib-1.0/Codata/Cofin.agda | omega12345/agda-mode | 0 | 1607 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- "Finite" sets indexed on coinductive "natural" numbers
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe --sized-types #-}
module Codata.Cofin where
open import Size
open import Codata.Thunk
open import Codata.Conat as Conat using (Conat; zero; suc; infinity; _ℕ<_; sℕ≤s; _ℕ≤infinity)
open import Codata.Conat.Bisimilarity as Bisim using (_⊢_≲_ ; s≲s)
open import Data.Nat
open import Data.Fin as Fin hiding (fromℕ; fromℕ≤; toℕ)
open import Function
open import Relation.Binary.PropositionalEquality
------------------------------------------------------------------------
-- The type
-- Note that `Cofin infnity` is /not/ finite. Note also that this is not a
-- coinductive type, but it is indexed on a coinductive type.
data Cofin : Conat ∞ → Set where
zero : ∀ {n} → Cofin (suc n)
suc : ∀ {n} → Cofin (n .force) → Cofin (suc n)
suc-injective : ∀ {n} {p q : Cofin (n .force)} →
(Cofin (suc n) ∋ suc p) ≡ suc q → p ≡ q
suc-injective refl = refl
------------------------------------------------------------------------
-- Some operations
fromℕ< : ∀ {n k} → k ℕ< n → Cofin n
fromℕ< {zero} ()
fromℕ< {suc n} {zero} (sℕ≤s p) = zero
fromℕ< {suc n} {suc k} (sℕ≤s p) = suc (fromℕ< p)
fromℕ : ℕ → Cofin infinity
fromℕ k = fromℕ< (suc k ℕ≤infinity)
toℕ : ∀ {n} → Cofin n → ℕ
toℕ zero = zero
toℕ (suc i) = suc (toℕ i)
fromFin : ∀ {n} → Fin n → Cofin (Conat.fromℕ n)
fromFin zero = zero
fromFin (suc i) = suc (fromFin i)
toFin : ∀ n → Cofin (Conat.fromℕ n) → Fin n
toFin zero ()
toFin (suc n) zero = zero
toFin (suc n) (suc i) = suc (toFin n i)
|
programs/oeis/199/A199483.asm | karttu/loda | 1 | 23404 | ; A199483: 6*7^n+1.
; 7,43,295,2059,14407,100843,705895,4941259,34588807,242121643,1694851495,11863960459,83047723207,581334062443,4069338437095,28485369059659,199397583417607,1395783083923243,9770481587462695,68393371112238859
mov $1,7
pow $1,$0
mul $1,6
add $1,1
|
libsrc/fcntl/msxdos2/fdtell.asm | jpoikela/z88dk | 640 | 171577 | SECTION code_clib
PUBLIC fdtell
PUBLIC _fdtell
INCLUDE "target/msx/def/msxdos2.def"
EXTERN MSXDOS
EXTERN msxdos_error
.fdtell
._fdtell
pop af
pop bc ;File handler
push bc
push af
ld hl,0
ld de,0
ld a,1
ld c,_SEEK
call MSXDOS
ld (msxdos_error),a
and a
ret z
ld hl,-1 ;return -1
ld d,h
ld e,l
ret
|
apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_uscib0_i2c_11.asm | tp-freeforall/breakfast | 1 | 85017 | ;*******************************************************************************
; MSP430x24x Demo - USCI_B0 I2C Slave TX multiple bytes to MSP430 Master
;
; Description: This demo connects two MSP430's via the I2C bus. The slave
; transmits to the master. This is the slave code. The interrupt driven
; data transmission is demonstrated using the USCI_B0 TX interrupt.
; ACLK = n/a, MCLK = SMCLK = default DCO = ~1.045MHz
;
; /|\ /|\
; MSP430F249 10k 10k MSP430F249
; slave | | master
; ----------------- | | -----------------
; -|XIN P3.1/UCB0SDA|<-|---+->|P3.1/UCB0SDA XIN|-
; | | | | | 32kHz
; -|XOUT | | | XOUT|-
; | P3.2/UCB0SCL|<-+----->|P3.2/UCB0SCL |
; | | | P1.0|--> LED
;
; <NAME>
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
;-------------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP3 bis.b #06h,&P3SEL ; Assign I2C pins to USCI_B0
SetupUCB0 bis.b #UCSWRST,&UCB0CTL1 ; Enable SW reset
mov.b #UCMODE_3+UCSYNC,&UCB0CTL0
; I2C Slave, synchronous mode
mov.w #048h,&UCB0I2COA ; Own Address is 048h
bic.b #UCSWRST,&UCB0CTL1 ; Clear SW reset, resume operation
bis.b #UCSTPIE+UCSTTIE,&UCB0I2CIE
; Enable STT and STP interrupt
bis.b #UCB0TXIE,&IE2 ; Enable TX interrupt
Main mov.w #TxData,R5 ; Start of TX buffer
clr.w R6 ; Clear TX byte count
bis.b #LPM0+GIE,SR ; Enter LPM0, enable interrupts
; Remain in LPM0 until master
; finishes RX
nop ; Set breakpoint >>here<< and
; read out the R6 counter
jmp Main ; Repeat
;-------------------------------------------------------------------------------
; The USCI_B0 data ISR is used to move data from MSP430 memory to the
; I2C master. R5 points to the next byte to be transmitted, and R6 keeps
; track of the number of bytes transmitted.
;-------------------------------------------------------------------------------
USCIAB0TX_ISR; USCI_B0 Data ISR
;-------------------------------------------------------------------------------
mov.b @R5+,&UCB0TXBUF ; Transmit data at address R5
inc.w R6 ; Increment TX byte counter
reti
;-------------------------------------------------------------------------------
; The USCI_B0 state ISR is used to wake up the CPU from LPM0 in order to do
; processing in the main program after data has been transmitted. LPM0 is
; only exit in case of a (re-)start or stop condition when actual data
; was transmitted.
;-------------------------------------------------------------------------------
USCIAB0RX_ISR; USCI_B0 State ISR
;-------------------------------------------------------------------------------
bic.b #UCSTPIFG+UCSTTIFG,&UCB0STAT
; Clear interrupt flags
tst.w R6 ; Check TX byte counter
jz USCIAB0RX_ISR_1 ; Jump if nothing was transmitted
bic.w #LPM0,0(SP) ; Clear LPM0
USCIAB0RX_ISR_1
reti
;-------------------------------------------------------------------------------
TxData; Table of data to transmit
;-------------------------------------------------------------------------------
.byte 011h ; Table of data to transmit
.byte 022h
.byte 033h
.byte 044h
.byte 055h
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".int22" ; USCI_B0 I2C Data Int Vector
.short USCIAB0TX_ISR
.sect ".int23"
.short USCIAB0RX_ISR
.sect ".reset" ; POR, ext. Reset, Watchdog
.short RESET
.end |
src/evaluate-matrices.adb | hgrodriguez/embedded-dashboard-console | 0 | 25614 | --
-- Copyright 2021 (C) <NAME>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
package body Evaluate.Matrices is
--------------------------------------------------------------------------
-- Check functions for the input received
-- Those functions set the global variables to the received value
-- as a side effect
--------------------------------------------------------------------------
function Check_Block (Block_Char : Character) return Boolean;
function Check_Size (Size_Char : Character) return Boolean;
function Check_Position (Position_Char : Character) return Boolean;
function Check_Value (Value_String : Execute.Matrix_Value_Type)
return Boolean;
--------------------------------------------------------------------------
-- Those variables hold the input received and are set by the
-- different Check_ functions
--------------------------------------------------------------------------
Block : Blocks;
Size : Sizes;
Position : Positions;
Value : Execute.Matrix_Value_Type;
--------------------------------------------------------------------------
-- see .ads
--------------------------------------------------------------------------
function Check_Input (Instruction : Matrix_Instruction)
return Execute.Matrix_Errors is
begin
if not Check_Block (Instruction (1)) then
return Execute.M_Wrong_Block;
end if;
if not Check_Size (Instruction (2)) then
return Execute.M_Wrong_Size;
end if;
if Block = Zero then
-- only supports Byte/Word_0
if Size /= Byte and Size /= Word then
return Execute.M_Wrong_Size;
end if;
end if;
if not Check_Position (Instruction (3)) then
return Execute.M_Wrong_Position;
end if;
if Block = Zero then
-- We only allow:
-- Byte: 0/1
-- Word: 0
if Size = Byte then
-- only supports Zero, One
if Position /= Zero and Position /= One then
return Execute.M_Wrong_Position;
end if;
else
-- if Word, then only Zero
if Position /= Zero then
return Execute.M_Wrong_Position;
end if;
end if;
else
-- Block 1: Double Word we only support Zero
if Size = Double_Word then
if Position /= Zero then
return Execute.M_Wrong_Position;
end if;
end if;
end if;
if not Check_Value (Instruction (4 .. Matrix_Instruction'Last)) then
return Execute.M_Wrong_Value;
end if;
return Execute.M_OK;
end Check_Input;
--------------------------------------------------------------------------
-- see .ads
--------------------------------------------------------------------------
function Evaluate (Instruction : Matrix_Instruction)
return Execute.Matrix_Command is
RetVal : Execute.Matrix_Command;
begin
RetVal.Value := Value;
if Block = Zero then
RetVal.Block := Execute.Block_0;
else
RetVal.Block := Execute.Block_1;
end if;
case Size is
when Byte =>
if Position = Zero then
RetVal.Command := Execute.Byte_0;
elsif Position = One then
RetVal.Command := Execute.Byte_1;
elsif Position = Two then
RetVal.Command := Execute.Byte_2;
elsif Position = Three then
RetVal.Command := Execute.Byte_3;
end if;
when Word =>
if Position = Zero then
RetVal.Command := Execute.Word_0;
elsif Position = One then
RetVal.Command := Execute.Word_1;
end if;
when Double_Word =>
RetVal.Command := Execute.Double_Word_0;
end case;
return RetVal;
end Evaluate;
--------------------------------------------------------------------------
-- Checks the character for the correct block request
--------------------------------------------------------------------------
function Check_Block (Block_Char : Character) return Boolean is
type B_2_C_Map is array (Blocks) of Character;
B_2_C : constant B_2_C_Map := (Zero => '0',
One => '1');
begin
for B in B_2_C_Map'First .. B_2_C_Map'Last loop
if Block_Char = B_2_C (B) then
Block := B;
return True;
end if;
end loop;
return False;
end Check_Block;
--------------------------------------------------------------------------
-- Checks the character for the correct size request
--------------------------------------------------------------------------
function Check_Size (Size_Char : Character) return Boolean is
type S_2_C_Map is array (Sizes) of Character;
S_2_C : constant S_2_C_Map := (Byte => 'B',
Word => 'W',
Double_Word => 'D'
);
begin
for S in S_2_C_Map'First .. S_2_C_Map'Last loop
if Size_Char = S_2_C (S) then
Size := S;
return True;
end if;
end loop;
return False;
end Check_Size;
--------------------------------------------------------------------------
-- Checks the character for the correct position request
--------------------------------------------------------------------------
function Check_Position (Position_Char : Character) return Boolean is
type P_2_C_Map is array (Positions) of Character;
P_2_C : constant P_2_C_Map
:= (Zero => '0',
One => '1',
Two => '2',
Three => '3');
begin
for P in
P_2_C_Map'First .. P_2_C_Map'Last loop
if Position_Char = P_2_C (P) then
Position := P;
return True;
end if;
end loop;
return False;
end Check_Position;
--------------------------------------------------------------------------
-- Checks the characters for the correct value request
--------------------------------------------------------------------------
function Check_Value (Value_String : Execute.Matrix_Value_Type)
return Boolean is
Last : Integer;
begin
case Size is
when Byte => Last := 2;
when Word => Last := 4;
when Double_Word => Last := 8;
end case;
for I in 1 .. Last loop
case Value_String (I) is
when '0' .. 'F' => Value (I) := Value_String (I);
when others => return False;
end case;
end loop;
return True;
end Check_Value;
end Evaluate.Matrices;
|
spectranet/socklib/bind.asm | speccytools/spectranet-gdbserver | 40 | 246583 | <filename>spectranet/socklib/bind.asm
; CALLER linkage for bind()
PUBLIC bind
EXTERN bind_callee
EXTERN ASMDISP_BIND_CALLEE
; int bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen);
.bind
pop hl ; return addr
pop bc ; addrlen
pop ix ; my_addr
pop af ; sockfd
push af
push ix
push bc
push hl
jp bind_callee + ASMDISP_BIND_CALLEE
|
45/runtime/herc/fvars.asm | minblock/msdos | 0 | 9299 | ; TITLE FVARS - Global data for MSHERC.
;***
;FVARS
;
; Copyright <C> 1987, 1988, Microsoft Corporation
;
;Purpose:
; Global data for MSHERC.
;
;******************************************************************************
include hgcdefs.inc
code segment para public 'code'
assume cs:code,ds:code
Extrn GetVideoState:near
Extrn SetGraphicsMode:near
Extrn Null_Function:near
Extrn SetCursor:near
Extrn ReadCursor:near
Extrn SetActivePage:near
Extrn WriteDot:near
Extrn ReadDot:near
Extrn WriteTTY:near
Extrn GSetCursorType:near,GScrollUp:near,GScrollDown:near
Extrn GReadAttrChar:near,WriteGrChar:near,GWriteChar:near
Public Old_Int10h_Routine
Public GrFuncTable
Public DMC_Save,HardGraphVals
Public DeltaCols,DeltaRows
Public YTable,UnHookFlag
Public Bit0
Public LEdge,REdge,BitPos,DstEdgeMasks
Public ZERO
Public CharHeight
Public CharBuff
Public ScrollLines
Public ConfigMode ;[1]
;---------INT 10H - Functions Dispatch Table----------
GrFuncTable dw offset SetGraphicsMode
dw offset GSetCursorType
dw offset SetCursor
dw offset ReadCursor
dw offset Null_Function
dw offset SetActivePage
dw offset GScrollUp
dw offset GScrollDown
dw offset GReadAttrChar
dw offset WriteGrChar
dw offset GWriteChar
dw offset Null_Function
dw offset WriteDot
dw offset ReadDot
dw offset WriteTTY
dw offset GetVideoState
Old_Int10h_Routine dd ? ;Segment:Offset of previous INT 10H
UnHookFlag db 1 ;Set to disable HGC Video Routines
;Clear to enable HGC Video Routines
ConfigMode db FULL ;[1] default to FULL mode (3)
ZERO dw 0
DMC_Save db ? ;temp variable for the DMC_Port value
;-------6845 register values for HGC graphics mode-----
HardGraphVals db 35H,2DH,2EH,7,5BH,2,57H,57H,2,3,0,0,0,0
;-------Temporary variables for the Scrolling Procedures------
DeltaCols dw ? ;Number of columns in scroll window
DeltaRows dw ? ;Number of rows in scroll window
ScrollLines dw ? ;number of scan lines to scroll
;------Table of bit position masks------
Bit0 db 00000001b
Bit1 db 00000010b
Bit2 db 00000100b
Bit3 db 00001000b
Bit4 db 00010000b
Bit5 db 00100000b
Bit6 db 01000000b
Bit7 db 10000000b
;------Table of Left Edge Masks--------
LEdge db 11111110b
db 11111100b
db 11111000b
db 11110000b
db 11100000b
db 11000000b
db 10000000b
db 00000000b
;------Table of Right Edge Masks
REdge db 00000000b
db 00000001b
db 00000011b
db 00000111b
db 00001111b
db 00011111b
db 00111111b
db 01111111b
;------Table y coordinate offsets for use in graphics mode calculations-----
YTable label word
?ROW = 0 ;row number
REPT 350 ;loop for each row (scan line)
;compute regen buffer offset for this row
DW 2000H * (?ROW MOD 4) + (?ROW / 4) * 90
?ROW = ?ROW + 1 ;next row
ENDM
;------- Graphics Mode Variables ----------
DstEdgeMasks dw ? ;Dest Left(LSB) and Right(MSB) Edge Masks
BitPos db ? ;Bit Position in Graphics Byte
CharHeight db 14
CharBuff db 14 dup (?) ;hold buffer for reading graphics character
code ends
end
|
programs/oeis/182/A182578.asm | neoneye/loda | 22 | 163954 | <reponame>neoneye/loda<gh_stars>10-100
; A182578: Number of ones in Zeckendorf representation of n^n.
; 1,1,2,3,3,6,3,10,13,12,16,15,20,24,20,30,25,31,26,33,33,31,34,42,49,49,53,55,56,55,58,64,64,67,73,78,70,76,77,75,89,83,92,90,106,99,100,99,107,116,107,115,125,125,122,119,127,137,127,138,155,156,153,160,145,154,162,163,179,160,165,174,176,184,186,196,186,184,199,194,188,205,201,215,212,214,220,232,228,213,233,243,233,239,234,256,251,263,252,272
pow $0,$0
seq $0,7895 ; Number of terms in Zeckendorf representation of n (write n as a sum of non-consecutive distinct Fibonacci numbers).
|
alloy4fun_models/trashltl/models/17/dss3m2bvkhiqE9BYK.als | Kaixi26/org.alloytools.alloy | 0 | 5217 | open main
pred iddss3m2bvkhiqE9BYK_prop18 {
always all f : Protected | f in Trash => f not in Protected'
}
pred __repair { iddss3m2bvkhiqE9BYK_prop18 }
check __repair { iddss3m2bvkhiqE9BYK_prop18 <=> prop18o } |
src/rt/minit.asm | deviator/druntime | 373 | 247115 | <filename>src/rt/minit.asm
;_ minit.asm
; Module initialization support.
;
; Copyright: Copyright Digital Mars 2000 - 2010.
; License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
; Authors: <NAME>
;
; Copyright Digital Mars 2000 - 2010.
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;
; With VC installed, build with:
; ml /omf minit.asm
.model FLAT
ifdef _WIN32
DATAGRP EQU FLAT
else
DATAGRP EQU DGROUP
endif
; Provide a default resolution for weak extern records, no way in C
; to define an omf symbol with a specific value
public __nullext
__nullext equ 0
extrn __moduleinfo_array:near
; This bit of assembler is needed because, from C or D, one cannot
; specify the names of data segments. Why does this matter?
; All the ModuleInfo pointers are placed into a segment named 'FM'.
; The order in which they are placed in 'FM' is arbitrarily up to the linker.
; In order to walk all the pointers, we need to be able to find the
; beginning and the end of the 'FM' segment.
; This is done by bracketing the 'FM' segment with two other, empty,
; segments named 'FMB' and 'FME'. Since this module is the only one that
; ever refers to 'FMB' and 'FME', we get to control the order in which
; these segments appear relative to 'FM' by using a GROUP statement.
; So, we have in memory:
; FMB empty segment
; FM contains all the pointers
; FME empty segment
; and finding the limits of FM is as easy as taking the address of FMB
; and the address of FME.
; These segments bracket FM, which contains the list of ModuleInfo pointers
FMB segment dword use32 public 'DATA'
FMB ends
FM segment dword use32 public 'DATA'
FM ends
FME segment dword use32 public 'DATA'
FME ends
; This leaves room in the _fatexit() list for _moduleDtor()
XOB segment dword use32 public 'BSS'
XOB ends
XO segment dword use32 public 'BSS'
dd ?
XO ends
XOE segment dword use32 public 'BSS'
XOE ends
DGROUP group FMB,FM,FME
; These segments bracket DP, which contains the _DATA pointer references
public __DPbegin, __DPend
DPB segment dword use32 public 'CODE'
__DPbegin:
DPB ends
DP segment dword use32 public 'CODE'
DP ends
DPE segment dword use32 public 'CODE'
__DPend:
DPE ends
CGROUP group DPB,DP,DPE
; These segments bracket TP, which contains the TLS pointer references
public __TPbegin, __TPend
TPB segment dword use32 public 'CODE'
__TPbegin:
TPB ends
TP segment dword use32 public 'CODE'
TP ends
TPE segment dword use32 public 'CODE'
__TPend:
TPE ends
CGROUP group TPB,TP,TPE
_TEXT segment para use32 public 'CODE'
assume CS:_TEXT
; extern (C) void _minit();
; Converts array of ModuleInfo pointers to a D dynamic array of them,
; so they can be accessed via D.
; Result is written to:
; extern (C) ModuleInfo[] _moduleinfo_array;
public __minit
__minit:
mov EDX,offset DATAGRP:FMB
mov EAX,offset DATAGRP:FME
mov dword ptr __moduleinfo_array+4,EDX
sub EAX,EDX ; size in bytes of FM segment
shr EAX,2 ; convert to array length
mov dword ptr __moduleinfo_array,EAX
ret
_TEXT ends
end
|
oeis/035/A035023.asm | neoneye/loda-programs | 11 | 4478 | ; A035023: One ninth of 9-factorial numbers.
; 1,18,486,17496,787320,42515280,2678462640,192849310080,15620794116480,1405871470483200,139181275577836800,15031577762406374400,1758694598201545804800,221595519373394771404800,29915395115408294139648000,4307816896618794356109312000
add $0,1
mov $1,2
lpb $0
sub $0,1
add $2,9
mul $1,$2
lpe
div $1,18
mov $0,$1
|
Ada/inc/Problem_37.ads | Tim-Tom/project-euler | 0 | 3490 | <reponame>Tim-Tom/project-euler<gh_stars>0
package Problem_37 is
procedure Solve;
end Problem_37;
|
oeis/002/A002283.asm | neoneye/loda-programs | 11 | 5895 | ; A002283: a(n) = 10^n - 1.
; 0,9,99,999,9999,99999,999999,9999999,99999999,999999999,9999999999,99999999999,999999999999,9999999999999,99999999999999,999999999999999,9999999999999999,99999999999999999,999999999999999999,9999999999999999999,99999999999999999999,999999999999999999999,9999999999999999999999,99999999999999999999999,999999999999999999999999,9999999999999999999999999,99999999999999999999999999,999999999999999999999999999,9999999999999999999999999999,99999999999999999999999999999,999999999999999999999999999999
mov $1,10
pow $1,$0
sub $1,1
mov $0,$1
|
libsrc/_DEVELOPMENT/target/yaz180/driver/i2c/c/sdcc/i2c_reset_fastcall.asm | Frodevan/z88dk | 640 | 161493 | SECTION code_driver
EXTERN asm_i2c_reset
PUBLIC _i2c_reset_fastcall
;------------------------------------------------------------------------------
; Reset a PCA9665 device
;
; void i2c_reset( uint8_t __IO_I2C1_PORT_MSB or __IO_I2C2_PORT_MSB ) __z88dk_fastcall
._i2c_reset_fastcall
ld a,l
jp asm_i2c_reset
|
oeis/098/A098531.asm | neoneye/loda-programs | 11 | 177862 | ; A098531: Sum of fifth powers of first n Fibonacci numbers.
; 0,1,2,34,277,3402,36170,407463,4491564,49926988,553211363,6137270812,68054635036,754774491429,8370420537086,92830050637086,1029498223070793,11417322172518550,126619992693837974,1404237451180502875,15573231068749231000,172709782964518145976,1915380827763133935527,21241898955777346570584,235576269055725209848152,2612580859778527953988777,28973965721494850768578970,321326203817930387444100538,3563562207626770426569210589,39520510488101948325068772738,438289177575098070334771172738
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,56572 ; Fifth power of Fibonacci numbers A000045.
add $4,$0
lpe
mov $0,$4
|
src/Categories/Category/Construction/TwistedArrow.agda | Trebor-Huang/agda-categories | 279 | 13327 | <filename>src/Categories/Category/Construction/TwistedArrow.agda
{-# OPTIONS --without-K --safe #-}
open import Categories.Category using (Category; module Definitions)
-- Definition of the "Twisted Arrow" Category of a Category 𝒞
module Categories.Category.Construction.TwistedArrow {o ℓ e} (𝒞 : Category o ℓ e) where
open import Level
open import Data.Product using (_,_; _×_; map; zip)
open import Function.Base using (_$_; flip)
open import Relation.Binary.Core using (Rel)
import Categories.Morphism as M
open M 𝒞
open import Categories.Morphism.Reasoning 𝒞
open Category 𝒞
open Definitions 𝒞
open HomReasoning
private
variable
A B C : Obj
record Morphism : Set (o ⊔ ℓ) where
field
{dom} : Obj
{cod} : Obj
arr : dom ⇒ cod
record Morphism⇒ (f g : Morphism) : Set (ℓ ⊔ e) where
constructor mor⇒
private
module f = Morphism f
module g = Morphism g
field
{dom⇐} : g.dom ⇒ f.dom
{cod⇒} : f.cod ⇒ g.cod
square : cod⇒ ∘ f.arr ∘ dom⇐ ≈ g.arr
TwistedArrow : Category (o ⊔ ℓ) (ℓ ⊔ e) e
TwistedArrow = record
{ Obj = Morphism
; _⇒_ = Morphism⇒
; _≈_ = λ f g → dom⇐ f ≈ dom⇐ g × cod⇒ f ≈ cod⇒ g
; id = mor⇒ (identityˡ ○ identityʳ)
; _∘_ = λ {A} {B} {C} m₁ m₂ → mor⇒ {A} {C} (∘′ m₁ m₂ ○ square m₁)
; assoc = sym-assoc , assoc
; sym-assoc = assoc , sym-assoc
; identityˡ = identityʳ , identityˡ
; identityʳ = identityˡ , identityʳ
; identity² = identity² , identity²
; equiv = record
{ refl = refl , refl
; sym = map sym sym
; trans = zip trans trans
}
; ∘-resp-≈ = zip (flip ∘-resp-≈) ∘-resp-≈
}
where
open Morphism⇒
open Equiv
open HomReasoning
∘′ : ∀ {A B C} (m₁ : Morphism⇒ B C) (m₂ : Morphism⇒ A B) →
(cod⇒ m₁ ∘ cod⇒ m₂) ∘ Morphism.arr A ∘ (dom⇐ m₂ ∘ dom⇐ m₁) ≈ cod⇒ m₁ ∘ Morphism.arr B ∘ dom⇐ m₁
∘′ {A} {B} {C} m₁ m₂ = begin
(cod⇒ m₁ ∘ cod⇒ m₂) ∘ Morphism.arr A ∘ (dom⇐ m₂ ∘ dom⇐ m₁) ≈⟨ pullʳ sym-assoc ⟩
cod⇒ m₁ ∘ (cod⇒ m₂ ∘ Morphism.arr A) ∘ (dom⇐ m₂ ∘ dom⇐ m₁) ≈⟨ refl⟩∘⟨ (pullˡ assoc) ⟩
cod⇒ m₁ ∘ (cod⇒ m₂ ∘ Morphism.arr A ∘ dom⇐ m₂) ∘ dom⇐ m₁ ≈⟨ (refl⟩∘⟨ square m₂ ⟩∘⟨refl) ⟩
cod⇒ m₁ ∘ Morphism.arr B ∘ dom⇐ m₁ ∎
|
ffight/lcs/container/1F.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 244701 | <gh_stars>1-10
copyright zengfr site:http://github.com/zengfr/romhack
0518CC bmi $518ee [container+1F]
051914 move.b #$32, ($1f,A6) [container+ 3]
05191A move.w #$400, ($50,A6) [container+1F]
052328 bmi $5234a [container+1F]
05236C move.b #$32, ($1f,A6) [container+ 3]
052372 movea.l #$523f4, A1 [container+1F]
0524C4 bmi $524e6 [container+1F]
05251C move.b #$46, ($1f,A6) [container+ 3]
052522 clr.b ($1e,A6) [container+1F]
052742 bmi $52764 [container+1F]
052794 move.b #$32, ($1f,A6) [container+ 3]
05279A clr.b ($1e,A6) [container+1F]
0529DC bmi $52a00 [container+1F]
052A26 move.b #$32, ($1f,A6) [container+ 3]
052A2C move.w #$300, ($50,A6) [container+1F]
052D86 bmi $52da8 [container+1F]
052DCA move.b #$32, ($1f,A6) [container+ 3]
052DD0 movea.l #$52ee6, A1 [container+1F]
054B3E move.b #$1, ($1f,A6) [container+1E]
054B44 movea.l #$54cac, A1 [container+1F]
054C04 bne $54c92 [container+1F]
054C0E move.w ($80,A6), D5 [container+1F]
copyright zengfr site:http://github.com/zengfr/romhack
|
test/counter.asm | ghasshee/pen | 0 | 104096 | # Stack: []
0x4 MSTORE(0x40, 0x60)
0x5 PUSH(0x20)
0x26 DUP1
0x27 PUSH(0x40)
0x29 DUP1
0x2A PUSH(MLOAD(POP(0x40)))
0x2B DUP1
0x2C SWAP3
0x2D PUSH(POP(0x20) + POP(@0x2A))
0x2E SWAP1
0x2F MSTORE(POP(0x40), POP(@0x2D))
0x30 DUP2
0x31 DUP1
0x34 DUP2
0x35 CODECOPY(POP(@0x2A), CODESIZE() - POP(0x20), POP(0x20))
0x5C JUMPI(0x2, !(CODESIZE() == 0x555))
# Stack: [@0x2A 0x20]
0x5D PUSH(0x2)
:label0
# Stack: [[0x2 | @0xD1] [@0xF4 | @0x2A] [0x20 | @0xAE]]
0x7F DUP3
0x86 JUMPI(:label1, !POP())
# Stack: [[0x2 | @0xD1] [@0x2A | @0xF4] [@0xAE | 0x20]]
0x87 DUP2
0x89 DUP1
0x8A SSTORE(POP(), MLOAD(POP()))
0x8B PUSH(0x20)
0xAC SWAP1
0xAD SWAP3
0xAE PUSH(POP() - POP(0x20))
0xAF SWAP2
0xD1 PUSH(0x1 + POP())
0xD2 SWAP1
0xF4 PUSH(0x20 + POP())
0xF5 SWAP1
0xFB JUMP(:label0)
:label1
# Stack: [[@0xD1 | 0x2] [@0xF4 | @0x2A] [@0xAE | 0x20]]
0xFD POP()
0xFE POP()
0xFF POP()
0x108 JUMPI(:label2, SLOAD(0x1))
# Stack: []
0x109 PUSH(0x1)
0x10B DUP1
0x10C SSTORE(POP(0x1), POP(0x1))
:label2
# Stack: []
0x150 SSTORE(0x0, 0x23)
0x151 PUSH(0x394)
0x172 DUP1
0x173 PUSH(0x40)
0x175 DUP1
0x176 PUSH(MLOAD(POP(0x40)))
0x177 DUP1
0x178 SWAP3
0x179 PUSH(POP(0x394) + POP(@0x176))
0x17A SWAP1
0x17B MSTORE(POP(0x40), POP(@0x179))
0x17C DUP2
0x19E DUP2
0x19F CODECOPY(POP(@0x176), 0x1A1, POP(0x394))
0x1A0 RETURN(POP(@0x176), POP(0x394))
# Stack: []
0x415 PUSH(:label1)
# Stack: []
0x48A PUSH(:label0)
# Stack: []
0x497 PUSH(:label2)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.