hexsha stringlengths 40 40 | size int64 6 1.05M | ext stringclasses 3 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 4 232 | max_stars_repo_name stringlengths 7 106 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 7 | max_stars_count int64 1 33.5k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 232 | max_issues_repo_name stringlengths 7 106 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 7 | max_issues_count int64 1 37.5k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 232 | max_forks_repo_name stringlengths 7 106 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 7 | max_forks_count int64 1 12.6k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 6 1.05M | avg_line_length float64 1.16 19.7k | max_line_length int64 2 938k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9066440c718aba3c8e999042723a9e9432acf53d | 58 | asm | Assembly | Lab/hw3_4/Sources/main.asm | asheemchhetri/ECE362 | f144be836356edd0feed18ee542afd9895e1081f | [
"MIT"
] | null | null | null | Lab/hw3_4/Sources/main.asm | asheemchhetri/ECE362 | f144be836356edd0feed18ee542afd9895e1081f | [
"MIT"
] | null | null | null | Lab/hw3_4/Sources/main.asm | asheemchhetri/ECE362 | f144be836356edd0feed18ee542afd9895e1081f | [
"MIT"
] | null | null | null | org $8510
lbra jloop
jloop bra kloop
kloop lbra jloop | 14.5 | 17 | 0.741379 |
7b174b2105f2ab991a1719f6140d899bbdfa1f49 | 2,654 | asm | Assembly | programs/oeis/027/A027658.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/027/A027658.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/027/A027658.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A027658: C(n+2,2)+C(n+4,5).
; 1,4,12,31,71,147,280,498,837,1342,2068,3081,4459,6293,8688,11764,15657,20520,26524,33859,42735,53383,66056,81030,98605,119106,142884,170317,201811,237801,278752,325160,377553,436492,502572,576423,658711,750139,851448,963418,1086869,1222662,1371700,1534929,1713339,1907965,2119888,2350236,2600185,2870960,3163836,3480139,3821247,4188591,4583656,5007982,5463165,5950858,6472772,7030677,7626403,8261841,8938944,9659728,10426273,11240724,12105292,13022255,13993959,15022819,16111320,17262018,18477541,19760590,21113940,22540441,24043019,25624677,27288496,29037636,30875337,32804920,34829788,36953427,39179407,41511383,43953096,46508374,49181133,51975378,54895204,57944797,61128435,64450489,67915424,71527800,75292273,79213596,83296620,87546295,91967671,96565899,101346232,106314026,111474741,116833942,122397300,128170593,134159707,140370637,146809488,153482476,160395929,167556288,174970108,182644059,190584927,198799615,207295144,216078654,225157405,234538778,244230276,254239525,264574275,275242401,286251904,297610912,309327681,321410596,333868172,346709055,359942023,373575987,387619992,402083218,416974981,432304734,448082068,464316713,481018539,498197557,515863920,534027924,552700009,571890760,591610908,611871331,632683055,654057255,676005256,698538534,721668717,745407586,769767076,794759277,820396435,846690953,873655392,901302472,929645073,958696236,988469164,1018977223,1050233943,1082253019,1115048312,1148633850,1183023829,1218232614,1254274740,1291164913,1328918011,1367549085,1407073360,1447506236,1488863289,1531160272,1574413116,1618637931,1663851007,1710068815,1757308008,1805585422,1854918077,1905323178,1956818116,2009420469,2063148003,2118018673,2174050624,2231262192,2289671905,2349298484,2410160844,2472278095,2535669543,2600354691,2666353240,2733685090,2802370341,2872429294,2943882452,3016750521,3091054411,3166815237,3244054320,3322793188,3403053577,3484857432,3568226908,3653184371,3739752399,3827953783,3917811528,4009348854,4102589197,4197556210,4294273764,4392765949,4493057075,4595171673,4699134496,4804970520,4912704945,5022363196,5133970924,5247554007,5363138551,5480750891,5600417592,5722165450,5846021493,5972012982,6100167412,6230512513,6363076251,6497886829,6634972688,6774362508,6916085209,7060169952,7206646140,7355543419,7506891679,7660721055,7817061928,7975944926,8137400925,8301461050
mov $12,$0
mov $14,$0
add $14,1
lpb $14
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
add $11,1
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
add $0,8
mov $7,$0
sub $7,6
bin $7,3
add $7,1
add $10,$7
lpe
add $13,$10
lpe
mov $1,$13
| 91.517241 | 2,326 | 0.838734 |
faae4f0e7175677f6ea6cc1318d550afc9dfbed3 | 7,832 | asm | Assembly | Library/SpecUI/CommonUI/CGadget/copenGadgetComp.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/SpecUI/CommonUI/CGadget/copenGadgetComp.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/SpecUI/CommonUI/CGadget/copenGadgetComp.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/Open (gadgets)
FILE: copenGadgetComp.asm
ROUTINES:
Name Description
---- -----------
GLB OLGadgetCompClass Open look button
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
DESCRIPTION:
$Id: copenGadgetComp.asm,v 1.1 97/04/07 10:54:27 newdeal Exp $
------------------------------------------------------------------------------@
CommonUIClassStructures segment resource
OLGadgetCompClass mask CLASSF_DISCARD_ON_SAVE or \
mask CLASSF_NEVER_SAVED
;this class handles these methods using utility routines in other files.
method VupCreateGState, OLGadgetCompClass, MSG_VIS_VUP_CREATE_GSTATE
method OLGadgetVupQuery, OLGadgetCompClass, MSG_VIS_VUP_QUERY
; method VisCallParent, OLGadgetCompClass, MSG_VIS_VUP_RELEASE_ALL_MENUS
method VisCallParent, OLGadgetCompClass, MSG_VIS_VUP_RELEASE_MENU_FOCUS
method VisCallParent, OLGadgetCompClass, MSG_OL_VUP_MAKE_APPLYABLE
method VisSendToChildren, OLGadgetCompClass, MSG_OL_MAKE_APPLYABLE
method VisSendToChildren, OLGadgetCompClass, MSG_OL_MAKE_NOT_APPLYABLE
if INDENT_BOXED_CHILDREN
method VisCallParent, OLGadgetCompClass, MSG_SPEC_VUP_ADD_GADGET_AREA_LEFT_MARGIN
endif
CommonUIClassStructures ends
;---------------------------------------------------
CommonFunctional segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLGadgetCompGupQuery -- MSG_SPEC_GUP_QUERY for OLGadgetCompClass
DESCRIPTION: Respond to a query traveling up the generic composite tree
PASS:
*ds:si - instance data
es - segment of OLGadgetCompClass
ax - MSG_SPEC_GUP_QUERY
cx - Query type (GenQueryType or SpecGenQueryType)
dx -?
bp - OLBuildFlags
RETURN:
carry - set if query acknowledged, clear if not
bp - OLBuildFlags
cx:dx - vis parent
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
see OLMapGroup for details
if (query = SGQT_BUILD_INFO) {
;Is below a control area: if is a menu or a GenTrigger which
;want to be moved into a GenFile-type object, then send query
;to parent to see if such a beast exists. Return if somebody
;above wants to grab this object. Otherwise, is a plain
;GenTrigger which should stay in this OLCtrl object.
if (MENUABLE) or (HINT_FILE or HINT_EDIT) {
MSG_SPEC_GUP_QUERY(vis parent, SGQT_BUILD_INFO);
if (visParent != NULL) {
return(stuff from parent)
}
}
;Nothing above grabbed object, or object is plain GenTrigger.
;Place inside this OLCtrl object.
TOP_MENU = 0;
SUB_MENU = 0;
visParent = this object;
} else {
send query to superclass (will send to generic parent)
}
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 7/89 Initial version
------------------------------------------------------------------------------@
OLGadgetCompGupQuery method OLGadgetCompClass, MSG_SPEC_GUP_QUERY
cmp cx, SGQT_BUILD_INFO ;can we answer this query?
je OLGadgetCompGUQ_answer ;skip if so...
;we can't answer this query: call super class to handle
mov di, offset OLGadgetCompClass
GOTO ObjCallSuperNoLock
OLGadgetCompGUQ_answer:
EC < call VisCheckVisAssumption >
test bp, mask OLBF_MENUABLE
jz noPromote
;;promote: ;send query to generic parent to see if it wants to grab object
push bp ;save OLBuildFlags in case
;we ignore parent
call GenCallParent
pop di ;di = original OLBuildFlags
mov bx, bp
and bx, mask OLBF_REPLY
cmp bx, OLBR_TOP_MENU shl offset OLBF_REPLY
jz done
cmp bx, OLBR_SUB_MENU shl offset OLBF_REPLY
jz done
mov bp, di ;return original OLBuildFlags
noPromote: ;use this OLGadgetCompClass object as visible parent
mov cx, ds:[LMBH_handle]
mov dx, si
done:
stc ;return query acknowledged
FALL_THRU CommonFunctionalFarRet
OLGadgetCompGupQuery endm
CommonFunctionalFarRet proc far
ret
CommonFunctionalFarRet endp
CommonFunctional ends
KbdNavigation segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLGadgetCompFupKbdChar - MSG_META_FUP_KBD_CHAR handler for OLGadgetCompClass
DESCRIPTION: This method is sent by child which 1) is the focused object
and 2) has received a MSG_META_KBD_CHAR or MSG_META_FUP_KBD_CHAR
which is does not care about. Since we also don't care
about the character, we forward this method up to the
parent in the focus hierarchy.
At this class level, we are assuming the parent in the
focus hierarchy is the visible parent.
PASS: *ds:si = instance data for object
cx = character value
dl = CharFlags
dh = ShiftState
bp low = ToggleState
bp high = scan code
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 2/90 initial version
------------------------------------------------------------------------------@
OLGadgetCompFupKbdChar method OLGadgetCompClass, MSG_META_FUP_KBD_CHAR
GOTO VisCallParent
OLGadgetCompFupKbdChar endm
KbdNavigation ends
CommonFunctional segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLGadgetCompBroadcastForDefaultFocus --
MSG_SPEC_BROADCAST_FOR_DEFAULT_FOCUS handler.
DESCRIPTION: This broadcast method is used to find the object within a window
which has HINT_DEFAULT_FOCUS{_WIN}. We handle here so that
the broadcast can be propogated into GenGadgets which are
inside a window.
PASS: *ds:si = instance data for object
RETURN: ^lcx:dx = OD of object with hint
carry set if broadcast handled
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 3/90 initial version
------------------------------------------------------------------------------@
OLGadgetCompBroadcastForDefaultFocus method OLGadgetCompClass, \
MSG_SPEC_BROADCAST_FOR_DEFAULT_FOCUS
;send MSG_SPEC_BROADCAST_FOR_DEFAULT_FOCUS to all visible
;children which are FULLY_ENABLED. Returns OD of last object in visible
;tree which has HINT_DEFAULT_FOCUS{_WIN}.
mov bx, offset OLBroadcastForDefaultFocus_callBack
;pass offset to callback routine,
;in Resident resource
GOTO OLResidentProcessVisChildren
OLGadgetCompBroadcastForDefaultFocus endm
CommonFunctional ends
InstanceObscure segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLGadgetCompGetBuildFlags --
MSG_VUP_GET_BUILD_FLAGS for OLGadgetCompClass
DESCRIPTION: Returns build flags.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VUP_GET_BUILD_FLAGS
RETURN: cx - OLBuildFlags
ax, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 4/ 9/92 Initial Version
------------------------------------------------------------------------------@
OLGadgetCompGetBuildFlags method dynamic OLGadgetCompClass, \
MSG_VUP_GET_BUILD_FLAGS
;
; The gadget is part of some other window. Let's assume this is
; done as the result of a SPEC_BUILD, and we can count on our Vis
; parent link being established.
;
GOTO VisCallParent
OLGadgetCompGetBuildFlags endm
InstanceObscure ends
| 26.914089 | 87 | 0.659346 |
4f2316630da6e0bb2dd7be78d049432a5d70a3b8 | 664 | asm | Assembly | mc-sema/validator/x86/tests/PCMPEQBrr.asm | randolphwong/mcsema | eb5b376736e7f57ff0a61f7e4e5a436bbb874720 | [
"BSD-3-Clause"
] | 2 | 2021-08-07T16:21:29.000Z | 2021-11-17T10:58:37.000Z | mc-sema/validator/x86/tests/PCMPEQBrr.asm | randolphwong/mcsema | eb5b376736e7f57ff0a61f7e4e5a436bbb874720 | [
"BSD-3-Clause"
] | null | null | null | mc-sema/validator/x86/tests/PCMPEQBrr.asm | randolphwong/mcsema | eb5b376736e7f57ff0a61f7e4e5a436bbb874720 | [
"BSD-3-Clause"
] | null | null | null | BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; allocate 16 byte aligned stack space for the packed values
lea ecx, [esp-33]
and ecx, 0xfffffff0
; load a 128 bit value into xmm0
mov DWORD [ecx], 0x11231111
mov DWORD [ecx+4], 0xa0441011
mov DWORD [ecx+8], 0xaaaaaaaa
mov DWORD [ecx+12], 0x22f83222
movaps xmm0, [ecx]
lea ecx, [ecx+16]
; load a 128 bit value into xmm1
mov DWORD [ecx], 0x11ba1111
mov DWORD [ecx+4], 0x0a440a0e
mov DWORD [ecx+8], 0xaaaaaaaa
mov DWORD [ecx+12], 0x221e0e22
movaps xmm1, [ecx]
;TEST_BEGIN_RECORDING
pcmpgtb xmm0, xmm1
;TEST_END_RECORDING
xor ecx, ecx
cvtsi2sd xmm0, ecx
cvtsi2sd xmm1, ecx
| 19.529412 | 60 | 0.759036 |
3fcb74518f2e169848768af0d8e9e4755b6370d6 | 619 | asm | Assembly | oeis/157/A157618.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/157/A157618.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/157/A157618.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A157618: a(n) = 625*n^2 - 886*n + 314.
; 53,1042,3281,6770,11509,17498,24737,33226,42965,53954,66193,79682,94421,110410,127649,146138,165877,186866,209105,232594,257333,283322,310561,339050,368789,399778,432017,465506,500245,536234,573473,611962,651701,692690,734929,778418,823157,869146,916385,964874,1014613,1065602,1117841,1171330,1226069,1282058,1339297,1397786,1457525,1518514,1580753,1644242,1708981,1774970,1842209,1910698,1980437,2051426,2123665,2197154,2271893,2347882,2425121,2503610,2583349,2664338,2746577,2830066,2914805
seq $0,157619 ; 31250n - 22150.
pow $0,2
sub $0,82810000
div $0,1562500
add $0,53
| 68.777778 | 494 | 0.807754 |
c9ff253cb5805e6651c5f121182f1c95721c85f1 | 2,788 | asm | Assembly | lib/std.asm | ssbostan/zagros | 7ac9959b07d4e5459cdfc9bd34b9ef062c4b9050 | [
"MIT"
] | 21 | 2020-03-28T09:40:49.000Z | 2022-01-28T17:26:01.000Z | lib/std.asm | ssbostan/zagros | 7ac9959b07d4e5459cdfc9bd34b9ef062c4b9050 | [
"MIT"
] | null | null | null | lib/std.asm | ssbostan/zagros | 7ac9959b07d4e5459cdfc9bd34b9ef062c4b9050 | [
"MIT"
] | 1 | 2019-12-21T14:36:27.000Z | 2019-12-21T14:36:27.000Z |
; ==================== ZagrOS ====================
; Zagros Open Source Operating System
; Saeid Bostandoust (ssbostan@linuxmail.org)
; Bostandoust.IR
; ==================== ZagrOS ====================
; ==================== getchr ====================
getchr:
mov ah, 00h
int 90h
ret
; ==================== getchr ====================
; ==================== putchr ====================
putchr:
push ax
mov ah, 01h
int 90h
pop ax
ret
; ==================== putchr ====================
; ==================== getstr ====================
getstr:
push ax
push dx
mov dx, si
mov ah, 02h
int 90h
pop dx
pop ax
ret
; ==================== getstr ====================
; ==================== putstr ====================
putstr:
push ax
push dx
mov dx, si
mov ah, 03h
int 90h
pop dx
pop ax
ret
; ==================== putstr ====================
; ==================== reboot ====================
reboot:
push ax
mov ah, 00h
int 91h
pop ax
ret
; ==================== reboot ====================
; ==================== clearw ====================
clearw:
push ax
mov ah, 01h
int 91h
pop ax
ret
; ==================== clearw ====================
; =================== setcolor ===================
setcolor:
push ax
mov ah, 02h
int 91h
pop ax
ret
; =================== setcolor ===================
; =================== getcolor ===================
getcolor:
mov ah, 03h
int 91h
ret
; =================== getcolor ===================
; ==================== gotoxy ====================
gotoxy:
push ax
push bx
push dx
mov ah, 02h
mov bh, 00h
int 10h
pop dx
pop bx
pop ax
ret
; ==================== gotoxy ====================
; ==================== wherex ====================
wherex:
push ax
push bx
push cx
mov ah, 03h
mov bh, 00h
int 10h
mov dh, 00h
pop cx
pop bx
pop ax
ret
; ==================== wherex ====================
; ==================== wherey ====================
wherey:
push ax
push bx
push cx
mov ah, 03h
mov bh, 00h
int 10h
mov dl, 00h
pop cx
pop bx
pop ax
ret
; ==================== wherey ====================
; ===================== endl =====================
endl:
push ax
mov al, 0ah
call putchr
mov al, 0dh
call putchr
mov ah, 04h
int 91h
pop ax
ret
; ===================== endl =====================
| 12.558559 | 52 | 0.289096 |
5b61c735e65a09e4cc509be3ddd4ce3059a70bef | 891 | nasm | Assembly | Assignment-6/setuid_mod.nasm | xMilkPowderx/SLAE-Code | da0c6e9d0feacd3814b6954b3fd3af5ce1bbaffb | [
"MIT"
] | 1 | 2021-04-22T06:37:00.000Z | 2021-04-22T06:37:00.000Z | Assignment-6/setuid_mod.nasm | xMilkPowderx/SLAE-Code | da0c6e9d0feacd3814b6954b3fd3af5ce1bbaffb | [
"MIT"
] | null | null | null | Assignment-6/setuid_mod.nasm | xMilkPowderx/SLAE-Code | da0c6e9d0feacd3814b6954b3fd3af5ce1bbaffb | [
"MIT"
] | 1 | 2020-01-23T15:45:18.000Z | 2020-01-23T15:45:18.000Z | ;Filename: setuid_mod.nasm
;Author: Jonathan So
;Student ID: SLAE-1470
;SLAE-Exercise 6
global _start
section .text
_start:
;xor eax,eax
;xor ebx,ebx
SHL ebx, 0x10 ;shift all values to left, result in 00000000
SHL ebx, 0x10 ;Sadly SHL didn't accept 0x20 (32bits) so we have to seperate them
;xor ecx,ecx
SHL ecx, 0x10
SHL ecx, 0x10 ;shift all values to left, result in 00000000
mul ebx
mov al,0x17
int 0x80
xor eax,eax
push eax
;push dword 0x68732f6e
mov dx, 0x6873 ;Instead of pushing the whole word, we push to by parts and use SHL to adjust
SHL edx, 16
mov dx, 0x2f6e
push edx
;push dword 0x69622f2f
mov dx, 0x6962 ;Instead of pushing the whole word, we push to by parts and use SHL to adjust
SHL edx, 16
mov dx, 0x2f2f
push edx
mov ebx,esp
lea edx,[esp+0x8]
push eax
push ebx
lea ecx,[esp]
mov al,0xb
int 0x80
xor eax,eax
mov al,0x1
int 0x80
| 19.369565 | 94 | 0.718294 |
055527597fb4707e392149af19e65901985a5588 | 5,705 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_965.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_965.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_965.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xa96a, %r14
nop
nop
nop
cmp $44170, %rdi
mov (%r14), %r9d
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_WT_ht+0x16a6a, %rbx
nop
nop
nop
nop
nop
dec %rcx
mov $0x6162636465666768, %r9
movq %r9, %xmm5
vmovups %ymm5, (%rbx)
nop
nop
nop
inc %rcx
lea addresses_A_ht+0xca6a, %rsi
lea addresses_WT_ht+0x1dc1a, %rdi
nop
nop
nop
nop
nop
inc %rbp
mov $113, %rcx
rep movsw
nop
nop
nop
dec %rcx
lea addresses_normal_ht+0x11a0a, %rsi
lea addresses_WC_ht+0x51ea, %rdi
nop
nop
nop
add $35746, %r15
mov $73, %rcx
rep movsb
nop
xor %rdi, %rdi
lea addresses_normal_ht+0xcc6a, %rcx
nop
nop
add %rdi, %rdi
mov $0x6162636465666768, %rbp
movq %rbp, (%rcx)
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_normal_ht+0xdb9a, %rdi
nop
nop
dec %rbx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%rdi)
nop
inc %r9
lea addresses_normal_ht+0x70a, %r9
nop
nop
nop
and $52475, %rdi
mov (%r9), %ebp
nop
nop
nop
nop
cmp $42812, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %rbp
push %rbx
push %rcx
// Faulty Load
lea addresses_PSE+0x1d86a, %rbp
nop
nop
nop
nop
sub %r14, %r14
mov (%rbp), %rcx
lea oracles, %r14
and $0xff, %rcx
shlq $12, %rcx
mov (%r14,%rcx,1), %rcx
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'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
*/
| 39.344828 | 2,999 | 0.663103 |
7a62089631d25dec22d671f0a4dbf42b3962eb8c | 907 | asm | Assembly | programs/oeis/130/A130102.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/130/A130102.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/130/A130102.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A130102: E.g.f.: (e^x - x)^2.
; 1,0,2,2,8,22,52,114,240,494,1004,2026,4072,8166,16356,32738,65504,131038,262108,524250,1048536,2097110,4194260,8388562,16777168,33554382,67108812,134217674,268435400,536870854,1073741764,2147483586,4294967232,8589934526,17179869116,34359738298,68719476664,137438953398,274877906868,549755813810,1099511627696,2199023255470,4398046511020,8796093022122,17592186044328,35184372088742,70368744177572,140737488355234,281474976710560,562949953421214,1125899906842524,2251799813685146,4503599627370392,9007199254740886
mov $5,2
mov $7,$0
lpb $5
mov $0,$7
sub $5,1
add $0,$5
mov $2,$0
add $2,$0
mov $4,2
mov $6,$0
mov $8,$0
mov $0,$2
pow $4,$6
add $0,$4
mul $0,2
trn $6,3
mul $6,$2
add $2,$0
add $8,2
add $2,$8
sub $2,$6
mov $3,$5
mov $8,$2
lpb $3
mov $1,$8
sub $3,1
lpe
lpe
lpb $7
sub $1,$8
mov $7,0
lpe
sub $1,11
div $1,2
| 23.868421 | 513 | 0.699008 |
71cecaf3140d00683046b83cbab253563a02d741 | 2,341 | asm | Assembly | externals/mpir-3.0.0/mpn/powerpc64/rshift.asm | JaminChan/eos_win | c03e57151cfe152d0d3120abb13226f4df74f37e | [
"MIT"
] | 12 | 2021-09-29T14:50:06.000Z | 2022-03-31T15:01:21.000Z | externals/mpir-3.0.0/mpn/powerpc64/rshift.asm | JaminChan/eos_win | c03e57151cfe152d0d3120abb13226f4df74f37e | [
"MIT"
] | 15 | 2021-12-24T22:53:49.000Z | 2021-12-25T10:03:13.000Z | LibSource/mpir/mpn/powerpc64/rshift.asm | ekzyis/CrypTool-2 | 1af234b4f74486fbfeb3b3c49228cc36533a8c89 | [
"Apache-2.0"
] | 10 | 2021-10-17T19:46:51.000Z | 2022-03-18T02:57:57.000Z | dnl PowerPC-64 mpn_rshift -- rp[] = up[] >> cnt
dnl Copyright 2003, 2005 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
include(`../config.m4')
C cycles/limb
C POWER3/PPC630: 1.5
C POWER4/PPC970: 3.0
C INPUT PARAMETERS
define(`rp',`r3')
define(`up',`r4')
define(`n',`r5')
define(`cnt',`r6')
define(`tnc',`r5')
define(`v0',`r0')
define(`v1',`r7')
define(`u0',`r8')
define(`u1',`r9')
define(`h0',`r10')
define(`h1',`r11')
ASM_START()
PROLOGUE(mpn_rshift)
ifdef(`HAVE_ABI_mode32',
` rldicl n, n, 0, 32') C zero extend n
mtctr n C copy n to count register
addi rp, rp, -16
subfic tnc, cnt, 64 C reverse shift count
ld u0, 0(up)
srd h0, u0, cnt
sld r12, u0, tnc C return value
bdz L(1) C jump for n = 1
ld u1, 8(up)
bdz L(2) C jump for n = 2
ldu u0, 16(up)
bdz L(end) C jump for n = 3
L(oop): sld v1, u1, tnc
srd h1, u1, cnt
ld u1, 8(up)
or h0, v1, h0
stdu h0, 16(rp)
bdz L(exit)
sld v0, u0, tnc
srd h0, u0, cnt
ldu u0, 16(up)
or h1, v0, h1
std h1, 8(rp)
bdnz L(oop)
L(end): sld v1, u1, tnc
srd h1, u1, cnt
or h0, v1, h0
stdu h0, 16(rp)
sld v0, u0, tnc
srd h0, u0, cnt
or h1, v0, h1
std h1, 8(rp)
L(1): std h0, 16(rp)
ifdef(`HAVE_ABI_mode32',
` srdi r3, r12, 32
mr r4, r12
',` mr r3, r12
')
blr
L(exit): sld v0, u0, tnc
srd h0, u0, cnt
or h1, v0, h1
std h1, 8(rp)
L(2): sld v1, u1, tnc
srd h1, u1, cnt
or h0, v1, h0
stdu h0, 16(rp)
std h1, 8(rp)
ifdef(`HAVE_ABI_mode32',
` srdi r3, r12, 32
mr r4, r12
',` mr r3, r12
')
blr
EPILOGUE()
| 21.281818 | 79 | 0.6651 |
9fa856a4a3b65f0df969656a983b30a93d84d916 | 278 | asm | Assembly | dseg.asm | HummusPrince/Semyon | bc7d2ba779014fbcced9f5e25d24392dda06cbb7 | [
"MIT"
] | 1 | 2022-03-04T14:23:30.000Z | 2022-03-04T14:23:30.000Z | dseg.asm | HummusPrince/Semyon | bc7d2ba779014fbcced9f5e25d24392dda06cbb7 | [
"MIT"
] | null | null | null | dseg.asm | HummusPrince/Semyon | bc7d2ba779014fbcced9f5e25d24392dda06cbb7 | [
"MIT"
] | 1 | 2020-10-04T11:27:31.000Z | 2020-10-04T11:27:31.000Z | .module dseg
.title "data segment"
;Def file includes
.include "define.def"
.include "macro.def"
.area DATA(REL, CON)
D_LEDLOC == . ;That's a define!
.db P_LED_R, P_LED_Y, P_LED_G, P_LED_B
D_LEDPWM == . ;That's a define!
.include "pwm_tbl.txt"
D_LEDPWM_LEN == . - D_LEDPWM | 18.533333 | 38 | 0.694245 |
a9ad1bc33177a42d5b7b1026dd6ef8944d9d58c9 | 6,858 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_3465_78.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_3465_78.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_3465_78.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x12777, %rsi
lea addresses_A_ht+0x1d8d9, %rdi
dec %r10
mov $46, %rcx
rep movsq
nop
nop
nop
sub %r15, %r15
lea addresses_D_ht+0xc237, %rcx
and %rbp, %rbp
mov (%rcx), %esi
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x17f77, %rsi
lea addresses_A_ht+0x1ca82, %rdi
nop
nop
sub %rbx, %rbx
mov $25, %rcx
rep movsl
nop
nop
and %r15, %r15
lea addresses_normal_ht+0x1eb29, %rbx
sub $28354, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, (%rbx)
nop
inc %r15
lea addresses_WT_ht+0x1cc37, %rsi
lea addresses_A_ht+0x68cf, %rdi
nop
nop
sub $43546, %rbx
mov $13, %rcx
rep movsq
cmp %rsi, %rsi
lea addresses_D_ht+0x4fb7, %rbp
nop
nop
nop
nop
nop
cmp %r10, %r10
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rbp)
nop
nop
inc %rsi
lea addresses_normal_ht+0x17177, %rsi
lea addresses_normal_ht+0x2c07, %rdi
dec %rdx
mov $82, %rcx
rep movsl
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_normal_ht+0x1ef7, %rsi
nop
dec %rdx
mov (%rsi), %r10d
inc %rdx
lea addresses_A_ht+0x5cb7, %rsi
lea addresses_UC_ht+0x31f7, %rdi
nop
nop
nop
nop
nop
sub %rbx, %rbx
mov $86, %rcx
rep movsw
nop
sub %rdx, %rdx
lea addresses_normal_ht+0xbd77, %rsi
nop
sub %rcx, %rcx
movups (%rsi), %xmm3
vpextrq $1, %xmm3, %r15
nop
nop
nop
dec %r15
lea addresses_UC_ht+0xe677, %rsi
lea addresses_A_ht+0x577, %rdi
nop
nop
sub $7877, %rbp
mov $91, %rcx
rep movsq
cmp $16888, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r9
push %rbp
push %rcx
push %rdx
// Faulty Load
lea addresses_normal+0x5f77, %rdx
xor $19740, %r9
vmovaps (%rdx), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbp
lea oracles, %rdx
and $0xff, %rbp
shlq $12, %rbp
mov (%rdx,%rbp,1), %rbp
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 6}}
{'dst': {'same': True, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 7, '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': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 7}}
{'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'45': 3399, 'b4': 1, '49': 16, 'e4': 1, '00': 7, '44': 38, '62': 1, '41': 2}
45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45
*/
| 41.313253 | 2,999 | 0.658793 |
c2873e21542584e46be16b9714336f49a0b2f487 | 55,964 | asm | Assembly | src/dos32a/text/kernel/int31h.asm | amindlost/dos32a | 06d8e3a0b2397d872205d6c99a7de0d6b8628bcc | [
"Unlicense"
] | 5 | 2022-01-21T08:09:42.000Z | 2022-03-17T10:15:55.000Z | src/dos32a/text/kernel/int31h.asm | amindlost/dos32a | 06d8e3a0b2397d872205d6c99a7de0d6b8628bcc | [
"Unlicense"
] | null | null | null | src/dos32a/text/kernel/int31h.asm | amindlost/dos32a | 06d8e3a0b2397d872205d6c99a7de0d6b8628bcc | [
"Unlicense"
] | 1 | 2022-02-19T22:58:50.000Z | 2022-02-19T22:58:50.000Z | ;
; Copyright (C) 1996-2006 by Narech K. All rights reserved.
;
; 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. The end-user documentation included with the redistribution, if any,
; must include the following acknowledgment:
;
; "This product uses DOS/32 Advanced DOS Extender technology."
;
; Alternately, this acknowledgment may appear in the software itself, if
; and wherever such third-party acknowledgments normally appear.
;
; 4. Products derived from this software may not be called "DOS/32A" or
; "DOS/32 Advanced".
;
; THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS" AND ANY EXPRESSED
; 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 AUTHORS OR COPYRIGHT HOLDERS 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.
;
;
;=============================================================================
; INT 31h INTERFACE
;=============================================================================
evendata
;=============================================================================
int31h_tab label word
dw 0300h ; simulate real mode int
dw int31h_0300
dw 0301h ; call rm proc RETF
dw int31h_0301
dw 0302h ; call rm proc IRET
dw int31h_0302
;---------------------------------------------------------------------
dw 0000h ; allocate descriptor
dw int31h_0000
dw 0001h ; free descriptor
dw int31h_0001
dw 0002h ; map seg to sel
dw int31h_0002
dw 0003h ; get sel increment value
dw int31h_0003
dw 0006h ; get sel base addr
dw int31h_0006
dw 0007h ; set sel base addr
dw int31h_0007
dw 0008h ; set sel limit
dw int31h_0008
dw 0009h ; set sel access rights
dw int31h_0009
dw 000Ah ; create alias sel
dw int31h_000A
dw 000Bh ; get descriptor
dw int31h_000B
dw 000Ch ; set descriptor
dw int31h_000C
dw 000Eh ; get multi descriptors
dw int31h_000E
dw 000Fh ; set multi descriptors
dw int31h_000F
;---------------------------------------------------------------------
dw 0100h ; alloc DOS memory
dw int31h_0100
dw 0101h ; free DOS memory
dw int31h_0101
dw 0102h ; resize DOS memory
dw int31h_0102
;---------------------------------------------------------------------
dw 0200h ; get real mode int
dw int31h_0200
dw 0201h ; set real mode int
dw int31h_0201
dw 0202h ; get pm exception vector
dw int31h_0202
dw 0203h ; set pm exception vector
dw int31h_0203
dw 0204h ; get pm int
dw int31h_0204
dw 0205h ; set pm int
dw int31h_0205
;---------------------------------------------------------------------
dw 0303h ; alloc callback
dw int31h_0303
dw 0304h ; free callback
dw int31h_0304
dw 0305h ; get state save/restore addr
dw int31h_0305
dw 0306h ; get raw mode switch addr
dw int31h_0306
;---------------------------------------------------------------------
dw 0400h ; get DPMI version
dw int31h_0400
;---------------------------------------------------------------------
dw 0500h ; get free mem info
dw int31h_0500
dw 0501h ; alloc mem
dw int31h_0501
dw 0502h ; free mem
dw int31h_0502
dw 0503h ; resize mem
dw int31h_0503
dw 050Ah ; get linear mem block and size
dw int31h_050A
;---------------------------------------------------------------------
dw 0600h ; lock linear region *VM*
dw int31h_0600
dw 0601h ; unlock linear region *VM*
dw int31h_0601
dw 0602h ; Mark Real Mode Region as Pageable *VM*
dw int31h_0602
dw 0603h ; Relock Real Mode Region *VM*
dw int31h_0603
dw 0604h ; get page size *VM*
dw int31h_0604
;---------------------------------------------------------------------
dw 0702h ; mark page *VM*
dw int31h_0702
dw 0703h ; discard page *VM*
dw int31h_0703
;---------------------------------------------------------------------
dw 0800h ; physical mem mapping *VM*
dw int31h_0800
dw 0801h ; free mapped mem *VM*
dw int31h_0801
;---------------------------------------------------------------------
dw 0900h ; get/disable VIS
dw int31h_0900
dw 0901h ; get/enable VIS
dw int31h_0901
dw 0902h ; get VIS
dw int31h_0902
;---------------------------------------------------------------------
dw 0A00h ; vendor specific
dw int31h_0A00
;---------------------------------------------------------------------
; dw 0B00h ; Set Debug Watchpoint
; dw int31h_0B00
; dw 0B01h ; Clear Debug Watchpoint
; dw int31h_0B01
; dw 0B02h ; Get State of Debug Watchpoint
; dw int31h_0B02
; dw 0B03h ; Reset Debug Watchpoint
; dw int31h_0B03
;---------------------------------------------------------------------
dw 0E00h ; get FPU status
dw int31h_0E00
dw 0E01h ; set FPU emulation
dw int31h_0E01
;---------------------------------------------------------------------
dw 0EEFFh ; PMODE/W compatible call
dw int31h_EEFF
;---------------------------------------------------------------------
int31h_end label word
;=============================================================================
int31h_pm:
cli
cld
push ds es fs gs ; push registers on stack
pushad
push bx
mov ds,cs:seldata ; DS -> KERNEL
cmp ax,int31h_cache[0] ; check if function # is in cache
mov bx,int31h_cache[2] ; retrieve cached target addr
je @@2 ; if cached, jump
xor bx,bx ; do a linear search
@@0: cmp ax,int31h_tab[bx] ; found function # ?
je @@1 ; if yes, jump
add bx,4 ; advance to next entry
cmp bx,(offs int31h_end - offs int31h_tab) ; end of table?
jb @@0 ; loop until end of table
pop bx ; no function found
jmp int31fail8001 ; exit with error 8001h
@@1: mov bx,int31h_tab[bx+2] ; get address of the appropriate handler
mov int31h_cache[0],ax ; store function # in cache
mov int31h_cache[2],bx ; store function addr in cache
@@2: mov ds,selzero ; DS -> 0 (beginning of memory)
xchg bx,[esp] ; store target addr & restore BX
ret
;-----------------------------------------------------------------------------
int31fail8001: ; INT 31h return fail with error 8001h
mov al,01h
jmp int31failx
int31fail8010: ; INT 31h return fail with error 8010h
mov al,10h
jmp int31failx
int31fail8011: ; INT 31h return fail with error 8011h
mov al,11h
jmp int31failx
int31fail8012: ; INT 31h return fail with error 8012h
mov al,12h
jmp int31failx
int31fail8013: ; INT 31h return fail with error 8013h
mov al,13h
jmp int31failx
int31fail8015: ; INT 31h return fail with error 8015h
mov al,15h
jmp int31failx
int31fail8016: ; INT 31h return fail with error 8016h
mov al,16h
jmp int31failx
int31fail8021: ; INT 31h return fail with error 8021h
mov al,21h
jmp int31failx
int31fail8022: ; INT 31h return fail with error 8022h
mov al,22h
jmp int31failx
int31fail8023: ; INT 31h return fail with error 8023h
mov al,23h
jmp int31failx
int31fail8024: ; INT 31h return fail with error 8024h
mov al,24h
jmp int31failx
int31fail8025: ; INT 31h return fail with error 8025h
mov al,25h
int31failx:
mov ah,80h
mov [esp+28],ax ; set AX on stack to 8010h for POPAD
jmp int31fail
;-----------------------------------------------------------------------------
int31failbx: ; INT 31h return fail with BX,AX
mov wptr [esp+16],bx ; put BX onto stack for POPAD
jmp int31failax
int31failcx: ; INT 31h return fail with CX,AX
mov wptr [esp+24],cx ; put CX onto stack for POPAD
int31failax: ; INT 31h return fail with AX
mov wptr [esp+28],ax ; put AX onto stack for POPAD
;-----------------------------------------------------------------------------
int31fail: ; INT 31h return fail, pop all regs
popad
pop gs fs es ds
int31failnopop: ; INT 31h return fail with carry set
or bptr [esp+8],01h ; set carry in EFLAGS on stack
iretd
;-----------------------------------------------------------------------------
int31okedx: ; INT 31h return ok with EDX,CX,AX
mov [esp+20],edx ; put EDX onto stack for POPAD
jmp int31okcx
int31okdx: ; INT 31h return ok with DX,CX,AX
mov [esp+20],dx ; put DX onto stack for POPAD
jmp int31okcx
int31oksinoax: ; INT 31h return ok SI,DI,BX,CX
mov ax,[esp+28] ; get old value of AX for restore
int31oksi: ; INT 31h return ok SI,DI,BX,CX,AX
mov [esp+4],si ; put SI onto stack for POPAD
mov [esp+0],di ; put DI onto stack for POPAD
int31okbx:
mov [esp+16],bx ; put BX onto stack for POPAD
int31okcx: ; INT 31h return ok with CX,AX
mov [esp+24],cx ; put CX onto stack for POPAD
int31okax: ; INT 31h return ok with AX
mov [esp+28],ax ; put AX onto stack for POPAD
;-----------------------------------------------------------------------------
int31ok: ; INT 31h return ok, pop all regs
popad
pop gs fs es ds
int31oknopop: ; INT 31h return ok with carry clear
and bptr [esp+8],0FEh ; clear carry in EFLAGS on stack
iretd
;=============================================================================
; Helper functions
;=============================================================================
;-----------------------------------------------------------------------------
int31testsel: ; test for valid selector BX
pop bp ; pop return address
cmp bx,cs:gdtlimit ; selector BX out of range?
ja int31fail8022 ; if yes, fail with error 8022h
mov edi,cs:gdtbase ; get base of GDT
and ebx,0FFF8h ; mask offset table index and RPL
test bptr ds:[edi+ebx+6],10h ; is descriptor used?
jz int31fail8022 ; if descriptor not used, fail 8022h
jmp bp ; return ok
;-----------------------------------------------------------------------------
int31testaccess: ; test access bits in CX
pop bp ; pop return address
test ch,20h ; test MUST BE 0 bit in CH
jnz int31fail8021 ; if not 0, error 8021h
test cl,90h ; test present and MUST BE 1 bits
jz int31fail8021 ; if both 0, error 8021h
jpo int31fail8021 ; if unequal, error 8021h
test cl,60h ; test DPL
jnz int31fail8021 ; if not 0, error 8021h
test cl,8 ; if code, more tests needed
jz @@0 ; if data, skip code tests
test cl,2 ; readable?
jz int31fail8021
test cl,4 ; non-conform?
jnz int31fail8021
@@0: jmp bp ; return ok
;-----------------------------------------------------------------------------
int31testint:
movzx ebx,bl ; EBX = interrupt number
mov al,bl
mov ah,bl
and ax,0F807h
movzx esi,al
cmp ah,picmaster ; if 1st PIC, offset = buffer + 0
jz @@done
add si,8
cmp ah,picslave ; if 2nd PIC, offset = buffer + 8
jz @@done
or si,-1
@@done: ret ; return: ZF = 0 if BL is IRQ, otherwise ZF = 1
;=============================================================================
; DESCRIPTOR FUNCTIONS
;=============================================================================
;=============================================================================
; Allocate Descriptors
;
int31h_0000:
test cx,cx ; if CX = 0, error 8021h
jz int31fail8021
mov edx,cs:gdtbase ; get base of GDT
movzx eax,cs:gdtlimit ; EAX = last selector index
and al,0F8h
mov bx,cx ; BX = number of selectors to find
@@l0: test bptr [edx+eax+6],10h ; is descriptor used?
jnz @@f0
dec bx ; found free descriptor, dec counter
jnz @@f1 ; continue if need to find more
mov ebx,eax ; found all descriptors requested
@@l1: mov dptr [edx+ebx],0 ; set entire new descriptor
mov dptr [edx+ebx+4],109200h
add bx,8 ; increment selector index
loop @@l1 ; dec counter of descriptors to mark
jmp int31okax ; return ok, with AX
@@f0: mov bx,cx ; reset number of selectors to find
@@f1: sub ax,8 ; dec current selector counter
cmp ax,8*SYSSELECTORS ; more descriptors to go?
jae @@l0 ; if yes, loop
jmp int31fail8011 ; did not find descriptors
;=============================================================================
; Free Descriptor
;
int31h_0001:
mov ax,cs
cmp ax,bx
jz int31fail8022 ; cannot free CS selector
mov ax,ss
cmp ax,bx
jz int31fail8022 ; cannot free SS selector
call int31testsel ; test for valid selector BX
xor eax,eax
mov [edi+ebx+0],eax ; mark descriptor as free
mov [edi+ebx+4],eax
mov cx,4 ; zero any segregs loaded with BX
lea ebp,[esp+32] ; EBP -> selectors on stack
@@l0: cmp wptr [ebp],bx ; selector = BX?
jne @@f0 ; if no, continue loop
mov [ebp],ax ; zero selector on stack
@@f0: add ebp,2 ; increment selector ptr
loop @@l0 ; loop
jmp int31ok ; return ok
;=============================================================================
; Map Real-Mode Segment to Descriptor
;
int31h_0002:
mov ds,cs:seldata
mov cx,16 ; max 16 selectors
mov si,offs segmentbases ; check, if segment already mapped
@@0: mov ax,[si+0] ; is selector zero (free entry)
test ax,ax
jz @@1 ; if yes, loop
cmp bx,[si+2] ; compare segment values
jz int31okax ; if already mapped, done
@@1: add si,4
loop @@0
mov cl,16
mov si,offs segmentbases ; search for a free entry
@@2: cmp wptr [si],0 ; this field free?
jz @@3 ; if yes, use it
add si,4
loop @@2
jmp int31fail8010 ; no entry free
@@3: mov [si+2],bx ; store segment
movzx edi,bx ; convert to linear address
shl edi,4
mov cl,1
xor ax,ax
int 31h ; allocate selector
jc int31failax
mov [si+0],ax ; store selector
mov bx,ax
xor cx,cx
mov dx,-1
mov ax,8
int 31h ; set descriptor limit 64k
mov dx,di
shr edi,16
mov cx,di
mov ax,7
int 31h ; set descriptor base
mov cx,0092h
mov ax,9
int 31h ; set access rights
mov ax,bx ; return selector
jmp int31okax
;=============================================================================
; Get Selector Increment Value
;
int31h_0003:
mov ax,8 ; selector increment value is 8
jmp int31okax ; return ok, with AX
;=============================================================================
; Get Segment Base Address
;
int31h_0006:
call int31testsel ; test for valid selector BX
mov dx,wptr ds:[edi+ebx+2] ; low word of 32bit linear address
mov cl,bptr ds:[edi+ebx+4] ; high word of 32bit linear address
mov ch,bptr ds:[edi+ebx+7]
jmp int31okdx ; return ok, with DX, CX, AX
;=============================================================================
; Set Segment Base Address
;
int31h_0007:
call int31testsel ; test for valid selector BX
mov wptr ds:[edi+ebx+2],dx ; low word of 32bit linear address
mov bptr ds:[edi+ebx+4],cl ; high word of 32bit linear address
mov bptr ds:[edi+ebx+7],ch
jmp int31ok ; return ok
;=============================================================================
; Set Segment Limit
;
int31h_0008:
call int31testsel ; test for valid selector BX
cmp cx,0Fh ; is limit greater than 1M?
jbe @@1 ; if not, jump
or dx,0FFFh ; auto-adjust limit
shrd dx,cx,12 ; DX = low 16 bits of page limit
shr cx,12 ; CL = high 4 bits of page limit
or cl,80h ; set granularity bit in CL
@@1: mov wptr ds:[edi+ebx],dx ; put low word of limit
and bptr ds:[edi+ebx+6],50h ; mask off G and high nibble of limit
or bptr ds:[edi+ebx+6],cl ; put high nibble of limit
jmp int31ok ; return ok
;=============================================================================
; Set Descriptor Access Rights
;
int31h_0009:
call int31testsel ; test for valid selector BX
call int31testaccess ; test access bits in CX
or ch, 10h ; set AVL bit, descriptor used
and ch,0D0h ; mask off low nibble of CH
and bptr ds:[edi+ebx+6],0Fh ; mask off high nibble access rights
or bptr ds:[edi+ebx+6],ch ; or in high access rights byte
mov bptr ds:[edi+ebx+5],cl ; put low access rights byte
jmp int31ok ; return ok
;=============================================================================
; Create Alias Descriptor
;
int31h_000A:
call int31testsel ; test for valid selector BX
xor ax,ax ; allocate descriptor
mov cx,1
int 31h
jc int31fail8011 ; if failed, descriptor unavailable
push ax ; preserve allocated selector
push ds ; copy descriptor and set type data
pop es
movzx edi,ax ; EDI = target selector
mov esi,cs:gdtbase ; ESI -> GDT
add edi,esi ; adjust to target descriptor in GDT
add esi,ebx ; adjust to source descriptor in GDT
movs dptr es:[edi],ds:[esi] ; copy descriptor
lods dptr ds:[esi]
mov ah,92h ; set descriptor type - R/W up data
stos dptr es:[edi]
pop ax ; restore allocated selector
jmp int31okax ; return ok, with AX
;=============================================================================
; Get Descriptor
;
int31h_000B:
call int31testsel ; test for valid selector BX
lea esi,[edi+ebx] ; ESI -> descriptor in GDT
mov edi,[esp] ; get EDI buffer ptr from stack
movs dptr es:[edi],ds:[esi] ; copy descriptor
movs dptr es:[edi],ds:[esi]
jmp int31ok ; return ok
;=============================================================================
; Set Descriptor
;
int31h_000C:
call int31testsel ; test for valid selector BX
mov esi,[esp] ; ESI = EDI buffer ptr from stack
mov cx,es:[esi+5] ; get access rights from descriptor
call int31testaccess ; test access bits in CX
push ds es ; swap DS and ES, target and source
pop ds es
add edi,ebx ; adjust EDI to descriptor in GDT
movs dptr es:[edi],ds:[esi] ; copy descriptor
lods dptr ds:[esi]
or al,10h ; set descriptor AVL bit
stos wptr es:[edi]
jmp int31ok ; return ok
;=============================================================================
; Get Multiple Descriptors
;
int31h_000E:
mov ax,000Bh ; function 000Bh, get descriptor
jmp int31h_000EF ; go to common function
;=============================================================================
; Set Multiple Descriptors
;
int31h_000F:
mov ax,000Ch ; function 000Ch, set descriptor
int31h_000EF: ; common to functions 000Eh and 000Fh
test cx,cx ; if CX = 0, return ok immediately
jz int31ok
mov dx,cx ; DX = number of descriptors
xor cx,cx ; CX = successful counter
@@l0: mov bx,es:[edi] ; BX = selector to get
add edi,2
int 31h ; get/set descriptor
jc int31failcx ; if error, fail with AX and CX
add edi,8 ; increment descriptor ptr
inc cx ; increment successful copy counter
dec dx ; decrement loop counter
jnz @@l0 ; if more descriptors to go, loop
jmp int31ok ; return ok
;=============================================================================
; DOS MEMORY FUNCTIONS
;=============================================================================
;=============================================================================
; Allocate DOS Memory Block
;
int31h_0100:
mov ah,48h ; DOS alloc memory function
call int31010x_f2 ; allocate memory
jc int31failbx ; if fail, exit with AX=err, BX=maxmem
mov dx,ax ; DX=segment of DOS memory block
xor ax,ax ; allocate descriptor
mov cx,1
int 31h
jnc @@1
mov ah,49h ; if error allocating descriptor
call int31010x_f2 ; free what was allocated
jmp int31fail8011 ; and exit with error 8011h
@@1: mov [esp+14h],ax ; set selector in DX
mov [esp+1Ch],dx ; set base address in AX
mov bx,ax
mov cx,dx
shl dx,4
shr cx,12
mov ax,0007h ; set selector base
int 31h
mov cx,0092h ; set access rights
mov al,09h
int 31h
jmp int31010x ; set selector size
;=============================================================================
; Free DOS Memory Block
;
int31h_0101:
mov ah,49h
mov si,dx ; preserve DX = selector
call int31010x_f1
jc int31failax
mov bx,si ; restore selector in BX
jmp int31h_0001
;=============================================================================
; Resize DOS Memory Block
;
int31h_0102:
mov ah,4Ah
mov si,dx ; preserve DX = selector
call int31010x_f1
jc int31failbx
mov bx,si ; restore selector in BX
int31010x:
movzx edx,wptr [esp+10h] ; get original size
shl edx,4 ; convert para to bytes
dec edx ; limit=size-1
shld ecx,edx,16
mov ax,0008h ; set limit
int 31h
jmp int31ok
;-----------------------------------------------------------------------------
int31010x_f1:
pop bp
push ax bx
mov bx,dx ; BX = selector
mov ax,0006h ; get base
int 31h
pop bx ax
jc int31failax
shrd dx,cx,4 ; adjust CX:DX to segment value
push bp
int31010x_f2:
xor cx,cx
push cx ; set real mode SS:SP
push cx
sub esp,10
push dx ; set real mode ES
push cx ; set real mode flags
pushad ; set real mode registers
push ss
pop es
mov edi,esp
mov bl,21h
mov ax,0300h
int 31h
mov bx,[esp+10h] ; get BX from structure
mov ax,[esp+1Ch] ; get AX from structure
lea esp,[esp+32h]
pop bp
jc int31failax ; if error, fail
bt wptr [esp-14h],0
jmp bp
;=============================================================================
; INTERRUPT FUNCTIONS
;=============================================================================
;=============================================================================
; Get Real Mode Interrupt Vector
;
int31h_0200:
movzx ebx,bl ; EBX = BL (interrupt number)
mov dx,[ebx*4+0] ; load real mode vector offset
mov cx,[ebx*4+2] ; load real mode vector segment
jmp int31okdx ; return ok, with AX, CX, DX
;=============================================================================
; Set Real Mode Interrupt Vector
;
int31h_0201:
mov ebp,dr7
xor eax,eax ; temporarily disable null-ptr protection
mov dr7,eax
movzx ebx,bl ; EBX = BL (interrupt number)
mov [ebx*4+0],dx ; set real mode vector offset
mov [ebx*4+2],cx ; set real mode vector segment
mov dr7,ebp
jmp int31ok ; return ok
;=============================================================================
; Get Processor Exception Handler Vector
;
int31h_0202:
mov ds,cs:seldata
cmp bl,20h ; must be in range 00..1Fh
jae int31fail8021 ; invalid value
xor cx,cx
xor edx,edx
cmp bl,10h ; if not in range 00..0Fh
jae @@done ; return 0:0
movzx ebx,bl
mov cx,wptr exctab_pm[ebx*8+4] ; get user-defined exception handler CS
mov edx,dptr exctab_pm[ebx*8+0] ; get user-defined exception handler EIP
@@done: mov ax,[esp+28]
jmp int31okedx ; return ok, with AX, CX, EDX
;=============================================================================
; Set Processor Exception Handler Vector
;
int31h_0203:
xchg bx,cx ; swap INT number with INT selector
call int31testsel ; test for valid selector BX
xchg bx,cx
mov ds,cs:seldata
cmp bl,20h ; must be in range 00..1Fh
jae int31fail8021 ; invalid value
cmp bl,10h ; if not in range 00..0Fh
jae @@done ; then done
movzx ebx,bl
mov wptr exctab_pm[ebx*8+4],cx ; set user-defined exception handler CS
mov dptr exctab_pm[ebx*8+0],edx ; set user-defined exception handler EIP
@@done: jmp int31ok ; return ok
;=============================================================================
; Get Protected Mode Interrupt Vector
;
int31h_0204:
mov ds,cs:seldata
call int31testint ; check if one of IRQs
jz @@1 ; if yes, read from buffer
@@0: shl ebx,3 ; adjust for location in IDT
add ebx,idtbase ; add base of IDT
mov ds,selzero
mov edx,dptr [ebx+4] ; get high word of offset
mov dx,wptr [ebx+0] ; get low word of offset
mov cx,wptr [ebx+2] ; get selector
jmp @@done
@@1: bt irqset_pm,si ; check if IRQ is installed
jnc @@2 ; if not, return built-in handler
test bl,0F0h ; check if IRQ is above INT 0Fh
jnz @@0 ; if yes, don't buffer: read from IDT
mov cx,wptr irqtab_pm[esi*8+4] ; get user-defined IRQ handler CS
mov edx,dptr irqtab_pm[esi*8+0] ; get user-defined IRQ handler EIP
jmp @@done
@@2: mov cx,SELCODE ; load built-in IRQ handler CS
lea edx,std_matrix[esi*4] ; load built-in IRQ handler EIP
@@done: mov ax,[esp+28]
jmp int31okedx ; return ok, with AX, CX, EDX
;=============================================================================
; Set Protected Mode Interrupt Vector
;
int31h_0205:
xchg bx,cx ; swap int number with int selector
call int31testsel ; test for valid selector BX
xchg bx,cx
mov ds,cs:seldata
mov es,selzero
movzx ecx,cx ; ECX = CX (selector)
call int31testint ; check if one of IRQs
jz @@1 ; if yes, install in buffer
cmp bl,1Bh ; process special interrupts
jz @@1Bh
cmp bl,1Ch
jz @@1Ch
cmp bl,23h
jz @@23h
cmp bl,24h
jz @@24h
@@0: shl ebx,3 ; adjust for location in IDT
add ebx,idtbase ; add base of IDT
mov wptr es:[ebx+0],dx ; set low word of offset
shr edx,16
mov wptr es:[ebx+6],dx ; set high word of offset
mov wptr es:[ebx+2],cx ; set selector
jmp @@done
@@1: cmp cx,SELCODE ; check if restoring IRQ
jnz @@2 ; if not, jump
btr irqset_rm,si ; reset IRQ installed bit (RM)
btr irqset_pm,si ; reset IRQ installed bit (PM)
mov eax,irqtab_rm[esi*4] ; restore real mode interrupt
mov es:[ebx*4],eax
cmp bl,10h ; check if INT vector is above INT 0Fh
jae @@0 ; if yes, install into IDT
jmp @@done
@@2: bts irqset_rm,si ; set IRQ installed bit (RM)
bts irqset_pm,si ; set IRQ installed bit (PM)
mov eax,es:[ebx*4] ; get CS:IP of real mode INT vector
mov irqtab_rm[esi*4],eax ; save CS:IP of real mode INT vector
lea eax,back_matrix[esi*4] ; get address of real mode IRQ callback
mov wptr es:[ebx*4+0],ax ; set real mode IRQ callback IP
mov wptr es:[ebx*4+2],_KERNEL ; set real mode IRQ callback CS
cmp bl,10h ; check if INT vector is above INT 0Fh
jae @@0 ; if yes, install into IDT
mov wptr irqtab_pm[esi*8+4],cx ; install CS into IRQ buffer
mov dptr irqtab_pm[esi*8+0],edx ; install EIP into IRQ buffer
@@done: jmp int31ok ; return ok
@@1Bh: cmp cx,SELCODE ; install real mode INT 1Bh callback
mov eax,newint1Bh
jnz @@1Bh0
mov eax,oldint1Bh
@@1Bh0: mov es:[4*1Bh],eax
jmp @@0
@@1Ch: cmp cx,SELCODE ; install real mode INT 1Ch callback
mov eax,newint1Ch
jnz @@1Ch0
mov eax,oldint1Ch
@@1Ch0: mov es:[4*1Ch],eax
jmp @@0
@@23h: cmp cx,SELCODE ; install real mode INT 23h callback
mov eax,newint23h
jnz @@23h0
mov eax,oldint23h
@@23h0: mov es:[4*23h],eax
jmp @@0
@@24h: cmp cx,SELCODE ; install real mode INT 24h callback
mov eax,newint24h
jnz @@24h0
mov eax,oldint24h
@@24h0: mov es:[4*24h],eax
jmp @@0
;=============================================================================
; Get and Disable Virtual Interrupt State
;
int31h_0900:
add esp,26h ; adjust stack
pop ds ; restore DS
btr wptr [esp+8],9 ; test and clear IF bit in EFLAGS
setc al ; set AL = carry (IF flag from EFLAGS)
jmp int31oknopop ; return ok, dont pop registers
;=============================================================================
; Get and Enable Virtual Interrupt State
;
int31h_0901:
add esp,26h ; adjust stack
pop ds ; restore DS
bts wptr [esp+8],9 ; test and set IF bit in EFLAGS
setc al ; set AL = carry (IF flag from EFLAGS)
jmp int31oknopop ; return ok, dont pop registers
;=============================================================================
; Get Virtual Interrupt State
;
int31h_0902:
add esp,26h ; adjust stack
pop ds ; restore DS
bt wptr [esp+8],9 ; just test IF bit in EFLAGS
setc al ; set AL = carry (IF flag from EFLAGS)
jmp int31oknopop ; return ok, dont pop registers
;=============================================================================
; REAL/PROTECTED MODE TRANSLATION FUNCTIONS
;=============================================================================
;=============================================================================
; Call Real Mode Procedure with Far Return Frame
; Call Real Mode Procedure with Interrupt Return Frame
;
int31h_0301:
int31h_0302:
mov ebp,dptr es:[edi+2Ah] ; get target CS:IP from structure
jmp int3103 ; go to common code
;=============================================================================
; Simulate Real Mode Interrupt
;
int31h_0300:
movzx ebx,bl ; get real mode INT CS:IP
mov ebp,dptr ds:[ebx*4] ; read from real mode interrupt table
int3103: ; common to 0300h, 0301h, and 0302h
mov gs,cs:seldata
movzx ebx,wptr es:[edi+2Eh] ; EBX = SP from register structure
movzx edx,wptr es:[edi+30h] ; EDX = SS from register structure
mov ax,bx ; check if caller provided stack
or ax,dx
jnz @@f3 ; if yes, go on to setup stack
mov dx,cs:rmstacktop ; DX = SS for real mode redirection
mov bx,cs:rmstacklen ; get size of real mode stack
sub dx,bx ; adjust DX to next stack location
cmp dx,cs:rmstackbase ; exceeded real mode stack space?
jb int31fail8012 ; if yes, error 8012h
mov gs:rmstacktop,dx ; update ptr for possible reenterancy
shl bx,4 ; adjust BX from paragraphs to bytes
@@f3: lea edi,[edx*4] ; EDI -> top of real mode stack
lea edi,[edi*4+ebx]
mov ax,ss
xchg ax,gs:rmstackss ; preserve and set new top of stack
push ax ; parms for possible reenterancy
lea eax,[esp-4]
xchg eax,gs:rmstackesp
push eax
movzx ecx,cx
mov ax,cx ; EAX = length of stack parms
add ax,ax ; convert words to bytes
sub bx,2Eh ; adjust real mode SP for needed vars
sub bx,ax ; adjust real mode SP for stack parms
push ds es ; swap DS and ES
pop ds es
std ; string copy backwards
sub edi,2 ; copy stack parms from protected mode
lea esi,[ecx*2+esp+38h] ; stack to real mode stack
rep movs wptr es:[edi],ss:[esi]
mov esi,[esp+06h] ; ESI = offset of structure from stack
mov ax,ds:[esi+20h] ; AX = FLAGS from register structure
cmp bptr [esp+22h],1 ; check AL on stack for function code
jz @@f4 ; if function 0301h, go on
and ah,0FCh ; 0300h or 0302h, clear IF and TF flag
stos wptr es:[edi] ; put flags on real mode stack
sub bx,2
@@f4: cld ; string copy forward
lea edi,[edx*4] ; EDI -> bottom of stack
lea edi,[edi*4+ebx]
mov cl,8 ; copy general regs to real mode stack
rep movs dptr es:[edi],ds:[esi]
add esi,6 ; copy FS and GS to real mode stack
movs dptr es:[edi],ds:[esi]
mov wptr es:[edi+8],_KERNEL ; return address from call
mov wptr es:[edi+6],offs @@f1
mov wptr es:[edi+4],ax ; store FLAGS for real mode IRET maybe
mov dptr es:[edi],ebp ; put call address to real mode stack
mov ax,[esi-6] ; real mode DS from register structure
mov cx,[esi-8] ; real mode ES from register structure
mov si,_KERNEL ; real mode target CS:IP
mov di,offs @@f0
db 66h ; JMP DWORD PTR, as in 32bit offset,
jmp wptr cs:pmtormswrout ; not seg:16bit offset
@@f0: popad ; load regs with call values
pop fs gs
iret ; go to call address
@@f1: push gs fs ds es ; store registers on stack
pushf ; store flags on stack
cli
pushad
xor eax,eax
mov ax,ss ; EAX = linear ptr to SS
xor ebp,ebp
shl eax,4
mov bp,sp ; EBP = SP
add ebp,eax ; EBP -> stored regs on stack
mov dx,cs:rmstackss ; get protected mode SS:ESP from stack
mov ebx,cs:rmstackesp
mov ax,SELZERO ; DS selector value for protected mode
mov cx,SELDATA ; ES selector value for protected mode
mov si,SELCODE ; target CS:EIP in protected mode
mov edi,offs @@f2
jmp cs:rmtopmswrout ; go back to protected mode
@@f2: push es
pop gs
pop es:rmstackesp
pop es:rmstackss
mov esi,ebp ; copy return regs from real mode
mov edi,[esp] ; get structure offset from stack
mov es,[esp+24h]
mov ecx,15h ; stack to register structure
cld
rep movs wptr es:[edi],ds:[esi]
cmp dptr es:[edi+4],0 ; stack provided by caller?
jne int31ok ; if yes, done now
mov ax,cs:rmstacklen ; restore top of real mode stack
add gs:rmstacktop,ax
jmp int31ok ; return ok
;=============================================================================
; Allocate Real Mode Callback Address
;
int31h_0303:
mov bl,cs:pm32_callbacks ; CL = total number of callbacks
test bl,bl ; are there any?
jz int31fail8015 ; if no, error 8015h
mov edx,cs:callbackbase ; EDX -> base of callbacks
mov ecx,edx ; for later use
@@l0: cmp wptr [edx+3],0 ; is this callback free?
jz @@f0 ; if yes, allocate
add edx,25 ; increment ptr to callback
dec bl ; decrement loop counter
jnz @@l0 ; if more callbacks to check, loop
jmp int31fail8015 ; no free callback, error 8015h
@@f0: mov bx,[esp+38] ; BX = caller DS from stack
mov [edx+3],bx ; store callback parms in callback
mov [edx+7],esi
mov [edx+12],es
mov [edx+16],edi
sub edx,ecx ; DX = offset of callback
shr ecx,4 ; CX = segment of callback
jmp int31okdx ; return ok, with DX, CX, AX
;=============================================================================
; Free Real Mode Callback Address
;
int31h_0304:
cmp cx,cs:callbackseg ; valid callback segment?
jne int31fail8024 ; if no, error 8024h
movzx ebx,dx ; EBX = offset of callback
xor ax,ax ; check if valid offset
xchg dx,ax
mov cx,25
div cx
test dx,dx ; is there a remainder
jnz int31fail8024 ; if yes, not valid, error 8024h
test ah,ah ; callback index too big?
jnz int31fail8024 ; if yes, not valid, error 8024h
cmp al,cs:pm32_callbacks ; callback index out of range?
jae int31fail8024 ; if yes, not valid, error 8024h
add ebx,cs:callbackbase ; EBX -> callback
mov wptr [ebx+3],0 ; set callback as free
jmp int31ok ; return ok
;=============================================================================
; Get State Save/Restore Addresses
;
int31h_0305: ; get state save/restore addresses
add esp,26h ; adjust stack
pop ds ; restore DS
xor ax,ax ; size needed is none
mov bx,cs:kernel_code ; real mode seg of same RETF
mov cx,offs vxr_saverestorerm ; same offset of 16bit RETF
mov si,cs ; selector of routine is this one
mov edi,offs vxr_saverestorepm ; offset of simple 32bit RETF
jmp int31oknopop ; return ok, dont pop registers
;=============================================================================
; Get Raw CPU Mode Switch Addresses
;
int31h_0306: ; get raw mode switch addresses
add esp,26h ; adjust stack
pop ds ; restore DS
mov si,cs ; selector of pmtorm rout is this one
mov edi,cs:pmtormswrout ; offset in this seg of rout
mov bx,cs:kernel_code ; real mode seg of rmtopm rout
mov cx,cs:rmtopmswrout ; offset of rout in real mode
jmp int31oknopop ; return ok, dont pop registers
;=============================================================================
; MISC FUNCTIONS
;=============================================================================
;=============================================================================
; Get DPMI Version
;
int31h_0400:
add esp,26h ; adjust stack
pop ds ; restore DS
mov ax,005Ah ; return version 0.9
mov bx,0003h ; capabilities
cmp cs:pmodetype,2
jnz @@1
mov bl,1
@@1: mov cl,cs:cputype ; processor type
mov dx,wptr cs:picslave ; master and slave PIC values
jmp int31oknopop ; return ok, don't pop registers
;=============================================================================
; Get Vendor-Specific API Entry Point
;
int31h_0A00:
add esp,26h ; adjust stack
pop ds ; restore DS
push es edi ecx esi ; save regs that will be modified
push cs ; ES = CS
pop es
mov ecx,15 ; search for vendor1 string
mov edi,offs @@str1
push esi
repe cmps bptr ds:[esi],es:[edi]
pop esi
mov edi,offs @@ent1 ; ES:EDI = sel:offset of entry SUNSYS
jz @@0 ; if found, jump
test cs:pm32_mode,10000000b ; check if to ignore DOS/4G extensions
jnz @@err ; if not, we are done
mov cl,16 ; search for vendor2 string
mov edi,offs @@str2
repe cmps bptr ds:[esi],es:[edi]
jnz @@err ; if not found, done
mov edi,offs @@ent2 ; ES:EDI = sel:offset of entry DOS/4G
pop esi ecx
add esp,6
jmp int31oknopop
@@0: add esp,14
xor eax,eax ; clear high words
mov ebx,eax
mov ecx,eax
mov edx,eax
mov ax,cs:client_version ; AX = DOS Extender Version Number
mov bl,cs:pm32_mode ; BL = kernel configuration
mov bh,cs:pmodetype ; BH = system software type
mov cl,cs:cputype ; CL = processor type
mov ch,cs:fputype ; CH = FPU type
mov dx,wptr cs:picslave ; DX = PIC values (unremapped)
jmp int31oknopop
@@err: pop esi ecx edi es ; if none of the strings were idetified
mov ax,8001h ; return with AX=8001h
jmp int31failnopop
@@str1 db 'SUNSYS DOS/32A',0 ; vendor1 API ID-string (DOS/32A)
@@str2 db 'RATIONAL DOS/4G',0 ; vendor2 API ID-string (DOS/4G)
@@ent2: mov ax,8500h ; vendor2 API entry point (DOS/4G)
jmp dptr cs:client_call
@@ent1: test al,al ; vendor1 API entry point (DOS/32A)
jz API_func00
cmp al,01h
jz API_func01
cmp al,02h
jz API_func02
cmp al,03h
jz API_func03
cmp al,04h
jz API_func04
cmp al,05h
jz API_func05
cmp al,06h
jz API_func06
cmp al,07h
jz API_func07
cmp al,08h
jz API_func08
cmp al,09h
jz API_func09
stc
db 66h
retf
;---------------------------------------------------------------------
API_func00: ; API function 00h: get access to IDT & GDT
mov bx,SELZERO
movzx ecx,cs:gdtlimit ; ECX = GDT limit
movzx edx,cs:idtlimit ; EDX = IDT limit
mov esi,cs:gdtbase ; BX:ESI = pointer to GDT
mov edi,cs:idtbase ; BX:EDI = pointer to IDT
jmp API_funcok
;---------------------------------------------------------------------
API_func01: ; API function 01h: get access to PageTables
mov bx,SELZERO
movzx ecx,cs:pagetables ; ECX = number of allocated pagetables
movzx edx,cs:pm32_maxfpages ; EDX = number of allocated phystables
mov esi,cs:pagetablebase ; BX:ESI = pointer to 0th pagetable
mov edi,cs:phystablebase ; BX:EDI = pointer to phystable
inc cx
jmp API_funcok
;---------------------------------------------------------------------
API_func02: ; API function 02: get access to INT tables
mov bx,SELDATA
mov esi,offs irqset_rm ; BX:ESI = pointer to INT switches
mov edi,offs irqtab_rm ; BX:EDI = pointer to INT tables
jmp API_funcok
;---------------------------------------------------------------------
API_func03: ; API function 03: get access to EXT memory
mov bx,SELZERO
mov ecx,cs:mem_free ; ECX = size of allocated memory
mov edx,cs:mem_ptr ; EDX = pointer to allocated memory
mov esi,cs:mem_top ; ESI = top of allocated memory
jmp API_funcok
;---------------------------------------------------------------------
API_func04: ; API function 04: get access to rm-stacks
mov bx,SELZERO
movzx ecx,cs:rmstacklen ; ECX = size of one stack
movzx edx,cs:rmstacktop ; EDX = pointer to top of stack
movzx esi,cs:rmstackbase ; ESI = base of stack area
movzx edi,cs:rmstacktop2 ; EDI = default top of stack
jmp API_funcok
;---------------------------------------------------------------------
API_func05: ; API function 05: get access to pm-stacks
mov bx,SELZERO
mov ecx,cs:pmstacklen ; ECX = size of one stack
mov edx,cs:pmstacktop ; EDX = pointer to top of stack
mov esi,cs:pmstackbase ; ESI = base of stack area
mov edi,cs:pmstacktop2 ; EDI = default top of stack
jmp API_funcok
;---------------------------------------------------------------------
API_func06: ; API function 06: get kernel selectors
mov bx,SELCODE ; BX = Kernel code selector
mov cx,SELDATA ; CX = Kernel data selector
mov dx,SELZERO ; DX = Kernel zero selector
movzx esi,wptr cs:kernel_code ; ESI = Kernel code segment
mov di,wptr cs:client_call[2] ; DI = Client code selector
jmp API_funcok
;---------------------------------------------------------------------
API_func07: ; API function 07: get critical handler entry
mov cx,cs:client_call[2] ; CX = default 16bit selector
mov dx,cs:client_call[0] ; DX = default 16bit offset
jmp API_funcok
;---------------------------------------------------------------------
API_func08: ; API function 08: set critical handler entry
push ds
mov ds,cs:seldata
mov client_call[2],cx ; CX = custom 16bit selector
mov client_call[0],dx ; DX = custom 16bit offset
pop ds
jmp API_funcok
;---------------------------------------------------------------------
API_func09: ; API function 09: get access to p. counters
mov cx,SELDATA ; CX = Kernel data selector
mov edx,offs _pc_base ; EDX = base of performance counters
;---------------------------------------------------------------------
API_funcok:
clc
db 66h
retf
;=============================================================================
; MEMORY FUNCTIONS
;=============================================================================
;=============================================================================
; Get Free Memory Information
;
int31h_0500:
or eax,-1
mov ecx,0Ch
push edi
rep stos dptr es:[edi]
pop edi
mov eax,cs:mem_ptr
or eax,cs:mem_free
jz @@1
call int31_checkblocks
call int31_getfreemem
@@1: mov ebx,eax
mov edx,eax ; EDX = largest free block
mov eax,cs:mem_free
shr eax,12 ; EAX = total memory pages
shr ebx,12 ; EBX = free pages left
shr ecx,12 ; ECX = total allocated memory
push es
pop ds
mov [edi+00h],edx ; 00h - largest free block
mov [edi+04h],ebx ; 04h - max unlocked pages
mov [edi+08h],ebx ; 08h - max locked pages
mov [edi+0Ch],eax ; 0Ch - total linear space
mov [edi+10h],ebx ; 10h -
mov [edi+14h],ecx ; 14h -
mov [edi+18h],eax ; 18h - total pages
mov [edi+1Ch],ecx ; 1Ch - total free mem in pages
jmp int31ok
;=============================================================================
; Allocate Memory Block
;
int31h_0501:
call int31_checkifmemavail
call int31_testbxcxtoebx ; convert BX:CX to EBX
call int31_checkblocks
mov esi,cs:mem_ptr ; get pointer to memory
@@1: mov eax,[esi+04h] ; get block size
btr eax,31 ; check if memory block is used
jc @@2 ; if yes, jump
cmp eax,ebx ; check if block is large enough
jae int31_allocblock ; if yes, allocate block
@@2: lea esi,[esi+eax+10h] ; load address of next memory block
cmp esi,cs:mem_top ; check if at top of memory
jb @@1 ; if not, loop
jmp int31fail8013 ; fail: not enough memory
;=============================================================================
; Free Memory Block
;
int31h_0502:
shl esi,16 ; convert SI:DI to ESI
mov si,di
call int31_checkifmemavail
call int31_checkblocks
call int31_checkhandle
btr dptr [esi+04h],31 ; set block as free
call int31_linkfreeblocks
jmp int31ok
;=============================================================================
; Resize Memory Block
;
int31h_0503:
shl esi,16 ; convert SI:DI to ESI
mov si,di
call int31_checkifmemavail
call int31_testbxcxtoebx ; convert BX:CX to EBX
call int31_checkblocks
call int31_checkhandle
mov eax,[esi+04h] ; get size of this block
btr eax,31 ; check if block is used
jnc int31fail8023 ; if block is free, fail
cmp eax,ebx ; check if enough memory
jae int31_allocblock ; if yes, reallocate block
mov [esi+04h],eax ; set this block as free
lea edi,[esi+eax+10h] ; get address of next block
cmp edi,cs:mem_top ; check if at top of memory
jae @@0
mov edx,[edi+04h] ; get size of next block
btr edx,31 ; check if block next to us is free
jc @@0 ; if not, jump
lea edx,[eax+edx+10h] ; calculate total size (this+hdr+next)
cmp edx,ebx ; check if enough
jb @@0 ; if not, jump
mov eax,edx ; set this size = (this + next)
mov [esi+04h],eax ; link this and next blocks
jmp int31_allocblock ; and go to the allocation routine
@@0: mov edi,cs:mem_ptr ; get pointer to memory
@@1: mov edx,[edi+04h] ; get block size
btr edx,31 ; check if memory block is used
jc @@2 ; if yes, jump
cmp edx,ebx ; check if block is large enough
jae @@3 ; if yes, allocate block
@@2: lea edi,[edi+edx+10h] ; load address of next memory block
cmp edi,cs:mem_top ; check if at top of memory
jb @@1 ; if not, loop
bts eax,31 ; set this block as used
mov [esi+04h],eax ; restore state of this block
jmp int31fail8013 ; fail: not enough memory
@@3: push esi edi
mov ecx,eax
shr ecx,2
add esi,10h
add edi,10h
rep movs dptr es:[edi],ds:[esi]
mov cl,al
and cl,3
rep movs bptr es:[edi],ds:[esi]
pop edi esi
call int31_linkfreeblocks
mov esi,edi
mov eax,edx
jmp int31_allocblock ; and go to the allocation routine
;=============================================================================
; Get Memory Block Size and Base
;
int31h_050A:
shl esi,16 ; convert SI:DI to ESI
mov si,di
call int31_checkifmemavail
call int31_checkblocks
call int31_checkhandle
mov ebx,[esi+04h] ; check if block is used
btr ebx,31
jnc int31fail8023
add esi,10h
xchg ebx,esi
mov cx,bx
shr ebx,16
mov di,si
shr esi,16
jmp int31oksinoax
;-----------------------------------------------------------------------------
int31_checkifmemavail: ; check if memory had been allocated
pop bp
push eax
mov eax,cs:mem_ptr
or eax,cs:mem_free
pop eax
jz int31fail8013
jmp bp
;-----------------------------------------------------------------------------
int31_checkblocks: ; check if memory had been overwritten
push eax esi
mov esi,cs:mem_ptr
@@1: test si,000Fh ; blocks must be para aligned
jnz @@err
mov eax,12345678h ; header id
cmp eax,[esi+00h] ; if no header_id at block start
jnz @@err ; then signal error
cmp eax,[esi+0Ch] ; if no header_id at block end
jnz @@err ; then signal error
mov eax,[esi+04h] ; get block size
btr eax,31 ; reset the used flag
lea esi,[esi+eax+10h] ; load address of next memory block
cmp esi,cs:mem_ptr
jb @@err
cmp esi,cs:mem_top ; check if at top of memory
ja @@err
jb @@1 ; if not, loop
pop esi eax
@@done: ret
@@err: mov ds,cs:seldata
xor eax,eax
mov mem_ptr,eax ; set to zero to prevent looping error
mov mem_free,eax ; when exiting
mov ax,8400h
jmp dptr client_call
;-----------------------------------------------------------------------------
int31_checkhandle:
pop bp ; check for valid handle in ESI
cmp esi,cs:mem_ptr
jb @@1
cmp esi,cs:mem_top
ja @@1
mov eax,12345678h
cmp eax,[esi+00h]
jnz @@1
cmp eax,[esi+0Ch]
jnz @@1
jmp bp
@@1: jmp int31fail8023 ; fail: invalid handle
;-----------------------------------------------------------------------------
int31_testbxcxtoebx: ; convert BX:CX to EBX
pop bp
shl ebx,16
mov bx,cx
test ebx,ebx
jz int31fail8021 ; BX:CX cannot be zero
add ebx,0Fh ; align EBX on para boundary
and bl,0F0h
bt ebx,31
jc int31fail8021 ; cannot allocate that much memory
jmp bp
;-----------------------------------------------------------------------------
int31_getfreemem:
xor eax,eax ; reset free memory size
xor ecx,ecx
mov esi,cs:mem_ptr ; get pointer to memory
@@1: mov edx,[esi+04h] ; get block size
btr edx,31 ; check if memory block is used
jc @@2 ; if yes, jump
add ecx,edx
cmp eax,edx ; pick largest value
ja @@2
mov eax,edx
@@2: lea esi,[esi+edx+10h] ; load addres of next memory block
cmp esi,cs:mem_top ; check if at top of memory
jb @@1 ; if not, loop
ret
;-----------------------------------------------------------------------------
int31_allocblock:
mov ecx,12345678h
movzx edx,cs:id32_process_id
sub eax,ebx ; nextsize=actualsize-allocsize
sub eax,10h ; is nextsize<16 (header size)
jb @@1 ; if yes, do not create next block
lea edi,[esi+ebx+10h] ; EDI = ptr to next block
mov [edi+00h],ecx ; header ID1
mov [edi+04h],eax ; set next block as free/size
mov [edi+08h],edx ; process_ID
mov [edi+0Ch],ecx ; header ID2
@@1: bts ebx,31 ; set this block as used
mov [esi+00h],ecx ; header ID1
mov [esi+04h],ebx ; store this block size in header
mov [esi+08h],edx ; process_ID
mov [esi+0Ch],ecx ; header ID2
call int31_linkfreeblocks
lea ebx,[esi+10h] ; EBX = ptr to memory block (-header)
mov cx,bx
shr ebx,16
mov di,si
shr esi,16
jmp int31oksinoax
;-----------------------------------------------------------------------------
int31_linkfreeblocks:
pushad
mov edi,cs:mem_ptr ; EDI = ptr to 1st block handle
mov ebp,cs:mem_top
mov eax,[edi+04h] ; get 1st block size
btr eax,31
lea esi,[edi+eax+10h] ; ESI = ptr to 2nd block handle
cmp esi,ebp ; check if at top of memory
jae @@done ; if yes, done
mov esi,edi ; ESI=EDI = ptr to 1st block
@@1: mov eax,[esi+04h] ; get block size
btr eax,31 ; check if block is used
jc @@4 ; if yes, jump
xor ebx,ebx ; reset amount of free block memory
xor ecx,ecx ; reset number of free blocks in raw
mov edi,esi ; remember addr of first free block
jmp @@3
@@2: add ecx,10h ; increment number of free blocks
mov eax,[esi+04h] ; get block size
btr eax,31 ; check if block is free
lea ebx,[eax+ebx] ; amount of free memory encountered
jnc @@3 ; if yes, jump
sub ebx,eax
sub ecx,10h
add ebx,ecx
add [edi+04h],ebx
jmp @@4
@@3: lea esi,[esi+eax+10h] ; calculate address of next block
cmp esi,ebp ; check if at top of memory
jb @@2 ; if not, loop
add ebx,ecx
add [edi+04h],ebx
jmp @@done
@@4: lea esi,[esi+eax+10h] ; calculate address of next block
cmp esi,ebp ; check if at top of memory
jb @@1 ; if not, loop
@@done: popad
ret
;=============================================================================
; VIRTUAL MEMORY FUNCTIONS (not supported)
;=============================================================================
;=============================================================================
; Lock Linear Region
; Unlock Linear Region
; Mark Real Mode Region as Pageable
; Relock Real Mode Region
; Mark Page as Demand Paging Candidate
; Discard Page Contents
;
int31h_0600:
int31h_0601:
int31h_0602:
int31h_0603:
int31h_0702:
int31h_0703:
jmp int31ok
;=============================================================================
; Get Page Size
;
int31h_0604:
xor bx,bx
mov cx,1000h
jmp int31okbx
;=============================================================================
; PHYSICAL MEMORY MAPPING FUNCTIONS
;=============================================================================
;=============================================================================
; Physical Address Mapping
;
int31h_0800:
shl ebx,16 ; convert BX:CX to EBX
shl esi,16 ; convert SI:DI to ESI
mov bx,cx
mov si,di
cmp ebx,100000h ; check if mapping under 1MB limit
jb int31fail8021 ; if yes, error
test esi,esi ; check if size is zero
jz int31fail8021 ; if yes, error
cmp cs:pmodetype,2 ; check if system is VCPI
jz @@vcpi ; if yes, do VCPI memory mapping
jmp int31ok ; if under raw/XMS, do nothing
@@vcpi: cmp cs:pm32_maxfpages,0 ; check if any linear memory avail.
jz int31fail8012 ; if not, signal error 8012h
push ds
pop es
mov edi,cs:phystablebase ; get base of pagetables
@@0: mov eax,ebx ; EAX = physical address
lea ecx,[esi+0FFFh] ; ECX = size of memory to map
and ax,0F000h
shr ecx,12
mov edx,edi
@@1: cmp edi,cs:phystabletop ; are there any pages mapped left
jae @@3 ; no, go on with mapping
mov ebp,[edi]
and bp,0F000h
cmp eax,ebp ; check if page already mapped
jz @@2 ; if yes, go to check next page
add edi,4 ; increment pointer into pagetables
jmp @@0 ; loop
@@2: add edi,4 ; increment pointer into pagetables
add eax,4096
dec ecx ; decrement amount of pages checked
jnz @@1 ; if there are more left, loop
mov eax,ebx
and ax,0F000h
sub ebx,eax
jmp @@done ; region already mapped, we are done
@@3: mov edi,cs:phystablebase ; get base of pagetables
mov ecx,cs:phystabletop ; get number of available pagetables
sub ecx,edi
shr ecx,2 ; convert to 4KB pages
mov eax,ebx
and ax,0F000h
lea ebp,[ebx+esi+0FFFh] ; EBP = number of required 4KB pages
sub ebp,eax
shr ebp,12
@@4: test ecx,ecx ; check if no linear space left
jz int31fail8021 ; if yes, error
xor eax,eax
repne scas dptr es:[edi] ; scan for first free page
lea edx,[edi-4] ; EDX = first free page address
repe scas dptr es:[edi] ; scan for amount of free pages
mov eax,edi
sub eax,edx
shr eax,2 ; EAX = free pages available
cmp eax,ebp ; check if enough free pages
jb @@4 ; no, must loop
mov eax,ebx ; EAX = physical address
and ax,0F000h
sub ebx,eax
mov edi,edx ; EDI = address of first free page
mov ecx,ebp
mov al,07h ; set page as user/writeable/present
cmp cs:cputype,3 ; check if CPU is 486+
jbe @@loop ; if not, jump
mov al,1Fh ; set PCD and PWT bits (no page cache)
@@loop: stos dptr es:[edi] ; map one 4KB page
add eax,4096 ; go for next page
loop @@loop ; loop until no pages left
or bptr [edx+1],2 ; mark start of mapped block
or bptr [edi-3],4 ; mark end of mapped block
@@done: sub edx,cs:phystablebase
shl edx,10
add edx,ebx
mov [esp+18h],dx
shr edx,16
or dx,8000h
mov [esp+10h],dx
mov eax,cs:vcpi_cr3
mov cr3,eax
xor eax,eax
mov cr2,eax
jmp int31ok
;=============================================================================
; Free Physical Address Mapping
;
int31h_0801:
cmp cs:pmodetype,2
jz @@vcpi
jmp int31ok ; if under raw/XMS, do nothing
@@vcpi: cmp cs:pm32_maxfpages,0 ; check if any linear memory avail.
jz int31fail8012 ; if not, signal error 8012h
and bx,7FFFh
shl ebx,16
mov bx,cx
shr ebx,10
and bl,0FCh
add ebx,cs:phystablebase
cmp ebx,cs:phystablebase ; check if addr is in range
jb int31fail8025
cmp ebx,cs:phystabletop
jae int31fail8025
test bptr [ebx+1],2
jz int31fail8025
@@loop: xor eax,eax ; clear page table entries
xchg eax,[ebx]
add ebx,04h
test ah,04h
jz @@loop
@@1: mov eax,cs:vcpi_cr3
mov cr3,eax
xor eax,eax
mov cr2,eax
jmp int31ok
;=============================================================================
; FPU RELATED FUNCTIONS
;=============================================================================
;=============================================================================
; Get Coprocessor Status
;
int31h_0E00:
movzx ax,cs:fputype ; get FPU type
shl ax,4 ; put FPU type in bits 4..7
smsw dx ; get MSW in DX
and dl,06h ; mask MP & EM bits
shr dl,1 ; map MP & EM bits to MPv & EMv bits
or al,dl ; put MPv & EMv bits into AL
shl dl,2 ; map MP & EM bits to MPr & EMr bits
or al,dl ; put MPr & EMr bits into AL
jmp int31okax
;=============================================================================
; Set Coprocessor Emulation
;
int31h_0E01:
mov ds,cs:seldata
and bl,00000011b ; mask MPv & EMv bits
shl bl,1 ; map MPv & EMv bits to MP & EM bits
smsw ax ; get MSW in AX
or al,bl ; set MP & EM bits
lmsw ax ; reload MSW
jmp int31ok
;=============================================================================
; NON-STANDARD FUNCTIONS
;=============================================================================
;=============================================================================
; PMODE/W id function
;
int31h_EEFF:
add esp,26h ; adjust stack
pop ds ; restore DS
push cs
pop es ; ES = CS
mov eax,'D32A' ; load id-string
mov ebx,offs $+2 ; ES:EBX points to itself ('\0' within opcode)
mov ch,cs:pmodetype
mov cl,cs:cputype
mov dx,cs:client_version
jmp int31oknopop
| 29.087318 | 78 | 0.583822 |
ee8f0249b86b739fc32307cbdf1a5a874fab508f | 448 | asm | Assembly | libsrc/stdio/ace/fgetc_cons.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 38 | 2021-06-18T12:56:15.000Z | 2022-03-12T20:38:40.000Z | libsrc/stdio/ace/fgetc_cons.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 2 | 2021-06-20T16:28:12.000Z | 2021-11-17T21:33:56.000Z | libsrc/stdio/ace/fgetc_cons.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 6 | 2021-06-18T18:18:36.000Z | 2021-12-22T08:01:32.000Z | ;
; Basic keyboard handling for the Jupiter ACE
; By Stefano Bodrato Feb. 2001
;
; getkey() Wait for keypress
;
;
; $Id: fgetc_cons.asm,v 1.5 2016-05-18 21:25:24 dom Exp $
;
SECTION code_clib
PUBLIC fgetc_cons
.fgetc_cons
.kwait
call $336
and a
jr nz,kwait
.kwait1
call $336
and a
jr z,kwait1
cp 5 ; Delete?
jr nz,nodel
ld a,8
.nodel
IF STANDARDESCAPECHARS
cp 13
jr nz,not_return
ld a,10
.not_return
ENDIF
ld l,a
ld h,0
ret
| 11.2 | 57 | 0.689732 |
73ca562e491a5e27c035321c8f642fefc3132567 | 229 | asm | Assembly | unittests/ASM/PrimaryGroup/3_F7_06_2.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | 628 | 2020-03-06T14:01:32.000Z | 2022-03-31T06:35:14.000Z | unittests/ASM/PrimaryGroup/3_F7_06_2.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | 576 | 2020-03-06T08:25:12.000Z | 2022-03-30T04:05:29.000Z | unittests/ASM/PrimaryGroup/3_F7_06_2.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | 38 | 2020-03-07T06:10:00.000Z | 2022-03-29T09:27:36.000Z | %ifdef CONFIG
{
"RegData": {
"RAX": "0x80000000",
"RDX": "0"
}
}
%endif
mov r15, 0xe0000000
mov eax, 0x2
mov [r15 + 8 * 0], eax
mov rax, 0xFFFFFFFF00000000
mov rdx, 0xFFFFFFFF00000001
div dword [r15 + 8 * 0]
hlt
| 10.904762 | 27 | 0.611354 |
3d8413a4bb5640825623e9d6a3ee82076622e40c | 1,970 | asm | Assembly | src/boot/bootsector.asm | bbworld1/egg-kernel | 176d056f75c5c923065e225a020a8d9fa0426eb3 | [
"MIT"
] | 8 | 2020-06-01T19:06:35.000Z | 2021-07-06T04:13:34.000Z | src/boot/bootsector.asm | bbworld1/egg-kernel | 176d056f75c5c923065e225a020a8d9fa0426eb3 | [
"MIT"
] | 1 | 2020-10-20T05:11:26.000Z | 2020-10-20T05:11:26.000Z | src/boot/bootsector.asm | bbworld1/egg-kernel | 176d056f75c5c923065e225a020a8d9fa0426eb3 | [
"MIT"
] | 5 | 2020-06-01T22:36:55.000Z | 2020-10-27T03:25:37.000Z | ; bootsector.asm: EggOS bootsector
; Start environment: real mode, physical address = 0x7C00
; No guarantees about actual CS/IP
; DL = disk number
BITS 16
ORG 0x7C00
; Some defines
SECTORS_TO_LOAD equ 3
; Set CS/IP by doing a far jump
jmp 0x0000:start
; Entry point
start:
; Set up segments and stack
cli
; Zero all segment registers
xor ax, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; Stack grows down from physical 0x7BFF, right below bootsector
mov ss, ax
mov sp, 0x7BFF
sti
; Save disk number on stack
push dx
; Switch VGA mode to text
; This is necessary on some devices that do not start in text mode
call setTextmode
; Load stage 2
call loadStage2
cmp ah, 0
jne .errorLoading
; Jump to bootloader
jmp 0x0000:0x7E00
; Hang (execution should never get here though)
jmp hang
; Called if stage 2 can't be loaded
.errorLoading:
mov eax, 0xDEADDEAD
jmp hang
; Enable textmode
; Set VGA mode to 3 (text) via BIOS interrupt 0x10
setTextmode:
xor ah, ah
mov al, 0x03
int 0x10
ret
; Load stage 2 of the bootloader
; Use BIOS interrupt 0x13 to load sectors
loadStage2:
; DL should have the drive index, which is already set for us by the boot sequence
mov ah, 0x42 ; AH = function number (0x42 = "extended read")
mov si, DAP ; DS:SI = pointer to DAP (structure containing data for interrupt)
int 0x13 ; Read data into buffer
ret
DAP:
db 0x10 ; Size of the DAP (always 16)
db 0x00 ; Must be zero
dw SECTORS_TO_LOAD ; Number of sectors
dw 0x7E00 ; Buffer offset
dw 0x0000 ; Buffer segment
dq 1 ; LBA sector to start at
; Hang system forever
hang:
cli
hlt
jmp hang
; Pad sectors with zero, leave space for magic number
TIMES 510-($-$$) db 0
dw 0xAA55 | 21.648352 | 94 | 0.628934 |
5e6eaf6a857c948e0f6024841feb267e973f46a5 | 500 | asm | Assembly | x86/string_operations_toolkit/string_operations_toolkit.asm | straceX/assemblyprogrammingtoolkit | d32d68572f10fa23302c3ab04d2f60d43a00dc61 | [
"Apache-2.0"
] | null | null | null | x86/string_operations_toolkit/string_operations_toolkit.asm | straceX/assemblyprogrammingtoolkit | d32d68572f10fa23302c3ab04d2f60d43a00dc61 | [
"Apache-2.0"
] | null | null | null | x86/string_operations_toolkit/string_operations_toolkit.asm | straceX/assemblyprogrammingtoolkit | d32d68572f10fa23302c3ab04d2f60d43a00dc61 | [
"Apache-2.0"
] | null | null | null | [BITS 32]
SECTION .text
global _strlenASM,_strlenASMv2
_strlenASM:
push ebp
mov ebp, esp
xor ecx, ecx
mov eax, [ebp + 8]
@2:
mov dl, [eax]
test dl, dl
jz @1
inc ecx
inc eax
jmp @2
@1:
mov eax, ecx
pop ebp
ret
_strlenASMv2:
push ebp
mov ebp, esp
push edi
xor ecx, ecx
dec ecx ; ecx = 0xFFFFFFFF
mov edi, [ebp + 8]
xor al, al
cld
repnz scasb
sub edi, [ebp + 8]
lea eax, [edi - 1]
;neg ecx ;Second way
;lea eax, [ecx - 2] ;Second way
pop edi
pop ebp
ret | 11.904762 | 32 | 0.614 |
6b9da72cf2e69b1bf031986c977c2a42b4c5ce4a | 353 | asm | Assembly | programs/oeis/084/A084633.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/084/A084633.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/084/A084633.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A084633: Inverse binomial transform of repeated odd numbers.
; 1,0,2,-4,8,-16,32,-64,128,-256,512,-1024,2048,-4096,8192,-16384,32768,-65536,131072,-262144,524288,-1048576,2097152,-4194304,8388608,-16777216,33554432,-67108864,134217728,-268435456,536870912,-1073741824,2147483648,-4294967296
mov $1,$0
sub $1,1
mov $2,-2
pow $2,$1
bin $0,$2
sub $0,$2
| 35.3 | 229 | 0.733711 |
d5495ca4392464bd049ad458d40aa7e87ab615f6 | 9,702 | asm | Assembly | libsrc/target/gb/gbdk/input.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/target/gb/gbdk/input.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/target/gb/gbdk/input.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | MODULE input
INCLUDE "target/gb/def/gb_globals.def"
;; Note that while gets uses a pointer, the pointer had better
;; be in non-banked RAM else bad things will happen.
;; BANKED: checked, imperfect
PUBLIC tmode_inout
GLOBAL copy_vram
GLOBAL set_xy_wtt
GLOBAL mv_sprite
GLOBAL set_sprite_prop
GLOBAL set_sprite_tile
GLOBAL asm_jpad
GLOBAL waitpadup
EXTERN __mode
EXTERN display_off
EXTERN wait_vbl_done
defc MINMSPOSX = 0x02 ; In tiles
defc MINMSPOSY = 0x0A
defc MAXMSPOSX = 0x11
defc MAXMSPOSY = 0x0F
defc INIMSPOSX = MINMSPOSX
defc INIMSPOSY = MINMSPOSY
defc KBDWINPOSY = 0x08 ; In tiles
defc KBDSIZE = 0x1006
defc MSOFFSETX = 0x0C ; In pixels
defc MSOFFSETY = 0x14
defc MINACCEL = 0x0800
defc MAXACCEL = 0x0100
defc CR = 0x0A ; Unix
GLOBAL tmode_out ; From 'output.s'
GLOBAL asm_putchar
GLOBAL asm_del_char
GLOBAL __console_y
SECTION bss_driver
msx: ; Mouse position
defs 0x01
msy:
defs 0x01
msacc: ; Mouse acceleration
defs 0x02
msstate: ; Mouse state
defs 0x01
mschanged: ; Did the mouse move?
defs 0x01
string_len: ; Used length of input buffer
defs 0x01
SECTION code_driver
;; Enter text mode with input
tmode_inout:
DI ; Disable interrupts
;; Turn the screen off
LDH A,(LCDC)
BIT 7,A
;; Turn the screen off
CALL nz,display_off
LD A,(__mode)
AND T_MODE
CALL Z,tmode_out
LD BC,tp1 ; Move pointer
LD HL,0x8000
LD DE,endtp1-tp1
CALL copy_vram
LD A,MINACCEL / 256 ; Acceleration
LD (msacc),A
LD A,MINACCEL % 256
LD (msacc+1),A
;; Initialize window
LD BC,frame_tiles
LD DE,0x0000 ; Place image at (0x00,0x00) tiles
LD HL,0x140A ; Image size is 0x14 x 0x0A tiles
CALL set_xy_wtt
LD BC,kbdtable
LD DE,0x0202 ; Place image at (0x02,0x02) tiles
LD HL,KBDSIZE ; Image size is 0x10 x 0x06 tiles
CALL set_xy_wtt
XOR A
LD A,MINWNDPOSX
LDH (WX),A
LD A,MAXWNDPOSY ; Hide window
LDH (WY),A
;; Initialize sprite
LD C,0x00 ; Sprite 0x00
LD D,0x00 ; Default sprite properties
CALL set_sprite_prop
LD C,0x00 ; Sprite 0x00
LD D,0x00 ; Tile 0x00
CALL set_sprite_tile
LD A,@00101100
LDH (OBP0),A
;; Turn the screen on
LD A,@11000001 ; LCD = On
; WindowBank = 0x9C00
; Window = Off
; BG Chr = 0x8800
; BG Bank = 0x9800
; OBJ = 8x8
; OBJ = Off
; BG = On
LDH (LCDC),A
LD A,T_MODE_INOUT
LD (__mode),A
EI ; Enable interrupts
RET
;; Prompt the user for a char and return it in A
PUBLIC asm_getchar
asm_getchar:
PUSH BC
PUSH DE
PUSH HL
CALL show_kbd
CALL show_mouse
get_1:
CALL track_mouse
CALL update_mouse
CALL asm_jpad
LD D,A
AND BUT_A ; Is A pressed ?
JP Z,get_1
LD A,(msy) ; Look for char under the mouse
SUB MINMSPOSY
JR Z,get_12
LD E,A
XOR A
get_11:
ADD MAXMSPOSX-MINMSPOSX+1
DEC E
JR NZ,get_11
get_12:
LD E,A
LD A,(msx)
SUB MINMSPOSX
ADD E
LD HL,kbdtable
LD B,0x00
LD C,A
ADD HL,BC
LD B,(HL)
CALL hide_mouse
CALL hide_kbd
LD A,B
POP HL
POP DE
POP BC
RET
;; Prompt the user for a string and store it in (HL)
PUBLIC asm_getstring
asm_getstring:
PUSH BC
PUSH DE
PUSH HL
CALL show_kbd
CALL show_bkg
CALL show_mouse
XOR A
LD (string_len),A
getstr_1:
CALL track_mouse
CALL update_mouse
CALL asm_jpad
LD D,A
AND BUT_A ; Is A pressed ?
JP NZ,getstr_10
LD A,D
AND BUT_B ; Is B pressed ?
JP NZ,getstr_20
LD A,D
AND SELECT ; Is SELECT pressed ?
JP NZ,getstr_30
LD A,D
AND START ; Is START pressed ?
JR Z,getstr_1
CALL waitpadup ; Wait for button to be depressed
LD A,CR
CALL asm_putchar
LD (HL),0x00
CALL hide_mouse
CALL hide_bkg
CALL hide_kbd
POP HL
POP DE
POP BC
RET
getstr_10:
;; Insert a character at cursor position
LD A,(string_len) ; Check buffer length
; CP BUFLEN-1 ; Keep 1 char for EOS
; JR Z,13$
INC A
LD (string_len),A ; Update it
LD A,(msy) ; Look for char under the mouse
SUB MINMSPOSY
JR Z,getstr_12
LD E,A
XOR A
getstr_11:
ADD MAXMSPOSX-MINMSPOSX+1
DEC E
JR NZ,getstr_11
getstr_12:
LD E,A
LD A,(msx)
SUB MINMSPOSX
ADD E
PUSH HL
LD HL,kbdtable
LD B,0x00
LD C,A
ADD HL,BC
LD A,(HL)
POP HL
LD (HL+),A ; Add it into input buffer
CALL asm_putchar ; Print it
CALL show_bkg ; Ensure the text is not hidden
getstr_13:
CALL waitpadup ; Wait for button to be depressed
JP getstr_1
getstr_20:
;; Delete a character at cursor position
LD A,(string_len) ; Is there any char in the buffer ?
OR A
JR Z,getstr_21
DEC A ; Yes
LD (string_len),A ; Update buffer length
DEC HL
CALL asm_del_char
getstr_21:
CALL waitpadup ; Wait for button to be depressed
JP getstr_1
getstr_30:
CALL hide_mouse
CALL hide_bkg
CALL hide_kbd
CALL waitpadup ; Wait for button to be depressed
CALL show_kbd
CALL show_bkg
CALL show_mouse
JP getstr_1
show_kbd:
PUSH BC
PUSH DE
LDH A,(LCDC)
OR @00100000 ; Window = On
LDH (LCDC),A
LD A,MAXWNDPOSY ; Show window
showkbd_1:
BIT 0,A ; Wait for VBL every 2 pixels (slow down)
JR NZ,showkbd_2
LD B,A
CALL wait_vbl_done
LD A,B
showkbd_2:
LDH (WY),A
CP KBDWINPOSY*0x08
JR Z,showkbd_99
DEC A
JR showkbd_1
showkbd_99:
POP DE
POP BC
RET
hide_kbd:
PUSH BC
PUSH DE
LD A,KBDWINPOSY*0x08+1
hide_1: ;de window
BIT 0,A ; Wait for VBL every 2 pixels (slow down)
JR Z,hide_2
LD B,A
CALL wait_vbl_done
LD A,B
hide_2:
LDH (WY),A
CP MAXWNDPOSY
JR Z,hide_3
INC A
JR hide_1
hide_3:
LDH A,(LCDC)
AND @11011111 ; Window = Off
LDH (LCDC),A
POP DE
POP BC
RET
show_bkg:
PUSH BC
PUSH DE
LDH A,(SCY)
LD D,A
LD A,(__console_y)
SUB KBDWINPOSY-1
JR C,show_99
JR Z,show_99
SLA A ; A = A * 8
SLA A
SLA A
SUB D
JR C,show_99
JR Z,show_99
LD C,A
LDH A,(SCY)
show_1:
BIT 0,A ; Wait for VBL every 2 pixels (slow down)
JR Z,show_2
LD B,A
CALL wait_vbl_done
LD A,B
show_2:
INC A
LDH (SCY),A
DEC C
JR nz,show_1
show_99:
POP DE
POP BC
RET
hide_bkg:
LDH A,(SCY)
OR A
RET Z
PUSH BC
PUSH DE
hidebkg_1:
BIT 0,A ; Wait for VBL every 2 pixels (slow down)
JR Z,hidebkg_2
LD B,A
CALL wait_vbl_done
LD A,B
hidebkg_2:
DEC A
LDH (SCY),A
JR Z,hidebkg_99
JR hidebkg_1
hidebkg_99:
POP DE
POP BC
RET
show_mouse:
LD A,INIMSPOSX
LD (msx),A
LD A,INIMSPOSY
LD (msy),A
CALL set_mouse
LDH A,(LCDC)
OR @00000010 ; OBJ = On
LDH (LCDC),A
RET
hide_mouse:
LDH A,(LCDC)
AND @11111101 ; OBJ = Off
LDH (LCDC),A
RET
track_mouse:
PUSH BC
PUSH DE
PUSH HL
XOR A
LD (mschanged),A ; Default to no change
CALL asm_jpad
LD D,A
LD HL,msstate
AND UP+DOWN+LEFT+RIGHT
JR NZ,track_1
LD (HL),0x00 ; Reset state
JP track_99
track_1:
LD A,(HL)
LD (HL),0x01 ; Set state
OR A ; Was it 0 ?
LD HL,msacc ; Acceleration
JR NZ,track_2
; Yes
LD (HL),MINACCEL % 256
INC HL
LD (HL),MINACCEL / 256
JR track_4 ; Update position
track_2:
LD C,(HL)
INC HL
LD B,(HL)
DEC BC
LD A,B
OR C
JR Z,track_3
LD (HL),B
DEC HL
LD (HL),C
JP track_99
track_3: ;Set new acceleration to maximum
LD (HL),MAXACCEL % 256
DEC HL
LD (HL),MAXACCEL / 256
track_4: ;update position
LD A,0x01
LD (mschanged),A
LD A,D
AND UP ; Is UP pressed ?
JR Z,track_6
LD A,(msy)
CP MINMSPOSY
JR Z,track_5
DEC A
LD (msy),A
JR track_6
track_5:
LD A,MAXMSPOSY
LD (msy),A
track_6:
LD A,D
AND DOWN ; Is DOWN pressed ?
JR Z,track_8
LD A,(msy)
CP MAXMSPOSY
JR Z,track_7
INC A
LD (msy),A
JR track_8
track_7:
LD A,MINMSPOSY
LD (msy),A
track_8:
LD A,D
AND LEFT ; Is LEFT pressed ?
JR Z,track_10
LD A,(msx)
CP MINMSPOSX
JR Z,track_9
DEC A
LD (msx),A
JR track_10
track_9:
LD A,MAXMSPOSX
LD (msx),A
track_10:
LD A,D
AND RIGHT ; Is RIGHT pressed ?
JR Z,track_99
LD A,(msx)
CP MAXMSPOSX
JR Z,track_11
INC A
LD (msx),A
JR track_99
track_11:
LD A,MINMSPOSX
LD (msx),A
track_99:
POP HL
POP DE
POP BC
RET
update_mouse:
LD A,(mschanged) ; Did it change ?
OR A
RET Z ; No
set_mouse:
PUSH BC
PUSH DE
PUSH HL
LD C,0x00 ; Sprite 0x00
LD A,(msx)
SLA A ; A = A * 8
SLA A
SLA A
ADD MSOFFSETX
LD D,A
LD A,(msy)
SLA A ; A = A * 8
SLA A
SLA A
ADD MSOFFSETY
LD E,A
CALL mv_sprite
POP HL
POP DE
POP BC
RET
;; PENDING: this is unfortunate. Refed from .tmode_inout
SECTION rodata_driver
tp1:
pointers:
; Tile 0x00
defb 0xFF,0xFF,0xFE,0x82,0xFC,0x84,0xFC,0x84,0xFE,0x82,0xFF,0xB1,0xCF,0xC9,0x87,0x87
endtp1:
frame_tiles:
defb 0x1C,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x1D
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x0F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0F
defb 0x1E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x1F
kbdtable:
;; This is unfortunate. astorgb and rgbasm cant interpert:
;; defm " !\"#$%&'()*+,-./"
;; so we have to use the hex form here.
defb 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27
defb 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F
defm "0123456789:"
;; astorgb recognises the embedded ; as a comment :)
defb 0x3B
defm "<=>?"
defm "@ABCDEFGHIJKLMNO"
defm "PQRSTUVWXYZ[\\]^_"
defm "`abcdefghijklmno"
defm "pqrstuvwxyz\{\|\}~ "
| 17.294118 | 105 | 0.701402 |
6ff4823601d402160a1e94c4062b69b8740e9eca | 392 | asm | Assembly | WEEK_2/multiplying_without_mul.asm | L12161/assembly_habijabi | 4dc7e77af33997f953107a1222a47b7b8b223f93 | [
"Apache-2.0"
] | null | null | null | WEEK_2/multiplying_without_mul.asm | L12161/assembly_habijabi | 4dc7e77af33997f953107a1222a47b7b8b223f93 | [
"Apache-2.0"
] | null | null | null | WEEK_2/multiplying_without_mul.asm | L12161/assembly_habijabi | 4dc7e77af33997f953107a1222a47b7b8b223f93 | [
"Apache-2.0"
] | null | null | null | CODE SEGMENT
ASSUME CS:CODE, DS:CODE
MOV AL,1101b
MOV BL,11b
MOV DL,AL ; FOR ADDING
;MOV DL,AL ; FOR THE LAST DIGIT LOOP
MOV CX,8
MOV AX, 0
ADD_AND_SHIFT_LOOP:
RCR BL,1
JNC ADD_TIMES_ZERO
ADD_TIMES_ONE:
ADD AX,DX
SHL DL,1
JMP PRE_LOOP
ADD_TIMES_ZERO:
ADD AX,0
SHL DL,1
JMP PRE_LOOP
PRE_LOOP:
LOOP ADD_AND_SHIFT_LOOP
HLT
CODE ENDS
END | 14 | 39 | 0.663265 |
8da9b486e8762a3371f32f756e18dfdb5906c0aa | 8,450 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_257.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_257.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_257.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x210e, %rbp
nop
nop
nop
cmp $44164, %r8
mov $0x6162636465666768, %rbx
movq %rbx, (%rbp)
nop
add $34338, %r14
lea addresses_WT_ht+0x831e, %rdx
nop
nop
nop
xor $56183, %r11
mov (%rdx), %r9w
nop
nop
nop
nop
nop
sub %rbx, %rbx
lea addresses_WT_ht+0xe7c6, %r9
nop
xor %rbx, %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
movups %xmm7, (%r9)
nop
add %rdx, %rdx
lea addresses_D_ht+0x1c21e, %rsi
lea addresses_A_ht+0x19dee, %rdi
nop
nop
nop
nop
nop
cmp $51368, %r9
mov $33, %rcx
rep movsb
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x1851e, %rsi
lea addresses_A_ht+0x1711e, %rdi
nop
nop
xor %rdx, %rdx
mov $9, %rcx
rep movsw
nop
nop
nop
and %rdx, %rdx
lea addresses_WT_ht+0xa352, %rbp
nop
nop
nop
nop
and %rdi, %rdi
movb $0x61, (%rbp)
nop
nop
nop
nop
dec %r8
lea addresses_WT_ht+0x971e, %rbp
nop
dec %r11
movb $0x61, (%rbp)
nop
add $63487, %rdx
lea addresses_UC_ht+0x441e, %rsi
lea addresses_D_ht+0x491e, %rdi
nop
nop
nop
dec %rdx
mov $26, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %rsi
lea addresses_A_ht+0xf31e, %rsi
lea addresses_WT_ht+0x4b1e, %rdi
sub $14479, %rbx
mov $77, %rcx
rep movsq
xor $5327, %rbp
lea addresses_WC_ht+0x1627e, %rsi
lea addresses_UC_ht+0x5ade, %rdi
nop
nop
nop
nop
sub $65297, %r14
mov $76, %rcx
rep movsq
nop
cmp %rsi, %rsi
lea addresses_D_ht+0x831e, %r8
xor %rdx, %rdx
movb (%r8), %r14b
nop
nop
nop
nop
nop
mfence
lea addresses_D_ht+0xeede, %r8
nop
nop
inc %r11
movw $0x6162, (%r8)
nop
nop
nop
nop
xor $16703, %r14
lea addresses_WC_ht+0x6bde, %r14
nop
nop
nop
nop
nop
add %rdi, %rdi
mov (%r14), %r11w
nop
add $43396, %rdx
lea addresses_UC_ht+0x91ae, %rsi
lea addresses_A_ht+0x13b9e, %rdi
clflush (%rsi)
nop
nop
nop
add %r8, %r8
mov $9, %rcx
rep movsw
nop
dec %rbp
lea addresses_normal_ht+0x3854, %r11
nop
sub $35366, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%r11)
nop
and %rbx, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rax
push %rbp
push %rcx
push %rsi
// Store
lea addresses_normal+0x1acea, %rbp
nop
sub $9607, %r13
movw $0x5152, (%rbp)
nop
nop
and $28516, %r13
// Load
lea addresses_RW+0x1a592, %r9
nop
nop
nop
nop
cmp $9974, %rax
movntdqa (%r9), %xmm4
vpextrq $0, %xmm4, %rsi
nop
nop
sub %rsi, %rsi
// Store
lea addresses_US+0x6ade, %r9
add %r11, %r11
movw $0x5152, (%r9)
dec %rcx
// Faulty Load
lea addresses_WC+0xf1e, %rcx
add %rax, %rax
mov (%rcx), %bp
lea oracles, %r9
and $0xff, %rbp
shlq $12, %rbp
mov (%r9,%rbp,1), %rbp
pop %rsi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_US'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 10, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': True, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 32.625483 | 2,999 | 0.653964 |
7df052a9e4445d661b1c3b96ff3717d20d2125fb | 584 | asm | Assembly | programs/oeis/000/A000457.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/000/A000457.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/000/A000457.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A000457: Exponential generating function: (1+3*x)/(1-2*x)^(7/2).
; 1,10,105,1260,17325,270270,4729725,91891800,1964187225,45831035250,1159525191825,31623414322500,924984868933125,28887988983603750,959493919812553125,33774185977401870000,1255977541034632040625,49204767195827349356250,2025596249561559215165625,87420469717919924022937500,3947034207764084569635628125,186074469794592558282822468750,9143022811270661613805958578125,467486731567578176427643795125000,24835232614527590622718576616015625
add $0,1
mov $1,$0
mov $2,1
lpb $1
sub $1,1
add $2,2
mul $0,$2
lpe
div $0,3
| 44.923077 | 433 | 0.844178 |
13396e9a6366f82a03d5a6a886f8865ca6019304 | 636 | asm | Assembly | pcl/edsger_lib/math/ln.asm | johnp41/Compiler-Uni | 4f653180d4f3f98316b15e566e57443041ef6faa | [
"MIT"
] | null | null | null | pcl/edsger_lib/math/ln.asm | johnp41/Compiler-Uni | 4f653180d4f3f98316b15e566e57443041ef6faa | [
"MIT"
] | null | null | null | pcl/edsger_lib/math/ln.asm | johnp41/Compiler-Uni | 4f653180d4f3f98316b15e566e57443041ef6faa | [
"MIT"
] | null | null | null | ; double ln (double d);
; ---------------------
; This function returns the natural logarithm of a real number.
; KNOWN BUGS !!!
; 1. Does not check anything.
; 2. Does not handle exceptions.
section .code
global _ln
_ln push rbp
mov rbp, rsp
fld1 ; 1
fldl2e ; 1, log2(e)
fdivp st1, st0 ; 1/log2(e)
fld tword [rbp+16] ; 1/log2(e), x
fyl2x ; (1/log2(e)) * log2(x) == ln(x)
pop rbp
ret
| 28.909091 | 73 | 0.378931 |
ac4b52fdc1451ea7db33f99c93521b29610c8519 | 430 | asm | Assembly | oeis/212/A212181.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/212/A212181.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/212/A212181.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A212181: Largest odd divisor of tau(n): a(n) = A000265(A000005(n)).
; Submitted by Simon Strandgaard
; 1,1,1,3,1,1,1,1,3,1,1,3,1,1,1,5,1,3,1,3,1,1,1,1,3,1,1,3,1,1,1,3,1,1,1,9,1,1,1,1,1,1,1,3,3,1,1,5,3,3,1,3,1,1,1,1,1,1,1,3,1,1,3,7,1,1,1,3,1,1,1,3,1,1,3,3,1,1,1,5,5,1,1,3,1,1,1,1,1,3,1,3,1,1,1,3,1,3,3,9
mov $2,$0
seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
lpb $2
dif $0,2
div $2,4
lpe
| 39.090909 | 201 | 0.57907 |
6518aeb9e9e3a25d7d171ab755a2c013e16c8b21 | 476 | asm | Assembly | programs/oeis/047/A047500.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/047/A047500.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/047/A047500.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A047500: Numbers that are congruent to {0, 3, 4, 5, 7} mod 8.
; 0,3,4,5,7,8,11,12,13,15,16,19,20,21,23,24,27,28,29,31,32,35,36,37,39,40,43,44,45,47,48,51,52,53,55,56,59,60,61,63,64,67,68,69,71,72,75,76,77,79,80,83,84,85,87,88,91,92,93,95,96,99,100,101,103,104,107,108,109,111,112,115,116,117,119,120,123,124,125,127,128,131,132,133,135,136,139,140,141,143,144,147,148,149,151,152,155,156,157,159
mul $0,2
add $0,28
sub $2,$0
div $0,5
sub $2,$0
div $2,2
sub $0,$2
sub $0,21
| 39.666667 | 333 | 0.661765 |
7ce88a679983891c140ccc8abda26e9d14a96902 | 4,820 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_1_1853.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_1_1853.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_1_1853.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xf8a9, %rax
nop
and $16825, %rcx
mov $0x6162636465666768, %r13
movq %r13, %xmm3
and $0xffffffffffffffc0, %rax
movntdq %xmm3, (%rax)
nop
nop
nop
nop
nop
inc %rbp
lea addresses_normal_ht+0x13d21, %rsi
lea addresses_WC_ht+0x1a8a9, %rdi
nop
sub %r13, %r13
mov $15, %rcx
rep movsq
nop
nop
nop
nop
xor %rax, %rax
lea addresses_A_ht+0x7ee9, %rcx
nop
dec %r9
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%rcx)
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0x90a9, %rax
nop
nop
sub %rsi, %rsi
movb $0x61, (%rax)
nop
nop
nop
and $17623, %rax
lea addresses_A_ht+0x1d3a9, %rsi
nop
cmp $60705, %r9
vmovups (%rsi), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %r13
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x1d109, %rsi
nop
nop
inc %rbp
movb (%rsi), %cl
nop
nop
nop
nop
nop
add $12627, %rsi
lea addresses_WC_ht+0x14089, %rsi
clflush (%rsi)
nop
nop
nop
dec %r9
movw $0x6162, (%rsi)
nop
nop
nop
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WT+0xa8a9, %rbx
nop
nop
nop
nop
nop
dec %rcx
movw $0x5152, (%rbx)
nop
nop
nop
nop
nop
dec %r13
// Store
mov $0x7ba2450000000aa9, %rdi
inc %rbx
mov $0x5152535455565758, %rsi
movq %rsi, %xmm4
vmovups %ymm4, (%rdi)
nop
nop
dec %rbx
// Store
lea addresses_WT+0xa8a9, %rdi
cmp $9064, %r12
mov $0x5152535455565758, %rsi
movq %rsi, (%rdi)
nop
sub $62018, %r13
// Load
lea addresses_WT+0x17e95, %r12
nop
nop
and $9607, %rdi
mov (%r12), %cx
// Exception!!!
nop
nop
mov (0), %r14
nop
nop
nop
and %r13, %r13
// Load
lea addresses_A+0x1bd7f, %rdi
nop
nop
nop
nop
nop
cmp %rbx, %rbx
movups (%rdi), %xmm2
vpextrq $0, %xmm2, %r14
nop
and $43104, %r14
// Store
lea addresses_D+0xcf69, %rcx
nop
nop
nop
nop
and %r14, %r14
mov $0x5152535455565758, %rbx
movq %rbx, %xmm7
movups %xmm7, (%rcx)
nop
nop
nop
nop
sub %rbx, %rbx
// Store
mov $0x706b4f0000000953, %rbx
nop
nop
sub $9046, %r13
mov $0x5152535455565758, %r14
movq %r14, %xmm1
vmovups %ymm1, (%rbx)
nop
cmp %rdi, %rdi
// Store
mov $0x3d66700000008f5, %rsi
nop
nop
nop
nop
cmp $57504, %r12
movl $0x51525354, (%rsi)
xor %rbx, %rbx
// Faulty Load
lea addresses_WT+0xa8a9, %r13
nop
nop
nop
nop
nop
and %rbx, %rbx
movntdqa (%r13), %xmm5
vpextrq $1, %xmm5, %rsi
lea oracles, %rdi
and $0xff, %rsi
shlq $12, %rsi
mov (%rdi,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': True, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_D', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_NC', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 7, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 11, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 5, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 2}}
{'00': 1}
00
*/
| 18.976378 | 152 | 0.643776 |
c92efd266024694c440a3c7f2fbff9080074cc33 | 457 | asm | Assembly | programs/oeis/317/A317961.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/317/A317961.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/317/A317961.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A317961: Trajectory of 10 under the morphism f: X -> XYX, where Y=1 if X contains an odd number of 1's, otherwise Y = 0.
; 1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0
add $0,1
mul $0,2
mov $1,2
mov $3,1
lpb $0
add $0,1
sub $2,$3
mul $3,$0
div $0,$1
lpe
add $1,1
gcd $2,3
div $1,$2
div $1,3
mov $0,$1
| 24.052632 | 191 | 0.553611 |
75076a95df06997a6509a95697885ec06dcffa58 | 60,608 | asm | Assembly | grep.asm | mtreffert/xv6-staus-treffert | eb739a9297b3bddcae1d4ed30745ad05744dc01e | [
"Xnet",
"X11"
] | null | null | null | grep.asm | mtreffert/xv6-staus-treffert | eb739a9297b3bddcae1d4ed30745ad05744dc01e | [
"Xnet",
"X11"
] | null | null | null | grep.asm | mtreffert/xv6-staus-treffert | eb739a9297b3bddcae1d4ed30745ad05744dc01e | [
"Xnet",
"X11"
] | 1 | 2021-02-16T11:57:21.000Z | 2021-02-16T11:57:21.000Z |
_grep: file format elf32-i386
Disassembly of section .text:
00000000 <matchstar>:
return 0;
}
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 57 push %edi
4: 56 push %esi
5: 53 push %ebx
6: 83 ec 1c sub $0x1c,%esp
9: 8b 75 08 mov 0x8(%ebp),%esi
c: 8b 7d 0c mov 0xc(%ebp),%edi
f: 8b 5d 10 mov 0x10(%ebp),%ebx
12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{ // a * matches zero or more instances
if(matchhere(re, text))
18: 89 5c 24 04 mov %ebx,0x4(%esp)
1c: 89 3c 24 mov %edi,(%esp)
1f: e8 3c 00 00 00 call 60 <matchhere>
24: 85 c0 test %eax,%eax
26: 75 20 jne 48 <matchstar+0x48>
return 1;
}while(*text!='\0' && (*text++==c || c=='.'));
28: 0f b6 03 movzbl (%ebx),%eax
2b: 84 c0 test %al,%al
2d: 74 0f je 3e <matchstar+0x3e>
2f: 0f be c0 movsbl %al,%eax
32: 83 c3 01 add $0x1,%ebx
35: 39 f0 cmp %esi,%eax
37: 74 df je 18 <matchstar+0x18>
39: 83 fe 2e cmp $0x2e,%esi
3c: 74 da je 18 <matchstar+0x18>
return 0;
}
3e: 83 c4 1c add $0x1c,%esp
int matchstar(int c, char *re, char *text)
{
do{ // a * matches zero or more instances
if(matchhere(re, text))
return 1;
}while(*text!='\0' && (*text++==c || c=='.'));
41: 31 c0 xor %eax,%eax
return 0;
}
43: 5b pop %ebx
44: 5e pop %esi
45: 5f pop %edi
46: 5d pop %ebp
47: c3 ret
48: 83 c4 1c add $0x1c,%esp
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
do{ // a * matches zero or more instances
if(matchhere(re, text))
4b: b8 01 00 00 00 mov $0x1,%eax
return 1;
}while(*text!='\0' && (*text++==c || c=='.'));
return 0;
}
50: 5b pop %ebx
51: 5e pop %esi
52: 5f pop %edi
53: 5d pop %ebp
54: c3 ret
55: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000060 <matchhere>:
return 0;
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 56 push %esi
64: 53 push %ebx
65: 83 ec 10 sub $0x10,%esp
68: 8b 55 08 mov 0x8(%ebp),%edx
6b: 8b 4d 0c mov 0xc(%ebp),%ecx
if(re[0] == '\0')
6e: 0f b6 02 movzbl (%edx),%eax
71: 84 c0 test %al,%al
73: 75 1c jne 91 <matchhere+0x31>
75: eb 51 jmp c8 <matchhere+0x68>
77: 90 nop
return 1;
if(re[1] == '*')
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
78: 0f b6 19 movzbl (%ecx),%ebx
7b: 84 db test %bl,%bl
7d: 74 39 je b8 <matchhere+0x58>
7f: 3c 2e cmp $0x2e,%al
81: 74 04 je 87 <matchhere+0x27>
83: 38 d8 cmp %bl,%al
85: 75 31 jne b8 <matchhere+0x58>
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
87: 0f b6 02 movzbl (%edx),%eax
8a: 84 c0 test %al,%al
8c: 74 3a je c8 <matchhere+0x68>
if(re[1] == '*')
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
8e: 83 c1 01 add $0x1,%ecx
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
return 1;
if(re[1] == '*')
91: 0f b6 5a 01 movzbl 0x1(%edx),%ebx
95: 8d 72 01 lea 0x1(%edx),%esi
98: 80 fb 2a cmp $0x2a,%bl
9b: 74 3b je d8 <matchhere+0x78>
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
9d: 3c 24 cmp $0x24,%al
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
return 1;
if(re[1] == '*')
return matchstar(re[0], re+2, text);
9f: 89 f2 mov %esi,%edx
if(re[0] == '$' && re[1] == '\0')
a1: 75 d5 jne 78 <matchhere+0x18>
a3: 84 db test %bl,%bl
a5: 75 d1 jne 78 <matchhere+0x18>
return *text == '\0';
a7: 31 c0 xor %eax,%eax
a9: 80 39 00 cmpb $0x0,(%ecx)
ac: 0f 94 c0 sete %al
af: eb 09 jmp ba <matchhere+0x5a>
b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
b8: 31 c0 xor %eax,%eax
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
}
ba: 83 c4 10 add $0x10,%esp
bd: 5b pop %ebx
be: 5e pop %esi
bf: 5d pop %ebp
c0: c3 ret
c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
c8: 83 c4 10 add $0x10,%esp
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
cb: b8 01 00 00 00 mov $0x1,%eax
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
}
d0: 5b pop %ebx
d1: 5e pop %esi
d2: 5d pop %ebp
d3: c3 ret
d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
return 1;
if(re[1] == '*')
return matchstar(re[0], re+2, text);
d8: 83 c2 02 add $0x2,%edx
db: 0f be c0 movsbl %al,%eax
de: 89 4c 24 08 mov %ecx,0x8(%esp)
e2: 89 54 24 04 mov %edx,0x4(%esp)
e6: 89 04 24 mov %eax,(%esp)
e9: e8 12 ff ff ff call 0 <matchstar>
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
}
ee: 83 c4 10 add $0x10,%esp
f1: 5b pop %ebx
f2: 5e pop %esi
f3: 5d pop %ebp
f4: c3 ret
f5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <match>:
int matchhere(char*, char*);
int matchstar(int, char*, char*);
int
match(char *re, char *text)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 56 push %esi
104: 53 push %ebx
105: 83 ec 10 sub $0x10,%esp
108: 8b 75 08 mov 0x8(%ebp),%esi
10b: 8b 5d 0c mov 0xc(%ebp),%ebx
if(re[0] == '^')
10e: 80 3e 5e cmpb $0x5e,(%esi)
111: 75 08 jne 11b <match+0x1b>
113: eb 2f jmp 144 <match+0x44>
115: 8d 76 00 lea 0x0(%esi),%esi
return matchhere(re+1, text);
do{ // must look at empty string
if(matchhere(re, text))
return 1;
}while(*text++ != '\0');
118: 83 c3 01 add $0x1,%ebx
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
do{ // must look at empty string
if(matchhere(re, text))
11b: 89 5c 24 04 mov %ebx,0x4(%esp)
11f: 89 34 24 mov %esi,(%esp)
122: e8 39 ff ff ff call 60 <matchhere>
127: 85 c0 test %eax,%eax
129: 75 0d jne 138 <match+0x38>
return 1;
}while(*text++ != '\0');
12b: 80 3b 00 cmpb $0x0,(%ebx)
12e: 75 e8 jne 118 <match+0x18>
return 0;
}
130: 83 c4 10 add $0x10,%esp
133: 5b pop %ebx
134: 5e pop %esi
135: 5d pop %ebp
136: c3 ret
137: 90 nop
138: 83 c4 10 add $0x10,%esp
if(re[0] == '^')
return matchhere(re+1, text);
do{ // must look at empty string
if(matchhere(re, text))
return 1;
}while(*text++ != '\0');
13b: b8 01 00 00 00 mov $0x1,%eax
return 0;
}
140: 5b pop %ebx
141: 5e pop %esi
142: 5d pop %ebp
143: c3 ret
int
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
144: 83 c6 01 add $0x1,%esi
147: 89 75 08 mov %esi,0x8(%ebp)
do{ // must look at empty string
if(matchhere(re, text))
return 1;
}while(*text++ != '\0');
return 0;
}
14a: 83 c4 10 add $0x10,%esp
14d: 5b pop %ebx
14e: 5e pop %esi
14f: 5d pop %ebp
int
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
150: e9 0b ff ff ff jmp 60 <matchhere>
155: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000160 <grep>:
char buf[1024];
int match(char*, char*);
void
grep(char *pattern, int fd)
{
160: 55 push %ebp
161: 89 e5 mov %esp,%ebp
163: 57 push %edi
164: 56 push %esi
165: 53 push %ebx
166: 83 ec 2c sub $0x2c,%esp
169: 8b 7d 08 mov 0x8(%ebp),%edi
16c: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
173: 90 nop
174: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int n, m;
char *p, *q;
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m)) > 0){
178: b8 00 04 00 00 mov $0x400,%eax
17d: 2b 45 e4 sub -0x1c(%ebp),%eax
180: 89 44 24 08 mov %eax,0x8(%esp)
184: 8b 45 e4 mov -0x1c(%ebp),%eax
187: 05 80 0a 00 00 add $0xa80,%eax
18c: 89 44 24 04 mov %eax,0x4(%esp)
190: 8b 45 0c mov 0xc(%ebp),%eax
193: 89 04 24 mov %eax,(%esp)
196: e8 e5 03 00 00 call 580 <read>
19b: 85 c0 test %eax,%eax
19d: 89 45 e0 mov %eax,-0x20(%ebp)
1a0: 0f 8e ae 00 00 00 jle 254 <grep+0xf4>
1a6: be 80 0a 00 00 mov $0xa80,%esi
1ab: 90 nop
1ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
m += n;
p = buf;
while((q = strchr(p, '\n')) != 0){
1b0: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
1b7: 00
1b8: 89 34 24 mov %esi,(%esp)
1bb: e8 40 02 00 00 call 400 <strchr>
1c0: 85 c0 test %eax,%eax
1c2: 89 c3 mov %eax,%ebx
1c4: 74 42 je 208 <grep+0xa8>
*q = 0;
1c6: c6 03 00 movb $0x0,(%ebx)
if(match(pattern, p)){
1c9: 89 74 24 04 mov %esi,0x4(%esp)
1cd: 89 3c 24 mov %edi,(%esp)
1d0: e8 2b ff ff ff call 100 <match>
1d5: 85 c0 test %eax,%eax
1d7: 75 07 jne 1e0 <grep+0x80>
1d9: 83 c3 01 add $0x1,%ebx
*q = '\n';
write(1, p, q+1 - p);
1dc: 89 de mov %ebx,%esi
1de: eb d0 jmp 1b0 <grep+0x50>
m += n;
p = buf;
while((q = strchr(p, '\n')) != 0){
*q = 0;
if(match(pattern, p)){
*q = '\n';
1e0: c6 03 0a movb $0xa,(%ebx)
write(1, p, q+1 - p);
1e3: 83 c3 01 add $0x1,%ebx
1e6: 89 d8 mov %ebx,%eax
1e8: 29 f0 sub %esi,%eax
1ea: 89 74 24 04 mov %esi,0x4(%esp)
1ee: 89 de mov %ebx,%esi
1f0: 89 44 24 08 mov %eax,0x8(%esp)
1f4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1fb: e8 88 03 00 00 call 588 <write>
200: eb ae jmp 1b0 <grep+0x50>
202: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
p = q+1;
}
if(p == buf)
208: 81 fe 80 0a 00 00 cmp $0xa80,%esi
20e: 74 38 je 248 <grep+0xe8>
int n, m;
char *p, *q;
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m)) > 0){
m += n;
210: 8b 45 e0 mov -0x20(%ebp),%eax
213: 01 45 e4 add %eax,-0x1c(%ebp)
}
p = q+1;
}
if(p == buf)
m = 0;
if(m > 0){
216: 8b 45 e4 mov -0x1c(%ebp),%eax
219: 85 c0 test %eax,%eax
21b: 0f 8e 57 ff ff ff jle 178 <grep+0x18>
m -= p - buf;
221: 81 45 e4 80 0a 00 00 addl $0xa80,-0x1c(%ebp)
228: 29 75 e4 sub %esi,-0x1c(%ebp)
memmove(buf, p, m);
22b: 8b 45 e4 mov -0x1c(%ebp),%eax
22e: 89 74 24 04 mov %esi,0x4(%esp)
232: c7 04 24 80 0a 00 00 movl $0xa80,(%esp)
239: 89 44 24 08 mov %eax,0x8(%esp)
23d: e8 3e 02 00 00 call 480 <memmove>
242: e9 31 ff ff ff jmp 178 <grep+0x18>
247: 90 nop
248: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
24f: e9 24 ff ff ff jmp 178 <grep+0x18>
}
}
}
254: 83 c4 2c add $0x2c,%esp
257: 5b pop %ebx
258: 5e pop %esi
259: 5f pop %edi
25a: 5d pop %ebp
25b: c3 ret
25c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000260 <main>:
int
main(int argc, char *argv[])
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 83 e4 f0 and $0xfffffff0,%esp
266: 57 push %edi
267: 56 push %esi
268: 53 push %ebx
269: 83 ec 24 sub $0x24,%esp
26c: 8b 7d 08 mov 0x8(%ebp),%edi
26f: 8b 5d 0c mov 0xc(%ebp),%ebx
int fd, i;
char *pattern;
if(argc <= 1){
272: 83 ff 01 cmp $0x1,%edi
275: 0f 8e 95 00 00 00 jle 310 <main+0xb0>
printf(2, "usage: grep pattern [file ...]\n");
exit();
}
pattern = argv[1];
27b: 8b 43 04 mov 0x4(%ebx),%eax
if(argc <= 2){
27e: 83 ff 02 cmp $0x2,%edi
if(argc <= 1){
printf(2, "usage: grep pattern [file ...]\n");
exit();
}
pattern = argv[1];
281: 89 44 24 1c mov %eax,0x1c(%esp)
if(argc <= 2){
285: 74 71 je 2f8 <main+0x98>
grep(pattern, 0);
exit();
287: 83 c3 08 add $0x8,%ebx
28a: be 02 00 00 00 mov $0x2,%esi
28f: 90 nop
}
for(i = 2; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
290: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
297: 00
298: 8b 03 mov (%ebx),%eax
29a: 89 04 24 mov %eax,(%esp)
29d: e8 06 03 00 00 call 5a8 <open>
2a2: 85 c0 test %eax,%eax
2a4: 78 32 js 2d8 <main+0x78>
printf(1, "grep: cannot open %s\n", argv[i]);
exit();
}
grep(pattern, fd);
2a6: 8b 54 24 1c mov 0x1c(%esp),%edx
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
2aa: 83 c6 01 add $0x1,%esi
2ad: 83 c3 04 add $0x4,%ebx
if((fd = open(argv[i], 0)) < 0){
printf(1, "grep: cannot open %s\n", argv[i]);
exit();
}
grep(pattern, fd);
2b0: 89 44 24 04 mov %eax,0x4(%esp)
2b4: 89 44 24 18 mov %eax,0x18(%esp)
2b8: 89 14 24 mov %edx,(%esp)
2bb: e8 a0 fe ff ff call 160 <grep>
close(fd);
2c0: 8b 44 24 18 mov 0x18(%esp),%eax
2c4: 89 04 24 mov %eax,(%esp)
2c7: e8 c4 02 00 00 call 590 <close>
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
2cc: 39 f7 cmp %esi,%edi
2ce: 7f c0 jg 290 <main+0x30>
exit();
}
grep(pattern, fd);
close(fd);
}
exit();
2d0: e8 93 02 00 00 call 568 <exit>
2d5: 8d 76 00 lea 0x0(%esi),%esi
exit();
}
for(i = 2; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
printf(1, "grep: cannot open %s\n", argv[i]);
2d8: 8b 03 mov (%ebx),%eax
2da: c7 44 24 04 20 0a 00 movl $0xa20,0x4(%esp)
2e1: 00
2e2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2e9: 89 44 24 08 mov %eax,0x8(%esp)
2ed: e8 fe 03 00 00 call 6f0 <printf>
exit();
2f2: e8 71 02 00 00 call 568 <exit>
2f7: 90 nop
exit();
}
pattern = argv[1];
if(argc <= 2){
grep(pattern, 0);
2f8: 89 04 24 mov %eax,(%esp)
2fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
302: 00
303: e8 58 fe ff ff call 160 <grep>
exit();
308: e8 5b 02 00 00 call 568 <exit>
30d: 8d 76 00 lea 0x0(%esi),%esi
{
int fd, i;
char *pattern;
if(argc <= 1){
printf(2, "usage: grep pattern [file ...]\n");
310: c7 44 24 04 00 0a 00 movl $0xa00,0x4(%esp)
317: 00
318: c7 04 24 02 00 00 00 movl $0x2,(%esp)
31f: e8 cc 03 00 00 call 6f0 <printf>
exit();
324: e8 3f 02 00 00 call 568 <exit>
329: 90 nop
32a: 90 nop
32b: 90 nop
32c: 90 nop
32d: 90 nop
32e: 90 nop
32f: 90 nop
00000330 <strcpy>:
#include "fcntl.h"
#include "user.h"
char*
strcpy(char *s, char *t)
{
330: 55 push %ebp
331: 31 d2 xor %edx,%edx
333: 89 e5 mov %esp,%ebp
335: 8b 45 08 mov 0x8(%ebp),%eax
338: 53 push %ebx
339: 8b 5d 0c mov 0xc(%ebp),%ebx
33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *os;
os = s;
while((*s++ = *t++) != 0)
340: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
344: 88 0c 10 mov %cl,(%eax,%edx,1)
347: 83 c2 01 add $0x1,%edx
34a: 84 c9 test %cl,%cl
34c: 75 f2 jne 340 <strcpy+0x10>
;
return os;
}
34e: 5b pop %ebx
34f: 5d pop %ebp
350: c3 ret
351: eb 0d jmp 360 <strcmp>
353: 90 nop
354: 90 nop
355: 90 nop
356: 90 nop
357: 90 nop
358: 90 nop
359: 90 nop
35a: 90 nop
35b: 90 nop
35c: 90 nop
35d: 90 nop
35e: 90 nop
35f: 90 nop
00000360 <strcmp>:
int
strcmp(const char *p, const char *q)
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 53 push %ebx
364: 8b 4d 08 mov 0x8(%ebp),%ecx
367: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
36a: 0f b6 01 movzbl (%ecx),%eax
36d: 84 c0 test %al,%al
36f: 75 14 jne 385 <strcmp+0x25>
371: eb 25 jmp 398 <strcmp+0x38>
373: 90 nop
374: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p++, q++;
378: 83 c1 01 add $0x1,%ecx
37b: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
37e: 0f b6 01 movzbl (%ecx),%eax
381: 84 c0 test %al,%al
383: 74 13 je 398 <strcmp+0x38>
385: 0f b6 1a movzbl (%edx),%ebx
388: 38 d8 cmp %bl,%al
38a: 74 ec je 378 <strcmp+0x18>
38c: 0f b6 db movzbl %bl,%ebx
38f: 0f b6 c0 movzbl %al,%eax
392: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
394: 5b pop %ebx
395: 5d pop %ebp
396: c3 ret
397: 90 nop
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
398: 0f b6 1a movzbl (%edx),%ebx
39b: 31 c0 xor %eax,%eax
39d: 0f b6 db movzbl %bl,%ebx
3a0: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3a2: 5b pop %ebx
3a3: 5d pop %ebp
3a4: c3 ret
3a5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003b0 <strlen>:
uint
strlen(char *s)
{
3b0: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
3b1: 31 d2 xor %edx,%edx
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3b3: 89 e5 mov %esp,%ebp
int n;
for(n = 0; s[n]; n++)
3b5: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3b7: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3ba: 80 39 00 cmpb $0x0,(%ecx)
3bd: 74 0c je 3cb <strlen+0x1b>
3bf: 90 nop
3c0: 83 c2 01 add $0x1,%edx
3c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3c7: 89 d0 mov %edx,%eax
3c9: 75 f5 jne 3c0 <strlen+0x10>
;
return n;
}
3cb: 5d pop %ebp
3cc: c3 ret
3cd: 8d 76 00 lea 0x0(%esi),%esi
000003d0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3d0: 55 push %ebp
3d1: 89 e5 mov %esp,%ebp
3d3: 8b 4d 10 mov 0x10(%ebp),%ecx
3d6: 53 push %ebx
3d7: 8b 45 08 mov 0x8(%ebp),%eax
char *d;
d = dst;
while(n-- > 0)
3da: 85 c9 test %ecx,%ecx
3dc: 74 14 je 3f2 <memset+0x22>
3de: 0f b6 5d 0c movzbl 0xc(%ebp),%ebx
3e2: 31 d2 xor %edx,%edx
3e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*d++ = c;
3e8: 88 1c 10 mov %bl,(%eax,%edx,1)
3eb: 83 c2 01 add $0x1,%edx
memset(void *dst, int c, uint n)
{
char *d;
d = dst;
while(n-- > 0)
3ee: 39 ca cmp %ecx,%edx
3f0: 75 f6 jne 3e8 <memset+0x18>
*d++ = c;
return dst;
}
3f2: 5b pop %ebx
3f3: 5d pop %ebp
3f4: c3 ret
3f5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000400 <strchr>:
char*
strchr(const char *s, char c)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 8b 45 08 mov 0x8(%ebp),%eax
406: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
40a: 0f b6 10 movzbl (%eax),%edx
40d: 84 d2 test %dl,%dl
40f: 75 11 jne 422 <strchr+0x22>
411: eb 15 jmp 428 <strchr+0x28>
413: 90 nop
414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
418: 83 c0 01 add $0x1,%eax
41b: 0f b6 10 movzbl (%eax),%edx
41e: 84 d2 test %dl,%dl
420: 74 06 je 428 <strchr+0x28>
if(*s == c)
422: 38 ca cmp %cl,%dl
424: 75 f2 jne 418 <strchr+0x18>
return (char*) s;
return 0;
}
426: 5d pop %ebp
427: c3 ret
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
428: 31 c0 xor %eax,%eax
if(*s == c)
return (char*) s;
return 0;
}
42a: 5d pop %ebp
42b: 90 nop
42c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
430: c3 ret
431: eb 0d jmp 440 <atoi>
433: 90 nop
434: 90 nop
435: 90 nop
436: 90 nop
437: 90 nop
438: 90 nop
439: 90 nop
43a: 90 nop
43b: 90 nop
43c: 90 nop
43d: 90 nop
43e: 90 nop
43f: 90 nop
00000440 <atoi>:
return r;
}
int
atoi(const char *s)
{
440: 55 push %ebp
int n;
n = 0;
while('0' <= *s && *s <= '9')
441: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
443: 89 e5 mov %esp,%ebp
445: 8b 4d 08 mov 0x8(%ebp),%ecx
448: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
449: 0f b6 11 movzbl (%ecx),%edx
44c: 8d 5a d0 lea -0x30(%edx),%ebx
44f: 80 fb 09 cmp $0x9,%bl
452: 77 1c ja 470 <atoi+0x30>
454: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
458: 0f be d2 movsbl %dl,%edx
45b: 83 c1 01 add $0x1,%ecx
45e: 8d 04 80 lea (%eax,%eax,4),%eax
461: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
465: 0f b6 11 movzbl (%ecx),%edx
468: 8d 5a d0 lea -0x30(%edx),%ebx
46b: 80 fb 09 cmp $0x9,%bl
46e: 76 e8 jbe 458 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
470: 5b pop %ebx
471: 5d pop %ebp
472: c3 ret
473: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
479: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000480 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
480: 55 push %ebp
481: 89 e5 mov %esp,%ebp
483: 56 push %esi
484: 8b 45 08 mov 0x8(%ebp),%eax
487: 53 push %ebx
488: 8b 5d 10 mov 0x10(%ebp),%ebx
48b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
48e: 85 db test %ebx,%ebx
490: 7e 14 jle 4a6 <memmove+0x26>
n = n*10 + *s++ - '0';
return n;
}
void*
memmove(void *vdst, void *vsrc, int n)
492: 31 d2 xor %edx,%edx
494: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
*dst++ = *src++;
498: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
49c: 88 0c 10 mov %cl,(%eax,%edx,1)
49f: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
4a2: 39 da cmp %ebx,%edx
4a4: 75 f2 jne 498 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
4a6: 5b pop %ebx
4a7: 5e pop %esi
4a8: 5d pop %ebp
4a9: c3 ret
4aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000004b0 <stat>:
return buf;
}
int
stat(char *n, struct stat *st)
{
4b0: 55 push %ebp
4b1: 89 e5 mov %esp,%ebp
4b3: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
4b6: 8b 45 08 mov 0x8(%ebp),%eax
return buf;
}
int
stat(char *n, struct stat *st)
{
4b9: 89 5d f8 mov %ebx,-0x8(%ebp)
4bc: 89 75 fc mov %esi,-0x4(%ebp)
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
4bf: be ff ff ff ff mov $0xffffffff,%esi
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
4c4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
4cb: 00
4cc: 89 04 24 mov %eax,(%esp)
4cf: e8 d4 00 00 00 call 5a8 <open>
if(fd < 0)
4d4: 85 c0 test %eax,%eax
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
4d6: 89 c3 mov %eax,%ebx
if(fd < 0)
4d8: 78 19 js 4f3 <stat+0x43>
return -1;
r = fstat(fd, st);
4da: 8b 45 0c mov 0xc(%ebp),%eax
4dd: 89 1c 24 mov %ebx,(%esp)
4e0: 89 44 24 04 mov %eax,0x4(%esp)
4e4: e8 d7 00 00 00 call 5c0 <fstat>
close(fd);
4e9: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
4ec: 89 c6 mov %eax,%esi
close(fd);
4ee: e8 9d 00 00 00 call 590 <close>
return r;
}
4f3: 89 f0 mov %esi,%eax
4f5: 8b 5d f8 mov -0x8(%ebp),%ebx
4f8: 8b 75 fc mov -0x4(%ebp),%esi
4fb: 89 ec mov %ebp,%esp
4fd: 5d pop %ebp
4fe: c3 ret
4ff: 90 nop
00000500 <gets>:
return 0;
}
char*
gets(char *buf, int max)
{
500: 55 push %ebp
501: 89 e5 mov %esp,%ebp
503: 57 push %edi
504: 56 push %esi
505: 31 f6 xor %esi,%esi
507: 53 push %ebx
508: 83 ec 2c sub $0x2c,%esp
50b: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
50e: eb 06 jmp 516 <gets+0x16>
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
510: 3c 0a cmp $0xa,%al
512: 74 39 je 54d <gets+0x4d>
514: 89 de mov %ebx,%esi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
516: 8d 5e 01 lea 0x1(%esi),%ebx
519: 3b 5d 0c cmp 0xc(%ebp),%ebx
51c: 7d 31 jge 54f <gets+0x4f>
cc = read(0, &c, 1);
51e: 8d 45 e7 lea -0x19(%ebp),%eax
521: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
528: 00
529: 89 44 24 04 mov %eax,0x4(%esp)
52d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
534: e8 47 00 00 00 call 580 <read>
if(cc < 1)
539: 85 c0 test %eax,%eax
53b: 7e 12 jle 54f <gets+0x4f>
break;
buf[i++] = c;
53d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
541: 88 44 1f ff mov %al,-0x1(%edi,%ebx,1)
if(c == '\n' || c == '\r')
545: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
549: 3c 0d cmp $0xd,%al
54b: 75 c3 jne 510 <gets+0x10>
54d: 89 de mov %ebx,%esi
break;
}
buf[i] = '\0';
54f: c6 04 37 00 movb $0x0,(%edi,%esi,1)
return buf;
}
553: 89 f8 mov %edi,%eax
555: 83 c4 2c add $0x2c,%esp
558: 5b pop %ebx
559: 5e pop %esi
55a: 5f pop %edi
55b: 5d pop %ebp
55c: c3 ret
55d: 90 nop
55e: 90 nop
55f: 90 nop
00000560 <fork>:
560: b8 01 00 00 00 mov $0x1,%eax
565: cd 30 int $0x30
567: c3 ret
00000568 <exit>:
568: b8 02 00 00 00 mov $0x2,%eax
56d: cd 30 int $0x30
56f: c3 ret
00000570 <wait>:
570: b8 03 00 00 00 mov $0x3,%eax
575: cd 30 int $0x30
577: c3 ret
00000578 <pipe>:
578: b8 04 00 00 00 mov $0x4,%eax
57d: cd 30 int $0x30
57f: c3 ret
00000580 <read>:
580: b8 06 00 00 00 mov $0x6,%eax
585: cd 30 int $0x30
587: c3 ret
00000588 <write>:
588: b8 05 00 00 00 mov $0x5,%eax
58d: cd 30 int $0x30
58f: c3 ret
00000590 <close>:
590: b8 07 00 00 00 mov $0x7,%eax
595: cd 30 int $0x30
597: c3 ret
00000598 <kill>:
598: b8 08 00 00 00 mov $0x8,%eax
59d: cd 30 int $0x30
59f: c3 ret
000005a0 <exec>:
5a0: b8 09 00 00 00 mov $0x9,%eax
5a5: cd 30 int $0x30
5a7: c3 ret
000005a8 <open>:
5a8: b8 0a 00 00 00 mov $0xa,%eax
5ad: cd 30 int $0x30
5af: c3 ret
000005b0 <mknod>:
5b0: b8 0b 00 00 00 mov $0xb,%eax
5b5: cd 30 int $0x30
5b7: c3 ret
000005b8 <unlink>:
5b8: b8 0c 00 00 00 mov $0xc,%eax
5bd: cd 30 int $0x30
5bf: c3 ret
000005c0 <fstat>:
5c0: b8 0d 00 00 00 mov $0xd,%eax
5c5: cd 30 int $0x30
5c7: c3 ret
000005c8 <link>:
5c8: b8 0e 00 00 00 mov $0xe,%eax
5cd: cd 30 int $0x30
5cf: c3 ret
000005d0 <mkdir>:
5d0: b8 0f 00 00 00 mov $0xf,%eax
5d5: cd 30 int $0x30
5d7: c3 ret
000005d8 <chdir>:
5d8: b8 10 00 00 00 mov $0x10,%eax
5dd: cd 30 int $0x30
5df: c3 ret
000005e0 <dup>:
5e0: b8 11 00 00 00 mov $0x11,%eax
5e5: cd 30 int $0x30
5e7: c3 ret
000005e8 <getpid>:
5e8: b8 12 00 00 00 mov $0x12,%eax
5ed: cd 30 int $0x30
5ef: c3 ret
000005f0 <sbrk>:
5f0: b8 13 00 00 00 mov $0x13,%eax
5f5: cd 30 int $0x30
5f7: c3 ret
000005f8 <sleep>:
5f8: b8 14 00 00 00 mov $0x14,%eax
5fd: cd 30 int $0x30
5ff: c3 ret
00000600 <tick>:
600: b8 15 00 00 00 mov $0x15,%eax
605: cd 30 int $0x30
607: c3 ret
00000608 <fork_tickets>:
608: b8 16 00 00 00 mov $0x16,%eax
60d: cd 30 int $0x30
60f: c3 ret
00000610 <fork_thread>:
610: b8 19 00 00 00 mov $0x19,%eax
615: cd 30 int $0x30
617: c3 ret
00000618 <wait_thread>:
618: b8 1a 00 00 00 mov $0x1a,%eax
61d: cd 30 int $0x30
61f: c3 ret
00000620 <sleep_lock>:
620: b8 17 00 00 00 mov $0x17,%eax
625: cd 30 int $0x30
627: c3 ret
00000628 <wake_lock>:
628: b8 18 00 00 00 mov $0x18,%eax
62d: cd 30 int $0x30
62f: c3 ret
00000630 <putc>:
//struct mutex_t plock;
static void
putc(int fd, char c)
{
630: 55 push %ebp
631: 89 e5 mov %esp,%ebp
633: 83 ec 28 sub $0x28,%esp
636: 88 55 f4 mov %dl,-0xc(%ebp)
write(fd, &c, 1);
639: 8d 55 f4 lea -0xc(%ebp),%edx
63c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
643: 00
644: 89 54 24 04 mov %edx,0x4(%esp)
648: 89 04 24 mov %eax,(%esp)
64b: e8 38 ff ff ff call 588 <write>
}
650: c9 leave
651: c3 ret
652: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
659: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000660 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
660: 55 push %ebp
661: 89 e5 mov %esp,%ebp
663: 57 push %edi
664: 89 c7 mov %eax,%edi
666: 56 push %esi
667: 89 ce mov %ecx,%esi
669: 53 push %ebx
66a: 83 ec 2c sub $0x2c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
66d: 8b 4d 08 mov 0x8(%ebp),%ecx
670: 85 c9 test %ecx,%ecx
672: 74 04 je 678 <printint+0x18>
674: 85 d2 test %edx,%edx
676: 78 5d js 6d5 <printint+0x75>
neg = 1;
x = -xx;
} else {
x = xx;
678: 89 d0 mov %edx,%eax
67a: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
681: 31 c9 xor %ecx,%ecx
683: 8d 5d d8 lea -0x28(%ebp),%ebx
686: 66 90 xchg %ax,%ax
}
i = 0;
do{
buf[i++] = digits[x % base];
688: 31 d2 xor %edx,%edx
68a: f7 f6 div %esi
68c: 0f b6 92 3d 0a 00 00 movzbl 0xa3d(%edx),%edx
693: 88 14 0b mov %dl,(%ebx,%ecx,1)
696: 83 c1 01 add $0x1,%ecx
}while((x /= base) != 0);
699: 85 c0 test %eax,%eax
69b: 75 eb jne 688 <printint+0x28>
if(neg)
69d: 8b 45 d4 mov -0x2c(%ebp),%eax
6a0: 85 c0 test %eax,%eax
6a2: 74 08 je 6ac <printint+0x4c>
buf[i++] = '-';
6a4: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
6a9: 83 c1 01 add $0x1,%ecx
while(--i >= 0)
6ac: 8d 71 ff lea -0x1(%ecx),%esi
6af: 01 f3 add %esi,%ebx
6b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, buf[i]);
6b8: 0f be 13 movsbl (%ebx),%edx
6bb: 89 f8 mov %edi,%eax
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6bd: 83 ee 01 sub $0x1,%esi
6c0: 83 eb 01 sub $0x1,%ebx
putc(fd, buf[i]);
6c3: e8 68 ff ff ff call 630 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6c8: 83 fe ff cmp $0xffffffff,%esi
6cb: 75 eb jne 6b8 <printint+0x58>
putc(fd, buf[i]);
}
6cd: 83 c4 2c add $0x2c,%esp
6d0: 5b pop %ebx
6d1: 5e pop %esi
6d2: 5f pop %edi
6d3: 5d pop %ebp
6d4: c3 ret
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
6d5: 89 d0 mov %edx,%eax
6d7: f7 d8 neg %eax
6d9: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp)
6e0: eb 9f jmp 681 <printint+0x21>
6e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
6e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000006f0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6f0: 55 push %ebp
6f1: 89 e5 mov %esp,%ebp
6f3: 57 push %edi
6f4: 56 push %esi
6f5: 53 push %ebx
6f6: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6f9: 8b 45 0c mov 0xc(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6fc: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6ff: 0f b6 08 movzbl (%eax),%ecx
702: 84 c9 test %cl,%cl
704: 0f 84 96 00 00 00 je 7a0 <printf+0xb0>
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
70a: 8d 55 10 lea 0x10(%ebp),%edx
70d: 31 f6 xor %esi,%esi
70f: 89 55 e4 mov %edx,-0x1c(%ebp)
712: 31 db xor %ebx,%ebx
714: eb 1a jmp 730 <printf+0x40>
716: 66 90 xchg %ax,%ax
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
718: 83 f9 25 cmp $0x25,%ecx
71b: 0f 85 87 00 00 00 jne 7a8 <printf+0xb8>
721: 66 be 25 00 mov $0x25,%si
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
725: 83 c3 01 add $0x1,%ebx
728: 0f b6 0c 18 movzbl (%eax,%ebx,1),%ecx
72c: 84 c9 test %cl,%cl
72e: 74 70 je 7a0 <printf+0xb0>
c = fmt[i] & 0xff;
if(state == 0){
730: 85 f6 test %esi,%esi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
732: 0f b6 c9 movzbl %cl,%ecx
if(state == 0){
735: 74 e1 je 718 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
737: 83 fe 25 cmp $0x25,%esi
73a: 75 e9 jne 725 <printf+0x35>
if(c == 'd'){
73c: 83 f9 64 cmp $0x64,%ecx
73f: 90 nop
740: 0f 84 fa 00 00 00 je 840 <printf+0x150>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
746: 83 f9 70 cmp $0x70,%ecx
749: 74 75 je 7c0 <printf+0xd0>
74b: 83 f9 78 cmp $0x78,%ecx
74e: 66 90 xchg %ax,%ax
750: 74 6e je 7c0 <printf+0xd0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
752: 83 f9 73 cmp $0x73,%ecx
755: 0f 84 8d 00 00 00 je 7e8 <printf+0xf8>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
75b: 83 f9 63 cmp $0x63,%ecx
75e: 66 90 xchg %ax,%ax
760: 0f 84 fe 00 00 00 je 864 <printf+0x174>
putc(fd, *ap);
ap++;
} else if(c == '%'){
766: 83 f9 25 cmp $0x25,%ecx
769: 0f 84 b9 00 00 00 je 828 <printf+0x138>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
76f: ba 25 00 00 00 mov $0x25,%edx
774: 89 f8 mov %edi,%eax
776: 89 4d e0 mov %ecx,-0x20(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
779: 83 c3 01 add $0x1,%ebx
} else if(c == '%'){
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
77c: 31 f6 xor %esi,%esi
ap++;
} else if(c == '%'){
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
77e: e8 ad fe ff ff call 630 <putc>
putc(fd, c);
783: 8b 4d e0 mov -0x20(%ebp),%ecx
786: 89 f8 mov %edi,%eax
788: 0f be d1 movsbl %cl,%edx
78b: e8 a0 fe ff ff call 630 <putc>
790: 8b 45 0c mov 0xc(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
793: 0f b6 0c 18 movzbl (%eax,%ebx,1),%ecx
797: 84 c9 test %cl,%cl
799: 75 95 jne 730 <printf+0x40>
79b: 90 nop
79c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
state = 0;
}
}
//mutex_unlock(&plock);
}
7a0: 83 c4 2c add $0x2c,%esp
7a3: 5b pop %ebx
7a4: 5e pop %esi
7a5: 5f pop %edi
7a6: 5d pop %ebp
7a7: c3 ret
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
} else {
putc(fd, c);
7a8: 89 f8 mov %edi,%eax
7aa: 0f be d1 movsbl %cl,%edx
7ad: e8 7e fe ff ff call 630 <putc>
7b2: 8b 45 0c mov 0xc(%ebp),%eax
7b5: e9 6b ff ff ff jmp 725 <printf+0x35>
7ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
7c0: 8b 45 e4 mov -0x1c(%ebp),%eax
7c3: b9 10 00 00 00 mov $0x10,%ecx
ap++;
7c8: 31 f6 xor %esi,%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
7ca: c7 04 24 00 00 00 00 movl $0x0,(%esp)
7d1: 8b 10 mov (%eax),%edx
7d3: 89 f8 mov %edi,%eax
7d5: e8 86 fe ff ff call 660 <printint>
7da: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
7dd: 83 45 e4 04 addl $0x4,-0x1c(%ebp)
7e1: e9 3f ff ff ff jmp 725 <printf+0x35>
7e6: 66 90 xchg %ax,%ax
} else if(c == 's'){
s = (char*)*ap;
7e8: 8b 55 e4 mov -0x1c(%ebp),%edx
7eb: 8b 32 mov (%edx),%esi
ap++;
7ed: 83 c2 04 add $0x4,%edx
7f0: 89 55 e4 mov %edx,-0x1c(%ebp)
if(s == 0)
7f3: 85 f6 test %esi,%esi
7f5: 0f 84 84 00 00 00 je 87f <printf+0x18f>
s = "(null)";
while(*s != 0){
7fb: 0f b6 16 movzbl (%esi),%edx
7fe: 84 d2 test %dl,%dl
800: 74 1d je 81f <printf+0x12f>
802: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, *s);
808: 0f be d2 movsbl %dl,%edx
s++;
80b: 83 c6 01 add $0x1,%esi
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
80e: 89 f8 mov %edi,%eax
810: e8 1b fe ff ff call 630 <putc>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
815: 0f b6 16 movzbl (%esi),%edx
818: 84 d2 test %dl,%dl
81a: 75 ec jne 808 <printf+0x118>
81c: 8b 45 0c mov 0xc(%ebp),%eax
} else if(c == '%'){
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
81f: 31 f6 xor %esi,%esi
821: e9 ff fe ff ff jmp 725 <printf+0x35>
826: 66 90 xchg %ax,%ax
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
} else if(c == '%'){
putc(fd, c);
828: 89 f8 mov %edi,%eax
82a: ba 25 00 00 00 mov $0x25,%edx
82f: e8 fc fd ff ff call 630 <putc>
834: 31 f6 xor %esi,%esi
836: 8b 45 0c mov 0xc(%ebp),%eax
839: e9 e7 fe ff ff jmp 725 <printf+0x35>
83e: 66 90 xchg %ax,%ax
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
840: 8b 45 e4 mov -0x1c(%ebp),%eax
843: b1 0a mov $0xa,%cl
ap++;
845: 66 31 f6 xor %si,%si
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
848: c7 04 24 01 00 00 00 movl $0x1,(%esp)
84f: 8b 10 mov (%eax),%edx
851: 89 f8 mov %edi,%eax
853: e8 08 fe ff ff call 660 <printint>
858: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
85b: 83 45 e4 04 addl $0x4,-0x1c(%ebp)
85f: e9 c1 fe ff ff jmp 725 <printf+0x35>
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
864: 8b 45 e4 mov -0x1c(%ebp),%eax
ap++;
867: 31 f6 xor %esi,%esi
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
869: 0f be 10 movsbl (%eax),%edx
86c: 89 f8 mov %edi,%eax
86e: e8 bd fd ff ff call 630 <putc>
873: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
876: 83 45 e4 04 addl $0x4,-0x1c(%ebp)
87a: e9 a6 fe ff ff jmp 725 <printf+0x35>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
87f: be 36 0a 00 00 mov $0xa36,%esi
884: e9 72 ff ff ff jmp 7fb <printf+0x10b>
889: 90 nop
88a: 90 nop
88b: 90 nop
88c: 90 nop
88d: 90 nop
88e: 90 nop
88f: 90 nop
00000890 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
890: 55 push %ebp
Header *bp, *p;
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
891: a1 68 0a 00 00 mov 0xa68,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
896: 89 e5 mov %esp,%ebp
898: 57 push %edi
899: 56 push %esi
89a: 53 push %ebx
89b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*) ap - 1;
89e: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8a1: 39 c8 cmp %ecx,%eax
8a3: 73 1d jae 8c2 <free+0x32>
8a5: 8d 76 00 lea 0x0(%esi),%esi
8a8: 8b 10 mov (%eax),%edx
8aa: 39 d1 cmp %edx,%ecx
8ac: 72 1a jb 8c8 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8ae: 39 d0 cmp %edx,%eax
8b0: 72 08 jb 8ba <free+0x2a>
8b2: 39 c8 cmp %ecx,%eax
8b4: 72 12 jb 8c8 <free+0x38>
8b6: 39 d1 cmp %edx,%ecx
8b8: 72 0e jb 8c8 <free+0x38>
8ba: 89 d0 mov %edx,%eax
free(void *ap)
{
Header *bp, *p;
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8bc: 39 c8 cmp %ecx,%eax
8be: 66 90 xchg %ax,%ax
8c0: 72 e6 jb 8a8 <free+0x18>
8c2: 8b 10 mov (%eax),%edx
8c4: eb e8 jmp 8ae <free+0x1e>
8c6: 66 90 xchg %ax,%ax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
8c8: 8b 71 04 mov 0x4(%ecx),%esi
8cb: 8d 3c f1 lea (%ecx,%esi,8),%edi
8ce: 39 d7 cmp %edx,%edi
8d0: 74 19 je 8eb <free+0x5b>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
8d2: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
8d5: 8b 50 04 mov 0x4(%eax),%edx
8d8: 8d 34 d0 lea (%eax,%edx,8),%esi
8db: 39 ce cmp %ecx,%esi
8dd: 74 21 je 900 <free+0x70>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
8df: 89 08 mov %ecx,(%eax)
freep = p;
8e1: a3 68 0a 00 00 mov %eax,0xa68
}
8e6: 5b pop %ebx
8e7: 5e pop %esi
8e8: 5f pop %edi
8e9: 5d pop %ebp
8ea: c3 ret
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
8eb: 03 72 04 add 0x4(%edx),%esi
bp->s.ptr = p->s.ptr->s.ptr;
8ee: 8b 12 mov (%edx),%edx
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
8f0: 89 71 04 mov %esi,0x4(%ecx)
bp->s.ptr = p->s.ptr->s.ptr;
8f3: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
8f6: 8b 50 04 mov 0x4(%eax),%edx
8f9: 8d 34 d0 lea (%eax,%edx,8),%esi
8fc: 39 ce cmp %ecx,%esi
8fe: 75 df jne 8df <free+0x4f>
p->s.size += bp->s.size;
900: 03 51 04 add 0x4(%ecx),%edx
903: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
906: 8b 53 f8 mov -0x8(%ebx),%edx
909: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
90b: a3 68 0a 00 00 mov %eax,0xa68
}
910: 5b pop %ebx
911: 5e pop %esi
912: 5f pop %edi
913: 5d pop %ebp
914: c3 ret
915: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
919: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000920 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
920: 55 push %ebp
921: 89 e5 mov %esp,%ebp
923: 57 push %edi
924: 56 push %esi
925: 53 push %ebx
926: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
929: 8b 5d 08 mov 0x8(%ebp),%ebx
if((prevp = freep) == 0){
92c: 8b 0d 68 0a 00 00 mov 0xa68,%ecx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
932: 83 c3 07 add $0x7,%ebx
935: c1 eb 03 shr $0x3,%ebx
938: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
93b: 85 c9 test %ecx,%ecx
93d: 0f 84 93 00 00 00 je 9d6 <malloc+0xb6>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
943: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
945: 8b 50 04 mov 0x4(%eax),%edx
948: 39 d3 cmp %edx,%ebx
94a: 76 1f jbe 96b <malloc+0x4b>
p->s.size -= nunits;
p += p->s.size;
p->s.size = nunits;
}
freep = prevp;
return (void*) (p + 1);
94c: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
953: 90 nop
954: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
if(p == freep)
958: 3b 05 68 0a 00 00 cmp 0xa68,%eax
95e: 74 30 je 990 <malloc+0x70>
960: 89 c1 mov %eax,%ecx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
962: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
964: 8b 50 04 mov 0x4(%eax),%edx
967: 39 d3 cmp %edx,%ebx
969: 77 ed ja 958 <malloc+0x38>
if(p->s.size == nunits)
96b: 39 d3 cmp %edx,%ebx
96d: 74 61 je 9d0 <malloc+0xb0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
96f: 29 da sub %ebx,%edx
971: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
974: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
977: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
97a: 89 0d 68 0a 00 00 mov %ecx,0xa68
return (void*) (p + 1);
980: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
983: 83 c4 1c add $0x1c,%esp
986: 5b pop %ebx
987: 5e pop %esi
988: 5f pop %edi
989: 5d pop %ebp
98a: c3 ret
98b: 90 nop
98c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < PAGE)
990: 81 fb ff 0f 00 00 cmp $0xfff,%ebx
996: b8 00 80 00 00 mov $0x8000,%eax
99b: bf 00 10 00 00 mov $0x1000,%edi
9a0: 76 04 jbe 9a6 <malloc+0x86>
9a2: 89 f0 mov %esi,%eax
9a4: 89 df mov %ebx,%edi
nu = PAGE;
p = sbrk(nu * sizeof(Header));
9a6: 89 04 24 mov %eax,(%esp)
9a9: e8 42 fc ff ff call 5f0 <sbrk>
if(p == (char*) -1)
9ae: 83 f8 ff cmp $0xffffffff,%eax
9b1: 74 18 je 9cb <malloc+0xab>
return 0;
hp = (Header*)p;
hp->s.size = nu;
9b3: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
9b6: 83 c0 08 add $0x8,%eax
9b9: 89 04 24 mov %eax,(%esp)
9bc: e8 cf fe ff ff call 890 <free>
return freep;
9c1: 8b 0d 68 0a 00 00 mov 0xa68,%ecx
}
freep = prevp;
return (void*) (p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
9c7: 85 c9 test %ecx,%ecx
9c9: 75 97 jne 962 <malloc+0x42>
if((prevp = freep) == 0){
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){
9cb: 31 c0 xor %eax,%eax
9cd: eb b4 jmp 983 <malloc+0x63>
9cf: 90 nop
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
9d0: 8b 10 mov (%eax),%edx
9d2: 89 11 mov %edx,(%ecx)
9d4: eb a4 jmp 97a <malloc+0x5a>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
9d6: c7 05 68 0a 00 00 60 movl $0xa60,0xa68
9dd: 0a 00 00
base.s.size = 0;
9e0: b9 60 0a 00 00 mov $0xa60,%ecx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
9e5: c7 05 60 0a 00 00 60 movl $0xa60,0xa60
9ec: 0a 00 00
base.s.size = 0;
9ef: c7 05 64 0a 00 00 00 movl $0x0,0xa64
9f6: 00 00 00
9f9: e9 45 ff ff ff jmp 943 <malloc+0x23>
| 30.749873 | 60 | 0.415242 |
52b5e575fb6a851968dd21b64753b61a9fc39fc8 | 3,881 | asm | Assembly | Linux_x64/squasher1.asm | codecop/Conways-Squasher-Coroutine | 46330e92c16a17612c244c15c8077318c1c0302b | [
"BSD-3-Clause"
] | 2 | 2020-07-07T22:53:23.000Z | 2021-04-26T19:22:58.000Z | Linux_x64/squasher1.asm | codecop/Conways-Squasher-Coroutine | 46330e92c16a17612c244c15c8077318c1c0302b | [
"BSD-3-Clause"
] | null | null | null | Linux_x64/squasher1.asm | codecop/Conways-Squasher-Coroutine | 46330e92c16a17612c244c15c8077318c1c0302b | [
"BSD-3-Clause"
] | 1 | 2020-12-10T14:42:53.000Z | 2020-12-10T14:42:53.000Z | bits 64
default rel
card_len equ 80
section .bss
switch: resq 1 ; module global data for SQUASHER
ON equ 1
OFF equ 0
i: resq 1 ; module global data for RDCRD and SQUASHER
card: resb card_len ; module global data for RDCRD and SQUASHER
t1: resq 1 ; module global data for SQUASHER
t2: resq 1 ; module global data for SQUASHER
out: resq 1 ; module global data for SQUASHER, WRITE
section .text
; --------------------------------------------------------------------------------
SYS_READ equ 0
STDIN equ 0
RDCRD:
mov rax, [i]
cmp rax, card_len
jne .exit
mov qword [i], 0
; read card into card[1:80]
mov rdx, card_len ; maximum number of bytes to read
mov rsi, card ; buffer to read into
mov rdi, STDIN ; file descriptor
mov rax, SYS_READ
syscall
.exit:
ret
; --------------------------------------------------------------------------------
SQUASHER:
mov rax, [switch]
cmp rax, OFF
je .off
.on:
mov rax, [t2]
mov [out], rax
mov qword [switch], OFF
jmp .exit
.off:
call RDCRD
mov rsi, [i]
mov rdi, card
xor rax, rax
mov al, [rdi + rsi]
mov [t1], rax
inc rsi
mov [i], rsi
mov rax, [t1] ; redundant, value still in register
cmp rax, '*'
jne .not_equal_ast
.equal_ast:
call RDCRD
mov rsi, [i] ; redundant, value still in register
mov rdi, card
xor rax, rax
mov al, [rdi + rsi]
mov [t2], rax
inc rsi
mov [i], rsi
mov rax, [t2] ; redundant, value still in register
cmp rax, '*'
jne .not_equal_second_ast
.equal_second_ast:
mov qword [t1], '^'
jmp .not_equal_ast
.not_equal_second_ast:
mov qword [switch], ON
jmp .not_equal_ast
.not_equal_ast: ; label 1
mov rax, [t1]
mov [out], rax
.exit:
ret
; --------------------------------------------------------------------------------
SYS_WRITE equ 1
STDOUT equ 1
printRbx:
mov rdx, 1 ; message length
mov rsi, rbx ; message to write
mov rdi, STDOUT ; file descriptor
mov rax, SYS_WRITE
syscall
ret
; --------------------------------------------------------------------------------
WRITE:
.loop:
call SQUASHER
; out is output area of SQUASHER and only holds a single byte,
; so it can only return a single read element. The look ahead
; reads a second element and thus needs a switch to return the
; looked "ahead" element on next call.
mov rbx, out
call printRbx
mov rax, [i]
cmp rax, card_len
jne .loop
ret
; --------------------------------------------------------------------------------
SYS_EXIT equ 60
_exitProgram:
mov rax, SYS_EXIT
mov rdi, 0 ; return code = 0
syscall
; --------------------------------------------------------------------------------
global _main
_main:
; set up switch
mov qword [switch], OFF
; set up global data
mov qword [i], card_len
call WRITE
.finished:
jmp _exitProgram
| 24.878205 | 83 | 0.401701 |
5d023604025bd7ea2c87e1274ace39b924e5d968 | 747 | asm | Assembly | oeis/072/A072176.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/072/A072176.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/072/A072176.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A072176: Unimodal analog of Fibonacci numbers: a(n+1) = Sum_{k=0..floor(n/2)} A071922(n-k,k).
; Submitted by Jon Maiga
; 1,1,2,3,5,9,16,30,56,106,201,382,727,1384,2636,5021,9565,18222,34715,66137,126001,240052,457338,871304,1659978,3162533,6025150,11478911,21869232,41664520,79377833,151227961,288114394,548905795,1045756749,1992340377,3795739480,7231514438,13777236648,26247925146,50006658961,95270994814,181507076087,345801140568,658808633780,1255139920101,2391250111573,4555728811206,8679420400571,16535738102881,31503328792449,60019076187004,114346313371330,217848727642456,415038025592666,790716404690573
mov $2,1
lpb $0
sub $0,1
add $1,$3
mov $5,$4
mov $4,$2
mov $2,$3
add $5,$4
mov $3,$5
add $4,$1
lpe
mov $0,$1
add $0,1
| 41.5 | 490 | 0.7751 |
b94f7df127e58b812e1731397b3f12262bfa13c4 | 69 | asm | Assembly | src/main/fragment/mos6502-common/_stackidxword_vbuc1=vwum1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/main/fragment/mos6502-common/_stackidxword_vbuc1=vwum1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/main/fragment/mos6502-common/_stackidxword_vbuc1=vwum1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | tsx
lda {m1}
sta STACK_BASE+{c1},x
lda {m1}+1
sta STACK_BASE+{c1}+1,x | 13.8 | 23 | 0.681159 |
ff8ec839bcf8d6aa74c24ed964d4aef4ee93915a | 7,668 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_zr_sm_/i3-7100_9_0xca_notsx.log_21829_1130.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_zr_sm_/i3-7100_9_0xca_notsx.log_21829_1130.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_zr_sm_/i3-7100_9_0xca_notsx.log_21829_1130.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x9bd2, %r10
nop
nop
nop
sub %rcx, %rcx
mov (%r10), %rax
nop
nop
nop
nop
nop
xor %rax, %rax
lea addresses_D_ht+0x10f02, %r12
nop
nop
nop
nop
nop
dec %rsi
mov (%r12), %dx
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x11802, %rax
nop
nop
nop
nop
nop
xor $21967, %rbx
mov (%rax), %r10d
nop
nop
nop
nop
and $3366, %rbx
lea addresses_D_ht+0xd0a2, %rsi
lea addresses_normal_ht+0xab82, %rdi
nop
add $18058, %r12
mov $23, %rcx
rep movsq
add $3770, %rax
lea addresses_WT_ht+0x6802, %rdi
cmp %rax, %rax
mov $0x6162636465666768, %r10
movq %r10, (%rdi)
nop
nop
nop
nop
nop
sub %r12, %r12
lea addresses_D_ht+0x13c52, %r10
nop
nop
nop
cmp %rsi, %rsi
movb $0x61, (%r10)
inc %rbx
lea addresses_UC_ht+0xe182, %r10
and $25347, %rsi
mov (%r10), %rax
nop
nop
add %rbx, %rbx
lea addresses_WT_ht+0x6362, %r12
nop
cmp %rcx, %rcx
movl $0x61626364, (%r12)
nop
nop
nop
xor $20389, %rbx
lea addresses_D_ht+0x6482, %rsi
xor %rbx, %rbx
mov $0x6162636465666768, %r10
movq %r10, (%rsi)
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0x2c02, %rbx
nop
nop
nop
sub %r10, %r10
movb (%rbx), %r12b
nop
nop
nop
nop
nop
sub $2048, %r12
lea addresses_D_ht+0x2896, %rsi
lea addresses_UC_ht+0xe3d0, %rdi
nop
inc %r10
mov $71, %rcx
rep movsw
nop
nop
xor %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r9
push %rax
push %rcx
push %rdx
// Store
lea addresses_D+0x6892, %rax
nop
nop
nop
cmp %r9, %r9
movw $0x5152, (%rax)
inc %rcx
// Store
mov $0x302, %r14
nop
dec %r15
mov $0x5152535455565758, %rdx
movq %rdx, %xmm4
movups %xmm4, (%r14)
nop
nop
nop
nop
nop
xor %r15, %r15
// Store
lea addresses_normal+0x3c02, %rcx
clflush (%rcx)
nop
nop
nop
nop
sub $25688, %r14
mov $0x5152535455565758, %r9
movq %r9, %xmm2
movntdq %xmm2, (%rcx)
nop
nop
nop
nop
nop
xor $16257, %rax
// Store
lea addresses_PSE+0x12b02, %r11
nop
nop
nop
nop
and %rax, %rax
mov $0x5152535455565758, %rdx
movq %rdx, %xmm0
vmovups %ymm0, (%r11)
nop
nop
nop
nop
cmp %rdx, %rdx
// Faulty Load
lea addresses_normal+0x3c02, %rcx
sub $8028, %r14
movaps (%rcx), %xmm7
vpextrq $0, %xmm7, %r11
lea oracles, %rdx
and $0xff, %r11
shlq $12, %r11
mov (%rdx,%r11,1), %r11
pop %rdx
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_P', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_normal', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_PSE', 'size': 32, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 7, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 9, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'58': 21468, '00': 361}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 32.35443 | 2,999 | 0.653234 |
9437f5c7ccf960e7c932c6f9de85929a384f29d4 | 65,786 | asm | Assembly | OSSOURCE/kernel.asm | mooseman/smallOS | a4468b69e8372350310828d5b72b56fb5e3a0fa8 | [
"Unlicense"
] | 3 | 2015-11-05T09:13:10.000Z | 2021-03-24T13:30:27.000Z | OSSOURCE/kernel.asm | mooseman/smallOS | a4468b69e8372350310828d5b72b56fb5e3a0fa8 | [
"Unlicense"
] | null | null | null | OSSOURCE/kernel.asm | mooseman/smallOS | a4468b69e8372350310828d5b72b56fb5e3a0fa8 | [
"Unlicense"
] | 1 | 2017-03-30T12:46:43.000Z | 2017-03-30T12:46:43.000Z | ; MMURTL Operating System Source Code
; Written by Richard A. Burgess
;
; This code is released to the public domain.
; "Share and enjoy....." ;)
;
.DATA
.INCLUDE MOSEDF.INC
.INCLUDE TSS.INC
.INCLUDE RQB.INC
.INCLUDE JOB.INC
dJunk DD 0 ;Used as temp in Service Abort function
dmsg DD 2 DUP(0) ;tmp for abort
EXTRN TimerTick DD
EXTRN SwitchTick DD
EXTRN dfHalted DD
EXTRN _nSwitches DD
EXTRN _nHalts DD
EXTRN _nReady DD
.CODE
EXTRN LinToPhy NEAR
;This file contains all the internal kernel functions plus
;the PUBLIC kernel functions SendMsg, ISendMsg, WaitMsg, CheckMsg,
;Request, Respond, MoveMsg, NewTask and SpawnTask.
;Exchange management functions such as AllocExch and DeAllocExch are
;also here.
;
; Note on interrupts and the kernel primitives:
; Because certain kernel functions may be called from ISRs,
; and because portions of other kernel functions may be
; interrupted by a task change that happens because of an action
; that an ISR takes, we must ensure that interrupts are
; DISABLED prior to the allocation or deallocation
; of ALL kernel data segment resources. This especially applies when
; a message is "in transit." For example: taken from an exchange
; but not yet linked to a TSS and placed on the ready queue.
; This is important!
;
; NOTE on Exchanges, Messages, and Tasks (TSSs)
; In MMURTL, an exchange is a place where either Messages or
; Tasks wait. There can never be tasks AND messages at an
; exchange at the same time (unless the kernel is BROKEN!).
; When a message is sent to an exchange, if a task is waiting
; there, is it immediately associated with the message
; and placed on the readyQ in priority order.
; For this reason we share the HEAD and TAIL link pointers
; for tasks and messages on an exchange.
;
;=============================================================================
enQueueMsg:
;
; INPUT : ESI,EAX
; OUTPUT : NONE
; REGISTERS : EAX,EDX,ESI,FLAGS
; MODIFIES : EDX
;
; This routine will place the link block pointed to by EAX onto the exchange
; pointed to by the ESI register. If EAX is NIL then the routine returns.
;
OR EAX,EAX ; if pLBin = NIL THEN Return;
JZ eqMsgDone ;
MOV DWORD PTR [EAX+NextLB], 0 ; pLBin^.Next <= NIL;
XCHG ESI,EAX ; pExch => EAX, pLBin => ESI
CMP DWORD PTR [EAX+EHead], 0 ; if ..MsgHead = NIL
JNE eqMNotNIL ; then
MOV [EAX+EHead],ESI ; ..MsgHead <= pLBin;
MOV [EAX+ETail],ESI ; ..MsgTail <= pLBin;
MOV DWORD PTR [EAX+fEMsg], 1 ; Flag it as a Msg (vice a task)
XCHG EAX,ESI ; Put pExch Back in ESI
RETN ; else
eqMNotNIL:
MOV EDX,[EAX+ETail] ; ..MsgTail^.NextLB <= pLBin;
MOV [EDX+NextLB],ESI ;
MOV [EAX+ETail],ESI ; ..MsgTail <= pLBin;
MOV DWORD PTR [EAX+fEMsg], 1 ; Flag it as a Msg (vice a task)
XCHG EAX,ESI ; Put pExch Back in ESI
eqMsgDone:
RETN ;
;=============================================================================
deQueueMsg:
;
; INPUT : ESI
; OUTPUT : EAX
; REGISTERS : EAX,EBX,ESI,FLAGS
; MODIFIES : *prgExch[ESI].msg.head and EBX
;
; This routine will dequeue a link block on the exchange pointed to by the
; ESI register and place the pointer to the link block dequeued into EAX.
;
MOV EAX,[ESI+fEMsg] ; Get Msg Flag
OR EAX, EAX ; Is it a Msg?
JZ deMsgDone ; No! (return 0)
MOV EAX,[ESI+EHead] ; pLBout <= ..MsgHead;
OR EAX, EAX ; if pLBout = NIL then Return;
JZ deMsgDone ;
MOV EBX,[EAX+NextLB] ; ..MsgHead <= ..MsgHead^.Next;
MOV [ESI+EHead],EBX ;
deMsgDone:
RETN ;
;=============================================================================
deQueueTSS:
;
; INPUT : ESI
; OUTPUT : EAX
; REGISTERS : EAX,EBX,ESI,FLAGS
; MODIFIES : EAX,EBX
;
; This routine will dequeue a TSS on the exchange pointed to by the ESI
; register and place the pointer to the TSS dequeued into EAX.
; EAX return NIL if no TSS is waiting at Exch ESI
;
XOR EAX,EAX ; Set up to return nothing
MOV EBX,[ESI+fEMsg] ; Msg flag (is it a Msg)
OR EBX, EBX
JNZ deTSSDone ; It's a Msg (return leaving EAX 0)
MOV EAX,[ESI+EHead] ; pTSSout <= ..TSSHead;
OR EAX, EAX ; if pTSSout = NIL then Return;
JZ deTSSDone ;
MOV EBX,[EAX+NextTSS] ; ..TSSHead <= ..TSSHead^.Next;
MOV [ESI+EHead],EBX ;
deTSSDone:
RETN ;
;=============================================================================
PUBLIC enQueueRdy:
;
; INPUT : EAX
; OUTPUT : NONE
; REGISTERS : EAX,EBX,EDX,FLAGS
; MODIFIES : EAX,EBX,EDX
;
; This routine will place a TSS pointed to by EAX onto the ReadyQueue. This
; algorithm chooses the proper priority queue based on the TSS priority.
; The Rdy Queue is an array of QUEUES (2 pointers, head & tail per QUEUE).
; This links the TSS to rgQueue[nPRI].
;
OR EAX,EAX ; if pTSS = NIL then return;
JZ eqRdyDone ;
INC _nReady ;
MOV DWORD PTR [EAX+NextTSS], 0 ; pTSSin^.Next <= NIL;
XOR EBX,EBX ; get the priority
MOV BL,[EAX+Priority] ; in EBX
XCHG EAX,EBX ; Priority => EAX, pTSSin => EBX
SHL EAX, 3 ; Times 8 (size of QUEUE)
LEA EDX,RdyQ ; Add offset of RdyQ => EAX
ADD EAX,EDX ; EAX pts to proper Rdy Queue
CMP DWORD PTR [EAX+Head], 0 ; if Head = NIL
JNE eqRNotNIL ; then
MOV [EAX+Head],EBX ; ..Head <= pTSSin;
MOV [EAX+Tail],EBX ; ..Tail <= pTSSin;
RETN ; else
eqRNotNIL:
MOV EDX,[EAX+Tail] ; ..Tail^.NextTSS <= pTSSin;
MOV [EDX+NextTSS],EBX ;
MOV [EAX+Tail],EBX ; ..Tail <= pTSSin;
eqRdyDone:
RETN ;
;=============================================================================
PUBLIC deQueueRdy:
;
; INPUT : NONE
; OUTPUT : EAX
; REGISTERS : EAX,EBX,ECX,FLAGS
; MODIFIES : RdyQ
;
; This routine will return a pointer in EAX to the highest priority task
; queued on the RdyQ. Then the routine will "pop" the TSS from the RdyQ.
; If there was no task queued, EAX is returned as NIL.
;
MOV ECX,nPRI ; Set up the number of times to loop
LEA EBX,RdyQ ; Get base address of RdyQ in EBX
deRdyLoop:
MOV EAX,[EBX] ; Get pTSSout in EAX
OR EAX, EAX ; IF pTSSout is NIL Then go and
JNZ deRdyFound ; check the next priority.
ADD EBX,sQUEUE ; Point to the next Priority Queue
LOOP deRdyLoop ; DEC ECX and LOOP IF NOT ZERO
deRdyFound:
OR EAX, EAX ; IF pTSSout is NIL Then there are
JZ deRdyDone ; No TSSs on the RdyQ; RETURN
DEC _nReady ;
MOV ECX,[EAX+NextTSS] ; Otherwise, deQueue the process
MOV [EBX],ECX ; And return with the pointer in EAX
deRdyDone:
RETN ;
;=============================================================================
PUBLIC ChkRdyQ:
;
; INPUT : NONE
; OUTPUT : EAX
; REGISTERS : EAX,EBX,ECX,FLAGS
; MODIFIES : RdyQ
;
; This routine will return a pointer to the highest priority TSS that
; is queued to run. It WILL NOT remove it from the Queue.
; If there was no task queued, EAX is returned as NIL.
;
MOV ECX,nPRI ; Set up the number of times to loop
LEA EBX,RdyQ ; Get base address of RdyQ in EBX
ChkRdyLoop:
MOV EAX,[EBX] ; Get pTSSout in EAX
OR EAX, EAX ; IF pTSSout is NIL Then go and
JNZ ChkRdyDone ; check the next priority.
ADD EBX,sQUEUE ; Point to the next Priority Queue
LOOP ChkRdyLoop ; DEC ECX and LOOP IF NOT ZERO
ChkRdyDone:
RETN ;
;=============================================================================
;================= BEGIN NEAR KERNEL HELPER ROUTINES =========================
;=============================================================================
; RemoveRdyJob (NEAR)
;
; This routine searchs all ready queue priorities for tasks belonging
; to pJCB. When one is found it is removed from the queue
; and the TSS is freed up. This is called when we are killing
; a job.
;
; Procedureal Interface :
;
; RemoveRdyJob(char *pJCB):ercType
;
; pJCB is a pointer to the JCB that the tasks to kill belong to.
;
; pJCB EQU DWORD PTR [EBP+8]
;
; INPUT : (pJCB on stack)
; OUTPUT : NONE
; REGISTERS : All general registers are trashed
; MODIFIES : RdyQ
;
;
PUBLIC _RemoveRdyJob:
;
PUSH EBP ;
MOV EBP,ESP ;
MOV ECX,nPRI ; Set up the number of times to loop
LEA EBX,RdyQ ; Get base address of RdyQ in EBX
MOV EDX, [EBP+8] ; EDX holds pJCB for comparison (RAB)
;EBX points to begining of next Priority Queue
RemRdyLoop:
MOV EAX,[EBX+Head] ; Get pTSS in EAX
MOV EDI, EAX ; EDI points to last TSS by default (or NIL)
OR EAX,EAX ; Is pTSS 0 (none left queued here)
JNZ RemRdy0 ; Valid pTSS!
RemRdyLoop1:
MOV [EBX+Tail], EDI ; EDI always points to last TSS or NIL
ADD EBX,sQUEUE ; Point to the next Priority Queue
LOOP RemRdyLoop ; DEC ECX and LOOP IF NOT ZERO
XOR EAX, EAX ; No error
POP EBP
RETN 4 ; All done (clean stack)
;Go here to dequeue a TSS at head of list
RemRdy0:
CMP EDX, [EAX+TSS_pJCB] ; Is this from the JCB we want?
JNE RemRdy2 ; No
MOV EDI, [EAX+NextTSS] ; Yes, deQueue the TSS
MOV [EBX+Head], EDI ; Fix link in Queue list
PUSH EBX ; Save ptr to RdyQue (crnt priority)
;Free up the TSS (add it to the free list)
MOV EBX,pFreeTSS ; pTSSin^.Next <= pFreeTSS;
MOV [EAX+NextTSS],EBX ;
MOV DWORD PTR [EAX+TSS_pJCB], 0 ; Make TSS invalid
MOV pFreeTSS,EAX ; pFreeTSS <= pTSSin;
INC _nTSSLeft ;
POP EBX
MOV EAX, EDI ; Make EAX point to new head TSS
OR EAX, EAX ; Is it Zero?
JZ RemRdyLoop1 ; Next Queue please
JMP RemRdy0 ; back to check next at head of list
;Go here to dequeue a TSS in middle or end of list
RemRdy2:
MOV EAX, [EDI+NextTSS] ; Get next link in list
OR EAX, EAX ; Valid pTSS?
JZ RemRdyLoop1 ; No. Next Queue please
CMP EDX, [EAX+TSS_pJCB] ; Is this from JCB we want?
JE RemRdy3 ; Yes. Trash it.
MOV EDI, EAX ; No. Next TSS
JMP RemRdy2
RemRdy3:
;EDI points to prev TSS
;EAX points to crnt TSS
;Make ESI point to NextTSS
MOV ESI, [EAX+NextTSS] ; Yes, deQueue the TSS
;Now we fix the list (Make Prev point to Next)
;This extracts EAX from the list
MOV [EDI+NextTSS], ESI ;Jump the removed link
PUSH EBX ;Save ptr to RdyQue (crnt priority)
;Free up the TSS (add it to the free list)
MOV EBX,pFreeTSS ; pTSSin^.Next <= pFreeTSS;
MOV [EAX+NextTSS],EBX ;
MOV DWORD PTR [EAX+TSS_pJCB], 0 ; Make TSS invalid
MOV pFreeTSS,EAX ; pFreeTSS <= pTSSin;
INC _nTSSLeft ;
POP EBX
;
OR ESI, ESI ;Is EDI the new Tail? (ESI = 0)
JZ RemRdyLoop1 ;Yes. Next Queue please
JMP RemRdy2 ;back to check next TSS
;=============================================================================
; GetExchOwner (NEAR)
;
; This routine returns the owner of the exchange specified.
; A pointer to the JCB of the owner is returned.
; ErcNotAlloc is returned if the exchange isn't allocated.
; ErcOutofRange is returned is the exchange number is invalid (too high)
;
; Procedureal Interface :
;
; GetExchOwner(long Exch, char *pJCBRet): dErrror
;
; Exch is the exchange number.
; pJCBRet is a pointer to the JCB that the tasks to kill belong to.
;
; Exch EQU DWORD PTR [EBP+12]
; pJCBRet EQU DWORD PTR [EBP+8]
PUBLIC _GetExchOwner: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV EAX, [EBP+12] ; Get Resp Exchange in EDX
CMP EAX,nExch ; Is the exchange out of range?
JB GEO01 ; No, continue
MOV EAX,ErcOutOfRange ; Yes, Error in EAX register
JMP GEOEnd ;
GEO01:
MOV EDX,sEXCH ; Compute offset of Exch in rgExch
MUL EDX ; sExch * Exch number
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EDX,EAX ; EDX -> Exch
MOV EAX, [EDX+Owner]
OR EAX, EAX ; Valid Exch (Allocated)
JNZ GEO02
MOV EAX, ErcNotAlloc ; No, not allocated
JMP SHORT GEOEnd
GEO02:
MOV ESI, [EBP+8] ;Where to return pJCB of Exchange
MOV [ESI], EAX ;
XOR EAX, EAX
GEOEnd:
MOV ESP,EBP ;
POP EBP ;
RETN 8 ;
;=============================================================================
; SetExchOwner (NEAR)
;
; This routine sets the owner of the exchange specified to the
; pJCB specified. This is used by the Job code to set the owner of
; a TSS exchange to a new JCB (even though the exchange was allocated
; by the OS). No error checking is done as the job code does it upfront!
;
; Procedureal Interface :
;
; SetExchOwner(long Exch, char *pNewJCB): dErrror
;
; Exch is the exchange number.
; pNewJCB is a pointer to the JCB of the new owner.
;
; Exch EQU DWORD PTR [EBP+12]
; pNewJCB EQU DWORD PTR [EBP+8]
PUBLIC _SetExchOwner: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV EAX, [EBP+12] ; Exchange Number
MOV EDX,sEXCH ; Compute offset of Exch in rgExch
MUL EDX ; sExch * Exch number
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ; EAX -> oExch + prgExch
MOV EBX, [EBP+8]
MOV [EAX+Owner], EBX
XOR EAX, EAX
POP EBP ;
RETN 8 ;
;=============================================================================
; SendAbort (NEAR)
;
; This routine sends one abort message to each valid service
; with the jobnum of the aborting job. If we receive a
; kernel error on Request it may be becuase it is a service
; that is aborting itself. We ignore the kernel errors.
;
; Procedureal Interface :
;
; SendAbort(long JobNum, ValidExch): dErrror
;
; JobNum is the job that is aborting
; ValidExch is any valid exchange so the request will go through
;
; JobNum EQU DWORD PTR [EBP+12]
; ValidExch EQU DWORD PTR [EBP+8]
PUBLIC _SendAbort: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV ESI,OFFSET rgSVC ; Get the address of rgSVC
MOV ECX,nSVC ; Get the number of Service Descriptors
SAB01:
CMP DWORD PTR [ESI], 0 ; Valid name?
JE SAB05 ; NO, next service
PUSH ESI ;Save count and pointer to SVC name
PUSH ECX
;Push all the params to make the request
PUSH ESI ;pName
PUSH 0 ;Abort Service Code
MOV EAX, [EBP+8] ;Exchange
PUSH EAX
PUSH OFFSET dJunk ;pHandleRet
PUSH 0 ;npSend
PUSH 0 ;pData0
PUSH 0 ;cbData0
PUSH 0 ;pData1
PUSH 0 ;cbData1
MOV EAX, [EBP+12] ;JobNum
PUSH EAX ;dData0
PUSH 0 ;dData1
PUSH 0 ;dData2
CALL FWORD PTR _Request
;RAB
SAB02:
PUSH DWORD PTR [EBP+8]
PUSH OFFSET dmsg
CALL FWORD PTR _WaitMsg
MOV EAX, dmsg
CMP EAX, dJunk ;see if we got got response back!
JNE SAB02 ;NO - wait again
;RAB
POP ECX
POP ESI
SAB05:
ADD ESI, sSVC ;Next Service name
LOOP SAB01
XOR EAX, EAX
MOV ESP,EBP ;
POP EBP ;
RETN 8 ;
;=======================================================================
;============== BEGIN PUBLIC KERNEL PRIMITIVES =========================
;=======================================================================
;
; Request - The kernel request primitive sends a message like the Send
; primitive except this function requires several more parameters.
; A system structure called a request block is allocated and some of these
; parameters are placed in it. A request block is the basic
; structure used for Client-Server communications. The exchange where a
; request should be queued is determined by searching the system service
; array for a matching request service name specified in the request block.
; The procedural interface to Request looks like this:
;
; Request( pSvcName [EBP+56]
; wSvcCode [EBP+52]
; dRespExch [EBP+48]
; pRqHndlRet [EBP+44]
; dnpSend [EBP+40]
; pData1 [EBP+36]
; dcbData1 [EBP+32]
; pData2 [EBP+28]
; dcbData2 [EBP+24]
; dData0 [EBP+20]
; dData1 [EBP+16]
; dData2 [EBP+12] ) : dError
PUBLIC __Request: ;
PUSH EBP ; Save the Previous FramePtr
MOV EBP,ESP ; Set up New FramePtr
;Validate service name from registry and get exchange
MOV EAX, [EBP+56] ;pServiceName
CALL GetExchange ;Leaves Service Exch in ESI if no errors
OR EAX,EAX ;Any errors?
JZ SHORT Req02 ;No
JMP ReqEnd ;Yes, return error
Req02:
;Validate exchange
MOV EDX, [EBP+48] ; Get Resp Exchange in EDX
CMP EDX,nExch ; Is the exchange out of range?
JB Req03 ; No, continue
MOV EAX,ercOutOfRange ; Yes, Error in EAX register
JMP ReqEnd ;
Req03:
;Get them a request block
CLI
CALL NewRQB ;EAX has ptr to new RqBlk (or 0 if none)
STI
OR EAX, EAX ;Did we get one? (NIL (0) means we didn't)
JNZ Req04 ;Yes. EAX ptr to new RqBlk
MOV EAX, ErcNoMoreRqBlks ;No, Sorry...
JMP ReqEnd ;
Req04:
;ESI still has the exchange for the service
;EDX still has the response exchange
;EAX has pRqBlk (Handle)
MOV EBX, EAX ;EBX now pts to RqBlk
MOV [EBX+ServiceExch], ESI ;Put Svc Exch into RqBlk
MOV EAX, [EBP+52] ;Get Svc Code
MOV [EBX+ServiceCode], AX ;Put Svc Code into RqBlk
MOV [EBX+RespExch], EDX ;Put Resp Exch into RqBlk
CALL GetCrntJobNum ;Get crnt JCB (Job Num of owner)
MOV [EBX+RqOwnerJob], EAX ;put in RqBlk
MOV EAX, [EBP+20] ;Get dData0
MOV [EBX+dData0], EAX ;put in RqBlk
MOV EAX, [EBP+16] ;Get dData1
MOV [EBX+dData1], EAX ;put in RqBlk
MOV EAX, [EBP+20] ;Get dData2
MOV [EBX+dData2], EAX ;put in RqBlk
MOV EAX, [EBP+36] ;Get pData1
MOV [EBX+pData1], EAX ;put in RqBlk
MOV EAX, [EBP+32] ;Get cbData1
MOV [EBX+cbData1], EAX ;put in RqBlk
MOV EAX, [EBP+28] ;Get pData2
MOV [EBX+pData2], EAX ;put in RqBlk
MOV EAX, [EBP+24] ;Get cbData2
MOV [EBX+cbData2], EAX ;put in RqBlk
MOV EAX, [EBP+40] ;Number of Send PbCbs
CMP EAX, 3 ;Must be 2 or less
JB Req06 ;
MOV EAX, 2
Req06:
MOV [EBX+npSend], AL ;Put nSend PbCbs into RqBlk
MOV CL, 2 ;Caculate nRecv (2-nSend)
SUB CL, AL ;Leave in CL
MOV [EBX+npRecv], CL ;Put npRecv in RqBlk
;At this point the RqBlk is all filled in.
;Now we will return the RqBlkHandle to the user.
;The handle is actually a ptr to the RqBlk but they can't use
;it as one anyway (so no problem)
MOV EDI, [EBP+44] ;Ptr to return handle to
MOV [EDI], EBX ;Give it to them
MOV EDX, EBX ;Save RqBlk in EDX
CLI ; No interruptions from here on
;Now we allocate a Link block to use
MOV EAX,pFreeLB ; EAX <= pFreeLB;
OR EAX,EAX ; Is pFreeLB NIL? (out of LBs)
JNZ Req08 ;
CALL DisposeRQB ; NO... free up RqBlk
MOV EAX,ercNoMoreLBs ; Move error in the EAX register
JMP ReqEnd ; Go home with bad news
Req08:
MOV EBX,[EAX+NextLB] ; pFreeLB <= pFreeLB^.Next
MOV pFreeLB,EBX ;
DEC _nLBLeft ;
MOV DWORD PTR [EAX+LBType],REQLB ; This is a Request Link Block
MOV DWORD PTR [EAX+NextLB], 0 ; pLB^.Next <= NIL;
MOV [EAX+DataLo],EDX ; RqHandle into Lower 1/2 of Msg
MOV DWORD PTR [EAX+DataHi], 0 ; Store zero in upper half of pLB^.Data
PUSH EAX ; Save pLB on the stack
;ESI still has the exchange Number for the service.
;The ptr to the exch is required for deQueueTSS so we get it.
MOV EAX,ESI ; Exch => EAX
MOV EDX, sEXCH ; Compute offset of Exch in rgExch
MUL EDX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ESI,EAX ; MAKE ESI <= pExch
;ESI now points to the exchange
CALL deQueueTSS ; DeQueue a TSS on that Exch
OR EAX,EAX ; Did we get one?
JNZ Req10 ; Yes, give up the message
POP EAX ; No, Get the pLB just saved
CALL enQueueMsg ; EnQueue the Message on Exch
XOR EAX,EAX ; No Error
JMP SHORT ReqEnd ; And get out!
Req10:
POP EBX ; Get the pLB just saved into EBX
MOV [EAX+pLBRet],EBX ; and put it in the TSS
CALL enQueueRdy ; EnQueue the TSS on the RdyQ
MOV EAX,pRunTSS ; Get the Ptr To the Running TSS
CALL enQueueRdy ; and put him on the RdyQ
CALL deQueueRdy ; Get high priority TSS off the RdyQ
CMP EAX,pRunTSS ; If the high priority TSS is the
JNE Req12 ; same as the Running TSS then return
XOR EAX,EAX ; Return to Caller with erc ok.
JMP SHORT ReqEnd
Req12:
MOV pRunTSS,EAX ; Make the TSS in EAX the Running TSS
MOV BX,[EAX+Tid] ; Get the task Id (TR)
MOV TSS_Sel,BX ; Put it in the JumpAddr for Task Swtich
INC _nSwitches ; Keep track of how many swtiches for stats
MOV EAX, TimerTick ;Save time of this switch for scheduler
MOV SwitchTick, EAX ;
JMP FWORD PTR [TSS] ; JMP TSS (This is the task swtich)
XOR EAX,EAX ; Return to Caller with erc ok.
ReqEnd:
STI ;
MOV ESP,EBP ;
POP EBP ;
RETF 48 ; Rtn to Caller & Remove Params from stack
;=============================================================================
; The response primitive is used by system services to respond to a
; Request received at their service exchange. The RqBlk handle must be
; supplied along with the error/status code to be returned to the
; caller. This is very similar to Send except is dealiases addresses
; in the RqBlk and then deallocates it. The exchange to respond to
; is located inside the RqBlk.
; If dStatRet is ErcOwnerAbort, simply return the Reqest Block
; to the free pool and return Erc 0 to caller.
; Respond(dRqHndl, dStatRet): dError
;
;
dRqHndl EQU DWORD PTR [EBP+16]
dStatRet EQU DWORD PTR [EBP+12]
PUBLIC __Respond: ;
PUSH EBP ; Save Callers Frame
MOV EBP,ESP ; Setup Local Frame
;RAB
MOV EAX, dRqHndl ; pRqBlk into EAX
MOV EBX, dStatRet
CMP EBX, ErcOwnerAbort ;
JNE Resp01
CLI ; No interruptions
CALL DisposeRQB ; Return Aborted RQB to pool.
XOR EAX, EAX ; No Error
JMP RespEnd ; Get out
Resp01:
;RAB
MOV ESI, [EAX+RespExch] ; Response Exchange into ESI
CMP ESI,nExch ; Is the exchange out of range?
JNAE Resp02 ; No, continue
MOV EAX,ercOutOfRange ; Error into the EAX register.
JMP RespEnd ; Get out
Resp02:
MOV EAX,ESI ; Exch => EAX
MOV EDX,sEXCH ; Compute offset of Exch in rgExch
MUL EDX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ESI,EAX ; MAKE ESI <= pExch
CMP DWORD PTR [EAX+Owner], 0 ; If the exchange is not allocated
JNE Resp04 ; return to the caller with error
MOV EAX,ercNotAlloc ; in the EAX register.
JMP RespEnd ;
Resp04:
MOV EAX, dRqHndl ; Get Request handle into EBX (pRqBlk)
MOV EBX, [EAX+RqOwnerJob]
CALL GetCrntJobNum
CMP EAX, EBX
JE Resp06 ;Same job - no DeAlias needed
MOV EAX, dRqHndl ; Get Request handle into EBX (pRqBlk)
MOV EBX, [EAX+cbData1] ;
OR EBX, EBX
JZ Resp05 ;No need to dealias (zero bytes)
MOV EDX, [EAX+pData1]
OR EDX, EDX
JZ Resp05 ;Null pointer!
PUSH ESI ;Save pExch across call
PUSH EDX ;pMem
PUSH EBX ;cbMem
CALL GetCrntJobNum
PUSH EAX
CALL FWORD PTR _DeAliasMem ;DO it and ignore errors
POP ESI ;get pExch back
Resp05:
MOV EAX, dRqHndl ; Get Request handle into EBX (pRqBlk)
MOV EBX, [EAX+cbData2] ;
OR EBX, EBX
JZ Resp06 ;No need to dealias (zero bytes)
MOV EDX, [EAX+pData2]
OR EDX, EDX
JZ Resp06 ;Null pointer!
PUSH ESI ;Save pExch across call
PUSH EDX ;pMem
PUSH EBX ;cbMem
CALL GetCrntJobNum ;
PUSH EAX
CALL FWORD PTR _DeAliasMem ;DO it and ignore errors
POP ESI ;get pExch back
Resp06:
MOV EAX, dRqHndl ; Get Request handle into EBX (pRqBlk)
CLI ; No interruptions
CALL DisposeRQB ; Return Rqb to pool. Not needed anymore
; Allocate a link block
MOV EAX,pFreeLB ; NewLB <= pFreeLB;
OR EAX,EAX ; IF pFreeLB=NIL THEN No LBs;
JNZ Resp07 ;
MOV EAX,ercNoMoreLBs ; caller with error in the EAX register
JMP RespEnd
Resp07:
MOV EBX,[EAX+NextLB] ; pFreeLB <= pFreeLB^.Next
MOV pFreeLB,EBX ;
DEC _nLBLeft ;
MOV DWORD PTR [EAX+LBType], RESPLB ; This is a Response Link Block
MOV DWORD PTR [EAX+NextLB], 0 ; pLB^.Next <= NIL;
MOV EBX, dRqHndl ; Get Request handle into EBX
MOV [EAX+DataLo],EBX ; Store in lower half of pLB^.Data
MOV EBX, dStatRet ; Get Status/Error into EBX
MOV [EAX+DataHi],EBX ; Store in upper half of pLB^.Data
PUSH EAX ; Save pLB on the stack
CALL deQueueTSS ; DeQueue a TSS on that Exch
OR EAX,EAX ; Did we get one?
JNZ Resp08 ; Yes, give up the message
POP EAX ; Get the pLB just saved
CALL enQueueMsg ; EnQueue the Message on Exch
XOR EAX, EAX ; No Error
JMP SHORT RespEnd ; And get out!
Resp08:
POP EBX ; Get the pLB just saved into EBX
MOV [EAX+pLBRet],EBX ; and put it in the TSS
CALL enQueueRdy ; EnQueue the TSS on the RdyQ
MOV EAX,pRunTSS ; Get the Ptr To the Running TSS
CALL enQueueRdy ; and put him on the RdyQ
CALL deQueueRdy ; Get high priority TSS off the RdyQ
CMP EAX,pRunTSS ; If the high priority TSS is the
JNE Resp10 ; same as the Running TSS then return
XOR EAX,EAX ; Return to Caller with erc ok.
JMP SHORT RespEnd ;
Resp10:
MOV pRunTSS,EAX ; Make the TSS in EAX the Running TSS
MOV BX,[EAX+Tid] ; Get the task Id (TR)
MOV TSS_Sel,BX ; Put it in the JumpAddr
INC _nSwitches
MOV EAX, TimerTick ;Save time of this switch for scheduler
MOV SwitchTick, EAX ;
JMP FWORD PTR [TSS] ; JMP TSS
XOR EAX,EAX ; Return to Caller with erc ok.
RespEnd:
STI
MOV ESP,EBP ;
POP EBP ;
RETF 8 ; Rtn to Caller & Remove Params
;=============================================================================
;
; MoveRequest - The kernel Move Request primitive.
; This allows a service to move a request to another exchange it owns.
; This can not be used to forward a request to another service or Job.
; It is very similar to send except it checks to ensure the destination
; Exchange is owned by the sender.
;
; Procedural Interface :
;
; MoveRequest(dRqBlkHndl, DestExch):ercType
;
; dqMsg is the handle of the RqBlk to forward.
; DestExch the exchange to where the Request should be sent.
;
;
;dRqBlkHndl EQU [EBP+16]
;DestExch EQU [EBP+12]
PUBLIC __MoveRequest: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV ESI, [EBP+12] ; Get Exchange Parameter in ESI
CMP ESI,nExch ; Is the exchange is out of range
JNAE MReq02 ; No, continue
MOV EAX,ercOutOfRange ; in the EAX register.
JMP MReqEnd ; Get out
MReq02:
MOV EAX,ESI ; Exch => EAX
MOV EDX,sEXCH ; Compute offset of Exch in rgExch
MUL EDX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ESI,EAX ; MAKE ESI <= pExch
MOV EDX, [EAX+Owner] ; Put exch owner into EDX (pJCB)
CALL GetpCrntJCB ; Leaves it in EAX (uses only EAX)
CMP EDX, EAX ; If the exchange is not owned by sender
JE MReq04 ; return to the caller with error
MOV EAX, ErcNotOwner ; in the EAX register.
JMP MReqEnd ; Get out
MReq04:
CLI ; No interruptions from here on
; Allocate a link block
MOV EAX,pFreeLB ; NewLB <= pFreeLB;
OR EAX,EAX ; IF pFreeLB=NIL THEN No LBs;
JNZ MReq08 ;
MOV EAX,ercNoMoreLBs ; caller with error in the EAX register
JMP MReqEnd ; Go home with bad news
MReq08:
MOV EBX,[EAX+NextLB] ; pFreeLB <= pFreeLB^.Next
MOV pFreeLB,EBX ;
DEC _nLBLeft ;
MOV DWORD PTR [EAX+LBType], REQLBA ; Request Link Block (ALIASED! RAB)
MOV DWORD PTR [EAX+NextLB], 0 ; pLB^.Next <= NIL;
MOV EBX, [EBP+16] ; RqHandle
MOV [EAX+DataLo],EBX ; RqHandle into Lower 1/2 of Msg
MOV DWORD PTR [EAX+DataHi], 0 ; Store zero in upper half of pLB^.Data
PUSH EAX ; Save pLB on the stack
CALL deQueueTSS ; DeQueue a TSS on that Exch
OR EAX,EAX ; Did we get one?
JNZ MReq10 ; Yes, give up the message
POP EAX ; Get the pLB just saved
CALL enQueueMsg ; EnQueue the Message on Exch ESI
XOR EAX, EAX
JMP SHORT MReqEnd ; And get out!
MReq10:
POP EBX ; Get the pLB just saved into EBX
MOV [EAX+pLBRet],EBX ; and put it in the TSS
CALL enQueueRdy ; EnQueue the TSS on the RdyQ
MOV EAX,pRunTSS ; Get the Ptr To the Running TSS
CALL enQueueRdy ; and put him on the RdyQ
CALL deQueueRdy ; Get high priority TSS off the RdyQ
CMP EAX,pRunTSS ; If the high priority TSS is the
JNE MReq12 ; same as the Running TSS then return
XOR EAX,EAX ; Return to Caller with erc ok.
JMP SHORT MReqEnd
MReq12:
MOV pRunTSS,EAX ; Make the TSS in EAX the Running TSS
MOV BX,[EAX+Tid] ; Get the task Id (TR)
MOV TSS_Sel,BX ; Put it in the JumpAddr for Task Swtich
INC _nSwitches ; Keep track of how many swtiches for stats
MOV EAX, TimerTick ;Save time of this switch for scheduler
MOV SwitchTick, EAX ;
JMP FWORD PTR [TSS] ; JMP TSS (This is the task switch)
XOR EAX,EAX ; Return to Caller with erc ok.
MReqEnd:
STI ;
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
;=============================================================================
;
; SendMsg - The kernel send primitive. This sends a non-specific message
; from a running task to an exchange. This may cause a task swtich if
; a task is waiting at the exchange and it is of equal or higher priority
; that the task that sent the message.
;
; Procedural Interface :
;
; SendMsg(exch, dMsg1, dMsg2):ercType
;
; exch is a DWORD (4 BYTES) containing the exchange to where the
; message should be sent.
;
; dMsg1 & dMsg2 are DWord values defined and understood
; only by the sending and receiving tasks.
;
SendExchange EQU [EBP+14h]
MessageHi EQU DWORD PTR [EBP+10h]
MessageLo EQU DWORD PTR [EBP+0Ch]
PUBLIC __SendMsg: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV ESI,SendExchange ; Get Exchange Parameter in ESI
CMP ESI,nExch ; If the exchange is out of range
JNAE Send00 ; the return to caller with error
MOV EAX,ercOutOfRange ; in the EAX register.
JMP SendEnd
Send00:
MOV EAX,ESI ; Exch => EAX
MOV EDX,sEXCH ; Compute offset of Exch in rgExch
MUL EDX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ESI,EAX ; MAKE ESI <= pExch
CMP DWORD PTR [EAX+Owner], 0 ; If the exchange is not allocated
JNE Send01 ; return to the caller with error
MOV EAX,ercNotAlloc ; in the EAX register.
JMP SendEnd ;
Send01:
CLI ; No interrupts
; Allocate a link block
MOV EAX,pFreeLB ; NewLB <= pFreeLB;
OR EAX,EAX ; IF pFreeLB=NIL THEN No LBs;
JNZ SHORT Send02 ;
MOV EAX,ercNoMoreLBs ; caller with error in the EAX register
JMP SHORT MReqEnd ; Go home with bad news
Send02:
MOV EBX,[EAX+NextLB] ; pFreeLB <= pFreeLB^.Next
MOV pFreeLB,EBX ;
DEC _nLBLeft ;
MOV DWORD PTR [EAX+LBType], DATALB ; This is a Data Link Block
MOV DWORD PTR [EAX+NextLB], 0 ; pLB^.Next <= NIL;
MOV EBX,MessageLo ; Get lower half of Msg in EBX
MOV [EAX+DataLo],EBX ; Store in lower half of pLB^.Data
MOV EBX,MessageHi ; Get upper half of Msg in EBX
MOV [EAX+DataHi],EBX ; Store in upper half of pLB^.Data
PUSH EAX ; Save pLB on the stack
CLI ; No interrupts
CALL deQueueTSS ; DeQueue a TSS on that Exch
STI
OR EAX,EAX ; Did we get one?
JNZ Send25 ; Yes, give up the message
POP EAX ; Get the pLB just saved
CLI ; No interrupts
CALL enQueueMsg ; EnQueue the Message on Exch
JMP Send04 ; And get out (Erc 0)!
Send25:
POP EBX ; Get the pLB just saved into EBX
CLI ; No interrupts
MOV [EAX+pLBRet],EBX ; and put it in the TSS
CALL enQueueRdy ; EnQueue the TSS on the RdyQ
MOV EAX,pRunTSS ; Get the Ptr To the Running TSS
CALL enQueueRdy ; and put him on the RdyQ
CALL deQueueRdy ; Get high priority TSS off the RdyQ
CMP EAX,pRunTSS ; If the high priority TSS is the
JNE Send03 ; same as the Running TSS then return
JMP SHORT Send04 ; Return with ErcOk
Send03:
MOV pRunTSS,EAX ; Make the TSS in EAX the Running TSS
MOV BX,[EAX+Tid] ; Get the task Id (TR)
MOV TSS_Sel,BX ; Put it in the JumpAddr
INC _nSwitches
MOV EAX, TimerTick ;Save time of this switch for scheduler
MOV SwitchTick, EAX ;
JMP FWORD PTR [TSS] ; JMP TSS
Send04:
XOR EAX,EAX ; Return to Caller with erc ok.
SendEnd:
STI ;
MOV ESP,EBP ;
POP EBP ;
RETF 12 ;
;=============================================================================
;
; ISendMsg - The OS Interrupt Send primitive.
; This procedure allows an ISR to send a message to an exchange.
; This is the same as SendMsg except NO task switch is
; performed. If a task is waiting at the exchange, the message is
; associated (linked) with it and it is moved to the RdyQ.
; It will get a chance to run the next time the RdyQ is evaluated
; by the Kernel which will probably be by the timer interrupt slicer.
; Interrupt tasks can use ISendMsg to send single or multiple messages
; to exchanges during their execution.
; Interrupts are CLEARED on entry and WILL NOT BE SET on exit!!!
; It is the responsibility of the caller to set them if desired.
; ISendMsg is intended only to be used by ISRs in device drivers
;
;
; Procedural Interface :
;
; ISendMsg(exch, dMsg1, dMsg2):ercType
;
; exch is a DWORD (4 BYTES) containing the exchange to where the
; message should be sent.
;
; dMsg1 and dMsg2 are DWORD messages.
;
; Parameters on stack are the same as _SendMsg.
PUBLIC __ISendMsg: ;
CLI ;INTS ALWAYS CLEARED AND LEFT THAT WAY!
PUSH EBP ;
MOV EBP,ESP ;
MOV ESI,SendExchange ; Get Exchange Parameter in ESI
CMP ESI,nExch ; If the exchange is out of range
JNAE ISend00 ; then return to caller with error
MOV EAX,ercOutOfRange ; in the EAX register.
MOV ESP,EBP ;
POP EBP ;
RETF 12 ;
ISend00:
MOV EAX,ESI ; Exch => EAX
MOV EDX,sEXCH ; Compute offset of Exch in rgExch
MUL EDX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ESI,EAX ; MAKE ESI <= pExch
CMP DWORD PTR [EAX+Owner], 0 ; If the exchange is not allocated
JNE ISend01 ; return to the caller with error
MOV EAX,ercNotAlloc ; in the EAX register.
MOV ESP,EBP ;
POP EBP ;
RETF 12 ;
ISend01:
; Allocate a link block
MOV EAX,pFreeLB ; NewLB <= pFreeLB;
OR EAX,EAX ; IF pFreeLB=NIL THEN No LBs;
JNZ SHORT ISend02 ;
MOV EAX,ercNoMoreLBs ; caller with error in the EAX register
MOV ESP,EBP ;
POP EBP ;
RETF 12 ;
ISend02:
MOV EBX,[EAX+NextLB] ; pFreeLB <= pFreeLB^.Next
MOV pFreeLB,EBX ;
DEC _nLBLeft ;
MOV DWORD PTR [EAX+LBType], DATALB ; This is a Data Link Block
MOV DWORD PTR [EAX+NextLB],0 ; pLB^.Next <= NIL;
MOV EBX,MessageLo ; Get lower half of Msg in EBX
MOV [EAX+DataLo],EBX ; Store in lower half of pLB^.Data
MOV EBX,MessageHi ; Get upper half of Msg in EBX
MOV [EAX+DataHi],EBX ; Store in upper half of pLB^.Data
PUSH EAX ; Save pLB on the stack
CALL deQueueTSS ; DeQueue a TSS on that Exch
OR EAX,EAX ; Did we get one?
JNZ ISend03 ; Yes, give up the message
POP EAX ; No, Get the pLB just saved
CALL enQueueMsg ; EnQueue the Message on Exch
JMP ISend04 ; And get out!
ISend03:
POP EBX ; Get the pLB just saved into EBX
MOV [EAX+pLBRet],EBX ; and put it in the TSS
CALL enQueueRdy ; EnQueue the TSS on the RdyQ
ISend04:
XOR EAX,EAX ; Return to Caller with erc ok.
MOV ESP,EBP ;
POP EBP ;
RETF 12 ;
;=============================================================================
;
; Wait - The kernel wait primitive. This procedure allows a task to
; receive information from another task from an exchange. If no
; message is at the exchange, the task is placed on the exchange
; and the ReadyQ is reevaluated to make the next tast run.
;
; A result code is returned in the EAX register.
;
; Procedural Interface :
;
; Wait(exch,pdqMsgRet):ercType
;
; exch is a DWORD (4 BYTES) containing the exchange to where the
; message should be sent.
;
; pMessage is a pointer to an 8 byte area where the
; message is stored.
;
WaitExchange EQU [EBP+10h]
pMessage EQU [EBP+0Ch]
;
;
PUBLIC __WaitMsg: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV ESI,WaitExchange ; Get Exchange Parameter in ESI
CMP ESI,nExch ; If the exchange is out of range
JNAE Wait00 ; the return to caller with error
MOV EAX,ercOutOfRange ; in the EAX register.
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
Wait00:
MOV EAX,ESI ; ExchId => EAX
MOV EBX,sEXCH ; Compute offset of ExchId in rgExch
MUL EBX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ESI,EAX ; Put Exch in to ESI
CMP DWORD PTR [EAX+Owner], 0 ; If the exchange is not allocated
JNE Wait01 ; return to the caller with error
MOV EAX,ercNotAlloc ; in the EAX register.
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
Wait01:
CLI ;
CALL deQueueMsg ; EAX <= pLB from pExch (ESI)
OR EAX,EAX ; If no message (pLB = NIL) Then
JZ Wait02 ; Wait for Message Else
JMP Wait05 ; Get Message and Return
Wait02:
MOV EAX,pRunTSS ; Get pRunTSS in EAX to Wait
;This next section of code Queues up the TSS pointed to
;by EAX on the exchange pointed to by ESI
; (i.e., we make the current task "wait")
MOV DWORD PTR [EAX+NextTSS], 0 ; pTSSin^.Next <= NIL;
XCHG ESI,EAX ; pExch => EAX, pTSSin => ESI
CMP DWORD PTR [EAX+EHead], 0 ; if ..TSSHead = NIL
JNE Wait025 ; then
MOV [EAX+EHead],ESI ; ..TSSHead <= pTSSin;
MOV [EAX+ETail],ESI ; ..TSSTail <= pTSSin;
MOV DWORD PTR [EAX+fEMsg], 0 ; Flag it as a TSS (vice a Msg)
XCHG ESI,EAX ; Make ESI <= pExch Again
JMP SHORT Wait03 ; else
Wait025:
MOV EDX,[EAX+ETail] ; ..TSSTail^.NextTSS <= pTSSin;
MOV [EDX+NextTSS],ESI ;
MOV [EAX+ETail],ESI ; ..TSSTail <= pTSSin;
MOV DWORD PTR [EAX+fEMsg], 0 ; Flag it as a TSS (vice a Msg)
XCHG ESI,EAX ; Make ESI <= pExch Again
;We just placed the current TSS on an exchange,
;now we get the next TSS to run (if there is one)
Wait03:
CALL deQueueRdy ; Get highest priority TSS off the RdyQ
OR EAX, EAX ; Anyone ready to run?
JNZ Wait035 ; Yes (jump to check pTSS)
MOV EDI, 1
MOV dfHalted, EDI
INC _nHalts
STI ; No, then HLT CPU until ready
HLT ; Halt CPU and wait for interrupt
CLI ; An interrupt has occured. Clear Interrupts
XOR EDI,EDI
MOV dfHalted, EDI
JMP Wait03 ; Check for a task to switch to
Wait035:
CMP EAX,pRunTSS ; Same one as before???
JE Wait04 ; You bet! NO SWITCH!!!
;Now we switch tasks by placing the address of the
;new TSS in pRunTSS and jumping to it. This forces
;a 386 task switch.
MOV pRunTSS,EAX ; Make high priority TSS Run.
MOV BX,[EAX+Tid] ;
MOV TSS_Sel,BX ;
INC _nSwitches
MOV EAX, TimerTick ;Save time of this switch for scheduler
MOV SwitchTick, EAX ;
JMP FWORD PTR [TSS] ; JUMP TSS (Switch Tasks)
; A task has just finished "Waiting"
; We are now in the new task with its memory space
; (or the same task if he was high pri & had a msg)
; If this is a system service it may need RqBlk address aliases
; If it is an OS service we alias in OS memory!
Wait04:
MOV EDX,pRunTSS ; Put the TSS in EAX into EDX
MOV EAX,[EDX+pLBRet] ; Get the pLB in EAX
Wait05:
; if we got here, we have either switched tasks
; and we are delivering a message (or Req) to the new task,
; or the there was a message waiting at the exch of
; the first caller and we are delivering it.
; Either way, the message is already deQueued from
; the exch and the critical part of WaitMsg is over.
; We can start interrupts again except when we have
; to return the Link Block to the pool (free it up)
STI ; WE CAN RESTART INTERRUPTS HERE
CMP DWORD PTR [EAX+LBType],REQLB ; Is the link block a Req Link Block?
JNE Wait06 ; No, Treat it as a data link block
;pLB.DataLo is RqHandle (pRqBlk)
PUSH EAX ; Save ptr to Link Block
MOV EBX,[EAX+DataLo] ; Get pRqBlk into EBX
;Now we set up to alias the memory for the service
; (Alias the 2 Pointers in the RqBlk)
;_AliasMem(pMem, dcbMem, dJobNum, ppAliasRet): dError
MOV ECX, [EBX+cbData1] ;
OR ECX, ECX ;is cbData1 0?
JZ Wait051 ;Yes
MOV EAX, [EBX+pData1] ;
OR EAX, EAX ;is pData1 NULL?
JZ Wait051 ;Yes
;Set up params for AliasMem
PUSH EAX ;pMem
PUSH ECX ;cbMem
MOV EAX, [EBX+RqOwnerJob]
PUSH EAX ;dJobNum
ADD EBX, pData1 ;Offset to pData1 in RqBlk
PUSH EBX ;Linear Address of pData1
CALL FWORD PTR _AliasMem
OR EAX, EAX ;Error??
JZ Wait051 ;No, continue
POP EBX ;Make stack right
MOV ESP,EBP ;Return Error...
POP EBP ;
RETF 8 ;
Wait051: ;Second Pointer (pData2)
POP EAX ;Restore ptr to Link Block
PUSH EAX ;Save again
MOV EBX,[EAX+DataLo] ; Get pRqBlk into EBX
MOV ECX, [EBX+cbData2] ;
OR ECX, ECX ;is cbData2 0?
JZ Wait052 ;Yes
MOV EAX, [EBX+pData2] ;
OR EAX, EAX ;is pData2 NULL?
JZ Wait052 ;Yes
;Set up params for AliasMem
PUSH EAX ;pMem
PUSH ECX ;cbMem
MOV EAX, [EBX+RqOwnerJob]
PUSH EAX ;dJobNum
ADD EBX, pData2 ;Offset to pData2 in RqBlk
PUSH EBX ;Linear Address of PData1
CALL FWORD PTR _AliasMem
OR EAX, EAX ;Error??
JZ Wait052 ;No, continue
POP EBX ;Make stack right
MOV ESP,EBP ;Return Error...
POP EBP ;
RETF 8 ;
Wait052:
POP EAX ;Restore ptr to Link Block
Wait06:
MOV EBX,[EAX+DataLo] ; Get pLB^.Data into ECX:EBX
MOV ECX,[EAX+DataHi] ;
MOV EDX,pMessage ; Get Storage Addr in EDX
MOV [EDX],EBX ; Put pLB^.Data in specified
MOV [EDX+4],ECX ; memory space (EDX)
;Return the LB to the pool
CLI
MOV EBX,pFreeLB ; pLBin^.Next <= pFreeLB;
MOV [EAX+NextLB],EBX ;
MOV pFreeLB,EAX ; pFreeLB <= pLBin;
INC _nLBLeft ;
STI ;
XOR EAX,EAX ; ErcOK! (0)
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
;
;=============================================================================
;
; CheckMsg - The kernel Check primitive. This procedure provides access
; to the operating system by allowing a task to receive information
; from another process WITHOUT BLOCKING. In other words, if no message is
; available Check returns to the caller. If a message IS available it
; is returned to the caller immediately. The caller is never placed on
; an exchange and the RdyQ is not evaluated.
;
; A result code is returned in the EAX register.
;
; Procedureal Interface :
;
; CheckMsg(exch,pdqMsg):ercType
;
; exch is a DWORD (4 BYTES) containing the exchange to where the
; message should be sent.
;
; pdqMsg is a pointer to an 8 byte area where the message is stored.
;
ChkExchange EQU [EBP+10h]
pCkMessage EQU [EBP+0Ch]
PUBLIC __CheckMsg: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV ESI,ChkExchange ; Get Exchange Parameter in ESI
CMP ESI,nExch ; If the exchange is out of range
JNAE Chk01 ; the return to caller with error
MOV EAX,ercOutOfRange ; in the EAX register.
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
Chk01:
MOV EAX,ESI ; Exch => EAX
MOV EBX,sEXCH ; Compute offset of Exch in rgExch
MUL EBX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ESI,EAX ; Put pExch in to ESI
CMP DWORD PTR [EAX+Owner], 0 ; If the exchange is not allocated
JNE Chk02 ; return to the caller with error
MOV EAX,ercNotAlloc ; in the EAX register.
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
Chk02:
CLI ; Can't be interrupted
CALL deQueueMsg ; EAX <= pLB from pExch (ESI)
OR EAX,EAX ; If pLB = NIL Then
JNZ Chk03 ; Go to get msg and return
STI ;
MOV EAX,ercNoMsg ; return with erc no msg
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
Chk03:
STI ;We can be interrupted again
CMP DWORD PTR [EAX+LBType],REQLB ; Is the link block a Req Link Block?
JNE Chk04 ; No, Treat it as a data link block
;pLB.DataLo is RqHandle (pRqBlk)
PUSH EAX ; Save ptr to Link Block
MOV EBX,[EAX+DataLo] ; Get pRqBlk into EBX
;Now we set up to alias the memory for the service
; (Alias the 2 Pointers in the RqBlk)
;_AliasMem(pMem, dcbMem, dJobNum, ppAliasRet): dError
MOV ECX, [EBX+cbData1] ;
OR ECX, ECX ;is cbData1 0?
JZ Chk031 ;Yes
MOV EAX, [EBX+pData1] ;
OR EAX, EAX ;is pData1 NULL?
JZ Chk031 ;Yes
;Set up params for AliasMem
PUSH EAX ;pMem
PUSH ECX ;cbMem
MOV EAX, [EBX+RqOwnerJob]
PUSH EAX ;dJobNum
ADD EBX, pData1 ;Offset to pData1 in RqBlk
PUSH EBX ;Linear Address of pData1
CALL FWORD PTR _AliasMem
OR EAX, EAX ;Error??
JZ Chk031 ;No, continue
POP EBX ;Make stack right
MOV ESP,EBP ;Return Error...
POP EBP ;
RETF 8 ;
Chk031: ;Second Pointer (pData2)
POP EAX ;Restore ptr to Link Block
PUSH EAX ;Save again
MOV EBX,[EAX+DataLo] ; Get pRqBlk into EBX
MOV ECX, [EBX+cbData2] ;
OR ECX, ECX ;is cbData2 0?
JZ Chk032 ;Yes
MOV EAX, [EBX+pData2] ;
OR EAX, EAX ;is pData2 NULL?
JZ Chk032 ;Yes
;Set up params for AliasMem
PUSH EAX ;pMem
PUSH ECX ;cbMem
MOV EAX, [EBX+RqOwnerJob]
PUSH EAX ;dJobNum
ADD EBX, pData2 ;Offset to pData2 in RqBlk
PUSH EBX ;Linear Address of PData1
CALL FWORD PTR _AliasMem
OR EAX, EAX ;Error??
JZ Chk032 ;No, continue
POP EBX ;Make stack right
MOV ESP,EBP ;Return Error...
POP EBP ;
RETF 8 ;
Chk032:
POP EAX ;Restore Ptr to Link Block
Chk04:
MOV EBX,[EAX+DataLo] ; Get pLB^.Data into ECX:EBX
MOV ECX,[EAX+DataHi] ;
MOV EDX,pCkMessage ; Get Storage Addr in EDX
MOV [EDX],EBX ; Put pLB^.Data in specified
MOV [EDX+4],ECX ; memory space (EDX)
;Return the LB to the pool
CLI
MOV EBX,pFreeLB ; pLBin^.Next <= pFreeLB;
MOV [EAX+NextLB],EBX ;
MOV pFreeLB,EAX ; pFreeLB <= pLBin;
INC _nLBLeft ;
STI ;
XOR EAX,EAX ;ErcOK! (0)
MOV ESP,EBP ;
POP EBP ;
RETF 8 ;
;====================================================================
; NewTask --- OS PUBLIC - Creates a new task and schedules it for execution.
; used primarily to create a task for a job other than the one you are in.
; The OS uses this to create the initial task for a newly loaded job.
;
; The OS stacks are preallocated as part of the TSS. If this is an OS
; task (CodeSeg = 8) then we load the TSS Stack into TSS_ESP and
; TSS_ESP0, otherwise we take the ESP param and place it into TSS_ESP.
;
; Procedural interface:
;
; NewTask(JobNum, CodeSeg, Priority, fDebug, Exch, ESP, EIP): dErcRet
;
;
NTS_Job EQU [EBP+36] ;Job Num for this task
NTS_CS EQU [EBP+32] ;8 for OS, 18h for user task
NTS_Pri EQU [EBP+28] ;Priority of this task
NTS_fDbg EQU [EBP+24] ;TRUE for DEBUGing
NTS_Exch EQU [EBP+20] ;Exchange for TSS
NTS_ESP EQU [EBP+16] ;Initial stack pointer
NTS_EIP EQU [EBP+12] ;Task start address
PUBLIC __NewTask: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV EDX, NTS_Pri ;
CMP EDX, nPRI-1 ;Priority OK?
JBE NT0000
MOV EAX,ercBadPriority
JMP NTEnd
NT0000:
MOV ECX, NTS_Exch
CMP ECX, nExch ;Exch in range?
JBE NT0001
MOV EAX,ercOutOfRange
JMP NTEnd
NT0001:
CLI ;we can't be interrupted
MOV EAX,pFreeTSS ; NewTSS <= pFreeTSS;
OR EAX,EAX ; IF pFreeTSS=NIL THEN Return;
JNZ NT0002 ;
MOV EAX,ercNoMoreTSSs ;No...
JMP NTEnd
NT0002:
MOV EBX,[EAX+NextTSS] ; pFreeTSS <= pFreeTSS^.Next
MOV pFreeTSS,EBX ;
DEC _nTSSLeft ;
STI
;EAX now has pNewTSS
MOV [EAX+Priority],DL ;put Priority into TSS
MOV DWORD PTR [EAX+TSS_EFlags],0202h ;Load the Flags Register
MOV [EAX+TSS_Exch], ECX ;Put new Exch in TSS (ECX is free)
MOV EBX, NTS_EIP ;mov EIP into TSS (Start Address)
MOV [EAX+TSS_EIP],EBX
MOV EBX, NTS_ESP ;mov ESP into TSS
MOV [EAX+TSS_ESP],EBX
MOV [EAX+TSS_ESP0],EBX ;
MOV ECX, NTS_CS ;mov CS into TSS
MOV [EAX+TSS_CS],CX
PUSH EAX ;Save pNewTSS
;Now we get pJCB from JobNum they passed in so we can
;get the PD from the JCB
MOV EAX, NTS_Job ;Set up to call GetpJCB
CALL GetpJCB ;EAX now has pJCB
MOV ECX, EAX ;ECX now has pJCB
POP EAX ;Restore pNewTSS to EAX
MOV [EAX+TSS_pJCB],ECX ;Put pJCB into TSS
MOV EBX, [ECX+JcbPD] ;Set up to call LinToPhy
PUSH EAX ;Save pNewTSS again
MOV EAX, NTS_Job ;
CALL LinToPhy ;Get Physical Address for PD into EAX
MOV EBX, EAX
POP EAX ;pNewTSS into EAX
MOV [EAX+TSS_CR3],EBX ;Put Physical Add for PD into TSS_CR3
CMP DWORD PTR NTS_fDbg, 0 ;Debug on entry?
JE NT0004 ;No
MOV WORD PTR [EAX+TSS_TrapBit], 1 ;Yes
NT0004:
MOV EBX, NTS_Pri ;Get priority of new task
CLI ;We can't be interrupted
MOV EDX,pRunTSS ;Get who's running
CMP BYTE PTR [EDX+Priority],BL ;Who got the highest Pri?
JA NT0005 ;New guy does (lowest num)
CALL enQueueRdy ;Just put new guy on the ReadyQue (EAX)
XOR EAX,EAX ;ercOk
JMP NTEnd ;Return to caller
NT0005:
XCHG EAX,EDX ;CrntTSS -> EAX, New TSS -> EDX
PUSH EDX ;Save New TSS
CALL enQueueRdy ;
POP EAX ;New TSS -> EAX
MOV pRunTSS,EAX ;Move new TSS into pRunTSS
MOV BX,[EAX+Tid] ;Put Selector/Offset in "TSS"
MOV TSS_Sel,BX ;
INC _nSwitches
MOV EAX, TimerTick ;Save time of this switch for scheduler
MOV SwitchTick, EAX ;
JMP FWORD PTR [TSS] ;Jump to new TSS
XOR EAX,EAX ;ErcOk
NTEnd:
STI ;
MOV ESP,EBP ;
POP EBP ;
RETF 28 ;
;====================================================================
; SpawnTask --- OS PUBLIC - Creates a new task in the current job
; and schedules it for execution
;
; Procedural Interface:
; SpawnTask(pEntry, dPriority, fDebug, pStack, fOSCode);
;
;
pEntryST EQU DWORD PTR [EBP+28]
dPriST EQU DWORD PTR [EBP+24]
fDebugST EQU DWORD PTR [EBP+20]
pStackST EQU DWORD PTR [EBP+16]
fOSCodeST EQU DWORD PTR [EBP+12]
NewExchST EQU DWORD PTR [EBP-4]
NewTSSST EQU DWORD PTR [EBP-8]
PUBLIC __SpawnTask: ;
PUSH EBP ;
MOV EBP,ESP ;
SUB ESP, 8 ;two local DWORD vars
CMP dPriST, nPRI-1 ;Priority OK?
JBE ST0001
MOV EAX,ercBadPriority
JMP STEnd
ST0001:
LEA EAX, NewExchST ;Allocate exchange
PUSH EAX
CALL FWORD PTR _AllocExch
OR EAX, EAX ;see if we got an error
JNZ STEnd ;Yup, bad news
;Allocate a new TSS
CLI ;we can't be interrupted
MOV EAX,pFreeTSS ; NewTSS <= pFreeTSS;
OR EAX,EAX ; IF pFreeTSS=NIL THEN Return;
JNZ ST0002 ;
STI
;Dealloc Exch if we didn't get a TSS
PUSH NewExchST
CALL FWORD PTR _DeAllocExch
MOV EAX,ercNoMoreTSSs ;No...
JMP NTEnd
ST0002:
MOV EBX,[EAX+NextTSS] ; pFreeTSS <= pFreeTSS^.Next
MOV pFreeTSS,EBX ;
DEC _nTSSLeft ;
STI
MOV NewTSSST, EAX ;Save new TSS
MOV EBX, NewExchST ;mov exch into TSS
MOV [EAX+TSS_Exch],EBX
MOV WORD PTR [EAX+TSS_CS], OSCodeSel ;Defaults to OS code selector
CMP fOSCodeST, 0
JNE ST0003
MOV WORD PTR [EAX+TSS_CS], JobCodeSel ;Make OS code selector
ST0003:
MOV EBX,pEntryST ;mov EIP into TSS
MOV [EAX+TSS_EIP],EBX
MOV EBX, pStackST ;mov ESP into TSS
MOV [EAX+TSS_ESP],EBX
MOV [EAX+TSS_ESP0],EBX
MOV EBX, pRunTSS
MOV EDX, [EBX+TSS_pJCB] ;Get pJCB from Crnt Task
MOV [EAX+TSS_pJCB],EDX
MOV EDX, [EBX+TSS_CR3] ;Get CR3 from crnt task
MOV [EAX+TSS_CR3],EDX ; move into new TSS
MOV DWORD PTR [EAX+TSS_EFlags],0202h ;Load the Flags Register
CMP fDebugST, 0 ;Debug on entry?
JE ST0004 ;No
MOV WORD PTR [EAX+TSS_TrapBit], 1 ;Yes
ST0004:
MOV EBX, dPriST ;mov priority into BL
MOV [EAX+Priority],BL ;put in TSS
CLI ;we can't be interrupted
MOV EDX,pRunTSS ;Get who's running
CMP [EDX+Priority],BL ;Who got the highest Pri?
JA ST0005 ;If crnt >, New guy does (lowest num)
CALL enQueueRdy ;Old guy does, just put new guy on Q.
XOR EAX,EAX ;ercOk
JMP STEnd ;Return to caller
ST0005:
XCHG EAX,EDX ;CrntTSS -> EAX, New TSS -> EDX
PUSH EDX ;New TSS -> Stack
CALL enQueueRdy ;Place crnt TSS on Q
POP EAX ;New TSS -> EAX
MOV pRunTSS,EAX ;Move new TSS into pRunTSS
MOV BX,[EAX+Tid] ;Put Selector/Offset in "TSS"
MOV TSS_Sel,BX ;
INC _nSwitches
MOV EAX, TimerTick ;Save time of this switch for scheduler
MOV SwitchTick, EAX ;
JMP FWORD PTR [TSS] ;Jump to new TSS
XOR EAX,EAX ;ErcOk
STEnd:
STI ;
MOV ESP,EBP ;
POP EBP ;
RETF 20 ;
;=============================================================================
;
; AllocExch - The kernel Allocate Exchange primitive. This procedure
; provides access to the operating system by allowing a TASK to
; allocate a message port for the transmission and reception of messages from
; another process.
;
; Procedural Interface :
;
; AllocExch(pExchRet):dError
;
; pExchRet is a pointer to where you want the Exchange Handle
; returned. The Exchange Handle is a DWORD (4 BYTES).
;
;=============================================================================
PUBLIC __AllocExch: ;
PUSH EBP ;
MOV EBP,ESP ;
XOR ESI,ESI ; Zero the Exch Index
MOV EBX,prgExch ; EBX <= ADR rgExch
MOV ECX,nExch ; Get number of exchanges in ECX
AE000:
CLI ;
CMP DWORD PTR [EBX+Owner], 0 ; Is this exchange free to use
JE AE001 ; If we found a Free Exch, JUMP
ADD EBX,sEXCH ; Point to the next Exchange
INC ESI ; Increment the Exchange Index
LOOP AE000 ; Keep looping until we are done
STI ;
MOV EAX,ercNoMoreExch ; There are no instances of the Exch
MOV ESP,EBP ;
POP EBP ;
RETF 4 ;
AE001:
MOV EDX,[EBP+0CH] ; Get the pExchRet in EDX
MOV [EDX],ESI ; Put Index of Exch at pExchRet
MOV EDX,pRunTSS ; Get pRunTSS in EDX
MOV EAX,[EDX+TSS_pJCB] ; Get the pJCB in EAX
MOV [EBX+Owner],EAX ; Make the Exch owner the Job
STI ;
MOV DWORD PTR [EBX+EHead],0 ; Make the msg/TSS queue NIL
MOV DWORD PTR [EBX+ETail],0 ;
DEC _nEXCHLeft ; Stats
XOR EAX,EAX ;ercOK (0)
MOV ESP,EBP ;
POP EBP ;
RETF 4 ;
;=============================================================================
;
; DeAllocExch - The kernel DeAllocate Exchange primitive. It allows a TASK
; to deallocate a "message port." It also deQueues any messages, and frees
; up any Link Blocks, TSSs, and RQBs, attached to the exchange
;
; Procedural Interface :
;
; DeAllocExch(Exch):ercType
;
; Exch is the Exchange Handle the process is asking to be released.
PUBLIC __DeAllocExch: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV ESI,[EBP+0CH] ; Load the Exchange Index in ESI
MOV EAX,ESI ; Get the Exchange Index in EAX
MOV EDX,sEXCH ; Compute offset of Exch in rgExch
MUL EDX ;
MOV EDX,prgExch ; Add offset of rgExch => EAX
ADD EAX,EDX ;
MOV ECX,EAX ; Make a copy in ECX (ECX = pExch)
MOV EDX,pRunTSS ; Get the pRunTSS in EDX
MOV EBX,[EDX+TSS_pJCB] ; Get pJCB in EBX
MOV EDX,[EAX+Owner] ; Get the Exchange Owner in EDX
CMP EBX,EDX ; If the CurrProc owns the Exchange,
JE DE000 ; yes
CMP EBX, OFFSET MonJCB ; if not owner, is this the OS???
JE DE000 ; yes
MOV EAX,ercNotOwner ;
MOV ESP,EBP ;
POP EBP ;
RETF 4 ;
DE000:
CLI ;
CMP DWORD PTR [ECX+fEMsg],0 ; See if a message may be queued
JE DE001 ; No. Go check for Task (TSS)
MOV ESI, ECX ; ESI must point to Exch for deQueue
CALL deQueueMsg ; Yes, Get the message off of the Exchange
OR EAX, EAX
JZ DE002 ; Nothing there. Go free the Exch.
;Return the LB to the pool
MOV EBX,pFreeLB ; pLBin^.Next <= pFreeLB;
MOV [EAX+NextLB],EBX ;
MOV pFreeLB,EAX ; pFreeLB <= pLBin;
INC _nLBLeft ;
JMP DE000 ; Go And Check for more.
; If we find an RqBlk on the exchange we must respond
;with ErcInvalidExch before we continue! This will
;only happen if a system service writer doesn't follow
;instructions or a service crashes!
;
DE001:
CMP DWORD PTR [ECX+EHead], 0 ; Check to See if TSS is queued
JE DE002 ; NIL = Empty, JUMP
MOV ESI, ECX ; ESI must point to Exch for deQueue
CALL deQueueTSS ; Get the TSS off of the Exchange
;Free up the TSS (add it to the free list)
MOV EBX,pFreeTSS ; pTSSin^.Next <= pFreeTSS;
MOV [EAX+NextTSS],EBX ;
MOV DWORD PTR [EAX+TSS_pJCB], 0 ; Make TSS invalid
MOV pFreeTSS,EAX ; pFreeTSS <= pTSSin;
INC _nTSSLeft ;
JMP DE001 ; Go And Check for more.
DE002:
MOV DWORD PTR [ECX+Owner], 0 ; Free up the exchange.
MOV DWORD PTR [ECX+fEMsg], 0 ; Reset msg Flag.
INC _nEXCHLeft ; Stats
STI ;
XOR EAX,EAX ;ercOK (0)
MOV ESP,EBP ;
POP EBP ;
RETF 4 ;
;=============================================================================
;
; GetTSSExch - This returns the Exchange of the current TSS to the
; caller. This is primarily provided for System Services that provide
; direct access blocking calls for customers.
;
; Procedural Interface :
;
; GetTSSExch(pExchRet):dError
;
; pExchRet is a pointer to where you want the Exchange Handle
; returned. The Exchange is a DWORD (4 BYTES).
;
PUBLIC __GetTSSExch: ;
PUSH EBP ;
MOV EBP,ESP ;
MOV EAX,pRunTSS ; Get the Ptr To the Running TSS
MOV ESI,[EBP+0CH] ; Get the pExchRet in EDX
MOV EBX, [EAX+TSS_Exch] ; Get Exch in EBX
MOV [ESI],EBX ; Put Index of Exch at pExchRet
XOR EAX, EAX ; ErcOK
POP EBP ;
RETF 4 ;
;=============================================================================
;
; SetPriority - This sets the priority of the task that called it
; to the priority specified in the single parameter.
;
; Procedural Interface :
;
; SetPriority(bPriority):dError
;
; bPriority is a byte with the new priority.
;
PUBLIC __SetPriority ;
PUSH EBP ;
MOV EBP,ESP ;
MOV EAX,pRunTSS ; Get the Ptr To the Running TSS
MOV EBX,[EBP+0CH] ; Get the new pri into EBX
AND EBX, 01Fh ; Nothing higher than 31!
MOV BYTE PTR [EAX+Priority], BL ;Put it in the TSS
XOR EAX, EAX ; ErcOK - No error.
POP EBP ;
RETF 4 ;
;=============================================================================
;
; GetPriority - This gets the priority of the task that called it
; and passes it to bPriorityRet.
;
; Procedural Interface :
;
; SetPriority(bPriorityRet):dError
;
; bPriorityret is a pointer to a byte where you want the
; priority returned.
;
PUBLIC __GetPriority ;
PUSH EBP ;
MOV EBP,ESP ;
MOV EAX,pRunTSS ; Get the Ptr To the Running TSS
MOV EBX,[EBP+0CH] ; Get the return pointer into EBX
MOV DL, BYTE PTR [EAX+Priority]
MOV BYTE PTR [EBX], DL ;
XOR EAX, EAX ; ErcOK - No error.
POP EBP ;
RETF 4 ;
;======================== End of Module ======================
| 35.675705 | 79 | 0.566868 |
de42c6d04c928f213482f566f697c451f881549a | 867 | asm | Assembly | programs/oeis/256/A256648.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/256/A256648.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/256/A256648.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A256648: 28-gonal pyramidal numbers: a(n) = n*(n+1)*(26*n-23)/6.
; 0,1,29,110,270,535,931,1484,2220,3165,4345,5786,7514,9555,11935,14680,17816,21369,25365,29830,34790,40271,46299,52900,60100,67925,76401,85554,95410,105995,117335,129456,142384,156145,170765,186270,202686,220039,238355,257660,277980,299341,321769,345290,369930,395715,422671,450824,480200,510825,542725,575926,610454,646335,683595,722260,762356,803909,846945,891490,937570,985211,1034439,1085280,1137760,1191905,1247741,1305294,1364590,1425655,1488515,1553196,1619724,1688125,1758425,1830650,1904826,1980979,2059135,2139320,2221560,2305881,2392309,2480870,2571590,2664495,2759611,2856964,2956580,3058485,3162705,3269266,3378194,3489515,3603255,3719440,3838096,3959249,4082925,4209150
lpb $0
mov $2,$0
sub $0,1
seq $2,161935 ; 28-gonal numbers: a(n) = n*(13*n - 12).
add $1,$2
lpe
mov $0,$1
| 78.818182 | 684 | 0.787774 |
b5f63058eb3495ae2e6cf49bb7df6f4b71e3f65e | 951 | asm | Assembly | release/runningsum.asm | JonathanUhler/MC-asm | 85ec4707909aed116bfeabd77385a32c4ee4ffd2 | [
"MIT"
] | 1 | 2020-11-10T02:55:35.000Z | 2020-11-10T02:55:35.000Z | release/runningsum.asm | JonathanUhler/MC-asm | 85ec4707909aed116bfeabd77385a32c4ee4ffd2 | [
"MIT"
] | 5 | 2020-11-23T06:48:44.000Z | 2021-01-21T15:32:41.000Z | release/runningsum.asm | JonathanUhler/Minecraft-Assembler | 19968b5db17527289739f602115927e6a7b27669 | [
"MIT"
] | null | null | null | // Small program to do the following:
//
// var sum = 0
// for i in 1..20 {
// sum += i
// }
// if sum == 210 {
// halt 0
// } else {
// halt 1
// }
// There is a bug in the simulator that causes the first instruction to be stepped
// on, so make it a nop
nop
// Register allocation:
//
// r1: sum
// r2: i
// r3, r4: working registers
// .pragma imm dec
li r1, 0 // var sum = 0
li r2, 1 // var i = 1
loop: add r1, r1, r2 // sum += i
cmpi r3, r2, 20 // Is i == 20?
brz r3, loop // Branch back to the start of the loop if not
addi r2, r2, 1 // Increment i in the delay slot
// Here at the end of the loop. Check for expected value
nop
cmpi r3, r1, 210 // Is sum == 1+2+...+20 = 210?
brz r3, bad // Branch if not
nop
halt 0 // Halt 0 is the success code
nop
.loc 0x40
bad: halt 1 // Halt 1 is the failure code
| 21.613636 | 83 | 0.520505 |
d0538b76d31d5cc35f2039726d6d5bfecb6889fa | 8,238 | asm | Assembly | text-editor-main.asm | Roduan-kareem-aldeen/asm-text-editor | bb85f82a98664d3a43b9d60c7a22d84a8a00cae7 | [
"Unlicense"
] | 1 | 2019-05-22T20:24:01.000Z | 2019-05-22T20:24:01.000Z | text-editor-main.asm | RoduanKD/asm-text-editor | bb85f82a98664d3a43b9d60c7a22d84a8a00cae7 | [
"Unlicense"
] | null | null | null | text-editor-main.asm | RoduanKD/asm-text-editor | bb85f82a98664d3a43b9d60c7a22d84a8a00cae7 | [
"Unlicense"
] | 1 | 2018-04-24T20:06:18.000Z | 2018-04-24T20:06:18.000Z | ;;=============================================================================;;
;; ;;
;; Assembly Text Editor ;;
;; ;;
;; ;;
;; ;;
;; By Roduan Kareem Aldeen & Abdullhafiez Faraj ;;
;; ;;
;; ;;
;;=============================================================================;;
.stack 100h
.data
posX db 1 dup(0) ; dh = posX -> controls row
posY db 1 dup(0) ; dl = posY -> controls column
matrix db 80*25 dup(' ') ; 25 lines of 80 chars each.
curr_line dw ?
curr_char dw ?
color db 2*16+15
;FOR COLORS USE NEXT TABLE:
;http://stackoverflow.com/questions/29460318/how-to-print-colored-string-in-assembly-language/29478158#29478158
filename db "C:/file.txt",0
handler dw ?
length dw dup(0)
start_menu_str dw ' ',0ah,0dh
dw ' ',0ah,0dh
dw ' ',0ah,0dh
dw ' ',0ah,0dh
dw ' ====================================================',0ah,0dh
dw ' || ||',0ah,0dh
dw ' || * Assembly Text Editor * ||',0ah,0dh
dw ' || ||',0ah,0dh
dw ' ||--------------------------------------------------||',0ah,0dh
dw ' || ||',0ah,0dh
dw ' || ||',0ah,0dh
dw ' || ||',0ah,0dh
dw ' || Type in what you want, press ESC ||',0ah,0dh
dw ' || To exit the program. ||',0ah,0dh
dw ' || ||',0ah,0dh
dw ' || Press Enter to start ||',0ah,0dh
dw ' || ||',0ah,0dh
dw ' || ||',0ah,0dh
dw ' ====================================================',0ah,0dh
dw '$',0ah,0dh
.code
;INITIALIZE DATA SEGMENT.
mov ax,@data
mov ds,ax
call main_menu ;Print the main menu
start_prog:
call clear_screen
jmp program
program: ; Initalize the variables
mov curr_line, offset matrix
mov curr_char, 0
start:
call read_char
;;--------------------------------------------------------------------;;
;; ;;
;; Keys Listeners ;;
;; ;;
;;____________________________________________________________________;;
;DISPLAY LETTER, DIGIT OR ANY OTHER ACCEPTABLE CHAR.
any_char:
mov ah, 9
mov bh, 0
mov bl, color
mov cx, 1 ; how many times display char.
int 10h ; display char in al.
;UPDATE CHAR IN MATRIX.
mov si, curr_line ; si points to the beginning of the line.
add si, curr_char ; si points to the char in the line.
mov [ si ], al ; the char is in the matrix.
inc length ; count the number of chars
;!!! EXTREMELY IMPORTANT : PREVIOUS BLOCK DISPLAYS ONE
;CHAR, AND NEXT BLOCK MOVES CURSOR TO THE RIGHT. THAT'S
;THE NORMAL BEHAVIOR FOR ALL EDITORS. DO NOT MOVE THESE
;TWO BLOCKS, THEY MUST BE THIS WAY. IF IT'S NECESSARY
;TO MOVE THEM, ADD A JUMP FROM ONE BLOCK TO THE OTHER.
;RIGHT.
moveRight:
inc curr_char ; update current char.
mov dl, posX
mov dh, posY
inc dl ; posX ++
mov posX, dl
jmp prntCrs
;LEFT.
moveLeft:
dec curr_char ; update current char.
mov dl, posX
mov dh, posY
dec dl ; posX --
mov posX, dl
jmp prntCrs
;UP.
moveUp:
sub curr_line, 80 ; update current line.
mov dl, posX
mov dh, posY
dec dh ; posY --
mov posY, dh
jmp prntCrs ; print cursor
;DOWN.
moveDown:
add curr_line, 80 ; update current line.
mov dl, posX
mov dh, posY
inc dh ; posY ++
mov posY, dh
jmp prntCrs
;ENTER.
moveNewLine:
mov si, curr_line
add si, 79
mov [si], 0dh
add curr_line, 80
mov curr_char, 0
mov posX, 0
mov dl, posX
mov dh, posY
inc dh
mov posY, dh
add length, 80
jmp prntCrs
;HOME
moveToBeginning:
mov curr_char, 0
mov posX, 0
mov dl, posX
jmp prntCrs
backSpace:
;check if this is the first char in the line
cmp curr_char, 0
je preventBackSpace
;UPDATE CHAR IN MATRIX.
dec curr_char
mov si, curr_line ; si points to the beginning of the line.
add si, curr_char ; si points to the char in the line.
mov [ si ], ' ' ; the char is in the matrix.
dec length ; count the number of chars
dec posX
mov dl, posX
;Move the cursor
mov ah, 2h
int 10h
;Update the Screen
mov al,' '
mov ah, 9
mov bh, 0
mov bl, 0000
mov cx, 1 ; how many times display char.
int 10h ; display char in al.
jmp prntCrs
prntCrs: ; print cursor
mov ah, 2h
int 10h
jmp start ; Go back to the beginning
fin:
int 20h
saveToFile:
;CREATE FILE.
mov ah, 3ch
mov cx, 0
mov dx, offset filename
int 21h
;PRESERVE FILE HANDLER RETURNED.
mov handler, ax
;WRITE STRING.
mov ah, 40h
mov bx, handler
mov cx, length ;STRING LENGTH.
mov dx, offset matrix
int 21h
;CLOSE FILE (OR DATA WILL BE LOST).
mov ah, 3eh
mov bx, handler
int 21h
jmp fin
preventBackSpace:
call read_char
;;--------------------------------------------------------------------;;
;; ;;
;; Clear the sceen ;;
;; Just set new text mood for avoiding complexicity ;;
;; ;;
;;____________________________________________________________________;;
clear_screen proc near
mov ah,0 ;graphics mode
mov al,3 ;
int 10h
ret
clear_screen endp
main_menu proc
mov ah,09h
mov dh,0
mov dx, offset start_menu_str
int 21h
input: ;wait for ENTER KEY.
mov ah, 0
int 16h
cmp al, 27 ; ESC
je fin
cmp ax, 1C0Dh ; ENTER.
je start_prog
jmp input
main_menu endp
read_char proc
;CAPTURE KEY.
mov ah, 0
int 16h
;EVALUATE KEY.
cmp al, 27 ; ESC
je fin
cmp ax, 4800h ; UP.
je moveUp
cmp ax, 4B00h ; LEFT.
je moveLeft
cmp ax, 4D00H ; RIGHT.
je moveRight
cmp ax, 5000h ; DOWN.
je moveDown
cmp ax, 1C0Dh ; ENTER.
je moveNewLine
cmp ax, 4700h ; HOME.
je moveToBeginning
cmp ax, 3F00h ; F5.
je saveToFile
cmp ax, 0E08h ; BackSpace.
je backSpace
cmp al, 32
jae any_char
jmp start
read_char endp
get_file_location_from_user proc
ret
get_file_location_from_user endp
| 30.065693 | 123 | 0.406167 |
f09a4e75793232deb1e56b167944ab79e6866e3b | 6,008 | asm | Assembly | Transynther/x86/_processed/US/_st_zr_un_sm_/i3-7100_9_0x84_notsx.log_21829_2018.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_st_zr_un_sm_/i3-7100_9_0x84_notsx.log_21829_2018.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_st_zr_un_sm_/i3-7100_9_0x84_notsx.log_21829_2018.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x167aa, %rsi
lea addresses_D_ht+0xc632, %rdi
nop
nop
xor %rbp, %rbp
mov $36, %rcx
rep movsb
nop
nop
nop
cmp %rax, %rax
lea addresses_UC_ht+0xcce2, %rbx
nop
nop
cmp %r10, %r10
movw $0x6162, (%rbx)
cmp $15450, %rbp
lea addresses_UC_ht+0x122b8, %rsi
lea addresses_UC_ht+0x8052, %rdi
nop
nop
nop
cmp %rbp, %rbp
mov $35, %rcx
rep movsw
add %rbp, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0x11eb2, %r12
nop
nop
nop
nop
nop
sub $47620, %r13
movb $0x51, (%r12)
and %r13, %r13
// REPMOV
lea addresses_WC+0x18632, %rsi
lea addresses_D+0x13232, %rdi
nop
nop
nop
nop
cmp $45933, %rbp
mov $47, %rcx
rep movsw
nop
nop
nop
nop
and %rbx, %rbx
// Load
lea addresses_RW+0x123e2, %rdi
nop
sub $7300, %r15
mov (%rdi), %rsi
nop
nop
nop
nop
nop
cmp $60028, %rbp
// Store
mov $0x53023b0000000b92, %rcx
nop
nop
nop
nop
nop
cmp %rdi, %rdi
mov $0x5152535455565758, %rsi
movq %rsi, (%rcx)
nop
nop
nop
cmp $56745, %r13
// Store
lea addresses_US+0x1b232, %rcx
nop
nop
sub $11579, %rbx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
movups %xmm2, (%rcx)
nop
nop
nop
xor %rdi, %rdi
// Faulty Load
lea addresses_US+0x1b232, %r12
sub %rdi, %rdi
mov (%r12), %r13w
lea oracles, %rsi
and $0xff, %r13
shlq $12, %r13
mov (%rsi,%r13,1), %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'same': False, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_RW', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_US', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'70': 2, '00': 8, '58': 21816, '38': 1, '08': 2}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 37.786164 | 2,999 | 0.654294 |
1b5fcd649e94f152f24731b6b47e5717ce4feea2 | 3,766 | asm | Assembly | kernel/gui/canvas.asm | ssebs/xos | 8c50cb7753690ad67696131a8b9935947e1a8075 | [
"MIT"
] | 15 | 2020-05-02T22:04:24.000Z | 2021-08-31T16:56:59.000Z | kernel/gui/canvas.asm | JamesLinus/xos | 3fba0cb15e84b5f7cd08e0a29ed5f86087192d2e | [
"MIT"
] | null | null | null | kernel/gui/canvas.asm | JamesLinus/xos | 3fba0cb15e84b5f7cd08e0a29ed5f86087192d2e | [
"MIT"
] | 1 | 2019-07-20T10:10:36.000Z | 2019-07-20T10:10:36.000Z |
;; xOS32
;; Copyright (C) 2016-2017 by Omar Mohammad.
use32
; wm_pixel_offset:
; Returns pixel offset within window canvas
; In\ EAX = Window handle
; In\ CX/DX = X/Y pos within the window
; Out\ EAX = Pixel offset, -1 on error
align 32
wm_pixel_offset:
mov [.x], cx
mov [.y], dx
call wm_get_window
jc .error
cmp [.x], si
jge .error
cmp [.y], di
jge .error
and esi, 0xFFFF ; window width
shl esi, 2 ; a canvas always uses 32bpp regardless of the physical video mode
;mov ebx, esi
movzx eax, [.y]
mul esi
movzx ebx, [.x]
shl ebx, 2
add eax, ebx
add eax, ecx ; ecx = framebuffer address
ret
.error:
mov eax, -1
ret
align 2
.x dw 0
.y dw 0
; wm_read_mouse:
; Reads the mouse position according to the window position
; In\ EAX = Window handle
; Out\ BL = Scrollwheel displacement
; Out\ CX/DX = X/Y pos, 0 on error
align 32
wm_read_mouse:
call wm_get_window
jc .error
test dx, WM_NO_FRAME
jnz .frameless
test dx, WM_TRANSPARENT
jnz .frameless
mov ecx, [mouse_x]
mov edx, [mouse_y]
sub cx, ax
sub dx, bx
sub cx, [window_canvas_x]
sub dx, [window_canvas_y]
.finish:
mov bl, [mouse_packet.scroll]
test cx, 0x8000
jnz .error
test dx, 0x8000
jnz .error
ret
.frameless:
mov ecx, [mouse_x]
mov edx, [mouse_y]
sub cx, ax
sub dx, bx
jmp .finish
.error:
xor cx, cx
xor dx, dx
ret
; wm_clear:
; Clears the window canvas
; In\ EAX = Window handle
; In\ EBX = Color
; Out\ Nothing
align 32
wm_clear:
cli
mov [.color], ebx
call wm_get_window
jc .done
mov [.canvas], ecx ; ecx = base of window canvas
movzx eax, si
movzx ebx, di
mul ebx
mov ecx, eax ; ecx = size of canvas in pixels
mov edi, [.canvas]
mov eax, [.color]
rep stosd
.done:
;mov [wm_dirty], 1
;call wm_redraw
ret
align 4
.color dd 0
.canvas dd 0
; wm_render_char:
; Renders a character using the default system font
; In\ EAX = Window handle
; In\ BL = Character
; In\ CX/DX = X/Y pos
; In\ ESI = Color
; Out\ Nothing
align 32
wm_render_char:
cli
and esi, 0xFFFFFF
mov [.fg], esi
mov [.handle], eax
and ebx, 0xFF
shl ebx, 4
add ebx, [system_font]
mov [.font_data], ebx
mov eax, [.handle]
call wm_pixel_offset
cmp eax, -1
je .done
mov [.offset], eax
mov eax, [.handle]
call wm_get_window
jc .done
and esi, 0xFFFF
shl esi, 2 ; mul 4
mov [.line], esi ; bytes per line
mov [.column], 0
mov [.row], 0
mov esi, [.font_data]
mov dl, [esi]
inc [.font_data]
mov edi, [.offset]
.put_column:
test dl, 0x80
jz .background
.foreground:
mov eax, [.fg]
stosd
jmp .next_column
.background:
add edi, 4
.next_column:
inc [.column]
cmp [.column], 8
je .next_row
shl dl, 1
jmp .put_column
.next_row:
inc [.row]
cmp [.row], 16
je .done
mov esi, [.font_data]
mov dl, [esi]
inc [.font_data]
mov edi, [.line]
add [.offset], edi
mov edi, [.offset]
jmp .put_column
.done:
ret
align 4
.font_data dd 0
.offset dd 0
.column db 0
.row db 0
align 4
.fg dd 0
.handle dd 0
.line dd 0
; wm_draw_text:
; Draws text using the default system font
; In\ EAX = Window Handle
; In\ ESI = Pointer to null terminated string
; In\ CX/DX = X/Y pos
; In\ EBX = Color
; Out\ Nothing
align 32
wm_draw_text:
cli
mov [.handle], eax
mov [.x], cx
mov [.y], dx
mov [.ox], cx
mov [.oy], dx
mov [.color], ebx
.loop:
lodsb
or al, al
jz .done
cmp al, 13
je .carriage
cmp al, 10
je .newline
push esi
mov bl, al ; bl = char
mov eax, [.handle]
mov cx, [.x]
mov dx, [.y]
mov esi, [.color]
call wm_render_char
pop esi
add [.x], 8
jmp .loop
.carriage:
mov ax, [.ox]
mov [.x], ax
jmp .loop
.newline:
mov ax, [.ox]
mov [.x], ax
add [.y], 16
jmp .loop
.done:
;call wm_redraw
ret
align 4
.handle dd 0
.x dw 0
.y dw 0
.ox dw 0
.oy dw 0
align 4
.color dd 0
| 13.644928 | 79 | 0.644716 |
ae94a056bf928963453df84ed8020ec76581aca7 | 540 | asm | Assembly | libsrc/enterprise/exos_open_channel.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 38 | 2021-06-18T12:56:15.000Z | 2022-03-12T20:38:40.000Z | libsrc/enterprise/exos_open_channel.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 2 | 2021-06-20T16:28:12.000Z | 2021-11-17T21:33:56.000Z | libsrc/enterprise/exos_open_channel.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 6 | 2021-06-18T18:18:36.000Z | 2021-12-22T08:01:32.000Z | ;
; Enterprise 64/128 specific routines
; by Stefano Bodrato, 2011
;
; exos_open_channel(unsigned char ch_number, char *device);
;
;
; $Id: exos_open_channel.asm,v 1.4 2016-06-19 20:17:32 dom Exp $
;
SECTION code_clib
PUBLIC exos_open_channel
PUBLIC _exos_open_channel
EXTERN exos_open_channel_callee
EXTERN ASMDISP_EXOS_OPEN_CHANNEL_CALLEE
exos_open_channel:
_exos_open_channel:
pop bc
pop de
pop hl
push hl
push de
push bc
jp exos_open_channel_callee + ASMDISP_EXOS_OPEN_CHANNEL_CALLEE
| 17.419355 | 65 | 0.742593 |
42de44381a894010c0438c1bd791d5c7a3e1780a | 581 | asm | Assembly | oeis/199/A199488.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/199/A199488.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/199/A199488.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A199488: 10*7^n+1.
; 11,71,491,3431,24011,168071,1176491,8235431,57648011,403536071,2824752491,19773267431,138412872011,968890104071,6782230728491,47475615099431,332329305696011,2326305139872071,16284135979104491,113988951853731431,797922662976120011,5585458640832840071,39098210485829880491,273687473400809163431,1915812313805664144011,13410686196639649008071,93874803376477543056491,657123623635342801395431,4599865365447399609768011,32199057558131797268376071,225393402906922580878632491,1577753820348458066150427431
mov $1,7
pow $1,$0
sub $1,1
mul $1,10
add $1,11
mov $0,$1
| 58.1 | 500 | 0.879518 |
6e429ea3f4c4f27d97dfc5290d09d81c84d37f14 | 8,676 | asm | Assembly | Tests/base/Copper/Main.asm | ped7g/ZXSpectrumNextTests | 3a3082cf3b2b17e1d9cd4f1d5c71934a2c3ce862 | [
"MIT"
] | 3 | 2018-12-29T16:02:49.000Z | 2020-01-30T06:41:37.000Z | Tests/base/Copper/Main.asm | ped7g/ZXSpectrumNextTests | 3a3082cf3b2b17e1d9cd4f1d5c71934a2c3ce862 | [
"MIT"
] | null | null | null | Tests/base/Copper/Main.asm | ped7g/ZXSpectrumNextTests | 3a3082cf3b2b17e1d9cd4f1d5c71934a2c3ce862 | [
"MIT"
] | null | null | null | device zxspectrum48
org $8000
INCLUDE "../../Constants.asm"
INCLUDE "../../TestFunctions.asm"
INCLUDE "../../OutputFunctions.asm"
LegendText:
db 'Copper draws Swedish flags',0
db 'by PAPER/BORDER 7 colour change.',0
db 'Flags 16x10 at: [1,64] below ...',0
db '[242,118] above ... and more :)',0
CopperBytesTxt:
db 'Copper ins. (max 0400): ',0
FlagData:
db %00000110,%00000000 ; 5:2:9 - blue, yellow, blue
db %00000110,%00000000
db %00000110,%00000000
db %00000110,%00000000
db %11111111,%11111111 ; lines are 4:2:4, middle is full yellow
db %11111111,%11111111
db %00000110,%00000000
db %00000110,%00000000
db %00000110,%00000000
db %00000110,%00000000
; 8 bit colour definitions
C_BLACK equ $00
C_WHITE equ $B6
C_BLUE equ $0E
C_YELLOW equ $F8
; does use A and B registers (A stays set to value)
MACRO NEXTREG register, value
; implemented by Z80 instructions only, and using I/O port (intentionally)
ld b,register
ld a,value
call WriteNextRegByIo
ENDM
Start:
call StartTest
; show MachineID and core version
ld de,MEM_ZX_SCREEN_4000
ld bc,MEM_ZX_SCREEN_4000+1*32
ld ix,$ED01 ; display also extended info after MachineId
call OutMachineIdAndCore_defLabels
; 03:05:06:08
; David's board 18.1.: 33:43:C8:38
ld hl,LegendText
ld de,MEM_ZX_SCREEN_4000+2*32
call OutStringAtDe
ld de,MEM_ZX_SCREEN_4000+3*32
call OutStringAtDe
ld de,MEM_ZX_SCREEN_4000+5*32
call OutStringAtDe
ld de,MEM_ZX_SCREEN_4000+6*32
call OutStringAtDe
; Draw dots for "rulers" to judge Copper precision
ld bc,$0801
ld hl,MEM_ZX_SCREEN_4000+8*256-32 ; ABOVE beginning of second VRAM third
ld d,$88
call FillSomeUlaLines
ld bc,$0801
ld hl,MEM_ZX_SCREEN_4000+16*256+32-8 ; BELOW end of second VRAM third
call FillSomeUlaLines
; set up ULANext mode and reset palette (BORDER is already 7 from StartTest)
; auto-increment OFF, select first ULA palette, UlaNext ON
NEXTREG PALETTE_CONTROL_NR_43, %10000001
; INK-mask 7 (will turn default attribute $38 into PAPER 7: INK 0)
NEXTREG PALETTE_FORMAT_NR_42, %00000111
; INK 0 - black
NEXTREG PALETTE_INDEX_NR_40, 0
NEXTREG PALETTE_VALUE_NR_41, C_BLACK
; PAPER/BORDER 7 = ULA.white
NEXTREG PALETTE_INDEX_NR_40, 128+7 ; index PAPER 7
NEXTREG PALETTE_VALUE_NR_41, C_WHITE
; PALETTE_INDEX_NR_40 is still set to 128+7 (!)
; and should stay that way for whole test (if auto-increment OFF works)
; set up Copper control to "stop" + index 0
NEXTREG COPPER_CONTROL_LO_NR_61, 0
NEXTREG COPPER_CONTROL_HI_NR_62, 0 ; full stop + index zero
; set up Copper data - set the TBBlue I/O port to COPPER_DATA_NR_60
ld bc,TBBLUE_REGISTER_SELECT_P_243B
ld a,COPPER_DATA_NR_60
out (c),a
inc b ; BC = TBBLUE_REGISTER_ACCESS_P_253B
; total instructions counter (should be not more than 1024!)
push iy
ld iy,0 ; count total instructions
; now fill up the flag-drawing instructions (5 flags ~= 990 instructions (!))
ld de,$0140 ; [1,64] ; this one should be +1px off from ruler to right
call UploadFlagAtDe
ld de,$434D ; [67,77] ; move this to 64 in case you need to release few ins.
call UploadFlagAtDe
; do one flag partly over right border
ld de,$F85B ; [248,91]
call UploadFlagAtDe
; do one flag over left border (skip DE coordinates calculation)
ld h,COPPER_WAIT + ($34<<1) ; x-compare 52 = 416px pos = somewhere in left border
ld l,1 ; don't do NOOP after wait at all
ld e,$68 ; y: 104
call UploadFlag
; last flag right over the drawn dots
ld de,$F276 ; [242,118] ; this one should be +2px off from ruler to right
call UploadFlagAtDe
; add HALT at the end of everything (will wait until the frame [0,0] restarts copper)
ld a,COPPER_HALT
out (c),a
out (c),a
inc iy ; count total instructions
; start Copper
ld b,COPPER_CONTROL_HI_NR_62
ld a,%11000000 ; reset PC + start, reset on every frame [0,0]
call WriteNextRegByIo
; Output total amount of copper instructions used
ld de,MEM_ZX_SCREEN_4000+16*256+7*32
ld hl,CopperBytesTxt
call OutStringAtDe
push iy
pop hl
ld a,h
call OutHexaValue
ld a,l
call OutHexaValue
pop iy
; finish the test (the screen is updated automatically by Copper, no CPU work needed)
call EndTest
; swedish flag: dimensions 5:2:9 horizontally, 4:2:4 vertically, proportion 5:8
; Googling for official colours in sRGB turned out to be lot more fun than I expected.
; Settling for (yellow) RGB(249, 205, 48) and (blue) RGB(22, 101, 161) in the end.
; Converting to ZXN display capabilities that will do 16x10 pixels (1px per ratio pt)
; yellow (7.7,6.4,1.5) = %111110001 and requires 9 bit definition ($F8 8b used :/ )
; blue (0.7,3.2,5.0) = %000011101 (will work as $0E 8 bit definition)
; copper code, does for every line of flag:
; * single wait instruction
; * then 2xNOOP are injected for every pixel position to be skipped
; * then 16x move instructions selecting blue or yellow colour are inserted (16 pixels)
; * then 1x move instruction selecting white colour is inserted (rest of line is white)
; Each flag has 10 lines = 180 instructions at least
; plus extra 20 NOOPs * (X-coordinate MOD 8) (WAIT can target only char positions)
; - it would be possible to optimize this code a lot by introducing more waits instead
; of writing each pixel as MOVE, but this is simplest way to write code + any position
; BC: $253B (and have NR60 selected already), DE: x:y pixel position
UploadFlagAtDe:
ld a,d
and $07 ; X mod 8
add a,a ; 2x noop = 2 dots = 1 pixel
inc a ; +1 for loop test
ld l,a ; L = amount of NOPs after Wait
ld a,d
rrca
rrca ; put (x/8) into position for WAIT inst.
and $3E ; keep only relevant bits
or COPPER_WAIT ; convert it to WAIT instruction (high byte)
ld h,a
; continue with UploadFlag code
; BC: $253B (and have NR60 selected already), H: WAIT instruction for start of line (+E),
; L: amount of nops after initial wait (at least one must be there)
UploadFlag:
ld a,e
add a,10
ld d,a ; D = end E
ld ix,FlagData
.LineLoop:
; test if all lines were produced
ld a,e
cp d
ret z ; last line reached, exit
; write WAIT for start of next line
ld a,h
out (c),a
ld a,e
out (c),a
inc iy ; count total instructions
inc e ; next line coordinate adjusted
; write L-1 many COPPER_NOOP instructions (to wait for correct pixel)
push hl ; preserve HL (L will be used as counter for all inner loops)
xor a ; 0 for NOOP programming
.InjectNoopsLoop:
dec l
call nz,.InjectNoop ; will skip NOOP write for L=1
jr nz,.InjectNoopsLoop
; output 16 "pixels" of flag
call .OutputOneByteOfData ; output 8 bits of flag data
call .OutputOneByteOfData ; output other 8 bits of flag data
; output white colour after the flag
ld a,PALETTE_VALUE_NR_41
out (c),a
ld a,C_WHITE
out (c),a
inc iy ; count total instructions
pop hl ; restore L "NOOP counter"
jr .LineLoop
; A: 0, BC: TBBLUE_REGISTER_ACCESS_P_253B, IY: Copper instructions counter
.InjectNoop: ; must preserve CPU FLAGS (ZF)!
out (c),a
out (c),a
inc iy ; count total instructions
ret
.OutputOneByteOfData:
ld l,8
.OutputOneBitOfData:
ld a,PALETTE_VALUE_NR_41
out (c),a ; cooper.move instruction to NR41
ld a,C_BLUE
rlc (ix) ; CF = bit of data
jr nc,.BlueColour
ld a,C_YELLOW
.BlueColour:
out (c),a
inc iy ; count total instructions
dec l
jr nz,.OutputOneBitOfData
inc ix ; next byte data
ret
savesna "!Copper.sna", Start
| 34.983871 | 93 | 0.615491 |
22000ddeaf024824bc4c969f70f86c04e1ba6bd7 | 484 | asm | Assembly | data/mapObjects/agatha.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | data/mapObjects/agatha.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | data/mapObjects/agatha.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | AgathaObject:
db $0 ; border block
db $4 ; warps
db $b, $4, $2, BRUNOS_ROOM
db $b, $5, $3, BRUNOS_ROOM
db $0, $4, $0, LANCES_ROOM
db $0, $5, $0, LANCES_ROOM
db $0 ; signs
db $1 ; objects
object SPRITE_AGATHA, $5, $2, STAY, DOWN, $1, OPP_AGATHA, $1
; warp-to
EVENT_DISP AGATHAS_ROOM_WIDTH, $b, $4 ; BRUNOS_ROOM
EVENT_DISP AGATHAS_ROOM_WIDTH, $b, $5 ; BRUNOS_ROOM
EVENT_DISP AGATHAS_ROOM_WIDTH, $0, $4 ; LANCES_ROOM
EVENT_DISP AGATHAS_ROOM_WIDTH, $0, $5 ; LANCES_ROOM
| 24.2 | 61 | 0.67562 |
0c6eaa5af43ff95f7905940f152f2dfb5108771c | 4,292 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_224.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_224.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_224.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %rbx
push %rcx
push %rdi
lea addresses_D_ht+0x14029, %r8
nop
nop
nop
nop
nop
xor $31732, %rbx
movl $0x61626364, (%r8)
nop
nop
nop
nop
nop
cmp $53728, %rdi
lea addresses_WT_ht+0x11189, %rcx
nop
nop
nop
nop
inc %r14
movups (%rcx), %xmm1
vpextrq $0, %xmm1, %r11
cmp %r14, %r14
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r9
push %rbx
push %rdi
// Faulty Load
lea addresses_A+0x19029, %r10
nop
nop
nop
nop
nop
cmp $521, %rbx
movb (%r10), %r14b
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rdi
pop %rbx
pop %r9
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
| 53.65 | 2,999 | 0.661463 |
3815d3203545b65c6269ab94685f0ff258045fa3 | 7,852 | asm | Assembly | Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_21829_939.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_21829_939.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_21829_939.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xe947, %r11
nop
nop
nop
add $57064, %r10
movb (%r11), %cl
add %rcx, %rcx
lea addresses_WT_ht+0x2854, %r10
nop
add %r9, %r9
movb (%r10), %r8b
cmp %rdi, %rdi
lea addresses_UC_ht+0x728f, %r10
nop
nop
nop
nop
nop
and $43705, %r11
mov (%r10), %r8d
nop
nop
nop
nop
and $23034, %rdi
lea addresses_D_ht+0x1c40f, %rsi
lea addresses_normal_ht+0x147cb, %rdi
clflush (%rsi)
nop
add $48535, %r14
mov $47, %rcx
rep movsq
cmp %r11, %r11
lea addresses_D_ht+0x1b02f, %rsi
lea addresses_D_ht+0xebcf, %rdi
nop
nop
nop
nop
nop
dec %r10
mov $85, %rcx
rep movsw
nop
nop
nop
nop
inc %rcx
lea addresses_A_ht+0x1bd4f, %rsi
lea addresses_UC_ht+0x1b1cf, %rdi
nop
nop
nop
and $32304, %r14
mov $21, %rcx
rep movsw
nop
nop
nop
nop
xor $58227, %rsi
lea addresses_A_ht+0x14dcf, %rsi
lea addresses_D_ht+0x14f0f, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
sub %r11, %r11
mov $9, %rcx
rep movsb
nop
nop
xor %rdi, %rdi
lea addresses_WT_ht+0x95b8, %rcx
nop
nop
nop
nop
cmp $50558, %rdi
movl $0x61626364, (%rcx)
nop
nop
and %r10, %r10
lea addresses_WT_ht+0xf277, %rdi
xor %r8, %r8
movb (%rdi), %r11b
nop
nop
nop
sub $25567, %rcx
lea addresses_UC_ht+0x15dcf, %rsi
nop
dec %r8
mov $0x6162636465666768, %r9
movq %r9, (%rsi)
nop
nop
cmp %r11, %r11
lea addresses_WT_ht+0xf90d, %rsi
lea addresses_UC_ht+0x9a7f, %rdi
clflush (%rdi)
nop
nop
nop
nop
add %r9, %r9
mov $36, %rcx
rep movsq
nop
and $27623, %rsi
lea addresses_A_ht+0x1913f, %rsi
lea addresses_WC_ht+0x163cf, %rdi
add $47417, %r14
mov $122, %rcx
rep movsq
and $15768, %r10
lea addresses_A_ht+0x1e4cf, %rdi
nop
nop
nop
nop
nop
xor $13574, %r14
mov $0x6162636465666768, %r9
movq %r9, %xmm0
movups %xmm0, (%rdi)
nop
nop
xor %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %r8
push %r9
push %rdi
// Store
lea addresses_US+0xc1cf, %r14
nop
nop
add %r9, %r9
movl $0x51525354, (%r14)
nop
nop
nop
nop
nop
and $7661, %r14
// Load
lea addresses_WT+0x1d04f, %r12
nop
nop
nop
nop
and $63745, %r10
mov (%r12), %r8
// Exception!!!
nop
mov (0), %r15
and %r12, %r12
// Faulty Load
lea addresses_US+0x11bcf, %r8
nop
nop
nop
xor $46222, %r12
vmovups (%r8), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r14
lea oracles, %r12
and $0xff, %r14
shlq $12, %r14
mov (%r12,%r14,1), %r14
pop %rdi
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_US'}}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': True, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 33.271186 | 2,999 | 0.655374 |
4ad005b01e224bfb7322f65dd0a14b4f16848a39 | 2,467 | asm | Assembly | test04.asm | kazuminn/x86emu | 7d2eac060b3c132e74ea1e246f257a630889b94d | [
"MIT"
] | 2 | 2020-01-31T11:24:10.000Z | 2020-02-24T03:11:06.000Z | test04.asm | kazuminn/ghyper | bc9f093b424ddc62d3f7fce0cd2cefc1942b8fdb | [
"MIT"
] | null | null | null | test04.asm | kazuminn/ghyper | bc9f093b424ddc62d3f7fce0cd2cefc1942b8fdb | [
"MIT"
] | null | null | null | 00000000 55 push ebp
00000001 89E5 mov ebp,esp
00000003 83EC18 sub esp,byte +0x18
00000006 C745F400000A00 mov dword [ebp-0xc],0xa0000
0000000D C745F040010000 mov dword [ebp-0x10],0x140
00000014 C745ECC8000000 mov dword [ebp-0x14],0xc8
0000001B 83EC04 sub esp,byte +0x4
0000001E 6A78 push byte +0x78
00000020 6A78 push byte +0x78
00000022 6A14 push byte +0x14
00000024 6A14 push byte +0x14
00000026 6A01 push byte +0x1
00000028 FF75F0 push dword [ebp-0x10]
0000002B FF75F4 push dword [ebp-0xc]
0000002E E812000000 call dword 0x45
00000033 83C420 add esp,byte +0x20
00000036 EBFE jmp short 0x36
00000038 55 push ebp
00000039 89E5 mov ebp,esp
0000003B 8B5508 mov edx,[ebp+0x8]
0000003E 8B450C mov eax,[ebp+0xc]
00000041 01D0 add eax,edx
00000043 5D pop ebp
00000044 C3 ret
00000045 55 push ebp
00000046 89E5 mov ebp,esp
00000048 83EC14 sub esp,byte +0x14
0000004B 8B4510 mov eax,[ebp+0x10]
0000004E 8845EC mov [ebp-0x14],al
00000051 8B4518 mov eax,[ebp+0x18]
00000054 8945F8 mov [ebp-0x8],eax
00000057 EB33 jmp short 0x8c
00000059 8B4514 mov eax,[ebp+0x14]
0000005C 8945FC mov [ebp-0x4],eax
0000005F EB1F jmp short 0x80
00000061 8B45F8 mov eax,[ebp-0x8]
00000064 0FAF450C imul eax,[ebp+0xc]
00000068 89C2 mov edx,eax
0000006A 8B45FC mov eax,[ebp-0x4]
0000006D 01D0 add eax,edx
0000006F 89C2 mov edx,eax
00000071 8B4508 mov eax,[ebp+0x8]
00000074 01C2 add edx,eax
00000076 0FB645EC movzx eax,byte [ebp-0x14]
0000007A 8802 mov [edx],al
0000007C 8345FC01 add dword [ebp-0x4],byte +0x1
00000080 8B45FC mov eax,[ebp-0x4]
00000083 3B451C cmp eax,[ebp+0x1c]
00000086 7ED9 jng 0x61
00000088 8345F801 add dword [ebp-0x8],byte +0x1
0000008C 8B45F8 mov eax,[ebp-0x8]
0000008F 3B4520 cmp eax,[ebp+0x20]
00000092 7EC5 jng 0x59
00000094 90 nop
00000095 C9 leave
00000096 C3 ret
| 43.280702 | 57 | 0.56668 |
87ebdffcfa362e24bca0a02a9f47b97ff22fac2e | 6,807 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_595.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_595.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_595.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1d3f6, %r15
clflush (%r15)
nop
nop
nop
and %rdi, %rdi
vmovups (%r15), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r14
nop
nop
nop
nop
nop
and $15589, %r11
lea addresses_normal_ht+0xdd6e, %r11
clflush (%r11)
nop
nop
nop
nop
nop
cmp $4305, %rbp
movb $0x61, (%r11)
nop
nop
nop
add %r14, %r14
lea addresses_WC_ht+0xb676, %rsi
lea addresses_WC_ht+0x1d3c5, %rdi
clflush (%rdi)
nop
nop
nop
and $24249, %r14
mov $117, %rcx
rep movsq
xor %rsi, %rsi
lea addresses_D_ht+0x3af6, %rsi
lea addresses_A_ht+0x12ff6, %rdi
nop
nop
nop
add $41408, %r8
mov $105, %rcx
rep movsl
and $6872, %r15
lea addresses_WT_ht+0xf646, %r15
nop
nop
nop
nop
nop
mfence
mov (%r15), %r8
cmp %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0x1abf6, %r13
nop
nop
nop
nop
nop
cmp $20557, %r10
mov $0x5152535455565758, %rsi
movq %rsi, (%r13)
cmp $31058, %rsi
// REPMOV
lea addresses_PSE+0x2bf6, %rsi
lea addresses_D+0x6ff6, %rdi
nop
nop
nop
nop
add %rbx, %rbx
mov $85, %rcx
rep movsl
nop
nop
nop
inc %r8
// REPMOV
lea addresses_RW+0x124b6, %rsi
lea addresses_normal+0x1a26a, %rdi
nop
nop
add $13952, %r8
mov $117, %rcx
rep movsb
nop
cmp $64205, %r13
// Store
lea addresses_WT+0x8bf6, %rsi
nop
nop
nop
nop
dec %rbp
movb $0x51, (%rsi)
nop
nop
nop
xor %rdi, %rdi
// Store
lea addresses_PSE+0x1f9bf, %rsi
clflush (%rsi)
nop
nop
nop
nop
dec %r10
movb $0x51, (%rsi)
nop
nop
nop
nop
inc %r13
// Store
mov $0xcf6, %rbx
nop
nop
xor $26590, %rsi
movl $0x51525354, (%rbx)
cmp %rbx, %rbx
// Faulty Load
lea addresses_D+0x1abf6, %r10
nop
nop
nop
nop
nop
sub $49845, %r13
mov (%r10), %ebx
lea oracles, %rdi
and $0xff, %rbx
shlq $12, %rbx
mov (%rdi,%rbx,1), %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_PSE', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_RW', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_D', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'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
*/
| 33.043689 | 2,999 | 0.655355 |
46246de37e18be2435dd9ad049b596ae17d7b89d | 196 | asm | Assembly | iod/con2/gw/draw.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | iod/con2/gw/draw.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | iod/con2/gw/draw.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; Common entry for drawing graphics figures
; Originally Laurence Reeves
; This has been modified to allow up to 24 bit colours
section con
xdef GW_DRAW
xref GW_fig
gw_draw
jmp gw_fig
end
| 15.076923 | 54 | 0.77551 |
da75a1279d0aa874db33f2124fabe131b4356282 | 4,036 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_247.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_247.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_247.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x761d, %rsi
lea addresses_D_ht+0x1c1d, %rdi
lfence
mov $106, %rcx
rep movsl
nop
nop
nop
sub %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rbp
push %rdx
push %rsi
// Faulty Load
lea addresses_UC+0x781d, %r14
clflush (%r14)
dec %rbp
mov (%r14), %r11
lea oracles, %rdx
and $0xff, %r11
shlq $12, %r11
mov (%rdx,%r11,1), %r11
pop %rsi
pop %rdx
pop %rbp
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
| 68.40678 | 2,999 | 0.663776 |
bb76d15e6118b246ee477101c37184cb863c806a | 1,566 | asm | Assembly | programs/oeis/259/A259821.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/259/A259821.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/259/A259821.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A259821: a(n) = floor( (3^n+1)^2/3^n ).
; 4,5,11,29,83,245,731,2189,6563,19685,59051,177149,531443,1594325,4782971,14348909,43046723,129140165,387420491,1162261469,3486784403,10460353205,31381059611,94143178829,282429536483,847288609445,2541865828331,7625597484989,22876792454963,68630377364885,205891132094651,617673396283949,1853020188851843,5559060566555525,16677181699666571,50031545098999709,150094635296999123,450283905890997365,1350851717672992091,4052555153018976269,12157665459056928803,36472996377170786405,109418989131512359211,328256967394537077629,984770902183611232883,2954312706550833698645,8862938119652501095931,26588814358957503287789,79766443076872509863363,239299329230617529590085,717897987691852588770251,2153693963075557766310749,6461081889226673298932243,19383245667680019896796725,58149737003040059690390171,174449211009120179071170509,523347633027360537213511523,1570042899082081611640534565,4710128697246244834921603691,14130386091738734504764811069,42391158275216203514294433203,127173474825648610542883299605,381520424476945831628649898811,1144561273430837494885949696429,3433683820292512484657849089283,10301051460877537453973547267845,30903154382632612361920641803531,92709463147897837085761925410589,278128389443693511257285776231763,834385168331080533771857328695285,2503155504993241601315571986085851,7509466514979724803946715958257549,22528399544939174411840147874772643,67585198634817523235520443624317925,202755595904452569706561330872953771,608266787713357709119683992618861309
mov $1,3
pow $1,$0
trn $1,2
add $1,4
mov $0,$1
| 174 | 1,475 | 0.921456 |
617cb3f89317b5c699e05d2eca4486a837d149d3 | 977 | asm | Assembly | projects/04/fill/Fill.asm | Spud304/nand2tetris | 0e4448f403721b5d2720c1fadbc74eebeee093fb | [
"MIT"
] | null | null | null | projects/04/fill/Fill.asm | Spud304/nand2tetris | 0e4448f403721b5d2720c1fadbc74eebeee093fb | [
"MIT"
] | null | null | null | projects/04/fill/Fill.asm | Spud304/nand2tetris | 0e4448f403721b5d2720c1fadbc74eebeee093fb | [
"MIT"
] | null | null | null | // This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Fill.asm
// Runs an infinite loop that listens to the keyboard input.
// When a key is pressed (any key), the program blackens the screen,
// i.e. writes "black" in every pixel;
// the screen should remain fully black as long as the key is pressed.
// When no key is pressed, the program clears the screen, i.e. writes
// "white" in every pixel;
// the screen should remain fully clear as long as no key is pressed.
// Put your code here.
(INPUT)
@KBD //check if a key is pressed (no key = 0)
D=M
@color
M=0
@FILL_SCREEN //skip the blacken code
D;JEQ // if 0
@BLACKEN
0;JMP
@INPUT
0;JMP
(BLACKEN)
@color
M=-1
(FILL_SCREEN)
@SCREEN //16373
D=A
@screen
M=D
(FILL_LOOP)
@color
D=M
@screen
A=M
M=D
@screen
M=M+1
@24576
D=A
@screen
D=D-M
@FILL_LOOP
D;JGT
@INPUT
0;JMP
| 15.030769 | 71 | 0.668373 |
4c2c20447fc89ab14118fd129f6e26b3167c0a8a | 1,155 | asm | Assembly | src/examples/decimalHexAndBinaryNumbers.asm | digitsensitive/c64 | 47b0aa02910c26f49bae967f573466b94143ec74 | [
"Unlicense"
] | 2 | 2020-12-04T23:25:20.000Z | 2021-11-04T21:56:37.000Z | src/examples/decimalHexAndBinaryNumbers.asm | digitsensitive/c64 | 47b0aa02910c26f49bae967f573466b94143ec74 | [
"Unlicense"
] | null | null | null | src/examples/decimalHexAndBinaryNumbers.asm | digitsensitive/c64 | 47b0aa02910c26f49bae967f573466b94143ec74 | [
"Unlicense"
] | 1 | 2022-02-02T12:14:56.000Z | 2022-02-02T12:14:56.000Z | ; ==========================================================
; COMMODORE 64 - Examples in 6502 Assembly language
; © Digitsensitive; digit.sensitivee@gmail.com
; Decimal, Hexadecimal and Binary numbers
; ==========================================================
; ----------------------------------------------------------
; A binary number is preceded by a percent sign (%)
; Immediate addressing can be identified by the Hashpount (#)
; The dollar sign ($) tells the assembler, that the number is in Hexadecimal.
; Example:
; The number 6 can be written as follows:
; #6 = #$6 = #$06 = #%0110
; ----------------------------------------------------------
; ----------------------------------------------------------
; Main Loop
; ----------------------------------------------------------
*=$02a7 ; sys 679
; In this example we will display four times the letter "F"
init lda #6 ; decimal
sta $0400
lda #$6 ; hexadecimal
sta $0401
lda #$06 ; hexadecimal
sta $0402
lda #%0110 ; binary
sta $0403
rts | 37.258065 | 77 | 0.393074 |
4fa18f2b820d9c9f98b80bb359a9995de45d7d72 | 1,743 | asm | Assembly | src/sdread.asm | codebje/cpmsuite | 4692b936e7061d39c26919fcaa86340344309705 | [
"MIT"
] | null | null | null | src/sdread.asm | codebje/cpmsuite | 4692b936e7061d39c26919fcaa86340344309705 | [
"MIT"
] | null | null | null | src/sdread.asm | codebje/cpmsuite | 4692b936e7061d39c26919fcaa86340344309705 | [
"MIT"
] | null | null | null | .z180
#target bin
#code TEXT, $100
#data DATA, *
#include "src/z180registers.z80"
#include "src/tbios.z80"
SPI_SPEED: equ SPI_CTRL_6MHZ
SPI_PAUSE: equ SPI_CTRL_SDCARD | SPI_SPEED
SPI_RESUME: equ SPI_CTRL_SDCARD | SPI_SPEED | SPI_CTRL_ENABLE
#code TEXT
.org $100
ld a, SPI_CTRL_SDCARD | SPI_CTRL_400KHZ
out0 (SPI_CTRL), a
ld hl, cmd55
ld b, 0
call sdcommand
tst %01111110
ld de, cmd55msg
jp nz, exit
ld a, 2
out0 (FPGA_CTRL), a
ld hl, acmd41
ld b, 0
call sdcommand
tst %01111110
ld de, acmd41msg
jp nz, exit
tst %00000001
ld de, idlemsg
jr nz, exit
ld hl, cmd58
ld b, 1
call sdcommand
push af
ld a, b
ld (r7bytes), a
ld a, c
ld (r7bytes+1), a
ld a, d
ld (r7bytes+2), a
ld a, e
ld (r7bytes+3), a
call printr7
pop af
call bin_to_hex
ld (r1val), de
ld de, r1val
ld c, CPM_WRITESTR
call BDOS
;; now read the first block
ld hl, cmd17
call sendcmd
call getr1
tst %01111111
ld de, cmd17msg
jp nz, exit
ld hl, block
ld bc, 512
call getdata
ld hl, block + 0x1be
ld de, 0
ld c, 4
call dump_hex
rst 0
exit:
push de
call bin_to_hex
pop hl
ld (hl), e
inc hl
ld (hl), d
dec hl
ld de, hl
ld c, CPM_WRITESTR
call BDOS
rst 0
cmd55msg: .db '?? cmd55', 13, 10, '$'
acmd41msg: .db '?? acmd41', 13, 10, '$'
idlemsg: .db '?? idle', 13, 10, '$'
cmd17msg: .db '?? cmd17', 13, 10, '$'
#include "src/bin2hex.z80"
#include "src/dump_hex.z80"
#include "src/sdlib.z80"
csd_bad_msg: .db 'Invalid CSD structure version, card unknown', 13, 10, '$'
csd_nov1_msg: .db 'CSD version 1.0 unsupported', 13, 10, '$'
csd_available: .db '???????K available user storage', 13, 10, '$'
r1val: .db '??', 13, 10, '$'
block: .ds 512
| 16.138889 | 75 | 0.627653 |
b4bc46b94d9d395e8096c53ada1726c294448de9 | 494 | asm | Assembly | oeis/145/A145220.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/145/A145220.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/145/A145220.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A145220: a(n) is the number of even permutations (of an n-set) with exactly 2 fixed points.
; Submitted by Christian Krause
; 1,0,0,20,45,504,3640,33480,333585,3671360,44053416,572698620,8017774765,120266629560,1924266062160,32712523070864,588825415257345,11187682889912640,223753657798223920,4698826813762738020,103374189902780192781,2377606367763944486840
mov $2,$0
seq $0,3221 ; Number of even permutations of length n with no fixed points.
add $2,1
mul $0,$2
add $2,1
mul $0,$2
div $0,2
| 41.166667 | 233 | 0.795547 |
3826c7b7e3158598e1a79fbbc077c46dd8540a98 | 1,678 | asm | Assembly | programs/oeis/209/A209295.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/209/A209295.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/209/A209295.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A209295: Antidiagonal sums of the gcd(.,.) array A109004.
; 0,2,5,8,12,14,21,20,28,30,37,32,52,38,53,60,64,50,81,56,92,86,85,68,124,90,101,108,132,86,165,92,144,138,133,152,204,110,149,164,220,122,237,128,212,234,181,140,288,182,245,216,252,158,297,244,316,242,229,176,420,182,245,336,320,290,381,200,332,294,421,212,492,218,293,400,372,350,453,236,512,378,325,248,604,382,341,372,508,266,657,416,452,398,373,428,656,290,497,540,620,302,597,308,604,690,421,320,756,326,677,476,736,338,669,520,572,642,469,548,1020,462,485,528,612,550,945,380,704,554,805,392,972,614,533,864,796,410,813,416,1076,606,565,668,1152,658,581,812,732,446,1125,452,892,846,973,704,1156,470,629,684,1168,746,1053,488,812,1110,661,500,1468,650,1061,948,852,518,1029,1020,1184,762,709,536,1692,542,1157,788,1084,842,1101,880,932,1242,1189,572,1472,578,773,1320,1260,590,1521,596,1500,866,805,944,1524,934,821,1152,1408,986,1965,632,1052,918,853,980,1836,1010,869,944,1732,1046,1317,668,1680,1590,901,680,1708,686,1445,1596,1372,698,1809,1072,1172,1022,1525,716,2400,722,1265,1296,1212,1442,1461,1172,1468,1074
mov $10,$0
mov $12,2
lpb $12
clr $0,10
mov $0,$10
sub $12,1
add $0,$12
sub $0,1
mov $7,$0
mov $9,$0
add $9,1
lpb $9
mov $0,$7
sub $9,1
sub $0,$9
mov $3,3
mov $6,$0
lpb $0
sub $0,1
add $3,2
mov $5,$6
gcd $5,$0
add $5,$3
mov $4,$5
sub $4,1
mov $3,$4
lpe
pow $4,0
mov $5,5
sub $5,$3
sub $4,$5
add $4,1
mov $1,$4
add $1,1
add $8,$1
lpe
mov $1,$8
mov $13,$12
lpb $13
mov $11,$1
sub $13,1
lpe
lpe
lpb $10
mov $10,0
sub $11,$1
lpe
mov $1,$11
sub $1,1
| 31.660377 | 1,024 | 0.632896 |
b56173ae7f9332563aa6845255c66f6b1381c272 | 299 | asm | Assembly | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/obstack_vprintf.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/obstack_vprintf.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/obstack_vprintf.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; int obstack_vprintf(struct obstack *obstack, const char *format, void *arg)
SECTION code_stdio
PUBLIC _obstack_vprintf
EXTERN l0_obstack_vprintf_callee
_obstack_vprintf:
pop af
pop hl
pop de
pop bc
push bc
push de
push hl
push af
jp l0_obstack_vprintf_callee
| 13 | 77 | 0.725753 |
7ad8fa23a0b1a9b7fc5d6e1ed569fbb827e58941 | 328 | asm | Assembly | programs/oeis/146/A146534.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/146/A146534.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/146/A146534.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A146534: 4*C(2n,n)-3*0^n.
; 1,8,24,80,280,1008,3696,13728,51480,194480,739024,2821728,10816624,41602400,160466400,620470080,2404321560,9334424880,36300541200,141381055200,551386115280,2153031497760
mov $2,$0
lpb $0,1
sub $0,1
mov $3,$2
add $3,$2
mov $1,$3
bin $1,$2
lpe
mul $1,8
add $1,5
trn $1,7
div $1,2
add $1,1
| 19.294118 | 171 | 0.689024 |
5c4715c845f1187c526b28d321f4c1ccdd43ec29 | 102 | asm | Assembly | tests/symbol_label_nested/16.asm | NullMember/customasm | 6e34d6432583a41278e6b3596f1817ae82149531 | [
"Apache-2.0"
] | 414 | 2016-10-14T22:39:20.000Z | 2022-03-30T07:52:44.000Z | tests/symbol_label_nested/16.asm | NullMember/customasm | 6e34d6432583a41278e6b3596f1817ae82149531 | [
"Apache-2.0"
] | 100 | 2018-03-22T16:12:24.000Z | 2022-03-26T09:19:23.000Z | tests/symbol_label_nested/16.asm | NullMember/customasm | 6e34d6432583a41278e6b3596f1817ae82149531 | [
"Apache-2.0"
] | 47 | 2017-06-29T15:12:13.000Z | 2022-03-10T04:50:51.000Z | #ruledef test
{
ld {x} => 0x55 @ x`8
}
global1:
ld ..local2
..local2: ; error: nesting level | 11.333333 | 32 | 0.568627 |
2a661b9b922bba2df228ff900c57bffd36fb2828 | 546 | asm | Assembly | asmex/asm01/asm_01.asm | filovirid/solveme | c5153cd2d760fa8616a1831c5bbae7dd4480d7a2 | [
"MIT"
] | null | null | null | asmex/asm01/asm_01.asm | filovirid/solveme | c5153cd2d760fa8616a1831c5bbae7dd4480d7a2 | [
"MIT"
] | null | null | null | asmex/asm01/asm_01.asm | filovirid/solveme | c5153cd2d760fa8616a1831c5bbae7dd4480d7a2 | [
"MIT"
] | null | null | null | ; Assembly exercise from the book
; Practical Reverse Engineering: X86, X64, ARM, Windows Kernel, Reversing Tools, and Obfuscation
; by: Alexandre Gazet, Bruce Dang, and Elias Bachaalany
; Chapter 1 (x86 and x64) p.11 Q.1
01: 8B 7D 08 mov edi, [ebp+8]
02: 8B D7 mov edx, edi
03: 33 C0 xor eax, eax
04: 83 C9 FF or ecx, 0FFFFFFFFh
05: F2 AE repne scasb
06: 83 C1 02 add ecx, 2
07: F7 D9 neg ecx
08: 8A 45 0C mov al, [ebp+0Ch]
09: 8B FA mov edi, edx
10: F3 AA rep stosb
11: 8B C2 mov eax, edx
| 32.117647 | 96 | 0.6337 |
27d8a7a149c9f25faba3daa88509621cf688eb53 | 9,417 | asm | Assembly | file-system/root/equ/bmodeequ.asm | dwildie/cromix-s100computers | 5155b207b5660aa28b46dee6ce2c1709c50b02f1 | [
"Apache-2.0"
] | 2 | 2022-01-13T22:27:43.000Z | 2022-03-22T23:26:47.000Z | file-system/root/equ/bmodeequ.asm | dwildie/cromix-s100computers | 5155b207b5660aa28b46dee6ce2c1709c50b02f1 | [
"Apache-2.0"
] | null | null | null | file-system/root/equ/bmodeequ.asm | dwildie/cromix-s100computers | 5155b207b5660aa28b46dee6ce2c1709c50b02f1 | [
"Apache-2.0"
] | null | null | null | list off, noxref
;
; Cromemco Inc.
; @(#)bmodeequ.asm 1.2 (7/7/87)
;
; Mode definitions for block devices
;
; D2-register values for _GETMODE and _SETMODE system calls
;
BMD_STATUS equ 0 ; Get/set status byte
BMD_FLG1 equ 1 ; Get/set flag1 byte
BMD_FLG2 equ 2 ; Get/set flag2 byte
BMD_FLG3 equ 3 ; Get/set flag3 byte
BMD_SIZE equ 4 ; Get number of bytes on device
BMD_SEEK equ 5 ; Seek
BMD_INIT equ 6 ; Initialize track
BMD_PRDWRT equ 7 ; Primitive read/write
BMD_RDWRT equ 8 ; Special read/write
BMD_RPM equ 9 ; Get RPM
BMD_VERSION equ 10 ; Version number
BMD_PHYCHAR equ 11 ; Physical characteristics
BMD_LDFIRM equ 12 ; Load firmware
BMD_SOFT equ 13 ; Accumulated number of retries
BMD_HARD equ 14 ; Accumulated number of hard errors
BMD_RETRY equ 15 ; Number of retries before hard error
BMD_GETALT equ 16 ; Get alternate track table
BMD_SETALT equ 17 ; Set alternate track table
BMD_GETPART equ 18 ; Get partition table
BMD_SETPART equ 19 ; Set partition table
;
; Values 20 .. 63 reserved
; Values 64 .. 127 special device modes
; Values 128 .. 255 reserved for user
; supplied drivers
; Floppy tape special numbers
;
BMD_RETEN equ 64 ; Number of tape repositions before
; a retension
; IMI disk special numbers
;
BMD_IMITYPE equ 64 ; Get type of IMI drive
; Values returned by BMD_IMITYPE
;
IM_50070 equ 01H ; IMI model 50070
IM_5007W equ 02H ; IMI model 5007W
IM_5018H equ 03H ; IMI model 5018H
IM_7710A equ 04H ; IMI model 7710A
IM_7710B equ 05H ; IMI model 7710B
; Memory driver special numbers
;
BMD_TMEM equ 64 ; Total memory
BMD_SMEM equ 65 ; System memory
BMD_HMEM equ 66 ; Shared memory
BMD_FMEM equ 67 ; Free memory
BMD_MMEM equ 68 ; Maximal free memory
BMD_CACR equ 69 ; CACR register
; Reserved
BMD_XMM equ 71 ; XMM usage
; D3-register & D4-register bits for BMD_STATUS calls
;
DS_BUSY equ 0 ; Device Busy (in use)
DS_WANT equ 1 ; Device Wanted (do wakeup)
DS_READ equ 2 ; Read-only device
DS_MODF equ 3 ; Super-block modified
DS_MOUNT equ 4 ; Device mounted
DS_HOME equ 5 ; Device has been homed
DS_BFSTEP equ 6 ; Buffered step flag
DS_VERIFY equ 7 ; Verify after write
; D3-register & D4-register bits for BMD_FLG1 calls
;
DF_SMALL equ 0 ; 1=small floppy 0=large floppy
DF_DSIDE equ 1 ; Double sided
DF_DDENS equ 2 ; Double density
DF_DTRACK equ 3 ; Double tracked
DF_CROMIX equ 4 ; Cromix format disk
DF_CDOS equ 5 ; Cdos format disk
DF_BACKUP equ 6 ; Backup format disk
DF_VOICE equ 7 ; 0=step 1=voice coil
; D3-register values for BMD_FLG2 calls
;
D2_SMALL equ 0 ; Small floppy
D2_LARGE equ 1 ; Large floppy
D2_STDC equ 2 ; STDC hard disk
D2_FSMD equ 3 ; Fixed part of SMD hard disk
D2_RSMD equ 4 ; Removable part of SMD hard disk
D2_UNIFORM equ 5 ; Uniform floppy
D2_MEMORY equ 6 ; Processor memory
D2_RAM equ 7 ; RAM disk
D2_FTAPE equ 8 ; Floppy tape
D2_IMI equ 9 ; IMI hard disk
; D3-register & D4-register bits for BMD_FLG3 calls
;
D3_WRTPRO equ 0 ; Device is write protected
D3_INTRPT equ 1 ; Device interrupts
D3_DUAL equ 2 ; Dual drive
; Floppy minor device number bits
;
FDENSITY equ 6 ; 0 = double density
FSIDES equ 5 ; 0 = double sided
FDUAL equ 4 ; 1 = dual drive (PERSCI)
FDTRACK equ 3 ; 1 = double tracked
FSIZE equ 2 ; 0 = 8", 1 = 5"
FUNIT equ 03H ; Mask for unit number
; SMD minor device number bits
;
CONTROLLER equ 7 ; Controller number
DRIVE equ 6 ; Drive number
FIXED equ 5 ; Fixed flag
PARTITION equ 1FH ; Partition number mask
; Data structure for BMD_INIT call
;
struct 0
in_flags ds.w 1 ; Density from minor device number
in_side ds.w 1 ; Side to initialize
in_track ds.w 1 ; Track to initialize
in_buf ds.l 1 ; Pointer to track image
in_size ds 0 ; Size of structure
mend
; Data structure for BMD_SEEK call
;
struct 0
sk_status ds.b 1 ; Return status
sk_terror ds.b 1 ; Fatal error number
sk_serror ds.b 1 ; System error number
sk_verify ds.b 1 ; Verify seek flag
sk_side ds.w 1 ; Side
sk_track ds.w 1 ; Track
sk_size ds 0 ; Size of structure
mend
; Data structure for BMD_RDWRT call
;
struct 0
rw_read ds.w 1 ; Read/write flag
rw_buf ds.l 1 ; Buffer pointer
rw_number ds.l 1 ; Number of blocks
rw_blknr ds.l 1 ; Starting block number
rw_size ds 0 ; Size of structure
mend
; Data structure for BMD_PRDWRT call
;
struct 0
prw_status ds.b 1 ; Controller status
prw_terror ds.b 1 ; Fatal error number
prw_serror ds.b 1 ; System error number
prw_read ds.b 1 ; Read write flag
prw_buf ds.l 1 ; Buffer pointer
prw_number ds.w 1 ; Number of sectors to do
prw_sector ds.w 1 ; Starting sector number
prw_surface ds.w 1 ; Surface number to read/write
prw_cylinder ds.w 1 ; Cylinder number to read/write
prw_size ds 0 ; Size of structure
mend
; Status bits for primitive operations
;
; STDC
;
sts_ioerror equ 0 ; IO error
sts_nioerror equ 1 ; Not IO error
sts_select equ 2 ; Error on select
sts_seek equ 3 ; Error on seek
sts_prd equ 4 ; Error on primitive read
sts_pwr equ 5 ; Error on primitive write
sts_ptx equ 6 ; Error on transfer
;
; Floppy
;
fls_select equ 1 ; Error on select
fls_home equ 2 ; Error on home
fls_rdadd equ 3 ; Error on read address
fls_seek equ 4 ; Error on seek
fls_pread equ 5 ; Error on preread
fls_read equ 6 ; Error on read
fls_write equ 7 ; Error on write
fls_wtrk equ 8 ; Error on write track
;
; SMD
;
sms_select equ 1 ; Error on select
sms_home equ 2 ; Error on home
sms_seek equ 3 ; Error on seek
sms_read equ 4 ; Error on read
sms_write equ 5 ; Error on write
sms_head equ 6 ; Error on select head
sms_pread equ 7 ; Error on preread
; Data structure for BMD_PHYCHAR call
;
struct 0
phy_surface ds.w 1 ; Number of surfaces on device
phy_cylinder ds.w 1 ; Number of cylinders on device
phy_sector ds.w 1 ; Number of sectors/track
phy_secsiz ds.w 1 ; Number of bytes/sector
phy_size ds 0 ; Size of structure
mend
; Data structure for BMD_LDFIRM call
;
struct 0
ldf_flags ds.w 1 ; Flags (see bellow)
ldf_count ds.w 1 ; Number of bytes
ldf_buf ds.l 1 ; Pointer to firmware
ldf_size ds 0 ; Size of structure
mend
LDFRM_DEBUG equ 8DH ; Load debugger firmware
LDFRM_FIRM equ 8FH ; Load regular firmware
; Data structure for BMD_ALTTRK call
;
struct 0
trk_badtrk ds.w 1 ; Bad head & cyl (4 & 12 bits)
trk_alttrk ds.w 1 ; Alt head & cyl (4 & 12 bits)
trk_size ds 0 ; Size of structure
mend
struct 0
alt_altptr ds.l 1 ; Pointer to alternate entries
alt_numalt ds.w 1 ; Number of alternate entries
alt_maxalt ds.w 1 ; Maximum numalt
alt_alttrk ds.w 1 ; Start of alternate tracks
alt_size ds 0 ; Size of structure
mend
; Data structure for BMD_PARTITION call
;
struct 0
ent_fstblock ds.l 1 ; Starting block number
ent_numblock ds.l 1 ; Number of blocks
ent_size ds 0 ; Size of strructure
mend
struct 0
prt_partptr ds.l 1 ; Pointer to partition entries
prt_numpart ds.w 1 ; Number of partition entries
prt_size ds 0 ; Size of structure
mend
list xref, on
| 34.621324 | 71 | 0.541892 |
ba4f365a93f449f12cc27464af2d846a6504f669 | 326 | asm | Assembly | programs/oeis/004/A004923.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/004/A004923.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/004/A004923.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A004923: Floor of n*phi^8, where phi is the golden ratio, A001622.
; 0,46,93,140,187,234,281,328,375,422,469,516,563,610,657,704,751,798,845,892,939,986,1033,1080,1127,1174,1221,1268,1315,1362,1409,1456,1503,1550,1597,1644,1691,1738,1785
mov $1,8
sub $1,$0
mul $1,2
mov $2,96
mul $2,$0
trn $2,2
add $1,$2
div $1,2
sub $1,8
| 25.076923 | 170 | 0.693252 |
94436c98dfc7b60fe950f975fc0a1fbfe575149a | 3,696 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_42.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_42.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_42.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rcx
push %rdi
push %rsi
// Faulty Load
lea addresses_A+0x195b7, %r14
nop
nop
nop
nop
xor $45793, %r12
mov (%r14), %edi
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
| 84 | 2,999 | 0.66342 |
ac2bdf64aa7856722f6e8bdf9ebad097d1365aca | 1,166 | asm | Assembly | os/bootloader/bootloader_main.asm | stplasim/basic-os | 36d951e2e2adcbae75a6066b464552b61a3d7f2c | [
"MIT"
] | 2 | 2021-03-21T09:32:19.000Z | 2022-01-28T22:22:41.000Z | os/bootloader/bootloader_main.asm | stplasim/basic-os | 36d951e2e2adcbae75a6066b464552b61a3d7f2c | [
"MIT"
] | null | null | null | os/bootloader/bootloader_main.asm | stplasim/basic-os | 36d951e2e2adcbae75a6066b464552b61a3d7f2c | [
"MIT"
] | null | null | null | [org 0x7c00]
KERNEL_OFFSET equ 0x1000 ; The same as when linking the kernel
mov [BOOT_DRIVE], dl ; The BIOS sets the boot drive in 'dl' on boot
mov bp, 0x9000
mov sp, bp
mov bx, MSG_REAL_MODE
call print
call print_nl
call load_kernel
call switch_to_pm
jmp $ ; Never executed
%include "boot_sector_print.asm"
%include "boot_sector_print_hex.asm"
%include "boot_sector_disk.asm"
%include "32bit_gdt.asm"
%include "32bit_print.asm"
%include "32bit_switch.asm"
[bits 16]
load_kernel:
mov bx, MSG_LOAD_KERNEL
call print
call print_nl
mov bx, KERNEL_OFFSET ; Read from disk and store in 0x1000
mov dh, 2
mov dl, [BOOT_DRIVE]
call disk_load
ret
[bits 32]
BEGIN_PM:
mov ebx, MSG_PROT_MODE
call print_string_pm
call KERNEL_OFFSET ; Give control to the kernel
jmp $ ; Stay here when the kernel returns control to us (if ever)
BOOT_DRIVE db 0 ; It's a good idea to store it in memory because 'dl' may get overwritten
MSG_REAL_MODE db "Started in 16-bit Real Mode", 0
MSG_PROT_MODE db "Landed in 32-bit Protected Mode", 0
MSG_LOAD_KERNEL db "Loading kernel into memory", 0
; padding
times 510 - ($-$$) db 0
dw 0xaa55 | 21.592593 | 89 | 0.731561 |
74c755888ffe9e8975fab920a8b2b028138ec19b | 509 | asm | Assembly | programs/oeis/111/A111333.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/111/A111333.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/111/A111333.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A111333: Number of odd numbers <= n-th prime.
; 1,2,3,4,6,7,9,10,12,15,16,19,21,22,24,27,30,31,34,36,37,40,42,45,49,51,52,54,55,57,64,66,69,70,75,76,79,82,84,87,90,91,96,97,99,100,106,112,114,115,117,120,121,126,129,132,135,136,139,141,142,147,154,156,157,159,166,169,174,175,177,180,184,187,190,192,195,199,201,205,210,211,216,217,220,222,225,229,231,232,234,240,244,246,250,252,255,261,262,271
mov $1,$0
trn $1,1
seq $1,8507 ; Number of odd composite numbers less than n-th odd prime.
add $0,$1
add $0,1
| 56.555556 | 349 | 0.697446 |
7785d18f9f13180b3dfd4d67ec3f1314874d9852 | 1,639 | asm | Assembly | constants/gfx_constants.asm | chaos-lord/CryEd | d67380ad026ac324290a6c31e20f79c06b8f82a6 | [
"MIT"
] | 1 | 2021-03-29T14:15:38.000Z | 2021-03-29T14:15:38.000Z | constants/gfx_constants.asm | chaos-lord/CryEd | d67380ad026ac324290a6c31e20f79c06b8f82a6 | [
"MIT"
] | 4 | 2021-03-28T17:20:09.000Z | 2021-04-27T22:20:31.000Z | constants/gfx_constants.asm | chaos-lord/CryEd | d67380ad026ac324290a6c31e20f79c06b8f82a6 | [
"MIT"
] | 4 | 2021-03-30T21:58:20.000Z | 2022-03-07T06:08:29.000Z | TILE_WIDTH EQU 8 ; pixels
LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes
LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes
NUM_PAL_COLORS EQU 4
PAL_COLOR_SIZE EQU 2
PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE
PALRGB_WHITE EQU palred 31 + palgreen 31 + palblue 31 ; $7fff
SCREEN_WIDTH EQU 20 ; tiles
SCREEN_HEIGHT EQU 18 ; tiles
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels
BG_MAP_WIDTH EQU 32 ; tiles
BG_MAP_HEIGHT EQU 32 ; tiles
METATILE_WIDTH EQU 4 ; tiles
SCREEN_META_WIDTH EQU 6 ; metatiles
SCREEN_META_HEIGHT EQU 5 ; metatiles
SURROUNDING_WIDTH EQU SCREEN_META_WIDTH * METATILE_WIDTH ; tiles
SURROUNDING_HEIGHT EQU SCREEN_META_HEIGHT * METATILE_WIDTH ; tiles
MAP_CONNECTION_PADDING_WIDTH EQU 3 ; metatiles
HP_BAR_LENGTH EQU 6 ; tiles
EXP_BAR_LENGTH EQU 8 ; tiles
HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * TILE_WIDTH ; pixels
EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels
; GetHPPal return values (see home/tilemap.asm)
HP_GREEN EQU 0
HP_YELLOW EQU 1
HP_RED EQU 2
; sprite_oam_struct members (see macros/wram.asm)
rsreset
SPRITEOAMSTRUCT_YCOORD rb ; 0
SPRITEOAMSTRUCT_XCOORD rb ; 1
SPRITEOAMSTRUCT_TILE_ID rb ; 2
SPRITEOAMSTRUCT_ATTRIBUTES rb ; 3
SPRITEOAMSTRUCT_LENGTH EQU _RS
NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wVirtualOAM
SPRITE_GFX_LIST_CAPACITY EQU 32 ; see wUsedSprites
; PokeAnims indexes (see engine/gfx/pic_animation.asm)
const_def
const ANIM_MON_SLOW
const ANIM_MON_NORMAL
const ANIM_MON_MENU
const ANIM_MON_TRADE
const ANIM_MON_EVOLVE
const ANIM_MON_HATCH
const ANIM_MON_HOF
const ANIM_MON_EGG1
const ANIM_MON_EGG2
| 28.258621 | 66 | 0.812691 |
3d26d2560ee33757385804fb90e1ca31a683c866 | 278 | asm | Assembly | programs/oeis/040/A040135.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/040/A040135.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/040/A040135.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A040135: Continued fraction for sqrt(148).
; 12,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6,24,6
add $0,1
mov $1,$0
mul $1,$0
trn $1,3
sub $1,2
gcd $1,8
mul $1,6
| 25.272727 | 166 | 0.604317 |
bc80362a4cffead84c0761ee396108dc064e44c3 | 5,441 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_236.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_236.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_236.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r9
push %rax
push %rbx
push %rdx
push %rsi
lea addresses_WC_ht+0x58cd, %r13
nop
nop
nop
and %r9, %r9
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
movups %xmm4, (%r13)
nop
nop
nop
cmp %r9, %r9
lea addresses_WC_ht+0x1d24d, %rax
nop
nop
nop
nop
nop
add %rsi, %rsi
movl $0x61626364, (%rax)
dec %rsi
lea addresses_D_ht+0xdeb1, %r14
nop
nop
dec %rdx
mov (%r14), %bx
nop
nop
nop
nop
inc %rsi
lea addresses_A_ht+0x161b5, %r13
nop
nop
nop
nop
and %r9, %r9
movw $0x6162, (%r13)
nop
nop
nop
add $57246, %rdx
pop %rsi
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WT+0x20c, %r8
nop
nop
nop
xor %r13, %r13
mov $0x5152535455565758, %r10
movq %r10, %xmm0
and $0xffffffffffffffc0, %r8
vmovntdq %ymm0, (%r8)
nop
nop
nop
nop
nop
cmp $27104, %r10
// REPMOV
lea addresses_PSE+0x1464d, %rsi
lea addresses_D+0x590f, %rdi
clflush (%rsi)
nop
nop
nop
inc %r13
mov $10, %rcx
rep movsw
nop
and %rsi, %rsi
// Faulty Load
lea addresses_PSE+0x1464d, %rdi
clflush (%rdi)
nop
nop
add %rcx, %rcx
mov (%rdi), %esi
lea oracles, %r8
and $0xff, %rsi
shlq $12, %rsi
mov (%r8,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_PSE', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 1, 'same': False}}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}}
{'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
*/
| 39.143885 | 2,999 | 0.658519 |
ebe5beef947b3a28d00bd84f75798bed16d87c4d | 6,584 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1825.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1825.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1825.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xfcd, %r14
clflush (%r14)
nop
sub $15180, %rsi
movb $0x61, (%r14)
nop
nop
nop
nop
add %r12, %r12
lea addresses_D_ht+0x141ad, %r9
nop
nop
sub $35078, %rbp
mov $0x6162636465666768, %r15
movq %r15, %xmm6
movups %xmm6, (%r9)
sub %r14, %r14
lea addresses_normal_ht+0x1488d, %rsi
lea addresses_normal_ht+0x14ccd, %rdi
clflush (%rdi)
nop
nop
add %r15, %r15
mov $54, %rcx
rep movsl
nop
nop
nop
nop
nop
add $43734, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r9
push %rbp
push %rdi
push %rsi
// Store
lea addresses_UC+0xb675, %r9
xor %r12, %r12
mov $0x5152535455565758, %rdi
movq %rdi, %xmm4
movups %xmm4, (%r9)
inc %r9
// Store
lea addresses_normal+0x1f621, %rbp
nop
nop
nop
dec %rdi
movl $0x51525354, (%rbp)
nop
nop
nop
nop
nop
cmp %r12, %r12
// Store
lea addresses_D+0x156ad, %r12
add $61746, %r10
mov $0x5152535455565758, %r11
movq %r11, (%r12)
// Exception!!!
nop
nop
mov (0), %rbp
nop
nop
nop
sub %rdi, %rdi
// Load
lea addresses_UC+0x1d22b, %rbp
nop
nop
nop
nop
nop
add $1355, %rsi
vmovups (%rbp), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rdi
nop
xor %r11, %r11
// Store
lea addresses_UC+0x1731d, %r12
and $4214, %r10
mov $0x5152535455565758, %r11
movq %r11, %xmm2
vmovups %ymm2, (%r12)
nop
nop
xor %r10, %r10
// Store
mov $0x5c874100000004cd, %rbp
nop
add %r12, %r12
mov $0x5152535455565758, %r10
movq %r10, (%rbp)
nop
nop
sub $40122, %r12
// Store
lea addresses_normal+0x964d, %rsi
nop
nop
sub $3103, %r11
movw $0x5152, (%rsi)
cmp $38602, %rsi
// Faulty Load
lea addresses_normal+0x19ccd, %r9
nop
sub $48580, %rdi
mov (%r9), %r10w
lea oracles, %r12
and $0xff, %r10
shlq $12, %r10
mov (%r12,%r10,1), %r10
pop %rsi
pop %rdi
pop %rbp
pop %r9
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': True, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
| 36.175824 | 2,999 | 0.655984 |
812718a441ac505b40ee3c6cc0a00700c9566e63 | 759 | asm | Assembly | libsrc/_DEVELOPMENT/stdio/z80/output_helpers/__stdio_printf_ln.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/stdio/z80/output_helpers/__stdio_printf_ln.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/stdio/z80/output_helpers/__stdio_printf_ln.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_clib
SECTION code_stdio
PUBLIC __stdio_printf_ln
EXTERN __stdio_nextarg_hl
__stdio_printf_ln:
; %ln converter called from vfprintf()
;
; enter : ix = FILE *
; hl = void *stack_param
; stack = buffer_digits, width, precision
;
; exit : carry reset
pop de
pop de
pop de ; clear stack
call __stdio_nextarg_hl ; hl = long *
or h
ret z ; if given nullptr
exx
push hl
exx
pop de ; de = count of chars output thus far
xor a
ld (hl),e
inc hl
ld (hl),d ; store count
inc hl
ld (hl),a
inc hl
ld (hl),a
ret ; carry reset
| 16.866667 | 68 | 0.500659 |
828482e3ceae95c963af99bd218742c50b122133 | 736 | asm | Assembly | PRG/objects/8-FA.asm | narfman0/smb3_pp1 | 38a58adafff67a403591e38875e9fae943a5fe76 | [
"Unlicense"
] | null | null | null | PRG/objects/8-FA.asm | narfman0/smb3_pp1 | 38a58adafff67a403591e38875e9fae943a5fe76 | [
"Unlicense"
] | null | null | null | PRG/objects/8-FA.asm | narfman0/smb3_pp1 | 38a58adafff67a403591e38875e9fae943a5fe76 | [
"Unlicense"
] | null | null | null | .byte $00 ; Unknown purpose
.byte OBJ_PODOBOO, $14, $13
.byte OBJ_PODOBOO, $1E, $11
.byte OBJ_THWOMP, $2E, $10
.byte OBJ_PODOBOO, $32, $12
.byte OBJ_PODOBOO, $38, $13
.byte OBJ_PSWITCHDOOR, $3B, $15
.byte OBJ_PODOBOO, $3C, $12
.byte OBJ_PODOBOO, $49, $13
.byte OBJ_PODOBOO, $4E, $12
.byte OBJ_THWOMP, $52, $10
.byte OBJ_PODOBOO, $57, $13
.byte OBJ_PODOBOO, $5C, $10
.byte OBJ_PODOBOO, $5E, $13
.byte OBJ_PODOBOO, $69, $12
.byte OBJ_PSWITCHDOOR, $74, $16
.byte OBJ_ROTODISCDUALOPPOSE, $A2, $14
.byte OBJ_PSWITCHDOOR, $AA, $13
.byte OBJ_BOO, $B2, $12
.byte OBJ_ROTODISCDUALCCLOCK, $B7, $16
.byte OBJ_PSWITCHDOOR, $C4, $13
.byte OBJ_THWOMPLEFTSLIDE, $CD, $18
.byte OBJ_PSWITCHDOOR, $CE, $13
.byte $FF ; Terminator
| 28.307692 | 39 | 0.67663 |
92bc1c141b33ae83e84f70d15c4c3b5e3a837ebc | 459 | asm | Assembly | ADL/Assemble/Delete/0/SH~R_delete_rear.asm | MaxMorning/LinkedListVisualization | b2a4f8f11ff6f6dfb495566a006e3472f1dac369 | [
"Apache-2.0"
] | 3 | 2021-11-06T03:47:08.000Z | 2021-11-06T03:47:11.000Z | ADL/Assemble/Delete/0/SH~R_delete_rear.asm | MaxMorning/LinkedListVisualization | b2a4f8f11ff6f6dfb495566a006e3472f1dac369 | [
"Apache-2.0"
] | null | null | null | ADL/Assemble/Delete/0/SH~R_delete_rear.asm | MaxMorning/LinkedListVisualization | b2a4f8f11ff6f6dfb495566a006e3472f1dac369 | [
"Apache-2.0"
] | 1 | 2021-11-06T03:47:14.000Z | 2021-11-06T03:47:14.000Z | aLine 0
gNewVPtr nextPtr
gMoveNext nextPtr, Root
gBne nextPtr, null, 3
aLine 1
Exception EMPTY_LIST
aLine 3
gNew prevPtr
gMove prevPtr, Root
aLine 4
gNew delPtr
gMove delPtr, nextPtr
gMoveNext nextPtr, delPtr
aLine 5
gBeq nextPtr, null, 7
aLine 6
gMove prevPtr, delPtr
aLine 7
gMove delPtr, nextPtr
gMoveNext nextPtr, nextPtr
Jmp -7
aLine 9
pDeleteNext prevPtr
aLine 10
nDelete delPtr
aLine 11
gDelete delPtr
gDelete prevPtr
gDelete nextPtr
aStd
Halt | 11.475 | 26 | 0.801743 |
24d88d0b16bd3fd92a331ee1398935d0a7011cef | 279 | asm | Assembly | programs/oeis/122/A122039.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/122/A122039.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/122/A122039.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A122039: Duplicate of A083706
; 1,4,9,18,35,68,133,262,519,1032,2057,4106,8203,16396,32781,65550,131087,262160,524305,1048594,2097171,4194324,8388629,16777238,33554455,67108888,134217753,268435482,536870939,1073741852,2147483677
mov $1,2
pow $1,$0
mul $1,2
add $1,$0
sub $1,1
| 31 | 198 | 0.774194 |
b8f6d0eb9e73bd1c94055e3d289c8abf6e8f4d6c | 194 | asm | Assembly | libvig/kernel/asm/multiboot1_header.asm | pmdm56/vigor | 0a65733a2b7bf48fc7d6071ea89c1af36f1cba80 | [
"MIT"
] | 36 | 2019-09-06T15:33:31.000Z | 2022-02-02T21:11:36.000Z | libvig/kernel/asm/multiboot1_header.asm | pmdm56/vigor | 0a65733a2b7bf48fc7d6071ea89c1af36f1cba80 | [
"MIT"
] | 3 | 2019-10-03T10:33:19.000Z | 2020-08-10T13:06:01.000Z | libvig/kernel/asm/multiboot1_header.asm | pmdm56/vigor | 0a65733a2b7bf48fc7d6071ea89c1af36f1cba80 | [
"MIT"
] | 9 | 2019-09-18T15:12:29.000Z | 2021-01-20T12:45:01.000Z | section .multiboot_header
header_start:
dd 0x1BADB002 ; magic number (multiboot 1)
dd 3 ; multiboot flags
dd -(0x1BADB002 + 3) ; header checksum
header_end:
| 21.555556 | 53 | 0.628866 |
1b9a5bc6fb6dd525689e3cb585305baa0389ffeb | 1,526 | asm | Assembly | programs/oeis/017/A017513.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/017/A017513.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/017/A017513.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A017513: a(n) = (11*n + 10)^5.
; 100000,4084101,33554432,147008443,459165024,1160290625,2535525376,4984209207,9039207968,15386239549,24883200000,38579489651,57735339232,83841135993,118636749824,164130859375,222620278176,296709280757,389328928768,503756397099,643634300000,812990017201,1016255020032,1258284197543,1544375182624,1880287678125,2272262782976,2727042318307,3251888153568,3854601532649,4543542400000,5327648726751,6216455836832,7220115733093,8349416423424,9615801246875,11031388199776,12608989261857,14362129722368,16305067506199,18452812500000,20821145878301,23426639429632,26286674882643,29419463232224,32844064065625,36580404888576,40649300451407,45072472075168,49872566977749,55073177600000,60698860931851,66775157838432,73328612386193,80386791169024,87978302634375,96132816409376,104881082626957,114254951251968,124287391407299,135012510700000,146465574547401,158683025503232,171702502583743,185562860593824,200304189453125,215967833522176,232596410928507,250233832892768,268925323054849,288717436800000,309658080584951,331796531264032,355183455415293,379870928666624,405912455021875,433362986186976,462278940896057,492718224237568,524740246980399,558405944900000,593777798104501,630919850360832,669897728420843,710778661347424,753631499840625,798526735563776,845536520469607,894734686126368,946196763043949,1000000000000000,1056223383366051,1114947656433632,1176255338740393,1240230745396224,1306960006409375,1376531086012576,1449033801989157,1524559844999168,1603202797905499
mul $0,11
add $0,10
pow $0,5
| 218 | 1,462 | 0.912844 |
8889704fee3ad5f71b721ac449dc32cff61a098f | 2,571 | asm | Assembly | Benchmark/fillin_v09.asm | DW0RKiN/M4_FORTH | b441b545707a12e5561cd50cbe902745caa9ed10 | [
"MIT"
] | 2 | 2020-09-12T08:26:40.000Z | 2022-03-08T23:06:19.000Z | Benchmark/fillin_v09.asm | DW0RKiN/M4_FORTH | b441b545707a12e5561cd50cbe902745caa9ed10 | [
"MIT"
] | null | null | null | Benchmark/fillin_v09.asm | DW0RKiN/M4_FORTH | b441b545707a12e5561cd50cbe902745caa9ed10 | [
"MIT"
] | 2 | 2021-02-05T05:43:02.000Z | 2021-06-30T19:10:15.000Z | ORG 32768
; === b e g i n ===
ld (Stop+1), SP ; 4:20 init storing the original SP value when the "bye" word is used
ld L, 0x1A ; 2:7 init Upper screen
call 0x1605 ; 3:17 init Open channel
ld HL, 60000 ; 3:10 init Init Return address stack
exx ; 1:4 init
call Fillin ; 3:17 scall
Stop: ; stop
ld SP, 0x0000 ; 3:10 stop restoring the original SP value when the "bye" word is used
ld HL, 0x2758 ; 3:10 stop
exx ; 1:4 stop
ret ; 1:10 stop
; ===== e n d =====
; --- the beginning of a data stack function ---
Fillin: ; ( -- )
push DE ; 1:11 push(0x4000)
ex DE, HL ; 1:4 push(0x4000)
ld HL, 0x4000 ; 3:10 push(0x4000)
begin101: ; begin 101
push DE ; 1:11 dup
ld D, H ; 1:4 dup
ld E, L ; 1:4 dup ( a -- a a )
push DE ; 1:11 push(255)
ex DE, HL ; 1:4 push(255)
ld HL, 255 ; 3:10 push(255)
ex DE, HL ; 1:4 swap ( b a -- a b )
ld (HL),E ; 1:7 C! cstore ( char addr -- )
pop HL ; 1:10 C! cstore
pop DE ; 1:10 C! cstore 1
add HL, DE ; 1:11 +
pop DE ; 1:10 +
push DE ; 1:11 dup
ld D, H ; 1:4 dup
ld E, L ; 1:4 dup ( a -- a a )
push DE ; 1:11 push(0x5B00)
ex DE, HL ; 1:4 push(0x5B00)
ld HL, 0x5B00 ; 3:10 push(0x5B00)
or A ; 1:4 =
sbc HL, DE ; 2:15 =
ld HL, 0x0000 ; 3:10 =
jr nz, $+3 ; 2:7/12 =
dec HL ; 1:6 =
pop DE ; 1:10 =
ld A, H ; 1:4 until 101
or L ; 1:4 until 101
ex DE, HL ; 1:4 until 101
pop DE ; 1:10 until 101
jp z, begin101 ; 3:10 until 101
break101: ; until 101
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
Fillin_end:
ret ; 1:10 s;
; --------- end of data stack function ---------
| 41.467742 | 102 | 0.346169 |
b47998e43d9f8a8684fe0bd1379cf8e1fc786a74 | 345 | asm | Assembly | REM/week 06/Project32_VS2019/AddSub2.asm | dodieboy/Np_class | af9ec993eda3c1e2bf70257c8384696bb64a5e9d | [
"MIT"
] | null | null | null | REM/week 06/Project32_VS2019/AddSub2.asm | dodieboy/Np_class | af9ec993eda3c1e2bf70257c8384696bb64a5e9d | [
"MIT"
] | null | null | null | REM/week 06/Project32_VS2019/AddSub2.asm | dodieboy/Np_class | af9ec993eda3c1e2bf70257c8384696bb64a5e9d | [
"MIT"
] | 2 | 2021-03-30T00:46:58.000Z | 2021-12-12T23:41:12.000Z | TITLE Add and Subtract, Version 2 (AddSub2.asm)
; This program adds and subtracts 32-bit integers
; and stores the sum in a variable.
INCLUDE Irvine32.inc
.data
area SDWORD 0
l SDWORD 30
w SDWORD 20
.code
main PROC
mov eax,l
mul w
mov area,eax
INVOKE ExitProcess,0 ; program ends
main ENDP
END main | 15.681818 | 55 | 0.669565 |
a7464b8159317b59d0d6db166ff67c51b3f04b62 | 804 | asm | Assembly | oeis/281/A281773.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/281/A281773.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/281/A281773.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A281773: Number of distinct topologies on an n-set that have exactly 4 open sets.
; 0,0,1,9,43,165,571,1869,5923,18405,56491,172029,521203,1573845,4742011,14266989,42882883,128812485,386765131,1160950749,3484162963,10455110325,31370573851,94122207309,282387593443,847204723365,2541698056171,7625261940669,22876121366323,68629035187605,205888447740091,617668027574829,1853009451433603,5559039091719045,16677138749993611,50031459199653789,150094463498307283,450283562293613685,1350851030478224731,4052553778629441549,12157662710277859363,36472990879612647525,109418978136396081451
mov $3,5
lpb $0
sub $0,1
mov $1,$2
add $2,1
mov $4,10
add $4,$2
add $2,$4
add $2,$1
add $5,2
add $6,5
sub $6,$3
trn $3,4
trn $6,$5
trn $5,$2
sub $2,6
mul $6,2
lpe
sub $1,$6
trn $1,1
mov $0,$1
| 32.16 | 496 | 0.771144 |
1b91326bb4920e02e6d02a5f0989f6a9b9a48a3b | 1,046 | asm | Assembly | solutions/36 - Seek and Destroy 2/size-57_speed-64.asm | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 45 | 2018-09-05T04:56:59.000Z | 2021-11-22T08:57:26.000Z | solutions/36 - Seek and Destroy 2/size-57_speed-64.asm | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 36 | 2018-09-01T11:34:26.000Z | 2021-05-19T23:20:49.000Z | solutions/36 - Seek and Destroy 2/size-57_speed-64.asm | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 36 | 2018-09-01T07:44:19.000Z | 2021-09-10T19:07:35.000Z | -- 7 Billion Humans (2053) --
-- 36: Seek and Destroy 2 --
-- Author: ansvonwa
-- Size: 57
-- Speed: 64
-- Speed Tests: 64, 64, 63, 64, 63
a:
b:
step n
mem1 = set n
if mem1 == nothing:
jump b
endif
c:
step n
mem2 = set n
if mem2 == nothing:
jump c
endif
if mem2 < mem1:
mem3 = set mem1
mem1 = set mem2
mem2 = set mem3
endif
d:
step n
mem3 = set n
if mem3 == nothing:
jump d
endif
if mem3 < mem2:
if mem3 < mem1:
mem4 = set mem3
mem3 = set mem2
mem2 = set mem1
mem1 = set mem4
else:
mem4 = set mem3
mem3 = set mem2
mem2 = set mem4
endif
endif
mem4 = set 99
e:
f:
step n
if n <= mem4:
mem4 = set n
if mem4 < mem2:
if mem4 < mem1:
mem4 = set mem3
mem3 = set mem2
mem2 = set mem1
mem1 = set n
else:
mem4 = set mem3
mem3 = set mem2
mem2 = set n
endif
else:
if mem4 < mem3:
mem4 = set mem3
mem3 = set n
endif
endif
jump f
endif
if n != wall:
jump e
endif
pickup mem1
mem1 = nearest shredder
giveto mem1
pickup mem2
giveto mem1
pickup mem3
giveto mem1
pickup mem4
giveto mem1
jump a
| 12.305882 | 34 | 0.629063 |
f6de770d0b5fb10079f3fe9633af2b768efcdc0f | 577 | asm | Assembly | oeis/052/A052203.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/052/A052203.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/052/A052203.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A052203: a(n) = (4n+1)*binomial(4n,n)/(3n+1).
; 1,5,36,286,2380,20349,177100,1560780,13884156,124403620,1121099408,10150595910,92263734836,841392966470,7694644696200,70539987842520,648045936942300,5964720367660956,54991682779774384,507749884105448600,4694436188839116720,43455233608636031325,402696352496587217580,3735497878529723371260,34683105208922671140900,322295345286237489770604,2997286799661158774479920,27894306911408446607922964,259772617021886376013968824,2420703166820738594302364220,22570540550071279978512845776
mov $1,4
mul $1,$0
add $1,1
bin $1,$0
mov $0,$1
| 64.111111 | 479 | 0.863085 |
eb4b4f2dba99008aaf7ec34ca0754a7b8fc6d6cc | 2,292 | asm | Assembly | engine/menu/start_menu.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | engine/menu/start_menu.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | engine/menu/start_menu.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | DisplayStartMenu::
ld a, BANK(StartMenu_Pokedex)
ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a
ld a, [wWalkBikeSurfState] ; walking/biking/surfing
ld [wWalkBikeSurfStateCopy], a
ld a, SFX_START_MENU
call PlaySound
RedisplayStartMenu::
callba DrawStartMenu
callba PrintSafariZoneSteps ; print Safari Zone info, if in Safari Zone
call UpdateSprites
.loop
call HandleMenuInput
ld b, a
.checkIfUpPressed
bit 6, a ; was Up pressed?
jr z, .checkIfDownPressed
ld a, [wCurrentMenuItem] ; menu selection
and a
jr nz, .loop
ld a, [wLastMenuItem]
and a
jr nz, .loop
; if the player pressed tried to go past the top item, wrap around to the bottom
CheckEvent EVENT_GOT_POKEDEX
ld a, 6 ; there are 7 menu items with the pokedex, so the max index is 6
jr nz, .wrapMenuItemId
dec a ; there are only 6 menu items without the pokedex
.wrapMenuItemId
ld [wCurrentMenuItem], a
call EraseMenuCursor
jr .loop
.checkIfDownPressed
bit 7, a
jr z, .buttonPressed
; if the player pressed tried to go past the bottom item, wrap around to the top
CheckEvent EVENT_GOT_POKEDEX
ld a, [wCurrentMenuItem]
ld c, 7 ; there are 7 menu items with the pokedex
jr nz, .checkIfPastBottom
dec c ; there are only 6 menu items without the pokedex
.checkIfPastBottom
cp c
jr nz, .loop
; the player went past the bottom, so wrap to the top
xor a
ld [wCurrentMenuItem], a
call EraseMenuCursor
jr .loop
.buttonPressed ; A, B, or Start button pressed
call PlaceUnfilledArrowMenuCursor
ld a, [wCurrentMenuItem]
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
ld a, b
and %00001010 ; was the Start button or B button pressed?
jp nz, CloseStartMenu
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
CheckEvent EVENT_GOT_POKEDEX
ld a, [wCurrentMenuItem]
jr nz, .displayMenuItem
inc a ; adjust position to account for missing pokedex menu item
.displayMenuItem
cp 0
jp z, StartMenu_Pokedex
cp 1
jp z, StartMenu_Pokemon
cp 2
jp z, StartMenu_Item
cp 3
jp z, StartMenu_TrainerInfo
cp 4
jp z, StartMenu_SaveReset
cp 5
jp z, StartMenu_Option
; EXIT falls through to here
CloseStartMenu::
call Joypad
ld a, [hJoyPressed]
bit 0, a ; was A button newly pressed?
jr nz, CloseStartMenu
call LoadTextBoxTilePatterns
jp CloseTextDisplay
| 26.651163 | 81 | 0.766579 |
a33f78fa543af6f6e27c306d044ddfb1e8a97cf1 | 337 | asm | Assembly | Chapter_5/Program 5.1/x86/Program_5.1_NASM.asm | chen150182055/Assembly | e5e76bea438a3752b59775098205a77aa7087110 | [
"MIT"
] | 272 | 2016-12-28T02:24:21.000Z | 2022-03-30T21:05:37.000Z | Chapter_5/Program 5.1/x86/Program_5.1_NASM.asm | chen150182055/Assembly | e5e76bea438a3752b59775098205a77aa7087110 | [
"MIT"
] | 1 | 2018-04-17T19:47:52.000Z | 2018-04-17T19:47:52.000Z | Chapter_5/Program 5.1/x86/Program_5.1_NASM.asm | chen150182055/Assembly | e5e76bea438a3752b59775098205a77aa7087110 | [
"MIT"
] | 62 | 2017-02-02T14:39:37.000Z | 2022-01-04T09:02:07.000Z | ; Program 5.1
; Conditional Jump - NASM (32-bit)
; Copyright (c) 2017 Hall & Slonka
SECTION .data
wages: DD 46000
SECTION .bss
taxes: RESD 1
SECTION .text
global _main
_main:
mov eax, 50000
cmp DWORD [wages], eax
jae higher
mov DWORD [taxes], 2000
jmp done
higher:
mov DWORD [taxes], 4000
done:
mov eax, 1
mov ebx, 0
int 80h
| 12.035714 | 34 | 0.694362 |
f61dc93acc97ce9472e5ea0e250e66016c73c90e | 4,934 | asm | Assembly | src/core/utilities.asm | endstation/golf | 5784b06e5b025c7c52b9b6ebcba2c62592730804 | [
"BSD-2-Clause"
] | 1 | 2022-02-13T16:09:18.000Z | 2022-02-13T16:09:18.000Z | src/core/utilities.asm | 1888games/golf | 5078fc0699e5f91a53761cc30526b510d49e955c | [
"BSD-2-Clause"
] | null | null | null | src/core/utilities.asm | 1888games/golf | 5078fc0699e5f91a53761cc30526b510d49e955c | [
"BSD-2-Clause"
] | 1 | 2022-02-12T23:40:10.000Z | 2022-02-12T23:40:10.000Z | ; Top-hole Golf
; Copyright 2020-2021 Matthew Clarke
; Various stuff which doesn't fit in anywhere else.
; *****************
; *** CONSTANTS ***
; *****************
utils_l_HEX2DEC_LOOKUP
!byte 1,0,0,0,0
!byte 2,0,0,0,0
!byte 4,0,0,0,0
!byte 8,0,0,0,0
!byte 6,1,0,0,0
!byte 2,3,0,0,0
!byte 4,6,0,0,0
!byte 8,2,1,0,0
!byte 6,5,2,0,0
!byte 2,1,5,0,0
!byte 4,2,0,1,0
!byte 8,4,0,2,0
!byte 6,9,0,4,0
!byte 2,9,1,8,0
!byte 4,8,3,6,1
!byte 8,6,7,2,3
utils_c_HEX2DEC_RESULT_SIZE_BYTES = 5
utils_l_BIT_LOOKUP !byte $01,$02,$04,$08,$10,$20,$40,$80
utils_l_EOR_BIT_LOOKUP !byte $fe,$fd,$fb,$f7,$ef,$df,$bf,$7f
; *****************
; *** VARIABLES ***
; *****************
; NOTE: stored lsb first.
utils_v_dec_digits !fill 5
; *******************
; ****** MACROS *****
; *******************
; *******************
; *** SUBROUTINES ***
; *******************
; INPUT: copy value into P0-P1 (low byte first).
; OUTPUT: digits in reverse order in utils_v_dec_digits; number of digits in .X
!zone {
.bit_counter !byte 0
utils_s_16bit_hex_to_dec
; Clear out the results area first.
ldx #4
lda #0
- sta utils_v_dec_digits,x
dex
bpl -
; '.bit_counter' goes from 15-0. Once it's negative, we're done.
lda #15
sta .bit_counter
; X tracks position in lookup table.
ldx #0
.loop_top
lsr P1
ror P0
bcc .skip
; Use Y to count to 5.
ldy #0
clc
- lda utils_v_dec_digits,y
adc utils_l_HEX2DEC_LOOKUP,x
; Force carry if result >= 10.
cmp #10
bcc .ok
; NOTE: C flag will be set.
sbc #10
; NOTE: C flag will still be set.
.ok
sta utils_v_dec_digits,y
inx
iny
; Preserve status of 'C' flag during following comparison.
php
cpy #5
beq +
plp
jmp -
+
plp
jmp .next_bit
.skip
; Advance lookup table iterator, since it wasn't used this time round.
txa
clc
adc #utils_c_HEX2DEC_RESULT_SIZE_BYTES
tax
.next_bit
dec .bit_counter
bpl .loop_top
; Find length.
; Look at each value starting at the end of the array and stop as soon as
; it's not zero. Length is then .X+1.
ldx #4
- lda utils_v_dec_digits,x
bne .found
dex
bpl -
.found
inx
; Make sure it's at least 1!
bne +
inx
+
rts
; end sub utils_s_16bit_hex_to_dec
} ; !zone
; **************************************************
; INPUTS: P0-P1 = address of indices, P2 = number of elements
; NOTE: write address of 'compare' subroutine into location utils_comp+1.
!zone {
.did_swap !byte 0
.iter !byte 0
utils_s_bubble_sort
.outer_loop
lda #0
sta .iter
sta .did_swap
.inner_loop
; If .iter >= n, inner loop is complete.
ldx .iter
inx
cpx P2
bcc +
; Loop is complete. If no swaps occurred, we're done.
lda .did_swap
beq .end
; So not done yet. Back round for another go.
jmp .outer_loop
+
; Load the next two indices into P3 and P4, then call the 'compare'
; routine.
ldy .iter
lda (P0),y
sta P3
iny
lda (P0),y
sta P4
utils_s_comp
; NOTE: $ffcc is a dummy placeholder. Actual address of compare
; routine should be written here.
jsr $ffcc
bcc +
; C flag set, so we must swap these two indices.
ldy .iter
lda (P0),y
tax ; First element into X.
iny
lda (P0),y
pha ; Second element onto stack.
; Y is pointing to the second slot.
txa
sta (P0),y
dey
; Now Y is pointing to the first slot.
pla
sta (P0),y
; Record that a swap has taken place.
lda #1
sta .did_swap
+
inc .iter
jmp .inner_loop
.end
rts
; end sub utils_s_bubble_sort
} ; !zone
; **************************************************
; Rotate bits in accumulator right twice.
!zone {
utils_s_ror_two_bits
pha
lsr
pla
ror
pha
lsr
pla
ror
rts
; end sub utils_s_ror_two_bits
} ; !zone
; **************************************************
; INPUTS: P0-P1 = buffer address
; X = number of bytes to write
; OUTPUTS: Y = number of bytes written.
!zone {
utils_s_write_digits_to_buffer
ldy #0
dex
-
lda utils_v_dec_digits,x
clc
adc #font_c_ASCII_0
sta (P0),y
iny
dex
bpl -
rts
; end sub utils_s_write_digits_to_buffer
} ; !zone
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
| 19.895161 | 81 | 0.501216 |
d229c3d21eadf4f3ac39989905ae985feefc9160 | 37 | asm | Assembly | src/main/fragment/csg65ce02-common/vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/main/fragment/csg65ce02-common/vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/main/fragment/csg65ce02-common/vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | eor ({z1}),z
beq !+
lda #1
!:
eor #1
| 6.166667 | 12 | 0.459459 |
cf53b138032a5ef9a789b80070b725b598de531f | 7,644 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1940.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1940.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1940.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1a860, %rsi
lea addresses_WT_ht+0x123e0, %rdi
clflush (%rsi)
nop
add $36377, %r8
mov $112, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $51581, %rsi
lea addresses_WC_ht+0x3ee0, %r15
sub %r11, %r11
movl $0x61626364, (%r15)
nop
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_D_ht+0x19010, %rsi
lea addresses_D_ht+0x3dd0, %rdi
nop
nop
nop
add %r15, %r15
mov $127, %rcx
rep movsb
nop
nop
nop
nop
and %r15, %r15
lea addresses_WT_ht+0x1b6e0, %rcx
nop
nop
inc %rdi
vmovups (%rcx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r8
cmp $10210, %r8
lea addresses_A_ht+0x10148, %rcx
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %r11
movq %r11, %xmm4
movups %xmm4, (%rcx)
nop
nop
nop
add $17391, %r8
lea addresses_A_ht+0x11e60, %rsi
nop
nop
nop
inc %r9
mov (%rsi), %r8w
nop
nop
nop
nop
nop
sub %r15, %r15
lea addresses_UC_ht+0x14ce0, %rsi
lea addresses_UC_ht+0x10560, %rdi
nop
nop
nop
nop
and $2343, %rdx
mov $28, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $6634, %r15
lea addresses_D_ht+0x3bd4, %rdi
nop
nop
xor %rsi, %rsi
vmovups (%rdi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r11
nop
nop
cmp $7292, %r11
lea addresses_WT_ht+0x15f78, %rsi
lea addresses_normal_ht+0x1e054, %rdi
nop
nop
nop
sub $36709, %rdx
mov $114, %rcx
rep movsq
nop
sub $61488, %r11
lea addresses_WC_ht+0xb690, %r9
dec %r11
movw $0x6162, (%r9)
nop
add $25214, %r9
lea addresses_UC_ht+0x160e0, %rdx
nop
nop
xor %rcx, %rcx
movups (%rdx), %xmm0
vpextrq $1, %xmm0, %r9
nop
cmp %r15, %r15
lea addresses_WT_ht+0x1a8ee, %rsi
nop
nop
nop
nop
nop
sub %r9, %r9
movb (%rsi), %r8b
nop
nop
sub $33959, %rdx
lea addresses_A_ht+0x1c860, %rsi
lea addresses_normal_ht+0xdfe0, %rdi
nop
nop
cmp %r11, %r11
mov $94, %rcx
rep movsw
sub $29361, %rdi
lea addresses_UC_ht+0x12bb, %rsi
lea addresses_D_ht+0x479c, %rdi
nop
nop
nop
nop
nop
cmp %r11, %r11
mov $41, %rcx
rep movsw
nop
nop
nop
nop
nop
add %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %rax
push %rbx
push %rcx
push %rdx
// Faulty Load
lea addresses_normal+0x132e0, %r10
nop
nop
nop
sub $44555, %rbx
mov (%r10), %rax
lea oracles, %r10
and $0xff, %rax
shlq $12, %rax
mov (%r10,%rax,1), %rax
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
| 34.432432 | 2,999 | 0.658948 |
d1b0e5dfecf1a99e3c66e9788f9466c1a1191340 | 591 | asm | Assembly | lab05/4-sets/sets.asm | adinasm/iocla-demos | a4109ed9fd3a34b097299f941617a6380267c003 | [
"MIT"
] | null | null | null | lab05/4-sets/sets.asm | adinasm/iocla-demos | a4109ed9fd3a34b097299f941617a6380267c003 | [
"MIT"
] | null | null | null | lab05/4-sets/sets.asm | adinasm/iocla-demos | a4109ed9fd3a34b097299f941617a6380267c003 | [
"MIT"
] | null | null | null | %include "printf32.asm"
section .text
global main
extern printf
main:
;cele doua multimi se gasesc in eax si ebx
mov eax, 139 ; 128 + 8 + 2 + 1 {7 , 3, 1, 0}
mov ebx, 169 ;
PRINTF32 `%u\n\x0`, eax ; afiseaza prima multime
PRINTF32 `%u\n\x0`, ebx ; afiseaza cea de-a doua multime
; TODO1: reuniunea a doua multimi
; TODO2: adaugarea unui element in multime
; TODO3: intersectia a doua multimi
; TODO4: complementul unei multimi
; TODO5: eliminarea unui element
; TODO6: diferenta de multimi EAX-EBX
xor eax, eax
ret
| 17.382353 | 60 | 0.632826 |
7e582fa6f4e65b41ac3827ca61628cec23947db9 | 1,073 | asm | Assembly | source/modules/basic/tokenise/testing/tokenisetest.asm | paulscottrobson/mega-basic | f71750889136e2fdc4e6053c5696593318162bcf | [
"MIT"
] | 3 | 2019-12-03T06:05:24.000Z | 2021-03-24T01:51:07.000Z | source/modules/basic/tokenise/testing/tokenisetest.asm | paulscottrobson/mega-basic | f71750889136e2fdc4e6053c5696593318162bcf | [
"MIT"
] | null | null | null | source/modules/basic/tokenise/testing/tokenisetest.asm | paulscottrobson/mega-basic | f71750889136e2fdc4e6053c5696593318162bcf | [
"MIT"
] | null | null | null | ; *******************************************************************************************
; *******************************************************************************************
;
; Name : tokenisetest.asm
; Purpose : Test skeleton, tokenise ASCII string
; Date : 2nd September 2019
; Author : Paul Robson (paul@robsons.org.uk)
;
; *******************************************************************************************
; *******************************************************************************************
TokeniseTest: ; tokenise IFT_LineBuffer -> TokenBuffer
; and exit.
#ResetStack
ldx #255
_ttCopy:inx
lda TokeniseTestIn,x
sta IFT_LineBuffer,x
bne _ttCopy
lda #IFT_LineBuffer & $FF
ldx #IFT_LineBuffer >> 8
jsr TokeniseString
ldx #0
_ttCompare:
lda TokeniseBuffer+3,x
cmp TokeniseTestOut,x
_ttStop:bne _ttStop
inx
cpx #TokeniseTestOutEnd-TokeniseTestOut
bne _ttCompare
jsr IFT_ClearScreen
lda #42
jsr IFT_PrintCharacter
#exit
_ttWait:bra _ttWait
.include "tokentest.src" | 29 | 93 | 0.458527 |
86eff740d4e5e14e62dcf1ff20ef2676472c6dcc | 442 | asm | Assembly | 01 - Addition of two byte-numbers (new)/prog01n.asm | xei/x86-assembly-dos-samples | 0ca6c0be493e66d32cedba57c6d78a1c97f52d79 | [
"Apache-2.0"
] | null | null | null | 01 - Addition of two byte-numbers (new)/prog01n.asm | xei/x86-assembly-dos-samples | 0ca6c0be493e66d32cedba57c6d78a1c97f52d79 | [
"Apache-2.0"
] | null | null | null | 01 - Addition of two byte-numbers (new)/prog01n.asm | xei/x86-assembly-dos-samples | 0ca6c0be493e66d32cedba57c6d78a1c97f52d79 | [
"Apache-2.0"
] | null | null | null | ; Program 01 - Addition of two byte-numbers
; Written by Hamidreza Hosseinkhani (hosseinkhani@live.com)
; June, 2011
TITLE Addition of two byte-numbers
.MODEL small
.STACK 40h
.DATA
Num1 DB 0FEh
Num2 DB 0EDh
ORG 000Ah
Sum DW ?
.CODE
Start: mov ax, @DATA
mov ds, ax
mov ah, 00h
mov al, Num1
mov bh, 00h
mov bl, Num2
add ax, bx
mov Sum, ax
mov ax, 4C00h
int 21h
END Start | 13.8125 | 60 | 0.615385 |
d2fa7b0f80326498a930eccf8c7eca7ac4fd365d | 7,766 | asm | Assembly | curve.asm | peckhamdata/cgl-6502 | 65bfe3449b3d684da95a2cd4b2ec5ce7e4d18864 | [
"MIT"
] | 4 | 2020-01-24T06:46:10.000Z | 2022-02-28T15:44:08.000Z | curve.asm | peckhamdata/cgl-6502 | 65bfe3449b3d684da95a2cd4b2ec5ce7e4d18864 | [
"MIT"
] | null | null | null | curve.asm | peckhamdata/cgl-6502 | 65bfe3449b3d684da95a2cd4b2ec5ce7e4d18864 | [
"MIT"
] | 1 | 2020-12-07T19:36:31.000Z | 2020-12-07T19:36:31.000Z | curve_p1_x: .byte 1
curve_p2_x: .byte 15
curve_p3_x: .byte 35
curve_p1_y: .byte 0
curve_p2_y: .byte 8
curve_p3_y: .byte 13
curve_num_segments: .byte $09
.byte $00
curve_vars:
curve_pts_x: .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
curve_pts_y: .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
curve_pts_x_lo: .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
curve_pts_x_hi: .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
curve_pts_y_lo: .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
curve_pts_y_hi: .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
curve_t: .byte $00
.byte $00
curve_t1: .byte $00
.byte $00
curve_a: .byte $00
.byte $00
curve_b: .byte $00
.byte $00
curve_c: .byte $00
.byte $00
curve_plot_char: .byte $3a
curve_fill_char: .byte $00
curve_is_filled: .byte $00
curve_fill_color: .byte $08
.macro curve_set_t() {
lda #$00
sta dividend+1
stx dividend
lda curve_num_segments
sta divisor
lda curve_num_segments+1
sta divisor+1
jsr divide
lda remainder
sta curve_t
lda remainder+1
sta curve_t+1
}
.macro curve_set_t1() {
sec
lda #$0a
sbc curve_t
sta curve_t1
lda #$00
sbc curve_t+1
sta curve_t1+1
}
.macro curve_set_a_b_c() {
// a = Pow(t1, 2)
// https://www.youtube.com/watch?v=EmsbsInpLHs
lda curve_t1
sta num1
sta num2
jsr multiply
sta curve_a
sty curve_a+1
// b = 2.0 * t * t1
lda curve_t
sta num1
lda curve_t+1
sta num1+1
lda curve_t1
sta num2
lda curve_t1+1
sta num2+1
jsr multiply
sta num1
sty num1+1
lda #$02
sta num2
lda #$00
sta num2+1
jsr multiply
sta curve_b
sty curve_b+1
// c = Pow(t, 2)
lda curve_t
sta num1
sta num2
lda curve_t+1
sta num1+1
sta num2+1
jsr multiply
sta curve_c
sty curve_c+1
}
.macro curve_set_x_y() {
// X
lda curve_a
sta num1
lda curve_p1_x
sta num2
lda #$00
sta num1+1
sta num2+1
jsr multiply
sta curve_pts_x_lo,x
tya
sta curve_pts_x_hi,x
lda curve_b
sta num1
lda curve_p2_x
sta num2
lda #$00
sta num1+1
sta num2+1
jsr multiply
adc curve_pts_x_lo,x
sta curve_pts_x_lo,x
tya
adc curve_pts_x_hi,x
sta curve_pts_x_hi,x
lda curve_c
sta num1
lda curve_p3_x
sta num2
lda #$00
sta num1+1
sta num2+1
jsr multiply
adc curve_pts_x_lo,x
sta curve_pts_x_lo,x
tya
adc curve_pts_x_hi,x
sta curve_pts_x_hi,x
// Y
lda curve_a
sta num1
lda curve_p1_y
sta num2
lda #$00
sta num1+1
sta num2+1
jsr multiply
adc curve_pts_y_lo,x
sta curve_pts_y_lo,x
tya
adc curve_pts_y_hi,x
sta curve_pts_y_hi,x
lda curve_b
sta num1
lda curve_p2_y
sta num2
lda #$00
sta num1+1
sta num2+1
jsr multiply
adc curve_pts_y_lo,x
sta curve_pts_y_lo,x
tya
adc curve_pts_y_hi,x
sta curve_pts_y_hi,x
lda curve_c
sta num1
lda curve_p3_y
sta num2
lda #$00
sta num1+1
sta num2+1
jsr multiply
adc curve_pts_y_lo,x
sta curve_pts_y_lo,x
tya
adc curve_pts_y_hi,x
sta curve_pts_y_hi,x
}
.macro curve_shift_right() {
lda curve_pts_x_lo,x
sta dividend
lda curve_pts_x_hi,x
sta dividend+1
lda #$64
sta divisor
lda #$00
sta divisor+1
jsr div16
lda dividend
sta curve_pts_x,x
lda curve_pts_y_lo,x
sta dividend
lda curve_pts_y_hi,x
sta dividend+1
lda #$64
sta divisor
lda #$00
sta divisor+1
jsr div16
lda dividend
sta curve_pts_y,x
}
curve_plot: txa
pha
ldx #$00
lda #$00
!loop: sta (curve_vars),x
inx
cpx #$47
bne !loop-
ldx #$00
!loop:
curve_set_t()
curve_set_t1()
curve_set_a_b_c()
curve_set_x_y()
curve_shift_right()
inx
cpx curve_num_segments
beq !done+
jmp !loop-
!done: ldx #$00
dec curve_num_segments
!loop:
lda (curve_pts_x),x
sta x0
lda (curve_pts_x+1),x
sta x1
lda (curve_pts_y),x
sta y0
lda (curve_pts_y+1),x
sta y1
jsr init_line
jsr plot_line
inx
cpx curve_num_segments
beq !done+
jmp !loop-
!done: pla
tax
rts
| 30.100775 | 80 | 0.339815 |
c017b48ba794f670dc638781ab60647a3b4fd0f0 | 124 | asm | Assembly | examples/file name test/option zxnext ignore.asm | cizo2000/sjasmplus | 615d7c0e09a44aa2a923095fc9ed6dca6ecae4a4 | [
"BSD-3-Clause"
] | 220 | 2016-10-22T19:44:39.000Z | 2022-03-29T20:57:04.000Z | examples/file name test/option zxnext ignore.asm | ped7g/sjasmplus | 487635c8057cd5594c372d9b70bc00a3f3a1ecc4 | [
"BSD-3-Clause"
] | 153 | 2018-05-07T10:31:23.000Z | 2022-03-30T04:35:59.000Z | examples/file name test/option zxnext ignore.asm | ped7g/sjasmplus | 487635c8057cd5594c372d9b70bc00a3f3a1ecc4 | [
"BSD-3-Clause"
] | 51 | 2016-05-12T21:27:36.000Z | 2022-03-27T15:16:16.000Z | ; this file should NOT be assembled by the CI script, it should be on the ignore list
some-invalid-instruction a,123
| 41.333333 | 85 | 0.741935 |
81e7e61c1dbabb52f06bbdc531cb788dd720440b | 3,197 | asm | Assembly | fiat-amd64/10541_eval10of50_ratio09504_seed1785685356_square_poly1305.asm | dderjoel/fiat-crypto | 57a9612577d766a0ae83169ea9517bfa7f01ea4e | [
"BSD-1-Clause",
"Apache-2.0",
"MIT-0",
"MIT"
] | 491 | 2015-11-25T23:44:39.000Z | 2022-03-29T17:31:21.000Z | fiat-amd64/10541_eval10of50_ratio09504_seed1785685356_square_poly1305.asm | dderjoel/fiat-crypto | 57a9612577d766a0ae83169ea9517bfa7f01ea4e | [
"BSD-1-Clause",
"Apache-2.0",
"MIT-0",
"MIT"
] | 755 | 2016-02-02T14:03:05.000Z | 2022-03-31T16:47:23.000Z | fiat-amd64/10541_eval10of50_ratio09504_seed1785685356_square_poly1305.asm | dderjoel/fiat-crypto | 57a9612577d766a0ae83169ea9517bfa7f01ea4e | [
"BSD-1-Clause",
"Apache-2.0",
"MIT-0",
"MIT"
] | 117 | 2015-10-25T16:28:15.000Z | 2022-02-08T23:01:09.000Z | SECTION .text
GLOBAL square_poly1305
square_poly1305:
sub rsp, 0x10
imul rax, [ rsi + 0x10 ], 0x5; x1 <- arg1[2] * 0x5
imul r10, rax, 0x2; x2 <- x1 * 0x2
imul r11, [ rsi + 0x8 ], 0x2; x10001 <- arg1[1] * 0x2
imul rdx, [ rsi + 0x10 ], 0x2; x3 <- arg1[2] * 0x2
imul r10, r10, 0x2; x10000 <- x2 * 0x2
imul rcx, [ rsi + 0x8 ], 0x2; x4 <- arg1[1] * 0x2
mov r8, rdx; preserving value of x3 into a new reg
mov rdx, [ rsi + 0x0 ]; saving arg1[0] in rdx.
mov [ rsp + 0x0 ], r15; spilling callerSaver15 to mem
mulx r9, r15, [ rsi + 0x0 ]; x16, x15<- arg1[0] * arg1[0]
mov rdx, r10; x10000 to rdx
mulx rdx, r10, [ rsi + 0x8 ]; x8, x7<- arg1[1] * x10000
test al, al
adox r10, r15
adox r9, rdx
mov r15, r10; x21, copying x17 here, cause x17 is needed in a reg for other than x21, namely all: , x21, x22, size: 2
shrd r15, r9, 44; x21 <- x19||x17 >> 44
mov rdx, 0xfffffffffff ; moving imm to reg
and r10, rdx; x22 <- x17&0xfffffffffff
xchg rdx, rcx; x4, swapping with 0xfffffffffff, which is currently in rdx
mulx rdx, r9, [ rsi + 0x0 ]; x14, x13<- arg1[0] * x4
xchg rdx, rax; x1, swapping with x14, which is currently in rdx
mov [ rsp + 0x8 ], r14; spilling callerSaver14 to mem
mulx rdx, r14, [ rsi + 0x10 ]; x6, x5<- arg1[2] * x1
adox r14, r9
adcx r14, r15
adox rax, rdx
adc rax, 0x0
mov r15, r14; x34, copying x31 here, cause x31 is needed in a reg for other than x34, namely all: , x34, x35, size: 2
shrd r15, rax, 43; x34 <- x33||x31 >> 43
mov r9, 0x2b ; moving imm to reg
bzhi r14, r14, r9; x35 <- x31 (only least 0x2b bits)
mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx
mulx r8, rax, r8; x12, x11<- arg1[0] * x3
mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx
mulx r11, r9, r11; x10, x9<- arg1[1] * x10001
adox r9, rax
clc;
adcx r9, r15
adox r8, r11
adc r8, 0x0
mov rdx, r9; x39, copying x36 here, cause x36 is needed in a reg for other than x39, namely all: , x39, x40, size: 2
shrd rdx, r8, 43; x39 <- x38||x36 >> 43
mov r15, 0x2b ; moving imm to reg
bzhi r9, r9, r15; x40 <- x36 (only least 0x2b bits)
imul rdx, rdx, 0x5; x41 <- x39 * 0x5
lea r10, [ r10 + rdx ]
mov rax, r10; x43, copying x42 here, cause x42 is needed in a reg for other than x43, namely all: , x43, x44, size: 2
shr rax, 44; x43 <- x42>> 44
lea rax, [ rax + r14 ]
and r10, rcx; x44 <- x42&0xfffffffffff
mov r14, rax; x46, copying x45 here, cause x45 is needed in a reg for other than x46, namely all: , x46, x47, size: 2
shr r14, 43; x46 <- x45>> 43
bzhi rax, rax, r15; x47 <- x45 (only least 0x2b bits)
lea r14, [ r14 + r9 ]
mov [ rdi + 0x0 ], r10; out1[0] = x44
mov [ rdi + 0x8 ], rax; out1[1] = x47
mov [ rdi + 0x10 ], r14; out1[2] = x48
mov r15, [ rsp + 0x0 ] ; pop
mov r14, [ rsp + 0x8 ] ; pop
add rsp, 0x10
ret
; cpu Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
; ratio 0.9504
; seed 1785685356
; CC / CFLAGS clang / -march=native -mtune=native -O3
; time needed: 312 ms / 10 evals=> 31.2ms/eval
; Time spent for assembling and measureing (initial batch_size=374, initial num_batches=31): 49 ms
; number of used evaluations: 10
; Ratio (time for assembling + measure)/(total runtime for 10 evals): 0.15705128205128205
; number reverted permutation/ tried permutation: 7 / 9 =77.778%
; number reverted decision/ tried decision: 1 / 1 =100.000% | 42.065789 | 117 | 0.65624 |
a725034774910aaf0c6029c17d71a457fd9fc90d | 675 | asm | Assembly | oeis/021/A021744.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/021/A021744.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/021/A021744.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A021744: Expansion of 1/((1-x)(1-4x)(1-5x)(1-6x)).
; Submitted by Jon Maiga
; 1,16,167,1442,11193,81228,563179,3779974,24771725,159439280,1012078431,6355276746,39568060897,244679845972,1504794392723,9213774596558,56213415403509,341957238034104,2075218782238855,12569055967480210,76004518190620361,458983885134432476,2768710647008205627,16686394388049524502,100489394158267548253,604793005299333085888,3638047238344140657839,21874753482003567302234,131480967228507071159985,790048419360638965975140,4746105133340489300056291,28505710034840904557882206
add $0,2
lpb $0
sub $0,1
add $2,2
mul $2,6
sub $2,11
mul $3,5
add $3,$1
mul $1,4
add $1,$2
lpe
mov $0,$3
| 39.705882 | 474 | 0.811852 |
32a6af9df826105260d17362bec20950b0a00c38 | 524 | asm | Assembly | programs/oeis/173/A173234.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/173/A173234.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/173/A173234.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A173234: Expansion of x*(1+3*x^2-2*x^3+2*x^4-x^5)/((1+x)*(x-1)^2*(x^2+1)^2).
; 0,1,1,3,1,2,3,5,2,3,5,7,3,4,7,9,4,5,9,11,5,6,11,13,6,7,13,15,7,8,15,17,8,9,17,19,9,10,19,21,10,11,21,23,11,12,23,25,12,13,25,27,13,14,27,29,14,15,29,31,15,16,31,33,16,17,33,35,17,18,35,37,18,19,37,39,19,20,39,41,20
mov $1,2
mov $3,$0
mov $4,$0
mov $0,0
div $4,2
mul $1,$4
sub $5,$4
add $3,$5
add $1,$3
mov $2,$1
div $2,3
mul $3,2
add $0,$3
add $0,$5
lpb $0
mov $0,$5
sub $0,1
mul $0,3
lpe
mod $2,2
add $2,1
mul $0,$2
mov $1,$0
div $1,2
| 18.714286 | 216 | 0.555344 |
e3acd20acb53d3875f0bbb47b965096ff09dce16 | 1,687 | asm | Assembly | lib/vgmplayer.h.asm | simondotm/fast-vgm | 3d28c0d4597ddf9fe72087a6c047ac7d5e5646c4 | [
"MIT"
] | 2 | 2019-01-16T00:31:58.000Z | 2021-02-19T21:01:04.000Z | lib/vgmplayer.h.asm | simondotm/fast-vgm | 3d28c0d4597ddf9fe72087a6c047ac7d5e5646c4 | [
"MIT"
] | null | null | null | lib/vgmplayer.h.asm | simondotm/fast-vgm | 3d28c0d4597ddf9fe72087a6c047ac7d5e5646c4 | [
"MIT"
] | 1 | 2020-03-30T14:24:56.000Z | 2020-03-30T14:24:56.000Z |
\\ VGM Player module
\\ Include file
\\ Define ZP and constant vars only in here
\\ Uses memory &0380-&03DF & ZP
\ ******************************************************************
\ * Define global constants
\ ******************************************************************
VGM_FX_num_freqs_bits = 7
VGM_FX_num_freqs = 2 ^ VGM_FX_num_freqs_bits ; number of VU bars - can be 16 or 32
VGM_FX_num_channels = 4 ; number of beat bars (one per channel)
\\ Player
VGM_PLAYER_string_max = 42 ; size of our meta data strings (title and author)
VGM_PLAYER_sample_rate = 50 ; locked to 50Hz
\ ******************************************************************
\ * Declare ZP variables
\ ******************************************************************
\\ Copied out of the RAW VGM header
.vgm_player_packet_count SKIP 2 ; number of packets
.vgm_player_duration_mins SKIP 1 ; song duration (mins)
.vgm_player_duration_secs SKIP 1 ; song duration (secs)
.vgm_player_packet_offset SKIP 1 ; offset from start of file to beginning of packet data
\\ Player vars
.vgm_player_ended SKIP 1 ; non-zero when player has reached end of tune
.vgm_player_data SKIP 1 ; temporary variable when decoding sound data - must be separate as player running on events
.vgm_player_last_reg SKIP 1 ; last channel (register) refered to by the VGM sound data
.vgm_player_reg_bits SKIP 1 ; bits 0 - 7 set if SN register 0 - 7 updated this frame, cleared at start of player poll - don't need these for beeb-step currently
.vgm_player_counter SKIP 2 ; increments by 1 every poll (20ms) - used as our tracker line no. & to sync fx with audio update
.vgm_player_counter_tmp SKIP 1 | 42.175 | 162 | 0.628927 |
835bb36c06b2484b6775214327fee89371cdf684 | 554 | asm | Assembly | oeis/167/A167406.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/167/A167406.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/167/A167406.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A167406: Sequence a(n) gives the number of ways to seat 2n people around a circular table so that person i does not sit across from person n+i for any 1 <= i <= n.
; Submitted by Christian Krause
; 0,4,64,2880,208896,23193600,3640688640,768126320640,209688566169600,71921062285148160,30278182590480384000,15350836256712740044800,9225766813653105691852800,6485670333458406942179328000,5272823572160895949091320627200
mov $1,1
lpb $0
mov $2,$3
add $3,$1
mov $1,$0
sub $0,1
mul $3,$1
mul $3,$1
mul $1,2
mul $1,$2
mul $3,4
lpe
mov $0,$3
| 30.777778 | 219 | 0.743682 |
88ed2807f4665cdc6c7897ffddde5787c9cfab3d | 4,377 | asm | Assembly | mth.asm | Number571/asmlib | a681d392763b7a51ed1a4c6ca8e36c889db6db8e | [
"MIT"
] | 27 | 2019-10-30T10:46:34.000Z | 2021-09-06T23:59:31.000Z | mth.asm | matv1346/asmlib | a681d392763b7a51ed1a4c6ca8e36c889db6db8e | [
"MIT"
] | 1 | 2019-10-05T08:20:27.000Z | 2019-10-05T08:20:27.000Z | mth.asm | matv1346/asmlib | a681d392763b7a51ed1a4c6ca8e36c889db6db8e | [
"MIT"
] | 3 | 2021-02-08T07:21:24.000Z | 2021-07-12T14:28:57.000Z | format ELF64
public modulo
public pow
public powmod
public euler
public srand
public rand
public bubble_sort
public gcd
public fibonacci
public factorial
include "str.inc"
section '.data' writeable
_next dq 1
section '.modulo' executable
; | input:
; rax = number 1
; rbx = number 2
; | output:
; rax = number
modulo:
push rdx
xor rdx, rdx
div rbx
mov rax, rdx
pop rdx
ret
section '.pow' executable
; | input:
; rax = number 1
; rbx = number 2
; | output:
; rax = number
pow:
push rbx
push rcx
mov rcx, rax
.next_iter:
cmp rbx, 1
jbe .close
imul rax, rcx
dec rbx
jmp .next_iter
.close:
pop rcx
pop rbx
ret
section '.powmod' executable
; | input:
; rax = number 1 (x)
; rbx = number 2 (y)
; rcx = number 3 (n)
; | output:
; rax = number
powmod:
push rbx
push rdx
mov rdx, 1
.next_iter:
cmp rbx, 0
je .close
push rbx
and rbx, 1
cmp rbx, 1
je .mulpow
jmp .next
.mulpow:
push rax
imul rdx, rax
mov rax, rdx
mov rbx, rcx
call modulo
mov rdx, rax
pop rax
.next:
imul rax, rax
mov rbx, rcx
call modulo
pop rbx
shr rbx, 1
jmp .next_iter
.close:
mov rax, rdx
pop rdx
pop rbx
ret
section '.euler' executable
; | input:
; rax = number
; | output:
; rax = number
euler:
push rbx
push rcx
mov rbx, 1
xor rcx, rcx
; [1:rax-1]
.next_iter:
cmp rbx, rax
jae .close
push rax
call gcd
cmp rax, 1
je .is_mutually_simple
jmp .next
.is_mutually_simple:
inc rcx
.next:
pop rax
inc rbx
jmp .next_iter
.close:
mov rax, rcx
pop rcx
pop rbx
ret
section '.srand' executable
; | input:
; rax = number
srand:
mov [_next], rax
ret
section '.rand' executable
; | output:
; rax = number
rand:
push rbx
push rdx
mov rax, [_next]
mov rbx, 1103515245 * 12345
mul rbx
mov [_next], rax
xor rdx, rdx
mov rbx, 65536
div rbx
xor rdx, rdx
mov rbx, 32768
div rbx
mov rax, rdx
pop rdx
pop rbx
ret
section '.bubble_sort' executable
; | input:
; rax = array
; rbx = array size
bubble_sort:
push rbx
push rcx
push rdx
xor rcx, rcx ; i
.first_iter:
cmp rcx, rbx
je .break_first
xor rdx, rdx ; j
push rbx
sub rbx, rcx
dec rbx
.second_iter:
cmp rdx, rbx
je .break_second
push rbx
mov bl, [rax+rdx]
cmp bl, [rax+rdx+1]
jg .swap
jmp .pass
.swap:
mov bh, [rax+rdx+1]
mov [rax+rdx+1], bl
mov [rax+rdx], bh
.pass:
pop rbx
inc rdx
jmp .second_iter
.break_second:
pop rbx
inc rcx
jmp .first_iter
.break_first:
pop rdx
pop rcx
pop rbx
ret
; gcd(a, 0) = a
; gcd(a, b) = gcd(b, a mod b)
section '.gcd' executable
; | input:
; rax = number 1
; rbx = number 2
; | output:
; rax = number
gcd:
push rbx
push rdx
.next_iter:
cmp rbx, 0
je .close
xor rdx, rdx
div rbx
push rbx
mov rbx, rdx
pop rax
jmp .next_iter
.close:
pop rdx
pop rbx
ret
; 0 1 1 2 3 5 8 13 21 ...
section '.fibonacci' executable
; | input:
; rax = number
; | output:
; rax = number
fibonacci:
push rbx
push rcx
mov rbx, 0
mov rcx, 1
cmp rax, 0
je .next_step
.next_iter:
cmp rax, 1
jle .close
push rcx
add rcx, rbx
pop rbx
dec rax
jmp .next_iter
.next_step:
xor rcx, rcx
.close:
mov rax, rcx
pop rcx
pop rbx
ret
; 6! = 1 * 2 * 3 * 4 * 5 * 6 = 720
section '.factorial' executable
; | input:
; rax = number
; | output:
; rax = number
factorial:
push rbx
mov rbx, rax
mov rax, 1
.next_iter:
cmp rbx, 1
jle .close
mul rbx
dec rbx
jmp .next_iter
.close:
pop rbx
ret
| 16.33209 | 34 | 0.500114 |
1193b100aaaf3518446e84a34b7fb99078cc200c | 2,190 | asm | Assembly | data/mart_inventories.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | data/mart_inventories.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | data/mart_inventories.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | ; mart inventories are below
; they are texts
; Viridian
ViridianCashierText::
TX_MART POKE_BALL,POTION,ANTIDOTE,PARLYZ_HEAL,REPEL,FROST_STONE
; Pewter
PewterCashierText::
TX_MART POKE_BALL,POTION,ESCAPE_ROPE,ANTIDOTE,POKE_DOLL,AWAKENING,PARLYZ_HEAL,SUN_STONE,MOON_STONE,TM_20,TM_31;Rage and Mimic
; Cerulean
CeruleanCashierText::
TX_MART POKE_BALL,POTION,ESCAPE_ROPE,REPEL,ANTIDOTE,BURN_HEAL,AWAKENING,PARLYZ_HEAL,LOVE_STONE,SUN_STONE,TM_09,TM_05;Take down, hidden power
; Bike shop
TX_MART BICYCLE
; Vermilion
VermilionCashierText::
TX_MART POKE_BALL,SUPER_POTION,ICE_HEAL,AWAKENING,PARLYZ_HEAL,REPEL,LOVE_STONE,TM_02,TM_04;Twister,Aerial Ace
; Lavender
LavenderCashierText::
TX_MART GREAT_BALL,SUPER_POTION,REVIVE,ESCAPE_ROPE,SUPER_REPEL,ANTIDOTE,BURN_HEAL,ICE_HEAL,PARLYZ_HEAL,SHINY_STONE,TM_30,TM_40;shadow ball, dark pulse
; Celadon Dept. Store 2F (1)
CeladonMart2Clerk1Text::
TX_MART GREAT_BALL,SUPER_POTION,REVIVE,SUPER_REPEL,ANTIDOTE,BURN_HEAL,ICE_HEAL,AWAKENING,PARLYZ_HEAL
; Celadon Dept. Store 2F (2)
CeladonMart2Clerk2Text::
TX_MART TM_32,TM_33,TM_02,TM_07,TM_37,TM_01,TM_05,TM_09,TM_17,TM_35;TM 35 is Ice Punch now, 17 is Dynamicpunch
; Celadon Dept. Store 4F
CeladonMart4ClerkText::
TX_MART POKE_DOLL,FIRE_STONE,THUNDER_STONE,WATER_STONE,LEAF_STONE,MOON_STONE,SUN_STONE,FROST_STONE,LOVE_STONE
; Celadon Dept. Store 5F (1)
CeladonMart5Clerk1Text::
TX_MART X_ACCURACY,GUARD_SPEC,DIRE_HIT,X_ATTACK,X_DEFEND,X_SPEED,X_SPECIAL
; Celadon Dept. Store 5F (2)
CeladonMart5Clerk2Text::
TX_MART HP_UP,PROTEIN,IRON,CARBOS,CALCIUM,RARE_CANDY
; Fuchsia
FuchsiaCashierText::
TX_MART ULTRA_BALL,GREAT_BALL,HYPER_POTION,REVIVE,FULL_HEAL,SUPER_REPEL,TM_16,TM_37;Poison Jab,X_SCISSOR
; unused?
TX_MART GREAT_BALL,HYPER_POTION,SUPER_POTION,FULL_HEAL,REVIVE
; Cinnabar
CinnabarCashierText::
TX_MART ULTRA_BALL,GREAT_BALL,HYPER_POTION,MAX_REPEL,ESCAPE_ROPE,FULL_HEAL,REVIVE,TM_43,TM_07;Hurricane, Iron Tail
; Saffron
SaffronCashierText::
TX_MART GREAT_BALL,HYPER_POTION,MAX_REPEL,ESCAPE_ROPE,FULL_HEAL,REVIVE,TM_50,TM_46;Substitute,Dazzlingleam
; Indigo
IndigoCashierText::
TX_MART SNAG_BALL,ULTRA_BALL,GREAT_BALL,FULL_RESTORE,MAX_POTION,FULL_HEAL,REVIVE,MAX_REPEL
| 33.692308 | 151 | 0.841096 |
43349c444f26744420e350f004138a8971527c6f | 761 | asm | Assembly | oeis/020/A020734.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/020/A020734.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/020/A020734.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A020734: Pisot sequence L(4,10).
; Submitted by Christian Krause
; 4,10,25,63,159,402,1017,2573,6510,16472,41679,105461,266850,675216,1708513,4323086,10938795,27678662,70035898,177213300,448406526,1134612428,2870933600,7264383443,18381221638,46510390257,117686215012,297783895756,753488830979,1906568577085,4824230419455,12206851313777,30887251652771,78154660046107,197756373910807,500387096550348,1266139955150160,3203740458296065,8106491610483780,20512025579561170,51902008118091743,131328738658295501,332303859194359827,840835417773882435,2127583475849621877
mov $4,2
lpb $4
mov $1,3
add $3,6
sub $4,2
lpb $0
sub $0,1
add $2,1
add $3,$2
div $3,$2
mov $2,$1
add $1,$3
sub $1,1
mul $3,$1
lpe
lpe
mov $0,$1
add $0,1
| 33.086957 | 496 | 0.767411 |
67ec1473de14e2be8284d3c3f1881ed7a878feaa | 70 | asm | Assembly | nasm/multiply_50654ddff44f800200000004.asm | p85/codewars-solutions | b4a5073b0c21f64e50e975416526ba5dd58019fc | [
"MIT"
] | null | null | null | nasm/multiply_50654ddff44f800200000004.asm | p85/codewars-solutions | b4a5073b0c21f64e50e975416526ba5dd58019fc | [
"MIT"
] | null | null | null | nasm/multiply_50654ddff44f800200000004.asm | p85/codewars-solutions | b4a5073b0c21f64e50e975416526ba5dd58019fc | [
"MIT"
] | null | null | null | global multiply
section .text
multiply:
mov eax, edi
mul esi
ret | 11.666667 | 15 | 0.728571 |
247606622a7e8ea353ac43970513c0e6627c4bdc | 1,049 | asm | Assembly | src/bootloader/bootloader.asm | Thombrom/SnekOS | fe8dd7b19f3c8c613853a6a4b8ea568658528010 | [
"MIT"
] | null | null | null | src/bootloader/bootloader.asm | Thombrom/SnekOS | fe8dd7b19f3c8c613853a6a4b8ea568658528010 | [
"MIT"
] | null | null | null | src/bootloader/bootloader.asm | Thombrom/SnekOS | fe8dd7b19f3c8c613853a6a4b8ea568658528010 | [
"MIT"
] | null | null | null | ;
; Bootloader for OS system
;
; Load sectors into memory
; for further execution
;
; Switch to 32bit protected
; mode and hand over controll
; to kernel
;
[bits 16]
[org 0x7c00] ; Bootloader always loaded at
; this specific adress
PROGRAM_SPACE equ 0x9000
SECTOR_LOAD_NUM equ 50
; Load further sectors
; into memory
mov [BOOT_DRIVE], dl ; BIOS stores boot drive in DL
; and we remember this for later
mov bp, 0x8000 ; Set stack to save location
mov sp, bp
mov bx, PROGRAM_SPACE ; Load sectors to 0x9000
mov dh, SECTOR_LOAD_NUM ; from boot disk
mov dl, [BOOT_DRIVE]
call disk_load
mov bx, boot_msg
call print_str
jmp PROGRAM_SPACE
BOOT_DRIVE:
db 0
boot_msg:
db "Booted in 16 bit mode", 0
%include "src/bootloader/print_str.asm"
%include "src/bootloader/print_hex.asm"
%include "src/bootloader/disk_load.asm"
; Bootsector end bits
; which must be 0xaa55
times 510-($-$$) db 0
dw 0xaa55
| 20.568627 | 60 | 0.641563 |
44db57883e532486ef495f0e82d91fabb18812f5 | 840 | asm | Assembly | dasm/optest.asm | ceharris/sbz80 | b5b6cbc8fb631e0703b15b0701d66e527bbf9ef7 | [
"Apache-2.0"
] | null | null | null | dasm/optest.asm | ceharris/sbz80 | b5b6cbc8fb631e0703b15b0701d66e527bbf9ef7 | [
"Apache-2.0"
] | null | null | null | dasm/optest.asm | ceharris/sbz80 | b5b6cbc8fb631e0703b15b0701d66e527bbf9ef7 | [
"Apache-2.0"
] | null | null | null |
;-------------------------------------------------------------
; optest:
; A macro that produces a test case for an instruction and
; its operands. The resulting code disassembles the given
; instruction and compares it to the expected disassembly.
; If the actual disassembly matches the expected disassembly,
; execution continues at the next address following the macro
; expansion. Otherwise, the r is halted; HL points at
; the expected and DE points at the actual and execution continues
; at the fail label.
;
; Parameters:
; a_op the instruction to test
; a_exp string containing the expected disassembly
;
optest macro a_op,a_exp
local op,exp,done
ld hl,op
call dasm
ld de,cbuf
call i2str
ld hl,exp
call validate
jr z,done
jp fail
op: `a_op`
exp: db `a_exp`,0
done:
endm
| 24 | 67 | 0.661905 |
bc97e90f39783c58ee9986a3208ead7561070def | 7,972 | asm | Assembly | maps/DanceTheatre.asm | pokeachromicdevs/pokeoctober | db74bb68bbfceac07eec6d64674bc24fd4c0b67f | [
"blessing"
] | 1 | 2021-07-05T23:48:37.000Z | 2021-07-05T23:48:37.000Z | maps/DanceTheatre.asm | AtmaBuster/pokeoctober | 12652b84eb2df1a0ed2f654a0ffcfb78202e515f | [
"blessing"
] | 1 | 2020-12-16T01:11:20.000Z | 2020-12-16T22:53:56.000Z | maps/DanceTheatre.asm | AtmaBuster/pokeoctober | 12652b84eb2df1a0ed2f654a0ffcfb78202e515f | [
"blessing"
] | 1 | 2021-07-05T23:33:22.000Z | 2021-07-05T23:33:22.000Z | object_const_def ; object_event constants
const DANCETHEATRE_KIMONO_GIRL1
const DANCETHEATRE_KIMONO_GIRL2
const DANCETHEATRE_KIMONO_GIRL3
const DANCETHEATRE_KIMONO_GIRL4
const DANCETHEATRE_KIMONO_GIRL5
const DANCETHEATRE_GENTLEMAN
const DANCETHEATRE_RHYDON
const DANCETHEATRE_COOLTRAINER_M
const DANCETHEATRE_GRANNY
DanceTheatre_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
TrainerKimonoGirlNaoko2:
trainer KIMONO_GIRL, NAOKO2, EVENT_BEAT_KIMONO_GIRL_NAOKO, KimonoGirlNaoko2SeenText, KimonoGirlNaoko2BeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext KimonoGirlNaoko2AfterBattleText
waitbutton
closetext
end
TrainerKimonoGirlSayo:
trainer KIMONO_GIRL, SAYO, EVENT_BEAT_KIMONO_GIRL_SAYO, KimonoGirlSayoSeenText, KimonoGirlSayoBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext KimonoGirlSayoAfterBattleText
waitbutton
closetext
end
TrainerKimonoGirlZuki:
trainer KIMONO_GIRL, ZUKI, EVENT_BEAT_KIMONO_GIRL_ZUKI, KimonoGirlZukiSeenText, KimonoGirlZukiBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext KimonoGirlZukiAfterBattleText
waitbutton
closetext
end
TrainerKimonoGirlKuni:
trainer KIMONO_GIRL, KUNI, EVENT_BEAT_KIMONO_GIRL_KUNI, KimonoGirlKuniSeenText, KimonoGirlKuniBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext KimonoGirlKuniAfterBattleText
waitbutton
closetext
end
TrainerKimonoGirlMiki:
trainer KIMONO_GIRL, MIKI, EVENT_BEAT_KIMONO_GIRL_MIKI, KimonoGirlMikiSeenText, KimonoGirlMikiBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext KimonoGirlMikiAfterBattleText
waitbutton
closetext
end
DanceTheaterSurfGuy:
faceplayer
opentext
writetext SurfGuyNeverLeftAScratchText
buttonsound
checkevent EVENT_GOT_HM03_SURF
iftrue SurfGuyAlreadyGaveSurf
checkevent EVENT_BEAT_KIMONO_GIRL_NAOKO
iffalse .KimonoGirlsUndefeated
checkevent EVENT_BEAT_KIMONO_GIRL_SAYO
iffalse .KimonoGirlsUndefeated
checkevent EVENT_BEAT_KIMONO_GIRL_ZUKI
iffalse .KimonoGirlsUndefeated
checkevent EVENT_BEAT_KIMONO_GIRL_KUNI
iffalse .KimonoGirlsUndefeated
checkevent EVENT_BEAT_KIMONO_GIRL_MIKI
iffalse .KimonoGirlsUndefeated
sjump .GetSurf
.KimonoGirlsUndefeated:
checkflag ENGINE_PLAYER_IS_FEMALE
iftrue .PlayerIsFemale
writetext SurfGuyLadGiftText
waitbutton
closetext
end
.PlayerIsFemale:
writetext SurfGuyLassieGiftText
waitbutton
closetext
end
.GetSurf:
writetext SurfGuyLikeADanceText
buttonsound
verbosegiveitem HM_WATER_SPORT
setevent EVENT_GOT_HM03_SURF
writetext SurfGuySurfExplanationText
waitbutton
closetext
end
SurfGuyAlreadyGaveSurf:
writetext SurfGuyElegantKimonoGirlsText
waitbutton
closetext
end
DanceTheaterRhydon:
opentext
writetext RhydonText
cry RHYDON
waitbutton
closetext
end
DanceTheatreCooltrainerMScript:
jumptextfaceplayer DanceTheatreCooltrainerMText
DanceTheatreGrannyScript:
jumptextfaceplayer DanceTheatreGrannyText
DanceTheatreFancyPanel:
jumptext DanceTheatreFancyPanelText
KimonoGirlNaoko2SeenText:
text "You have lovely"
line "#MON. May I see"
cont "them in battle?"
done
KimonoGirlNaoko2BeatenText:
text "Oh, you are very"
line "strong."
done
KimonoGirlNaoko2AfterBattleText:
text "I enjoyed that"
line "bout. I would like"
cont "to see you again."
done
KimonoGirlSayoSeenText:
text "I always dance"
line "with my #MON."
para "Of course, I also"
line "train them."
done
KimonoGirlSayoBeatenText:
text "Oh, so close!"
line "I almost had you."
done
KimonoGirlSayoAfterBattleText:
text "Rhythm is impor-"
line "tant for both"
para "dancing and #-"
line "MON."
done
KimonoGirlZukiSeenText:
text "Isn't my barrette"
line "pretty?"
para "Oh. A #MON"
line "battle?"
done
KimonoGirlZukiBeatenText:
text "I don't have any"
line "#MON left…"
done
KimonoGirlZukiAfterBattleText:
text "I put a different"
line "flower in my bar-"
cont "rette every month."
done
KimonoGirlKuniSeenText:
text "Oh, you're a cute"
line "trainer. Would you"
cont "like to battle?"
done
KimonoGirlKuniBeatenText:
text "You're stronger"
line "than you look."
done
KimonoGirlKuniAfterBattleText:
text "I trained a lot,"
line "so I thought I was"
para "a capable trainer."
line "I guess I'm not."
done
KimonoGirlMikiSeenText:
text "Do you like my"
line "dancing? I'm good"
cont "at #MON too."
done
KimonoGirlMikiBeatenText:
text "Ooh, you're good"
line "at #MON too."
done
KimonoGirlMikiAfterBattleText:
text "I can keep dancing"
line "because there are"
para "people who enjoy"
line "what I do."
para "My #MON keep my"
line "spirits up too."
done
SurfGuyNeverLeftAScratchText:
text "Not only are the"
line "KIMONO GIRLS great"
para "dancers, they're"
line "also skilled at"
cont "#MON."
para "I always challenge"
line "them, but I've"
para "never even left a"
line "scratch…"
done
SurfGuyLadGiftText:
text "Lad! If you can"
line "defeat all the"
para "KIMONO GIRLS, I'll"
line "give you a gift."
done
SurfGuyLassieGiftText:
text "Lassie, if you can"
line "defeat all the"
para "KIMONO GIRLS, I'll"
line "give you a gift."
done
SurfGuyLikeADanceText:
text "The way you bat-"
line "tled, it was like"
cont "watching a dance."
para "It was a rare"
line "treat to see!"
para "I want you to have"
line "this. Don't worry"
cont "--take it!"
done
SurfGuySurfExplanationText:
text "That's WATER SPORT."
para "It's a move that"
line "lets #MON swim"
cont "across water."
done
SurfGuyElegantKimonoGirlsText:
text "I wish my #MON"
line "were as elegant as"
cont "the KIMONO GIRLS…"
done
RhydonText:
text "RHYDON: Gugooh"
line "gugogooh!"
done
DanceTheatreCooltrainerMText:
text "That man's always"
line "with his RHYDON."
para "Says he wants a"
line "#MON that can"
cont "SURF and dance."
para "Is he trying to"
line "make a synchro-"
cont "nized swimming"
cont "#MON?"
done
DanceTheatreGrannyText:
text "The KIMONO GIRLS"
line "are so beautiful…"
para "But they have to"
line "go through rigor-"
cont "ous training."
para "And they have to"
line "learn to follow"
para "customs before ap-"
line "pearing in public."
para "But if you love"
line "something, any-"
cont "thing is possible."
done
DanceTheatreFancyPanelText:
text "It's a fancy panel"
line "that's decorated"
cont "with flowers."
done
DanceTheatre_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 5, 13, ECRUTEAK_CITY, 8
warp_event 6, 13, ECRUTEAK_CITY, 8
db 0 ; coord events
db 2 ; bg events
bg_event 5, 6, BGEVENT_UP, DanceTheatreFancyPanel
bg_event 6, 6, BGEVENT_UP, DanceTheatreFancyPanel
db 9 ; object events
object_event 0, 2, SPRITE_KIMONO_GIRL, SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 0, TrainerKimonoGirlNaoko2, -1
object_event 2, 1, SPRITE_KIMONO_GIRL, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 0, TrainerKimonoGirlSayo, -1
object_event 6, 2, SPRITE_KIMONO_GIRL, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 0, TrainerKimonoGirlZuki, -1
object_event 9, 1, SPRITE_KIMONO_GIRL, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 0, TrainerKimonoGirlKuni, -1
object_event 11, 2, SPRITE_KIMONO_GIRL, SPRITEMOVEDATA_SPINCLOCKWISE, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 0, TrainerKimonoGirlMiki, -1
object_event 7, 10, SPRITE_GENTLEMAN, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DanceTheaterSurfGuy, -1
object_event 6, 8, SPRITE_RHYDON, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, DanceTheaterRhydon, -1
object_event 10, 10, SPRITE_COOLTRAINER_M, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, DanceTheatreCooltrainerMScript, -1
object_event 3, 6, SPRITE_GRANNY, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DanceTheatreGrannyScript, -1
| 22.083102 | 158 | 0.780607 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.