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 |
|---|---|---|---|---|
src/main/antlr4/nl/knaw/huc/di/tag/tagml/grammar/TAGMLParser.g4 | HuygensING/tagml | 2 | 5205 | parser grammar TAGMLParser;
options { tokenVocab=TAGMLLexer; }
document
: header whitespace? body whitespace? EOF
;
header
: (schemaLocation whitespace?)? ( namespaceDefinition whitespace? )*
;
body
: chunk+
;
namespaceDefinition
: DEFAULT_NamespaceOpener IN_NamespaceIdentifier IN_NamespaceURI IN_NamespaceCloser
;
schemaLocation
: DEFAULT_SchemaOpener IS_SchemaURL IS_SchemaCloser
;
chunk
: startTag
| endTag
| milestoneTag
| textVariation
| text
;
startTag
: beginOpenMarkup markupName annotation* endOpenMarkup // possible recursion
;
beginOpenMarkup
: DEFAULT_BeginOpenMarkup
| ITV_BeginOpenMarkup
| IRT_BeginOpenMarkup
;
endOpenMarkup
: IMO_EndOpenMarkup
| A_EndOpenMarkup
;
markupName
: prefix? name suffix? layerInfo?
;
prefix
: IMO_Prefix
| IMC_Prefix
;
layerInfo
: divider layerName ( comma layerName )*
;
comma
: IMO_Comma
| IMC_Comma
;
divider
: IMO_Divider
| IMC_Divider
;
layerName
: name? IMO_Prefix? name
;
name
: IMO_Name
| IMC_Name
;
suffix
: IMO_Suffix
| IMC_Suffix
;
endTag
: beginCloseMarkup markupName IMC_EndCloseMarkup
;
beginCloseMarkup
: DEFAULT_BeginCloseMarkup
| ITV_BeginCloseMarkup
| IRT_BeginCloseMarkup
;
milestoneTag
: beginOpenMarkup name layerInfo? annotation* endMilestoneTag // possible recursion
;
endMilestoneTag
: IMO_EndMilestoneMarkup
| A_EndMilestoneMarkup
;
annotation
: annotationName eq annotationValue # BasicAnnotation
| annotationName ref refValue # RefAnnotation
| idAnnotation eq idValue # IdentifyingAnnotation
;
annotationName
: A_AnnotationName
| IO_AnnotationName
;
idAnnotation
: A_IdAnnotation
| IO_IdAnnotation
;
eq
: A_EQ
| IO_EQ
;
annotationValue
: AV_StringValue
| booleanValue
| AV_NumberValue
| richTextValue
| listValue
| objectValue
;
idValue
: AV_IdValue
;
ref
: A_Ref
| IO_Ref
;
refValue
: RV_RefValue
;
booleanValue
: AV_TRUE
| AV_FALSE
;
richTextValue
: AV_RichTextOpener chunk* IRT_RichTextCloser // recursion!
;
listValue
: AV_ListOpener annotationValue ( IL_SEPARATOR annotationValue )* IL_ListCloser // possible recursion
;
objectValue
: AV_ObjectOpener annotation annotation* IO_ObjectCloser // recursion!
;
textVariation
: beginTextVariation variantText ( textVariationSeparator variantText )+ ITV_EndTextVariation
;
beginTextVariation
: DEFAULT_BeginTextVariation
| ITV_BeginTextVariation
| IRT_BeginTextVariation
;
textVariationSeparator
: TextVariationSeparator
;
variantText
: ( chunk | ITV_Text )+
;
text
: DEFAULT_Text
| ITV_Text
| IRT_Text
| whitespace
;
whitespace
: DEFAULT_Whitespace
; |
codetree-satrapa/src/main/grammar/common/FormattingArtifact.g4 | armange/java-codeless-core | 0 | 6753 | lexer grammar FormattingArtifact;
@header {package br.com.armange.codetree.satrapa.grammar.parser;}
WS : [ \t]+ -> skip ;
fragment
UC_LETTER : [A-Z] ;
LC_LETTER : [a-z] ;
NUMBER : [0-9] ;
UNDERSCORE : [_]; |
src/util/oli/app/ariadr.asm | olifink/qspread | 0 | 88443 | <reponame>olifink/qspread
; get item address in 2dim string array
include win1_mac_oli
include win1_keys_err
section utility
xdef ut_ariadr
;+++
; get item address in 2dim string array
;
; Entry Exit
; d1.l array type (0=abs,1=rel) preserved
; d2.w item number preserved
; a0 array desctiptor preserved
; a1 ptr to array item
;
; errors: orng item number not in array
;---
ut_ariadr subr a0/d1-d3
move.w d2,d3
xjsr ut_arinf
sub.w d3,d1
bmi.s error
mulu d2,d3
lea (a0,d3.l),a1
moveq #0,d0
exit subend
error moveq #err.orng,d0
bra.s exit
end
error
|
Task/Boolean-values/AppleScript/boolean-values-4.applescript | LaudateCorpus1/RosettaCodeData | 1 | 1590 | <reponame>LaudateCorpus1/RosettaCodeData
sortItems from L with reversal
|
special_keys/next_track.scpt | caius/special_keys | 0 | 3611 | -- Define apps in order you want them to respond
if application "iTunes" is running then
tell application "iTunes"
next track
play -- Mirror spotify behaviour, if not playing then start playing
return "itunes"
end tell
end if
|
WebAppsGenerator.Core/Grammar/SneakLexer.g4 | drajwer/web-apps-generator | 0 | 1397 | lexer grammar SneakLexer;
tokens { INDENT, DEDENT }
@lexer::members
{
// Source: https://github.com/wevrem/wry/blob/master/grammars/DentLexer.g4
// Initializing `pendingDent` to true means any whitespace at the beginning
// of the file will trigger an INDENT, which is a syntax error
private bool pendingDent = true;
private int indentCount = 0;
private System.Collections.Generic.Queue<IToken> tokenQueue = new System.Collections.Generic.Queue<IToken>();
private System.Collections.Generic.Stack<int> indentStack = new System.Collections.Generic.Stack<int>();
private IToken initialIndentToken = null;
private int getSavedIndent() { return indentStack.TryPeek(out var top) ? top : 0; }
private CommonToken createToken(int type, String text, IToken next) {
CommonToken token = new CommonToken(type, text);
if (null != initialIndentToken) {
token.StartIndex = initialIndentToken.StartIndex;
token.Line = initialIndentToken.Line;
token.Column = initialIndentToken.Column; // originally this prop is named CharPositionInLine
token.StopIndex = next.StartIndex-1;
}
return token;
}
private int getIndentationCount(String spaces) {
int spaces_count = 0;
foreach (char ch in spaces) {
switch (ch) {
case '\t':
spaces_count += 8;
break;
default:
// A normal space char.
spaces_count++;
break;
}
}
return spaces_count;
}
public override IToken NextToken() {
// Return tokens from the queue if it is not empty.
if (tokenQueue.Count != 0) { return tokenQueue.Dequeue(); }
// Grab the next token and if nothing special is needed, simply return it.
// Initialize `initialIndentToken` if needed.
IToken next = base.NextToken();
if (pendingDent && null == initialIndentToken && NEWLINE != next.Type) { initialIndentToken = next; }
if (null == next || Hidden == next.Channel || NEWLINE == next.Type) { return next; }
// Handle EOF. In particular, handle an abrupt EOF that comes without an
// immediately preceding NEWLINE.
if (next.Type == Eof) {
indentCount = 0;
// EOF outside of `pendingDent` state means input did not have a final
// NEWLINE before end of file.
if (!pendingDent) {
initialIndentToken = next;
tokenQueue.Enqueue(createToken(NEWLINE, "NEWLINE", next));
}
}
// Before exiting `pendingDent` state queue up proper INDENTS and DEDENTS.
while (indentCount != getSavedIndent()) {
if (indentCount > getSavedIndent()) {
indentStack.Push(indentCount);
tokenQueue.Enqueue(createToken(INDENT, "INDENT", next));
} else {
indentStack.Pop();
tokenQueue.Enqueue(createToken(DEDENT, "DEDENT", next));
}
}
pendingDent = false;
tokenQueue.Enqueue(next);
return tokenQueue.Dequeue();
}
}
fragment IDENTIFIER : [A-Za-z_]+[A-Za-z_0-9]*;
fragment NUM : [-+]?([0-9]* '.' [0-9]+|[0-9]+);
fragment WHITESPACES : (' ' | '\t')+ ;
NEWLINE : ( '\r'? '\n' | '\r' )
{
if (pendingDent) { Skip(); }
pendingDent = true;
indentCount = 0;
initialIndentToken = null;
};
WS : WHITESPACES
{
Skip();
if (pendingDent) { indentCount += getIndentationCount(Text); }
};
INDENT : 'INDENT' -> channel(HIDDEN);
DEDENT : 'DEDENT' -> channel(HIDDEN);
CLASS : 'class'
;
COLON : ':' -> pushMode(PROPERTY)
;
HASH : '#'
;
COMMA : ','
;
OPEN_BRACKET : '('
;
CLOSE_BRACKET : ')'
;
EQUALS : '='
;
COMMENT : '//' ~[\r\n]+ -> channel(HIDDEN)
;
MULTILINE_COMM : '/*' .*? '*/' -> skip
;
VALUE : '"' .*? '"'
| NUM
| 'true'
| 'false'
;
ID : IDENTIFIER
;
mode PROPERTY;
TYPE : [A-Za-z]+ ('?')?('[]')? -> popMode
;
PROP_WS : WHITESPACES -> skip
; |
grammar/Tamizh.g4 | MannarAmuthan/Anicham | 0 | 2776 | <filename>grammar/Tamizh.g4
/**
* @author <NAME>
Tamizh antlr4 grammar
*/
grammar Tamizh;
@header {
package grammar;
}
tamizh_script: patthi+ EOF;
patthi: vaakiyam+ NEWLINE;
vaakiyam : sol+ STOP_POINT WS;
sol : ezhuththu+ (COMMA | WS)*;
ezhuththu: UYIR
| MEI
| AAYTHAM
| UYIR_MEI_OU
| UYIR_MEI_OA
| UYIR_MEI_O
| UYIR_MEI_AI
| UYIR_MEI_AE
| UYIR_MEI_E
| UYIR_MEI_OO
| UYIR_MEI_U
| UYIR_MEI_EE
| UYIR_MEI_I
| UYIR_MEI_AA
| UYIR_MEI_A
| GRANTHA_MEI
| GRANTHA_OU
| GRANTHA_OA
| GRANTHA_O
| GRANTHA_AI
| GRANTHA_AE
| GRANTHA_E
| GRANTHA_OO
| GRANTHA_U
| GRANTHA_EE
| GRANTHA_I
| GRANTHA_AA
| GRANTHA_A
| GRANTHA_SRI;
MEI : (UYIR_MEI_A) (PULLI);
UYIR_MEI_OU : (UYIR_MEI_A) (OU);
UYIR_MEI_OA : (UYIR_MEI_A) (O_NEDIL);
UYIR_MEI_O : (UYIR_MEI_A) (O_KURIL);
UYIR_MEI_AI : (UYIR_MEI_A) (I);
UYIR_MEI_AE : (UYIR_MEI_A) (EA_NEDIL);
UYIR_MEI_E : (UYIR_MEI_A) (EA_KURIL);
UYIR_MEI_OO : (UYIR_MEI_A) (U_NEDIL);
UYIR_MEI_U : (UYIR_MEI_A) (U_KURIL);
UYIR_MEI_EE : (UYIR_MEI_A) (NEDIL_SULI);
UYIR_MEI_I : (UYIR_MEI_A) (SULI);
UYIR_MEI_AA : (UYIR_MEI_A) (KAAL);
UYIR_MEI_A : ('\u0B95' | '\u0B99' | '\u0B9A' | '\u0B9E' | '\u0B9F' | '\u0BA3' | '\u0BA4' | '\u0BA8'..'\u0BAA' | '\u0BAE'..'\u0BB5');
UYIR : ('\u0B85'..'\u0B8A' | '\u0B8E'..'\u0B90' | '\u0B92'..'\u0B94') ;
PULLI : '\u0BCD';
KAAL : '\u0BBE';
SULI : '\u0BBF';
NEDIL_SULI : '\u0BC0';
U_KURIL : '\u0BC1';
U_NEDIL : '\u0BC2';
EA_KURIL : '\u0BC6';
EA_NEDIL : '\u0BC7';
I : '\u0BC8';
O_KURIL : '\u0BCA';
O_NEDIL : '\u0BCB';
OU : '\u0BCC';
AAYTHAM : '\u0B83';
// Grantha Script
GRANTHA_SRI: (GRANTHA_SH) (PULLI) ('\u0BB0')(NEDIL_SULI);
GRANTHA_MEI : (GRANTHA_A) (PULLI);
GRANTHA_OU : (GRANTHA_A) (OU);
GRANTHA_OA : (GRANTHA_A) (O_NEDIL);
GRANTHA_O : (GRANTHA_A) (O_KURIL);
GRANTHA_AI : (GRANTHA_A) (I);
GRANTHA_AE : (GRANTHA_A) (EA_NEDIL);
GRANTHA_E : (GRANTHA_A) (EA_KURIL);
GRANTHA_OO : (GRANTHA_A) (U_NEDIL);
GRANTHA_U : (GRANTHA_A) (U_KURIL);
GRANTHA_EE : (GRANTHA_A) (NEDIL_SULI);
GRANTHA_I : (GRANTHA_A) (SULI);
GRANTHA_AA : (GRANTHA_A) (KAAL);
GRANTHA_A: (GRANTHA_JA) | (GRANTHA_SH) | (GRANTHA_SS) | (GRANTHA_S) | (GRANTHA_H);
GRANTHA_JA: '\u0B9C';
GRANTHA_SH: '\u0BB6';
GRANTHA_SS: '\u0BB7';
GRANTHA_S: '\u0BB8';
GRANTHA_H: '\u0BB9';
PUNCTUATIONS: [!{}?\\-\\"'`‘]+ -> skip ;
COMMA: ([,]);
WS : (' '|[\t])+;
STOP_POINT : '.';
NEWLINE : [\n]+ ; |
programs/oeis/143/A143098.asm | jmorken/loda | 1 | 85642 | <filename>programs/oeis/143/A143098.asm
; A143098: First differences of A143097.
; 1,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1,2,2,-1
mov $2,$0
lpb $0
mul $2,$0
sub $0,$2
mod $0,3
mov $1,$0
mod $0,2
mov $3,$1
cmp $3,0
add $1,$3
lpe
add $1,1
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver2/sfc/ys_enmy14.asm | prismotizm/gigaleak | 0 | 243214 | Name: ys_enmy14.asm
Type: file
Size: 100036
Last-Modified: '2016-05-13T04:51:45Z'
SHA-1: B248E5BADBF1152D740E4DF6CC99E334A0ED5E0F
Description: null
|
libsrc/adt/heap/ADTHeapAdd.asm | jpoikela/z88dk | 640 | 173817 | <filename>libsrc/adt/heap/ADTHeapAdd.asm
; void adt_HeapAdd(void *item, void **array, uint n, void *compare)
; 08.2005 aralbrec
SECTION code_clib
PUBLIC ADTHeapAdd
EXTERN ADTHeapSiftUp
; enter: HL = N+1 (number of items in array after this one added)
; BC = array address
; DE = &item
; IX = compare(DE=&array[child], HL=&array[parent])
; set carry if child < parent (min heap) -- MUST PRESERVE BC,DE,HL,IX
.ADTHeapAdd
add hl,hl
push hl
add hl,bc ; hl = &array[N+1]
ld (hl),e ; store new item at end of array
inc hl
ld (hl),d
dec hl
pop de ; de = start index * 2
jp ADTHeapSiftUp
|
programs/oeis/105/A105638.asm | karttu/loda | 1 | 10415 | <filename>programs/oeis/105/A105638.asm<gh_stars>1-10
; A105638: Maximum number of intersections in self-intersecting n-gon.
; 0,1,5,7,14,17,27,31,44,49,65,71,90,97,119,127,152,161,189,199,230,241,275,287,324,337,377,391,434,449,495,511,560,577,629,647,702,721,779,799,860,881,945,967,1034,1057,1127,1151,1224,1249,1325,1351,1430,1457,1539,1567,1652,1681,1769,1799,1890,1921,2015,2047,2144,2177,2277,2311,2414,2449,2555,2591,2700,2737,2849,2887,3002,3041,3159,3199,3320,3361,3485,3527,3654,3697,3827,3871,4004,4049,4185,4231,4370,4417,4559,4607,4752,4801,4949,4999,5150,5201,5355,5407,5564,5617,5777,5831,5994,6049,6215,6271,6440,6497,6669,6727,6902,6961,7139,7199,7380,7441,7625,7687,7874,7937,8127,8191,8384,8449,8645,8711,8910,8977,9179,9247,9452,9521,9729,9799,10010,10081,10295,10367,10584,10657,10877,10951,11174,11249,11475,11551,11780,11857,12089,12167,12402,12481,12719,12799,13040,13121,13365,13447,13694,13777,14027,14111,14364,14449,14705,14791,15050,15137,15399,15487,15752,15841,16109,16199,16470,16561,16835,16927,17204,17297,17577,17671,17954,18049,18335,18431,18720,18817,19109,19207,19502,19601,19899,19999,20300,20401,20705,20807,21114,21217,21527,21631,21944,22049,22365,22471,22790,22897,23219,23327,23652,23761,24089,24199,24530,24641,24975,25087,25424,25537,25877,25991,26334,26449,26795,26911,27260,27377,27729,27847,28202,28321,28679,28799,29160,29281,29645,29767,30134,30257,30627,30751,31124,31249
mov $1,$0
add $0,2
div $0,2
add $1,1
mul $1,$0
sub $1,1
|
test/succeed/Issue376Loop.agda | larrytheliquid/agda | 1 | 7326 | <gh_stars>1-10
-- 2014-01-01 Andreas, test case constructed by <NAME>
{-# OPTIONS --allow-unsolved-metas #-}
-- unguarded recursive record
record R : Set where
constructor cons
field
r : R
postulate F : (R → Set) → Set
q : (∀ P → F P) → (∀ P → F P)
q h P = h (λ {(cons x) → {!!}})
-- ISSUE WAS: Bug in implementation of eta-expansion of projected var,
-- leading to loop in Agda.
|
Source/Levels/L0304.asm | AbePralle/FGB | 0 | 23566 | ; L0304.asm pansies eat shrooms
; Generated 08.03.2000 by mlevel
; Modified 08.03.2000 by <NAME>
INCLUDE "Source/Defs.inc"
INCLUDE "Source/Levels.inc"
INCLUDE "Source/Items.inc"
;---------------------------------------------------------------------
SECTION "Level0304Section",ROMX
;---------------------------------------------------------------------
dialog:
L0304_spores_gtx:
INCBIN "Data/Dialog/Talk/L0304_spores.gtx"
L0304_Contents::
DW L0304_Load
DW L0304_Init
DW L0304_Check
DW L0304_Map
;---------------------------------------------------------------------
; Load
;---------------------------------------------------------------------
L0304_Load:
DW ((L0304_LoadFinished - L0304_Load2)) ;size
L0304_Load2:
call ParseMap
ret
L0304_LoadFinished:
;---------------------------------------------------------------------
; Map
;---------------------------------------------------------------------
L0304_Map:
INCBIN "Data/Levels/L0304_shroom.lvl"
;---------------------------------------------------------------------
; Init
;---------------------------------------------------------------------
PANSYINDEX1 EQU 45
PANSYINDEX2 EQU 46
PANSYINDEX3 EQU 47
LOWSHROOMINDEX EQU 2
HIGHSHROOMINDEX EQU 13
MAPPITCH EQU 32
STATE_NORMAL_INIT EQU 1
STATE_NORMAL_TALK EQU 2
STATE_NORMAL EQU 3
STATE_SOLVED_INIT EQU 4
STATE_SOLVED_TALK EQU 5
STATE_SOLVED EQU 6
L0304_Init:
DW ((L0304_InitFinished - L0304_Init2)) ;size
L0304_Init2:
ldio a,[mapState]
ld hl,((.resetStateTable-L0304_Init2)+levelCheckRAM)
call Lookup8
ldio [mapState],a
STDSETUPDIALOG
ld bc,ITEM_SPOREMASK
call HasInventoryItem
jr nz,.hasMask
ld hl,HOffsetOnHBlank
call InstallHBlankHandler
.hasMask
;ld a,BANK(shroom_gbm)
;ld hl,shroom_gbm
;call InitMusic
;set the pansies to be friendly and to eat the shrooms
ld c,PANSYINDEX1
call ((.makeFriendly-L0304_Init2)+levelCheckRAM)
ld c,PANSYINDEX2
call ((.makeFriendly-L0304_Init2)+levelCheckRAM)
ld c,PANSYINDEX3
call ((.makeFriendly-L0304_Init2)+levelCheckRAM)
ld bc,classPansy
ld de,classHippiePansy
call ChangeClass
;remove the shrooms blocking the exit if level solved already
ldio a,[mapState]
cp STATE_SOLVED_INIT
ret nz
ld hl,$d1dd
call ((.remove2x2-L0304_Init2)+levelCheckRAM)
ld hl,$d23d
call ((.remove2x2-L0304_Init2)+levelCheckRAM)
ret
.makeFriendly
call GetFirst
or a
ret z
.continue
ld a,GROUP_MONSTERB
call SetGroup
ld hl,((HIGHSHROOMINDEX<<8) | LOWSHROOMINDEX)
call SetActorDestLoc
call GetNextObject
or a
jr nz,.continue
ret
.remove2x2
ld a,MAPBANK
ldio [$ff70],a
xor a
ld [hl+],a
ld [hl-],a
ld de,MAPPITCH
add hl,de
ld [hl+],a
ld [hl],a
ret
.resetStateTable
DB STATE_NORMAL_INIT,STATE_NORMAL_INIT,STATE_NORMAL_INIT
DB STATE_NORMAL_INIT,STATE_SOLVED_INIT,STATE_SOLVED_INIT
DB STATE_SOLVED_INIT
L0304_InitFinished:
;---------------------------------------------------------------------
; Check
;---------------------------------------------------------------------
L0304_Check:
DW ((L0304_CheckFinished - L0304_Check2)) ;size
L0304_Check2:
call ((.updateWave-L0304_Check2)+levelCheckRAM)
ldio a,[mapState]
cp STATE_NORMAL_INIT
jr z,.initialUpdate
cp STATE_SOLVED_INIT
jr z,.initialUpdate
cp STATE_NORMAL_TALK
jr z,.talk
cp STATE_SOLVED_TALK
jr z,.talk
ld a,1
ld hl,((.checkSolved-L0304_Check2)+levelCheckRAM)
call CheckEachHero
ret
.initialUpdate
inc a
ldio [mapState],a
ret
.talk
ld bc,ITEM_SPOREMASK
call HasInventoryItem
jr nz,.afterTalk
call MakeIdle
ld de,((.afterTalk-L0304_Check2)+levelCheckRAM)
call SetDialogSkip
call SetSpeakerToFirstHero
ld de,L0304_spores_gtx
call ShowDialogAtBottom
.afterTalk
call ClearDialogSkipForward
call MakeNonIdle
ldio a,[mapState]
inc a
ldio [mapState],a
ret
.checkSolved
or a
ret z
ld c,a
call GetFirst ;get my hero object
call GetCurZone
cp 2
jr z,.inZone2
xor a ;return false
ret
.inZone2
;in zone 2, level solved
ld a,STATE_SOLVED
ldio [mapState],a
ld a,1 ;return true
ret
.updateWave
ld bc,ITEM_SPOREMASK
call HasInventoryItem
ret nz
;fill the horizontalOffset table with values from the sine table
ld a,TILEINDEXBANK
ldio [$ff70],a
ldio a,[updateTimer]
and 63
ld e,a
ld d,0
ld hl,((.sineTable-L0304_Check2)+levelCheckRAM)
add hl,de
ld de,horizontalOffset
ld c,144
.updateLoop
ld a,[hl+]
ld [de],a
inc de
dec c
jr nz,.updateLoop
ld a,[horizontalOffset]
ld [lineZeroHorizontalOffset],a
ld hl,hblankFlag
set 2,[hl]
ret
.sineTable ;four 64-byte sine waves, values between 0 and 7
REPT 4
DB 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7
DB 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4
DB 4, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
DB 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3
ENDR
L0304_CheckFinished:
PRINT "0304 Script Sizes (Load/Init/Check) (of $500): "
PRINT (L0304_LoadFinished - L0304_Load2)
PRINT " / "
PRINT (L0304_InitFinished - L0304_Init2)
PRINT " / "
PRINT (L0304_CheckFinished - L0304_Check2)
PRINT "\n"
|
asm/32bit-main.asm | soragui/makeOS | 0 | 85199 |
[org 0x7C00] ; bootloader offset
mov bp, 0x9000 ; set the stack
mov sp, bp
mov bx, MSG_REAL_MODE
call print
call print_nl
call switch_to_pm
jmp $
%include 'boot_sect_print.asm'
%include '32bit-switch.asm'
%include '32bit-print.asm'
%include '32bit-gdt.asm'
[bits 32]
BEGIN_PM:
mov edx, MSG_PROT_MODE
call print_string_pm
jmp $
MSG_REAL_MODE db "Started in 16-bit real mode", 0
MSG_PROT_MODE db "Loaded 32-bit protected mode", 0
; bootsector
times 510-($-$$) db 0
dw 0xAA55
|
src/ui/errordialog.adb | thindil/steamsky | 80 | 11096 | -- Copyright (c) 2020-2021 <NAME> <<EMAIL>>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY 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
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Characters.Latin_1;
with Ada.Strings.Unbounded;
with Ada.Text_IO;
with Interfaces.C;
with GNAT.Directory_Operations;
with GNAT.OS_Lib;
with GNAT.Time_Stamp;
with GNAT.Traceback.Symbolic;
with Tcl;
with Tcl.Ada;
with Tcl.Tk.Ada;
with Tcl.Tk.Ada.Widgets;
with Tcl.Tk.Ada.Widgets.Toplevel;
with Tcl.Tk.Ada.Widgets.Toplevel.MainWindow;
with Tcl.Tk.Ada.Widgets.Text;
with Game;
with Game.SaveLoad;
with Log;
with MainMenu.Commands;
with Ships;
with Utils.UI;
package body ErrorDialog is
procedure Save_Exception(An_Exception: Exception_Occurrence) is
use Ada.Characters.Latin_1;
use Ada.Strings.Unbounded;
use Ada.Text_IO;
use GNAT.OS_Lib;
use GNAT.Time_Stamp;
use GNAT.Traceback.Symbolic;
use Game;
use Game.SaveLoad;
use Log;
use Ships;
Error_File: File_Type;
Error_Text: Unbounded_String := Null_Unbounded_String;
begin
if Natural(Player_Ship.Crew.Length) > 0 then
Save_Game;
end if;
Append
(Source => Error_Text,
New_Item =>
Current_Time & LF & Game_Version & LF & "Exception: " &
Exception_Name(X => An_Exception) & LF & "Message: " &
Exception_Message(X => An_Exception) & LF &
"-------------------------------------------------" & LF);
if Directory_Separator = '/' then
Append
(Source => Error_Text,
New_Item => Symbolic_Traceback(E => An_Exception) & LF);
else
Append
(Source => Error_Text,
New_Item => Exception_Information(X => An_Exception) & LF);
end if;
Append
(Source => Error_Text,
New_Item => "-------------------------------------------------");
Open_Error_File_Block :
begin
Open
(File => Error_File, Mode => Append_File,
Name => To_String(Source => Save_Directory) & "error.log");
exception
when Name_Error =>
Create
(File => Error_File, Mode => Append_File,
Name => To_String(Source => Save_Directory) & "error.log");
end Open_Error_File_Block;
Put_Line(File => Error_File, Item => To_String(Source => Error_Text));
Close(File => Error_File);
End_Logging;
Show_Error_Dialog_Block :
declare
use type Interfaces.C.int;
use GNAT.Directory_Operations;
use Tcl;
use Tcl.Ada;
use Tcl.Tk.Ada;
use Tcl.Tk.Ada.Widgets;
use MainMenu.Commands;
use Utils.UI;
Interp: Tcl.Tcl_Interp := Get_Context;
begin
Destroy_Main_Window_Block :
declare
use Tcl.Tk.Ada.Widgets.Toplevel;
use Tcl.Tk.Ada.Widgets.Toplevel.MainWindow;
Main_Window: Tk_Toplevel := Get_Main_Window(Interp => Interp);
begin
Destroy(Widgt => Main_Window);
exception
when Storage_Error =>
null;
end Destroy_Main_Window_Block;
Interp := Tcl.Tcl_CreateInterp;
if Tcl.Tcl_Init(interp => Interp) = Tcl.TCL_ERROR then
Ada.Text_IO.Put_Line
(Item =>
"Steam Sky: Tcl.Tcl_Init failed: " &
Tcl.Ada.Tcl_GetStringResult(interp => Interp));
return;
end if;
if Tcl.Tk.Tk_Init(interp => Interp) = Tcl.TCL_ERROR then
Ada.Text_IO.Put_Line
(Item =>
"Steam Sky: Tcl.Tk.Tk_Init failed: " &
Tcl.Ada.Tcl_GetStringResult(interp => Interp));
return;
end if;
Set_Context(Interp => Interp);
Tcl_EvalFile
(interp => Get_Context,
fileName =>
To_String(Source => Data_Directory) & "ui" & Dir_Separator &
"errordialog.tcl");
Add_Command
(Name => "OpenLink", Ada_Command => Open_Link_Command'Access);
Show_Error_Message_Block :
declare
use Tcl.Tk.Ada.Widgets.Text;
Text_View: constant Tk_Text :=
Get_Widget(pathName => ".technical.text", Interp => Interp);
begin
Insert
(TextWidget => Text_View, Index => "end",
Text => "{" & To_String(Source => Error_Text) & "}");
configure(Widgt => Text_View, options => "-state disabled");
end Show_Error_Message_Block;
Tcl.Tk.Tk_MainLoop;
end Show_Error_Dialog_Block;
end Save_Exception;
end ErrorDialog;
|
data/mapObjects/lab1.asm | adhi-thirumala/EvoYellow | 16 | 242972 | Lab1Object:
db $17 ; border block
db $5 ; warps
db $7, $2, $2, $ff
db $7, $3, $2, $ff
db $4, $8, $0, CINNABAR_LAB_2
db $4, $c, $0, CINNABAR_LAB_3
db $4, $10, $0, CINNABAR_LAB_4
db $4 ; signs
db $2, $3, $2 ; Lab1Text2
db $4, $9, $3 ; Lab1Text3
db $4, $d, $4 ; Lab1Text4
db $4, $11, $5 ; Lab1Text5
db $1 ; objects
object SPRITE_FISHER, $1, $3, STAY, NONE, $1 ; person
; warp-to
EVENT_DISP CINNABAR_LAB_1_WIDTH, $7, $2
EVENT_DISP CINNABAR_LAB_1_WIDTH, $7, $3
EVENT_DISP CINNABAR_LAB_1_WIDTH, $4, $8 ; CINNABAR_LAB_2
EVENT_DISP CINNABAR_LAB_1_WIDTH, $4, $c ; CINNABAR_LAB_3
EVENT_DISP CINNABAR_LAB_1_WIDTH, $4, $10 ; CINNABAR_LAB_4
|
libsrc/math/zxmath/log10.asm | meesokim/z88dk | 0 | 83895 | ;
;
; ZX Maths Routines
;
; 10/12/02 - <NAME>
;
; $Id: log10.asm,v 1.3 2015/01/19 01:32:57 pauloscustodio Exp $
;
;double log10(double) -- 1/ln(10)
;Number in FA..
IF FORzx
INCLUDE "zxfp.def"
ELSE
INCLUDE "81fp.def"
ENDIF
PUBLIC log10
EXTERN fsetup1
EXTERN stkequ
.log10
call fsetup1
defb ZXFP_STK_TEN
defb ZXFP_LN
defb ZXFP_STK_ONE
defb ZXFP_DIVISION
defb ZXFP_END_CALC
jp stkequ
|
main.asm | TobiasKaiser/ahci_sbe | 2 | 240176 | ; main.asm -- ahci_sbe main file generating PCI option ROM header structures,
; performing basic initialization, %includes all other asm source files
; Copyright (C) 2014, 2016 <NAME> <<EMAIL>>
org 0
rom_size_multiple_of equ 512
bits 16
; PCI Expansion Rom Header
; ------------------------
db 0x55, 0xAA ; signature
db rom_size/512; initialization size in 512 byte blocks
entry_point: jmp start
times 21 - ($ - entry_point) db 0
dw pci_data_structure
; PCI Data Structure
; ------------------
pci_data_structure:
db 'P', 'C', 'I', 'R'
dw PCI_VENDOR_ID
dw PCI_DEVICE_ID
dw 0 ; reserved
dw pci_data_structure_end - pci_data_structure
db 0 ; revision
db 0x02, 0x00, 0x00 ; class code: ethernet
dw rom_size/512
dw 0 ; revision level of code / data
db 0 ; code type => Intel x86 PC-AT compatible
db (1<<7) ; this is the last image
dw 0 ; reserved
pci_data_structure_end:
start:
push CS
pop DS
mov [sp_orig], SP
call cls
call pmm_detect_and_alloc
loop_over_multiple_ahci_controllers:
mov AX, [cur_ahci_index]
call find_ahci
cmp AX, 0
jnz loop_over_multiple_ahci_controllers_end
call ahci_main
mov AX, [cur_ahci_index]
inc AX
mov [cur_ahci_index], AX
jmp loop_over_multiple_ahci_controllers
loop_over_multiple_ahci_controllers_end:
mov AL, [needs_reboot]
cmp AL, 0
jz no_reboot
call clear_last_password
call cls_blank
jmp 0xFFFF:0x0000 ; <-- reboot (so many possibilities)
fatal_error:
push AX
mov AX, fatal_error_msg
call puts
pop AX
call puts
call pause
mov SP, [sp_orig]
no_reboot:
call clear_last_password
call cls_blank
retf ; <-- continue boot
; ----
%include "pmm.asm"
%include "ahci.asm"
%include "io.asm"
; memclear function
; -----------------
memclear: ; set AX bytes starting at ES:ECX to 0x00
push AX
push ECX
memclear_loop:
mov [ES:ECX], byte 0
inc ECX
dec AX
jnz memclear_loop
pop ECX
pop AX
ret
; Strings
; -------
version_str db `ahci_sbe v. 0.9\0`
fatal_error_msg db `Fatal error: \0`
pause_msg db `Press any key to continue...\n\0`
pw_dialog_msg db `Enter password to unlock device:\0`
pw_dialog_prompt db `Password: \0`
pw_dialog_usage_msg db `ENTER=Unlock Shift+ENTER=Unlock multiple ESC=Skip\0`
wrong_password_msg db `Wrong password. Press return to try again.\0`
; Error messages
; --------------
err_no_pci db `PCI not present\n\0`
err_no_ahci db `AHCI not present\n\0`
err_abar db `Failed to read ABAR\n\0`
err_no_pmm db `PMM not present\n\0`
err_pmm_alloc db `PMM alloc failed\n\0`
err_pmm_chksum db `PMM checksum mismatch\n\0`
; Global Variables
; ----------------
abar dd 0x00000000 ; save ABAR here
sp_orig dw 0x0000 ; original stack pointer for returning in case of an error
pmm_entry_point dw 0x0000, 0x0000 ; save PMM entry point here
needs_reboot db 0 ; set to 1 if we need reboot
cur_style db 0x07 ; grey on black = default
cur_ahci_index dw 0x0000 ; start with achi controll #0, then try #1, ...
unlock_multiple db 0x00 ; 0=unlock single, else=unlock multiple
last_password_length dd 0x00000000
last_password dd 0, 0, 0, 0, 0, 0, 0, 0
horiz_line_left db 0
horiz_line_middle db 0
horiz_line_right db 0
; ROM padding, checksum needs to be added separately
; --------------------------------------------------
db 0 ; reserve at least one byte for checksum
rom_end equ $-$$
rom_size equ (((rom_end-1)/rom_size_multiple_of)+1)*rom_size_multiple_of
times rom_size - rom_end db 0 ; padding
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0x48.log_21829_2207.asm | ljhsiun2/medusa | 9 | 9509 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x6785, %rdx
nop
nop
inc %r8
movb $0x61, (%rdx)
nop
nop
nop
nop
nop
sub $50758, %rax
lea addresses_UC_ht+0x49cb, %rcx
nop
cmp $37212, %rax
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
inc %rdx
lea addresses_D_ht+0x10385, %rsi
nop
nop
cmp $13716, %r12
mov $0x6162636465666768, %r11
movq %r11, (%rsi)
nop
nop
cmp %rdx, %rdx
lea addresses_normal_ht+0x18785, %r12
nop
nop
and $20901, %r8
vmovups (%r12), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rax
nop
nop
nop
nop
nop
sub $61870, %r12
lea addresses_A_ht+0x2505, %rsi
lea addresses_D_ht+0x1237e, %rdi
nop
nop
nop
nop
nop
and %rdx, %rdx
mov $102, %rcx
rep movsl
nop
nop
inc %rax
lea addresses_WC_ht+0x8785, %r12
nop
sub $2621, %r8
movb (%r12), %dl
sub $43408, %r12
lea addresses_normal_ht+0x18e85, %rsi
nop
nop
add $63906, %rdx
mov (%rsi), %r11w
nop
nop
xor $62373, %rdi
lea addresses_normal_ht+0x1cd85, %rsi
lea addresses_normal_ht+0xd4c5, %rdi
nop
nop
nop
and $23971, %rax
mov $40, %rcx
rep movsl
xor $52168, %rcx
lea addresses_normal_ht+0x16585, %rdi
nop
cmp %rdx, %rdx
mov (%rdi), %r8d
nop
nop
nop
nop
inc %rdi
lea addresses_WT_ht+0xafa5, %rsi
lea addresses_D_ht+0x80f0, %rdi
nop
add $29045, %r12
mov $8, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $49871, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %rax
push %rbp
push %rcx
push %rdi
// Store
lea addresses_A+0x12b85, %rbp
nop
nop
and %r15, %r15
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
movaps %xmm5, (%rbp)
nop
sub $49451, %rbp
// Store
lea addresses_US+0x18e85, %rdi
nop
nop
nop
nop
inc %rcx
mov $0x5152535455565758, %rax
movq %rax, (%rdi)
nop
nop
xor $6429, %rbp
// Faulty Load
lea addresses_A+0x12b85, %rbp
nop
nop
nop
nop
nop
and $6178, %r14
mov (%rbp), %rax
lea oracles, %rdi
and $0xff, %rax
shlq $12, %rax
mov (%rdi,%rax,1), %rax
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
source/nodes/program-element_vector_factories.adb | optikos/oasis | 0 | 8787 | -- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Nodes.Array_Component_Association_Vectors;
with Program.Nodes.Aspect_Specification_Vectors;
with Program.Nodes.Element_Vectors;
with Program.Nodes.Expression_Vectors;
with Program.Nodes.Case_Expression_Path_Vectors;
with Program.Nodes.Case_Path_Vectors;
with Program.Nodes.Component_Clause_Vectors;
with Program.Nodes.Defining_Identifier_Vectors;
with Program.Nodes.Discrete_Range_Vectors;
with Program.Nodes.Discriminant_Association_Vectors;
with Program.Nodes.Discriminant_Specification_Vectors;
with Program.Nodes.Elsif_Path_Vectors;
with Program.Nodes.Enumeration_Literal_Specification_Vectors;
with Program.Nodes.Exception_Handler_Vectors;
with Program.Nodes.Formal_Package_Association_Vectors;
with Program.Nodes.Identifier_Vectors;
with Program.Nodes.Parameter_Association_Vectors;
with Program.Nodes.Parameter_Specification_Vectors;
with Program.Nodes.Record_Component_Association_Vectors;
with Program.Nodes.Select_Path_Vectors;
with Program.Nodes.Variant_Vectors;
with Program.Storage_Pools;
package body Program.Element_Vector_Factories is
type Array_Component_Association_Vector_Access is
not null access Program.Nodes.Array_Component_Association_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Aspect_Specification_Vector_Access is
not null access Program.Nodes.Aspect_Specification_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Case_Expression_Path_Vector_Access is
not null access Program.Nodes.Case_Expression_Path_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Case_Path_Vector_Access is
not null access Program.Nodes.Case_Path_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Component_Clause_Vector_Access is
not null access Program.Nodes.Component_Clause_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Defining_Identifier_Vector_Access is
not null access Program.Nodes.Defining_Identifier_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Discrete_Range_Vector_Access is
not null access Program.Nodes.Discrete_Range_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Discriminant_Association_Vector_Access is
not null access Program.Nodes.Discriminant_Association_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Discriminant_Specification_Vector_Access is
not null access Program.Nodes.Discriminant_Specification_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Element_Vector_Access is
not null access Program.Nodes.Element_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Elsif_Path_Vector_Access is
not null access Program.Nodes.Elsif_Path_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Enumeration_Literal_Specification_Vector_Access is not null access
Program.Nodes.Enumeration_Literal_Specification_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Exception_Handler_Vector_Access is
not null access Program.Nodes.Exception_Handler_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Expression_Vector_Access is
not null access Program.Nodes.Expression_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Package_Association_Vector_Access is not null access
Program.Nodes.Formal_Package_Association_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Identifier_Vector_Access is not null access
Program.Nodes.Identifier_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Parameter_Association_Vector_Access is not null access
Program.Nodes.Parameter_Association_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Parameter_Specification_Vector_Access is not null access
Program.Nodes.Parameter_Specification_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Record_Component_Association_Vector_Access is not null access
Program.Nodes.Record_Component_Association_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Select_Path_Vector_Access is not null access
Program.Nodes.Select_Path_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
type Variant_Vector_Access is not null access
Program.Nodes.Variant_Vectors.Vector
with Storage_Pool => Program.Storage_Pools.Pool;
-----------------------------------------------
-- Create_Array_Component_Association_Vector --
-----------------------------------------------
not overriding function Create_Array_Component_Association_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Array_Component_Associations
.Array_Component_Association_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Array_Component_Association_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Array_Component_Association_Vectors.Vector'
(Program.Nodes.Array_Component_Association_Vectors.Create
(Each));
begin
return Program.Elements.Array_Component_Associations
.Array_Component_Association_Vector_Access (Result);
end;
end Create_Array_Component_Association_Vector;
----------------------------------------
-- Create_Aspect_Specification_Vector --
----------------------------------------
not overriding function Create_Aspect_Specification_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Aspect_Specification_Vector_Access :=
new
(Self.Subpool) Program.Nodes.Aspect_Specification_Vectors.Vector'
(Program.Nodes.Aspect_Specification_Vectors.Create (Each));
begin
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access (Result);
end;
end Create_Aspect_Specification_Vector;
----------------------------------------
-- Create_Case_Expression_Path_Vector --
----------------------------------------
not overriding function Create_Case_Expression_Path_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Case_Expression_Paths
.Case_Expression_Path_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Case_Expression_Path_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Case_Expression_Path_Vectors.Vector'
(Program.Nodes.Case_Expression_Path_Vectors.Create (Each));
begin
return Program.Elements.Case_Expression_Paths
.Case_Expression_Path_Vector_Access (Result);
end;
end Create_Case_Expression_Path_Vector;
-----------------------------
-- Create_Case_Path_Vector --
-----------------------------
not overriding function Create_Case_Path_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Case_Paths.Case_Path_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Case_Path_Vector_Access :=
new (Self.Subpool) Program.Nodes.Case_Path_Vectors.Vector'
(Program.Nodes.Case_Path_Vectors.Create (Each));
begin
return Program.Elements.Case_Paths .Case_Path_Vector_Access (Result);
end;
end Create_Case_Path_Vector;
------------------------------------
-- Create_Component_Clause_Vector --
------------------------------------
not overriding function Create_Component_Clause_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Component_Clauses
.Component_Clause_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Component_Clause_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Component_Clause_Vectors.Vector'
(Program.Nodes.Component_Clause_Vectors.Create (Each));
begin
return Program.Elements.Component_Clauses
.Component_Clause_Vector_Access (Result);
end;
end Create_Component_Clause_Vector;
---------------------------------------
-- Create_Defining_Identifier_Vector --
---------------------------------------
not overriding function Create_Defining_Identifier_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Defining_Identifier_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Defining_Identifier_Vectors.Vector'
(Program.Nodes.Defining_Identifier_Vectors.Create (Each));
begin
return Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access (Result);
end;
end Create_Defining_Identifier_Vector;
----------------------------------
-- Create_Discrete_Range_Vector --
----------------------------------
not overriding function Create_Discrete_Range_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Discrete_Ranges.Discrete_Range_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Discrete_Range_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Discrete_Range_Vectors.Vector'
(Program.Nodes.Discrete_Range_Vectors.Create (Each));
begin
return Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access (Result);
end;
end Create_Discrete_Range_Vector;
--------------------------------------------
-- Create_Discriminant_Association_Vector --
--------------------------------------------
not overriding function Create_Discriminant_Association_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Discriminant_Associations
.Discriminant_Association_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Discriminant_Association_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Discriminant_Association_Vectors.Vector'
(Program.Nodes.Discriminant_Association_Vectors.Create (Each));
begin
return Program.Elements.Discriminant_Associations
.Discriminant_Association_Vector_Access (Result);
end;
end Create_Discriminant_Association_Vector;
----------------------------------------------
-- Create_Discriminant_Specification_Vector --
----------------------------------------------
not overriding function Create_Discriminant_Specification_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Discriminant_Specification_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Discriminant_Specification_Vectors.Vector'
(Program.Nodes.Discriminant_Specification_Vectors.Create
(Each));
begin
return Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access (Result);
end;
end Create_Discriminant_Specification_Vector;
---------------------------
-- Create_Element_Vector --
---------------------------
not overriding function Create_Element_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Element_Vectors.Element_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Element_Vector_Access :=
new (Self.Subpool) Program.Nodes.Element_Vectors.Vector'
(Program.Nodes.Element_Vectors.Create (Each));
begin
return Program.Element_Vectors.Element_Vector_Access (Result);
end;
end Create_Element_Vector;
------------------------------
-- Create_Elsif_Path_Vector --
------------------------------
not overriding function Create_Elsif_Path_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Elsif_Paths.Elsif_Path_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Elsif_Path_Vector_Access :=
new (Self.Subpool) Program.Nodes.Elsif_Path_Vectors.Vector'
(Program.Nodes.Elsif_Path_Vectors.Create (Each));
begin
return Program.Elements.Elsif_Paths.Elsif_Path_Vector_Access (Result);
end;
end Create_Elsif_Path_Vector;
-----------------------------------------------------
-- Create_Enumeration_Literal_Specification_Vector --
-----------------------------------------------------
not overriding function Create_Enumeration_Literal_Specification_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Enumeration_Literal_Specification_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Enumeration_Literal_Specification_Vectors.Vector'
(Program.Nodes.Enumeration_Literal_Specification_Vectors.Create
(Each));
begin
return Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Vector_Access (Result);
end;
end Create_Enumeration_Literal_Specification_Vector;
-------------------------------------
-- Create_Exception_Handler_Vector --
-------------------------------------
not overriding function Create_Exception_Handler_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Exception_Handler_Vector_Access :=
new (Self.Subpool) Program.Nodes.Exception_Handler_Vectors.Vector'
(Program.Nodes.Exception_Handler_Vectors.Create (Each));
begin
return Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access (Result);
end;
end Create_Exception_Handler_Vector;
------------------------------
-- Create_Expression_Vector --
------------------------------
not overriding function Create_Expression_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Expressions.Expression_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Expression_Vector_Access :=
new (Self.Subpool) Program.Nodes.Expression_Vectors.Vector'
(Program.Nodes.Expression_Vectors.Create (Each));
begin
return Program.Elements.Expressions.Expression_Vector_Access (Result);
end;
end Create_Expression_Vector;
----------------------------------------------
-- Create_Formal_Package_Association_Vector --
----------------------------------------------
not overriding function Create_Formal_Package_Association_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Formal_Package_Association_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Formal_Package_Association_Vectors.Vector'
(Program.Nodes.Formal_Package_Association_Vectors.Create
(Each));
begin
return Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Vector_Access (Result);
end;
end Create_Formal_Package_Association_Vector;
------------------------------
-- Create_Identifier_Vector --
------------------------------
not overriding function Create_Identifier_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Identifiers
.Identifier_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Identifier_Vector_Access :=
new (Self.Subpool) Program.Nodes.Identifier_Vectors.Vector'
(Program.Nodes.Identifier_Vectors.Create (Each));
begin
return Program.Elements.Identifiers.Identifier_Vector_Access (Result);
end;
end Create_Identifier_Vector;
-----------------------------------------
-- Create_Parameter_Association_Vector --
-----------------------------------------
not overriding function Create_Parameter_Association_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Parameter_Association_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Parameter_Association_Vectors.Vector'
(Program.Nodes.Parameter_Association_Vectors.Create (Each));
begin
return Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access (Result);
end;
end Create_Parameter_Association_Vector;
-------------------------------------------
-- Create_Parameter_Specification_Vector --
-------------------------------------------
not overriding function Create_Parameter_Specification_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Parameter_Specification_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Parameter_Specification_Vectors.Vector'
(Program.Nodes.Parameter_Specification_Vectors.Create (Each));
begin
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access (Result);
end;
end Create_Parameter_Specification_Vector;
------------------------------------------------
-- Create_Record_Component_Association_Vector --
------------------------------------------------
not overriding function Create_Record_Component_Association_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Record_Component_Associations
.Record_Component_Association_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Record_Component_Association_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Record_Component_Association_Vectors.Vector'
(Program.Nodes.Record_Component_Association_Vectors.Create
(Each));
begin
return Program.Elements.Record_Component_Associations
.Record_Component_Association_Vector_Access (Result);
end;
end Create_Record_Component_Association_Vector;
-------------------------------
-- Create_Select_Path_Vector --
-------------------------------
not overriding function Create_Select_Path_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Select_Paths.Select_Path_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Select_Path_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Select_Path_Vectors.Vector'
(Program.Nodes.Select_Path_Vectors.Create (Each));
begin
return Program.Elements.Select_Paths.Select_Path_Vector_Access
(Result);
end;
end Create_Select_Path_Vector;
---------------------------
-- Create_Variant_Vector --
---------------------------
not overriding function Create_Variant_Vector
(Self : Element_Vector_Factory;
Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class)
return Program.Elements.Variants.Variant_Vector_Access
is
Cursor : constant Program.Element_Vectors.Element_Cursor := Each.First;
begin
if not Program.Element_Vectors.Has_Element (Cursor) then
return null;
end if;
declare
Result : constant Variant_Vector_Access :=
new (Self.Subpool)
Program.Nodes.Variant_Vectors.Vector'
(Program.Nodes.Variant_Vectors.Create (Each));
begin
return Program.Elements.Variants.Variant_Vector_Access (Result);
end;
end Create_Variant_Vector;
end Program.Element_Vector_Factories;
|
include/bits_sched_h.ads | docandrew/troodon | 5 | 7660 | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with System;
package bits_sched_h is
SCHED_OTHER : constant := 0; -- /usr/include/bits/sched.h:28
SCHED_FIFO : constant := 1; -- /usr/include/bits/sched.h:29
SCHED_RR : constant := 2; -- /usr/include/bits/sched.h:30
SCHED_BATCH : constant := 3; -- /usr/include/bits/sched.h:32
SCHED_ISO : constant := 4; -- /usr/include/bits/sched.h:33
SCHED_IDLE : constant := 5; -- /usr/include/bits/sched.h:34
SCHED_DEADLINE : constant := 6; -- /usr/include/bits/sched.h:35
SCHED_RESET_ON_FORK : constant := 16#40000000#; -- /usr/include/bits/sched.h:37
CSIGNAL : constant := 16#000000ff#; -- /usr/include/bits/sched.h:42
CLONE_VM : constant := 16#00000100#; -- /usr/include/bits/sched.h:43
CLONE_FS : constant := 16#00000200#; -- /usr/include/bits/sched.h:44
CLONE_FILES : constant := 16#00000400#; -- /usr/include/bits/sched.h:45
CLONE_SIGHAND : constant := 16#00000800#; -- /usr/include/bits/sched.h:46
CLONE_PIDFD : constant := 16#00001000#; -- /usr/include/bits/sched.h:47
CLONE_PTRACE : constant := 16#00002000#; -- /usr/include/bits/sched.h:49
CLONE_VFORK : constant := 16#00004000#; -- /usr/include/bits/sched.h:50
CLONE_PARENT : constant := 16#00008000#; -- /usr/include/bits/sched.h:52
CLONE_THREAD : constant := 16#00010000#; -- /usr/include/bits/sched.h:54
CLONE_NEWNS : constant := 16#00020000#; -- /usr/include/bits/sched.h:55
CLONE_SYSVSEM : constant := 16#00040000#; -- /usr/include/bits/sched.h:56
CLONE_SETTLS : constant := 16#00080000#; -- /usr/include/bits/sched.h:57
CLONE_PARENT_SETTID : constant := 16#00100000#; -- /usr/include/bits/sched.h:58
CLONE_CHILD_CLEARTID : constant := 16#00200000#; -- /usr/include/bits/sched.h:60
CLONE_DETACHED : constant := 16#00400000#; -- /usr/include/bits/sched.h:62
CLONE_UNTRACED : constant := 16#00800000#; -- /usr/include/bits/sched.h:63
CLONE_CHILD_SETTID : constant := 16#01000000#; -- /usr/include/bits/sched.h:65
CLONE_NEWCGROUP : constant := 16#02000000#; -- /usr/include/bits/sched.h:67
CLONE_NEWUTS : constant := 16#04000000#; -- /usr/include/bits/sched.h:68
CLONE_NEWIPC : constant := 16#08000000#; -- /usr/include/bits/sched.h:69
CLONE_NEWUSER : constant := 16#10000000#; -- /usr/include/bits/sched.h:70
CLONE_NEWPID : constant := 16#20000000#; -- /usr/include/bits/sched.h:71
CLONE_NEWNET : constant := 16#40000000#; -- /usr/include/bits/sched.h:72
CLONE_IO : constant := 16#80000000#; -- /usr/include/bits/sched.h:73
-- Definitions of constants and data structure for POSIX 1003.1b-1993
-- scheduling interface.
-- Copyright (C) 1996-2021 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <https://www.gnu.org/licenses/>.
-- Scheduling algorithms.
-- Cloning flags.
-- Clone current process.
function clone
(uu_fn : access function (arg1 : System.Address) return int;
uu_child_stack : System.Address;
uu_flags : int;
uu_arg : System.Address -- , ...
) return int -- /usr/include/bits/sched.h:82
with Import => True,
Convention => C,
External_Name => "clone";
-- Unshare the specified resources.
function unshare (uu_flags : int) return int -- /usr/include/bits/sched.h:86
with Import => True,
Convention => C,
External_Name => "unshare";
-- Get index of currently used CPU.
function sched_getcpu return int -- /usr/include/bits/sched.h:89
with Import => True,
Convention => C,
External_Name => "sched_getcpu";
-- Get currently used CPU and NUMA node.
function getcpu (arg1 : access unsigned; arg2 : access unsigned) return int -- /usr/include/bits/sched.h:92
with Import => True,
Convention => C,
External_Name => "getcpu";
-- Switch process to namespace of type NSTYPE indicated by FD.
function setns (uu_fd : int; uu_nstype : int) return int -- /usr/include/bits/sched.h:95
with Import => True,
Convention => C,
External_Name => "setns";
end bits_sched_h;
|
programs/oeis/062/A062816.asm | jmorken/loda | 1 | 20553 | ; A062816: a(n) = phi(n)*tau(n) - 2n = A000010(n)*A000005(n) - 2*n.
; -1,-2,-2,-2,-2,-4,-2,0,0,-4,-2,0,-2,-4,2,8,-2,0,-2,8,6,-4,-2,16,10,-4,18,16,-2,4,-2,32,14,-4,26,36,-2,-4,18,48,-2,12,-2,32,54,-4,-2,64,28,20,26,40,-2,36,50,80,30,-4,-2,72,-2,-4,90,96,62,28,-2,56,38,52,-2,144,-2,-4,90,64,86,36,-2,160,108,-4,-2,120,86,-4,50,144,-2,108,106,80,54,-4,98,192,-2,56,162,160,-2,52,-2,176,174,-4,-2,216,-2,100,66,256,-2,60,122,104,198,-4,146,272,88,-4,74,112,150,180,-2,256,78,124,-2,216,166,-4,306,240,-2,76,-2,296,86,-4,194,432,158,-4,210,136,-2,180,-2,272,270,172,170,264,-2,-4,98,448,206,216,-2,152,310,-4,-2,432,130,172,306,160,-2,100,370,448,110,-4,-2,504,-2,212,114,336,206,108,266,176,486,196,-2,512,-2,-4,378,364,-2,324,-2,560,126,-4,266,360,230,-4,378,544,302,348,-2,200,134,-4,242,720,286,-4,138,520,326,132,-2,704,630,-4,-2,408,-2,244,498,432,-2,396,266,224,150,292,-2,800,-2,176,486,232,518,148,370,464,158,300
sub $1,$0
cal $0,79535 ; a(n) = phi(n)*d(n) - n.
sub $0,1
add $1,$0
|
prototyping/Luau/Heap.agda | TheGreatSageEqualToHeaven/luau | 1 | 12070 | {-# OPTIONS --rewriting #-}
module Luau.Heap where
open import Agda.Builtin.Equality using (_≡_; refl)
open import FFI.Data.Maybe using (Maybe; just; nothing)
open import FFI.Data.Vector using (Vector; length; snoc; empty; lookup-snoc-not)
open import Luau.Addr using (Addr; _≡ᴬ_)
open import Luau.Var using (Var)
open import Luau.Syntax using (Block; Expr; Annotated; FunDec; nil; function_is_end)
open import Properties.Equality using (_≢_; trans)
open import Properties.Remember using (remember; _,_)
open import Properties.Dec using (yes; no)
-- Heap-allocated objects
data Object (a : Annotated) : Set where
function_is_end : FunDec a → Block a → Object a
Heap : Annotated → Set
Heap a = Vector (Object a)
data _≡_⊕_↦_ {a} : Heap a → Heap a → Addr → Object a → Set where
defn : ∀ {H val} →
-----------------------------------
(snoc H val) ≡ H ⊕ (length H) ↦ val
_[_] : ∀ {a} → Heap a → Addr → Maybe (Object a)
_[_] = FFI.Data.Vector.lookup
∅ : ∀ {a} → Heap a
∅ = empty
data AllocResult a (H : Heap a) (V : Object a) : Set where
ok : ∀ b H′ → (H′ ≡ H ⊕ b ↦ V) → AllocResult a H V
alloc : ∀ {a} H V → AllocResult a H V
alloc H V = ok (length H) (snoc H V) defn
next : ∀ {a} → Heap a → Addr
next = length
allocated : ∀ {a} → Heap a → Object a → Heap a
allocated = snoc
lookup-not-allocated : ∀ {a} {H H′ : Heap a} {b c O} → (H′ ≡ H ⊕ b ↦ O) → (c ≢ b) → (H [ c ] ≡ H′ [ c ])
lookup-not-allocated {H = H} {O = O} defn p = lookup-snoc-not O H p
|
dv3/java/hd/ckwp.asm | olifink/smsqe | 0 | 171675 | <filename>dv3/java/hd/ckwp.asm<gh_stars>0
; DV3 JAVA HDD Check Write Protect V1.00 @ <NAME> 2014
; based on
; DV3 QXL Hard Disk Check Write Protect V3.00 1993 <NAME>
section dv3
xdef hd_ckwp
include 'dev8_keys_java'
include 'dev8_dv3_keys'
;+++
; Check write protect, density: does dothing
;
;
; a3 c p pointer to linkage block
; a4 c p pointer to drive definition
;
; all registers except d0 preserved
;
; status arbitrary
;
;---
hd_ckwp
moveq #jta.ckwp,d0 ; is disk write protected?
dc.w jva.trpa ; return NZ if write proted
sne ddf_wprot(a4)
hdwp_exit
rts
end
|
libmikeos/src.os/os_print_digit.asm | mynameispyo/InpyoOS | 0 | 91343 | <filename>libmikeos/src.os/os_print_digit.asm<gh_stars>0
; @@@ void mikeos_print_digit(unsigned char value);
%include "os_vector.inc"
section .text
use16
global _mikeos_print_digit
_mikeos_print_digit:
mov bx, sp
mov al, [ss:bx + 2]
mov bx, os_print_digit
call bx
ret
|
src/sqlite/ado-statements-sqlite.adb | Letractively/ada-ado | 0 | 3211 | -----------------------------------------------------------------------
-- ADO Databases -- Database connections
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
-- Written by <NAME> (<EMAIL>)
--
-- This file is part of ADO.
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 2,
-- or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY 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
-- along with this program; see the file COPYING. If not, write to
-- the Free Software Foundation, 59 Temple Place - Suite 330,
-- Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------
with Sqlite3_H;
with Sqlite3_H.Perfect_Hash;
with Interfaces.C.Strings;
with Util.Log;
with Util.Log.Loggers;
with ADO.Drivers.Dialects;
package body ADO.Statements.Sqlite is
use Util.Log;
use Ada.Calendar;
use type ADO.Schemas.Class_Mapping_Access;
Log : constant Loggers.Logger := Loggers.Create ("ADO.Statements.Sqlite");
type Dialect is new ADO.Drivers.Dialects.Dialect with null record;
-- Check if the string is a reserved keyword.
overriding
function Is_Reserved (D : in Dialect;
Name : in String) return Boolean;
-- Get the quote character to escape an identifier.
overriding
function Get_Identifier_Quote (D : in Dialect) return Character;
-- Append the item in the buffer escaping some characters if necessary
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in ADO.Blob_Ref);
Sqlite_Dialect : aliased Dialect;
procedure Execute (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
SQL : in String;
Result : out int;
Stmt : out System.Address);
-- Releases the sqlite statement
procedure Release_Stmt (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Stmt : in out System.Address);
procedure Prepare (Stmt : in out Sqlite_Query_Statement;
Query : in String);
-- ------------------------------
-- Check if the string is a reserved keyword.
-- ------------------------------
overriding
function Is_Reserved (D : in Dialect;
Name : in String) return Boolean is
pragma Unreferenced (D);
begin
return Sqlite3_H.Perfect_Hash.Is_Keyword (Name);
end Is_Reserved;
-- ------------------------------
-- Get the quote character to escape an identifier.
-- ------------------------------
overriding
function Get_Identifier_Quote (D : in Dialect) return Character is
pragma Unreferenced (D);
begin
return '`';
end Get_Identifier_Quote;
-- ------------------------------
-- Append the item in the buffer escaping some characters if necessary
-- ------------------------------
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in ADO.Blob_Ref) is
pragma Unreferenced (D);
use type Ada.Streams.Stream_Element;
C : Ada.Streams.Stream_Element;
Blob : constant ADO.Blob_Access := Item.Value;
begin
for I in Blob.Data'Range loop
C := Blob.Data (I);
case C is
when Character'Pos (ASCII.NUL) =>
Append (Buffer, '\');
Append (Buffer, '0');
when Character'Pos (''') =>
Append (Buffer, ''');
Append (Buffer, Character'Val (C));
when others =>
Append (Buffer, Character'Val (C));
end case;
end loop;
end Escape_Sql;
-- ------------------------------
-- Releases the sqlite statement
-- ------------------------------
procedure Release_Stmt (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Stmt : in out System.Address) is
use System;
Result : int;
begin
if Stmt /= System.Null_Address then
Result := Sqlite3_H.sqlite3_reset (Stmt);
ADO.Drivers.Connections.Sqlite.Check_Error (Connection, Result);
Result := Sqlite3_H.sqlite3_finalize (Stmt);
ADO.Drivers.Connections.Sqlite.Check_Error (Connection, Result);
Stmt := System.Null_Address;
end if;
end Release_Stmt;
-- ------------------------------
-- Delete statement
-- ------------------------------
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Sqlite_Delete_Statement;
Result : out Natural) is
begin
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => "DELETE FROM ");
ADO.SQL.Append_Name (Target => Stmt.Query.SQL, Name => Stmt.Table.Table.all);
if Stmt.Query.Has_Join then
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Join);
end if;
if Stmt.Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Filter);
end if;
declare
Sql_Query : constant String := Stmt.Query.Expand;
Handle : aliased System.Address;
Res : int;
begin
Execute (Connection => Stmt.Connection,
SQL => Sql_Query,
Result => Res,
Stmt => Handle);
ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Res);
Release_Stmt (Stmt.Connection, Handle);
Result := Natural (Sqlite3_H.sqlite3_changes (Stmt.Connection));
end;
end Execute;
-- ------------------------------
-- Create the delete statement
-- ------------------------------
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement_Access is
Result : constant Sqlite_Delete_Statement_Access := new Sqlite_Delete_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Query := Result.Delete_Query'Access;
Result.Delete_Query.Set_Dialect (Sqlite_Dialect'Access);
return Result.all'Access;
end Create_Statement;
procedure Execute (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
SQL : in String;
Result : out int;
Stmt : out System.Address) is
ZSql : Strings.chars_ptr := Strings.New_String (SQL);
Handle : aliased System.Address;
begin
Log.Debug ("Execute: {0}", SQL);
Result := Sqlite3_H.sqlite3_prepare_v2 (db => Connection,
zSql => ZSql,
nByte => int (SQL'Length + 1),
ppStmt => Handle'Address,
pzTail => System.Null_Address);
Strings.Free (ZSql);
Stmt := Handle;
if Result /= Sqlite3_H.SQLITE_OK then
ADO.Drivers.Connections.Sqlite.Check_Error (Connection, Result);
return;
end if;
Result := Sqlite3_H.sqlite3_step (Handle);
end Execute;
-- ------------------------------
-- Update statement
-- ------------------------------
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Sqlite_Update_Statement) is
Result : Integer;
begin
Sqlite_Update_Statement'Class (Stmt).Execute (Result);
end Execute;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Sqlite_Update_Statement;
Result : out Integer) is
begin
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "UPDATE ");
ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " SET ");
ADO.SQL.Append_Fields (Update => Stmt.This_Query);
if Stmt.This_Query.Has_Join then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Join);
end if;
if Stmt.This_Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Filter);
end if;
declare
Sql_Query : constant String := Stmt.This_Query.Expand;
Handle : aliased System.Address;
Res : int;
begin
Execute (Connection => Stmt.Connection,
SQL => Sql_Query,
Result => Res,
Stmt => Handle);
ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Res);
Release_Stmt (Stmt.Connection, Handle);
Result := Natural (Sqlite3_H.sqlite3_changes (Stmt.Connection));
end;
end Execute;
-- ------------------------------
-- Create an update statement
-- ------------------------------
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement_Access is
Result : constant Sqlite_Update_Statement_Access := new Sqlite_Update_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Update := Result.This_Query'Access;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Sqlite_Dialect'Access);
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Insert statement
-- ------------------------------
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Sqlite_Insert_Statement;
Result : out Integer) is
begin
if Stmt.Table /= null then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "INSERT INTO ");
ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " (");
ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => False);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ") VALUES(");
ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => True);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ")");
end if;
declare
Sql_Query : constant String := Stmt.This_Query.Expand;
Handle : aliased System.Address;
Res : int;
begin
Execute (Connection => Stmt.Connection,
SQL => Sql_Query,
Result => Res,
Stmt => Handle);
ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Res);
Release_Stmt (Stmt.Connection, Handle);
Result := Natural (Sqlite3_H.sqlite3_changes (Stmt.Connection));
end;
end Execute;
-- ------------------------------
-- Create an insert statement.
-- ------------------------------
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement_Access is
Result : constant Sqlite_Insert_Statement_Access := new Sqlite_Insert_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Update := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Sqlite_Dialect'Access);
ADO.SQL.Set_Insert_Mode (Result.This_Query);
return Result.all'Access;
end Create_Statement;
procedure Prepare (Stmt : in out Sqlite_Query_Statement;
Query : in String) is
Sql : Strings.chars_ptr := Strings.New_String (Query);
Result : int;
Handle : aliased System.Address;
begin
Result := Sqlite3_H.sqlite3_prepare_v2 (db => Stmt.Connection,
zSql => Sql,
nByte => int (Query'Length + 1),
ppStmt => Handle'Address,
pzTail => System.Null_Address);
Strings.Free (Sql);
if Result = Sqlite3_H.SQLITE_OK then
Stmt.Stmt := Handle;
else
ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Result);
end if;
end Prepare;
-- Execute the query
procedure Execute (Query : in out Sqlite_Query_Statement) is
use Sqlite3_H;
use System;
Result : int;
begin
if Query.This_Query.Has_Join then
ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => " ");
ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => Query.This_Query.Get_Join);
end if;
if Query.This_Query.Has_Filter then
ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => Query.This_Query.Get_Filter);
end if;
declare
Expanded_Query : constant String := Query.Query.Expand;
begin
-- Execute the query
Prepare (Query, Expanded_Query);
Log.Debug ("Execute: {0}", Expanded_Query);
Result := Sqlite3_H.sqlite3_step (Query.Stmt);
if Result = Sqlite3_H.SQLITE_ROW then
Query.Status := HAS_ROW;
elsif Result = Sqlite3_H.SQLITE_DONE then
Query.Status := DONE;
else
Query.Status := ERROR;
declare
Error : constant Strings.chars_ptr := Sqlite3_H.sqlite3_errmsg (Query.Connection);
Message : constant String := Strings.Value (Error);
begin
Log.Error ("Query failed: '{0}'", Expanded_Query);
Log.Error (" with error: '{0}'", Message);
raise Invalid_Statement with "Query failed: " & Message;
end;
end if;
end;
end Execute;
-- ------------------------------
-- Returns True if there is more data (row) to fetch
-- ------------------------------
function Has_Elements (Query : in Sqlite_Query_Statement) return Boolean is
use type System.Address;
begin
return Query.Stmt /= System.Null_Address and then Query.Status = HAS_ROW;
end Has_Elements;
-- ------------------------------
-- Fetch the next element
-- ------------------------------
overriding
procedure Next (Query : in out Sqlite_Query_Statement) is
use type System.Address;
Result : int;
begin
if Query.Stmt = System.Null_Address then
Query.Status := ERROR;
else
Result := Sqlite3_H.sqlite3_step (Query.Stmt);
if Result = Sqlite3_H.SQLITE_ROW then
Query.Status := HAS_ROW;
elsif Result = Sqlite3_H.SQLITE_DONE then
Query.Status := DONE;
else
ADO.Drivers.Connections.Sqlite.Check_Error (Query.Connection, Result);
Query.Status := ERROR;
end if;
end if;
end Next;
-- ------------------------------
-- Returns true if the column <b>Column</b> is null.
-- ------------------------------
overriding
function Is_Null (Query : in Sqlite_Query_Statement;
Column : in Natural) return Boolean is
Res : constant int := Sqlite3_H.sqlite3_column_type (Query.Stmt, int (Column));
begin
return Res = Sqlite3_H.SQLITE_NULL;
end Is_Null;
-- Get the number of rows returned by the query
function Get_Row_Count (Query : in Sqlite_Query_Statement) return Natural is
pragma Unreferenced (Query);
begin
return 0;
end Get_Row_Count;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Int64</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Int64 (Query : in Sqlite_Query_Statement;
Column : in Natural) return Int64 is
Result : constant Sqlite3_H.sqlite_int64
:= Sqlite3_H.sqlite3_column_int64 (Query.Stmt, int (Column));
begin
return Int64 (Result);
end Get_Int64;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Unbounded_String (Query : in Sqlite_Query_Statement;
Column : in Natural) return Unbounded_String is
use type Strings.chars_ptr;
Text : constant Strings.chars_ptr
:= Sqlite3_H.sqlite3_column_text (Query.Stmt, int (Column));
begin
if Text = Strings.Null_Ptr then
return Null_Unbounded_String;
else
return To_Unbounded_String (Interfaces.C.Strings.Value (Text));
end if;
end Get_Unbounded_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_String (Query : Sqlite_Query_Statement;
Column : Natural) return String is
use type Strings.chars_ptr;
Text : constant Strings.chars_ptr
:= Sqlite3_H.sqlite3_column_text (Query.Stmt, int (Column));
begin
if Text = Strings.Null_Ptr then
return "";
else
return Interfaces.C.Strings.Value (Text);
end if;
end Get_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as a <b>Blob</b> reference.
-- ------------------------------
overriding
function Get_Blob (Query : in Sqlite_Query_Statement;
Column : in Natural) return ADO.Blob_Ref is
use type System.Address;
Text : constant System.Address
:= Sqlite3_H.sqlite3_column_blob (Query.Stmt, int (Column));
Len : constant int := Sqlite3_H.sqlite3_column_bytes (Query.Stmt, int (Column));
begin
if Text = System.Null_Address or Len <= 0 then
return Null_Blob;
else
return Get_Blob (Size => Natural (Len),
Data => To_Chars_Ptr (Text));
end if;
end Get_Blob;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Time</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Time (Query : in Sqlite_Query_Statement;
Column : in Natural) return Ada.Calendar.Time is
Text : constant Strings.chars_ptr
:= Sqlite3_H.sqlite3_column_text (Query.Stmt, int (Column));
begin
return ADO.Statements.Get_Time (ADO.Statements.To_Chars_Ptr (Text));
end Get_Time;
-- ------------------------------
-- Get the column type
-- ------------------------------
overriding
function Get_Column_Type (Query : in Sqlite_Query_Statement;
Column : in Natural)
return ADO.Schemas.Column_Type is
Res : constant int := Sqlite3_H.sqlite3_column_type (Query.Stmt, int (Column));
begin
case Res is
when Sqlite3_H.SQLITE_NULL =>
return ADO.Schemas.T_NULL;
when Sqlite3_H.SQLITE_INTEGER =>
return ADO.Schemas.T_INTEGER;
when Sqlite3_H.SQLITE_FLOAT =>
return ADO.Schemas.T_FLOAT;
when Sqlite3_H.SQLITE_TEXT =>
return ADO.Schemas.T_VARCHAR;
when Sqlite3_H.SQLITE_BLOB =>
return ADO.Schemas.T_BLOB;
when others =>
return ADO.Schemas.T_UNKNOWN;
end case;
end Get_Column_Type;
-- ------------------------------
-- Get the column name.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Column_Name (Query : in Sqlite_Query_Statement;
Column : in Natural)
return String is
use type Interfaces.C.Strings.chars_ptr;
Name : constant Interfaces.C.Strings.chars_ptr
:= Sqlite3_H.sqlite3_column_name (Query.Stmt, int (Column));
begin
if Name = Interfaces.C.Strings.Null_Ptr then
return "";
else
return Interfaces.C.Strings.Value (Name);
end if;
end Get_Column_Name;
-- ------------------------------
-- Get the number of columns in the result.
-- ------------------------------
overriding
function Get_Column_Count (Query : in Sqlite_Query_Statement)
return Natural is
begin
return Natural (Sqlite3_H.sqlite3_column_count (Query.Stmt));
end Get_Column_Count;
-- ------------------------------
-- Deletes the query statement.
-- ------------------------------
overriding
procedure Finalize (Query : in out Sqlite_Query_Statement) is
begin
Release_Stmt (Query.Connection, Query.Stmt);
end Finalize;
-- ------------------------------
-- Create the query statement.
-- ------------------------------
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement_Access is
Result : constant Sqlite_Query_Statement_Access := new Sqlite_Query_Statement;
begin
Result.Connection := Database;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Sqlite_Dialect'Access);
if Table /= null then
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "SELECT ");
for I in Table.Members'Range loop
if I > Table.Members'First then
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => ", ");
end if;
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "o.");
ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Members (I).all);
end loop;
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " FROM ");
ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Table.all);
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " AS o ");
end if;
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Create the query statement.
-- ------------------------------
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Query : in String)
return Query_Statement_Access is
pragma Unreferenced (Query);
Result : constant Sqlite_Query_Statement_Access := new Sqlite_Query_Statement;
begin
Result.Connection := Database;
Result.Query := Result.This_Query'Access;
return Result.all'Access;
end Create_Statement;
end ADO.Statements.Sqlite;
|
src/ewok-isr.adb | PThierry/ewok-kernel | 65 | 2180 | --
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- 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 soc.interrupts; use soc.interrupts;
with ewok.posthook;
with ewok.softirq;
with ewok.dma;
with soc.dma;
with soc.nvic;
package body ewok.isr
with spark_mode => off
is
procedure postpone_isr
(intr : in soc.interrupts.t_interrupt;
handler : in ewok.interrupts.t_interrupt_handler_access;
task_id : in ewok.tasks_shared.t_task_id)
is
pragma warnings (off); -- Size differ
function to_unsigned_32 is new ada.unchecked_conversion
(soc.dma.t_dma_stream_int_status, unsigned_32);
pragma warnings (on);
dma_status : soc.dma.t_dma_stream_int_status;
status : unsigned_32 := 0;
data : unsigned_32 := 0;
isr_params : ewok.softirq.t_isr_parameters;
ok : boolean;
begin
-- Acknowledge interrupt:
-- - DMAs are managed by the kernel
-- - Devices managed by user tasks should use the posthook mechanism
-- to acknowledge interrupt (in order to avoid bursts).
-- Note:
-- Posthook execution is mandatory for hardware devices that wait for
-- a quick answer from the driver. It permit to execute some
-- instructions (reading and writing registers) and to return some
-- value (former 'status' and 'data' parameters)
if soc.dma.soc_is_dma_irq (intr) then
ewok.dma.get_status_register (task_id, intr, dma_status, ok);
if ok then
status := to_unsigned_32 (dma_status) and 2#0011_1101#;
else
raise program_error;
end if;
ewok.dma.clear_dma_interrupts (task_id, intr);
else
-- INFO: this function should be executed as a critical section
-- (ToCToU risk)
ewok.posthook.exec (intr, status, data);
end if;
-- All user ISR have their Pending IRQ bit clean here
soc.nvic.clear_pending_irq (soc.nvic.to_irq_number (intr));
-- Pushing the request for further treatment by softirq
isr_params.handler := ewok.interrupts.to_system_address (handler);
isr_params.interrupt := intr;
isr_params.posthook_status := status;
isr_params.posthook_data := data;
-- INFO: this function is not reentrant
ewok.softirq.push_isr (task_id, isr_params);
return;
end postpone_isr;
end ewok.isr;
|
examples/writer/hello/hello.asm | CrackerCat/COFFI | 110 | 89757 | ; This program serves as an example for coding the writer.cpp example
.386 ; For 80386 CPUs or higher.
.model flat, stdcall ; Windows is always the 32-bit FLAT model
option casemap:none ; Masm32 will use case-sensitive labels.
.data
MyBoxText db "Hello World!",0
.code
MyMsgBox:
MessageBoxA PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
invoke MessageBoxA, 0, ADDR MyBoxText, ADDR MyBoxText, 0
ExitProcess PROTO STDCALL :DWORD
invoke ExitProcess,0
hlt
end MyMsgBox
|
libsrc/_DEVELOPMENT/target/yaz180/driver/ide/ide_soft_reset.asm | jpoikela/z88dk | 640 | 29742 | <reponame>jpoikela/z88dk
SECTION code_driver
PUBLIC ide_soft_reset
EXTERN __IO_IDE_CONTROL
EXTERN ide_wait_ready
EXTERN ide_write_byte
;------------------------------------------------------------------------------
; Routines that talk with the IDE drive, these should be called by
; the main program.
; by writing to the __IO_IDE_CONTROL register, a software reset
; can be initiated.
; this should be followed with a call to "ide_init".
ide_soft_reset:
push af
push de
ld e, 00000110b ;no interrupt, set drives reset
ld a, __IO_IDE_CONTROL
call ide_write_byte
ld e, 00000010b ;no interrupt, clear drives reset
ld a, __IO_IDE_CONTROL
call ide_write_byte
pop de
pop af
jp ide_wait_ready
|
Task/Thieles-interpolation-formula/Ada/thieles-interpolation-formula-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 4160 | <reponame>LaudateCorpus1/RosettaCodeData
with Ada.Numerics.Generic_Real_Arrays;
generic
type Real is digits <>;
package Thiele is
package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (Real);
subtype Real_Array is Real_Arrays.Real_Vector;
type Thiele_Interpolation (Length : Natural) is private;
function Create (X, Y : Real_Array) return Thiele_Interpolation;
function Inverse (T : Thiele_Interpolation; X : Real) return Real;
private
type Thiele_Interpolation (Length : Natural) is record
X, Y, RhoX : Real_Array (1 .. Length);
end record;
end Thiele;
|
src/ewok-posthook.adb | PThierry/ewok-kernel | 65 | 17186 | <filename>src/ewok-posthook.adb
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- 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 ewok.exported.interrupts; use ewok.exported.interrupts;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.interrupts;
with ewok.devices;
package body ewok.posthook
with spark_mode => off
is
function read_register (addr : system_address)
return unsigned_32
is
reg : unsigned_32
with import, volatile_full_access, address => to_address (addr);
begin
return reg;
end read_register;
pragma inline (read_register);
procedure set_bits_in_register
(addr : in system_address;
bits : in unsigned_32;
val : in unsigned_32)
is
reg : unsigned_32
with import, volatile_full_access, address => to_address (addr);
begin
if bits = 16#FFFF_FFFF# then
reg := val;
else
reg := (reg and (not bits)) or (val and bits);
end if;
end set_bits_in_register;
procedure exec
(intr : in soc.interrupts.t_interrupt;
status : out unsigned_32;
data : out unsigned_32)
is
dev_id : ewok.devices_shared.t_device_id;
dev_addr : system_address;
config : ewok.exported.interrupts.t_interrupt_config_access;
found : boolean;
val : unsigned_32;
mask : unsigned_32;
begin
config := ewok.devices.get_interrupt_config_from_interrupt (intr);
if config = NULL then
status := 0;
data := 0;
return;
end if;
dev_id := ewok.interrupts.get_device_from_interrupt (intr);
if dev_id = ID_DEV_UNUSED then
status := 0;
data := 0;
return;
end if;
dev_addr := ewok.devices.get_device_addr (dev_id);
#if CONFIG_KERNEL_EXP_REENTRANCY
-- posthooks are, by now, executed with ISR disabled, to avoid temporal holes
-- when reading/writing data in device's registers and generating potential
-- ToCToU
m4.cpu.disable_irq;
#end if;
for i in config.all.posthook.action'range loop
case config.all.posthook.action(i).instr is
when POSTHOOK_NIL =>
#if CONFIG_KERNEL_EXP_REENTRANCY
-- No subsequent action. Returning.
m4.cpu.enable_irq;
#end if;
return;
when POSTHOOK_READ =>
val := read_register (dev_addr +
system_address (config.all.posthook.action(i).read.offset));
config.all.posthook.action(i).read.value := val;
-- This value need to be saved ?
if config.all.posthook.status =
config.all.posthook.action(i).read.offset
then
status := val;
end if;
-- This value need to be saved ?
if
config.all.posthook.data =
config.all.posthook.action(i).read.offset
then
data := val;
end if;
when POSTHOOK_WRITE =>
set_bits_in_register
(dev_addr + system_address
(config.all.posthook.action(i).write.offset),
config.all.posthook.action(i).write.mask,
config.all.posthook.action(i).write.value);
when POSTHOOK_WRITE_REG =>
-- Retrieving the already read register value
found := false;
for j in config.all.posthook.action'first .. i loop
if config.all.posthook.action(j).instr = POSTHOOK_READ and then
config.all.posthook.action(j).read.offset =
config.all.posthook.action(i).write_reg.offset_src
then
val := config.all.posthook.action(j).read.value;
found := true;
exit;
end if;
end loop;
if not found then
val := read_register (dev_addr + system_address
(config.all.posthook.action(i).write_reg.offset_src));
end if;
-- Calculating the mask to apply in order to write only active
-- bits
mask := config.all.posthook.action(i).write_reg.mask and val;
-- Inverted write might be needed
if config.all.posthook.action(i).write_reg.mode = MODE_NOT then
val := not val;
end if;
-- Writing into the destination register
set_bits_in_register
(dev_addr + system_address
(config.all.posthook.action(i).write_reg.offset_dest),
mask,
val);
when POSTHOOK_WRITE_MASK =>
-- Retrieving the value
found := false;
for j in config.all.posthook.action'first .. i loop
if config.all.posthook.action(j).instr = POSTHOOK_READ and then
config.all.posthook.action(j).read.offset =
config.all.posthook.action(i).write_mask.offset_src
then
val := config.all.posthook.action(j).read.value;
found := true;
exit;
end if;
end loop;
if not found then
val := read_register (dev_addr + system_address
(config.all.posthook.action(i).write_mask.offset_src));
end if;
-- Retrieving the mask
found := false;
for j in config.all.posthook.action'first .. i loop
if config.all.posthook.action(j).instr = POSTHOOK_READ and then
config.all.posthook.action(j).read.offset =
config.all.posthook.action(i).write_mask.offset_mask
then
mask := config.all.posthook.action(j).read.value;
found := true;
exit;
end if;
end loop;
if not found then
mask := read_register (dev_addr + system_address
(config.all.posthook.action(i).write_mask.offset_mask));
end if;
-- Calculating the mask
mask := mask and val;
-- Inverted write might be needed
if config.all.posthook.action(i).write_mask.mode = MODE_NOT then
val := not val;
end if;
-- Writing into the destination register
set_bits_in_register
(dev_addr + system_address
(config.all.posthook.action(i).write_mask.offset_dest),
mask,
val);
end case;
end loop;
#if CONFIG_KERNEL_EXP_REENTRANCY
-- Let's enable again IRQs
m4.cpu.enable_irq;
#end if;
end exec;
end ewok.posthook;
|
libsrc/graphics/zx81/hr/mt_hardcopy.asm | jpoikela/z88dk | 640 | 98355 | ;
; Copy the graphics area to the zx printer
;
; <NAME>, 2018
;
;
; $Id: mt_hardcopy.asm $
;
SECTION code_clib
PUBLIC zx_hardcopy
PUBLIC _zx_hardcopy
EXTERN zx_fast
EXTERN zx_slow
.zx_hardcopy
._zx_hardcopy
CALL zx_fast
; REGISTER B = 64 OR 192 LINES (192 X LOOP1)
IF FORzx81mt64
ld b,64 ; new row counter
ELSE
ld b,192 ; new row counter
ENDIF
LD HL,($407B) ; REGISTER HL POINTS TO THE GRAPHICS D-FILE
XOR A ; SET REGISTER BITS 0-7 TO ZERO
OUT ($FB),A ; START PRINTER (BIT 2=0)
.LOOP1
IN A,($FB) ; GET PRINTER STATUS BYTE
RLA ; ROTATE BIT 7 (LF BUSY) TO C FLAG
JR NC,LOOP1 ; LOOP IF LINEFEED IS BUSY
PUSH BC ; SAVE ROW COUNT
.L0EF4 LD A,B ; row counter
CP $03 ; cleverly prepare a printer control mask
SBC A,A ; to slow printer for the last two pixel lines
AND $02 ; keep bit 1
OUT ($FB),A ; bit 2 is reset, turn on the zx printer
LD D,A ; save the printer control mask
;; COPY-L-1
.L0EFD ;CALL L1F54 ; routine
.L1F54 LD A,$7F ; BREAK-KEY
IN A,($FE) ;
RRA ;
jr nc,copy_exit
;; COPY-CONT
.L0F0C IN A,($FB) ; read printer port
ADD A,A ; test bit 6 and 7
JP M,copy_exit ; return if no printer or hw error
JR NC,L0F0C ; if bit 7 is reset (LF BUSY), then wait
LD C,32 ; 32 bytes line
LD E,0
JR FIRSTCOL
;; COPY-BYTES
.L0F14 LD E,(HL) ; get byte data
.FIRSTCOL
INC HL
LD B,8 ; 8 bit
;; COPY-BITS
.L0F18 RL D ; mix the printer control mask
RL E ; and the data byte
RR D ; to alter the stylus speed
;; COPY-WAIT
.L0F1E IN A,($FB) ; read the printer port
RRA ; test for alignment signal from encoder.
JR NC,L0F1E ; loop until not present to COPY-WAIT
LD A,D ; control byte to A
OUT ($FB),A ; and output to printer por
DJNZ L0F18 ; loop for all eight bits to COPY-BITS
DEC C ; loop for all the 32 bytes in the current line
JR NZ,L0F14 ; to COPY-BYTES
POP BC
INC HL ; 33rd byte (HALT line terminator on Memotech HRG)
DJNZ LOOP1 ; REPEAT 64 OR 192 TIMES
PUSH BC ; BALANCE STACK
.copy_exit
POP BC ; BALANCE STACK
LD A,4 ; BIT 2 IS PRINTER ON/OFF BIT
OUT ($FB),A ; TURN OFF PRINTER
JP zx_slow
|
huffman/huffman-tree.agda | rfindler/ial | 29 | 15490 | module huffman-tree where
open import lib
data huffman-tree : Set where
ht-leaf : string → ℕ → huffman-tree
ht-node : ℕ → huffman-tree → huffman-tree → huffman-tree
-- get the frequency out of a Huffman tree
ht-frequency : huffman-tree → ℕ
ht-frequency (ht-leaf _ f) = f
ht-frequency (ht-node f _ _) = f
-- lower frequency nodes are considered smaller
ht-compare : huffman-tree → huffman-tree → 𝔹
ht-compare h1 h2 = (ht-frequency h1) < (ht-frequency h2)
{- return (just s) if Huffman tree is an ht-leaf with string s;
otherwise, return nothing (this is a constructor for the maybe type -- see maybe.agda in the IAL) -}
ht-string : huffman-tree → maybe string
ht-string (ht-leaf s f) = just s
ht-string _ = nothing
-- several helper functions for ht-to-string (defined at the bottom)
private
-- helper function for ht-to-stringh
ht-declare-node : huffman-tree → ℕ → string × string
ht-declare-node h n =
let cur = "n" ^ (ℕ-to-string n) in
cur , (cur ^ " [label = \"" ^ (help (ht-string h)) ^ (ℕ-to-string (ht-frequency h)) ^ "\"];\n")
where help : maybe string → string
help (just s) = s ^ " , "
help nothing = ""
-- helper function for ht-to-stringh
ht-attach : maybe string → string → string
ht-attach nothing _ = ""
ht-attach (just c) c' = c ^ " -> " ^ c' ^ ";\n"
ht-to-stringh : huffman-tree → ℕ → maybe string → ℕ × string
ht-to-stringh h n prev with ht-declare-node h n
ht-to-stringh (ht-leaf _ _) n prev | c , s = suc n , (ht-attach prev c) ^ s
ht-to-stringh (ht-node _ h1 h2) n prev | c , s with ht-to-stringh h1 (suc n) (just c)
ht-to-stringh (ht-node _ h1 h2) _ prev | c , s | n , s1 with ht-to-stringh h2 n (just c)
ht-to-stringh (ht-node _ h1 h2) _ prev | c , s | _ , s1 | n , s2 = n , (ht-attach prev c) ^ s ^ s1 ^ s2
{- turn a Huffman tree into a string in Graphviz format
(you can render the output .gv file at http://sandbox.kidstrythisathome.com/erdos/) -}
ht-to-string : huffman-tree → string
ht-to-string h with ht-to-stringh h 0 nothing
ht-to-string h | _ , s = "digraph h {\nnode [shape = plaintext];\n" ^ s ^ "}"
|
libsrc/target/g800/lcd_contrast.asm | jpoikela/z88dk | 640 | 26030 | ;
; G850 library
;
;--------------------------------------------------------------
;
; $Id: lcd_contrast.asm $
;
;----------------------------------------------------------------
;
; lcd_contrast(x) - set LCD contrast (0..17)
;
;----------------------------------------------------------------
SECTION code_clib
PUBLIC lcd_contrast
PUBLIC _lcd_contrast
lcd_contrast:
_lcd_contrast:
cp 18
ret nc
ld a,128
add l
out (64),a
ret
|
linux32/libs/stdlib.asm | amittaigames/asmgame | 0 | 100182 | <gh_stars>0
; Standard library
; Linux 32 bit
;----------------------------------------------------------------------
; SYSTEM CALLS
;----------------------------------------------------------------------
SYS_EXIT: equ 0x0001
SYS_READ: equ 0x0003
SYS_WRITE: equ 0x0004
;----------------------------------------------------------------------
; void exit(int code)
;
; Exits the program
;----------------------------------------------------------------------
exit:
mov ebx, eax ; Move function arg to system call arg
mov eax, SYS_EXIT ; System call
int 0x80
ret
;----------------------------------------------------------------------
; int strlen(char* str)
;
; Returns the length of a string
;----------------------------------------------------------------------
strlen:
push ecx ; Store registers
mov ecx, 0 ; Set counter
.charLoop:
cmp byte [eax], 0 ; Compare against zero
je .done ; End of string
inc ecx ; Increment counter
inc eax ; Increment pointer
jmp .charLoop ; Start over
.done:
sub eax, ecx ; Set string pointer back
mov edx, ecx ; Set return value
pop ecx ; Restore registers
ret
;----------------------------------------------------------------------
; void sprint(char* str)
;
; Prints a string
;----------------------------------------------------------------------
sprint:
push eax ; Store registers
push ebx
push ecx
push edx
call strlen ; Get string length in EDX
mov ecx, eax ; Move string to system call argument
mov ebx, 1 ; Standard output
mov eax, SYS_WRITE ; System call
int 0x80
pop edx ; Restore registers
pop ecx
pop ebx
pop eax
ret
;----------------------------------------------------------------------
; void sprintNL()
;
; Prints a new line character
;----------------------------------------------------------------------
sprintNL:
push eax ; Store registers
mov eax, 10 ; Move new line to EAX
push eax ; Push it
mov eax, esp ; Get new line from stack pointer
call sprint ; Print it
pop eax ; Pop the new line
pop eax ; Restore registers
ret
;----------------------------------------------------------------------
; void gets(char* dest, int size)
;
; Gets string from standard input (removes new line)
;----------------------------------------------------------------------
gets:
push eax ; Store registers
push ebx
push ecx
push edx
mov edx, ebx ; Set last system call arg to function arg
mov ecx, eax ; Set system call string to function arg
mov ebx, 0 ; Standard input
mov eax, SYS_READ ; System call
int 0x80
mov eax, ecx ; Get string back
mov ebx, 0 ; Null character
call strlen ; Get string length
mov ecx, edx ; Move length to 3rd param
sub ecx, 1 ; Subtract to new line
call setChar ; Set the new line to null char
pop edx ; Restore registers
pop ecx
pop ebx
pop eax
ret
;----------------------------------------------------------------------
; int strEquals(char* a, char* b)
;
; Compares strings
;----------------------------------------------------------------------
strcmp:
push eax ; Store registers
push ebx
push ecx
call strlen ; Get string length for A
push eax ; Store string
push edx ; Store length
mov eax, ebx ; Move string B to function arg
call strlen ; Get string length for B
pop ecx ; Get A length
cmp ecx, edx ; Compare lengths
jne .ne2 ; If not equal, end
pop eax ; Get string back
mov ecx, 0 ; Begin counter
.charLoop:
cmp ecx, edx ; Compare counter and length
je .done ; If end of string, finish
mov al, [eax + ecx] ; Check character from string A
mov bl, [ebx + ecx] ; Check character from string B
cmp al, bl ; Check if same
jne .ne ; If different, jump somewhere else
inc ecx ; Increment counter
jmp .charLoop ; Start over
.ne2:
pop eax ; Restore push
.ne:
pop ecx ; Restore registers
pop ebx
pop eax
mov edx, 0 ; Set return value to false
ret
.done:
pop ecx ; Restore registers
pop ebx
pop eax
mov edx, 1 ; Set return value to true
ret
;----------------------------------------------------------------------
; void setChar(char* a, char c, int index)
;
; Sets a charater in a string
;----------------------------------------------------------------------
setChar:
mov [eax + ecx], ebx ; Set the string pointer offset to char
ret |
corpus/antlr4/training/T.g4 | antlr/groom | 408 | 3805 | grammar T;
a : A ;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_932.asm | ljhsiun2/medusa | 9 | 101087 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r9
push %rcx
push %rdx
// Faulty Load
lea addresses_PSE+0x1f924, %rdx
nop
nop
nop
nop
add $45772, %r12
vmovups (%rdx), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r14
lea oracles, %rcx
and $0xff, %r14
shlq $12, %r14
mov (%rcx,%r14,1), %r14
pop %rdx
pop %rcx
pop %r9
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
programs/oeis/068/A068952.asm | neoneye/loda | 22 | 5222 | <filename>programs/oeis/068/A068952.asm<gh_stars>10-100
; A068952: Squares in A068949.
; 1,4,9,16,36,49,64,81,100,121,144,196
mul $0,2
seq $0,225875 ; We write the 1 + 4*k numbers once and twice the others.
add $1,$0
pow $1,2
mov $0,$1
|
libsrc/_DEVELOPMENT/adt/wv_stack/c/sccz80/wv_stack_max_size.asm | jpoikela/z88dk | 640 | 24965 |
; size_t wv_stack_max_size(wv_stack_t *s)
SECTION code_clib
SECTION code_adt_wv_stack
PUBLIC wv_stack_max_size
EXTERN asm_wv_stack_size
defc wv_stack_max_size = asm_wv_stack_size
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _wv_stack_max_size
defc _wv_stack_max_size = wv_stack_max_size
ENDIF
|
Task/Visualize-a-tree/AppleScript/visualize-a-tree.applescript | LaudateCorpus1/RosettaCodeData | 1 | 1518 | -- Vertically centered textual tree using UTF8 monospaced
-- box-drawing characters, with options for compacting
-- and pruning.
-- ┌── Gamma
-- ┌─ Beta ┼── Delta
-- │ └ Epsilon
-- Alpha ┼─ Zeta ───── Eta
-- │ ┌─── Iota
-- └ Theta ┼── Kappa
-- └─ Lambda
-- TESTS --------------------------------------------------
on run
set tree to Node(1, ¬
{Node(2, ¬
{Node(4, {Node(7, {})}), ¬
Node(5, {})}), ¬
Node(3, ¬
{Node(6, ¬
{Node(8, {}), Node(9, {})})})})
set tree2 to Node("Alpha", ¬
{Node("Beta", ¬
{Node("Gamma", {}), ¬
Node("Delta", {}), ¬
Node("Epsilon", {})}), ¬
Node("Zeta", {Node("Eta", {})}), ¬
Node("Theta", ¬
{Node("Iota", {}), Node("Kappa", {}), ¬
Node("Lambda", {})})})
set strTrees to unlines({"(NB – view in mono-spaced font)\n\n", ¬
"Compacted (not all parents vertically centered):\n", ¬
drawTree2(true, false, tree), ¬
"\nFully expanded and vertically centered:\n", ¬
drawTree2(false, false, tree2), ¬
"\nVertically centered, with nodeless lines pruned out:\n", ¬
drawTree2(false, true, tree2)})
set the clipboard to strTrees
strTrees
end run
-- drawTree2 :: Bool -> Bool -> Tree String -> String
on drawTree2(blnCompressed, blnPruned, tree)
-- Tree design and algorithm inspired by the Haskell snippet at:
-- https://doisinkidney.com/snippets/drawing-trees.html
script measured
on |λ|(t)
script go
on |λ|(x)
set s to " " & x & " "
Tuple(length of s, s)
end |λ|
end script
fmapTree(go, t)
end |λ|
end script
set measuredTree to |λ|(tree) of measured
script levelMax
on |λ|(a, level)
a & maximum(map(my fst, level))
end |λ|
end script
set levelWidths to foldl(levelMax, {}, ¬
init(levels(measuredTree)))
-- Lefts, Mid, Rights
script lmrFromStrings
on |λ|(xs)
set {ls, rs} to items 2 thru -2 of ¬
(splitAt((length of xs) div 2, xs) as list)
Tuple3(ls, item 1 of rs, rest of rs)
end |λ|
end script
script stringsFromLMR
on |λ|(lmr)
script add
on |λ|(a, x)
a & x
end |λ|
end script
foldl(add, {}, items 2 thru -2 of (lmr as list))
end |λ|
end script
script fghOverLMR
on |λ|(f, g, h)
script
property mg : mReturn(g)
on |λ|(lmr)
set {ls, m, rs} to items 2 thru -2 of (lmr as list)
Tuple3(map(f, ls), |λ|(m) of mg, map(h, rs))
end |λ|
end script
end |λ|
end script
script lmrBuild
on leftPad(n)
script
on |λ|(s)
replicateString(n, space) & s
end |λ|
end script
end leftPad
-- lmrBuild main
on |λ|(w, f)
script
property mf : mReturn(f)
on |λ|(wsTree)
set xs to nest of wsTree
set lng to length of xs
set {nChars, x} to items 2 thru -2 of ¬
((root of wsTree) as list)
set _x to replicateString(w - nChars, "─") & x
-- LEAF NODE ------------------------------------
if 0 = lng then
Tuple3({}, _x, {})
else if 1 = lng then
-- NODE WITH SINGLE CHILD ---------------------
set indented to leftPad(1 + w)
script lineLinked
on |λ|(z)
_x & "─" & z
end |λ|
end script
|λ|(|λ|(item 1 of xs) of mf) of ¬
(|λ|(indented, lineLinked, indented) of ¬
fghOverLMR)
else
-- NODE WITH CHILDREN -------------------------
script treeFix
on cFix(x)
script
on |λ|(xs)
x & xs
end |λ|
end script
end cFix
on |λ|(l, m, r)
compose(stringsFromLMR, ¬
|λ|(cFix(l), cFix(m), cFix(r)) of ¬
fghOverLMR)
end |λ|
end script
script linked
on |λ|(s)
set c to text 1 of s
set t to tail(s)
if "┌" = c then
_x & "┬" & t
else if "│" = c then
_x & "┤" & t
else if "├" = c then
_x & "┼" & t
else
_x & "┴" & t
end if
end |λ|
end script
set indented to leftPad(w)
set lmrs to map(f, xs)
if blnCompressed then
set sep to {}
else
set sep to {"│"}
end if
tell lmrFromStrings
set tupleLMR to |λ|(intercalate(sep, ¬
{|λ|(item 1 of lmrs) of ¬
(|λ|(" ", "┌", "│") of treeFix)} & ¬
map(|λ|("│", "├", "│") of treeFix, ¬
init(tail(lmrs))) & ¬
{|λ|(item -1 of lmrs) of ¬
(|λ|("│", "└", " ") of treeFix)}))
end tell
|λ|(tupleLMR) of ¬
(|λ|(indented, linked, indented) of fghOverLMR)
end if
end |λ|
end script
end |λ|
end script
set treeLines to |λ|(|λ|(measuredTree) of ¬
foldr(lmrBuild, 0, levelWidths)) of stringsFromLMR
if blnPruned then
script notEmpty
on |λ|(s)
script isData
on |λ|(c)
"│ " does not contain c
end |λ|
end script
any(isData, characters of s)
end |λ|
end script
set xs to filter(notEmpty, treeLines)
else
set xs to treeLines
end if
unlines(xs)
end drawTree2
-- GENERIC ------------------------------------------------
-- Node :: a -> [Tree a] -> Tree a
on Node(v, xs)
{type:"Node", root:v, nest:xs}
end Node
-- Tuple (,) :: a -> b -> (a, b)
on Tuple(a, b)
-- Constructor for a pair of values, possibly of two different types.
{type:"Tuple", |1|:a, |2|:b, length:2}
end Tuple
-- Tuple3 (,,) :: a -> b -> c -> (a, b, c)
on Tuple3(x, y, z)
{type:"Tuple3", |1|:x, |2|:y, |3|:z, length:3}
end Tuple3
-- Applied to a predicate and a list,
-- |any| returns true if at least one element of the
-- list satisfies the predicate.
-- any :: (a -> Bool) -> [a] -> Bool
on any(f, xs)
tell mReturn(f)
set lng to length of xs
repeat with i from 1 to lng
if |λ|(item i of xs) then return true
end repeat
false
end tell
end any
-- compose (<<<) :: (b -> c) -> (a -> b) -> a -> c
on compose(f, g)
script
property mf : mReturn(f)
property mg : mReturn(g)
on |λ|(x)
|λ|(|λ|(x) of mg) of mf
end |λ|
end script
end compose
-- concat :: [[a]] -> [a]
-- concat :: [String] -> String
on concat(xs)
set lng to length of xs
if 0 < lng and string is class of (item 1 of xs) then
set acc to ""
else
set acc to {}
end if
repeat with i from 1 to lng
set acc to acc & item i of xs
end repeat
acc
end concat
-- concatMap :: (a -> [b]) -> [a] -> [b]
on concatMap(f, xs)
set lng to length of xs
set acc to {}
tell mReturn(f)
repeat with i from 1 to lng
set acc to acc & (|λ|(item i of xs, i, xs))
end repeat
end tell
return acc
end concatMap
-- filter :: (a -> Bool) -> [a] -> [a]
on filter(f, xs)
tell mReturn(f)
set lst to {}
set lng to length of xs
repeat with i from 1 to lng
set v to item i of xs
if |λ|(v, i, xs) then set end of lst to v
end repeat
return lst
end tell
end filter
-- fmapTree :: (a -> b) -> Tree a -> Tree b
on fmapTree(f, tree)
script go
property g : |λ| of mReturn(f)
on |λ|(x)
set xs to nest of x
if xs ≠ {} then
set ys to map(go, xs)
else
set ys to xs
end if
Node(g(root of x), ys)
end |λ|
end script
|λ|(tree) of go
end fmapTree
-- foldl :: (a -> b -> a) -> a -> [b] -> a
on foldl(f, startValue, xs)
tell mReturn(f)
set v to startValue
set lng to length of xs
repeat with i from 1 to lng
set v to |λ|(v, item i of xs, i, xs)
end repeat
return v
end tell
end foldl
-- foldr :: (a -> b -> b) -> b -> [a] -> b
on foldr(f, startValue, xs)
tell mReturn(f)
set v to startValue
set lng to length of xs
repeat with i from lng to 1 by -1
set v to |λ|(item i of xs, v, i, xs)
end repeat
return v
end tell
end foldr
-- fst :: (a, b) -> a
on fst(tpl)
if class of tpl is record then
|1| of tpl
else
item 1 of tpl
end if
end fst
-- identity :: a -> a
on identity(x)
-- The argument unchanged.
x
end identity
-- init :: [a] -> [a]
-- init :: [String] -> [String]
on init(xs)
set blnString to class of xs = string
set lng to length of xs
if lng > 1 then
if blnString then
text 1 thru -2 of xs
else
items 1 thru -2 of xs
end if
else if lng > 0 then
if blnString then
""
else
{}
end if
else
missing value
end if
end init
-- intercalate :: [a] -> [[a]] -> [a]
-- intercalate :: String -> [String] -> String
on intercalate(sep, xs)
concat(intersperse(sep, xs))
end intercalate
-- intersperse(0, [1,2,3]) -> [1, 0, 2, 0, 3]
-- intersperse :: a -> [a] -> [a]
-- intersperse :: Char -> String -> String
on intersperse(sep, xs)
set lng to length of xs
if lng > 1 then
set acc to {item 1 of xs}
repeat with i from 2 to lng
set acc to acc & {sep, item i of xs}
end repeat
if class of xs is string then
concat(acc)
else
acc
end if
else
xs
end if
end intersperse
-- isNull :: [a] -> Bool
-- isNull :: String -> Bool
on isNull(xs)
if class of xs is string then
"" = xs
else
{} = xs
end if
end isNull
-- iterateUntil :: (a -> Bool) -> (a -> a) -> a -> [a]
on iterateUntil(p, f, x)
script
property mp : mReturn(p)'s |λ|
property mf : mReturn(f)'s |λ|
property lst : {x}
on |λ|(v)
repeat until mp(v)
set v to mf(v)
set end of lst to v
end repeat
return lst
end |λ|
end script
|λ|(x) of result
end iterateUntil
-- levels :: Tree a -> [[a]]
on levels(tree)
script nextLayer
on |λ|(xs)
script
on |λ|(x)
nest of x
end |λ|
end script
concatMap(result, xs)
end |λ|
end script
script roots
on |λ|(xs)
script
on |λ|(x)
root of x
end |λ|
end script
map(result, xs)
end |λ|
end script
map(roots, iterateUntil(my isNull, nextLayer, {tree}))
end levels
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
-- The list obtained by applying f
-- to each element of xs.
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
end map
-- maximum :: Ord a => [a] -> a
on maximum(xs)
script
on |λ|(a, b)
if a is missing value or b > a then
b
else
a
end if
end |λ|
end script
foldl(result, missing value, xs)
end maximum
-- mReturn :: First-class m => (a -> b) -> m (a -> b)
on mReturn(f)
-- 2nd class handler function lifted into 1st class script wrapper.
if script is class of f then
f
else
script
property |λ| : f
end script
end if
end mReturn
-- replicateString :: Int -> String -> String
on replicateString(n, s)
set out to ""
if n < 1 then return out
set dbl to s
repeat while (n > 1)
if (n mod 2) > 0 then set out to out & dbl
set n to (n div 2)
set dbl to (dbl & dbl)
end repeat
return out & dbl
end replicateString
-- snd :: (a, b) -> b
on snd(tpl)
if class of tpl is record then
|2| of tpl
else
item 2 of tpl
end if
end snd
-- splitAt :: Int -> [a] -> ([a], [a])
on splitAt(n, xs)
if n > 0 and n < length of xs then
if class of xs is text then
Tuple(items 1 thru n of xs as text, items (n + 1) thru -1 of xs as text)
else
Tuple(items 1 thru n of xs, items (n + 1) thru -1 of xs)
end if
else
if n < 1 then
Tuple({}, xs)
else
Tuple(xs, {})
end if
end if
end splitAt
-- tail :: [a] -> [a]
on tail(xs)
set blnText to text is class of xs
if blnText then
set unit to ""
else
set unit to {}
end if
set lng to length of xs
if 1 > lng then
missing value
else if 2 > lng then
unit
else
if blnText then
text 2 thru -1 of xs
else
rest of xs
end if
end if
end tail
-- unlines :: [String] -> String
on unlines(xs)
-- A single string formed by the intercalation
-- of a list of strings with the newline character.
set {dlm, my text item delimiters} to ¬
{my text item delimiters, linefeed}
set str to xs as text
set my text item delimiters to dlm
str
end unlines
|
Applications/Sublime-Text/open/open.applescript | looking-for-a-job/applescript-examples | 1 | 2317 | #!/usr/bin/osascript
tell application "Sublime Text 2"
#open {"/Users/user/git/2288960", "/Users/user/git/3889945"}
end tell
tell application "Sublime Text 2"
#open "/Users/user/git/2288960"
end tell
tell application "Finder"
set l to {}
repeat with s in (get selection)
set end of l to s as alias
end repeat
tell application "Sublime Text 2"
open l
end tell
end tell
|
oeis/072/A072223.asm | neoneye/loda-programs | 11 | 27204 | <gh_stars>10-100
; A072223: Decimal expansion of unimodal analog of golden section with respect to A072176: a=lim A072176(n)/A072176(n+1).
; Submitted by <NAME>
; 5,2,4,8,8,8,5,9,8,6,5,6,4,0,4,7,9,3,8,9,9,4,8,6,1,3,8,5,4,1,2,8,3,9,1,5,6,9,0,3,4,2,9,4,7,7,3,9,3,4,2,1,5,9,6,5,3,1,4,2,1,6,4,2,1,1,8,5,8,0,6,8,6,5,8,4,4,4,4,1,7,2,6,2,5,4,9,2,1,0,9,1,7,6,1,3,1,1,2
add $0,1
mov $3,$0
mul $3,4
lpb $3
add $1,$6
add $2,$1
sub $3,1
add $5,$2
sub $6,22
add $6,$5
lpe
cmp $2,$1
add $2,$5
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
adium/ASUnitTests/GetWindowName.applescript | sin-ivan/AdiumPipeEvent | 0 | 2264 | <reponame>sin-ivan/AdiumPipeEvent<filename>adium/ASUnitTests/GetWindowName.applescript
global HandyAdiumScripts
on run
tell application "Adium"
if (get name of window "Contacts") is not "Contacts" then
--this is actually indicative of complicated AS problem
--It will most likely involve changing the sdef so that
--the windows's pnam is set correctly
error
end
end tell
end run |
bc_antlr4/bc.g4 | malkiewiczm/bc_implementation | 0 | 750 | grammar bc;
@header {
import java.util.Map;
import java.util.TreeMap;
import java.util.Deque;
import java.util.LinkedList;
}
@members {
Map<String, Integer> functionNames = new TreeMap<>();
Deque<mJmp> breakJmp = new LinkedList<mJmp>();
Deque<mJmp> continueJmp = new LinkedList<mJmp>();
}
parseAll: statementList EOF
{ Program.ops.add(new mHalt()); }
;
statementList: statement* ;
block
: '{' statementList '}'
| statement
;
statement
: statementBase
| expr
{ Program.ops.add(new mPop()); }
;
statementSilent
: statementBase
| expr
{ Program.ops.add(new mPopSilent()); }
;
statementBase locals [mJmp jmp, mJz jz, mJmp jmpFor0, mJmp jmpFor1, mPush push]
: ';'
| ID '=' expr
{ Program.ops.add(new mStore($ID.text)); }
| 'if' '(' expr ')'
{ $jz = new mJz(-1); Program.ops.add($jz); }
block
{ $jz.val = Program.here(); }
(
'else'
{
$jmp = new mJmp(-1);
Program.ops.add($jmp);
++$jz.val;
}
block
{ $jmp.val = Program.here(); }
)?
|
{
$jmp = new mJmp(-1);
$jz = new mJz(-1);
$jmpFor0 = new mJmp(-1);
$jmpFor1 = new mJmp(-1);
}
/* A */
'for' '(' statementSilent? ';'
{
$jmpFor0.val = Program.here();
}
/* B */
expr? ';'
{
Program.ops.add($jz);
Program.ops.add($jmpFor1);
$jmp.val = Program.here();
breakJmp.push(new mJmp(-1));
continueJmp.push(new mJmp(Program.here()));
}
/* C */
statementSilent? ')'
{
Program.ops.add($jmpFor0);
$jmpFor1.val = Program.here();
}
block
{
Program.ops.add($jmp);
$jz.val = Program.here();
breakJmp.pop().val = Program.here();
continueJmp.pop();
}
| 'while'
{
$jmp = new mJmp(Program.here());
breakJmp.push(new mJmp(-1));
continueJmp.push(new mJmp(Program.here()));
}
'(' expr ')'
{
$jz = new mJz(-1);
Program.ops.add($jz);
}
block
{
Program.ops.add($jmp);
$jz.val = Program.here();
breakJmp.pop().val = Program.here();
continueJmp.pop();
}
|
{
$jmp = new mJmp(-1);
Program.ops.add($jmp);
}
'define' fname=ID '(' args+=ID? ( ',' args+=ID )* ')'
{
functionNames.put($fname.text, Program.here());
int expectedArgs = $args.size();
Program.ops.add(new mPushScope(expectedArgs));
for (int i = expectedArgs - 1; i >= 0; --i) {
Program.ops.add(new mStoreLocal($args.get(i).getText()));
}
}
block
{
Program.ops.add(new mPush(0.0));
Program.ops.add(new mReturn());
$jmp.val = Program.here();
}
| 'return' expr
{ Program.ops.add(new mReturn()); }
| 'return'
{
Program.ops.add(new mPush(0.0));
Program.ops.add(new mReturn());
}
| 'break'
{
Program.fatalIf(breakJmp.size() == 0, "called 'break' while not in a loop");
Program.ops.add(breakJmp.peek());
}
| 'continue'
{
Program.fatalIf(continueJmp.size() == 0, "called 'continue' while not in a loop");
Program.ops.add(continueJmp.peek());
}
| 'halt'
{ Program.ops.add(new mHalt()); }
| 'print'
{
$push = new mPush(-1);
Program.ops.add($push);
}
exprList
{
Program.ops.add(new mPrint());
$push.value = Program.here();
}
| 'print'
{
$push = new mPush(-1);
Program.ops.add($push);
}
'(' exprList ')'
{
Program.ops.add(new mPrint());
$push.value = Program.here();
}
;
expr locals [mPush push]
: op=('++' | '--') ID {
switch ($op.text) {
case "++":
Program.ops.add(new mPreInc($ID.text));
break;
default:
Program.ops.add(new mPreDec($ID.text));
}
}
| ID op=('++' | '--') {
switch ($op.text) {
case "++":
Program.ops.add(new mPostInc($ID.text));
break;
default:
Program.ops.add(new mPostDec($ID.text));
}
}
| '-' expr
{ Program.ops.add(new mNegate()); }
| expr '^' expr
{ Program.ops.add(new mExponent()); }
| expr op=('*' | '/' | '%') expr {
switch ($op.text) {
case "*":
Program.ops.add(new mMult());
break;
case "/":
Program.ops.add(new mDiv());
break;
default:
Program.ops.add(new mMod());
}
}
| expr op=('-' | '+') expr {
switch ($op.text) {
case "-":
Program.ops.add(new mSub());
break;
default:
Program.ops.add(new mAdd());
}
}
| expr op=('<' | '>' | '<=' | '>=' | '==' | '!=') expr {
switch ($op.text) {
case "<":
Program.ops.add(new mLt());
break;
case ">":
Program.ops.add(new mGt());
break;
case "<=":
Program.ops.add(new mLte());
break;
case ">=":
Program.ops.add(new mGte());
break;
case "==":
Program.ops.add(new mEq());
break;
default:
Program.ops.add(new mNeq());
}
}
| '!' expr
{ Program.ops.add(new mComplement()); }
| expr '&&' expr
{ Program.ops.add(new mAnd()); }
| expr '||' expr
{ Program.ops.add(new mOr()); }
| fname=ID
{
$push = new mPush(-1);
Program.ops.add($push);
}
'(' exprList ')'
{
Integer location = functionNames.get($fname.text);
if (location == null) {
Mne m = Program.getBuiltinCall($fname.text);
if (m == null) {
Program.fatal("function '" + $fname.text + "' does not exist");
}
Program.ops.add(m);
} else {
Program.ops.add(new mJmp(location));
}
$push.value = Program.here();
}
| '(' expr ')'
| FLOAT
{ Program.ops.add(new mPush(Double.parseDouble($FLOAT.text))); }
| ID
{ Program.ops.add(new mPushVar($ID.text)); }
;
exprList: args+=expr? (',' args+=expr)*
{
Program.ops.add(new mPush((double)$args.size()));
};
FLOAT
: '-'? Digit+ '.' Digit*
| '-'? '.' Digit+
| '-'? Digit+
;
fragment Digit: [0-9] ;
ID: [A-Za-z]+[A-Za-z0-9_]*;
WS : [ \r\n\t]+ -> skip ;
COMMENT : '/*' .*? '*/' -> skip ;
|
Ejemplos y Utilidades/ejemplos mikroC/ejemplo timer0/timer0.asm | DAFRELECTRONICS/ThunderBolt | 1 | 84415 | <gh_stars>1-10
_interrupt:
;timer0.c,7 :: void interrupt()
;timer0.c,9 :: if (INTCON.f2 == 1)
BTFSS INTCON+0, 2
GOTO L_interrupt0
;timer0.c,11 :: T0CON.f7 = 0;
BCF T0CON+0, 7
;timer0.c,12 :: INTCON.f2 = 0;
BCF INTCON+0, 2
;timer0.c,13 :: TMR0H = 0;
CLRF TMR0H+0
;timer0.c,14 :: TMR0L = 0;
CLRF TMR0L+0
;timer0.c,15 :: PORTC.f1 = !PORTC.f1;
BTG PORTC+0, 1
;timer0.c,16 :: T0CON.f7 = 1;
BSF T0CON+0, 7
;timer0.c,17 :: }
L_interrupt0:
;timer0.c,18 :: }
L_end_interrupt:
L__interrupt5:
RETFIE 1
; end of _interrupt
_main:
;timer0.c,23 :: void main()
;timer0.c,25 :: TRISA= 0b00000000;
CLRF TRISA+0
;timer0.c,26 :: TRISB= 0b00000000;
CLRF TRISB+0
;timer0.c,27 :: TRISC= 0b00000001;
MOVLW 1
MOVWF TRISC+0
;timer0.c,29 :: PORTA = 0;
CLRF PORTA+0
;timer0.c,30 :: PORTB = 0;
CLRF PORTB+0
;timer0.c,31 :: PORTC = 0;
CLRF PORTC+0
;timer0.c,33 :: T0CON = 0b00000001;
MOVLW 1
MOVWF T0CON+0
;timer0.c,34 :: TMR0H = 0x15;
MOVLW 21
MOVWF TMR0H+0
;timer0.c,35 :: TMR0L = 0xA0;
MOVLW 160
MOVWF TMR0L+0
;timer0.c,36 :: INTCON = 0b11100000;
MOVLW 224
MOVWF INTCON+0
;timer0.c,37 :: RCON.f7 = 0;
BCF RCON+0, 7
;timer0.c,38 :: T0CON.f7 = 1;
BSF T0CON+0, 7
;timer0.c,40 :: while(1)
L_main1:
;timer0.c,42 :: PORTC.f2 = !PORTC.f2;
BTG PORTC+0, 2
;timer0.c,43 :: delay_ms(500);
MOVLW 31
MOVWF R11, 0
MOVLW 113
MOVWF R12, 0
MOVLW 30
MOVWF R13, 0
L_main3:
DECFSZ R13, 1, 1
BRA L_main3
DECFSZ R12, 1, 1
BRA L_main3
DECFSZ R11, 1, 1
BRA L_main3
NOP
;timer0.c,44 :: }
GOTO L_main1
;timer0.c,45 :: }
L_end_main:
GOTO $+0
; end of _main
_bootInterrupt:
;timer0.c,47 :: void bootInterrupt() //tabla de saltos para poder activar interrupciones usando un bootloader, manda llamar interrupciones y al main segun correponda
;timer0.c,50 :: goto _main
GOTO _main+0
;timer0.c,51 :: goto 0
GOTO 0
;timer0.c,52 :: goto _interrupt
GOTO _interrupt+0
;timer0.c,54 :: }
L_end_bootInterrupt:
RETURN 0
; end of _bootInterrupt
|
addrs_xv6.asm | adrianna157/CS444-Lab5-Mutexes | 0 | 174336 | <gh_stars>0
_addrs_xv6: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
static int int_data = -1;
static const char str[] = "hello world";
int
main(int argc, char *argv[])
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 56 push %esi
4: 53 push %ebx
5: 83 e4 f0 and $0xfffffff0,%esp
8: 83 ec 20 sub $0x20,%esp
static int sdata = -2;
int x = 3;
char *ch1 = sbrk(0);
b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
int x = 3;
12: c7 44 24 1c 03 00 00 movl $0x3,0x1c(%esp)
19: 00
char *ch1 = sbrk(0);
1a: e8 5b 04 00 00 call 47a <sbrk>
char *ch2 = malloc(100);
1f: c7 04 24 64 00 00 00 movl $0x64,(%esp)
char *ch1 = sbrk(0);
26: 89 c3 mov %eax,%ebx
char *ch2 = malloc(100);
28: e8 23 08 00 00 call 850 <malloc>
char *ch3 = sbrk(0);
2d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
char *ch2 = malloc(100);
34: 89 c6 mov %eax,%esi
char *ch3 = sbrk(0);
36: e8 3f 04 00 00 call 47a <sbrk>
printf(1, "location of high water mark\t: %p\n", ch3);
3b: c7 44 24 04 ac 0b 00 movl $0xbac,0x4(%esp)
42: 00
43: c7 04 24 01 00 00 00 movl $0x1,(%esp)
4a: 89 44 24 08 mov %eax,0x8(%esp)
4e: e8 4d 05 00 00 call 5a0 <printf>
printf(1, "location of malloc 1\t\t: %p\n", ch2);
53: 89 74 24 08 mov %esi,0x8(%esp)
57: c7 44 24 04 30 0c 00 movl $0xc30,0x4(%esp)
5e: 00
5f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
66: e8 35 05 00 00 call 5a0 <printf>
printf(1, "location of malloc 2\t\t: %p\n", malloc(200));
6b: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
72: e8 d9 07 00 00 call 850 <malloc>
77: c7 44 24 04 4c 0c 00 movl $0xc4c,0x4(%esp)
7e: 00
7f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
86: 89 44 24 08 mov %eax,0x8(%esp)
8a: e8 11 05 00 00 call 5a0 <printf>
printf(1, "location of malloc 3\t\t: %p\n", malloc(300));
8f: c7 04 24 2c 01 00 00 movl $0x12c,(%esp)
96: e8 b5 07 00 00 call 850 <malloc>
9b: c7 44 24 04 68 0c 00 movl $0xc68,0x4(%esp)
a2: 00
a3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
aa: 89 44 24 08 mov %eax,0x8(%esp)
ae: e8 ed 04 00 00 call 5a0 <printf>
printf(1, "location of sbrk(0)\t\t: %p\n\n", ch1);
b3: 89 5c 24 08 mov %ebx,0x8(%esp)
b7: c7 44 24 04 84 0c 00 movl $0xc84,0x4(%esp)
be: 00
bf: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c6: e8 d5 04 00 00 call 5a0 <printf>
printf(1, "location of argv[0]\t\t: %p\n\n", &(argv[0]));
cb: 8b 45 0c mov 0xc(%ebp),%eax
ce: c7 44 24 04 a0 0c 00 movl $0xca0,0x4(%esp)
d5: 00
d6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
dd: 89 44 24 08 mov %eax,0x8(%esp)
e1: e8 ba 04 00 00 call 5a0 <printf>
printf(1, "location of stack\t\t: %p\n", &x);
e6: 8d 44 24 1c lea 0x1c(%esp),%eax
ea: 89 44 24 08 mov %eax,0x8(%esp)
ee: c7 44 24 04 bc 0c 00 movl $0xcbc,0x4(%esp)
f5: 00
f6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
fd: e8 9e 04 00 00 call 5a0 <printf>
printf(1, "location of argc\t\t: %p\n", &argc);
102: 8d 45 08 lea 0x8(%ebp),%eax
105: 89 44 24 08 mov %eax,0x8(%esp)
109: c7 44 24 04 d5 0c 00 movl $0xcd5,0x4(%esp)
110: 00
111: c7 04 24 01 00 00 00 movl $0x1,(%esp)
118: e8 83 04 00 00 call 5a0 <printf>
printf(1, "location of argv\t\t: %p\n", &argv);
11d: 8d 45 0c lea 0xc(%ebp),%eax
120: 89 44 24 08 mov %eax,0x8(%esp)
124: c7 44 24 04 ed 0c 00 movl $0xced,0x4(%esp)
12b: 00
12c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
133: e8 68 04 00 00 call 5a0 <printf>
printf(1, "location of uninitialized\t: %p\n", &unint_data);
138: c7 44 24 08 e0 11 00 movl $0x11e0,0x8(%esp)
13f: 00
140: c7 44 24 04 d0 0b 00 movl $0xbd0,0x4(%esp)
147: 00
148: c7 04 24 01 00 00 00 movl $0x1,(%esp)
14f: e8 4c 04 00 00 call 5a0 <printf>
printf(1, "location of initialized\t\t: %p\n", &int_data);
154: c7 44 24 08 dc 11 00 movl $0x11dc,0x8(%esp)
15b: 00
15c: c7 44 24 04 f0 0b 00 movl $0xbf0,0x4(%esp)
163: 00
164: c7 04 24 01 00 00 00 movl $0x1,(%esp)
16b: e8 30 04 00 00 call 5a0 <printf>
printf(1, "location of static data\t\t: %p\n", &sdata);
170: c7 44 24 08 d8 11 00 movl $0x11d8,0x8(%esp)
177: 00
178: c7 44 24 04 10 0c 00 movl $0xc10,0x4(%esp)
17f: 00
180: c7 04 24 01 00 00 00 movl $0x1,(%esp)
187: e8 14 04 00 00 call 5a0 <printf>
printf(1, "location of const str\t\t: %p\n", &str);
18c: c7 44 24 08 3b 0d 00 movl $0xd3b,0x8(%esp)
193: 00
194: c7 44 24 04 05 0d 00 movl $0xd05,0x4(%esp)
19b: 00
19c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1a3: e8 f8 03 00 00 call 5a0 <printf>
printf(1, "location of main\t\t: %p\n\n", main);
1a8: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
1af: 00
1b0: c7 44 24 04 22 0d 00 movl $0xd22,0x4(%esp)
1b7: 00
1b8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1bf: e8 dc 03 00 00 call 5a0 <printf>
exit();
1c4: e8 29 02 00 00 call 3f2 <exit>
1c9: 66 90 xchg %ax,%ax
1cb: 66 90 xchg %ax,%ax
1cd: 66 90 xchg %ax,%ax
1cf: 90 nop
000001d0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 8b 45 08 mov 0x8(%ebp),%eax
1d6: 8b 4d 0c mov 0xc(%ebp),%ecx
1d9: 53 push %ebx
char *os;
os = s;
while((*s++ = *t++) != 0)
1da: 89 c2 mov %eax,%edx
1dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1e0: 83 c1 01 add $0x1,%ecx
1e3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
1e7: 83 c2 01 add $0x1,%edx
1ea: 84 db test %bl,%bl
1ec: 88 5a ff mov %bl,-0x1(%edx)
1ef: 75 ef jne 1e0 <strcpy+0x10>
;
return os;
}
1f1: 5b pop %ebx
1f2: 5d pop %ebp
1f3: c3 ret
1f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000200 <strcmp>:
int
strcmp(const char *p, const char *q)
{
200: 55 push %ebp
201: 89 e5 mov %esp,%ebp
203: 8b 55 08 mov 0x8(%ebp),%edx
206: 53 push %ebx
207: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
20a: 0f b6 02 movzbl (%edx),%eax
20d: 84 c0 test %al,%al
20f: 74 2d je 23e <strcmp+0x3e>
211: 0f b6 19 movzbl (%ecx),%ebx
214: 38 d8 cmp %bl,%al
216: 74 0e je 226 <strcmp+0x26>
218: eb 2b jmp 245 <strcmp+0x45>
21a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
220: 38 c8 cmp %cl,%al
222: 75 15 jne 239 <strcmp+0x39>
p++, q++;
224: 89 d9 mov %ebx,%ecx
226: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
229: 0f b6 02 movzbl (%edx),%eax
p++, q++;
22c: 8d 59 01 lea 0x1(%ecx),%ebx
while(*p && *p == *q)
22f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx
233: 84 c0 test %al,%al
235: 75 e9 jne 220 <strcmp+0x20>
237: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
239: 29 c8 sub %ecx,%eax
}
23b: 5b pop %ebx
23c: 5d pop %ebp
23d: c3 ret
23e: 0f b6 09 movzbl (%ecx),%ecx
while(*p && *p == *q)
241: 31 c0 xor %eax,%eax
243: eb f4 jmp 239 <strcmp+0x39>
245: 0f b6 cb movzbl %bl,%ecx
248: eb ef jmp 239 <strcmp+0x39>
24a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000250 <strlen>:
uint
strlen(const char *s)
{
250: 55 push %ebp
251: 89 e5 mov %esp,%ebp
253: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
256: 80 39 00 cmpb $0x0,(%ecx)
259: 74 12 je 26d <strlen+0x1d>
25b: 31 d2 xor %edx,%edx
25d: 8d 76 00 lea 0x0(%esi),%esi
260: 83 c2 01 add $0x1,%edx
263: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
267: 89 d0 mov %edx,%eax
269: 75 f5 jne 260 <strlen+0x10>
;
return n;
}
26b: 5d pop %ebp
26c: c3 ret
for(n = 0; s[n]; n++)
26d: 31 c0 xor %eax,%eax
}
26f: 5d pop %ebp
270: c3 ret
271: eb 0d jmp 280 <memset>
273: 90 nop
274: 90 nop
275: 90 nop
276: 90 nop
277: 90 nop
278: 90 nop
279: 90 nop
27a: 90 nop
27b: 90 nop
27c: 90 nop
27d: 90 nop
27e: 90 nop
27f: 90 nop
00000280 <memset>:
void*
memset(void *dst, int c, uint n)
{
280: 55 push %ebp
281: 89 e5 mov %esp,%ebp
283: 8b 55 08 mov 0x8(%ebp),%edx
286: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
287: 8b 4d 10 mov 0x10(%ebp),%ecx
28a: 8b 45 0c mov 0xc(%ebp),%eax
28d: 89 d7 mov %edx,%edi
28f: fc cld
290: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
292: 89 d0 mov %edx,%eax
294: 5f pop %edi
295: 5d pop %ebp
296: c3 ret
297: 89 f6 mov %esi,%esi
299: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002a0 <strchr>:
char*
strchr(const char *s, char c)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 8b 45 08 mov 0x8(%ebp),%eax
2a6: 53 push %ebx
2a7: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
2aa: 0f b6 18 movzbl (%eax),%ebx
2ad: 84 db test %bl,%bl
2af: 74 1d je 2ce <strchr+0x2e>
if(*s == c)
2b1: 38 d3 cmp %dl,%bl
2b3: 89 d1 mov %edx,%ecx
2b5: 75 0d jne 2c4 <strchr+0x24>
2b7: eb 17 jmp 2d0 <strchr+0x30>
2b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2c0: 38 ca cmp %cl,%dl
2c2: 74 0c je 2d0 <strchr+0x30>
for(; *s; s++)
2c4: 83 c0 01 add $0x1,%eax
2c7: 0f b6 10 movzbl (%eax),%edx
2ca: 84 d2 test %dl,%dl
2cc: 75 f2 jne 2c0 <strchr+0x20>
return (char*)s;
return 0;
2ce: 31 c0 xor %eax,%eax
}
2d0: 5b pop %ebx
2d1: 5d pop %ebp
2d2: c3 ret
2d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002e0 <gets>:
char*
gets(char *buf, int max)
{
2e0: 55 push %ebp
2e1: 89 e5 mov %esp,%ebp
2e3: 57 push %edi
2e4: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
2e5: 31 f6 xor %esi,%esi
{
2e7: 53 push %ebx
2e8: 83 ec 2c sub $0x2c,%esp
cc = read(0, &c, 1);
2eb: 8d 7d e7 lea -0x19(%ebp),%edi
for(i=0; i+1 < max; ){
2ee: eb 31 jmp 321 <gets+0x41>
cc = read(0, &c, 1);
2f0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
2f7: 00
2f8: 89 7c 24 04 mov %edi,0x4(%esp)
2fc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
303: e8 02 01 00 00 call 40a <read>
if(cc < 1)
308: 85 c0 test %eax,%eax
30a: 7e 1d jle 329 <gets+0x49>
break;
buf[i++] = c;
30c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
for(i=0; i+1 < max; ){
310: 89 de mov %ebx,%esi
buf[i++] = c;
312: 8b 55 08 mov 0x8(%ebp),%edx
if(c == '\n' || c == '\r')
315: 3c 0d cmp $0xd,%al
buf[i++] = c;
317: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
31b: 74 0c je 329 <gets+0x49>
31d: 3c 0a cmp $0xa,%al
31f: 74 08 je 329 <gets+0x49>
for(i=0; i+1 < max; ){
321: 8d 5e 01 lea 0x1(%esi),%ebx
324: 3b 5d 0c cmp 0xc(%ebp),%ebx
327: 7c c7 jl 2f0 <gets+0x10>
break;
}
buf[i] = '\0';
329: 8b 45 08 mov 0x8(%ebp),%eax
32c: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
330: 83 c4 2c add $0x2c,%esp
333: 5b pop %ebx
334: 5e pop %esi
335: 5f pop %edi
336: 5d pop %ebp
337: c3 ret
338: 90 nop
339: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000340 <stat>:
int
stat(const char *n, struct stat *st)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 56 push %esi
344: 53 push %ebx
345: 83 ec 10 sub $0x10,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
348: 8b 45 08 mov 0x8(%ebp),%eax
34b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
352: 00
353: 89 04 24 mov %eax,(%esp)
356: e8 d7 00 00 00 call 432 <open>
if(fd < 0)
35b: 85 c0 test %eax,%eax
fd = open(n, O_RDONLY);
35d: 89 c3 mov %eax,%ebx
if(fd < 0)
35f: 78 27 js 388 <stat+0x48>
return -1;
r = fstat(fd, st);
361: 8b 45 0c mov 0xc(%ebp),%eax
364: 89 1c 24 mov %ebx,(%esp)
367: 89 44 24 04 mov %eax,0x4(%esp)
36b: e8 da 00 00 00 call 44a <fstat>
close(fd);
370: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
373: 89 c6 mov %eax,%esi
close(fd);
375: e8 a0 00 00 00 call 41a <close>
return r;
37a: 89 f0 mov %esi,%eax
}
37c: 83 c4 10 add $0x10,%esp
37f: 5b pop %ebx
380: 5e pop %esi
381: 5d pop %ebp
382: c3 ret
383: 90 nop
384: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
388: b8 ff ff ff ff mov $0xffffffff,%eax
38d: eb ed jmp 37c <stat+0x3c>
38f: 90 nop
00000390 <atoi>:
int
atoi(const char *s)
{
390: 55 push %ebp
391: 89 e5 mov %esp,%ebp
393: 8b 4d 08 mov 0x8(%ebp),%ecx
396: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
397: 0f be 11 movsbl (%ecx),%edx
39a: 8d 42 d0 lea -0x30(%edx),%eax
39d: 3c 09 cmp $0x9,%al
n = 0;
39f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
3a4: 77 17 ja 3bd <atoi+0x2d>
3a6: 66 90 xchg %ax,%ax
n = n*10 + *s++ - '0';
3a8: 83 c1 01 add $0x1,%ecx
3ab: 8d 04 80 lea (%eax,%eax,4),%eax
3ae: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
3b2: 0f be 11 movsbl (%ecx),%edx
3b5: 8d 5a d0 lea -0x30(%edx),%ebx
3b8: 80 fb 09 cmp $0x9,%bl
3bb: 76 eb jbe 3a8 <atoi+0x18>
return n;
}
3bd: 5b pop %ebx
3be: 5d pop %ebp
3bf: c3 ret
000003c0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
3c0: 55 push %ebp
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3c1: 31 d2 xor %edx,%edx
{
3c3: 89 e5 mov %esp,%ebp
3c5: 56 push %esi
3c6: 8b 45 08 mov 0x8(%ebp),%eax
3c9: 53 push %ebx
3ca: 8b 5d 10 mov 0x10(%ebp),%ebx
3cd: 8b 75 0c mov 0xc(%ebp),%esi
while(n-- > 0)
3d0: 85 db test %ebx,%ebx
3d2: 7e 12 jle 3e6 <memmove+0x26>
3d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
3d8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
3dc: 88 0c 10 mov %cl,(%eax,%edx,1)
3df: 83 c2 01 add $0x1,%edx
while(n-- > 0)
3e2: 39 da cmp %ebx,%edx
3e4: 75 f2 jne 3d8 <memmove+0x18>
return vdst;
}
3e6: 5b pop %ebx
3e7: 5e pop %esi
3e8: 5d pop %ebp
3e9: c3 ret
000003ea <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3ea: b8 01 00 00 00 mov $0x1,%eax
3ef: cd 40 int $0x40
3f1: c3 ret
000003f2 <exit>:
SYSCALL(exit)
3f2: b8 02 00 00 00 mov $0x2,%eax
3f7: cd 40 int $0x40
3f9: c3 ret
000003fa <wait>:
SYSCALL(wait)
3fa: b8 03 00 00 00 mov $0x3,%eax
3ff: cd 40 int $0x40
401: c3 ret
00000402 <pipe>:
SYSCALL(pipe)
402: b8 04 00 00 00 mov $0x4,%eax
407: cd 40 int $0x40
409: c3 ret
0000040a <read>:
SYSCALL(read)
40a: b8 05 00 00 00 mov $0x5,%eax
40f: cd 40 int $0x40
411: c3 ret
00000412 <write>:
SYSCALL(write)
412: b8 10 00 00 00 mov $0x10,%eax
417: cd 40 int $0x40
419: c3 ret
0000041a <close>:
SYSCALL(close)
41a: b8 15 00 00 00 mov $0x15,%eax
41f: cd 40 int $0x40
421: c3 ret
00000422 <kill>:
SYSCALL(kill)
422: b8 06 00 00 00 mov $0x6,%eax
427: cd 40 int $0x40
429: c3 ret
0000042a <exec>:
SYSCALL(exec)
42a: b8 07 00 00 00 mov $0x7,%eax
42f: cd 40 int $0x40
431: c3 ret
00000432 <open>:
SYSCALL(open)
432: b8 0f 00 00 00 mov $0xf,%eax
437: cd 40 int $0x40
439: c3 ret
0000043a <mknod>:
SYSCALL(mknod)
43a: b8 11 00 00 00 mov $0x11,%eax
43f: cd 40 int $0x40
441: c3 ret
00000442 <unlink>:
SYSCALL(unlink)
442: b8 12 00 00 00 mov $0x12,%eax
447: cd 40 int $0x40
449: c3 ret
0000044a <fstat>:
SYSCALL(fstat)
44a: b8 08 00 00 00 mov $0x8,%eax
44f: cd 40 int $0x40
451: c3 ret
00000452 <link>:
SYSCALL(link)
452: b8 13 00 00 00 mov $0x13,%eax
457: cd 40 int $0x40
459: c3 ret
0000045a <mkdir>:
SYSCALL(mkdir)
45a: b8 14 00 00 00 mov $0x14,%eax
45f: cd 40 int $0x40
461: c3 ret
00000462 <chdir>:
SYSCALL(chdir)
462: b8 09 00 00 00 mov $0x9,%eax
467: cd 40 int $0x40
469: c3 ret
0000046a <dup>:
SYSCALL(dup)
46a: b8 0a 00 00 00 mov $0xa,%eax
46f: cd 40 int $0x40
471: c3 ret
00000472 <getpid>:
SYSCALL(getpid)
472: b8 0b 00 00 00 mov $0xb,%eax
477: cd 40 int $0x40
479: c3 ret
0000047a <sbrk>:
SYSCALL(sbrk)
47a: b8 0c 00 00 00 mov $0xc,%eax
47f: cd 40 int $0x40
481: c3 ret
00000482 <sleep>:
SYSCALL(sleep)
482: b8 0d 00 00 00 mov $0xd,%eax
487: cd 40 int $0x40
489: c3 ret
0000048a <uptime>:
SYSCALL(uptime)
48a: b8 0e 00 00 00 mov $0xe,%eax
48f: cd 40 int $0x40
491: c3 ret
00000492 <getppid>:
#ifdef GETPPID
SYSCALL(getppid)
492: b8 16 00 00 00 mov $0x16,%eax
497: cd 40 int $0x40
499: c3 ret
0000049a <cps>:
#endif // GETPPID
#ifdef CPS
SYSCALL(cps)
49a: b8 17 00 00 00 mov $0x17,%eax
49f: cd 40 int $0x40
4a1: c3 ret
000004a2 <halt>:
#endif // CPS
#ifdef HALT
SYSCALL(halt)
4a2: b8 18 00 00 00 mov $0x18,%eax
4a7: cd 40 int $0x40
4a9: c3 ret
000004aa <kdebug>:
#endif // HALT
#ifdef KDEBUG
SYSCALL(kdebug)
4aa: b8 19 00 00 00 mov $0x19,%eax
4af: cd 40 int $0x40
4b1: c3 ret
000004b2 <va2pa>:
#endif // KDEBUG
#ifdef VA2PA
SYSCALL(va2pa)
4b2: b8 1a 00 00 00 mov $0x1a,%eax
4b7: cd 40 int $0x40
4b9: c3 ret
000004ba <kthread_create>:
#endif // VA2PA
#ifdef KTHREADS
SYSCALL(kthread_create)
4ba: b8 1b 00 00 00 mov $0x1b,%eax
4bf: cd 40 int $0x40
4c1: c3 ret
000004c2 <kthread_join>:
SYSCALL(kthread_join)
4c2: b8 1c 00 00 00 mov $0x1c,%eax
4c7: cd 40 int $0x40
4c9: c3 ret
000004ca <kthread_exit>:
SYSCALL(kthread_exit)
4ca: b8 1d 00 00 00 mov $0x1d,%eax
4cf: cd 40 int $0x40
4d1: c3 ret
000004d2 <kthread_self>:
#endif // KTHREADS
#ifdef BENNY_MOOTEX
SYSCALL(kthread_self)
4d2: b8 1e 00 00 00 mov $0x1e,%eax
4d7: cd 40 int $0x40
4d9: c3 ret
000004da <kthread_yield>:
SYSCALL(kthread_yield)
4da: b8 1f 00 00 00 mov $0x1f,%eax
4df: cd 40 int $0x40
4e1: c3 ret
000004e2 <kthread_cpu_count>:
SYSCALL(kthread_cpu_count)
4e2: b8 20 00 00 00 mov $0x20,%eax
4e7: cd 40 int $0x40
4e9: c3 ret
000004ea <kthread_thread_count>:
SYSCALL(kthread_thread_count)
4ea: b8 21 00 00 00 mov $0x21,%eax
4ef: cd 40 int $0x40
4f1: c3 ret
4f2: 66 90 xchg %ax,%ax
4f4: 66 90 xchg %ax,%ax
4f6: 66 90 xchg %ax,%ax
4f8: 66 90 xchg %ax,%ax
4fa: 66 90 xchg %ax,%ax
4fc: 66 90 xchg %ax,%ax
4fe: 66 90 xchg %ax,%ax
00000500 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
500: 55 push %ebp
501: 89 e5 mov %esp,%ebp
503: 57 push %edi
504: 56 push %esi
505: 89 c6 mov %eax,%esi
507: 53 push %ebx
508: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
50b: 8b 5d 08 mov 0x8(%ebp),%ebx
50e: 85 db test %ebx,%ebx
510: 74 09 je 51b <printint+0x1b>
512: 89 d0 mov %edx,%eax
514: c1 e8 1f shr $0x1f,%eax
517: 84 c0 test %al,%al
519: 75 75 jne 590 <printint+0x90>
neg = 1;
x = -xx;
} else {
x = xx;
51b: 89 d0 mov %edx,%eax
neg = 0;
51d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
524: 89 75 c0 mov %esi,-0x40(%ebp)
}
i = 0;
527: 31 ff xor %edi,%edi
529: 89 ce mov %ecx,%esi
52b: 8d 5d d7 lea -0x29(%ebp),%ebx
52e: eb 02 jmp 532 <printint+0x32>
do{
buf[i++] = digits[x % base];
530: 89 cf mov %ecx,%edi
532: 31 d2 xor %edx,%edx
534: f7 f6 div %esi
536: 8d 4f 01 lea 0x1(%edi),%ecx
539: 0f b6 92 4e 0d 00 00 movzbl 0xd4e(%edx),%edx
}while((x /= base) != 0);
540: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
542: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
545: 75 e9 jne 530 <printint+0x30>
if(neg)
547: 8b 55 c4 mov -0x3c(%ebp),%edx
buf[i++] = digits[x % base];
54a: 89 c8 mov %ecx,%eax
54c: 8b 75 c0 mov -0x40(%ebp),%esi
if(neg)
54f: 85 d2 test %edx,%edx
551: 74 08 je 55b <printint+0x5b>
buf[i++] = '-';
553: 8d 4f 02 lea 0x2(%edi),%ecx
556: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
while(--i >= 0)
55b: 8d 79 ff lea -0x1(%ecx),%edi
55e: 66 90 xchg %ax,%ax
560: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
565: 83 ef 01 sub $0x1,%edi
write(fd, &c, 1);
568: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
56f: 00
570: 89 5c 24 04 mov %ebx,0x4(%esp)
574: 89 34 24 mov %esi,(%esp)
577: 88 45 d7 mov %al,-0x29(%ebp)
57a: e8 93 fe ff ff call 412 <write>
while(--i >= 0)
57f: 83 ff ff cmp $0xffffffff,%edi
582: 75 dc jne 560 <printint+0x60>
putc(fd, buf[i]);
}
584: 83 c4 4c add $0x4c,%esp
587: 5b pop %ebx
588: 5e pop %esi
589: 5f pop %edi
58a: 5d pop %ebp
58b: c3 ret
58c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
x = -xx;
590: 89 d0 mov %edx,%eax
592: f7 d8 neg %eax
neg = 1;
594: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
59b: eb 87 jmp 524 <printint+0x24>
59d: 8d 76 00 lea 0x0(%esi),%esi
000005a0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
5a0: 55 push %ebp
5a1: 89 e5 mov %esp,%ebp
5a3: 57 push %edi
char *s;
int c, i, state;
uint *ap;
state = 0;
5a4: 31 ff xor %edi,%edi
{
5a6: 56 push %esi
5a7: 53 push %ebx
5a8: 83 ec 3c sub $0x3c,%esp
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5ab: 8b 5d 0c mov 0xc(%ebp),%ebx
ap = (uint*)(void*)&fmt + 1;
5ae: 8d 45 10 lea 0x10(%ebp),%eax
{
5b1: 8b 75 08 mov 0x8(%ebp),%esi
ap = (uint*)(void*)&fmt + 1;
5b4: 89 45 d4 mov %eax,-0x2c(%ebp)
for(i = 0; fmt[i]; i++){
5b7: 0f b6 13 movzbl (%ebx),%edx
5ba: 83 c3 01 add $0x1,%ebx
5bd: 84 d2 test %dl,%dl
5bf: 75 39 jne 5fa <printf+0x5a>
5c1: e9 ca 00 00 00 jmp 690 <printf+0xf0>
5c6: 66 90 xchg %ax,%ax
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
5c8: 83 fa 25 cmp $0x25,%edx
5cb: 0f 84 c7 00 00 00 je 698 <printf+0xf8>
write(fd, &c, 1);
5d1: 8d 45 e0 lea -0x20(%ebp),%eax
5d4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
5db: 00
5dc: 89 44 24 04 mov %eax,0x4(%esp)
5e0: 89 34 24 mov %esi,(%esp)
state = '%';
} else {
putc(fd, c);
5e3: 88 55 e0 mov %dl,-0x20(%ebp)
write(fd, &c, 1);
5e6: e8 27 fe ff ff call 412 <write>
5eb: 83 c3 01 add $0x1,%ebx
for(i = 0; fmt[i]; i++){
5ee: 0f b6 53 ff movzbl -0x1(%ebx),%edx
5f2: 84 d2 test %dl,%dl
5f4: 0f 84 96 00 00 00 je 690 <printf+0xf0>
if(state == 0){
5fa: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
5fc: 0f be c2 movsbl %dl,%eax
if(state == 0){
5ff: 74 c7 je 5c8 <printf+0x28>
}
} else if(state == '%'){
601: 83 ff 25 cmp $0x25,%edi
604: 75 e5 jne 5eb <printf+0x4b>
if(c == 'd' || c == 'u'){
606: 83 fa 75 cmp $0x75,%edx
609: 0f 84 99 00 00 00 je 6a8 <printf+0x108>
60f: 83 fa 64 cmp $0x64,%edx
612: 0f 84 90 00 00 00 je 6a8 <printf+0x108>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
618: 25 f7 00 00 00 and $0xf7,%eax
61d: 83 f8 70 cmp $0x70,%eax
620: 0f 84 aa 00 00 00 je 6d0 <printf+0x130>
putc(fd, '0');
putc(fd, 'x');
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
626: 83 fa 73 cmp $0x73,%edx
629: 0f 84 e9 00 00 00 je 718 <printf+0x178>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
62f: 83 fa 63 cmp $0x63,%edx
632: 0f 84 2b 01 00 00 je 763 <printf+0x1c3>
putc(fd, *ap);
ap++;
} else if(c == '%'){
638: 83 fa 25 cmp $0x25,%edx
63b: 0f 84 4f 01 00 00 je 790 <printf+0x1f0>
write(fd, &c, 1);
641: 8d 45 e6 lea -0x1a(%ebp),%eax
644: 83 c3 01 add $0x1,%ebx
647: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
64e: 00
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
64f: 31 ff xor %edi,%edi
write(fd, &c, 1);
651: 89 44 24 04 mov %eax,0x4(%esp)
655: 89 34 24 mov %esi,(%esp)
658: 89 55 d0 mov %edx,-0x30(%ebp)
65b: c6 45 e6 25 movb $0x25,-0x1a(%ebp)
65f: e8 ae fd ff ff call 412 <write>
putc(fd, c);
664: 8b 55 d0 mov -0x30(%ebp),%edx
write(fd, &c, 1);
667: 8d 45 e7 lea -0x19(%ebp),%eax
66a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
671: 00
672: 89 44 24 04 mov %eax,0x4(%esp)
676: 89 34 24 mov %esi,(%esp)
putc(fd, c);
679: 88 55 e7 mov %dl,-0x19(%ebp)
write(fd, &c, 1);
67c: e8 91 fd ff ff call 412 <write>
for(i = 0; fmt[i]; i++){
681: 0f b6 53 ff movzbl -0x1(%ebx),%edx
685: 84 d2 test %dl,%dl
687: 0f 85 6d ff ff ff jne 5fa <printf+0x5a>
68d: 8d 76 00 lea 0x0(%esi),%esi
}
}
}
690: 83 c4 3c add $0x3c,%esp
693: 5b pop %ebx
694: 5e pop %esi
695: 5f pop %edi
696: 5d pop %ebp
697: c3 ret
state = '%';
698: bf 25 00 00 00 mov $0x25,%edi
69d: e9 49 ff ff ff jmp 5eb <printf+0x4b>
6a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 10, 1);
6a8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6af: b9 0a 00 00 00 mov $0xa,%ecx
printint(fd, *ap, 16, 0);
6b4: 8b 45 d4 mov -0x2c(%ebp),%eax
state = 0;
6b7: 31 ff xor %edi,%edi
printint(fd, *ap, 16, 0);
6b9: 8b 10 mov (%eax),%edx
6bb: 89 f0 mov %esi,%eax
6bd: e8 3e fe ff ff call 500 <printint>
ap++;
6c2: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
6c6: e9 20 ff ff ff jmp 5eb <printf+0x4b>
6cb: 90 nop
6cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
write(fd, &c, 1);
6d0: 8d 45 e1 lea -0x1f(%ebp),%eax
6d3: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
6da: 00
6db: 89 44 24 04 mov %eax,0x4(%esp)
6df: 89 34 24 mov %esi,(%esp)
6e2: c6 45 e1 30 movb $0x30,-0x1f(%ebp)
6e6: e8 27 fd ff ff call 412 <write>
6eb: 8d 45 e2 lea -0x1e(%ebp),%eax
6ee: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
6f5: 00
6f6: 89 44 24 04 mov %eax,0x4(%esp)
6fa: 89 34 24 mov %esi,(%esp)
6fd: c6 45 e2 78 movb $0x78,-0x1e(%ebp)
701: e8 0c fd ff ff call 412 <write>
printint(fd, *ap, 16, 0);
706: b9 10 00 00 00 mov $0x10,%ecx
70b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
712: eb a0 jmp 6b4 <printf+0x114>
714: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
718: 8b 45 d4 mov -0x2c(%ebp),%eax
ap++;
71b: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
s = (char*)*ap;
71f: 8b 38 mov (%eax),%edi
s = "(null)";
721: b8 47 0d 00 00 mov $0xd47,%eax
726: 85 ff test %edi,%edi
728: 0f 44 f8 cmove %eax,%edi
while(*s != 0){
72b: 0f b6 07 movzbl (%edi),%eax
72e: 84 c0 test %al,%al
730: 74 2a je 75c <printf+0x1bc>
732: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
738: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
73b: 8d 45 e3 lea -0x1d(%ebp),%eax
s++;
73e: 83 c7 01 add $0x1,%edi
write(fd, &c, 1);
741: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
748: 00
749: 89 44 24 04 mov %eax,0x4(%esp)
74d: 89 34 24 mov %esi,(%esp)
750: e8 bd fc ff ff call 412 <write>
while(*s != 0){
755: 0f b6 07 movzbl (%edi),%eax
758: 84 c0 test %al,%al
75a: 75 dc jne 738 <printf+0x198>
state = 0;
75c: 31 ff xor %edi,%edi
75e: e9 88 fe ff ff jmp 5eb <printf+0x4b>
putc(fd, *ap);
763: 8b 45 d4 mov -0x2c(%ebp),%eax
state = 0;
766: 31 ff xor %edi,%edi
putc(fd, *ap);
768: 8b 00 mov (%eax),%eax
write(fd, &c, 1);
76a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
771: 00
772: 89 34 24 mov %esi,(%esp)
putc(fd, *ap);
775: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
778: 8d 45 e4 lea -0x1c(%ebp),%eax
77b: 89 44 24 04 mov %eax,0x4(%esp)
77f: e8 8e fc ff ff call 412 <write>
ap++;
784: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
788: e9 5e fe ff ff jmp 5eb <printf+0x4b>
78d: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
790: 8d 45 e5 lea -0x1b(%ebp),%eax
state = 0;
793: 31 ff xor %edi,%edi
write(fd, &c, 1);
795: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
79c: 00
79d: 89 44 24 04 mov %eax,0x4(%esp)
7a1: 89 34 24 mov %esi,(%esp)
7a4: c6 45 e5 25 movb $0x25,-0x1b(%ebp)
7a8: e8 65 fc ff ff call 412 <write>
7ad: e9 39 fe ff ff jmp 5eb <printf+0x4b>
7b2: 66 90 xchg %ax,%ax
7b4: 66 90 xchg %ax,%ax
7b6: 66 90 xchg %ax,%ax
7b8: 66 90 xchg %ax,%ax
7ba: 66 90 xchg %ax,%ax
7bc: 66 90 xchg %ax,%ax
7be: 66 90 xchg %ax,%ax
000007c0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
7c0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7c1: a1 e4 11 00 00 mov 0x11e4,%eax
{
7c6: 89 e5 mov %esp,%ebp
7c8: 57 push %edi
7c9: 56 push %esi
7ca: 53 push %ebx
7cb: 8b 5d 08 mov 0x8(%ebp),%ebx
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7ce: 8b 08 mov (%eax),%ecx
bp = (Header*)ap - 1;
7d0: 8d 53 f8 lea -0x8(%ebx),%edx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7d3: 39 d0 cmp %edx,%eax
7d5: 72 11 jb 7e8 <free+0x28>
7d7: 90 nop
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7d8: 39 c8 cmp %ecx,%eax
7da: 72 04 jb 7e0 <free+0x20>
7dc: 39 ca cmp %ecx,%edx
7de: 72 10 jb 7f0 <free+0x30>
7e0: 89 c8 mov %ecx,%eax
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7e2: 39 d0 cmp %edx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7e4: 8b 08 mov (%eax),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7e6: 73 f0 jae 7d8 <free+0x18>
7e8: 39 ca cmp %ecx,%edx
7ea: 72 04 jb 7f0 <free+0x30>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7ec: 39 c8 cmp %ecx,%eax
7ee: 72 f0 jb 7e0 <free+0x20>
break;
if(bp + bp->s.size == p->s.ptr){
7f0: 8b 73 fc mov -0x4(%ebx),%esi
7f3: 8d 3c f2 lea (%edx,%esi,8),%edi
7f6: 39 cf cmp %ecx,%edi
7f8: 74 1e je 818 <free+0x58>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
7fa: 89 4b f8 mov %ecx,-0x8(%ebx)
if(p + p->s.size == bp){
7fd: 8b 48 04 mov 0x4(%eax),%ecx
800: 8d 34 c8 lea (%eax,%ecx,8),%esi
803: 39 f2 cmp %esi,%edx
805: 74 28 je 82f <free+0x6f>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
807: 89 10 mov %edx,(%eax)
freep = p;
809: a3 e4 11 00 00 mov %eax,0x11e4
}
80e: 5b pop %ebx
80f: 5e pop %esi
810: 5f pop %edi
811: 5d pop %ebp
812: c3 ret
813: 90 nop
814: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
818: 03 71 04 add 0x4(%ecx),%esi
81b: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
81e: 8b 08 mov (%eax),%ecx
820: 8b 09 mov (%ecx),%ecx
822: 89 4b f8 mov %ecx,-0x8(%ebx)
if(p + p->s.size == bp){
825: 8b 48 04 mov 0x4(%eax),%ecx
828: 8d 34 c8 lea (%eax,%ecx,8),%esi
82b: 39 f2 cmp %esi,%edx
82d: 75 d8 jne 807 <free+0x47>
p->s.size += bp->s.size;
82f: 03 4b fc add -0x4(%ebx),%ecx
freep = p;
832: a3 e4 11 00 00 mov %eax,0x11e4
p->s.size += bp->s.size;
837: 89 48 04 mov %ecx,0x4(%eax)
p->s.ptr = bp->s.ptr;
83a: 8b 53 f8 mov -0x8(%ebx),%edx
83d: 89 10 mov %edx,(%eax)
}
83f: 5b pop %ebx
840: 5e pop %esi
841: 5f pop %edi
842: 5d pop %ebp
843: c3 ret
844: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
84a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000850 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
850: 55 push %ebp
851: 89 e5 mov %esp,%ebp
853: 57 push %edi
854: 56 push %esi
855: 53 push %ebx
856: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
859: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
85c: 8b 1d e4 11 00 00 mov 0x11e4,%ebx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
862: 8d 48 07 lea 0x7(%eax),%ecx
865: c1 e9 03 shr $0x3,%ecx
if((prevp = freep) == 0){
868: 85 db test %ebx,%ebx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
86a: 8d 71 01 lea 0x1(%ecx),%esi
if((prevp = freep) == 0){
86d: 0f 84 9b 00 00 00 je 90e <malloc+0xbe>
873: 8b 13 mov (%ebx),%edx
875: 8b 7a 04 mov 0x4(%edx),%edi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
878: 39 fe cmp %edi,%esi
87a: 76 64 jbe 8e0 <malloc+0x90>
87c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax
if(nu < 4096)
883: bb 00 80 00 00 mov $0x8000,%ebx
888: 89 45 e4 mov %eax,-0x1c(%ebp)
88b: eb 0e jmp 89b <malloc+0x4b>
88d: 8d 76 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
890: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
892: 8b 78 04 mov 0x4(%eax),%edi
895: 39 fe cmp %edi,%esi
897: 76 4f jbe 8e8 <malloc+0x98>
899: 89 c2 mov %eax,%edx
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
89b: 3b 15 e4 11 00 00 cmp 0x11e4,%edx
8a1: 75 ed jne 890 <malloc+0x40>
if(nu < 4096)
8a3: 8b 45 e4 mov -0x1c(%ebp),%eax
8a6: 81 fe 00 10 00 00 cmp $0x1000,%esi
8ac: bf 00 10 00 00 mov $0x1000,%edi
8b1: 0f 43 fe cmovae %esi,%edi
8b4: 0f 42 c3 cmovb %ebx,%eax
p = sbrk(nu * sizeof(Header));
8b7: 89 04 24 mov %eax,(%esp)
8ba: e8 bb fb ff ff call 47a <sbrk>
if(p == (char*)-1)
8bf: 83 f8 ff cmp $0xffffffff,%eax
8c2: 74 18 je 8dc <malloc+0x8c>
hp->s.size = nu;
8c4: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
8c7: 83 c0 08 add $0x8,%eax
8ca: 89 04 24 mov %eax,(%esp)
8cd: e8 ee fe ff ff call 7c0 <free>
return freep;
8d2: 8b 15 e4 11 00 00 mov 0x11e4,%edx
if((p = morecore(nunits)) == 0)
8d8: 85 d2 test %edx,%edx
8da: 75 b4 jne 890 <malloc+0x40>
return 0;
8dc: 31 c0 xor %eax,%eax
8de: eb 20 jmp 900 <malloc+0xb0>
if(p->s.size >= nunits){
8e0: 89 d0 mov %edx,%eax
8e2: 89 da mov %ebx,%edx
8e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
8e8: 39 fe cmp %edi,%esi
8ea: 74 1c je 908 <malloc+0xb8>
p->s.size -= nunits;
8ec: 29 f7 sub %esi,%edi
8ee: 89 78 04 mov %edi,0x4(%eax)
p += p->s.size;
8f1: 8d 04 f8 lea (%eax,%edi,8),%eax
p->s.size = nunits;
8f4: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
8f7: 89 15 e4 11 00 00 mov %edx,0x11e4
return (void*)(p + 1);
8fd: 83 c0 08 add $0x8,%eax
}
}
900: 83 c4 1c add $0x1c,%esp
903: 5b pop %ebx
904: 5e pop %esi
905: 5f pop %edi
906: 5d pop %ebp
907: c3 ret
prevp->s.ptr = p->s.ptr;
908: 8b 08 mov (%eax),%ecx
90a: 89 0a mov %ecx,(%edx)
90c: eb e9 jmp 8f7 <malloc+0xa7>
base.s.ptr = freep = prevp = &base;
90e: c7 05 e4 11 00 00 e8 movl $0x11e8,0x11e4
915: 11 00 00
base.s.size = 0;
918: ba e8 11 00 00 mov $0x11e8,%edx
base.s.ptr = freep = prevp = &base;
91d: c7 05 e8 11 00 00 e8 movl $0x11e8,0x11e8
924: 11 00 00
base.s.size = 0;
927: c7 05 ec 11 00 00 00 movl $0x0,0x11ec
92e: 00 00 00
931: e9 46 ff ff ff jmp 87c <malloc+0x2c>
936: 66 90 xchg %ax,%ax
938: 66 90 xchg %ax,%ax
93a: 66 90 xchg %ax,%ax
93c: 66 90 xchg %ax,%ax
93e: 66 90 xchg %ax,%ax
00000940 <benny_thread_create>:
static struct benny_thread_s *bt_new(void);
int
benny_thread_create(benny_thread_t *abt, void (*func)(void*), void *arg_ptr)
{
940: 55 push %ebp
941: 89 e5 mov %esp,%ebp
943: 56 push %esi
944: 53 push %ebx
945: 83 ec 10 sub $0x10,%esp
}
static struct benny_thread_s *
bt_new(void)
{
struct benny_thread_s *bt = malloc(sizeof(struct benny_thread_s));
948: c7 04 24 0c 00 00 00 movl $0xc,(%esp)
94f: e8 fc fe ff ff call 850 <malloc>
if (bt == NULL) {
954: 85 c0 test %eax,%eax
struct benny_thread_s *bt = malloc(sizeof(struct benny_thread_s));
956: 89 c6 mov %eax,%esi
if (bt == NULL) {
958: 74 66 je 9c0 <benny_thread_create+0x80>
// allocate 2 pages worth of memory and then make sure the
// beginning address used for the stack is page alligned.
// we want it page alligned so that we don't generate a
// page fault by accessing the stack for a thread.
bt->bt_stack = bt->mem_stack = malloc(PGSIZE * 2);
95a: c7 04 24 00 20 00 00 movl $0x2000,(%esp)
961: e8 ea fe ff ff call 850 <malloc>
if (bt->bt_stack == NULL) {
966: 85 c0 test %eax,%eax
bt->bt_stack = bt->mem_stack = malloc(PGSIZE * 2);
968: 89 c3 mov %eax,%ebx
96a: 89 46 08 mov %eax,0x8(%esi)
96d: 89 46 04 mov %eax,0x4(%esi)
if (bt->bt_stack == NULL) {
970: 74 5d je 9cf <benny_thread_create+0x8f>
free(bt);
return NULL;
}
if (((uint) bt->bt_stack) % PGSIZE != 0) {
972: 25 ff 0f 00 00 and $0xfff,%eax
977: 75 37 jne 9b0 <benny_thread_create+0x70>
// allign the thread stack to a page boundary
bt->bt_stack += (PGSIZE - ((uint) bt->bt_stack) % PGSIZE);
}
bt->bid = -1;
979: c7 06 ff ff ff ff movl $0xffffffff,(%esi)
bt->bid = kthread_create(func, arg_ptr, bt->bt_stack);
97f: 8b 45 10 mov 0x10(%ebp),%eax
982: 89 5c 24 08 mov %ebx,0x8(%esp)
986: 89 44 24 04 mov %eax,0x4(%esp)
98a: 8b 45 0c mov 0xc(%ebp),%eax
98d: 89 04 24 mov %eax,(%esp)
990: e8 25 fb ff ff call 4ba <kthread_create>
if (bt->bid != 0) {
995: 85 c0 test %eax,%eax
bt->bid = kthread_create(func, arg_ptr, bt->bt_stack);
997: 89 06 mov %eax,(%esi)
if (bt->bid != 0) {
999: 74 2d je 9c8 <benny_thread_create+0x88>
*abt = (benny_thread_t) bt;
99b: 8b 45 08 mov 0x8(%ebp),%eax
99e: 89 30 mov %esi,(%eax)
result = 0;
9a0: 31 c0 xor %eax,%eax
}
9a2: 83 c4 10 add $0x10,%esp
9a5: 5b pop %ebx
9a6: 5e pop %esi
9a7: 5d pop %ebp
9a8: c3 ret
9a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
bt->bt_stack += (PGSIZE - ((uint) bt->bt_stack) % PGSIZE);
9b0: 29 c3 sub %eax,%ebx
9b2: 81 c3 00 10 00 00 add $0x1000,%ebx
9b8: 89 5e 04 mov %ebx,0x4(%esi)
9bb: eb bc jmp 979 <benny_thread_create+0x39>
9bd: 8d 76 00 lea 0x0(%esi),%esi
9c0: 8b 1d 04 00 00 00 mov 0x4,%ebx
9c6: eb b7 jmp 97f <benny_thread_create+0x3f>
int result = -1;
9c8: b8 ff ff ff ff mov $0xffffffff,%eax
9cd: eb d3 jmp 9a2 <benny_thread_create+0x62>
free(bt);
9cf: 89 34 24 mov %esi,(%esp)
return NULL;
9d2: 31 f6 xor %esi,%esi
free(bt);
9d4: e8 e7 fd ff ff call 7c0 <free>
9d9: 8b 5b 04 mov 0x4(%ebx),%ebx
9dc: eb a1 jmp 97f <benny_thread_create+0x3f>
9de: 66 90 xchg %ax,%ax
000009e0 <benny_thread_bid>:
{
9e0: 55 push %ebp
9e1: 89 e5 mov %esp,%ebp
return bt->bid;
9e3: 8b 45 08 mov 0x8(%ebp),%eax
}
9e6: 5d pop %ebp
return bt->bid;
9e7: 8b 00 mov (%eax),%eax
}
9e9: c3 ret
9ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000009f0 <benny_thread_join>:
{
9f0: 55 push %ebp
9f1: 89 e5 mov %esp,%ebp
9f3: 53 push %ebx
9f4: 83 ec 14 sub $0x14,%esp
9f7: 8b 5d 08 mov 0x8(%ebp),%ebx
retVal = kthread_join(bt->bid);
9fa: 8b 03 mov (%ebx),%eax
9fc: 89 04 24 mov %eax,(%esp)
9ff: e8 be fa ff ff call 4c2 <kthread_join>
if (retVal == 0) {
a04: 85 c0 test %eax,%eax
a06: 75 27 jne a2f <benny_thread_join+0x3f>
free(bt->mem_stack);
a08: 8b 53 08 mov 0x8(%ebx),%edx
a0b: 89 45 f4 mov %eax,-0xc(%ebp)
a0e: 89 14 24 mov %edx,(%esp)
a11: e8 aa fd ff ff call 7c0 <free>
bt->bt_stack = bt->mem_stack = NULL;
a16: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
a1d: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx)
free(bt);
a24: 89 1c 24 mov %ebx,(%esp)
a27: e8 94 fd ff ff call 7c0 <free>
a2c: 8b 45 f4 mov -0xc(%ebp),%eax
}
a2f: 83 c4 14 add $0x14,%esp
a32: 5b pop %ebx
a33: 5d pop %ebp
a34: c3 ret
a35: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
a39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000a40 <benny_thread_exit>:
{
a40: 55 push %ebp
a41: 89 e5 mov %esp,%ebp
}
a43: 5d pop %ebp
return kthread_exit(exitValue);
a44: e9 81 fa ff ff jmp 4ca <kthread_exit>
a49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000a50 <benny_mootex_init>:
}
# ifdef BENNY_MOOTEX
int
benny_mootex_init(benny_mootex_t *benny_mootex)
{
a50: 55 push %ebp
a51: 89 e5 mov %esp,%ebp
a53: 8b 45 08 mov 0x8(%ebp),%eax
benny_mootex->locked = 0;
a56: c7 00 00 00 00 00 movl $0x0,(%eax)
benny_mootex->bid = -1;
a5c: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax)
return 0;
}
a63: 31 c0 xor %eax,%eax
a65: 5d pop %ebp
a66: c3 ret
a67: 89 f6 mov %esi,%esi
a69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000a70 <benny_mootex_yieldlock>:
int
benny_mootex_yieldlock(benny_mootex_t *benny_mootex)
{
a70: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
a71: b8 01 00 00 00 mov $0x1,%eax
a76: 89 e5 mov %esp,%ebp
a78: 56 push %esi
a79: 53 push %ebx
a7a: 8b 5d 08 mov 0x8(%ebp),%ebx
a7d: f0 87 03 lock xchg %eax,(%ebx)
// #error this is the call to lock the mootex that will yield in a
// #error loop until the lock is acquired.
while(xchg(&benny_mootex->locked, 1) != 0){
a80: 85 c0 test %eax,%eax
a82: be 01 00 00 00 mov $0x1,%esi
a87: 74 15 je a9e <benny_mootex_yieldlock+0x2e>
a89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
benny_yield(void)
{
// # error This just gives up the rest of this scheduled time slice to
// # error another process/thread.
return kthread_yield();
a90: e8 45 fa ff ff call 4da <kthread_yield>
a95: 89 f0 mov %esi,%eax
a97: f0 87 03 lock xchg %eax,(%ebx)
while(xchg(&benny_mootex->locked, 1) != 0){
a9a: 85 c0 test %eax,%eax
a9c: 75 f2 jne a90 <benny_mootex_yieldlock+0x20>
return kthread_self();
a9e: e8 2f fa ff ff call 4d2 <kthread_self>
benny_mootex->bid = benny_self();
aa3: 89 43 04 mov %eax,0x4(%ebx)
}
aa6: 31 c0 xor %eax,%eax
aa8: 5b pop %ebx
aa9: 5e pop %esi
aaa: 5d pop %ebp
aab: c3 ret
aac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000ab0 <benny_mootex_spinlock>:
{
ab0: 55 push %ebp
ab1: ba 01 00 00 00 mov $0x1,%edx
ab6: 89 e5 mov %esp,%ebp
ab8: 53 push %ebx
ab9: 83 ec 04 sub $0x4,%esp
abc: 8b 5d 08 mov 0x8(%ebp),%ebx
abf: 90 nop
ac0: 89 d0 mov %edx,%eax
ac2: f0 87 03 lock xchg %eax,(%ebx)
while(xchg(&benny_mootex->locked, 1) != 0){
ac5: 85 c0 test %eax,%eax
ac7: 75 f7 jne ac0 <benny_mootex_spinlock+0x10>
return kthread_self();
ac9: e8 04 fa ff ff call 4d2 <kthread_self>
benny_mootex->bid = benny_self();
ace: 89 43 04 mov %eax,0x4(%ebx)
}
ad1: 83 c4 04 add $0x4,%esp
ad4: 31 c0 xor %eax,%eax
ad6: 5b pop %ebx
ad7: 5d pop %ebp
ad8: c3 ret
ad9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000ae0 <benny_mootex_unlock>:
{
ae0: 55 push %ebp
ae1: 89 e5 mov %esp,%ebp
ae3: 53 push %ebx
ae4: 83 ec 04 sub $0x4,%esp
ae7: 8b 5d 08 mov 0x8(%ebp),%ebx
return kthread_self();
aea: e8 e3 f9 ff ff call 4d2 <kthread_self>
if(tid == benny_mootex->bid){
aef: 39 43 04 cmp %eax,0x4(%ebx)
af2: 75 1c jne b10 <benny_mootex_unlock+0x30>
__sync_synchronize();
af4: 0f ae f0 mfence
return 0;
af7: 31 c0 xor %eax,%eax
benny_mootex->bid = -1;
af9: c7 43 04 ff ff ff ff movl $0xffffffff,0x4(%ebx)
__sync_lock_release(&benny_mootex->locked);
b00: c7 03 00 00 00 00 movl $0x0,(%ebx)
}
b06: 83 c4 04 add $0x4,%esp
b09: 5b pop %ebx
b0a: 5d pop %ebp
b0b: c3 ret
b0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
b10: 83 c4 04 add $0x4,%esp
return -1;
b13: b8 ff ff ff ff mov $0xffffffff,%eax
}
b18: 5b pop %ebx
b19: 5d pop %ebp
b1a: c3 ret
b1b: 90 nop
b1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000b20 <benny_mootex_trylock>:
{
b20: 55 push %ebp
b21: b8 01 00 00 00 mov $0x1,%eax
b26: 89 e5 mov %esp,%ebp
b28: 53 push %ebx
b29: 83 ec 04 sub $0x4,%esp
b2c: 8b 5d 08 mov 0x8(%ebp),%ebx
b2f: f0 87 03 lock xchg %eax,(%ebx)
if(xchg(&benny_mootex->locked, 1) != 0){
b32: 85 c0 test %eax,%eax
b34: 75 08 jne b3e <benny_mootex_trylock+0x1e>
int tid = kthread_self();
b36: e8 97 f9 ff ff call 4d2 <kthread_self>
benny_mootex->bid = tid;
b3b: 89 43 04 mov %eax,0x4(%ebx)
}
b3e: 83 c4 04 add $0x4,%esp
b41: b8 ff ff ff ff mov $0xffffffff,%eax
b46: 5b pop %ebx
b47: 5d pop %ebp
b48: c3 ret
b49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b50 <benny_mootex_wholock>:
{
b50: 55 push %ebp
b51: 89 e5 mov %esp,%ebp
return benny_mootex->bid;
b53: 8b 45 08 mov 0x8(%ebp),%eax
}
b56: 5d pop %ebp
return benny_mootex->bid;
b57: 8b 40 04 mov 0x4(%eax),%eax
}
b5a: c3 ret
b5b: 90 nop
b5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000b60 <benny_mootex_islocked>:
{
b60: 55 push %ebp
b61: 89 e5 mov %esp,%ebp
return benny_mootex->locked;
b63: 8b 45 08 mov 0x8(%ebp),%eax
}
b66: 5d pop %ebp
return benny_mootex->locked;
b67: 8b 00 mov (%eax),%eax
}
b69: c3 ret
b6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000b70 <benny_self>:
{
b70: 55 push %ebp
b71: 89 e5 mov %esp,%ebp
}
b73: 5d pop %ebp
return kthread_self();
b74: e9 59 f9 ff ff jmp 4d2 <kthread_self>
b79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b80 <benny_yield>:
{
b80: 55 push %ebp
b81: 89 e5 mov %esp,%ebp
}
b83: 5d pop %ebp
return kthread_yield();
b84: e9 51 f9 ff ff jmp 4da <kthread_yield>
b89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b90 <benny_cpu_count>:
int
benny_cpu_count(void)
{
b90: 55 push %ebp
b91: 89 e5 mov %esp,%ebp
// # error call the kthread_cpu_count() function.
// kthread_cpu_count();
return kthread_cpu_count();
}
b93: 5d pop %ebp
return kthread_cpu_count();
b94: e9 49 f9 ff ff jmp 4e2 <kthread_cpu_count>
b99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000ba0 <benny_thread_count>:
int
benny_thread_count(void)
{
ba0: 55 push %ebp
ba1: 89 e5 mov %esp,%ebp
// # error call the kthread_thread_count() function.
// kthread_thread_count()
return kthread_thread_count();
}
ba3: 5d pop %ebp
return kthread_thread_count();
ba4: e9 41 f9 ff ff jmp 4ea <kthread_thread_count>
|
Task/Arrays/Ada/arrays.ada | LaudateCorpus1/RosettaCodeData | 1 | 10441 | procedure Array_Test is
A, B : array (1..20) of Integer;
-- Ada array indices may begin at any value, not just 0 or 1
C : array (-37..20) of integer
-- Ada arrays may be indexed by enumerated types, which are
-- discrete non-numeric types
type Days is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
type Activities is (Work, Fish);
type Daily_Activities is array(Days) of Activities;
This_Week : Daily_Activities := (Mon..Fri => Work, Others => Fish);
-- Or any numeric type
type Fingers is range 1..4; -- exclude thumb
type Fingers_Extended_Type is array(fingers) of Boolean;
Fingers_Extended : Fingers_Extended_Type;
-- Array types may be unconstrained. The variables of the type
-- must be constrained
type Arr is array (Integer range <>) of Integer;
Uninitialized : Arr (1 .. 10);
Initialized_1 : Arr (1 .. 20) := (others => 1);
Initialized_2 : Arr := (1 .. 30 => 2);
Const : constant Arr := (1 .. 10 => 1, 11 .. 20 => 2, 21 | 22 => 3);
Centered : Arr (-50..50) := (0 => 1, Others => 0);
Result : Integer
begin
A := (others => 0); -- Assign whole array
B := (1 => 1, 2 => 1, 3 => 2, others => 0);
-- Assign whole array, different values
A (1) := -1; -- Assign individual element
A (2..4) := B (1..3); -- Assign a slice
A (3..5) := (2, 4, -1); -- Assign a constant slice
A (3..5) := A (4..6); -- It is OK to overlap slices when assigned
Fingers_Extended'First := False; -- Set first element of array
Fingers_Extended'Last := False; -- Set last element of array
end Array_Test;
|
programs/oeis/195/A195437.asm | neoneye/loda | 22 | 91169 | ; A195437: Triangle formed by: 1 even, 2 odd, 3 even, 4 odd... starting with 2.
; 2,5,7,10,12,14,17,19,21,23,26,28,30,32,34,37,39,41,43,45,47,50,52,54,56,58,60,62,65,67,69,71,73,75,77,79,82,84,86,88,90,92,94,96,98,101,103,105,107,109,111,113,115,117,119,122,124,126,128,130,132,134,136,138,140,142,145,147,149,151,153,155,157,159,161,163,165,167,170,172,174,176,178,180,182,184,186,188,190,192,194,197,199,201,203,205,207,209,211,213
mov $1,$0
seq $0,2024 ; n appears n times; a(n) = floor(sqrt(2n) + 1/2).
add $0,1
mul $1,2
add $0,$1
|
Assembler_v2/KPU.Assembler.Implementation/ANTLR/LowLevelAssembly.g4 | KPU-RISC/KPU | 8 | 3582 | grammar LowLevelAssembly;
/* Entry Point */
program: (opcode | NEWLINE)+;
opcode:
/* SET opcode */
SET register_ab ',' '"' FourBitBinaryValue '"' # SET /* SET A, "1010" */
| SET register_ab ',' '"' FourBitBinaryValue '"' JumpLabel int # SET /* SET A, "1010":JUMP_ADDRESS_MARKER */
/* ALU IN/OUT opcodes */
| MOV_ALU_IN register_ab ',' register_8bit # MOV_ALU_IN /* MOV_ALU_IN A, D */
| MOV_ALU_OUT register_8bit # MOV_ALU_OUT /* MOV_ALU_OUT D */
| MOV_ALU_C_TO_AB register_ab # MOV_ALU_C_TO_AB /* MOV_ALU_C_TO_AB A */
/* ALU opcodes */
| SHL # SHL /* SHL */
| SHR # SHR /* SHR */
| SAR # SAR /* SAR */
| RCL # RCL /* RCL */
| RCR # RCR /* RCR */
| OR # OR /* OR */
| ADD # ADD /* ADD */
| ADC # ADC /* ADC */
| SUB # SUB /* SUB */
| SBB # SBB /* SBB */
| XOR # XOR /* XOR */
| AND # AND /* AND */
| NOT # NOT /* NOT */
| NEG # NEG /* NEG */
| MOV8 # MOV8 /* MOV8 */
| NOP # NOP /* NOP */
| NOP JumpLabel # NOP /* NOP:JUMP_LABEL */
/* MOV opcodes */
| MOV register_8bit ',' register_8bit # MOV /* MOV D, E */
| MOV16 register_16bit ',' register_16bit # MOV16 /* MOV16 M, SP */
/* LOAD/STORE opcodes */
| LOAD register_8bit # LOAD /* LOAD D */
| STORE register_8bit # STORE /* STORE D */
/* FLAGS opcodes */
| SAVE_FLAGS # SAVE_FLAGS /* SAVE_FLAGS */
| RESTORE_FLAGS # RESTORE_FLAGS /* RESTORE_FLAGS */
| FLAGS_TO_OUTBUFFER # FLAGS_TO_OUTBUFFER /* FLAGS_TO_OUTBUFFER */
| STORE_FLAGS # STORE_FLAGS /* STORE_FLAGS */
| INBUFFER_TO_FLAGS # INBUFFER_TO_FLAGS /* INBUFFER_TO_FLAGS */
| LOAD_FLAGS # LOAD_FLAGS /* LOAD_FLAGS */
/* 16-bit Adder opcodes */
| BIT16_ADDER # BIT16_ADDER /* BIT16_ADDER */
/* Jump opcodes */
| 'NOP' JumpLabel # JMP_LABEL /* NOP:JUMPLABEL */
| JMP JumpLabel # JMP /* JMP :JUMPLABEL */
| JZ JumpLabel # JZ /* JZ :JUMPLABEL */
| JNZ JumpLabel # JNZ /* JNZ :JUMPLABEL */
| JNS JumpLabel # JNS /* JNS :JUMPLABEL */
| JNC JumpLabel # JNC /* JNC :JUMPLABEL */
| CALL JumpLabel # CALL /* CALL :JUMPLABEL */
| RET # RET /* RET */
/* IN opcodes */
| IN port_8bit # IN /* IN A */
/* OUT opcodes */
| OUT out_port_8bit # OUT /* OUT C */
/* INT opcode */
| INT # INT /* INT */
/* HLT opcode */
| HLT # HLT /* HLT */
/* Data Section */
| DATA SixteenBitBinaryValue ',' EightBitBinaryValue # DATA /* Data Section */
/* BEGIN/END Macros... */
| MACRO # MACRO /* Macro */
;
/* Opcode Token */
SET: 'SET';
HLT: 'HLT';
MOV_ALU_IN: 'MOV_ALU_IN';
MOV_ALU_OUT: 'MOV_ALU_OUT';
MOV_ALU_C_TO_AB: 'MOV_ALU_C_TO_AB';
SHL: 'SHL';
SHR: 'SHR';
SAR: 'SAR';
RCL: 'RCL';
RCR: 'RCR';
OR: 'OR';
ADD: 'ADD';
ADC: 'ADC';
SUB: 'SUB';
SBB: 'SBB';
XOR: 'XOR';
AND: 'AND';
NOT: 'NOT';
NEG: 'NEG';
MOV8: 'MOV8';
NOP: 'NOP';
MOV: 'MOV';
MOV16: 'MOV16';
LOAD: 'LOAD';
STORE: 'STORE';
SAVE_FLAGS: 'SAVE_FLAGS';
RESTORE_FLAGS: 'RESTORE_FLAGS';
FLAGS_TO_OUTBUFFER: 'FLAGS_TO_OUTBUFFER';
STORE_FLAGS: 'STORE_FLAGS';
BIT16_ADDER: '16BIT_ADDER';
INBUFFER_TO_FLAGS: 'INBUFFER_TO_FLAGS';
LOAD_FLAGS: 'LOAD_FLAGS';
JMP: 'JMP';
JZ: 'JZ';
JNS: 'JNS';
JNZ: 'JNZ';
JNC: 'JNC';
CALL: 'CALL';
RET: 'RET';
IN: 'IN';
OUT: 'OUT';
INT: 'INT';
DATA: 'DATA';
/* Register Rules */
register_8bit: REG_8BIT;
register_16bit: REG_16BIT;
register_ab: REG_AB;
out_port_8bit: OUT_PORT_8BIT;
port_8bit: PORT_8BIT;
plus_sign: PLUS_SIGN;
minus_sign: MINUS_SIGN;
int: NUMBER;
/* Register Token */
REG_8BIT : 'D' | 'E' | 'F' | 'G' | 'H' | 'XL' | 'XH';
REG_16BIT : 'J' | 'M' | 'SP' | 'BP' | 'X' | 'Y' | 'Z' | 'PC';
REG_AB: 'A' | 'B';
PORT_8BIT: 'A' | 'B';
OUT_PORT_8BIT : 'C' | 'D';
/* Arithmetic Token */
PLUS_SIGN : '+';
MINUS_SIGN : '-';
/* Other Token */
FourBitBinaryValue: BinaryDigit BinaryDigit BinaryDigit BinaryDigit;
EightBitBinaryValue: BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit 'b';
SixteenBitBinaryValue: BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit BinaryDigit 'b';
HexValue: HexDigit HexDigit;
JumpLabel: ':' String+;
fragment BinaryDigit: [01];
fragment HexDigit: [0-9a-fA-F];
fragment String: [a-zA-Z_];
NUMBER: [0-9]+;
WS : [\t\r\n' ']+ -> skip;
MACRO: ';;' ~[\r\n]*; |
alloy4fun_models/trashltl/models/4/Kr5Kcj2zKEbbKpNrf.als | Kaixi26/org.alloytools.alloy | 0 | 3690 | open main
pred idKr5Kcj2zKEbbKpNrf_prop5 {
eventually no Trash
}
pred __repair { idKr5Kcj2zKEbbKpNrf_prop5 }
check __repair { idKr5Kcj2zKEbbKpNrf_prop5 <=> prop5o } |
src/pointed/core.agda | pcapriotti/agda-base | 20 | 2608 | {-# OPTIONS --without-K #-}
module pointed.core where
open import sum
open import equality.core
open import function.core
open import function.isomorphism.core
PSet : ∀ i → Set _
PSet i = Σ (Set i) λ X → X
PMap : ∀ {i j} → PSet i → PSet j → Set _
PMap (X , x) (Y , y) = Σ (X → Y) λ f → f x ≡ y
_∘P_ : ∀ {i j k}{𝓧 : PSet i}{𝓨 : PSet j}{𝓩 : PSet k}
→ PMap 𝓨 𝓩 → PMap 𝓧 𝓨 → PMap 𝓧 𝓩
(g , q) ∘P (f , p) = (g ∘ f , ap g p · q)
instance
pmap-comp : ∀ {i j k} → Composition _ _ _ _ _ _
pmap-comp {i}{j}{k} = record
{ U₁ = PSet i
; U₂ = PSet j
; U₃ = PSet k
; hom₁₂ = PMap
; hom₂₃ = PMap
; hom₁₃ = PMap
; _∘_ = _∘P_ }
|
test/test67.asm | bitwiseworks/nasm-os2 | 3 | 178230 | ;Testname=unoptimized; Arguments=-fbin -otest67.bin -O0; Files=stdout stderr test67.bin
;Testname=optimized; Arguments=-fbin -otest67.bin -Ox; Files=stdout stderr test67.bin
bits 16
mov ax,[bx]
mov ax,[foo]
mov ax,[word foo]
mov ax,[dword foo]
mov ax,[ebx]
rep movsb
a16 rep movsb
a32 rep movsb
a32 mov ax,bx
bits 32
mov ax,[bx]
mov ax,[foo]
mov ax,[word foo]
mov ax,[dword foo]
mov ax,[ebx]
rep movsb
a16 rep movsb
a32 rep movsb
bits 64
mov ax,[rbx]
mov ax,[foo]
mov ax,[qword foo]
mov ax,[dword foo]
mov ax,[ebx]
rep movsb
a32 rep movsb
a64 rep movsb
foo:
|
Code/boot.asm | Paulo-player/-Paulo-player-PauloRamsesValeria_FinalProject_OS_RR_2021 | 2 | 246950 | org 0x7C00 ;Endereço carregado pela BIOS
bits 16 ;Arquitetura de 16 bits
start:
cli ;Desabilita as interrupções
mov si, msg ;ponteiro SI guarda oo endereço de msg
mov ah, 0x0E ;print char
.loop lodsb ;Carrega si no registrador AL e incrementa (contador)
or al, al ;Checa se não há mais caracteres a serem imprimidos
jz halt ;Interrompe o loop
int 0x10 ;caso contrário, interrompe o loop
jmp .loop ;Próxima iteração e repetição do loop
halt: hlt ;hlt interrompe a execução do loop
msg: db "Hello, World!", 0 ;String armazenada no endereço 0,
times 510 - ($ - $$) db 0 ;Magic numbers para oidentificação do código como bootable
dw 0xAA55 |
mmpd-lib/src/focus/mac_os/get_window_info.scpt | michd/midi-macro-pad | 1 | 1903 | #!/usr/bin/osascript
-- With thanks to this StackOverflow answer by Albert
-- https://stackoverflow.com/a/5293758/1019228
global frontApp, frontAppName, frontAppClass, windowTitle, executablePath
set windowTitle to ""
tell application "System Events"
-- Get the focused application
set frontApp to first application process whose frontmost is true
-- Grab name and display name of focused application, these will
-- be the values we populate window_class with
set frontAppName to name of frontApp
set frontAppClass to displayed name of frontApp
-- Get the absolute path of the application owning this window
set executablePath to POSIX path of (application file of frontApp)
-- Get the window title
tell process frontAppName
tell (1st window whose value of attribute "AXMain" is true)
set windowTitle to value of attribute "AXTitle"
end tell
end tell
end tell
-- Print app class, app name, window title, executable path to STDOUT on their own lines
copy frontAppClass & "\n" & frontAppName & "\n" & windowTitle & "\n" & executablePath to stdout |
Task/GUI-enabling-disabling-of-controls/Ada/gui-enabling-disabling-of-controls.ada | LaudateCorpus1/RosettaCodeData | 1 | 4107 | <reponame>LaudateCorpus1/RosettaCodeData<filename>Task/GUI-enabling-disabling-of-controls/Ada/gui-enabling-disabling-of-controls.ada<gh_stars>1-10
with Ada.Strings.Fixed;
with Gtk.Main;
with Gtk.Handlers;
with Gtk.Button;
with Gtk.Window;
with Gtk.GEntry;
with Gtk.Editable;
with Gtk.Box;
with Gtk.Widget;
with Glib.Values;
procedure Disabling is
type My_Natural is range 0 .. 10;
The_Value : My_Natural := 0;
Main_Window : Gtk.Window.Gtk_Window;
Content : Gtk.Box.Gtk_Vbox;
Increment_Button : Gtk.Button.Gtk_Button;
Decrement_Button : Gtk.Button.Gtk_Button;
Entry_Field : Gtk.GEntry.Gtk_Entry;
package Entry_Callbacks is new Gtk.Handlers.Callback
(Gtk.GEntry.Gtk_Entry_Record);
package Button_Callbacks is new Gtk.Handlers.Callback
(Gtk.Button.Gtk_Button_Record);
package Window_Callbacks is new Gtk.Handlers.Return_Callback
(Gtk.Window.Gtk_Window_Record, Boolean);
-- update displayed text
procedure Update_Entry is
begin
Gtk.GEntry.Set_Text
(The_Entry => Entry_Field,
Text =>
Ada.Strings.Fixed.Trim
(Source => My_Natural'Image (The_Value),
Side => Ada.Strings.Both));
end Update_Entry;
procedure Check_Value is
begin
Gtk.Widget.Set_Sensitive
(Gtk.Widget.Gtk_Widget (Decrement_Button),
The_Value > 0);
Gtk.Widget.Set_Sensitive
(Gtk.Widget.Gtk_Widget (Increment_Button),
The_Value < 10);
Gtk.Widget.Set_Sensitive
(Gtk.Widget.Gtk_Widget (Entry_Field),
The_Value = 0);
end Check_Value;
procedure On_Changed_Text
(Object : access Gtk.GEntry.Gtk_Entry_Record'Class;
Params : Glib.Values.GValues)
is
pragma Unreferenced (Params, Object);
begin
The_Value := My_Natural'Value (Gtk.GEntry.Get_Text (Entry_Field));
Check_Value;
Update_Entry;
exception
when Constraint_Error =>
The_Value := 0;
end On_Changed_Text;
-- make sure that only numbers are entered
procedure On_Insert_Text
(Object : access Gtk.GEntry.Gtk_Entry_Record'Class;
Params : Glib.Values.GValues)
is
Length : constant Glib.Gint :=
Glib.Values.Get_Int (Glib.Values.Nth (Params, 2));
Text : constant String :=
Glib.Values.Get_String (Glib.Values.Nth (Params, 1), Length);
begin
declare
Number : My_Natural;
pragma Unreferenced (Number);
begin
Number := My_Natural'Value (Text);
exception
when Constraint_Error =>
-- refuse values that are not parsable
Gtk.Handlers.Emit_Stop_By_Name
(Object => Object,
Name => Gtk.Editable.Signal_Insert_Text);
end;
end On_Insert_Text;
-- Callback for click event
procedure On_Increment_Click
(Object : access Gtk.Button.Gtk_Button_Record'Class)
is
pragma Unreferenced (Object);
begin
The_Value := The_Value + 1;
Check_Value;
Update_Entry;
end On_Increment_Click;
-- Callback for click event
procedure On_Decrement_Click
(Object : access Gtk.Button.Gtk_Button_Record'Class)
is
pragma Unreferenced (Object);
begin
The_Value := The_Value - 1;
Check_Value;
Update_Entry;
end On_Decrement_Click;
-- Callback for delete event
function On_Main_Window_Delete
(Object : access Gtk.Window.Gtk_Window_Record'Class)
return Boolean
is
pragma Unreferenced (Object);
begin
Gtk.Main.Main_Quit;
return True;
end On_Main_Window_Delete;
begin
Gtk.Main.Init;
Gtk.GEntry.Gtk_New (Widget => Entry_Field);
Entry_Callbacks.Connect
(Widget => Entry_Field,
Name => Gtk.Editable.Signal_Insert_Text,
Cb => On_Insert_Text'Access);
Entry_Callbacks.Connect
(Widget => Entry_Field,
Name => Gtk.Editable.Signal_Changed,
Cb => On_Changed_Text'Access);
Gtk.Button.Gtk_New (Button => Increment_Button, Label => "Increment");
Gtk.Button.Gtk_New (Button => Decrement_Button, Label => "Decrement");
Button_Callbacks.Connect
(Widget => Increment_Button,
Name => Gtk.Button.Signal_Clicked,
Marsh => Button_Callbacks.To_Marshaller (On_Increment_Click'Access));
Button_Callbacks.Connect
(Widget => Decrement_Button,
Name => Gtk.Button.Signal_Clicked,
Marsh => Button_Callbacks.To_Marshaller (On_Decrement_Click'Access));
Gtk.Box.Gtk_New_Vbox (Box => Content);
Gtk.Box.Add (Container => Content, Widget => Entry_Field);
Gtk.Box.Add (Container => Content, Widget => Increment_Button);
Gtk.Box.Add (Container => Content, Widget => Decrement_Button);
Gtk.Window.Gtk_New (Window => Main_Window);
Gtk.Window.Add (Container => Main_Window, Widget => Content);
Window_Callbacks.Connect
(Widget => Main_Window,
Name => Gtk.Widget.Signal_Delete_Event,
Cb => On_Main_Window_Delete'Access);
Gtk.Window.Show_All (Widget => Main_Window);
Update_Entry;
Gtk.Main.Main;
end Disabling;
|
programs/oeis/076/A076508.asm | neoneye/loda | 22 | 22326 | ; A076508: Expansion of 2*x*(1+4*x+8*x^2)/(1-24*x^3).
; 2,8,16,48,192,384,1152,4608,9216,27648,110592,221184,663552,2654208,5308416,15925248,63700992,127401984,382205952,1528823808,3057647616,9172942848,36691771392,73383542784,220150628352,880602513408
add $0,6
mov $1,3
lpb $0
sub $0,1
add $2,1
mul $1,$2
dif $2,4
lpe
div $1,216
mov $0,$1
|
Tests/IO/Ptr.e.asm | lehtojo/Evie | 12 | 11167 | .intel_syntax noprefix
.global _Z4mainv
.global _Z10Start_Testv
.section .text #.text
_Z10Start_Testv:
sub rsp, 44 #.STACK, 44
mov dword ptr [rsp + 0 ], 10 #.STACK_0, 10
lea rcx, qword ptr [rsp + 0 ] #val_REG0, .STACK_0
mov qword ptr [rsp + 4 ], rcx #.STACK_4, val_REG0
lea rcx, qword ptr [rsp + 4 ] #a_REG1, .STACK_4
mov qword ptr [rsp + 12 ], rcx #.STACK_12, a_REG1
mov rcx, qword ptr [rsp + 4 ] #a_REG2, .STACK_4
mov ecx, dword ptr [rcx ] #a_REG2_REG3, a_REG2
mov eax, ecx #Returning_REG4, a_REG2_REG3
add rsp, 44 #.STACK, 44
ret #
lea rcx, qword ptr [rsp + 12 ] #b_REG5, .STACK_12
mov qword ptr [rsp + 20 ], rcx #.STACK_20, b_REG5
lea rcx, qword ptr [rsp + 20 ] #c_REG6, .STACK_20
mov qword ptr [rsp + 28 ], rcx #.STACK_28, c_REG6
lea rcx, qword ptr [rsp + 28 ] #d_REG7, .STACK_28
mov qword ptr [rsp + 36 ], rcx #.STACK_36, d_REG7
lea rcx, qword ptr [rsp + 36 ] #e_REG8, .STACK_36
mov rcx, rcx #f, e_REG8
mov rcx, qword ptr [rcx ] #f_REG9, f
mov rcx, qword ptr [rcx ] #f_REG9_REG10, f_REG9
mov rcx, qword ptr [rcx ] #f_REG9_REG10_REG11, f_REG9_REG10
mov rcx, qword ptr [rcx ] #f_REG9_REG10_REG11_REG12, f_REG9_REG10_REG11
mov rcx, qword ptr [rcx ] #f_REG9_REG10_REG11_REG12_REG13, f_REG9_REG10_REG11_REG12
mov ecx, dword ptr [rcx ] #f_REG9_REG10_REG11_REG12_REG13_REG14, f_REG9_REG10_REG11_REG12_REG13
mov eax, ecx #Returning_REG15, f_REG9_REG10_REG11_REG12_REG13_REG14
add rsp, 44 #.STACK, 44
ret #
mov rcx, 123 #Normal_Cast_needing_Var, 123
mov ecx, dword ptr [rcx ] #Normal_Cast_needing_Var_REG16, Normal_Cast_needing_Var
mov eax, ecx #Returning_REG17, Normal_Cast_needing_Var_REG16
add rsp, 44 #.STACK, 44
ret #
mov rcx, 1234 #Dynamic_needing_Var, 1234
mov rcx, qword ptr [rcx ] #Dynamic_needing_Var_REG18, Dynamic_needing_Var
mov ecx, dword ptr [rcx ] #Dynamic_needing_Var_REG18_REG19, Dynamic_needing_Var_REG18
mov eax, ecx #Returning_REG20, Dynamic_needing_Var_REG18_REG19
add rsp, 44 #.STACK, 44
ret #
add rsp, 44 #.STACK, 44
ret #
_Z4mainv:
sub rsp, 44 #.STACK, 44
mov dword ptr [rsp + 0 ], 10 #.STACK_0, 10
lea rcx, qword ptr [rsp + 0 ] #val_102_REG0, .STACK_0
mov qword ptr [rsp + 4 ], rcx #.STACK_4, val_102_REG0
lea rcx, qword ptr [rsp + 4 ] #a_102_REG1, .STACK_4
mov qword ptr [rsp + 12 ], rcx #.STACK_12, a_102_REG1
jmp Return_Here_138 #Return_Here_138
lea rcx, qword ptr [rsp + 12 ] #b_102_REG2, .STACK_12
mov qword ptr [rsp + 20 ], rcx #.STACK_20, b_102_REG2
lea rcx, qword ptr [rsp + 20 ] #c_102_REG3, .STACK_20
mov qword ptr [rsp + 28 ], rcx #.STACK_28, c_102_REG3
lea rcx, qword ptr [rsp + 28 ] #d_102_REG4, .STACK_28
mov qword ptr [rsp + 36 ], rcx #.STACK_36, d_102_REG4
lea rcx, qword ptr [rsp + 36 ] #e_102_REG5, .STACK_36
mov rcx, rcx #f_102, e_102_REG5
jmp Return_Here_138 #Return_Here_138
mov rcx, 123 #Normal_Cast_needing_Var_102, 123
jmp Return_Here_138 #Return_Here_138
mov rcx, 1234 #Dynamic_needing_Var_102, 1234
jmp Return_Here_138 #Return_Here_138
Return_Here_138:
mov eax, 1 #Returning_REG6, 1
add rsp, 44 #.STACK, 44
ret #
add rsp, 44 #.STACK, 44
ret #
.section .data #.data
std_MAX_CONSOLE_BUFFER_LENGHT:
.long 4096 #4096
std_GENERIC_WRITE:
.long 1073741824 #1073741824
std_GENERIC_READ:
.quad 2147483648 #2147483648
std_FILE_SHARE_NONE:
.long 0 #0
std_FILE_SHARE_READ:
.long 1 #1
std_FILE_SHARE_WRITE:
.long 2 #2
std_FILE_SHARE_DELETE:
.long 4 #4
std_CREATE_NEW:
.long 1 #1
std_CREATE_ALWAYS:
.long 2 #2
std_OPEN_EXISTING:
.long 3 #3
std_OPEN_ALWAYS:
.long 4 #4
std_TRUNCATE_EXISTING:
.long 4 #4
std_FILE_ATTRIBUTE_NORMAL:
.long 128 #128
std_FILE_ATTRIBUTE_FOLDER:
.long 16 #16
std_MAXIMUM_PATH_LENGTH:
.long 260 #260
std_ERROR_INSUFFICIENT_BUFFER:
.long 122 #122
std_MINIMUM_PROCESS_FILENAME_LENGTH:
.long 50 #50
|
oeis/216/A216131.asm | neoneye/loda-programs | 11 | 99174 | ; A216131: a(n) = 11^n mod 1000.
; Submitted by <NAME>
; 1,11,121,331,641,51,561,171,881,691,601,611,721,931,241,651,161,771,481,291,201,211,321,531,841,251,761,371,81,891,801,811,921,131,441,851,361,971,681,491,401,411,521,731,41,451,961,571,281,91,1,11,121,331,641,51,561,171,881,691,601,611,721,931,241,651,161,771,481,291,201,211,321,531,841,251,761,371,81,891,801,811,921,131,441,851,361,971,681,491,401,411,521,731,41,451,961,571,281,91
mov $1,11
pow $1,$0
mod $1,-1000
mov $0,$1
|
libsrc/zx81/tape/tape_load_block_callee.asm | teknoplop/z88dk | 0 | 32 | <gh_stars>0
;
; Tape load routine
;
;
; int __CALLEE__ tape_load_block_callee(void *addr, size_t len, unsigned char type)
;
;
; $Id: tape_load_block_callee.asm,v 1.6 2015/08/11 07:16:36 stefano Exp $
;
PUBLIC tape_load_block_callee
PUBLIC ASMDISP_TAPE_LOAD_BLOCK_CALLEE
EXTERN zx_fast
EXTERN zx_slow
; Very simple header, only check the 'type' byte in a Spectrum-ish way.
; For design reasons, we test a whole word..
;-----
.header
defw 0 ; LEN
defw 0 ; LOC
.header2
defw 0 ; file type (2 bytes)
;-----
EXTERN musamy_load
.tape_load_block_callee
pop de
pop bc
ld a,c
pop bc
pop hl
push de
.asmentry
LD (header+2),hl ; LOC
LD (header),bc ; LEN
ld e,a
.ld_retry
push de
ld hl,rethere
push hl
LD HL,header
PUSH HL
LD BC,2 ; file type len
PUSH BC
LD HL,header2
PUSH HL
call zx_fast
;LD L,40h ; VERIFY MODE
LD L,0 ; LOAD MODE
jp musamy_load
.rethere
push hl
call zx_slow
IF FORlambda
call $1C28 ; BREAK-1 on Lambda
ELSE
call $f46 ; BREAK-1 on ZX81
ENDIF
pop hl
pop de
ret nc ; if BREAK is pressed, return; timeout error code is valid for BREAK too
ld a,3
cp l ; timeout ?
jr z,ld_retry
xor a
or l
ret nz ; other errors
ld a,(header2)
cp e
ret z ; all OK
ld l,4 ; file type error
ret
DEFC ASMDISP_TAPE_LOAD_BLOCK_CALLEE = # asmentry - tape_load_block_callee
|
src/bin/simple-game/asm/hello-world.asm | gregtatum/cpu-6502-rs | 0 | 175681 | ; https://skilldrick.github.io/easy6502/
; by <NAME>, licensed under CC BY 4.0
lda #$01
sta $0200
lda #$05
sta $0201
lda #$08
sta $0202
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/scalbln.asm | meesokim/z88dk | 0 | 245869 |
SECTION code_fp_math48
PUBLIC _scalbln
EXTERN cm48_sdcciy_scalbln
defc _scalbln = cm48_sdcciy_scalbln
|
text/randomString.applescript | adriannier/applescript-functions | 7 | 4708 | <reponame>adriannier/applescript-functions
set str to randomString(64)
set the clipboard to str
on randomString(stringSize)
(* Generate a UUID compliant with RFC 4122v4 *)
set disabled to "!|l0OI12Z5S8B"
set allowed to "!#$%&()+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^abcdefghijklmnopqrstuvwxyz{|}~"
set allowedCount to count of allowed
set buffer to ""
repeat
repeat
set thisChar to character (random number from 1 to allowedCount) of allowed
if thisChar is not in disabled then exit repeat
end repeat
set buffer to buffer & thisChar
if (count of buffer) is greater than or equal to stringSize then exit repeat
end repeat
return buffer
end randomString |
assembly_code/Test_Program1.asm | jquinonezb/Equipo_6 | 0 | 9850 | MAIN:
addi $t1,$zero,3
addi $t2,$zero,7
addi $t3,$zero,1
add $t1,$t1,$t1
add $t2,$t2,$t1
add $t3,$t2,$t1
|
Playbox.widget/lib/Get Current Track.applescript | vyder/uebersicht-widgets | 0 | 400 | <reponame>vyder/uebersicht-widgets<filename>Playbox.widget/lib/Get Current Track.applescript
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
global artistName, songName, albumName, songRating, songDuration, currentPosition, musicapp, apiKey, songMetaFile, mypath, currentCoverURL
property blackStar : "★"
property whiteStar : "☆"
set metaToGrab to {"artistName", "songName", "albumName", "songDuration", "currentPosition", "coverURL", "songChanged"}
property enableLogging : false --- options: true | false
set apiKey to "<KEY>"
try
set mypath to POSIX path of (path to me)
set AppleScript's text item delimiters to "/"
set mypath to (mypath's text items 1 thru -2 as string) & "/"
set AppleScript's text item delimiters to ""
on error e
logEvent(e)
return
end try
set songMetaFile to (mypath & "songMeta.plist" as string)
if isMusicPlaying() is true then
getSongMeta()
—return grabCover()
writeSongMeta({"currentPosition" & "##" & currentPosition})
if didSongChange() is true then
delay 1
writeSongMeta({¬
"artistName" & "##" & artistName, ¬
"songName" & "##" & songName, ¬
"songDuration" & "##" & songDuration, ¬
"songChanged" & "##" & ¬
true})
if didCoverChange() is true then
set savedCoverURL to my readSongMeta({"coverURL"})
set currentCoverURL to grabCover()
if savedCoverURL is not currentCoverURL then writeSongMeta({"coverURL" & "##" & currentCoverURL})
end if
writeSongMeta({"albumName" & "##" & albumName})
else
writeSongMeta({"songChanged" & "##" & false})
end if
if didCoverChange() is true then
set savedCoverURL to my readSongMeta({"coverURL"})
set currentCoverURL to grabCover()
if savedCoverURL is not currentCoverURL then writeSongMeta({"coverURL" & "##" & currentCoverURL})
end if
spitOutput(metaToGrab) as string
else
return
end if
------------------------------------------------
---------------SUBROUTINES GALORE---------------
------------------------------------------------
on isMusicPlaying()
set apps to {"iTunes", "Spotify"}
set answer to false
repeat with anApp in apps
tell application "System Events" to set isRunning to (name of processes) contains anApp
if isRunning is true then
try
using terms from application "iTunes"
tell application anApp
if player state is playing then
set musicapp to (anApp as string)
set answer to true
end if
end tell
end using terms from
on error e
my logEvent(e)
end try
end if
end repeat
return answer
end isMusicPlaying
on getSongMeta()
try
set musicAppReference to a reference to application musicapp
using terms from application "iTunes"
try
tell musicAppReference
set {artistName, songName, albumName, songDuration} to {artist, name, album, duration} of current track
set currentPosition to my formatNum(player position as string)
set songDuration to my formatNum(songDuration as string)
end tell
on error e
my logEvent(e)
end try
end using terms from
on error e
my logEvent(e)
end try
return songDuration
end getSongMeta
on didSongChange()
set answer to false
try
set currentSongMeta to artistName & songName
set savedSongMeta to (readSongMeta({"artistName"}) & readSongMeta({"songName"}) as string)
if currentSongMeta is not savedSongMeta then set answer to true
on error e
my logEvent(e)
end try
return answer
end didSongChange
on didCoverChange()
set answer to false
try
set currentSongMeta to artistName & albumName
set savedSongMeta to (readSongMeta({"artistName"}) & readSongMeta({"albumName"}) as string)
if currentSongMeta is not savedSongMeta then set answer to true
if readSongMeta({"coverURL"}) as string is "NA" then set answer to true
on error e
my logEvent(e)
end try
return answer
end didCoverChange
on grabCover()
try
if musicapp is "iTunes" then
tell application "iTunes" to tell current track
if exists (every artwork) then
my getLocaliTunesArt()
else
my getLastfmArt()
end if
end tell
else if musicapp is "Spotify" then
my getSpotifyArt()
--my getLastfmArt()
end if
on error e
logEvent(e)
set currentCoverURL to getPathItem(mypath) & "default.png"
end try
return currentCoverURL
end grabCover
on getLocaliTunesArt()
do shell script "rm -rf " & readSongMeta({"oldFilename"}) -- delete old artwork
tell application "iTunes" to tell artwork 1 of current track -- get the raw bytes of the artwork into a var
set srcBytes to raw data
if format is «class PNG » then -- figure out the proper file extension
set ext to ".png"
else
set ext to ".jpg"
end if
end tell
set fileName to (mypath as POSIX file) & "cover" & (random number from 0 to 999) & ext as string -- get the filename to ~/my path/cover.ext
set outFile to open for access file fileName with write permission -- write to file
set eof outFile to 0 -- truncate the file
write srcBytes to outFile -- write the image bytes to the file
close access outFile
set currentCoverURL to POSIX path of fileName
writeSongMeta({"oldFilename" & "##" & currentCoverURL})
set currentCoverURL to getPathItem(currentCoverURL)
end getLocaliTunesArt
on getLastfmArt()
set coverDownloaded to false
set rawXML to ""
set currentCoverURL to "NA"
repeat 5 times
try
set rawXML to (do shell script "curl 'http://ws.audioscrobbler.com/2.0/?method=album.getinfo&artist=" & quoted form of (my encodeText(artistName, true, false, 1)) & "&album=" & quoted form of (my encodeText(albumName, true, false, 1)) & "&api_key=" & apiKey & "'")
delay 1
on error e
my logEvent(e & return & rawXML)
end try
if rawXML is not "" then
try
set AppleScript's text item delimiters to "extralarge\">"
set processingXML to text item 2 of rawXML
set AppleScript's text item delimiters to "</image>"
set currentCoverURL to text item 1 of processingXML
set AppleScript's text item delimiters to ""
if currentCoverURL is "" then
my logEvent("Cover art unavailable." & return & rawXML)
set currentCoverURL to "NA"
set coverDownloaded to true
end if
on error e
my logEvent(e & return & rawXML)
end try
set coverDownloaded to true
end if
if coverDownloaded is true then exit repeat
end repeat
end getLastfmArt
on getSpotifyArt()
set coverDownloaded to false
set rawXML to ""
set currentCoverURL to "NA"
repeat 5 times
try
tell application "Spotify" to set trackID to id of current track
set AppleScript's text item delimiters to ":"
set trackID to last text item of trackID
set AppleScript's text item delimiters to ""
on error e
my logEvent(e)
end try
try
set rawXML to (do shell script "curl -X GET 'https://api.spotify.com/v1/tracks/" & trackID & "'")
delay 1
on error e
my logEvent(e & return & rawXML)
end try
if rawXML is not "" then
try
set AppleScript's text item delimiters to "\"url\" : \""
set processingXML to text item 2 of rawXML
set AppleScript's text item delimiters to "\","
set currentCoverURL to text item 1 of processingXML
set AppleScript's text item delimiters to ""
if currentCoverURL is "" then
my logEvent("Cover art unavailable." & return & rawXML)
set currentCoverURL to "NA"
set coverDownloaded to true
end if
on error e
my logEvent(e & return & rawXML)
end try
set coverDownloaded to true
end if
if coverDownloaded is true then exit repeat
end repeat
end getSpotifyArt
on getPathItem(aPath)
set AppleScript's text item delimiters to "/"
set countItems to count text items of aPath
set start to countItems - 2
set outputPath to "/" & text items start thru -1 of aPath as string
set AppleScript's text item delimiters to ""
return outputPath
end getPathItem
on readSongMeta(keyNames)
set valueList to {}
tell application "System Events" to tell property list file songMetaFile to tell contents
repeat with keyName in keyNames
try
set keyValue to value of property list item keyName
on error e
my logEvent("Reading song metadata" & space & e)
my writeSongMeta({keyName & "##" & "NA"})
set keyValue to value of property list item keyName
end try
copy keyValue to the end of valueList
end repeat
end tell
return valueList
end readSongMeta
on writeSongMeta(keys)
tell application "System Events"
if my checkFile(songMetaFile) is false then
-- create an empty property list dictionary item
set the parent_dictionary to make new property list item with properties {kind:record}
-- create new property list file using the empty dictionary list item as contents
set this_plistfile to ¬
make new property list file with properties {contents:parent_dictionary, name:songMetaFile}
end if
try
repeat with aKey in keys
set AppleScript's text item delimiters to "##"
set keyName to text item 1 of aKey
set keyValue to text item 2 of aKey
set AppleScript's text item delimiters to ""
make new property list item at end of property list items of contents of property list file songMetaFile ¬
with properties {kind:string, name:keyName, value:keyValue}
end repeat
on error e
my logEvent(e)
end try
end tell
end writeSongMeta
on spitOutput(metaToGrab)
set valuesList to {}
repeat with metaPiece in metaToGrab
set valuesList to valuesList & readSongMeta({metaPiece}) & " @ "
end repeat
set output to items 1 thru -2 of valuesList
--logEvent(output)
return output
end spitOutput
on formatNum(aNumber)
set delimiters to {",", "."}
repeat with aDelimiter in delimiters
if aNumber does not contain aDelimiter then
set outNumber to comma_delimit(aNumber)
else
set outNumber to aNumber
end if
end repeat
return outNumber
end formatNum
on comma_delimit(this_number)
set this_number to this_number as string
if this_number contains "E" then set this_number to number_to_string(this_number)
set the num_length to the length of this_number
set the this_number to (the reverse of every character of this_number) as string
set the new_num to ""
repeat with i from 1 to the num_length
if i is the num_length or (i mod 3) is not 0 then
set the new_num to (character i of this_number & the new_num) as string
else
set the new_num to ("." & character i of this_number & the new_num) as string
end if
end repeat
return the new_num
end comma_delimit
on number_to_string(this_number)
set this_number to this_number as string
if this_number contains "E+" then
set x to the offset of "." in this_number
set y to the offset of "+" in this_number
set z to the offset of "E" in this_number
set the decimal_adjust to characters (y - (length of this_number)) thru ¬
-1 of this_number as string as number
if x is not 0 then
set the first_part to characters 1 thru (x - 1) of this_number as string
else
set the first_part to ""
end if
set the second_part to characters (x + 1) thru (z - 1) of this_number as string
set the converted_number to the first_part
repeat with i from 1 to the decimal_adjust
try
set the converted_number to ¬
the converted_number & character i of the second_part
on error
set the converted_number to the converted_number & "0"
end try
end repeat
return the converted_number
else
return this_number
end if
end number_to_string
on encodeText(this_text, encode_URL_A, encode_URL_B, method)
--http://www.macosxautomation.com/applescript/sbrt/sbrt-08.html
set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789"
set the URL_A_chars to "$+!'/?;&@=#%><{}[]\"~`^\\|*"
set the URL_B_chars to ".-_:"
set the acceptable_characters to the standard_characters
if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars
if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars
set the encoded_text to ""
repeat with this_char in this_text
if this_char is in the acceptable_characters then
set the encoded_text to (the encoded_text & this_char)
else
set the encoded_text to (the encoded_text & encode_char(this_char, method)) as string
end if
end repeat
return the encoded_text
end encodeText
on encode_char(this_char, method)
set the ASCII_num to (the ASCII number this_char)
set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
set x to item ((ASCII_num div 16) + 1) of the hex_list
set y to item ((ASCII_num mod 16) + 1) of the hex_list
if method is 1 then
return ("%" & x & y) as string
else if method is 2 then
return "_" as string
end if
end encode_char
on checkFile(myfile)
try
POSIX file myfile as alias
return true
on error
return false
end try
end checkFile
on logEvent(e)
if enableLogging is true then
set e to e as string
tell application "Finder" to set myName to (name of file (path to me))
do shell script "echo '" & (current date) & space & quoted form of e & "' >> ~/Library/Logs/" & quoted form of myName & ".log"
else
return
end if
end logEvent |
programs/oeis/160/A160467.asm | karttu/loda | 1 | 8405 | <gh_stars>1-10
; A160467: a(n) = 1 if n is odd; otherwise, a(n) = 2^(k-1) where 2^k is the largest power of 2 that divides n.
; 1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,32,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,64,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,32,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1
bin $0,3
add $0,1
mov $1,$0
gcd $1,32768
|
test/ctestc/src/ctestc.adb | ficorax/PortAudioAda | 2 | 17633 | with Ada.Command_Line;
with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Text_IO; use Ada.Text_IO;
with System; use System;
with PortAudioAda; use PortAudioAda;
with Ctestc_Types; use Ctestc_Types;
with Ctestc_Callbacks; use Ctestc_Callbacks;
procedure Ctestc
is
package ACL renames Ada.Command_Line;
err : PA_Error;
stream : aliased PA_Stream_Ptr;
framesPerBuffer : Integer := Default_Buffer_Size;
outLatency : Integer := 0;
minLatency : constant Integer := Default_Buffer_Size * 2;
sampleRate : Long_Float := 44100.0;
Finish : Boolean := False;
begin
Put_Line ("pa_minlat - Determine minimum latency for your computer.");
Put_Line (" usage: pa_minlat {userBufferSize}");
Put_Line (" for example: pa_minlat 64");
Put_Line ("Adjust your stereo until you hear" &
" a smooth tone in each speaker.");
Put_Line ("Then try to find the smallest number" &
" of frames that still sounds smooth.");
Put_Line ("Note that the sound will stop momentarily" &
" when you change the number of buffers.");
-- Get bufferSize from command line.
if ACL.Argument_Count > 0 then
framesPerBuffer := Integer'Value (ACL.Argument (1));
end if;
Put ("Frames per buffer = ");
Put (framesPerBuffer, 0);
New_Line;
data.left_phase := 0.0;
data.right_phase := 0.0;
err := PA_Initialize;
if err /= paNoError then
raise PortAudio_Exception;
end if;
outLatency := Integer (sampleRate * 200.0 / 1000.0); -- 200 msec.
-- Try different numBuffers in a loop.
while not Finish loop
outputParameters.device := PA_Get_Default_Output_Device;
outputParameters.channelCount := 2;
outputParameters.sampleFormat := paFloat32;
outputParameters.suggestedLatency :=
PA_Time (outLatency) / PA_Time (sampleRate);
outputParameters.hostApiSpecificStreamInfo := System.Null_Address;
-- printf("%6.1f msec.\n", outLatency, . * 1000.0 );
Put ("Latency = ");
Put (outLatency, 0);
Put (" frames = ");
Put (Long_Float (outputParameters.suggestedLatency) * 1000.0, 0, 1, 0);
Put_Line (" msec.");
err := PA_Open_Stream
(stream'Access,
null,
outputParameters'Access,
sampleRate,
IC.unsigned_long (framesPerBuffer),
paClipOff,
paMinLatCallback'Access,
data'Address);
if err /= paNoError or stream = null then
raise PortAudio_Exception;
end if;
-- Start audio.
err := PA_Start_Stream (stream);
if err /= paNoError then
raise PortAudio_Exception;
end if;
-- Ask user for a new nlatency.
New_Line;
Put_Line ("Move windows around to see if the sound glitches.");
Put ("Latency now ");
Put (outLatency, 0);
Put (", enter new number of frames, or 'q' to quit: ");
declare
str : constant access String := new String'(Ada.Text_IO.Get_Line);
begin
if str.all (1) = 'q' then
Finish := True;
else
outLatency := Integer'Value (str.all);
if outLatency < minLatency then
Put ("Latency below minimum of ");
Put (minLatency, 0);
Put_Line ("! Set to minimum!!!");
outLatency := minLatency;
end if;
end if;
exception
when others =>
Put_Line ("Put integer number or 'q' to quit");
end;
-- Stop sound until ENTER hit.
err := PA_Stop_Stream (stream);
if err /= paNoError then
raise PortAudio_Exception;
end if;
err := PA_Close_Stream (stream);
if err /= paNoError then
raise PortAudio_Exception;
end if;
end loop;
Put_Line ("A good setting for latency would be somewhat higher than");
Put_Line ("the minimum latency that worked.");
Put_Line ("PortAudio: Test finished.");
err := PA_Terminate;
-----------------------------------------------------------------------------
exception
when PortAudio_Exception =>
err := PA_Terminate;
Put_Line ("Error occured while using the PortAudio stream");
Put_Line ("Error code: " & PA_Error'Image (err));
Put_Line ("Error message: " & PA_Get_Error_Text (err));
end Ctestc;
|
Library/Spool/Process/processCustom.asm | steakknife/pcgeos | 504 | 167565 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: processCustom.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 9/28/92 Initial version.
DESCRIPTION:
$Id: processCustom.asm,v 1.1 97/04/07 11:11:27 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrintInit segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VerifyCustomPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY:
PASS:
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 9/28/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VerifyCustomPort proc near
clc
ret
VerifyCustomPort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitCustomPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pass initialization parameters to the stream driver
CALLED BY: InitPrinterPort
PASS: stack frame inherited from SpoolerLoop
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 9/28/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InitCustomPort proc near
uses ax,bx,cx,dx,di,si,bp
curJob local SpoolJobInfo ; all we need to process this job
.enter inherit
;
; Have the stream driver load its options
;
push ds ; dgroup
segmov ds, ss
lea si, curJob.SJI_info.JP_printerName
mov di, STREAM_ESC_LOAD_OPTIONS
call curJob.SJI_stream
pop ds
; open the port
tryOpen:
; copy the port data into a block to pass in BX
mov ax, size CPP_info
mov cx, ALLOC_DYNAMIC_NO_ERR_LOCK or mask HF_SHARABLE
call MemAlloc
push es, ds
mov es, ax
lea si, customParams.CPP_info
segmov ds, ss
clr di
mov cx, size CPP_info/2
rep movsw
if size CPP_info and 1
movsb
endif
pop es, ds
call MemUnlock
push bx
; assume DR_STREAM_OPEN will fail
mov customParams.CPP_unit, -1
mov dx, SPOOL_PARALLEL_BUFFER_SIZE
mov di, DR_STREAM_OPEN
mov ax, mask SOF_NOBLOCK
push bp
call curJob.SJI_stream ; open the port
pop bp
pop cx
push bx
pushf
mov bx, cx
call MemFree
popf
pop bx
jnc portOK
mov cx, PERROR_PARALLEL_ERR
mov dx, curJob.SJI_qHan
call SpoolErrorBox ; signal problem
TestUserStandardDialogResponses SPOOL_BAD_USER_STANDARD_DIALOG_RESPONSE, IC_OK, IC_DISMISS
cmp ax, IC_OK
je tryOpen ; if not cancelling...
mov ax, PE_PORT_NOT_OPENED ; otherwise signal error type
stc
jmp done
portOK:
mov customParams.CPP_unit, bx
; set the error notification mechanism
push bp ; save frame pointer
mov di, DR_STREAM_SET_NOTIFY
mov ax, StreamNotifyType <0, SNE_ERROR, SNM_ROUTINE>
mov cx, dgroup
mov dx, offset dgroup:StreamErrorHandler
lea si, curJob.SJI_stream
mov bp, curJob.SJI_qHan ; value to pass in ax
call {fptr.far}ss:[si] ; call to driver
pop bp
;
; now set the connection info for the printer driver
;
mov di, DR_PRINT_SET_STREAM
mov cx, bx
mov si, curJob.SJI_info.JP_portInfo.PPI_type
mov dx, curJob.SJI_sHan ; pass stream handle
mov bx, curJob.SJI_pstate
call curJob.SJI_pDriver
clc ; signal no problem
; all done
done:
.leave
ret
InitCustomPort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ExitCustomPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close the custom port
CALLED BY: SpoolerLoop
PASS: ss:bp - inherited local vars
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 9/28/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ExitCustomPort proc near
curJob local SpoolJobInfo ; all we need to process this job
.enter inherit
;
; close the port
;
mov bx, customParams.CPP_unit
cmp bx, -1
je exit
;
; check if we should kill (user cancel) or flush (otherwise)
; pending data
;
if _KILL_CUSTOM_PORT_DATA_ON_CANCEL
push ds, si
call LockQueue
mov ds, ax
mov si, curJob.SJI_qHan
mov si, ds:[si]
cmp ds:[si].QI_error, SI_ABORT
pushf
call UnlockQueue
popf
pop ds, si
endif
mov di, DR_STREAM_CLOSE
mov ax, STREAM_LINGER
if _KILL_CUSTOM_PORT_DATA_ON_CANCEL
jne linger ; not abort, flush data
mov ax, STREAM_DISCARD ; else, discard data
linger:
endif
push bp
call curJob.SJI_stream
pop bp
exit:
.leave
ret
ExitCustomPort endp
PrintInit ends
PrintError segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ErrorCustomPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle errors from the custom port
CALLED BY: custom driver via StreamErrorHandler
PASS: ds - segment of locked queue segment
*ds:si - pointer to queue that is affected
dx - error word (PrinterError from printDr.def)
RETURN: carry set if print job should abort
ds - fixed up if necessary
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Copied from ErrorParallelPort with barely any understanding of
what I'm doing.
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 6/ 9/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ErrorCustomPort proc near
uses ax,bx,cx,di,es
.enter
mov cx, dx
call UnlockQueue ; release the queue
mov dx, si ; dx = queue handle
call SpoolErrorBox
push ax ; save error code
call LockQueue ; get queue back, since
mov ds, ax ; caller expects it
pop ax ; restore error code
; check to see what to do...
TestUserStandardDialogResponses SPOOL_BAD_USER_STANDARD_DIALOG_RESPONSE, IC_OK, IC_DISMISS
cmp ax, IC_OK ; should we abort?
je doRestart ; no, continue
; the user has decided to call it quits. Close down the
; port and let the spooler handle all the errors generated.
abort:
mov bx, ds:[si] ; deref queue handle
mov ds:[bx].QI_error, SI_ABORT ; signal abort
; close the port
call CloseCustomPort
stc ; set error flag
done:
.leave
ret
doRestart:
push si
mov si, ds:[si]
mov ax, ds:[si].QI_resend
les si, ds:[si].QI_threadInfo
mov bx, es:[si].SJI_info.JP_portInfo.PPI_params.PP_custom.CPP_unit
mov di, STREAM_ESC_RESTART_OUTPUT
call es:[si].SJI_stream
pop si
jc abort
jmp done
ErrorCustomPort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CloseCustomPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close the custom port
CALLED BY: CloseCustomPortFar, ErrorCustomPort, CommPortErrorHandler
PASS: *ds:si - QueueInfo
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 8/10/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CloseCustomPort proc near
uses bx,di,ax,dx, si, es
.enter
mov si, ds:[si]
les si, ds:[si].QI_threadInfo
mov bx, es:[si].SJI_info.JP_portInfo.PPI_params.PP_custom.CPP_unit
mov di, DR_STREAM_CLOSE ; close the port
mov ax, STREAM_DISCARD ; kill the data
call es:[si].SJI_stream ; signal the driver
.leave
ret
CloseCustomPort endp
PrintError ends
|
oeis/198/A198849.asm | neoneye/loda-programs | 11 | 27749 | <reponame>neoneye/loda-programs
; A198849: a(n) = (11*6^n - 1)/5.
; Submitted by <NAME>
; 2,13,79,475,2851,17107,102643,615859,3695155,22170931,133025587,798153523,4788921139,28733526835,172401161011,1034406966067,6206441796403,37238650778419,223431904670515,1340591428023091,8043548568138547,48261291408831283,289567748452987699,1737406490717926195,10424438944307557171,62546633665845343027,375279801995072058163,2251678811970432348979,13510072871822594093875,81060437230935564563251,486362623385613387379507,2918175740313680324277043,17509054441882081945662259
mov $2,6
pow $2,$0
mov $0,$2
div $0,5
mul $0,11
add $0,2
|
src/apsepp-test_event_class-generic_exception_mixin.ads | thierr26/ada-apsepp | 0 | 6060 | <filename>src/apsepp-test_event_class-generic_exception_mixin.ads<gh_stars>0
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
generic
type Parent is abstract new Test_Event_Base with private;
package Apsepp.Test_Event_Class.Generic_Exception_Mixin is
type Child_W_Exception is new Parent with private
with Type_Invariant'Class =>
Child_W_Exception.Exception_Access = null
or else
(
Exception_Identity (Child_W_Exception.Exception_Access.all)
/=
Null_Id
);
overriding
procedure Set (Obj : in out Child_W_Exception; Data : Test_Event_Data);
overriding
procedure Clean_Up (Obj : in out Child_W_Exception);
overriding
function Exception_Access
(Obj : Child_W_Exception) return Exception_Occurrence_Access;
overriding
procedure Free_Exception (Obj : in out Child_W_Exception);
private
type Child_W_Exception is new Parent with record
E : Exception_Occurrence_Access;
end record;
end Apsepp.Test_Event_Class.Generic_Exception_Mixin;
|
3-mid/opengl/source/lean/text/private/opengl-glyphimpl.ads | charlie5/lace | 20 | 497 | <reponame>charlie5/lace
with
freetype_C.FT_GlyphSlot;
package openGL.GlyphImpl
--
-- Implements an openGL glyph.
--
is
type Item is tagged private;
type View is access all Item'Class;
---------
-- Types
--
subtype error_Kind is freetype_C.FT_Error;
no_Error : constant error_Kind;
---------
-- Forge
--
procedure define (Self : in out Item; glyth_Slot : in freetype_c.FT_GlyphSlot.item);
--
-- glyth_Slot: The Freetype glyph to be processed.
--------------
-- Attributes
--
function Advance (Self : in Item) return Real; -- The advance distance for this glyph.
function BBox (Self : in Item) return Bounds; -- Return the bounding box for this glyph.
function Error (Self : in Item) return error_Kind; -- Return the current error code.
private
type Item is tagged
record
Advance : Vector_3;
bBox : Bounds;
Err : error_Kind;
end record;
procedure destruct (Self : in out Item);
no_Error : constant error_Kind := 0;
end openGL.GlyphImpl;
|
tst/8080int.asm | 1801BM1/vm80a | 131 | 82363 | title 'Preliminary 8080 interrupt tests'
fault equ 8000h
.8080
aseg
org 0h
begin: jmp start
org 8h
vect1: jmp fault+$
org 10h
vect2: jmp fault+$
org 18h
vect3: jmp fault+$
org 20h
vect4: ei
ret
org 28h
vect5: jmp fault+$
org 30h
vect6: jmp fault+$
org 38h
vect7: jmp fault+$
org 100h
start: lxi SP, stack
di
ei
di
ei
di
ei
mvi A, 1 ; test simple compares and z/nz jumps
hlt
cpi 2
jz fault+$
cpi 1
jnz fault+$
jmp lab0
hlt ; emergency exit
db 0FFh
lab0: call lab2 ; does a simple call work?
lab1: jmp fault+$ ; fail
lab2: pop H ; check return address
mov A, H
cpi high lab1
jz lab3
jmp fault+$
lab3: mov A, L
cpi low lab1
jz lab4
jmp fault+$
; test presence and uniqueness of all machine registers
; (except ir)
lab4: lxi SP, regs1
pop PSW
pop B
pop D
pop H
lxi SP, regs2+8
push H
push D
push B
push PSW
lda regs2+0
cpi 2
jnz fault+$
lda regs2+1
cpi 4
jnz fault+$
lda regs2+2
cpi 6
jnz fault+$
lda regs2+3
cpi 8
jnz fault+$
lda regs2+4
cpi 10
jnz fault+$
lda regs2+5
cpi 12
jnz fault+$
lda regs2+6
cpi 14
jnz fault+$
lda regs2+7
cpi 16
jnz fault+$
; test access to memory via (HL)
lxi H, hlval
mov A, M
cpi 0A5h
jnz fault+$
lxi H, hlval+1
mov A, M
cpi 03Ch
jnz fault+$
; test unconditional return
lxi SP, stack
lxi H, reta
push H
ret
jmp fault+$
; test instructions needed for hex output
reta: mvi A, 0FFh
ani 0Fh
cpi 0Fh
jnz fault+$
mvi A, 05Ah
ani 0Fh
cpi 0Ah
jnz fault+$
rrc
cpi 05h
jnz fault+$
rrc
cpi 82h
jnz fault+$
rrc
cpi 41h
jnz fault+$
rrc
cpi 0a0h
jnz fault+$
lxi H, 01234h
push H
pop B
mov A, B
cpi 12h
jnz fault+$
mov A, C
cpi 34h
jnz fault+$
; test conditional call, ret, jp, jr
tcond macro flag, pcond, ncond
lxi H, flag
push H
pop psw
c`pcond lab1`pcond
jmp fault+$
lab1`pcond:
pop H
lxi H, 0D7h xor flag
push H
pop PSW
c`ncond lab2`pcond
jmp fault+$
lab2`pcond:
pop H
lxi H,lab3`pcond
push H
lxi H, flag
push H
pop PSW
r`pcond
jmp fault+$
lab3`pcond:
lxi H,lab4`pcond
push H
lxi H, 0D7h xor flag
push H
pop PSW
r`ncond
jmp fault+$
lab4`pcond:
lxi H, flag
push H
pop PSW
j`pcond lab5`pcond
jmp fault+$
lab5`pcond:
lxi H, 0D7h xor flag
push H
pop PSW
j`ncond lab6`pcond
jmp fault+$
lab6`pcond:
endm
tcond 001h, c, nc
tcond 004h, pe, po
tcond 040h, z, nz
tcond 080h, m, p
; test indirect jumps
lxi H,lab7
pchl
jmp fault+$
; djnz (and (partially) inc a, inc hl)
lab7: mvi A, 0A5h
mvi B, 4
lab8: rrc
dcr B
jnz lab8
cpi 05Ah
cnz fault+$
mvi B, 16
lab9: inr A
dcr B
jnz lab9
cpi 06Ah
cnz fault+$
mvi B, 0
lxi H, 0
lab10: inx H
dcr B
jnz lab10
mov A, H
cpi 1
cnz fault+$
mov a,l
cpi 0
cnz fault+$
allok: lxi H, 0FFFFh;
mov A, M
jmp fault+$
regs1: db 2, 4, 6, 8, 10, 12, 14, 16
regs2: ds 8,0
hlval: db 0A5h,03Ch
ds 120
stack equ $
end begin
|
fsm/Fsm.g4 | jgoppert/fsm | 2 | 5672 | <filename>fsm/Fsm.g4
grammar Fsm;
fsm_main: fsm_state+;
fsm_state : 'STATE' ID '{'
fsm_transition*
'}'
;
fsm_transition : 'TRANSITION' ID '{'
fsm_guard*
'}';
fsm_expr: fsm_expr fsm_op=('*'|'/') fsm_expr # MulDiv
| fsm_expr fsm_op=('+'|'-') fsm_expr # AddSub
| INT # int
| ID # id
| '(' fsm_expr ')' # parens
;
fsm_guard : 'GUARD' ID;
MUL : '*' ; // assigns token name to '*' used above in grammar
DIV : '/' ;
ADD : '+' ;
SUB : '-' ;
ID : [a-zA-Z]+ ; // match identifiers
INT : [0-9]+ ; // match integers
WS : [ \r\n\t]+ -> skip ; // toss out whitespace
|
libsrc/_DEVELOPMENT/adt/p_forward_list/c/sccz80/p_forward_list_empty.asm | teknoplop/z88dk | 8 | 1770 | <gh_stars>1-10
; int p_forward_list_empty(p_forward_list_t *list)
SECTION code_clib
SECTION code_adt_p_forward_list
PUBLIC p_forward_list_empty
EXTERN asm_p_forward_list_empty
defc p_forward_list_empty = asm_p_forward_list_empty
|
programs/oeis/237/A237886.asm | jmorken/loda | 1 | 91870 | <reponame>jmorken/loda
; A237886: Side length of smallest square containing n dominoes with short side lengths 1, 2, ..., n.
; 0,2,4,6,8,11,14,17,21,24,28,32,37,41,46,50,55,60,66,71
mov $1,3
mov $2,$0
mov $4,4
mov $7,$0
lpb $2
add $4,$0
lpb $4
mov $1,$0
mov $3,$0
mov $4,$0
add $5,1
mov $6,11
lpe
div $1,2
lpb $5
add $1,$0
add $1,1
mul $1,$3
sub $5,$5
lpe
lpb $6
add $1,3
div $1,4
add $5,2
mul $5,2
sub $6,$5
lpe
add $1,1
mov $2,4
lpe
sub $1,3
mov $8,$7
mul $8,2
add $1,$8
|
tools/asmx2/test/6805.asm | retro16/blastsdk | 10 | 167205 | <filename>tools/asmx2/test/6805.asm
; 6805.asm
dir EQU 'D'
imm EQU 'I'
ix1 EQU 'X'
ix2 EQU 'X2'
ext EQU 'EX'
BRSET 0 dir . ; 00 44 FE
BRCLR 0 dir . ; 01 44 FE
BRSET 1 dir . ; 02 44 FE
BRCLR 1 dir . ; 03 44 FE
BRSET 2 dir . ; 04 44 FE
BRCLR 2 dir . ; 05 44 FE
BRSET 3 dir . ; 06 44 FE
BRCLR 3 dir . ; 07 44 FE
BRSET 4 dir . ; 08 44 FE
BRCLR 4 dir . ; 09 44 FE
BRSET 5 dir . ; 0A 44 FE
BRCLR 5 dir . ; 0B 44 FE
BRSET 6 dir . ; 0C 44 FE
BRCLR 6 dir . ; 0D 44 FE
BRSET 7 dir . ; 0E 44 FE
BRCLR 7 dir . ; 0F 44 FE
BSET 0 dir ; 10 44
BCLR 0 dir ; 11 44
BSET 1 dir ; 12 44
BCLR 1 dir ; 13 44
BSET 2 dir ; 14 44
BCLR 2 dir ; 15 44
BSET 3 dir ; 16 44
BCLR 3 dir ; 17 44
BSET 4 dir ; 18 44
BCLR 4 dir ; 19 44
BSET 5 dir ; 1A 44
BCLR 5 dir ; 1B 44
BSET 6 dir ; 1C 44
BCLR 6 dir ; 1D 44
BSET 7 dir ; 1E 44
BCLR 7 dir ; 1F 44
BRA . ; 20 FE
BRN . ; 21 FE
BHI . ; 22 FE
BLS . ; 23 FE
BCC . ; 24 FE
BCS . ; 25 FE
BHS . ; 24 FE
BLO . ; 25 FE
BNE . ; 26 FE
BEQ . ; 27 FE
BHCC . ; 28 FE
BHCS . ; 29 FE
BPL . ; 2A FE
BMI . ; 2B FE
BMC . ; 2C FE
BMS . ; 2D FE
BIL . ; 2E FE
BIH . ; 2F FE
NEG dir ; 30 44
FCB $31 ; 31 44
FCB $32 ; 32 44
COM dir ; 33 44
LSR dir ; 34 44
FCB $35 ; 35
ROR dir ; 36 44
ASR dir ; 37 44
ASL dir ; 38 44
LSL dir ; 38 44
ROL dir ; 39 44
DEC dir ; 3A 44
FCB $3B ; 3B 44
INC dir ; 3C 44
TST dir ; 3D 44
FCB $3E ; 3E 44
CLR dir ; 3F 44
NEGA ; 40
FCB $41 ; 41
MUL ; 42
COMA ; 43
LSRA ; 44
FCB $45 ; 45
RORA ; 46
ASRA ; 47
ASLA ; 48
LSLA ; 48
ROLA ; 49
DECA ; 4A
FCB $4B ; 4B
INCA ; 4C
TSTA ; 4D
FCB $4E ; 4E
CLRA ; 4F
NEGX ; 50
FCB $51 ; 51
FCB $52 ; 52
COMX ; 53
LSRX ; 54
FCB $55 ; 55
RORX ; 56
ASRX ; 57
ASLX ; 58
LSLX ; 58
ROLX ; 59
DECX ; 5A
FCB $5B ; 5B
INCX ; 5C
TSTX ; 5D
FCB $5E ; 5E
CLRX ; 5F
NEG ix1,X ; 60 58
FCB $61 ; 61
FCB $62 ; 62
COM ix1,X ; 63 58
LSR ix1,X ; 64 58
FCB $65 ; 65
ROR ix1,X ; 66 58
ASR ix1,X ; 67 58
ASL ix1,X ; 68 58
LSL ix1,X ; 68 58
ROL ix1,X ; 69 58
DEC ix1,X ; 6A 58
FCB $6B ; 6B
INC ix1,X ; 6C 58
TST ix1,X ; 6D 58
FCB $6E ; 6E
CLR ix1,X ; 6F 58
NEG ,X ; 70
FCB $71 ; 71
FCB $72 ; 72
COM ,X ; 73
LSR ,X ; 74
FCB $75 ; 75
ROR ,X ; 76
ASR ,X ; 77
ASL ,X ; 78
LSL ,X ; 78
ROL ,X ; 79
DEC ,X ; 7A
FCB $7B ; 7B
INC ,X ; 7C
TST ,X ; 7D
FCB $7E ; 7E
CLR ,X ; 7F
RTI ; 80
RTS ; 81
FCB $82 ; 82
SWI ; 83
FCB $84 ; 84
FCB $85 ; 85
FCB $86 ; 86
FCB $87 ; 87
FCB $88 ; 88
FCB $89 ; 89
FCB $8A ; 8A
FCB $8B ; 8B
FCB $8C ; 8C
FCB $8D ; 8D
STOP ; 8E
WAIT ; 8F
FCB $90 ; 90
FCB $91 ; 91
FCB $92 ; 92
FCB $93 ; 93
FCB $94 ; 94
FCB $95 ; 95
FCB $96 ; 96
TAX ; 97
CLC ; 98
SEC ; 99
CLI ; 9A
SEI ; 9B
RSP ; 9C (reset stack pointer)
NOP ; 9D
FCB $9E ; 9E
TXA ; 9F
SUB #imm ; A0 49
CMP #imm ; A1 49
SBC #imm ; A2 49
CPX #imm ; A3 49
AND #imm ; A4 49
BIT #imm ; A5 49
LDA #imm ; A6 49
FCB $A7 ; A7 (STA #imm)
EOR #imm ; A8 49
ADC #imm ; A9 49
ORA #imm ; AA 49
ADD #imm ; AB 49
FCB $AC ; AC (JMP #imm)
BSR . ; AD FE
LDX #imm ; AE 49
FCB $AF ; AF (STX #imm)
SUB dir ; B0 44
CMP dir ; B1 44
SBC dir ; B2 44
CPX dir ; B3 44
AND dir ; B4 44
BIT dir ; B5 44
LDA dir ; B6 44
STA dir ; B7 44
EOR dir ; B8 44
ADC dir ; B9 44
ORA dir ; BA 44
ADD dir ; BB 44
JMP dir ; BC 44
JSR dir ; BD 44
LDX dir ; BE 44
STX dir ; BF 44
SUB ext ; C0 4558
CMP ext ; C1 4558
SBC ext ; C2 4558
CPX ext ; C3 4558
AND ext ; C4 4558
BIT ext ; C5 4558
LDA ext ; C6 4558
STA ext ; C7 4558
EOR ext ; C8 4558
ADC ext ; C9 4558
ORA ext ; CA 4558
ADD ext ; CB 4558
JMP ext ; CC 4558
JSR ext ; CD 4558
LDX ext ; CE 4558
STX ext ; CF 4558
SUB ix2,X ; D0 5832
CMP ix2,X ; D1 5832
SBC ix2,X ; D2 5832
CPX ix2,X ; D3 5832
AND ix2,X ; D4 5832
BIT ix2,X ; D5 5832
LDA ix2,X ; D6 5832
STA ix2,X ; D7 5832
EOR ix2,X ; D8 5832
ADC ix2,X ; D9 5832
ORA ix2,X ; DA 5832
ADD ix2,X ; DB 5832
JMP ix2,X ; DC 5832
JSR ix2,X ; DD 5832
LDX ix2,X ; DE 5832
STX ix2,X ; DF 5832
SUB ix1,X ; E0 58
CMP ix1,X ; E1 58
SBC ix1,X ; E2 58
CPX ix1,X ; E3 58
AND ix1,X ; E4 58
BIT ix1,X ; E5 58
LDA ix1,X ; E6 58
STA ix1,X ; E7 58
EOR ix1,X ; E8 58
ADC ix1,X ; E9 58
ORA ix1,X ; EA 58
ADD ix1,X ; EB 58
JMP ix1,X ; EC 58
JSR ix1,X ; ED 58
LDX ix1,X ; EE 58
STX ix1,X ; EF 58
SUB ,X ; F0
CMP ,X ; F1
SBC ,X ; F2
CPX ,X ; F3
AND ,X ; F4
BIT ,X ; F5
LDA ,X ; F6
STA ,X ; F7
EOR ,X ; F8
ADC ,X ; F9
ORA ,X ; FA
ADD ,X ; FB
JMP ,X ; FC
JSR ,X ; FD
LDX ,X ; FE
STX ,X ; FF
END
|
3-mid/opengl/private/freetype/source/thin/freetype_c-ft_face.ads | charlie5/lace | 20 | 17396 | with
freetype_c.Pointers;
package freetype_c.FT_Face
is
subtype Item is Pointers.FT_FaceRec_Pointer;
type Item_array is array (C.Size_t range <>) of aliased FT_Face.Item;
type Pointer is access all FT_Face.Item;
type Pointer_array is array (C.Size_t range <>) of aliased FT_Face.Pointer;
type pointer_Pointer is access all FT_Face.Pointer;
end freetype_c.FT_Face;
|
oeis/173/A173142.asm | neoneye/loda-programs | 11 | 28460 | ; A173142: a(n) = n^n - (n-1)^(n-1) - (n-2)^(n-2) - ... - 1.
; Submitted by <NAME>
; 1,3,22,224,2837,43243,773474,15903604,369769661,9594928683,274906599294,8620383706328,293663289402069,10799919901775579,426469796631518922,17997426089579351788,808344199828497012733,38500271751352361059803,1938227111261072875032934,102838987799940445696784976,5735710806185922967077909397,335478414133633515320962384139,20533090659253106434882701847538,1312507931509841406815254108870180,87462878347821796391807624610448253,6065946774614954060720700846116120779
add $0,1
mov $2,$0
lpb $0
mov $3,$0
sub $0,1
pow $3,$2
sub $1,$3
sub $2,1
trn $3,$1
add $1,$3
lpe
mov $0,$1
|
libsrc/_DEVELOPMENT/l/sccz80/9-common/i32/l_long_rl_mhl.asm | ahjelm/z88dk | 4 | 21917 | <reponame>ahjelm/z88dk
; Z88 Small C+ Run Time Library
; Long functions
;
; feilipu 10/2021
SECTION code_clib
SECTION code_l_sccz80
PUBLIC l_long_rl_mhl
;primary = primary<<1
;enter with primary in (hl)
.l_long_rl_mhl
ld a,(hl)
rla
ld (hl),a
inc hl
ld a,(hl)
rla
ld (hl),a
inc hl
ld a,(hl)
rla
ld (hl),a
inc hl
ld a,(hl)
rla
ld (hl),a
ret
|
tier-1/xcb/source/thin/xcb-xcb_segment_t.ads | charlie5/cBound | 2 | 16646 | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_segment_t is
-- Item
--
type Item is record
x1 : aliased Interfaces.Integer_16;
y1 : aliased Interfaces.Integer_16;
x2 : aliased Interfaces.Integer_16;
y2 : aliased Interfaces.Integer_16;
end record;
-- Item_Array
--
type Item_Array is
array (Interfaces.C.size_t range <>) of aliased xcb.xcb_segment_t.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_segment_t.Item,
Element_Array => xcb.xcb_segment_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array (Interfaces.C.size_t range <>) of aliased xcb.xcb_segment_t.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_segment_t.Pointer,
Element_Array => xcb.xcb_segment_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_segment_t;
|
agda/HITs/PropositionalTruncation/Sugar.agda | oisdk/combinatorics-paper | 0 | 11044 | <filename>agda/HITs/PropositionalTruncation/Sugar.agda
{-# OPTIONS --cubical --safe #-}
module HITs.PropositionalTruncation.Sugar where
open import Cubical.HITs.PropositionalTruncation
open import Level
_=<<_ : ∀ {a} {A : Type a} {b} {B : ∥ A ∥ → Type b}
→ ((x : A) → ∥ B ∣ x ∣ ∥) → (xs : ∥ A ∥) → ∥ B xs ∥
_=<<_ = elimPropTrunc (λ _ → squash)
_>>=_ : ∀ {a} {A : Type a} {b} {B : Type b}
→ (xs : ∥ A ∥) → (A → ∥ B ∥) → ∥ B ∥
_>>=_ {a} {A} {b} {B} xs f = elimPropTrunc (λ _ → squash) f xs
_>>_ : ∥ A ∥ → ∥ B ∥ → ∥ B ∥
_ >> ys = ys
pure : A → ∥ A ∥
pure = ∣_∣
_<*>_ : ∥ (A → B) ∥ → ∥ A ∥ → ∥ B ∥
fs <*> xs = do
f ← fs
x ← xs
∣ f x ∣
infixr 1 _∥$∥_
_∥$∥_ : (A → B)→ ∥ A ∥ → ∥ B ∥
f ∥$∥ xs = recPropTrunc squash (λ x → ∣ f x ∣) xs
|
engine/events/fish.asm | genterz/pokecross | 28 | 25199 | <reponame>genterz/pokecross
Fish:
; Using a fishing rod.
; Fish for monsters with rod e in encounter group d.
; Return monster e at level d.
push af
push bc
push hl
ld b, e
call GetFishGroupIndex
ld hl, FishGroups
rept FISHGROUP_DATA_LENGTH
add hl, de
endr
call .Fish
pop hl
pop bc
pop af
ret
.Fish:
; Fish for monsters with rod b from encounter data in FishGroup at hl.
; Return monster e at level d.
call Random
cp [hl]
jr nc, .no_bite
; Get encounter data by rod:
; 0: Old
; 1: Good
; 2: Super
inc hl
ld e, b
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
; Compare the encounter chance to select a Pokemon.
call Random
.loop
cp [hl]
jr z, .ok
jr c, .ok
inc hl
inc hl
inc hl
jr .loop
.ok
inc hl
; Species 0 reads from a time-based encounter table.
ld a, [hli]
ld d, a
and a
call z, .TimeEncounter
ld e, [hl]
ret
.no_bite
ld de, 0
ret
.TimeEncounter:
; The level byte is repurposed as the index for the new table.
ld e, [hl]
ld d, 0
ld hl, TimeFishGroups
rept 4
add hl, de
endr
ld a, [wTimeOfDay]
maskbits NUM_DAYTIMES
cp NITE_F
jr c, .time_species
inc hl
inc hl
.time_species
ld d, [hl]
inc hl
ret
GetFishGroupIndex:
; Return the index of fishgroup d in de.
push hl
ld hl, wDailyFlags1
bit DAILYFLAGS1_FISH_SWARM_F, [hl]
pop hl
jr z, .done
ld a, d
cp FISHGROUP_QWILFISH
jr z, .qwilfish
cp FISHGROUP_REMORAID
jr z, .remoraid
.done
dec d
ld e, d
ld d, 0
ret
.qwilfish
ld a, [wFishingSwarmFlag]
cp FISHSWARM_QWILFISH
jr nz, .done
ld d, FISHGROUP_QWILFISH_SWARM
jr .done
.remoraid
ld a, [wFishingSwarmFlag]
cp FISHSWARM_REMORAID
jr nz, .done
ld d, FISHGROUP_REMORAID_SWARM
jr .done
INCLUDE "data/wild/fish.asm"
|
programs/oeis/184/A184549.asm | neoneye/loda | 22 | 241530 | <gh_stars>10-100
; A184549: Super-birthdays (falling on the same weekday), version 1 (birth within the year following a February 29).
; 0,6,17,23,28,34,45,51,56,62,73,79,84,90,101,107,112,118,129,135,140,146,157,163,168,174,185,191,196,202,213,219,224,230,241,247,252,258,269,275,280,286,297,303,308,314
add $0,15
seq $0,184551 ; Super-birthdays (falling on the same weekday), version 3 (birth within 2 and 3 years after a February 29).
sub $0,106
|
src/kernel/kernel_entry.asm | Dudejoe870/FunOS | 2 | 11559 | <reponame>Dudejoe870/FunOS
[bits 32]
global _start
_start:
[extern kernel_main]
call kernel_main
jmp $ |
oeis/311/A311804.asm | neoneye/loda-programs | 11 | 163856 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A311804: Coordination sequence Gal.6.216.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>(s2)
; 1,4,8,13,17,21,25,29,33,38,42,46,50,54,59,63,67,71,75,79,84,88,92,96,100,105,109,113,117,121,125,130,134,138,142,146,151,155,159,163,167,171,176,180,184,188,192,197,201,205
mul $0,4
mov $3,$0
sub $0,1
div $0,11
add $0,1
mov $2,$3
mul $2,21
div $2,22
add $2,$0
mov $0,$2
|
ASM/src/chests.asm | denoflionsx/OoT-Randomizer | 83 | 29154 | <filename>ASM/src/chests.asm
GET_CHEST_OVERRIDE_WRAPPER:
sb t9,0x01E9(s0)
addiu sp, sp, -0x20
sw ra, 0x04 (sp)
sw a0, 0x08 (sp)
sw a1, 0x0C (sp)
sw t0, 0x10 (sp)
swc1 $f10, 0x14 (sp)
swc1 $f16, 0x18 (sp)
jal get_chest_override
move a0, s0
lw ra, 0x04 (sp)
lw a0, 0x08 (sp)
lw a1, 0x0C (sp)
lw t0, 0x10 (sp)
lwc1 $f10, 0x14 (sp)
lwc1 $f16, 0x18 (sp)
jr ra
addiu sp, sp, 0x20
|
build-compilation.ads | annexi-strayline/AURA | 13 | 19980 | ------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- 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 copyright holder 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 --
-- OWNER 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. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Containers.Synchronized_Queue_Interfaces;
with Ada.Containers.Unbounded_Priority_Queues;
with Progress;
with Registrar.Library_Units;
package Build.Compilation is
type Compilation_Message_Context is (Warning, Error);
type Compiler_Message is
record
Unit : Registrar.Library_Units.Library_Unit;
Context: Compilation_Message_Context;
STDERR : UBS.Unbounded_String;
end record;
function Get_Context (Message: Compiler_Message)
return Compilation_Message_Context is
(Message.Context);
function Before (Left, Right: Compilation_Message_Context) return Boolean is
(Left = Error and then Right = Warning);
-- We want to dequeue Errors before Warnings
package CMQI is new Ada.Containers.Synchronized_Queue_Interfaces
(Compiler_Message);
package CMQ is new Ada.Containers.Unbounded_Priority_Queues
(Queue_Interfaces => CMQI,
Queue_Priority => Compilation_Message_Context,
Get_Priority => Get_Context,
Before => Before);
-------------
-- Compile --
-------------
procedure Compile (Configuration: in Build_Configuration);
Compilation_Progress: aliased Progress.Progress_Tracker;
Compiler_Messages : CMQ.Queue;
-- Attempts to compile all units with a State of "Available".
--
-- Any options in Global_Compiler_Options are prepended to any of the
-- computed options determined by the subsystem/root configuration
--
-- Compilation output is always output to files at Compiler_Output (see
-- private part)
-- * unit_name.cmd: The command (and arguments) used to invoke the compiler
-- * unit_name.out: The standard output stream of the compiler
-- * unit_name.err: The standard error stream of the compiler
--
-- Additionally, std_err is output to the Compiler_Messages queue if it
-- is non-empty.
--
-- If the compiler process exits successfully, all stderr output is assumed
-- to be warning messages, and Context is set to Warnings. Otherwise,
-- Context is set to Error on a non-successful exit status
--
-- Compiled units will have ther hashes regenerated, and their state
-- promoted to "Compiled"
end Build.Compilation;
|
programs/oeis/026/A026535.asm | karttu/loda | 0 | 99362 | <filename>programs/oeis/026/A026535.asm
; A026535: a(n) = t(1+5n) where t = A001285 (Thue-Morse sequence).
; 2,1,2,2,2,2,2,1,2,1,1,2,2,1,1,2,2,1,2,1,1,1,1,1,2,1,2,1,1,2,2,1,2,1,2,2,2,2,2,2,1,2,2,1,1,1,1,2,2,1,2,2,2,2,2,2,1,2,1,2,2,1,1,2,2,1,2,2,2,2,2,1,2,1,1,2,2,2,2,1,1,2,1,2,2,2,2,2,1,2
mul $0,10
add $0,3
mov $1,$0
lpb $0,1
add $1,$0
div $0,2
lpe
mod $1,2
add $1,1
|
reuse/Pointers.asm | William0Friend/my_masm | 0 | 4245 | <reponame>William0Friend/my_masm
; Pointers (Pointers.asm)
; Demonstration of pointers and TYPEDEF.
.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:dword
; Create user-defined types.
PBYTE TYPEDEF PTR BYTE ; pointer to bytes
PWORD TYPEDEF PTR WORD ; pointer to words
PDWORD TYPEDEF PTR DWORD ; pointer to doublewords
.data
arrayB BYTE 10h,20h,30h
arrayW WORD 1,2,3
arrayD DWORD 4,5,6
; Create some pointer variables.
ptr1 PBYTE arrayB
ptr2 PWORD arrayW
ptr3 PDWORD arrayD
.code
main PROC
; Use the pointers to access data.
mov esi,ptr1
mov al,[esi] ; 10h
mov esi,ptr2
mov ax,[esi] ; 1
mov esi,ptr3
mov eax,[esi] ; 4
invoke ExitProcess,0
main ENDP
END main |
bssn/code/bssninitial.adb | leo-brewin/adm-bssn-numerical | 1 | 26829 | with Ada.Text_IO; use Ada.Text_IO;
-- for access to Halt
with Support;
-- for parsing of the command line arguments
with Support.RegEx; use Support.RegEx;
with Support.CmdLine; use Support.CmdLine;
-- for setup of initial data
with BSSNBase; use BSSNBase;
with BSSNBase.Initial;
-- for data io
with BSSNBase.Data_IO;
with Metric.Kasner; use Metric.Kasner;
procedure BSSNInitial is
procedure initialize is
re_intg : String := "([-+]?[0-9]+)";
re_real : String := "([-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?)"; -- note counts as 2 groups (1.234(e+56))
re_intg_seq : String := re_intg&"x"&re_intg&"x"&re_intg;
re_real_seq : String := re_real&":"&re_real&":"&re_real;
begin
if find_command_arg('h') then
Put_Line (" Usage: bssninitial [-nPxQxR] [-dDx:Dy:Dz] [-pp1:p2:p3] [-Ddata] [-tTime] [-h]");
Put_Line (" -nPxQxR : Create a grid with P by Q by NR grid points, default: P=Q=R=20");
Put_Line (" -dDx:Dy:Dz : Grid spacings are Dx, Dy and Dz, default: Dx=Dy=Dz=0.1");
Put_Line (" -pp1:p2:p3 : p1, p2, and p3 are the Kasner parameters, default: p1=p2=2/3, p3=-1/3");
Put_line (" -Ddata : Where to save the data, default: data/");
Put_Line (" -tTime : Set the initial time, default: T=1");
Put_Line (" -h : This message.");
Support.Halt (0);
else
beg_time := read_command_arg ('t',1.0);
dx := grep (read_command_arg ('d',"0.1:0.1:0.1"),re_real_seq,1,fail=>0.1);
dy := grep (read_command_arg ('d',"0.1:0.1:0.1"),re_real_seq,3,fail=>0.1);
dz := grep (read_command_arg ('d',"0.1:0.1:0.1"),re_real_seq,5,fail=>0.1);
num_x := grep (read_command_arg ('n',"20x20x20"),re_intg_seq,1,fail=>20);
num_y := grep (read_command_arg ('n',"20x20x20"),re_intg_seq,2,fail=>20);
num_z := grep (read_command_arg ('n',"20x20x20"),re_intg_seq,3,fail=>20);
the_time := beg_time;
grid_point_num := num_x * num_y * num_z;
end if;
end initialize;
begin
initialize;
echo_command_line;
report_kasner_params;
BSSNBase.Initial.create_grid;
BSSNBase.Initial.create_data;
-- two ways to save the data
-- these use binary format for the data, not for human consumption
-- BSSNBase.Data_IO.write_grid;
-- BSSNBase.Data_IO.write_data;
--
-- BSSNBase.Data_IO.read_grid;
-- BSSNBase.Data_IO.read_data;
-- these use plain text format for the data, safe for humans
BSSNBase.Data_IO.write_grid_fmt;
BSSNBase.Data_IO.write_data_fmt;
BSSNBase.Data_IO.read_grid_fmt;
BSSNBase.Data_IO.read_data_fmt;
end BSSNInitial;
|
arch/ARM/cortex_m/src/semihosting-filesystem.adb | morbos/Ada_Drivers_Library | 2 | 26802 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, 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 the copyright holder 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. --
-- --
------------------------------------------------------------------------------
package body Semihosting.Filesystem is
-----------------
-- Create_Node --
-----------------
overriding function Create_Node
(This : in out SHFS;
Path : Pathname;
Kind : File_Kind)
return Status_Kind
is
pragma Unreferenced (This, Path, Kind);
begin
return Read_Only_File_System;
end Create_Node;
----------------------
-- Create_Directory --
----------------------
overriding function Create_Directory
(This : in out SHFS;
Path : Pathname)
return Status_Kind
is
pragma Unreferenced (This, Path);
begin
return Read_Only_File_System;
end Create_Directory;
------------
-- Unlink --
------------
overriding function Unlink
(This : in out SHFS;
Path : Pathname)
return Status_Kind
is
pragma Unreferenced (This, Path);
begin
return Read_Only_File_System;
end Unlink;
----------------------
-- Remove_Directory --
----------------------
overriding function Remove_Directory
(This : in out SHFS;
Path : Pathname)
return Status_Kind
is
pragma Unreferenced (This, Path);
begin
return Read_Only_File_System;
end Remove_Directory;
------------
-- Rename --
------------
overriding function Rename
(This : in out SHFS;
Old_Path : Pathname;
New_Path : Pathname)
return Status_Kind
is
pragma Unreferenced (This, Old_Path, New_Path);
begin
return Read_Only_File_System;
end Rename;
------------------------
-- Change_Permissions --
------------------------
overriding function Truncate_File
(This : in out SHFS;
Path : Pathname;
Length : IO_Count)
return Status_Kind
is
pragma Unreferenced (Path, Length, This);
begin
return Read_Only_File_System;
end Truncate_File;
----------
-- Open --
----------
overriding function Open
(This : in out SHFS;
Path : Pathname;
Mode : File_Mode;
Handler : out Any_File_Handle)
return Status_Kind
is
FH : SHFS_File_Handle_Access;
FD : SH_Word;
begin
if Path'Length = 0 then
return No_Such_File_Or_Directory;
end if;
if Mode /= Read_Only then
return Permission_Denied;
end if;
FD := Semihosting.Open (Filename => Path,
Mode => OPEN_FLAG_RB);
if FD = SH_Word'Last then
return No_Such_File_Or_Directory;
else
FH := This.Get_File_Handle;
FH.FD := FD;
FH.Is_Open := True;
Handler := Any_File_Handle (FH);
return Status_Ok;
end if;
end Open;
--------------------
-- Open_Directory --
--------------------
overriding function Open_Directory
(This : in out SHFS;
Path : Pathname;
Handle : out Any_Directory_Handle)
return Status_Kind
is
pragma Unreferenced (This, Path, Handle);
begin
return Operation_Not_Permitted;
end Open_Directory;
---------------------
-- Get_File_Handle --
---------------------
function Get_File_Handle (This : in out SHFS)
return not null SHFS_File_Handle_Access
is
Ret : SHFS_File_Handle_Access := This.File_Handles;
begin
-- Try to find a free handle
while Ret /= null and then Ret.Is_Open loop
Ret := Ret.Next;
end loop;
-- Allocate a new handle
if Ret = null then
Ret := new SHFS_File_Handle;
Ret.Is_Open := False;
Ret.Next := This.File_Handles;
This.File_Handles := Ret;
end if;
return Ret;
end Get_File_Handle;
----------
-- Read --
----------
overriding function Read
(This : in out SHFS_File_Handle;
Data : out UInt8_Array)
return Status_Kind
is
begin
if not This.Is_Open then
return Invalid_Argument;
end if;
if Semihosting.Read (File_Handle => This.FD,
Buffer_Address => Data'Address,
Buffer_Size => Data'Length) /= 0
then
return Input_Output_Error;
else
return Status_Ok;
end if;
end Read;
-----------
-- Write --
-----------
overriding function Write
(This : in out SHFS_File_Handle;
Data : UInt8_Array)
return Status_Kind
is
pragma Unreferenced (Data);
begin
if not This.Is_Open then
return Invalid_Argument;
end if;
return Permission_Denied;
end Write;
----------
-- Seek --
----------
overriding function Seek
(This : in out SHFS_File_Handle;
Offset : IO_Count)
return Status_Kind
is
begin
if not This.Is_Open then
return Invalid_Argument;
end if;
if Semihosting.Seek (File_Handle => This.FD,
Absolute_Position => SH_Word (Offset)) /= 0
then
return Input_Output_Error;
else
return Status_Ok;
end if;
end Seek;
-----------
-- Close --
-----------
overriding function Close
(This : in out SHFS_File_Handle)
return Status_Kind
is
begin
if not This.Is_Open then
return Invalid_Argument;
end if;
if Semihosting.Close (This.FD) /= 0 then
return Invalid_Argument;
else
This.Is_Open := False;
return Status_Ok;
end if;
end Close;
end Semihosting.Filesystem;
|
Examples/Q4.asm | Pyxxil/rust-lc3-as | 3 | 179524 | <filename>Examples/Q4.asm
;
; Initialization
;
.ORIG x3000
LD R6, EMPTY ; R6 is the stack pointer
LD R5, PTR ; R5 is pointer to characters
AND R0, R0, #0
ADD R0, R0, #10 ; Print a new line
OUT
;
REDO LDR R3, R5, #0 ; R3 gets character
;
; Test character for end of file
;
ADD R4, R3, #-10 ; Test for end of line (ASCII xA)
BRz EXIT ; If done, quit
LD R4, ZERO
ADD R3, R3, R4 ; Get the decimal value from ASCII to R3
JSR CONV
ADD R5, R5, #1
LD R0, FACTOR ; '!'
OUT
LD R0, EQUAL ; '='
OUT
; Start calculation (The operand is at R3)
ADD R4, R3, #0
ADD R1, R3, #-1
; Loop
OLoop AND R2, R2, #0
ILoop ADD R2, R2, R4
ADD R1, R1, #-1
BRp ILoop
ADD R4, R2, #0
ADD R3, R3, #-1
ADD R1, R3, #-1
BRp OLoop
ADD R3, R4, #0
;
JSR CONV
AND R0, R0, #0
ADD R0, R0, #10 ; Print a new line
OUT
BRnzp REDO
;
; A subroutine to output a 3-digit decimal result.
;
CONV ADD R1, R7, #0 ; R3, R4, R5 and R7 are used in this subroutine
JSR Push
ADD R1, R3, #0 ; R3 is the input value
JSR Push
ADD R1, R4, #0
JSR Push
ADD R1, R5, #0
JSR Push
AND R5, R5, #0
OUT100 LD R4, HUNDRED
ADD R4, R3, R4 ; R3 - #100
BRn PRI100
LD R4, HUNDRED
ADD R3, R3, R4 ; R3 - #100
ADD R5, R5, #1
BRnzp OUT100
PRI100 LD R0, ASCII ; Load the ASCII template
ADD R0, R0, R5 ; Convert binary count to ASCII
OUT ; ASCII code in R0 is displayed.
AND R5, R5, #0
OUT10 ADD R4, R3, #-10
BRn PRI10
ADD R3, R3, #-10
ADD R5, R5, #1
BRnzp OUT10
PRI10 LD R0, ASCII ; Load the ASCII template
ADD R0, R0, R5 ; Convert binary count to ASCII
OUT ; ASCII code in R0 is displayed.
LD R0, ASCII
ADD R0, R0, R3 ; Convert binary count to ASCII
OUT ; ASCII code in R0 is displayed.
JSR Pop
ADD R5, R1, #0
JSR Pop
ADD R4, R1, #0
JSR Pop
ADD R3, R1, #0
JSR Pop
ADD R7, R1, #0
RET
EXIT HALT ; Halt machine
Push STR R1, R6, #0 ; Stack Push
ADD R6, R6, #-1
RET
Pop ADD R6, R6, #1 ; Stack Pop
LDR R1, R6, #0
RET
; End of the subroutine
PTR .FILL x3500
EMPTY .FILL x4000
ASCII .FILL x0030 ; '0'
ZERO .FILL xFFD0 ; -'0'
HUNDRED .FILL xFF9C ; -#100
EQUAL .FILL x003D ; '='
PLUS .FILL x002B ; '+'
MINUS .FILL x002D ; '-'
FACTOR .FILL x0021 ; '!'
MULT .FILL x002A ; '*'
VAL .BLKW 1
.END
|
src/el-contexts-default.ads | My-Colaborations/ada-el | 0 | 8656 | <reponame>My-Colaborations/ada-el
-----------------------------------------------------------------------
-- EL.Contexts -- Default contexts for evaluating an expression
-- Copyright (C) 2009, 2010, 2011, 2015 <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 EL.Variables;
with Ada.Finalization;
private with Util.Beans.Objects.Maps;
-- private with EL.Objects.Maps; creates Assert_Failure sem_ch10.adb:2691
package EL.Contexts.Default is
-- ------------------------------
-- Default Context
-- ------------------------------
-- Context information for expression evaluation.
type Default_Context is new Ada.Finalization.Controlled and ELContext with private;
type Default_Context_Access is access all Default_Context'Class;
overriding
procedure Finalize (Obj : in out Default_Context);
-- Retrieves the ELResolver associated with this ELcontext.
overriding
function Get_Resolver (Context : Default_Context) return ELResolver_Access;
-- Retrieves the VariableMapper associated with this ELContext.
overriding
function Get_Variable_Mapper (Context : Default_Context)
return access EL.Variables.Variable_Mapper'Class;
-- Retrieves the FunctionMapper associated with this ELContext.
-- The FunctionMapper is only used when parsing an expression.
overriding
function Get_Function_Mapper (Context : Default_Context)
return EL.Functions.Function_Mapper_Access;
-- Set the function mapper to be used when parsing an expression.
overriding
procedure Set_Function_Mapper (Context : in out Default_Context;
Mapper : access EL.Functions.Function_Mapper'Class);
-- Set the VariableMapper associated with this ELContext.
overriding
procedure Set_Variable_Mapper (Context : in out Default_Context;
Mapper : access EL.Variables.Variable_Mapper'Class);
-- Set the ELResolver associated with this ELcontext.
procedure Set_Resolver (Context : in out Default_Context;
Resolver : in ELResolver_Access);
procedure Set_Variable (Context : in out Default_Context;
Name : in String;
Value : access Util.Beans.Basic.Readonly_Bean'Class);
-- Handle the exception during expression evaluation.
overriding
procedure Handle_Exception (Context : in Default_Context;
Ex : in Ada.Exceptions.Exception_Occurrence);
-- ------------------------------
-- Guarded Context
-- ------------------------------
-- The <b>Guarded_Context</b> is a proxy context that allows to handle exceptions
-- raised when evaluating expressions. The <b>Handler</b> procedure will be called
-- when an exception is raised when the expression is evaluated. This allows to
-- report an error message and ignore or not the exception (See ASF).
type Guarded_Context (Handler : not null access
procedure (Ex : in Ada.Exceptions.Exception_Occurrence);
Context : ELContext_Access)
is new Ada.Finalization.Limited_Controlled and ELContext with null record;
type Guarded_Context_Access is access all Default_Context'Class;
-- Retrieves the ELResolver associated with this ELcontext.
overriding
function Get_Resolver (Context : in Guarded_Context) return ELResolver_Access;
-- Retrieves the Variable_Mapper associated with this ELContext.
overriding
function Get_Variable_Mapper (Context : in Guarded_Context)
return access EL.Variables.Variable_Mapper'Class;
-- Retrieves the Function_Mapper associated with this ELContext.
-- The Function_Mapper is only used when parsing an expression.
overriding
function Get_Function_Mapper (Context : in Guarded_Context)
return EL.Functions.Function_Mapper_Access;
-- Set the function mapper to be used when parsing an expression.
overriding
procedure Set_Function_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Functions.Function_Mapper'Class);
-- Set the Variable_Mapper associated with this ELContext.
overriding
procedure Set_Variable_Mapper (Context : in out Guarded_Context;
Mapper : access EL.Variables.Variable_Mapper'Class);
-- Handle the exception during expression evaluation.
overriding
procedure Handle_Exception (Context : in Guarded_Context;
Ex : in Ada.Exceptions.Exception_Occurrence);
-- ------------------------------
-- Default Resolver
-- ------------------------------
type Default_ELResolver is new ELResolver with private;
type Default_ELResolver_Access is access all Default_ELResolver'Class;
-- Get the value associated with a base object and a given property.
overriding
function Get_Value (Resolver : Default_ELResolver;
Context : ELContext'Class;
Base : access Util.Beans.Basic.Readonly_Bean'Class;
Name : Unbounded_String) return EL.Objects.Object;
-- Set the value associated with a base object and a given property.
overriding
procedure Set_Value (Resolver : in out Default_ELResolver;
Context : in ELContext'Class;
Base : access Util.Beans.Basic.Bean'Class;
Name : in Unbounded_String;
Value : in EL.Objects.Object);
-- Register the value under the given name.
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in Util.Beans.Basic.Readonly_Bean_Access);
-- Register the value under the given name.
procedure Register (Resolver : in out Default_ELResolver;
Name : in Unbounded_String;
Value : in EL.Objects.Object);
private
type Default_Context is new Ada.Finalization.Controlled and ELContext with record
Var_Mapper : EL.Variables.Variable_Mapper_Access;
Resolver : ELResolver_Access;
Function_Mapper : EL.Functions.Function_Mapper_Access;
Var_Mapper_Created : Boolean := False;
end record;
type Default_ELResolver is new ELResolver with record
Map : EL.Objects.Maps.Map;
end record;
end EL.Contexts.Default;
|
3-mid/opengl/source/lean/renderer/opengl-impostor-simple.adb | charlie5/lace-alire | 1 | 9240 | with
openGL.Camera,
openGL.Texture,
ada.unchecked_Deallocation;
package body openGL.Impostor.simple
is
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
if Self /= null
then
destroy (Self.all);
deallocate (Self);
end if;
end free;
overriding
function current_Camera_look_at_Rotation (Self : in Item) return Matrix_3x3
is
begin
return Self.current_Camera_look_at_Rotation;
end current_Camera_look_at_Rotation;
overriding
function update_Required (Self : access Item; the_Camera : access Camera.item'Class) return Boolean
is
use linear_Algebra_3d;
begin
-- Look directly at target so it will be rendered in the centre of the viewport.
--
Self.current_Camera_look_at_Rotation := get_Rotation (look_at (the_Camera.Site,
get_Translation (Self.Target.Transform),
-- get_Translation (Self.Target.model_Transform),
(0.0, 1.0, 0.0)));
Self.current_pixel_Region := Self.get_pixel_Region (camera_Spin => Self.current_Camera_look_at_Rotation,
camera_Site => the_Camera.Site,
camera_projection_Transform => the_Camera.projection_Transform,
camera_Viewport => the_Camera.Viewport);
declare
update_Required : Boolean := Self.general_Update_required (the_Camera.Site,
Self.current_pixel_Region);
begin
if not update_Required
and then Self.size_Update_required (Self.current_pixel_Region)
then
update_Required := True;
end if;
if Update_required
then
Self.current_Width_pixels := Self.current_pixel_Region.Width; -- Cache current state.
Self.current_Height_pixels := Self.current_pixel_Region.Height;
Self.current_copy_X := Self.current_pixel_Region.X;
Self.current_copy_Y := Self.current_pixel_Region.Y;
Self.current_copy_Width := Self.current_pixel_Region.Width;
Self.current_copy_Height := Self.current_pixel_Region.Height;
end if;
return update_Required;
end;
end update_Required;
overriding
procedure pre_update (Self : in out Item; the_Camera : access Camera.item'Class)
is
begin
Self.camera_world_Rotation_original := the_Camera.Spin;
the_Camera.Spin_is (Self.current_Camera_look_at_Rotation);
end pre_update;
overriding
procedure update (Self : in out Item; the_Camera : access Camera.item'Class;
texture_Pool : in Texture.Pool_view)
is
world_Rotation_original : constant Matrix_3x3 := the_Camera.Spin;
begin
the_Camera.Spin_is (Self.current_Camera_look_at_Rotation);
Impostor.item (Self).update (the_Camera, texture_Pool); -- Base class 'update'.
the_Camera.Spin_is (world_Rotation_original);
end update;
overriding
procedure post_update (Self : in out Item; the_Camera : access Camera.item'Class)
is
begin
the_Camera.Spin_is (Self.camera_world_Rotation_original);
end post_update;
end openGL.Impostor.simple;
|
day04/day04.adb | thorstel/Advent-of-Code-2018 | 2 | 6250 | with Ada.Assertions; use Ada.Assertions;
with Ada.Containers.Ordered_Maps; use Ada.Containers;
with Ada.Text_IO; use Ada.Text_IO;
with Input; use Input;
procedure Day04 is
type Hour is array (Natural range 0 .. 59) of Natural;
package Time_Maps is new Ordered_Maps (Key_Type => Natural,
Element_Type => Hour);
Time_Table : Time_Maps.Map;
Most_Minutes_Guard : Natural := 0;
Most_Minutes_Max_Minute : Natural := 0;
Most_Minutes_Count : Natural := 0;
Most_In_Minute_Guard : Natural := 0;
Most_In_Minute_Count : Natural := 0;
Most_In_Minute : Natural := 0;
begin
-- Input Setup
declare
Current_Guard : Natural := 0;
Sleep_Start : Natural range 0 .. 59 := 0;
begin
for Repose_Record of Repose_Records loop
if Repose_Record.Action = Shift_Start then
Current_Guard := Repose_Record.Data;
elsif Repose_Record.Action = Fall_Asleep then
Sleep_Start := Repose_Record.Data;
elsif Repose_Record.Action = Wake_Up then
if not Time_Table.Contains (Current_Guard) then
Time_Table.Insert (Current_Guard, (others => 0));
end if;
declare
Current_Hour : Hour := Time_Table.Element (Current_Guard);
begin
for S in Sleep_Start .. (Repose_Record.Data - 1) loop
Current_Hour (S) := Current_Hour (S) + 1;
end loop;
Time_Table.Replace (Current_Guard, Current_Hour);
end;
else
Assert (False, "This should not happen!");
end if;
end loop;
end;
-- Part 1 & 2
for C in Time_Table.Iterate loop
declare
Max_Minute : Natural := 0;
Minute_Count : Natural := 0;
begin
for I in 0 .. 59 loop
Minute_Count := Minute_Count + Time_Maps.Element (C) (I);
if Time_Maps.Element (C) (I) > Time_Maps.Element (C) (Max_Minute) then
Max_Minute := I;
end if;
if Time_Maps.Element (C) (I) > Most_In_Minute_Count then
Most_In_Minute := I;
Most_In_Minute_Guard := Time_Maps.Key (C);
Most_In_Minute_Count := Time_Maps.Element (C) (I);
end if;
end loop;
if Minute_Count > Most_Minutes_Count then
Most_Minutes_Guard := Time_Maps.Key (C);
Most_Minutes_Count := Minute_Count;
Most_Minutes_Max_Minute := Max_Minute;
end if;
end;
end loop;
Put_Line ("Part 1 =" & Natural'Image (Most_Minutes_Guard * Most_Minutes_Max_Minute));
Put_Line ("Part 2 =" & Natural'Image (Most_In_Minute_Guard * Most_In_Minute));
end Day04;
|
CPU/functions/timer/mips1.asm | SilenceX12138/MIPS-Microsystems | 55 | 87299 | <reponame>SilenceX12138/MIPS-Microsystems
#cal_set={add,sub,or,and,sll,sllv,srl,srlv}
#Timer 0x7f00-0x7f0b
#UART 0x7f10-0x7f2b
#Switch 0x7f2c-0x7f33
#LED 0x7f34-0x7f37
#Tube 0x7f38-0x7f3f
#Key <KEY>
.text
initial:
li $t0,0xfc01 #allow all IRQ
mtc0 $t0,$12
li $t0,0xffffffff #set timer continuously count mode
sw $t0,0x7f00($0)
li $t0,10000000 #set count-down time for timer
sw $t0,0x7f04($0)
wait_key:
j wait_key
nop
.ktext 0x4180
lw $k0,0($0) #use $k0 as old val to count down
lw $k1,0x7f2c($0) #use $k1 as new val to count down
lw $t2,0x7f38($0) #use $t2 as tube's current val
bne $k0,$k1,reset
nop
beq $t2,$0,reset
nop
lw $t2,0x7f38($0)
addiu $t2,$t2,-1
sw $t2,0x7f38($0)
j return
nop
reset:
lw $k1,0x7f2c($0)
sw $k1,0($0)
sw $k1,0x7f38($0)
j return
nop
return:
eret
|
src/to-string.agda | ice1k/cedille | 0 | 1503 | import cedille-options
module to-string (options : cedille-options.options) where
open import cedille-types
open import constants
open import syntax-util
open import ctxt
open import rename
open import general-util
open import datatype-util
open import type-util
open import free-vars
open import json
data expr-side : Set where
left : expr-side
right : expr-side
neither : expr-side
is-left : expr-side → 𝔹
is-left left = tt
is-left _ = ff
is-right : expr-side → 𝔹
is-right right = tt
is-right _ = ff
exprd-eq : exprd → exprd → 𝔹
exprd-eq TERM TERM = tt
exprd-eq TYPE TYPE = tt
exprd-eq KIND KIND = tt
exprd-eq _ _ = ff
is-eq-op : {ed : exprd} → ⟦ ed ⟧ → 𝔹
is-eq-op{TERM} (VarSigma _) = tt
is-eq-op{TERM} (Rho _ _ _ _) = tt
is-eq-op{TERM} (Phi _ _ _) = tt
is-eq-op{TERM} (Delta _ _ _) = tt
is-eq-op _ = ff
pattern arrow-var = "_arrow_"
pattern TpArrow tp me tp' = TpAbs me arrow-var (Tkt tp) tp'
pattern KdArrow tk kd = KdAbs arrow-var tk kd
is-arrow : {ed : exprd} → ⟦ ed ⟧ → 𝔹
is-arrow {TYPE} (TpArrow _ _ _) = tt
is-arrow {KIND} (KdArrow _ _) = tt
is-arrow _ = ff
is-type-level-app : ∀ {ed} → ⟦ ed ⟧ → 𝔹
is-type-level-app {TYPE} (TpApp T tT) = tt
is-type-level-app _ = ff
{- need-parens e1 e2 s
returns tt iff we need parens when e1 occurs as the given
side s of parent expression e2. -}
need-parens : {ed : exprd} → {ed' : exprd} → ⟦ ed ⟧ → ⟦ ed' ⟧ → expr-side → 𝔹
need-parens {TYPE} {TYPE} (TpAbs _ _ _ _) (TpArrow _ _ _) left = tt
need-parens {TYPE} {TYPE} (TpIota _ _ _) (TpArrow _ _ _) left = tt
need-parens {KIND} {KIND} (KdAbs _ _ _) (KdArrow _ _) left = tt
need-parens {TYPE} {KIND} (TpAbs _ _ _ _) (KdArrow _ _) left = tt
need-parens {TYPE} {KIND} (TpIota _ _ _) (KdArrow _ _) left = tt
need-parens {TERM} {_} (Var x) p lr = ff
need-parens {TERM} {_} (Hole pi) p lr = ff
need-parens {TERM} {_} (IotaPair t₁ t₂ x Tₓ) p lr = ff
need-parens {TERM} {_} (IotaProj t n) p lr = ff
need-parens {TYPE} {_} (TpVar x) p lr = ff
need-parens {TYPE} {_} (TpEq t₁ t₂) p lr = ff
need-parens {TYPE} {_} (TpHole pi) p lr = ff
need-parens {KIND} {_} (KdHole pi) p lr = ff
need-parens {KIND} {_} KdStar p lr = ff
need-parens {_} {TERM} _ (IotaPair t₁ t₂ x Tₓ) lr = ff
need-parens {_} {TYPE} _ (TpEq t₁ t₂) lr = ff
need-parens {_} {TERM} _ (Beta ot ot') lr = ff
need-parens {_} {TERM} _ (Phi tₑ t₁ t₂) lr = is-left lr
need-parens {_} {TERM} _ (Rho _ _ _ _) right = ff
need-parens {_} {TERM} _ (Delta _ _ _) right = ff
need-parens {_} {TERM} _ (LetTm _ _ _ _ _) lr = ff
need-parens {_} {TERM} _ (LetTp _ _ _ _) lr = ff
need-parens {_} {TERM} _ (Lam _ _ _ _) lr = ff
need-parens {_} {TERM} _ (Mu _ _ _ _ _) right = ff
need-parens {_} {TYPE} _ (TpLam _ _ _) lr = ff
need-parens {_} {TYPE} _ (TpAbs _ _ _ _) lr = ff
need-parens {_} {KIND} _ (KdAbs _ _ _) neither = ff
need-parens {_} {TYPE} _ (TpIota _ _ _) lr = ff
need-parens {TERM} {_} (App t t') p lr = tt
need-parens {TERM} {_} (AppE t tT) p lr = tt
need-parens {TERM} {_} (Beta ot ot') p lr = ff
need-parens {TERM} {_} (Delta _ T t) p lr = tt
need-parens {TERM} {_} (Lam me x tk? t) p lr = tt
need-parens {TERM} {_} (LetTm me x T t t') p lr = tt
need-parens {TERM} {_} (LetTp x T t t') p lr = tt
need-parens {TERM} {_} (Phi tₑ t₁ t₂) p lr = tt
need-parens {TERM} {_} (Rho tₑ x Tₓ t) p lr = tt
need-parens {TERM} {_} (VarSigma t) p lr = ~ is-eq-op p
need-parens {TERM} {_} (Mu _ _ _ _ _) p lr = tt
need-parens {TERM} {_} (Sigma _ _ _ _ _) p lr = tt
need-parens {TYPE} {e} (TpAbs me x tk T) p lr = ~ exprd-eq e TYPE || ~ is-arrow p || is-left lr
need-parens {TYPE} {_} (TpIota x T₁ T₂) p lr = tt
need-parens {TYPE} {_} (TpApp T tT) p lr = ~ is-arrow p && (~ is-type-level-app p || is-right lr)
need-parens {TYPE} {_} (TpLam x tk T) p lr = tt
need-parens {KIND} {_} (KdAbs x tk k) p lr = ~ is-arrow p || is-left lr
pattern ced-ops-drop-spine = cedille-options.options.mk-options _ _ _ _ ff _ _ _ ff _ _
pattern ced-ops-conv-arr = cedille-options.options.mk-options _ _ _ _ _ _ _ _ ff _ _
pattern ced-ops-conv-abs = cedille-options.options.mk-options _ _ _ _ _ _ _ _ tt _ _
drop-spine : cedille-options.options → {ed : exprd} → ctxt → ⟦ ed ⟧ → ⟦ ed ⟧
drop-spine ops @ ced-ops-drop-spine = h
where
drop-mod-argse : (mod : args) → (actual : args) → args
drop-mod-argse (ArgE _ :: asₘ) (ArgE _ :: asₐ) = drop-mod-argse asₘ asₐ
drop-mod-argse (Arg _ :: asₘ) (Arg t :: asₐ) = drop-mod-argse asₘ asₐ
drop-mod-argse (_ :: asₘ) asₐ@(Arg t :: _) = drop-mod-argse asₘ asₐ
-- ^ Relevant term arg, so wait until we find its corresponding relevant module arg ^
drop-mod-argse _ asₐ = asₐ
drop-mod-args-term : ctxt → var × args → term
drop-mod-args-term Γ (v , as) =
let uqv = unqual-all (ctxt.qual Γ) v in
flip recompose-apps (Var uqv) $
maybe-else' (ifMaybe (~ v =string uqv) $ ctxt-get-qi Γ uqv)
as λ qi → drop-mod-argse (snd qi) as
drop-mod-args-type : ctxt → var × 𝕃 tmtp → type
drop-mod-args-type Γ (v , as) =
let uqv = unqual-all (ctxt.qual Γ) v in
flip recompose-tpapps (TpVar uqv) $
maybe-else' (ifMaybe (~ v =string uqv) $ ctxt-qualif-args-length Γ Erased uqv)
as λ n → drop n as
h : {ed : exprd} → ctxt → ⟦ ed ⟧ → ⟦ ed ⟧
h {TERM} Γ t = maybe-else' (decompose-var-headed t) t (drop-mod-args-term Γ)
h {TYPE} Γ T = maybe-else' (decompose-tpvar-headed T) T (drop-mod-args-type Γ)
h Γ x = x
drop-spine ops Γ x = x
to-string-rewrite : {ed : exprd} → ctxt → cedille-options.options → ⟦ ed ⟧ → Σi exprd ⟦_⟧
to-string-rewrite{TYPE} Γ ced-ops-conv-arr (TpAbs me x (Tkt T) T') = , TpAbs me (if is-free-in x T' then x else arrow-var) (Tkt T) T'
to-string-rewrite{KIND} Γ ced-ops-conv-arr (KdAbs x tk k) = , KdAbs (if is-free-in x k then x else arrow-var) tk k
to-string-rewrite{TERM} Γ ops (VarSigma t) with to-string-rewrite Γ ops t
...| ,_ {TERM} (VarSigma t') = , t'
...| t? = , VarSigma t
to-string-rewrite Γ ops x = , drop-spine ops Γ x
-------------------------------
open import pretty
use-newlines : 𝔹
use-newlines =
~ iszero (cedille-options.options.pretty-print-columns options)
&& cedille-options.options.pretty-print options
doc-to-rope : DOC → rope
doc-to-rope = if use-newlines
then pretty (cedille-options.options.pretty-print-columns options)
else flatten-out
strM : Set
strM = {ed : exprd} → DOC → ℕ → 𝕃 tag → ctxt → maybe ⟦ ed ⟧ → expr-side → DOC × ℕ × 𝕃 tag
strEmpty : strM
strEmpty s n ts Γ pe lr = s , n , ts
to-stringh : {ed : exprd} → ⟦ ed ⟧ → strM
strM-Γ : (ctxt → strM) → strM
strM-Γ f s n ts Γ = f Γ s n ts Γ
infixr 2 _>>str_
_>>str_ : strM → strM → strM
(m >>str m') s n ts Γ pe lr with m s n ts Γ pe lr
(m >>str m') s n ts Γ pe lr | s' , n' , ts' = m' s' n' ts' Γ pe lr
strAdd : string → strM
strAdd s s' n ts Γ pe lr = s' <> TEXT [[ s ]] , n + string-length s , ts
strLine : strM
strLine s n ts Γ pe lr = s <> LINE , suc n , ts
strNest : ℕ → strM → strM
strNest i m s n ts Γ pe lr with m nil n ts Γ pe lr
...| s' , n' , ts' = s <> nest i s' , n' , ts'
strFold' : (ℕ → ℕ) → {ed : exprd} → 𝕃 (ℕ × strM) → ℕ → 𝕃 tag → ctxt → maybe ⟦ ed ⟧ → expr-side → 𝕃 (ℕ × DOC) × ℕ × 𝕃 tag
strFold' l [] n ts Γ pe lr = [] , n , ts
strFold' l ((i , x) :: []) n ts Γ pe lr with x nil n ts Γ pe lr
...| sₓ , nₓ , tsₓ = [ i , sₓ ] , nₓ , tsₓ
strFold' l ((i , x) :: xs) n ts Γ pe lr with x nil n ts Γ pe lr
...| sₓ , nₓ , tsₓ with strFold' l xs (l nₓ) tsₓ Γ pe lr
...| sₓₛ , nₓₛ , tsₓₛ = (i , sₓ) :: sₓₛ , nₓₛ , tsₓₛ
strFold : (ℕ → ℕ) → (𝕃 (ℕ × DOC) → DOC) → 𝕃 (ℕ × strM) → strM
strFold l f ms s n ts Γ pe lr with strFold' l ms n ts Γ pe lr
...| s' , n' , ts' = s <> f s' , n' , ts'
strFoldi : ℕ → (ℕ → ℕ) → (𝕃 DOC → DOC) → 𝕃 strM → strM
strFoldi i l f = strNest i ∘' strFold suc (f ∘' map snd) ∘' map (_,_ 0)
-- Either fit all args on one line, or give each their own line
strList : ℕ → 𝕃 strM → strM
strList i = strFoldi i suc λ ms → flatten (spread ms) :<|> stack ms
-- Fit as many args on each line as possible
-- (n = number of strM args)
-- (𝕃 strM so that optional args (nil) are possible)
strBreak : (n : ℕ) → fold n strM λ X → ℕ → 𝕃 strM → X
strBreak = h [] where
h : 𝕃 (ℕ × strM) → (n : ℕ) → fold n strM λ X → ℕ → 𝕃 strM → X
h ms (suc n) i m = h (map (_,_ i) m ++ ms) n
h ms zero = strFold suc filln $ reverse ms
strBracket : char → strM → char → strM
strBracket l m r s n ts Γ pe lr with m nil (suc (suc n)) ts Γ pe lr
...| s' , n' , ts' = s <> bracket (char-to-string l) s' (char-to-string r) , suc (suc n') , ts'
strΓ' : defScope → var → strM → strM
strΓ' ds v m s n ts Γ =
let gl = ds iff globalScope
v' = if gl then (ctxt.mn Γ # v) else v in
m s n ts
(record Γ {
qual = qualif-insert-params (ctxt.qual Γ) v' (unqual-local v) (if gl then ctxt.ps Γ else []);
i = trie-insert (ctxt.i Γ) v' (var-decl , missing-location)
})
strΓ : var → strM → strM
strΓ x m s n ts Γ = m s n ts (ctxt-var-decl x Γ)
ctxt-get-file-id : ctxt → (filename : string) → ℕ
ctxt-get-file-id = trie-lookup-else 0 ∘ ctxt.id-map
make-loc-tag : ctxt → (filename start-to end-to : string) → (start-from end-from : ℕ) → tag
make-loc-tag Γ fn s e = make-tag "loc"
(("fn" , json-nat (ctxt-get-file-id Γ fn)) ::
("s" , json-raw [[ s ]]) :: ("e" , json-raw [[ e ]]) :: [])
var-loc-tag : ctxt → location → var → 𝕃 (string × 𝕃 tag)
var-loc-tag Γ ("missing" , "missing") x = []
var-loc-tag Γ ("" , _) x = []
var-loc-tag Γ (_ , "") x = []
var-loc-tag Γ (fn , pi) x =
let fn-tag = "fn" , json-nat (ctxt-get-file-id Γ fn)
s-tag = "s" , json-raw [[ pi ]]
e-tag = "e" , json-raw [[ posinfo-plus-str pi x ]] in
[ "loc" , fn-tag :: s-tag :: e-tag :: [] ]
var-tags : ctxt → var → var → 𝕃 (string × 𝕃 tag)
var-tags Γ qv uqv =
(if qv =string qualif-var Γ uqv then id else ("shadowed" , []) ::_)
(var-loc-tag Γ (ctxt-var-location Γ qv) uqv)
strAddTags : string → 𝕃 (string × 𝕃 tag) → strM
strAddTags sₙ tsₙ sₒ n tsₒ Γ pe lr =
let n' = n + string-length sₙ in
sₒ <> TEXT [[ sₙ ]] , n' , map (uncurry λ k vs → make-tag k vs n n') tsₙ ++ tsₒ
strVar : var → strM
strVar v = strM-Γ λ Γ →
let uqv = unqual-local v -- $ unqual-all (ctxt-get-qualif Γ) v
uqv' = if cedille-options.options.show-qualified-vars options then v else uqv in
strAddTags uqv' (var-tags Γ (qualif-var Γ v) uqv)
strKvar : var → strM
strKvar v = strM-Γ λ Γ → strVar (unqual-all (ctxt.qual Γ) v)
-- Only necessary to unqual-local because of module parameters
strBvar : var → (class body : strM) → strM
strBvar v cm bm = strAdd (unqual-local v) >>str cm >>str strΓ' localScope v bm
strMetaVar : var → span-location → strM
strMetaVar x (fn , pi , pi') s n ts Γ pe lr =
let n' = n + string-length x in
s <> TEXT [[ x ]] , n' , make-loc-tag Γ fn pi pi' n n' :: ts
{-# TERMINATING #-}
term-to-stringh : term → strM
type-to-stringh : type → strM
kind-to-stringh : kind → strM
ctr-to-string : ctr → strM
case-to-string : case → strM
cases-to-string : cases → strM
caseArgs-to-string : case-args → strM → strM
params-to-string : params → strM
params-to-string' : strM → params → strM
params-to-string'' : params → strM → strM
optTerm-to-string : maybe term → char → char → 𝕃 strM
optClass-to-string : maybe tpkd → strM
optType-to-string : maybe char → maybe type → 𝕃 strM
arg-to-string : arg → strM
args-to-string : args → strM
binder-to-string : erased? → string
lam-to-string : erased? → string
arrowtype-to-string : erased? → string
vars-to-string : 𝕃 var → strM
bracketL : erased? → string
bracketR : erased? → string
braceL : erased? → string
braceR : erased? → string
opacity-to-string : opacity → string
hole-to-string : posinfo → strM
to-string-ed : {ed : exprd} → ⟦ ed ⟧ → strM
to-string-ed{TERM} = term-to-stringh
to-string-ed{TYPE} = type-to-stringh
to-string-ed{KIND} = kind-to-stringh
to-stringh' : {ed : exprd} → expr-side → ⟦ ed ⟧ → strM
to-stringh' {ed} lr t {ed'} s n ts Γ mp lr' =
elim-Σi (to-string-rewrite Γ options t) λ t' →
parens-if (maybe𝔹 mp (λ pe → need-parens t' pe lr)) (to-string-ed t') s n ts Γ (just t') lr
where
parens-if : 𝔹 → strM → strM
parens-if p s = if p then (strAdd "(" >>str strNest 1 s >>str strAdd ")") else s
to-stringl : {ed : exprd} → ⟦ ed ⟧ → strM
to-stringr : {ed : exprd} → ⟦ ed ⟧ → strM
to-stringl = to-stringh' left
to-stringr = to-stringh' right
to-stringh = to-stringh' neither
set-parent : ∀ {ed} → ⟦ ed ⟧ → strM → strM
set-parent t m s n ts Γ _ lr = m s n ts Γ (just t) lr
apps-to-string : ∀ {ll : 𝔹} → (if ll then term else type) → strM
apps-to-string {tt} t with decompose-apps t
...| tₕ , as = set-parent t $ strList 2
(to-stringl tₕ :: map arg-to-string as)
apps-to-string {ff} T with decompose-tpapps T
...| Tₕ , as = set-parent T $ strList 2
(to-stringl Tₕ :: map arg-to-string (tmtps-to-args ff as))
lams-to-string : term → strM
lams-to-string t =
elim-pair (decompose-lams-pretty t) λ xs b →
set-parent t $ strFold suc filln $ foldr {B = 𝕃 (ℕ × strM)}
(λ {(x , me , oc) r →
(1 , (strAdd (lam-to-string me) >>str strAdd " " >>str
strBvar x (strNest 4 (optClass-to-string oc)) (strAdd " ."))) ::
map (map-snd $ strΓ' localScope x) r}) [ 2 , to-stringr b ] xs
where
decompose-lams-pretty : term → 𝕃 (var × erased? × maybe tpkd) × term
decompose-lams-pretty = h [] where
h : 𝕃 (var × erased? × maybe tpkd) → term → 𝕃 (var × erased? × maybe tpkd) × term
h acc (Lam me x oc t) = h ((x , me , oc) :: acc) t
h acc t = reverse acc , t
term-to-stringh (App t t') = apps-to-string (App t t')
term-to-stringh (AppE t tT) = apps-to-string (AppE t tT)
term-to-stringh (Beta t t') = strBreak 3
0 [ strAdd "β" ]
2 [ strAdd "<" >>str to-stringh (erase t ) >>str strAdd ">" ]
2 [ strAdd "{" >>str to-stringh (erase t') >>str strAdd "}" ]
term-to-stringh (Delta _ T t) = strBreak 3
0 [ strAdd "δ" ]
2 [ to-stringl T >>str strAdd " -" ]
1 [ to-stringr t ]
term-to-stringh (Hole pi) = hole-to-string pi
term-to-stringh (IotaPair t₁ t₂ x Tₓ) = strBreak 3
1 [ strAdd "[ " >>str to-stringh t₁ >>str strAdd "," ]
1 [ to-stringh t₂ ]
1 [ strAdd "@ " >>str
strBvar x (strAdd " . ") (strNest (5 + string-length x) (to-stringh Tₓ)) >>str
strAdd " ]" ]
term-to-stringh (IotaProj t n) = to-stringh t >>str strAdd (if n iff ι1 then ".1" else ".2")
term-to-stringh (Lam me x oc t) = lams-to-string (Lam me x oc t)
term-to-stringh (LetTm me x T t t') = strBreak 4
1 [ strAdd (bracketL me) >>str strAdd (unqual-local x) ]
5 ( optType-to-string (just ':') T )
3 [ strAdd "= " >>str to-stringh t >>str strAdd (bracketR me) ]
1 [ strΓ' localScope x (to-stringr t') ]
term-to-stringh (LetTp x k T t) = strBreak 4
1 [ strAdd (bracketL NotErased) >>str strAdd (unqual-local x) ]
5 [ strAdd ": " >>str to-stringh k ]
3 [ strAdd "= " >>str to-stringh T >>str strAdd (bracketR NotErased) ]
1 [ strΓ' localScope x (to-stringr t) ]
term-to-stringh (Phi tₑ t₁ t₂) = strBreak 3
0 [ strAdd "φ " >>str to-stringl tₑ >>str strAdd " -" ]
2 [ to-stringh t₁ ]
2 [ strAdd "{ " >>str to-stringr (erase t₂) >>str strAdd " }" ]
term-to-stringh (Rho tₑ x Tₓ t) = strBreak 3
0 [ strAdd "ρ " >>str to-stringl tₑ ]
1 [ strAdd "@ " >>str strBvar x (strAdd " . ") (to-stringh (erase Tₓ)) ]
1 [ strAdd "- " >>str strNest 2 (to-stringr t) ]
term-to-stringh (VarSigma t) = strAdd "ς " >>str to-stringh t
term-to-stringh (Var x) = strVar x
term-to-stringh (Mu x t ot t~ cs) =
strAdd "μ " >>str
strBvar x
(strAdd " . " >>str strBreak 2
2 [ to-stringl t ]
3 ( optType-to-string (just '@') ot ))
(strAdd " " >>str strBracket '{' (cases-to-string cs) '}')
term-to-stringh (Sigma ot t oT t~ cs) =
strAdd "σ " >>str strBreak 3
2 (maybe-else' {B = 𝕃 strM} ot []
λ t → [ strAdd "<" >>str to-stringh t >>str strAdd ">" ])
2 [ to-stringl t ]
3 ( optType-to-string (just '@') oT ) >>str
strAdd " " >>str strBracket '{' (cases-to-string cs) '}'
type-to-stringh (TpArrow T a T') = strBreak 2
2 [ to-stringl T >>str strAdd (arrowtype-to-string a) ]
2 [ to-stringr T' ]
type-to-stringh (TpAbs me x tk T) = strBreak 2
3 [ strAdd (binder-to-string me ^ " ") >>str
strBvar x (strAdd " : " >>str to-stringl -tk' tk >>str strAdd " .") strEmpty ]
1 [ strΓ' localScope x (to-stringh T) ]
type-to-stringh (TpIota x T₁ T₂) = strBreak 2
2 [ strAdd "ι " >>str
strBvar x (strAdd " : " >>str to-stringh T₁ >>str strAdd " .") strEmpty ]
2 [ strΓ' localScope x (to-stringh T₂) ]
type-to-stringh (TpApp T tT) = apps-to-string (TpApp T tT)
type-to-stringh (TpEq t₁ t₂) = strBreak 2
2 [ strAdd "{ " >>str to-stringh (erase t₁) ]
2 [ strAdd "≃ " >>str to-stringh (erase t₂) >>str strAdd " }" ]
type-to-stringh (TpHole pi) = hole-to-string pi
type-to-stringh (TpLam x tk T) = strBreak 2
3 [ strAdd "λ " >>str
strBvar x (strAdd " : " >>str to-stringh -tk' tk >>str strAdd " .") strEmpty ]
1 [ strΓ' localScope x (to-stringr T) ]
type-to-stringh (TpVar x) = strVar x
kind-to-stringh (KdArrow k k') = strBreak 2
2 [ to-stringl -tk' k >>str strAdd " ➔" ]
2 [ to-stringr k' ]
kind-to-stringh (KdAbs x tk k) = strBreak 2
4 [ strAdd "Π " >>str
strBvar x (strAdd " : " >>str to-stringl -tk' tk >>str strAdd " .") strEmpty ]
1 [ strΓ' localScope x (to-stringh k) ]
kind-to-stringh (KdHole pi) = hole-to-string pi
kind-to-stringh KdStar = strAdd "★"
hole-to-string pi = strM-Γ λ Γ → strAddTags "●" (var-loc-tag Γ (split-var pi) "●")
optTerm-to-string nothing c1 c2 = []
optTerm-to-string (just t) c1 c2 =
[ strAdd (𝕃char-to-string (c1 :: [ ' ' ])) >>str
to-stringh t >>str
strAdd (𝕃char-to-string (' ' :: [ c2 ])) ]
optClass-to-string nothing = strEmpty
optClass-to-string (just atk) = strAdd " : " >>str to-stringh -tk' atk
optType-to-string pfx nothing = []
optType-to-string pfx (just T) =
[ maybe-else strEmpty (λ pfx → strAdd (𝕃char-to-string (pfx :: [ ' ' ]))) pfx >>str to-stringh T ]
arg-to-string (Arg t) = to-stringr t
arg-to-string (ArgE (Ttm t)) = strAdd "-" >>str strNest 1 (to-stringr t)
arg-to-string (ArgE (Ttp T)) = strAdd "·" >>str strNest 2 (to-stringr T)
args-to-string = set-parent (App (Hole pi-gen) (Hole pi-gen)) ∘ foldr' strEmpty λ t x → strAdd " " >>str arg-to-string t >>str x
binder-to-string tt = "∀"
binder-to-string ff = "Π"
lam-to-string tt = "Λ"
lam-to-string ff = "λ"
arrowtype-to-string ff = " ➔"
arrowtype-to-string tt = " ➾"
opacity-to-string opacity-open = ""
opacity-to-string opacity-closed = "opaque "
vars-to-string [] = strEmpty
vars-to-string (v :: []) = strVar v
vars-to-string (v :: vs) = strVar v >>str strAdd " " >>str vars-to-string vs
ctr-to-string (Ctr x T) = strAdd x >>str strAdd " : " >>str to-stringh T
case-to-string (Case x as t _) =
strM-Γ λ Γ →
let as-f = λ x as → strVar x >>str caseArgs-to-string as (strAdd " ➔ " >>str to-stringr t) in
case (env-lookup Γ x , options) of uncurry λ where
(just (ctr-def mps T _ _ _ , _ , _)) ced-ops-drop-spine →
as-f (unqual-all (ctxt.qual Γ) x) as
_ _ → as-f x as
cases-to-string = h use-newlines where
h : 𝔹 → cases → strM
h _ [] = strEmpty
h tt (m :: []) = strAdd "| " >>str case-to-string m
h tt (m :: ms) = strAdd "| " >>str case-to-string m >>str strLine >>str h tt ms
h ff (m :: []) = case-to-string m
h ff (m :: ms) = case-to-string m >>str strAdd " | " >>str h ff ms
caseArgs-to-string [] m = m
caseArgs-to-string (CaseArg _ x (just (Tkk _)) :: as) m = strAdd " ·" >>str strBvar x strEmpty (caseArgs-to-string as m)
caseArgs-to-string (CaseArg ff x _ :: as) m = strAdd " " >>str strBvar x strEmpty (caseArgs-to-string as m)
caseArgs-to-string (CaseArg tt x _ :: as) m = strAdd " -" >>str strBvar x strEmpty (caseArgs-to-string as m)
braceL me = if me then "{" else "("
braceR me = if me then "}" else ")"
bracketL me = if me then "{ " else "[ "
bracketR me = if me then " } -" else " ] -"
param-to-string : param → (strM → strM) × strM
param-to-string (Param me v atk) =
strΓ' localScope v ,
(strAdd (braceL me) >>str
strAdd (unqual-local v) >>str
strAdd " : " >>str
to-stringh -tk' atk >>str
strAdd (braceR me))
params-to-string'' ps f = elim-pair (foldr (λ p → uncurry λ g ms → elim-pair (param-to-string p) λ h m → g ∘ h , m :: map h ms) (id , []) ps) λ g ms → strList 2 (strEmpty :: ms) >>str g f
params-to-string' f [] = f
params-to-string' f (p :: []) = elim-pair (param-to-string p) λ g m → m >>str g f
params-to-string' f (p :: ps) = elim-pair (param-to-string p) λ g m → m >>str strAdd " " >>str params-to-string' (g f) ps
params-to-string = params-to-string' strEmpty
strRun : ctxt → strM → rope
strRun Γ m = doc-to-rope $ fst $ m {TERM} NIL 0 [] Γ nothing neither
strRunTag : (name : string) → ctxt → strM → tagged-val
strRunTag name Γ m with m {TERM} NIL 0 [] Γ nothing neither
...| s , n , ts = name , doc-to-rope s , ts
to-stringe : {ed : exprd} → ⟦ ed ⟧ → strM
to-stringe = to-stringh ∘' (if cedille-options.options.erase-types options then erase else id)
to-string-tag : {ed : exprd} → string → ctxt → ⟦ ed ⟧ → tagged-val
to-string-tag name Γ t = strRunTag name Γ (to-stringe t)
to-string : {ed : exprd} → ctxt → ⟦ ed ⟧ → rope
to-string Γ t = strRun Γ (to-stringh t)
tpkd-to-stringe : tpkd → strM
tpkd-to-stringe = to-stringe -tk'_
tpkd-to-string : ctxt → tpkd → rope
tpkd-to-string Γ atk = strRun Γ (tpkd-to-stringe atk)
params-to-string-tag : string → ctxt → params → tagged-val
params-to-string-tag name Γ ps = strRunTag name Γ (params-to-string ps)
|
notes/fixed-points/LFPs/ListN.agda | asr/fotc | 11 | 4068 | <gh_stars>10-100
------------------------------------------------------------------------------
-- From ListN as the least fixed-point to ListN using data
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- We want to represent the total lists of total natural numbers data
-- type
--
-- data ListN : D → Set where
-- lnnil : ListN []
-- lncons : ∀ {n ns} → N n → ListN ns → ListN (n ∷ ns)
--
-- using the representation of ListN as the least fixed-point.
module LFPs.ListN where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.Nat.Type
open import FOTC.Data.Nat.UnaryNumbers
------------------------------------------------------------------------------
-- ListN is a least fixed-point of a functor
-- The functor.
-- ListNF : (D → Set) → D → Set
-- ListNF P ns = ns ≡ [] ∨ (∃[ n' ] ∃[ ns' ] N n' ∧ ns ≡ n' ∷ ns' ∧ P ns')
-- List is the least fixed-point of ListF.
postulate
ListN : D → Set
-- ListN is a pre-fixed point of ListNF.
--
-- Peter: It corresponds to the introduction rules.
ListN-in : ∀ {ns} →
ns ≡ [] ∨ (∃[ n' ] ∃[ ns' ] N n' ∧ ns ≡ n' ∷ ns' ∧ ListN ns') →
ListN ns
-- ListN is the least pre-fixed point of ListFN.
--
-- Peter: It corresponds to the elimination rule of an inductively
-- defined predicate.
ListN-ind :
(A : D → Set) →
(∀ {ns} → ns ≡ [] ∨ (∃[ n' ] ∃[ ns' ] N n' ∧ ns ≡ n' ∷ ns' ∧ A ns') → A ns) →
∀ {ns} → ListN ns → A ns
------------------------------------------------------------------------------
-- The data constructors of List.
lnnil : ListN []
lnnil = ListN-in (inj₁ refl)
lncons : ∀ {n ns} → N n → ListN ns → ListN (n ∷ ns)
lncons {n} {ns} Nn LNns = ListN-in (inj₂ (n , ns , Nn , refl , LNns))
------------------------------------------------------------------------------
-- The induction principle for List.
ListN-ind' : (A : D → Set) →
A [] →
(∀ n {ns} → N n → A ns → A (n ∷ ns)) →
∀ {ns} → ListN ns → A ns
ListN-ind' A A[] is = ListN-ind A prf
where
prf : ∀ {ns} → ns ≡ [] ∨ (∃[ n' ] ∃[ ns' ] N n' ∧ ns ≡ n' ∷ ns' ∧ A ns') →
A ns
prf (inj₁ ns≡[]) = subst A (sym ns≡[]) A[]
prf (inj₂ (n' , ns' , Nn' , h₁ , Ans')) = subst A (sym h₁) (is n' Nn' Ans')
------------------------------------------------------------------------------
-- Example
ys : D
ys = 0' ∷ 1' ∷ 2' ∷ []
ys-ListN : ListN ys
ys-ListN =
lncons nzero (lncons (nsucc nzero) (lncons (nsucc (nsucc nzero)) lnnil))
|
programs/oeis/120/A120182.asm | neoneye/loda | 22 | 84642 | <gh_stars>10-100
; A120182: a(1)=5; a(n)=floor((34+sum(a(1) to a(n-1)))/6).
; 5,6,7,8,10,11,13,15,18,21,24,28,33,38,45,52,61,71,83,97,113,132,154,179,209,244,285,332,388,452,528,616,718,838,978,1141,1331,1553,1811,2113
add $0,1
mov $1,2
mov $2,2
lpb $0
sub $0,1
add $2,$1
mov $1,6
add $1,$2
div $1,6
add $2,4
lpe
add $1,4
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1421.asm | ljhsiun2/medusa | 9 | 244930 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x11762, %rsi
lea addresses_UC_ht+0x15f62, %rdi
nop
dec %r12
mov $3, %rcx
rep movsq
nop
nop
sub $43772, %r14
lea addresses_A_ht+0x790, %r15
clflush (%r15)
nop
nop
nop
nop
sub $49642, %rcx
movl $0x61626364, (%r15)
xor %rsi, %rsi
lea addresses_UC_ht+0x14762, %rdi
nop
nop
add %r10, %r10
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%rdi)
nop
xor $25131, %r14
lea addresses_UC_ht+0x18822, %rsi
lea addresses_UC_ht+0x1bd62, %rdi
nop
xor %r12, %r12
mov $2, %rcx
rep movsl
nop
and $29919, %rsi
lea addresses_normal_ht+0x17416, %r14
cmp %r15, %r15
mov $0x6162636465666768, %r10
movq %r10, (%r14)
and $64547, %rsi
lea addresses_WC_ht+0x1888a, %rsi
lea addresses_WT_ht+0x6d62, %rdi
nop
nop
nop
nop
cmp %rax, %rax
mov $24, %rcx
rep movsw
nop
sub $58969, %r15
lea addresses_A_ht+0x7962, %r12
nop
nop
nop
add %rcx, %rcx
vmovups (%r12), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdi
nop
nop
nop
nop
nop
xor $44083, %rdi
lea addresses_D_ht+0x15502, %rax
nop
nop
lfence
vmovups (%rax), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r10
nop
nop
nop
nop
nop
and $15732, %r15
lea addresses_WT_ht+0x17d62, %rdi
nop
nop
sub %rcx, %rcx
movw $0x6162, (%rdi)
xor $4531, %rdi
lea addresses_D_ht+0x19162, %rsi
nop
nop
xor $24999, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm5
and $0xffffffffffffffc0, %rsi
vmovaps %ymm5, (%rsi)
nop
nop
cmp $44534, %rax
lea addresses_WT_ht+0x13834, %rsi
lea addresses_UC_ht+0x3e62, %rdi
nop
nop
nop
nop
nop
and $1293, %r12
mov $125, %rcx
rep movsl
nop
sub %rdi, %rdi
lea addresses_WT_ht+0x5162, %rcx
nop
nop
add $4803, %rsi
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
sub %r10, %r10
lea addresses_UC_ht+0x87fa, %r14
nop
nop
cmp $3669, %rax
mov (%r14), %r12d
add $49831, %r15
lea addresses_A_ht+0x1a8a2, %rcx
sub $59941, %r14
movups (%rcx), %xmm5
vpextrq $0, %xmm5, %r10
inc %r12
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r15
push %rbx
push %rsi
// Faulty Load
lea addresses_PSE+0x18562, %r15
nop
add $1764, %rsi
vmovups (%r15), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %r13
lea oracles, %r12
and $0xff, %r13
shlq $12, %r13
mov (%r12,%r13,1), %r13
pop %rsi
pop %rbx
pop %r15
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_PSE', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_PSE', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 5}}
{'dst': {'same': False, 'NT': True, 'AVXalign': True, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 10}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 5}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
src/termu18n.asm | queso-fuego/amateuros | 10 | 26973 | <gh_stars>1-10
;;;
;;; font file - 0-127 for ascii, 10x18 pixels each
;;; based on terminus u18n
;;;
;; Font header - width & height
db 10, 18
times 31*36 - 2 db 0
;; Space
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
2200h,\
2200h,\
2200h,\
2200h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
2200h,\
2200h,\
2200h,\
7F00h,\
2200h,\
2200h,\
2200h,\
2200h,\
7F00h,\
2200h,\
2200h,\
2200h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0800h,\
0800h,\
3E00h,\
4900h,\
4800h,\
4800h,\
4800h,\
3E00h,\
0900h,\
0900h,\
0900h,\
4900h,\
3E00h,\
0800h,\
0800h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7100h,\
5100h,\
7200h,\
0200h,\
0400h,\
0400h,\
0800h,\
0800h,\
1000h,\
1380h,\
2280h,\
2380h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1C00h,\
2200h,\
2200h,\
2200h,\
1400h,\
1880h,\
2480h,\
4300h,\
4100h,\
4100h,\
2280h,\
1C80h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0800h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0400h,\
0800h,\
0800h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
0800h,\
0800h,\
0400h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1000h,\
0800h,\
0800h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
0800h,\
0800h,\
1000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
2200h,\
1400h,\
0800h,\
7F00h,\
0800h,\
1400h,\
2200h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0800h,\
7F00h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0800h,\
1000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7F00h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0100h,\
0100h,\
0200h,\
0200h,\
0400h,\
0400h,\
0800h,\
0800h,\
1000h,\
1000h,\
2000h,\
2000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4300h,\
4500h,\
4900h,\
5100h,\
6100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0800h,\
1800h,\
2800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
0100h,\
0200h,\
0400h,\
0800h,\
1000h,\
2000h,\
4000h,\
7F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
0100h,\
0100h,\
1E00h,\
0100h,\
0100h,\
0100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0100h,\
0300h,\
0500h,\
0900h,\
1100h,\
2100h,\
4100h,\
4100h,\
7F00h,\
0100h,\
0100h,\
0100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7F00h,\
4000h,\
4000h,\
4000h,\
4000h,\
7E00h,\
0100h,\
0100h,\
0100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1E00h,\
2000h,\
4000h,\
4000h,\
4000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7F00h,\
4100h,\
4100h,\
0100h,\
0200h,\
0200h,\
0400h,\
0400h,\
0800h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3F00h,\
0100h,\
0100h,\
0100h,\
0200h,\
3C00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0800h,\
1000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0100h,\
0200h,\
0400h,\
0800h,\
1000h,\
2000h,\
2000h,\
1000h,\
0800h,\
0400h,\
0200h,\
0100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7F00h,\
0000h,\
0000h,\
0000h,\
7F00h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
2000h,\
1000h,\
0800h,\
0400h,\
0200h,\
0100h,\
0100h,\
0200h,\
0400h,\
0800h,\
1000h,\
2000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1C00h,\
2200h,\
4100h,\
4100h,\
0100h,\
0200h,\
0400h,\
0800h,\
0800h,\
0000h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3F00h,\
4080h,\
4080h,\
4780h,\
4880h,\
4880h,\
4880h,\
4980h,\
4680h,\
4000h,\
4000h,\
3F80h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
7F00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
7E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7C00h,\
4200h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4200h,\
7C00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7F00h,\
4000h,\
4000h,\
4000h,\
4000h,\
7C00h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
7F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7F00h,\
4000h,\
4000h,\
4000h,\
4000h,\
7C00h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4000h,\
4000h,\
4000h,\
4F00h,\
4100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
7F00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1C00h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
1C00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0380h,\
0100h,\
0100h,\
0100h,\
0100h,\
0100h,\
0100h,\
0100h,\
2100h,\
2100h,\
2100h,\
1E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4100h,\
4200h,\
4400h,\
4800h,\
5000h,\
6000h,\
6000h,\
5000h,\
4800h,\
4400h,\
4200h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
7F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4080h,\
6180h,\
5280h,\
5280h,\
4C80h,\
4C80h,\
4080h,\
4080h,\
4080h,\
4080h,\
4080h,\
4080h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
6100h,\
5100h,\
4900h,\
4500h,\
4300h,\
4100h,\
4100h,\
4100h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
7E00h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4900h,\
3E00h,\
0200h,\
0100h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
7E00h,\
5000h,\
4800h,\
4400h,\
4200h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4000h,\
4000h,\
3E00h,\
0100h,\
0100h,\
0100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7F00h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
4100h,\
2200h,\
2200h,\
2200h,\
1400h,\
1400h,\
1400h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4080h,\
4080h,\
4080h,\
4080h,\
4080h,\
4080h,\
4C80h,\
4C80h,\
5280h,\
5280h,\
6180h,\
4080h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
2200h,\
2200h,\
1400h,\
0800h,\
0800h,\
1400h,\
2200h,\
2200h,\
4100h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
2200h,\
2200h,\
1400h,\
1400h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
7F00h,\
0100h,\
0100h,\
0200h,\
0400h,\
0800h,\
1000h,\
2000h,\
4000h,\
4000h,\
4000h,\
7F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1C00h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
1000h,\
1C00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
2000h,\
2000h,\
1000h,\
1000h,\
0800h,\
0800h,\
0400h,\
0400h,\
0200h,\
0200h,\
0100h,\
0100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1C00h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
0400h,\
1C00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0800h,\
1400h,\
2200h,\
4100h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7F00h,\
0000h
dw 1000h,\
0800h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
3E00h,\
0100h,\
0100h,\
3F00h,\
4100h,\
4100h,\
4100h,\
4100h,\
3F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
4000h,\
4000h,\
4000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
7E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0100h,\
0100h,\
0100h,\
3F00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
7F00h,\
4000h,\
4000h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0700h,\
0800h,\
0800h,\
3E00h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
3F00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3F00h,\
0100h,\
0100h,\
3E00h
dw 0000h,\
0000h,\
0000h,\
4000h,\
4000h,\
4000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0000h,\
1800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
1C00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0200h,\
0200h,\
0000h,\
0600h,\
0200h,\
0200h,\
0200h,\
0200h,\
0200h,\
0200h,\
0200h,\
0200h,\
2200h,\
2200h,\
1C00h
dw 0000h,\
0000h,\
0000h,\
4000h,\
4000h,\
4000h,\
4100h,\
4200h,\
4400h,\
4800h,\
7000h,\
4800h,\
4400h,\
4200h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
1800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
1C00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7E00h,\
4900h,\
4900h,\
4900h,\
4900h,\
4900h,\
4900h,\
4900h,\
4900h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7E00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
7E00h,\
4000h,\
4000h,\
4000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
3F00h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3F00h,\
0100h,\
0100h,\
0100h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
4F00h,\
5000h,\
6000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
4000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
3E00h,\
4100h,\
4000h,\
4000h,\
3E00h,\
0100h,\
0100h,\
4100h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0800h,\
3E00h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0700h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
2200h,\
2200h,\
1400h,\
1400h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
4900h,\
4900h,\
4900h,\
4900h,\
4900h,\
3E00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
2200h,\
1400h,\
0800h,\
1400h,\
2200h,\
4100h,\
4100h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
4100h,\
3F00h,\
0100h,\
0100h,\
3E00h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7F00h,\
0100h,\
0200h,\
0400h,\
0800h,\
1000h,\
2000h,\
4000h,\
7F00h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0600h,\
0800h,\
0800h,\
0800h,\
0800h,\
3000h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0600h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
3000h,\
0800h,\
0800h,\
0800h,\
0800h,\
0600h,\
0800h,\
0800h,\
0800h,\
0800h,\
0800h,\
3000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
3100h,\
4900h,\
4900h,\
4600h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h
dw 0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
0000h,\
7FC0h
;; Padding for next 512 bytes sector boundary
times 4608-($-$$) db 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.