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
80231dcecfcc1c11bf08f72a57379c21330c34ef
320
asm
Assembly
programs/oeis/089/A089533.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/089/A089533.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/089/A089533.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A089533: a(n)=(A089348(n)-1)/10n. ; 1,2,1,1,2,1,1,3,2,1,3,2,1,2,1,4,6,1,1,2,1,3,2,1,1,2,1,1,5,2,1,2,1,3,2,5,4,2,3,1,2,1,1,2,4,1,2,7,1,6,2,1,2,1,6,5,1,3,2,1,3,3,1,1,2,1,3,2,1,1,3,3,9,2,1,1,3,3,3,2,1,1,14,3,3,2,2,1,3,2,1,6,2,1,2,5,1,6,1,3 add $0,1 mul $0,10 sub $0,1 seq $0,34693 ; Smallest k such that k*n+1 is prime.
40
202
0.54375
5490dd6e94814bc0aa2422145cb1f1d9a47418ee
94,248
asm
Assembly
Library/SpecUI/CommonUI/CView/cviewPaneWindow.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/SpecUI/CommonUI/CView/cviewPaneWindow.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/SpecUI/CommonUI/CView/cviewPaneWindow.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: OpenLook/View FILE: viewPaneWindow.asm ROUTINES: Name Description ---- ----------- INT TestIfMouseImpliedOrActiveInPaneWindow Tests to see if the mouse is actually active within the pane window (If not, then it must be active on the border of the pane) At least for the moment, calls superclass to do stuff if on the border, before returning. INT OLPaneWindowSetContent Opens a new OD. Sends whatever is necessary to simulate a view coming up. INT ViewEnabled? Returns whether view is enabled or not. MTD MSG_VIS_QUERY_IF_OBJECT_HANDLES_INK This method handler is called to see if this view handles ink. If the InkType is anything other than NO_INK, then assume that we want ink. MTD MSG_VIS_LOST_GADGET_EXCL Ends grab for pane that may be in effect. Can be used for simple case when user releases mouse from interacting with window, & in more complicated situations, such as the window being closed down or the thing losing the gadget exclusive. yadda yadda yadda... INT OLPaneClearGrabsCommon Clear all grab flags, scrolling, panning, mouse grab, & timers, all without tampering with the gadget exclusive. MTD MSG_META_PTR Handles pointer events in the pane. INT OLCombineMouseEvent Handles pointer events in the pane. INT UpdateConstrain Copy UIFA_CONSTRAIN bit into local instance bit INT TransCoords Translates coordinates, as needed. GLB GrabTargetAndFocusIfPossible Grabs the target and focus, unless the "don't grab from text objects" flag is set, and a text object has the focus. INT OLPaneContentLeave Handler for MSG_META_RAW_UNIV_LEAVE. Implements drag-scrolling. If a wandering mouse grab is in effect, release the gadget exclusive if we have it, so that the mouse can continue to wander. MTD MSG_SPEC_VIEW_FORCE_INITIATE_DRAG_SCROLL Forces a drag scroll by turning on the _GRAB flag. INT RepeatSelectScroll Repeats the select scroll, if needed. INT GetPaneWinBounds Gets the bounds for the actual window. Depends on what flags are set (could be a 0, 1, or 2 pixel wide border). INT GetFrameBounds Returns bounds of frame around window. INT DrawColorPaneWinFrame Draws a chiseled border. INT DrawBWPaneWinFrame Draws a regular border. MTD MSG_SPEC_VIEW_UNSUSPEND_OPENED_WIN Unsuspends the newly opened window, if it still exists. INT SendPaneSizeMethod Send a method to the OD associated with pane, containing current size of pane & pane handle INT SendMethod Sends a method to the output descriptor. INT OLPaneGrabGadgetExclAndMouse Enact a PRESS_GRAB by grabbing the gadget exclusive & mouse, if we don't already have it. INT OLPaneNoUpdatePending Indicates that the parent pane's scroll will cause an update to happen (is 0,0). INT OLPaneWindowScroll Scrolls the window. INT SeeIfLargeTranslation Checks to see if the desired translation is large. INT OLPaneSelectScroll Possibly initiate a scroll event. INT StartDragTimer Start up the drag timer for a drag scroll. INT GetLimitedXIncrement Get x increment, limited to a maximum value. INT GetLimitedYIncrement Get x increment, limited to a maximum value. INT CheckIfNegativeScrollNeeded Checks to see we need a negative scroll to see more of the drag bounds. INT CheckIfPositiveScrollNeeded Checks to see we need a positive scroll to see more of the drag bounds. REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/89 Initial version DESCRIPTION: Handles window-specific code for the OLPane object. $Id: cviewPaneWindow.asm,v 1.3 98/05/04 07:12:01 joon Exp $ -------------------------------------------------------------------------------@ idata segment ; this global variable just provides a unique token to associate ; windows with so we dont unsuspend the wrong windows windowID word 0 idata ends ViewCommon segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: TestIfMouseImpliedOrActiveInPaneWindow DESCRIPTION: Tests to see if the mouse is actually active within the pane window (If not, then it must be active on the border of the pane) At least for the moment, calls superclass to do stuff if on the border, before returning. CALLED BY: INTERNAL PASS: *ds:si - OLPane ax - method being used cx, dx, bp -- button stuff es -- class segment RETURN: carry - set if not over pane window, but instead is over border (superclass called in this case, so no further processing necessary) if carry set, ax - MouseReturnFlags (In Objects/uiInputC.def) mask MRF_PROCESSED - if event processed by gadget. See def. below. mask MRF_REPLAY - causes a replay of the button to the modified implied/active grab. See def. below. mask MRF_SET_POINTER_IMAGE - sets the PIL_GADGET level cursor based on the value of cx:dx: cx:dx - optr to PointerDef in sharable memory block, OR cx = 0, and dx = PtrImageValue (Internal/im.def) mask MRF_CLEAR_POINTER_IMAGE - Causes the PIL_GADGET level cursor to be cleared DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/90 Initial version Chris 2/91 Calls superclass if on border Doug 5/91 Fixup for elimination of Flow* routines ------------------------------------------------------------------------------@ TestIfMouseImpliedOrActiveInPaneWindow proc near uses di .enter ; Call source of the mouse event, the application object, to see ; if it recognizes this window or not. ; push ax, cx, dx, bp mov di, ds:[si] add di, ds:[di].Vis_offset mov bp, ds:[di].OLPI_window ; Fetch pane to do the comparison with mov ax, MSG_VIS_CONTENT_TEST_IF_ACTIVE_OR_IMPLIED_WIN call GenCallApplication pop ax, cx, dx, bp jnc exit ; in pane's window, branch mov di, offset OLPaneClass call ObjCallSuperNoLock ; do superclass method, if one stc ; return carry set exit: .leave ret TestIfMouseImpliedOrActiveInPaneWindow endp COMMENT @---------------------------------------------------------------------- METHOD: OLPaneCloseWin -- MSG_VIS_CLOSE_WIN for OLPaneClass DESCRIPTION: Updates pane window. If a window already exists, changes the window bounds. If it doesn't, creates a window for it. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_VIS_CLOSE_WIN RETURN: nothing ax, cx, dx, bp -- trashed 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/ 4/89 Initial version Eric 5/90 Moved RELEASE_FOCUS, TARGET code to VIS_UN_BUILD handler. ------------------------------------------------------------------------------@ OLPaneCloseWin method OLPaneClass, MSG_VIS_CLOSE_WIN mov bx, ds:[si] add bx, ds:[bx].Vis_offset ; ds:bx = SpecificInstance clr di xchg di, ds:[bx].OLPI_window ; get window, store 0 tst di jz none inc ds:[bx].OLPI_windowID ; make sure ID for null-window ; not equal to any window ; that ever existed call WinClose ; close Window, which will ; prevent any further ; MSG_META_EXPOSED events from ; being generated. mov bp, di mov ax, MSG_META_CONTENT_VIEW_WIN_CLOSED call OLPaneSendToApp none: ret OLPaneCloseWin endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneWindowSetContent -- DESCRIPTION: Opens a new OD. Sends whatever is necessary to simulate a view coming up. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_GEN_VIEW_SET_CONTENT cx:dx - new OD RETURN: nothing DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 11/22/89 Initial version srs 12/29/89 Skips window stuff if window handle is zero ------------------------------------------------------------------------------@ OLPaneWindowSetContent proc far call PaneGetWindow ;get window in di jz 90$ ;no window, exit push si ;save pane handle mov si, WIT_EXPOSURE_OBJ ;set a new exposure OD call WinSetInfo pop si ;restore pane handle mov bp, di ;pass window handle in bp mov ax, MSG_META_CONTENT_VIEW_WIN_OPENED ;send this to output call SendPaneSizeMethod 90$: ret OLPaneWindowSetContent endp COMMENT @---------------------------------------------------------------------- ROUTINE: ViewEnabled? SYNOPSIS: Returns whether view is enabled or not. CALLED BY: everyone PASS: *ds:si -- pane handle RETURN: true if view is enabled, false (ZF=1) otherwise DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 2/ 2/90 Initial version ------------------------------------------------------------------------------@ ViewEnabled? proc near uses di .enter mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset test ds:[di].VI_attrs, mask VA_FULLY_ENABLED .leave ret ViewEnabled? endp COMMENT @---------------------------------------------------------------------- METHOD: OLPaneEndMoveCopy DESCRIPTION: Handle release of quick move/paste button action which was started in the view. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_END_MOVE_COPY cx - x pos, in window coordinates dx - y pos, in window coordinates bp high - UIFunctionsActive bp low - ButtonInfo RETURN: nothing 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 ---- ---- ----------- Doug 7/90 Split out from main group for additional handling. ------------------------------------------------------------------------------@ OLPaneEndMoveCopy method OLPaneClass, MSG_META_END_MOVE_COPY call GenProcessGenAttrsBeforeAction ; Start any new input modes call OLPaneButton ; Process move/copy call GenProcessGenAttrsAfterAction ; Send terminating input mode ret ; method via app queue OLPaneEndMoveCopy endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneButton - Handler for button methods DESCRIPTION: First handles local OL pane functions, then sends button on to application PASS: *ds:si - instance data es - segment of MetaClass ax - Mouse button method cx - x pos, in window coordinates dx - y pos, in window coordinates bp high - UIFunctionsActive bp low - ButtonInfo RETURN: nothing 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 ---- ---- ----------- Doug 5/89 Initial version ------------------------------------------------------------------------------@ OLPaneButton method OLPaneClass, MSG_META_END_SELECT, \ MSG_META_DRAG_SELECT, \ MSG_META_START_MOVE_COPY, \ MSG_META_DRAG_MOVE_COPY, \ MSG_META_DRAG_FEATURES, \ MSG_META_START_OTHER, \ MSG_META_END_OTHER, \ MSG_META_DRAG_OTHER call ViewEnabled? ; make sure view is enabled LONG jz exit ; nope, exit ; See if the mouse is interacting ; with the pane (as opposed to ; the thin border around it) call TestIfMouseImpliedOrActiveInPaneWindow LONG jc exitProcessed ; Not in window, handled by superclass, ; exit with their return flags ;inPaneWindow: mov di, ds:[si] add di, ds:[di].Vis_offset ; NOTE: ds:di must be object! call UpdateConstrain ; update our local copy of constrain bit ; ; If this is a button press, then grab the gadget exclusive & mouse, ; if we haven't already. ; test bp, mask BI_PRESS jz afterPress ; skip mouse grab if not press call OLPaneGrabGadgetExclAndMouse afterPress: push bp push ax ; save method (MSG_META_BUTTON) ; ; Save mouse position, in case we get panning ; pointer events. ; mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance mov ax, cx ;pointer coords in ax,bx mov bx, dx ; push di ; mov di, ds:[di].OLPI_window ;pass window handle ; call WinTransform ;make screen coords! ; pop di mov ds:[di].OLPI_mouseX, ax ;save mouse position mov ds:[di].OLPI_mouseY, bx ; pop ax ; restore MSG_META_BUTTON ; Send on to application EC < call ECCheckVisCoords > call TransCoords ; translate coords appropriately call OLPaneSendToApp pop bp ; Release gadget exclusive, thereby forcing a cease & desist of ; all activity, if no buttons are down, i.e. they're all up. ; Do this AFTER sending the button release on to the app, so that ; we don't inadvertently nuke a grab before the object has a chance ; to get the UP-button. ; test bp, mask BI_B0_DOWN or \ mask BI_B1_DOWN or \ mask BI_B2_DOWN or \ mask BI_B3_DOWN jnz afterReleaseCheck mov ax, MSG_VIS_RELEASE_GADGET_EXCL call VisCallParentWithSelf afterReleaseCheck: exit: mov ax, mask MRF_PROCESSED ;say processed exitProcessed: ret OLPaneButton endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLPaneQueryIfPressIsInk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This method handler is invoked to send the MSG_META_QUERY_IF_PRESS_IS_INK to the output. CALLED BY: GLOBAL PASS: ds:di, *ds:si - ptr to OLPane object cx,dx - coords of mouse press RETURN: nada DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/ 3/91 Initial version IP 08/22/94 fixed gstate problem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLPaneQueryIfPressIsInk method OLPaneClass, MSG_META_QUERY_IF_PRESS_IS_INK EC < call ECCheckVisCoords > call ViewEnabled? ;If view is not enabled, just exit... LONG jz noInkExit if GRAFFITI_ANYWHERE ; ; Test for Ink starting inside our bounds. It turns out that ; we want to allow starting outside our bounds if we're in a ; GenPrimary, because title bars do nothing for full-screen ; windows. In dialogs, however, specifically in the Graffiti ; Input Box, this test is required because otherwise you can't ; activate the Exit trigger. If the Key library returned ; IRV_INK_WITH_STANDARD_OVERRIDE it would work, but that causes ; another problem (can't do single-tap for punctuation shift). ; So here we check if we're in a dialog box of some sort, and ; only do the test in that case. ; push ax, cx, dx mov ax, MSG_META_IS_OBJECT_IN_CLASS mov cx, segment OLDialogWinClass ; is it a dialog? mov dx, offset OLDialogWinClass call CallOLWin ; carry set if so pop ax, cx, dx ; cx = TitleGroupType jnc notDialog ; not GenDisplay, use CallOLWin call TestIfMouseImpliedOrActiveInPaneWindow LONG jc noInkExit notDialog: else call TestIfMouseImpliedOrActiveInPaneWindow LONG jc noInkExit endif mov di, ds:[si] add di, ds:[di].Gen_offset mov bl, ds:[di].GVI_inkType cmp bl, GVIT_PRESSES_ARE_NOT_INK LONG je noInkExit call GrabTargetAndFocusIfPossible cmp bl, GVIT_QUERY_OUTPUT je doQuery clr bp mov ax, IRV_DESIRES_INK cmp bl, GVIT_PRESSES_ARE_INK je inkCommon mov ax, IRV_INK_WITH_STANDARD_OVERRIDE inkCommon: ; Check if an object has set up any dest info for the ink (the ink object ; does this to allow ink input even though the ink object's thread may ; be busy). push ax mov ax, ATTR_GEN_VIEW_INK_DESTINATION_INFO call ObjVarFindData jnc popExit clr di tst ds:[bx].IDIP_createGState jz createBlock mov ax, MSG_GEN_VIEW_GET_WINDOW call ObjCallInstanceNoLock mov di, cx jcxz createBlock call GrCreateState tst ds:[bx].IDIP_color jz createBlock mov al, ds:[bx].IDIP_color clr ah call GrSetLineColor createBlock: mov bp, di ; ^h GState movdw cxdx, ds:[bx].IDIP_dest mov ax, ds:[bx].IDIP_brushSize clrdw bxdi call UserCreateInkDestinationInfo popExit: pop ax exit: ret doQuery: call TransCoords EC < push si > EC < mov si, ds:[si] > EC < add si, ds:[si].Gen_offset > EC < tstdw ds:[si].GVI_content > EC < ERROR_Z OL_VIEW_GVIT_QUERY_OUTPUT_SET_WITH_NO_OUTPUT > EC < pop si > call OLPaneSendToApp mov ax, IRV_WAIT ret noInkExit: mov ax, IRV_NO_INK jmp exit OLPaneQueryIfPressIsInk endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLPaneQueryIfObjectHandlesInk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This method handler is called to see if this view handles ink. If the InkType is anything other than NO_INK, then assume that we want ink. CALLED BY: GLOBAL PASS: ss:bp - ptr to VisCallChildrenInBoundsFrame RETURN: CX:DX <- optr of this object, if necessary DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/ 6/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLPaneQueryIfObjectHandlesInk method dynamic OLPaneClass, MSG_VIS_QUERY_IF_OBJECT_HANDLES_INK mov di, bx add di, ds:[di].GenView_offset cmp ds:[di].GVI_inkType, GVIT_PRESSES_ARE_NOT_INK je exit call VisObjectHandlesInkReply exit: ret OLPaneQueryIfObjectHandlesInk endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLPaneInk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine sends the ink off to the output, after transforming the bounds... CALLED BY: GLOBAL PASS: bp - InkHeader RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/ 6/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLPaneInk method OLPaneClass, MSG_META_NOTIFY_WITH_DATA_BLOCK cmp dx, GWNT_INK jne callSuper cmp cx, MANUFACTURER_ID_GEOWORKS jne callSuper ; We are getting ink, so grab the target call GrabTargetAndFocusIfPossible mov ax, MSG_META_NOTIFY_WITH_DATA_BLOCK call OLPaneSendToApp exit: ret callSuper: mov di, offset OLPaneClass GOTO ObjCallSuperNoLock OLPaneInk endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLPaneEndGrab DESCRIPTION: Ends grab for pane that may be in effect. Can be used for simple case when user releases mouse from interacting with window, & in more complicated situations, such as the window being closed down or the thing losing the gadget exclusive. The main reason this is done is to force the release of the mouse grab & feedback by an object within the view when doing a quick-transfer operation. This is the only way we have of telling such an object to "knock it off" if the mouse moves out of the view, or over onto another application. The only other way this might possibly be done would be to trick the content with regards to the implied window. Such a scenerio might look like: " All contents, even those below Views, now have to be instructed as to when the IMPLIED_WIN is one of theirs. Views will send this notification whenever the mouse enters the view area, & clear it when it leaves. One special case, however: As long as the view has the mouse grabbed, we'll continue to let the content believe the mouse is over the port window. Why? Because we in every other way treat the document area itself as being visible, continuing to pass it mouse events, & expecting it to continue doing things like selecting while auto-scrolling. By leaving the implied window set, UIFA_IN will continue to indicate whether the mouse is in the visible bounds of the object or not. " This approach was chosen against both because of the ugliness of faking enter/leave events, & because LARGE mouse events don't have a UIFA_IN flag, meaning that would be insufficient info objects in a large doc model. Releases: Mouse grab Gadget exclusive Drag scrolling CALLED BY: INTERNAL OLPaneLostGadgetExcl PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_VIS_LOST_GADGET_EXCL RETURN: nothing 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 ---- ---- ----------- Doug 10/89 Initial version ------------------------------------------------------------------------------@ OLPaneEndGrab method dynamic OLPaneClass, MSG_VIS_LOST_GADGET_EXCL push ds:[di].OLPI_window ; Save window handle while we can get it push ds:[di].OLPI_optFlags ; Save opt flags for wandering-grab ; check. call OLPaneClearGrabsCommon ; ; If we've got a wandering grab active, set the quick-transfer cursor ; to the non-interactable one. If no quick-transfer is active (someone ; told us to allow global transfer for no apparent reason), this will ; have no effect, so it won't cause any harm. -- ardeb 7/31/92 ; pop ax test ax, mask OLPOF_WANDERING_GRAB jz tellContent mov ax, CQTF_CLEAR clr bp call ClipboardSetQuickTransferFeedback tellContent: pop bp ; Pass window handle in bp per method ; specification mov ax, MSG_META_CONTENT_VIEW_LOST_GADGET_EXCL call OLPaneSendToApp ret OLPaneEndGrab endm COMMENT @---------------------------------------------------------------------- FUNCTION: OLPaneClearGrabsCommon DESCRIPTION: Clear all grab flags, scrolling, panning, mouse grab, & timers, all without tampering with the gadget exclusive. CALLED BY: INTERNAL PASS: *ds:si - OLPaneClass object RETURN: nothing DESTROYED: di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/92 Initial version ------------------------------------------------------------------------------@ OLPaneClearGrabsCommon proc near ; Clear bits which are defined as being clear when losing gadget excl ; mov di, ds:[si] add di, ds:[di].Vis_offset and ds:[di].OLPI_optFlags, not (mask OLPOF_PRESS_GRAB or \ mask OLPOF_PANNING_GRAB or \ mask OLPOF_DRAG_SCROLL_ON_ANY_BUTTON or \ mask OLPOF_DRAG_SCROLLING) ; .. as well as the mouse grab, which may not be had without the gadget ; exclusive. ; call VisReleaseMouse call OLPaneNoUpdatePending ; Turn off timers, etc. related to ; above bits ; If ptr no longer over view area, send off MSG_META_CONTENT_LEAVE, if ; we haven't done so already. ; mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLPI_optFlags, mask OLPOF_PTR_IN_RAW_UNIV jnz done call OLPaneContentLeave done: ret OLPaneClearGrabsCommon endp COMMENT @---------------------------------------------------------------------- METHOD: OLPanePtr -- MSG_META_PTR for OLPaneClass DESCRIPTION: Handles pointer events in the pane. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_PTR cx, dx - ptr screen position, relative to view window. RETURN: ax - 0 if ptr not in button, mask MRF_PROCESSED if ptr is inside cx, dx, bp -- trashed 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 7/28/89 Initial version ------------------------------------------------------------------------------@ OLPanePtrMethod method dynamic OLPaneClass, MSG_META_PTR call ViewEnabled? ;make sure view is enabled LONG jz exit ;nope, exit ; Rather than doing this, which is not too incredibly fast, we can do ; an optimized check (which follows in braces) ; ; See if the mouse is interacting ; ; with the pane (as opposed to ; ; the thin border around it) ; call TestIfMouseImpliedOrActiveInPaneWindow ; jc exitProcessed ; Not in window, handled by superclass, ; ; { ; Test to see if we have the mouse ; grabbed at this time mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB jnz sendOnPtrEvent ; if so (same criteria as used ; to grab mouse), then window handle ; in grab is pane, coord info ; is OK, go ahead and send. sendBasedOnInRawUniv: ; OTHERWISE, we may assume that ; we got the event because we are ; the implied window. Check to see ; if ptr is in RAW_UNIV of pane ; or not test ds:[di].OLPI_optFlags, mask OLPOF_PTR_IN_RAW_UNIV jnz sendOnPtrEvent ; in raw universe, go process it mov di, offset OLPaneClass call ObjCallSuperNoLock ; else send to any children jmp exitProcessed sendOnPtrEvent: ; } mov di, ds:[si] add di, ds:[di].Vis_offset ; NOTE: ds:di must be object! call UpdateConstrain ; update our local copy of constrain bit ; WANDER DETECTION ; ; Check for situation of mouse wandering into the view window on ; an implied basis, i.e. we don't have the grab ; test ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB jnz afterWanderDetect ; nope, just the usual ; indeed, we've just gotten an implied PTR event. ; Presume no mouse buttons are down... andnf ds:[di].OLPI_optFlags, not mask OLPOF_WANDERING_GRAB ; test presumption test bp, mask BI_B0_DOWN or \ mask BI_B1_DOWN or \ mask BI_B2_DOWN or \ mask BI_B3_DOWN jz afterWanderDetect ; nope, just the usual ; ; only do wander grab on quick-transfer, prevents unwanted grabbing ; of gadget excl if dragging on START_SELECT - brianc 2/4/93 ; test bp, mask UIFA_MOVE_COPY shl 8 jz afterWanderDetect ; Jackpot! We've detected the mouse wandering into ; us with a mouse button down, meaning that there is ; a wandering grab, such as a quick-transfer active. ; To accomodate it, we'll grab the gadget excl & mouse, ; but with the caveat of a "WANDERING_GRAB" in action. call OLPaneGrabGadgetExclAndMouse mov di, ds:[si] add di, ds:[di].Vis_offset or ds:[di].OLPI_optFlags, mask OLPOF_WANDERING_GRAB afterWanderDetect: ; UNCONSTRAIN ; ; Check to see if ptr outside of view window, with wandering grab, ; but without CONSTRAIN bit, i.e. it has been released by user ; mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLPI_optFlags, mask OLPOF_WANDERING_GRAB jz afterUnconstrain test ds:[di].OLPI_optFlags, mask OLPOF_PTR_IN_RAW_UNIV or \ mask OLPOF_CONSTRAIN jnz afterUnconstrain ; ; Force release of gadget exclusive, so that we let the mouse ; wander again. ; mov ax, MSG_VIS_RELEASE_GADGET_EXCL call VisCallParentWithSelf mov ax, MSG_FLOW_ALLOW_GLOBAL_TRANSFER clr di call UserCallFlow ; Don't send ptr event onto content -- instead, replay it to ; whatever window it is over now. ; mov ax, mask MRF_PROCESSED or mask MRF_REPLAY jmp short exitProcessed afterUnconstrain: ; PANNING ; ; Handle panning if we're doing panning. ; test ds:[di].OLPI_optFlags, mask OLPOF_PANNING_GRAB jnz pan ; DRAG SCROLL ; ; If select-scrolling, let's possibly start a scroll happening. ; test ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLLING jz afterDragScroll ;not select scrolling, branch test ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLL_PENDING or \ mask OLPOF_TIMER_EXPIRED_PENDING jnz afterDragScroll ;already started one, branch ; ; We'll select scroll, and send the pointer event to the content, ; anyway, in case it is wanted or the thing doesn't actually scroll. ; (Used to just exit afterwards -- changed to this 7/30/90 cbh) ; push ax, cx, dx, bp ;save regs call OLPaneSelectScroll ;else possibly start something pop ax, cx, dx, bp ;restore regs afterDragScroll: ; SEND TO CONTENT ; mov di, ds:[si] add di, ds:[di].Gen_offset test ds:[di].GVI_attrs, mask GVA_DONT_SEND_PTR_EVENTS jnz afterSendToContent call TransCoords ;translate coords as needed ;Else send on to pane ;window, compressing events ;as we go. push si mov bx, ds:[di].GVI_content.handle mov si, ds:[di].GVI_content.chunk push cs ;push custom vector on stack mov di, offset OLCombineMouseEvent push di mov di, mask MF_FORCE_QUEUE or mask MF_CHECK_DUPLICATE or \ mask MF_CUSTOM or mask MF_CHECK_LAST_ONLY call ObjMessage ;off she goes... pop si afterSendToContent: exit: mov ax, mask MRF_PROCESSED ; assume output sets ptr image exitProcessed: ret pan: if 0 mov ax, cx ;pointer coords in ax,bx mov bx, dx ; push di ; mov di, ds:[di].OLPI_window ;pass window handle ; call WinTransform ;make screen coords! ; pop di mov cx, ds:[di].OLPI_mouseX ;get old position mov dx, ds:[di].OLPI_mouseY sub cx, ax ;subtract new position from old sub dx, bx mov ds:[di].OLPI_mouseX, ax ;store new position mov ds:[di].OLPI_mouseY, bx call ConvertScreenToDocCoords ;convert to document change mov ax, MSG_SPEC_VIEW_PAN ;send scroll method to ourselves call ObjCallInstanceNoLock ; endif jmp short exit OLPanePtrMethod endm ; ; Custom combination routine for ptr events, called by ObjMessage in ; OLPanePtr above. ; OLCombineMouseEvent proc far class OLPaneClass cmp ds:[bx].HE_method, MSG_META_PTR jne cantUpdate cmp ds:[bx].HE_bp, bp ; different button flags? jne cantUpdate ; yes!, can't combine mov ds:[bx].HE_cx, cx ; update event mov ds:[bx].HE_dx, dx ; update event mov di, PROC_SE_EXIT ; show we're done ret cantUpdate: mov di, PROC_SE_STORE_AT_BACK ; just put at the back. ret OLCombineMouseEvent endp COMMENT @---------------------------------------------------------------------- FUNCTION: UpdateConstrain DESCRIPTION: Copy UIFA_CONSTRAIN bit into local instance bit CALLED BY: INTERNAL OLPanePtrMethod OLPaneButton PASS: ds:di - ptr straight into OLPaneClass object bp high - UIFunctionsActive RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 3/92 Initial version ------------------------------------------------------------------------------@ UpdateConstrain proc near test bp, (mask UIFA_CONSTRAIN) shl 8 jz clear ornf ds:[di].OLPI_optFlags, mask OLPOF_CONSTRAIN ret clear: andnf ds:[di].OLPI_optFlags, not mask OLPOF_CONSTRAIN ret UpdateConstrain endp COMMENT @---------------------------------------------------------------------- ROUTINE: TransCoords SYNOPSIS: Translates coordinates, as needed. CALLED BY: utility PASS: *ds:si -- view cx, dx -- mouse position, in window coordinates RETURN: cx, dx -- coords translated, according to translate flag carry set if window is closing DESTROYED: nothing PSEUDO CODE/STRATEGY: if (not GVA_WINDOW_COORDINATE_MOUSE_EVENTS) WinUnTransCoord(cx, dx, OLPI_window) endif KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 4/26/91 Initial version Doug 5/13/91 Changed to pass unscaled data for large doc model case (Now new flag GVA_WINDOW_COORDINATE_ MOUSE_EVENTS) ------------------------------------------------------------------------------@ TransCoords proc near uses di, ax, bx .enter mov di, ds:[si] add di, ds:[di].Gen_offset ;See if passing window coords ;between view & content test ds:[di].GVI_attrs, mask GVA_WINDOW_COORDINATE_MOUSE_EVENTS jnz exit ;branch if doing this call PaneGetWindow ;get window in di jz exit ;no window, exit (cbh 10/21/91) push cx, dx ;save mouse coords call WinGetWinScreenBounds ;add window left/top back in pop cx, dx add ax, cx add bx, dx ;we now have screen coords again call WinUntransform ;go ahead and translate mov cx, ax mov dx, bx EC < jnc EC10 > EC < cmp ax, WE_COORD_OVERFLOW > EC < ERROR_E OL_VIEW_CANT_SEND_ABS_MOUSE_COORDS_TO_BIG_CONTENTS > EC < EC10: > exit: .leave ; ret TransCoords endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrabTargetAndFocusIfPossible %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Grabs the target and focus, unless the "don't grab from text objects" flag is set, and a text object has the focus. CALLED BY: GLOBAL PASS: *ds:si - OLPane object RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 10/21/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrabTargetAndFocusIfPossible proc near uses ax, cx, dx, bp .enter ; ; New code so that certain views avoid taking the focus from text ; objects. Currently only used by scrolling lists, as text objects ; and other contents figure to always want the focus if the thing ; is focusable, anyway. Of course, I see no code here for ; GVA_FOCUSABLE, so I wonder... -cbh 9/12/92 ; mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLPI_flags, mask OLPF_DONT_TAKE_FOCUS_FROM_TEXT_OBJECTS jz 10$ call OpenTestIfFocusOnTextEditObject jnc exit ;skip if on text object, shouldn't take ; focus or target... 10$: mov ax, MSG_META_GRAB_TARGET_EXCL call ObjCallInstanceNoLock mov ax, MSG_META_GRAB_FOCUS_EXCL call ObjCallInstanceNoLock exit: .leave ret GrabTargetAndFocusIfPossible endp COMMENT @---------------------------------------------------------------------- METHOD: OLPaneStartSelect - Handler for MSG_META_START_SELECT DESCRIPTION: Implements click-to-type kbd focus, if selected. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_START_SELECT cx - x pos, in window coordinates dx - y pos, in window coordinates bp high - UIFunctionsActive bp low - ButtonInfo RETURN: nothing 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 ---- ---- ----------- Doug 5/89 Initial version ------------------------------------------------------------------------------@ OLPaneStartSelect method OLPaneClass, MSG_META_START_SELECT call ViewEnabled? ; make sure view is enabled jz exit ; nope, exit ; See if the mouse is interacting ; with the pane (as opposed to ; the thin border around it) call TestIfMouseImpliedOrActiveInPaneWindow jc exitProcessed ; Not in window, handled by superclass, ; exit call GrabTargetAndFocusIfPossible GOTO OLPaneButton exit: mov ax, mask MRF_PROCESSED ;say processed exitProcessed: ret OLPaneStartSelect endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneStartFeatures - Handler for MSG_META_START_FEATURE DESCRIPTION: Handles panning of the pane. Gets the grab for the pane. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_START_FEATURE cx - x pos dx - y pos bp - OpenButton flags RETURN: nothing 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 ---- ---- ----------- Doug 5/89 Initial version ------------------------------------------------------------------------------@ OLPaneStartFeatures method OLPaneClass, MSG_META_START_FEATURES call ViewEnabled? ; make sure view is enabled jz exit ; nope, exit ; See if the mouse is interacting ; with the pane (as opposed to ; the thin border around it) call TestIfMouseImpliedOrActiveInPaneWindow jc exitProcessed ; Not in window, handled by superclass, ; exit push bp call OLPaneButton pop bp mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB jz exitProcessed ;don't have grab, exit test bp, mask UIFA_PAN shl 8 ; panning option set? jz exitProcessed ; if not, do standard button stuff ; Mark as panning or ds:[di].OLPI_optFlags, mask OLPOF_PANNING_GRAB exit: mov ax, mask MRF_PROCESSED exitProcessed: ret OLPaneStartFeatures endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneEndFeatures - Handler for MSG_META_END_FEATURES DESCRIPTION: Stops panning (if scrollable) PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_END_FEATURES cx - x pos dx - y pos bp - OpenButton flags RETURN: nothing 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 ---- ---- ----------- Doug 5/89 Initial version ------------------------------------------------------------------------------@ OLPaneEndFeatures method OLPaneClass, MSG_META_END_FEATURES ; See if the mouse is interacting ; with the pane (as opposed to ; the thin border around it) call TestIfMouseImpliedOrActiveInPaneWindow jc exitProcessed ; Not in window, handled by superclass, ; exit ; Make sure not panning anymore ; (EVEN IF NOT ENABLED) mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance and ds:[di].OLPI_optFlags, not (mask OLPOF_PANNING_GRAB) GOTO OLPaneButton ; & do regular handling exit: mov ax, mask MRF_PROCESSED exitProcessed: ret OLPaneEndFeatures endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneRawEnter DESCRIPTION: Uses raw enter method to turn off any drag scrolling in progress. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_RAW_UNIV_ENTER RETURN: nothing ax, cx, dx, bp -- trashed 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 9/ 6/89 Initial version ------------------------------------------------------------------------------@ OLPaneRawEnter method OLPaneClass, MSG_META_RAW_UNIV_ENTER ; Ptr is longer in universe mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance or ds:[di].OLPI_optFlags, mask OLPOF_PTR_IN_RAW_UNIV ; ; END any select scrolling in process ; mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance and ds:[di].OLPI_optFlags, not mask OLPOF_DRAG_SCROLLING ; No more. Not needed, & just results in more messages flying around. ; -- Doug 7/1/92 ; ; NOTIFY OD ; ; call OLPaneSendToApp ; Send out a MSG_META_CONTENT_ENTER, unless we've already done so. ; mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLPI_optFlags, mask OLPOF_ENTERED jnz afterEnter ornf ds:[di].OLPI_optFlags, mask OLPOF_ENTERED mov ax, MSG_META_CONTENT_ENTER mov cx, ds:[LMBH_handle] mov dx, si call OLPaneSendToApp afterEnter: ret OLPaneRawEnter endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneRawLeave DESCRIPTION: Handler for MSG_META_RAW_UNIV_LEAVE. Implements drag-scrolling. If a wandering mouse grab is in effect, release the gadget exclusive if we have it, so that the mouse can continue to wander. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_RAW_LEAVE RETURN: nothing ax, cx, dx, bp -- trashed 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 9/ 1/89 Initial version ------------------------------------------------------------------------------@ OLPaneRawLeave method OLPaneClass, MSG_META_RAW_UNIV_LEAVE ; Ptr is no longer in universe mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance and ds:[di].OLPI_optFlags, not mask OLPOF_PTR_IN_RAW_UNIV call ViewEnabled? ; make sure view is enabled jz afterConstrain ; if not, force release of any exlusive ; WANDER CONTINUATION ; ; If not wandering, keep mouse grabbed by view, by not messing ; with gadget excl. ; test ds:[di].OLPI_optFlags, mask OLPOF_WANDERING_GRAB jz afterForceRelease ; See if user has CONSTRAIN override to wandering mouse ; test ds:[di].OLPI_optFlags, mask OLPOF_CONSTRAIN jz afterConstrain ; But! Can't oblige if GVA_DRAG_SCROLLING not set. ; mov bx, ds:[si] add bx, ds:[bx].Gen_offset test ds:[bx].GVI_attrs, mask GVA_DRAG_SCROLLING jz afterConstrain ; if so, set bit to let the scrolling begin, & skip force-off of ; gadget exclusive. ; ornf ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLL_ON_ANY_BUTTON jmp short afterForceRelease afterConstrain: ; If mouse should be allowed to wander, force off gadget excl so it can ; push ax, cx, dx, bp mov ax, MSG_VIS_RELEASE_GADGET_EXCL call VisCallParentWithSelf call ViewEnabled? ; make sure view is enabled jz afterAllowGlobalTransfer ; no, branch -cbh 4/26/93 mov ax, MSG_FLOW_ALLOW_GLOBAL_TRANSFER clr di call UserCallFlow afterAllowGlobalTransfer: pop ax, cx, dx, bp afterForceRelease: call ViewEnabled? ; make sure view is enabled jz afterDragScroll ; if not, can't drag scroll ; DRAG SCROLL DETECTION ; ; See if we're supposed to scroll while moving outside of the window. ; If so, we should set the OLPWF_DRAG_SCROLLING flag to start ; scrolling the window. ; mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB jz afterDragScroll ;don't have grab, exit ; See if temp override to allow ; drag scroll until end of win grab test ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLL_ON_ANY_BUTTON jnz startDragScroll mov di, ds:[si] add di, ds:[di].Gen_offset test ds:[di].GVI_attrs, mask GVA_DRAG_SCROLLING jz exit ;user doesn't want it, branch ; See if select button down ; (we only scroll on select) push ax, cx, dx, bp mov ax, MSG_VIS_VUP_GET_MOUSE_STATUS call VisCallParent mov ax, bp test ah, mask UIFA_SELECT pop ax, cx, dx, bp jz exit ;if not exit startDragScroll: mov di, ds:[si] add di, ds:[di].Vis_offset or ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLLING push ax, cx, dx, bp call OLPaneSelectScroll ;initiate a select-scroll event pop ax, cx, dx, bp afterDragScroll: exit: ; Unless press grab is still active (in which case content is ; still being interacted with), send a MSG_META_CONTENT_LEAVE ; mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB jnz afterLeave call OLPaneContentLeave afterLeave: ; No more. Not needed, & just results in more messages flying around. ; -- Doug 7/1/92 ; ; NOTIFY OD of MSG_META_RAW_UNIV_LEAVE ; ; call OLPaneSendToApp ret OLPaneRawLeave endm OLPaneContentLeave proc near mov di, ds:[si] add di, ds:[di].Vis_offset ; if already left, done. test ds:[di].OLPI_optFlags, mask OLPOF_ENTERED jz done ; else clear bit & leave. andnf ds:[di].OLPI_optFlags, not mask OLPOF_ENTERED push ax, cx, dx, bp mov ax, MSG_META_CONTENT_LEAVE mov cx, ds:[LMBH_handle] mov dx, si call OLPaneSendToApp pop ax, cx, dx, bp done: ret OLPaneContentLeave endp COMMENT @---------------------------------------------------------------------- METHOD: OLPaneForceInitiateDragScroll -- MSG_SPEC_VIEW_FORCE_INITIATE_DRAG_SCROLL for OLPaneClass DESCRIPTION: Forces a drag scroll by turning on the _GRAB flag. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_SPEC_VIEW_FORCE_INITIATE_DRAG_SCROLL RETURN: nothing ax, cx, 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 11/23/92 Initial Version ------------------------------------------------------------------------------@ OLPaneForceInitiateDragScroll method dynamic OLPaneClass, \ MSG_SPEC_VIEW_FORCE_INITIATE_DRAG_SCROLL ; or ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB andnf ds:[di].OLPI_optFlags, not mask OLPOF_WANDERING_GRAB call OLPaneGrabGadgetExclAndMouse FALL_THRU OLPaneInitiateDragScroll OLPaneForceInitiateDragScroll endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneInitiateDragScroll DESCRIPTION: Initiates panning of window, if mouse button(s) are down. This is used for the case that an application wishes panning to happen with buttons other than the SELECT button (Such as hitting DIRECT_ACTION on a control point in Draw) PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_GEN_VIEW_INITIATE_DRAG_SCROLL RETURN: nothing ax, cx, dx, bp -- trashed 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 ---- ---- ----------- Doug 5/89 Initial version ------------------------------------------------------------------------------@ OLPaneInitiateDragScroll method OLPaneClass, \ MSG_GEN_VIEW_INITIATE_DRAG_SCROLL call ViewEnabled? ; make sure view is enabled jz exit ; nope, exit mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance ; First, make sure that a PRESS_GRAB ; is in effect test ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB jz exit ; if not, done ; Set flag to allow any-button drag ; scroll or ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLL_ON_ANY_BUTTON ; if in view, or already scrolling, done ; test ds:[di].OLPI_optFlags, mask OLPOF_PTR_IN_RAW_UNIV jnz exit ; if still in window, no scroll test ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLLING jnz exit ; if already scrolling, done ; Else, START scrolling ; or ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLLING call OLPaneSelectScroll ; try to initiate a scroll exit: EC < Destroy ax, cx, dx, bp ;trash things > ret OLPaneInitiateDragScroll endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneUpdateComplete -- MSG_META_WIN_UPDATE_COMPLETE for OLPaneClass DESCRIPTION: Handles update complete events. When we're not in select- scrolling mode, we just send the event up to the parent, to see if any scrollbars need to keep scrolling. If we are in select-scroll mode, we check to see if the current mouse position is outside the window and send a scroll method to our parent if so. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_WIN_UPDATE_COMPLETE RETURN: nothing ax, cx, dx, bp -- trashed 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 8/22/89 Initial version ------------------------------------------------------------------------------@ WinCommon segment resource global OpenWinDarkenWindow:far WinCommon ends OLPaneUpdateComplete method OLPaneClass, MSG_META_WIN_UPDATE_COMPLETE mov di, ds:[si] ;no more scroll pending add di, ds:[di].Vis_offset ; and ds:[di].OLPI_optFlags, not mask OLPOF_DRAG_SCROLL_PENDING call RepeatSelectScroll ret OLPaneUpdateComplete endm COMMENT @---------------------------------------------------------------------- ROUTINE: RepeatSelectScroll SYNOPSIS: Repeats the select scroll, if needed. CALLED BY: OLPaneUpdateComplete, OLPaneTimerExpired PASS: *ds:si -- object RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 6/ 6/90 Initial version ------------------------------------------------------------------------------@ RepeatSelectScroll proc far mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLLING jz repeatScroll ;not select-scrolling branch test ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLL_PENDING \ or mask OLPOF_TIMER_EXPIRED_PENDING jnz exit ;still waiting for one of these, ; exit ; ; Try initiating another select-scroll event if the pointer is still ; out of the window bounds. ; call OLPaneSelectScroll ;else try to initiate scroll jmp short exit repeatScroll: ; ; We've just completed a normal scroll event. Send method back to ; scrollbars to see if we should scroll again. (Sadly, we must send ; it via the queue because a scrollbars MSG_META_END_SELECT may still ; be on the queue. -cbh 2/22/93) ; mov ax, MSG_REPEAT_SCROLL clr bx mov di, mask MF_FORCE_QUEUE call CallScrollbar mov bx, CS_VERTICAL mov di, mask MF_FORCE_QUEUE call CallScrollbar exit: ret RepeatSelectScroll endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetPaneWinBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the bounds for the actual window. Depends on what flags are set (could be a 0, 1, or 2 pixel wide border). CALLED BY: OLPaneRealize, OLPaneUpdateWindows PASS: *ds:si -- handle of pane RETURN: ax, bx, cx, dx -- bounds of actual window, in screen coordinates DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 4/ 4/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetPaneWinBounds proc far class OLPaneClass push di call GetWinLeftTop ;cx, dx <- window left, top call GetFrameWidth ;frame width in ax add cx, ax ;add frame to upper left add dx, ax mov ax, cx ;keep in ax, bx as well mov bx, dx mov di, ds:[si] ;and get right and bottom add di, ds:[di].Vis_offset ; from window size. add cx, ds:[di].OLPI_winWidth dec cx add dx, ds:[di].OLPI_winHeight dec dx pop di ret GetPaneWinBounds endp COMMENT @---------------------------------------------------------------------- ROUTINE: GetFrameBounds SYNOPSIS: Returns bounds of frame around window. CALLED BY: utility PASS: *ds:si -- pane RETURN: ax, bx, cx, dx -- bounds of frame around window, in screen coordinates DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 2/19/91 Initial version ------------------------------------------------------------------------------@ GetFrameBounds proc far push di call GetFrameWidth ;get frame width push ax call GetPaneWinBounds ;get bounds of frame area pop di sub ax, di ;move out from window sub bx, di add cx, di add dx, di pop di ret GetFrameBounds endp COMMENT @---------------------------------------------------------------------- METHOD: OLPaneDraw -- MSG_VIS_DRAW for OLPaneClass DESCRIPTION: Draw the pane. PASS: *ds:si - instance data es - segment of OLPaneClass ax - MSG_VIS_DRAW cl - DrawFlags: DF_EXPOSED set if updating bp - GState to use RETURN: nothing ax, cx, dx, bp -- trashed 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 ---- ---- ----------- Doug 2/89 Initial version Chris 4/91 Updated for new graphics, bounds conventions ------------------------------------------------------------------------------@ OLPaneDraw method OLPaneClass, MSG_VIS_DRAW if _OL_STYLE push es push bp push cx call ViewEnabled? ;see if enabled jnz drawIt ;it is enabled, branch greyOut: push ax mov ax, SDM_50 ;50% outline mov di, bp call GrSetLineMask pop ax drawIt: push cx push dx mov ax,GIT_PRIVATE_DATA mov di, bp call GrGetInfo ;returns ax, bx, cx, dx pop dx pop cx ; ; al = color scheme, ah = display type, cl = update flag ; mov ch, cl ;Pass DrawFlags in ch mov cl, al ;Pass color scheme in cl ;(ax & bx get trashed) mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- GenInstance test ds:[di].OLPI_attrs, mask OLPA_SPECIAL_BORDER mov di, bp ;gstate in di jnz color ;do chisel if color doesn't ; match call DrawBWPaneWinFrame ;draw normal black frame jmp short exit color: CallMod DrawColorPaneWinFrame ;draw chiseled frame exit: mov ax, SDM_100 ;in case we did a 50% pattern call GrSetAreaMask pop cx pop bp pop es mov ax, MSG_VIS_DRAW ;call superclass to draw mov di, offset OLPaneClass ; children call ObjCallSuperNoLock ret endif if _MOTIF if (not DRAW_STYLES) mov di, ds:[si] ;point to instance add di, ds:[di].Gen_offset ;ds:[di] -- SpecInstance test ds:[di].GVI_attrs, mask GVA_NO_WIN_FRAME jnz doChildren ;no frame, skip all of this endif push ax push cx mov di, bp ;gstate in di if DRAW_STYLES ;--------------------------------------------------------------- ; ; set wash color ; push di mov di, ds:[si] add di, ds:[di].Gen_offset mov dx, di ; ds:dx = gen instance movdw bxax, ds:[di].GVI_color pop di call GrSetAreaColor ; ; get frame flag, draw style, frame thickness, inset thickness ; push di mov di, dx ; ds:di = gen instance mov ax, mask DIAFF_FRAME shl 8 ; default to draw frame test ds:[di].GVI_attrs, mask GVA_NO_WIN_FRAME jz haveFrameFlag clr ax ; clear frame flag haveFrameFlag: mov di, ds:[si] add di, ds:[di].Vis_offset mov al, ds:[di].OLPI_drawStyle pop di push ax ; pass frame, draw style mov ax, (DRAW_STYLE_FRAME_WIDTH shl 8) or DRAW_STYLE_INSET_WIDTH push ax ; pass flags, inset widths call GetFrameBounds ; pass frame bounds inc cx ; make fillRect-style coords inc dx ; ; draw frame and inset ; call OpenDrawInsetAndFrame ; ; show focus for text object, if necessary ; if TEXT_DISPLAY_FOCUSABLE call ShowScrollingTextFocus endif else ;------------------------------------------------------------------------- call OpenSetInsetRectColors ;set typical colors mov bx, ds:[si] ;point to instance add bx, ds:[bx].Vis_offset ;ds:[di] -- SpecInstance test ds:[bx].OLPI_attrs, mask OLPA_SPECIAL_BORDER jnz drawIt ;special border, go draw it mov bp, (C_BLACK shl 8) or C_BLACK ;probably want black instead test ds:[bx].OLPI_attrs, mask OLPA_WHITE_BORDER jz drawIt ;not drawing white, branch mov bp, (C_WHITE shl 8) or C_WHITE ;else draw a white border drawIt: call GetFrameBounds ;get bounds inc cx ;make fillRect-style coords inc dx call OpenDrawRect ;draw an inset rect doneFrame:: endif ; DRAW_STYLES ----------------------------------------------------------- mov bp, di ;gstate in di again pop cx pop ax doChildren: mov di, offset OLPaneClass ;do children now call ObjCallSuperNoLock ret endif if _ISUI mov di, ds:[si] ;point to instance add di, ds:[di].Gen_offset ;ds:[di] -- SpecInstance test ds:[di].GVI_attrs, mask GVA_NO_WIN_FRAME jnz doChildren ;no frame, skip all of this push ax, cx, bp mov di, bp ;gstate in di call GetFrameBounds ;get bounds inc cx ;make fillRect-style coords inc dx mov bp, C_DARK_GRAY or (C_WHITE shl 8) call OpenCheckIfBW jnc 10$ mov bp, C_BLACK or (C_BLACK shl 8) 10$: call OpenDrawRect ;draw an inset rect inc ax inc bx dec cx dec dx mov bp, C_BLACK or (C_LIGHT_GRAY shl 8) call OpenCheckIfBW jnc 20$ mov bp, C_BLACK or (C_BLACK shl 8) 20$: call OpenDrawRect pop ax, cx, bp doChildren: mov di, offset OLPaneClass ;do children now GOTO ObjCallSuperNoLock endif ; _ISUI OLPaneDraw endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ShowScrollingTextFocus %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw focus indicator for scrolling text, if necessary CALLED BY: INTERNAL OLPaneDraw PASS: *ds:si = view di = gstate RETURN: nothing DESTROYED: ax, bx, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/23/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if TEXT_DISPLAY_FOCUSABLE ShowScrollingTextFocus proc near mov ax, ATTR_OL_PANE_SCROLLING_TEXT call ObjVarFindData jnc done mov bx, ds:[bx] ; *ds:bx = text object mov bx, ds:[bx] ; deref add bx, ds:[bx].Vis_offset test ds:[bx].OLTDI_specState, mask TDSS_EDITABLE jnz done test ds:[bx].OLTDI_moreState, mask TDSS_FOCUSABLE jz done test ds:[bx].VTI_intSelFlags, mask VTISF_IS_FOCUS pushf ; save focus state mov ax, ({dword}ds:[bx].VTI_washColor).low push ax ; save color for later mov bx, ({dword}ds:[bx].VTI_washColor).high call GrSetAreaColor push di ; save gstate call GetFrameWidth ; ax = frame width pop di mov bp, ax sub bp, 1+TEXT_DISPLAY_FOCUS_WIDTH ; remove gutter and focus ; width call GetFrameBounds ; view bounds add ax, bp ; adjust to get focus coords sub cx, bp add bx, bp sub dx, bp pop bp ; bp = wash color call GrFillRect ; clear area out popf ; get focus state jz done ;not needed here for some reason ; dec cx ; adjust for line drawing ; dec dx push ax mov ax, C_WHITE ; assume white cursor cmp bp, C_BLACK je haveCursorColor ; white cursor for black cmp bp, C_DARK_GREY je haveCursorColor ; white cursor for dark grey mov ax, C_BLACK ; black cursor for any other haveCursorColor: call GrSetLineColor mov al, SDM_50 call GrSetLineMask pop ax call GrDrawRect ; draw focus indicator mov al, SDM_100 call GrSetLineMask done: ret ShowScrollingTextFocus endp endif COMMENT @---------------------------------------------------------------------- ROUTINE: DrawColorPaneWinFrame SYNOPSIS: Draws a chiseled border. CALLED BY: OLPaneDraw PASS: *ds:si -- instance data cl -- color scheme ch -- DrawFlags: DF_EXPOSED set if updating di -- gstate RETURN: nothing DESTROYED: ax, bx, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 8/31/89 Initial version Chris 4/91 Updated for new graphics, bounds conventions ------------------------------------------------------------------------------@ if _OL_STYLE ;----------------------------- DrawColorPaneWinFrame proc far class OLPaneClass call GetDarkColor ;al <- dark color, ah <- flag call GrSetLineColor call GetLightColor ;al <- light color, ah <- flag call GrSetAreaColor ;use for clearing first call GetFrameBounds ;get the bounds of the thing inc cx inc dx call GrFillRect ;first white out dec cx dec dx dec cx ;inset right and bottom dec dx call GrDrawRect inc ax ;draw a dark frame, shifted inc bx inc cx inc dx push ax mov ax, C_WHITE call GrSetLineColor pop ax call GrDrawRect ;then draw the white frame ret DrawColorPaneWinFrame endp endif ;----------------------------------------- COMMENT @---------------------------------------------------------------------- ROUTINE: DrawBWPaneWinFrame SYNOPSIS: Draws a regular border. CALLED BY: OLPaneDraw PASS: *ds:si -- instance data cl -- color scheme ch -- DrawFlags: DF_EXPOSED set if updating di -- gstate RETURN: nothing DESTROYED: ax, bx, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 8/31/89 Initial version Chris 4/91 Updated for new graphics, bounds conventions ------------------------------------------------------------------------------@ if _OL_STYLE DrawBWPaneWinFrame proc near class OLPaneClass mov al, cl ;set area color to bkgd mov cl, 4 shr al, cl clr ah call GrSetAreaColor ;used for clearing mov ax, C_BLACK ;use dark color mov bx, ds:[si] ;point to instance add bx, ds:[bx].Vis_offset ;ds:[di] -- SpecInstance test ds:[bx].OLPI_attrs, mask OLPA_WHITE_BORDER jz 10$ ;not drawing white, branch mov ax, C_WHITE ;else draw a white border 10$: call GrSetLineColor call GetFrameBounds ;get the bounds of the thing inc cx inc dx call GrFillRect ;clear area first dec cx dec dx call GrDrawRect ;now draw the frame. ret DrawBWPaneWinFrame endp endif COMMENT @---------------------------------------------------------------------- METHOD: OLPaneOpenWin -- MSG_VIS_OPEN_WIN for OLPaneClass DESCRIPTION: Open pane PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_VIS_OPEN_WIN bp - window to realize on RETURN: nothing ax, cx, dx, bp -- trashed 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/ 4/89 Initial version Doug 10/89 Broke into OpenWin & MoveResizeWin ------------------------------------------------------------------------------@ OLPaneOpenWin method OLPaneClass, MSG_VIS_OPEN_WIN push si ;save pane handle call GeodeGetProcessHandle ; Get owner for window push bx ; Push layer ID to use push bx ; Push owner to use push bp ; pass parent window handle clr ax ; pass region (rectangular) push ax push ax call GetPaneWinBounds ; get window bounds to pass push dx push cx push bx push ax ; ; Get color to use, set up in the pane's spec build. ; mov di, ds:[si] ;point to instance add di, ds:[di].Gen_offset ;ds:[di] -- GenInstance movdw bxax, ds:[di].GVI_color ;bxax = color mov bp, ds:[di].GVI_content.chunk ; pass OD from pane object mov di, ds:[di].GVI_content.handle mov cx, ds:[LMBH_handle] ; pass enter/leave OD mov dx, si ; Initialize window suspended ; (No update drawing) mov si, mask WPF_INIT_SUSPENDED call WinOpen ; Inform the application that the pane is open pop si ;restore chunk handle mov di, ds:[si] add di, ds:[di].Vis_offset ;ds:di = SpecificInstance mov ds:[di].OLPI_window, bx ;store window handle push es mov ax, segment dgroup mov es, ax mov ax, es:[windowID] inc es:[windowID] pop es mov ds:[di].OLPI_windowID, ax ;change unique window ID push bx ;save window handle mov di, ds:[si] ;point to instance add di, ds:[di].Gen_offset ;ds:[di] -- GenInstance mov dx, ds:[di].GVI_scaleFactor.PF_x.WWF_int ;get current scaling mov cx, ds:[di].GVI_scaleFactor.PF_x.WWF_frac mov bx, ds:[di].GVI_scaleFactor.PF_y.WWF_int mov ax, ds:[di].GVI_scaleFactor.PF_y.WWF_frac pop di ;restore window handle push di ;save again mov bp, si ;save pane handle mov si, WIF_INVALIDATE ;invalidate when scaling call WinApplyScale ;scale the sucker mov si, bp ;restore pane handle mov ax, MSG_SPEC_VIEW_INIT_ORIGIN ;get initial origin straight call ObjCallInstanceNoLock mov ax, MSG_GEN_VIEW_GET_SCALE_FACTOR call ObjCallInstanceNoLock ;send the initial scale factor mov bx, bp call SendNewScaleToOD pop bx ;restore window handle mov ax, MSG_META_CONTENT_VIEW_WIN_OPENED call SendPaneSizeMethod ;if not normalized scrolling, ;then we won't be getting ;a NORMALIZE_COMPLETE w/initial ;position later, so ;UnSuspend now. mov di, ds:[si] add di, ds:[di].Gen_offset ;ds:si = SpecificInstance tst ds:[di].GVI_content.handle ;if no content yet, we didn't jz unsuspend ; normalize, unsuspend now. test ds:[di].GVI_attrs, mask GVA_TRACK_SCROLLING jnz done ; if normalized scrolling, the ; UnSuspend will be delayed ; until the initial position ; is sent to NORMALIZE_COMPLETE unsuspend: ; If not, then do it now. ; ; Now calling MSG_SPEC_VIEW_UNSUSPEND_OPENED_WIN, which will check ; to make sure the view window still matches, rather than MSG_GEN_- ; VIEW_UNSUSPEND_UPDATE. -cbh 4/21/93 ; mov di, ds:[si] add di, ds:[di].Vis_offset mov cx, ds:[di].OLPI_windowID mov ax, MSG_SPEC_VIEW_UNSUSPEND_OPENED_WIN mov bx, ds:[LMBH_handle] mov di, mask MF_FORCE_QUEUE ; Send via queue to force same call ObjMessage ; ordering with content ; messages whether content ; run by UI or not (they are ; also send FORCE_QUEUE ; 12/ 2/91 -cbh done: ret OLPaneOpenWin endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneUnsuspendOpenedWin -- MSG_SPEC_VIEW_UNSUSPEND_OPENED_WIN for OLPaneClass DESCRIPTION: Unsuspends the newly opened window, if it still exists. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_SPEC_VIEW_UNSUSPEND_OPENED_WIN cx - windowID of window to unsuspend RETURN: nothing ax, cx, 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/21/93 Initial Version ------------------------------------------------------------------------------@ OLPaneUnsuspendOpenedWin method dynamic OLPaneClass, \ MSG_SPEC_VIEW_UNSUSPEND_OPENED_WIN cmp cx, ds:[di].OLPI_windowID ;same window? jne exit ;no, forget unsuspend, probably ; from a previous incarnation. mov ax, MSG_GEN_VIEW_UNSUSPEND_UPDATE GOTO ObjCallInstanceNoLock exit: ret OLPaneUnsuspendOpenedWin endm COMMENT @---------------------------------------------------------------------- METHOD: OLPaneMoveResizeWin -- MSG_VIS_MOVE_RESIZE_WIN for OLPaneClass DESCRIPTION: Resizes a pane PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_VIS_MOVE_RESIZE_WIN RETURN: nothing ax, cx, dx, bp -- trashed 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/ 4/89 Initial version Doug 10/89 Broke into OpenWin & MoveResizeWin ------------------------------------------------------------------------------@ OLPaneMoveResizeWin method OLPaneClass, MSG_VIS_MOVE_RESIZE_WIN mov bx, ds:[si] add bx, ds:[bx].Vis_offset ;ds:bx = SpecificInstance mov di, ds:[bx].OLPI_window ;fetch window handle ; cmp ds:[bx].OLPI_window, 0 ;already have a window? EC< call VisCheckVisAssumption ;Make sure vis data exists > mov bx, ds:[si] add bx, ds:[bx].Vis_offset ;ds:di = VisInstance test ds:[bx].VI_optFlags, mask VOF_WINDOW_INVALID jz exit ;skip if not invalid ; ; Notify Pane OD of change in pane size. ; push si ;save chunk handle call GetPaneWinBounds mov si,mask WPF_ABS ;resize absolute (i.e. move) push si clr si clr bp call WinResize pop si ;restore handle if FLOATING_SCROLLERS ; Update floating scrollers so they'll move push cx mov cx, TRUE ;close scrollers before update call OLPaneUpdateFloatingScrollers pop cx endif ; ; Moved back here from OLPaneSetNewPageSize, so things are done in the ; correct order. 10/23/91 cbh. ; push di mov ax, MSG_META_CONTENT_VIEW_SIZE_CHANGED call SendPaneSizeMethod ;send size notification pop di ; ; Unsuspend the update, after making a complete trip through the ; application's queue. (Only if the thing has been suspended ; previously, of course.) ; ; push si ; mov si, ds:[si] ; add si, ds:[si].Vis_offset ; test ds:[si].OLPI_flags, mask OLPF_SUSPENDED_FOR_SIZE_CHANGE ; jz 90$ ; and ds:[si].OLPI_flags, not mask OLPF_SUSPENDED_FOR_SIZE_CHANGE ; call WinUnSuspendUpdate mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLPI_flags, mask OLPF_SUSPENDED_FOR_SIZE_CHANGE jz exit and ds:[di].OLPI_flags, not mask OLPF_SUSPENDED_FOR_SIZE_CHANGE mov cx, ds:[di].OLPI_windowID mov bx, ds:[LMBH_handle] mov ax, MSG_SPEC_VIEW_UNSUSPEND_OPENED_WIN ;to help updates. I think mov di, mask MF_FORCE_QUEUE ; re-maximizing displays & call ObjMessage ; stuff causes extra ; invalidation even after ; this point. 4/13/93 cbh ;90$: ; pop si exit: ret OLPaneMoveResizeWin endm COMMENT @---------------------------------------------------------------------- FUNCTION: SendPaneSizeMethod DESCRIPTION: Send a method to the OD associated with pane, containing current size of pane & pane handle CALLED BY: INTERNAL PASS: *ds:si - pane ax - Method to send on to GVI_content RETURN: Method sent to OD, with cx, dx = width & height, bp = window handle di - pane handle DESTROYED: ax, cx, dx, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/89 Initial version ------------------------------------------------------------------------------@ SendPaneSizeMethod proc far class OLPaneClass mov di, ds:[si] add di, ds:[di].Vis_offset mov cx, ds:[di].OLPI_pageWidth mov dx, ds:[di].OLPI_pageHeight FALL_THRU SendMethod ;and send SendPaneSizeMethod endp COMMENT @---------------------------------------------------------------------- ROUTINE: SendMethod SYNOPSIS: Sends a method to the output descriptor. CALLED BY: SendPaneSizeMethod, OLPaneOpenWin OLPaneMoveResizeWin PASS: ax -- method RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 8/29/89 Initial version ------------------------------------------------------------------------------@ SendMethod proc far class OLPaneClass push bp call PaneGetWindow ;get window in di mov bp, di ;pass window handle in bp call OLPaneSendToApp ;send to output pop bp ret SendMethod endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLPaneGrabGadgetExclAndMouse DESCRIPTION: Enact a PRESS_GRAB by grabbing the gadget exclusive & mouse, if we don't already have it. CALLED BY: INTERNAL OLPaneButton PASS: *ds:si - OLPane RETURN: Nothing DESTROYED: Nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/89 Initial version Doug 5/90 Updated ------------------------------------------------------------------------------@ OLPaneGrabGadgetExclAndMouse proc near uses ax, cx, dx, di, bp class OLPaneClass .enter mov di, ds:[si] add di, ds:[di].Vis_offset ; Skip if we already have it test ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB jnz done ; Mark as having grab now or ds:[di].OLPI_optFlags, mask OLPOF_PRESS_GRAB ; Init to not DRAG_SCROLLING, & ; not OLPOF_DRAG_SCROLL_ON_ANY_BUTTON andnf ds:[di].OLPI_optFlags, not (mask OLPOF_DRAG_SCROLLING or \ mask OLPOF_DRAG_SCROLL_ON_ANY_BUTTON) ; Grab gadget exclusive, so that we're allowed to grab mouse ; mov ax, MSG_VIS_TAKE_GADGET_EXCL call VisCallParentWithSelf ; Grab mouse itself, passing pane window (can't use VisGrabMouse) ; sub sp, size VupAlterInputFlowData ; create stack frame mov bp, sp ; ss:bp points to it mov ax, ds:[LMBH_handle] mov ss:[bp].VAIFD_object.handle, ax ; copy object OD into frame mov ss:[bp].VAIFD_object.chunk, si mov ss:[bp].VAIFD_flags, mask VIFGF_MOUSE or mask VIFGF_GRAB or \ mask VIFGF_PTR or mask VIFGF_NOT_HERE mov ss:[bp].VAIFD_grabType, VIFGT_ACTIVE mov di, ds:[si] add di, ds:[di].Vis_offset mov di, ds:[di].OLPI_window ; get window handle for pane mov ss:[bp].VAIFD_gWin, di ; & pass in method clr ax ; init to no translation mov ss:[bp].VAIFD_translation.PD_x.high, ax mov ss:[bp].VAIFD_translation.PD_x.low, ax mov ss:[bp].VAIFD_translation.PD_y.high, ax mov ss:[bp].VAIFD_translation.PD_y.low, ax mov dx, size VupAlterInputFlowData ; pass size of structure in dx mov ax, MSG_VIS_VUP_ALTER_INPUT_FLOW ; send method call ObjCallInstanceNoLock add sp, size VupAlterInputFlowData ; restore stack done: .leave ret OLPaneGrabGadgetExclAndMouse endp COMMENT @---------------------------------------------------------------------- METHOD: OLPaneNoUpdatePending SYNOPSIS: Indicates that the parent pane's scroll will cause an update to happen (is 0,0). CALLED BY: several routines PASS: *ds:si - instance data es - segment of MetaClass RETURN: nothing DESTROYED: di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 5/25/90 Initial version ------------------------------------------------------------------------------@ OLPaneNoUpdatePending proc far uses ax, cx, dx, bp .enter mov di, ds:[si] ;no more scroll pending add di, ds:[di].Vis_offset ; test ds:[di].OLPI_optFlags, (mask OLPOF_DRAG_SCROLL_PENDING \ or mask OLPOF_TIMER_EXPIRED_PENDING) jz exit ;neither flag set, exit and ds:[di].OLPI_optFlags, not (mask OLPOF_DRAG_SCROLL_PENDING \ or mask OLPOF_TIMER_EXPIRED_PENDING) mov dx, si ;now pass ^lcx:dx 10/29/90 cbh mov cx, ds:[LMBH_handle] mov ax, MSG_OL_APP_STOP_TIMER call GenCallApplication exit: .leave ret OLPaneNoUpdatePending endp ViewCommon ends ViewScroll segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLPaneWindowScroll -- DESCRIPTION: Scrolls the window. PASS: *ds:si - instance data es - segment of MetaClass bx:ax - new x origin dx:cx - new y origin RETURN: bx:ax - new x origin (may have changed) dx:cx - new y origin (may have changed) DESTROYED: di, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: The reason that the passed origin values may have changed is that when a view is scaled, the passed integer scroll value may not translate to an integer number of pixels. The integer number of pixels that consistute the scroll amount are translated into the equivalent document units, which may change the passed origin by some fraction. The fractional part of the change is stored in GVI_origin by this routine -- the integer part returned here is stored later by StoreNewOrigin, which is called by OLPaneScroll. REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 5/23/89 Initial version Jim 8/5/91 Added fixed-point support to GVI_origin ------------------------------------------------------------------------------@ OLPaneWindowScroll proc far uses bp, si .enter push ax, bx, cx, dx ; save translation amount ; NOTE: code at WinScroll ; (below) assumes that nothing ; is pushed between here and ; there...(jad) call MakeRelativeToOrigin ;make relative scroll amount mov bp, ax ;slightly cheaper to do this or bp, bx or bp, cx or bp, dx LONG jz exit ;nothing to scroll, exit 1/21/93 mov bp, ds:[si] ;say there's a scroll pending add bp, ds:[bp].Vis_offset mov di, ds:[bp].OLPI_window ;pass window handle tst di LONG jz exit ;exit if no window test ds:[bp].OLPI_optFlags, mask OLPOF_DRAG_SCROLLING jz 7$ push di call StartDragTimer ;start up the drag timer (moved here pop di ;(from OLPaneSelectScroll 1/21/93 cbh) 7$: ; ; If non-scrolling, we'll disconnect the view's scrolling capability, ; while keeping the origin internally. ; mov bp, ds:[si] add bp, ds:[bp].Vis_offset test ds:[bp].OLPI_attrs, mask OLPA_NON_SCROLLING LONG jnz exit ; ; Now, do the scrolling. For scrolling small amounts, and we know we ; won't be invalidating soon anyway, we'll use WinScroll. For small ; amounts where invalidation is pending, we will call WinApply- ; Translation without an invalidation. For large scrolling (32 bits), ; we'll call the new and exciting WinApplyTranslationDWord. ; call SeeIfLargeTranslation ;is vertical scroll large? jc largeScroll ;yes, branch xchg ax, cx ;now check horiz scroll xchg bx, dx call SeeIfLargeTranslation xchg ax, cx xchg bx, dx jc largeScroll ;large, branch ;smallScroll: pop ax, bx, cx, dx ; restore original absolute org call MakeRelativeWWFixed call WinScroll ;scroll the window ; the values returned by WinScroll may be different (by some fraction) ; that what we passd to the routine. We need to reflect this change ; in GVI_origin. Since we have the relative amounts in registers, we ; just add these to GVI_origin, the have this routine return the final ; value (integer part). It will get stored again later, but that's OK. updateOrigin: neg cx ; NegateFixed dx.cx not dx cmc adc dx, 0 neg ax ; NegateFixed bx.ax not bx cmc adc bx, 0 mov bp, ds:[si] ; get ptr to instance data add bp, ds:[bp].Gen_offset add ds:[bp].GVI_origin.PDF_x.DWF_frac, cx ; update origin xchg ax, cx ; need to do cwd mov ax, dx cwd adc ds:[bp].GVI_origin.PDF_x.DWF_int.low, ax adc ds:[bp].GVI_origin.PDF_x.DWF_int.high, dx add ds:[bp].GVI_origin.PDF_y.DWF_frac, cx mov ax, bx cwd adc ds:[bp].GVI_origin.PDF_y.DWF_int.low, ax adc ds:[bp].GVI_origin.PDF_y.DWF_int.high, dx movdw bxax, ds:[bp].GVI_origin.PDF_x.DWF_int movdw dxcx, ds:[bp].GVI_origin.PDF_y.DWF_int ; This screwed up the integer portion of GVI_origin. -cbh 3/30/93 ; tst ds:[bp].GVI_origin.PDF_x.DWF_frac ; jns 10$ ; incdw bxax ;10$: ; tst ds:[bp].GVI_origin.PDF_y.DWF_frac ; jns 20$ ; incdw dxcx ;20$: push ax, bx, cx, dx jmp short finishScroll largeScroll: clr si ;assume we can invalidate negdw dxcx ;negate dx:cx (y scroll amt) xchg ax, cx ;Jim does these the other way. xchg bx, dx negdw dxcx ;negate dx:cx (x scroll amt) call WinApplyTranslationDWord finishScroll: call ImForcePtrMethod ;ptr has moved wrt. window... exit: pop ax, bx, cx, dx ; restore translation amounts .leave ret OLPaneWindowScroll endp COMMENT @---------------------------------------------------------------------- ROUTINE: SeeIfLargeTranslation SYNOPSIS: Checks to see if the desired translation is large. CALLED BY: OLPaneWindowScroll PASS: dx:cx -- translation to check RETURN: carry set if large DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 3/21/91 Initial version ------------------------------------------------------------------------------@ LARGE_TRANSLATION equ 2000h ;arbitrary cutoff point... HIGH_WORD equ 0ffff0000h LOW_WORD equ 00000ffffh SeeIfLargeTranslation proc near cmp dx, (LARGE_TRANSLATION and HIGH_WORD) shr 16 jg isLarge ;a lot bigger, exit jl 10$ cmp cx, LARGE_TRANSLATION and LOW_WORD ja isLarge ;a little bigger, exit 10$: cmp dx, (-LARGE_TRANSLATION and HIGH_WORD) shr 16 jl isLarge ;a lot smaller, exit jg isSmall cmp cx, -LARGE_TRANSLATION and LOW_WORD jb isLarge ;a little smaller, exit isSmall: clc jmp short exit isLarge: stc exit: ret SeeIfLargeTranslation endp COMMENT @---------------------------------------------------------------------- METHOD: OLPaneTimerExpired -- MSG_TIMER_EXPIRED for OLPaneClass DESCRIPTION: Handles timer-expired events. We start timers at the beginning of select-scrolls. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_TIMER_EXPIRED RETURN: nothing ax, cx, dx, bp -- trashed 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 8/22/89 Initial version ------------------------------------------------------------------------------@ OLPaneTimerExpired method OLPaneClass, MSG_TIMER_EXPIRED mov di, ds:[si] ;no more scroll pending add di, ds:[di].Vis_offset ; and ds:[di].OLPI_optFlags, not mask OLPOF_TIMER_EXPIRED_PENDING call RepeatSelectScroll ret OLPaneTimerExpired endm COMMENT @---------------------------------------------------------------------- ROUTINE: OLPaneSelectScroll SYNOPSIS: Possibly initiate a scroll event. CALLED BY: OLPaneUpdateComplete, OLPaneInitiateDragScroll, OLPaneRawLeave, OLPanePtr PASS: *ds:si -- object RETURN: nothing DESTROYED: ax, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: Horrible access to pane's instance data. REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 5/21/90 Initial version ------------------------------------------------------------------------------@ OLPaneSelectScroll proc far call GetPaneWinBounds ;get pane bounds in ax,bx,cx,dx xchg bx, cx ;xchg to get left,right,top,bot push cx, dx ;save top and bottom call VisQueryWindow ;get window in di call ImGetMousePos ;returns current pos in cx, dx mov di, ds:[si] ;point to instance of pane add di, ds:[di].Gen_offset ;ds:[di] -- GenInstance of pane cmp cx, ax ;see if to left of window jge 10$ ;it's not, branch call GetLimitedXIncrement ;increment in cx clr bx ;doing horizontal xchg cx, dx ;pass scroll amount in dx call CheckIfNegativeScrollNeeded ;if we even need to scroll xchg cx, dx ;return scroll amount to cx jc 5$ ;we need to scroll, branch clr cx ;else don't scroll 5$: neg cx ;scroll negatively jmp checkVert 10$: cmp cx, bx ;see if to right of window mov cx, 0 ;assume not jle checkVert ;nope, branch call GetLimitedXIncrement clr bx ;doing horizontal xchg cx, dx ;pass scroll amount in dx call CheckIfPositiveScrollNeeded ;if we even need to scroll xchg cx, dx ;(restore scroll amount to cx) jc checkVert ;yes, branch clr cx ;else don't scroll checkVert: DoPop bx, ax ;restore bottom, top cmp dx, ax ;see if above top jge 20$ ;nope, branch call GetLimitedYIncrement mov bx, CNSN_VERTICAL ;vertical scroll call CheckIfNegativeScrollNeeded ;if we even need to scroll jc 15$ ;yes, branch clr dx ;else don't scroll 15$: neg dx ;scroll negatively jmp scroll 20$: cmp dx, bx ;see if below bottom of view!!! ; (sorry, Wendy) mov dx, 0 ;assume not jle scroll ;nope, branch call GetLimitedYIncrement mov bx, CNSN_VERTICAL ;vert scroll call CheckIfPositiveScrollNeeded ;if we even need to scroll jc scroll ;yes, branch clr dx ;else don't scroll scroll: ; ; Vert scroll amount in dx:cx, horizontal amount in bx:ax. Move into ; scroll structure. ; clr bp ;normal scroll mov ax, MSG_SPEC_VIEW_DRAG_SCROLL ;get ready to send scroll method tst cx ;see if any x change jnz stillScrolling ;yes, branch tst dx ;see if any y change jz exit ;nope, exit stillScrolling: call ObjCallInstanceNoLock ;go scroll exit: ret OLPaneSelectScroll endp COMMENT @---------------------------------------------------------------------- ROUTINE: StartDragTimer SYNOPSIS: Start up the drag timer for a drag scroll. CALLED BY: OLPaneWindowScroll PASS: *ds:si -- pane RETURN: nothing DESTROYED: di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 1/21/93 Initial version ------------------------------------------------------------------------------@ StartDragTimer proc near ; ; Start a timer going. We won't re-scroll until the timer expires. ; push ax, cx, dx, bp mov dx, si ;now pass ^lcx:dx 10/29/90 cbh mov cx, ds:[LMBH_handle] mov ax, MSG_OL_APP_STOP_TIMER call GenCallApplication ; turn timer off, if any clr bp ; use standard system delay mov dx, si mov cx, ds:[LMBH_handle] mov ax, MSG_OL_APP_START_TIMER call GenCallApplication pop ax, cx, dx, bp mov di, ds:[si] add di, ds:[di].Vis_offset or ds:[di].OLPI_optFlags, mask OLPOF_DRAG_SCROLLING or \ mask OLPOF_TIMER_EXPIRED_PENDING ret StartDragTimer endp COMMENT @---------------------------------------------------------------------- ROUTINE: GetLimitedXIncrement, GetLimitedYIncrement SYNOPSIS: Get x increment, limited to a maximum value. CALLED BY: OLPaneSelectScroll PASS: ds:di -- GenView instance RETURN: cx -- value to use (dx for GetLimitedYIncrement) DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 5/ 3/91 Initial version ------------------------------------------------------------------------------@ MAX_DRAG_SCROLL_INCREMENT equ 4000 GetLimitedXIncrement proc near mov cx, ds:[di].GVI_increment.PD_x.low cmp cx, MAX_DRAG_SCROLL_INCREMENT ;limit to a maximum increment ja 3$ tst ds:[di].GVI_increment.PD_x.high jz 5$ 3$: mov cx, MAX_DRAG_SCROLL_INCREMENT 5$: ret GetLimitedXIncrement endp GetLimitedYIncrement proc near mov dx, ds:[di].GVI_increment.PD_y.low cmp dx, MAX_DRAG_SCROLL_INCREMENT ;limit to a maximum increment ja 3$ tst ds:[di].GVI_increment.PD_y.high jz 5$ 3$: mov dx, MAX_DRAG_SCROLL_INCREMENT 5$: ret GetLimitedYIncrement endp COMMENT @---------------------------------------------------------------------- ROUTINE: CheckIfNegativeScrollNeeded SYNOPSIS: Checks to see we need a negative scroll to see more of the drag bounds. CALLED BY: OLPaneSelectScroll PASS: *ds:si -- view bx -- CNSN_VERTICAL if y, zero otherwise dx -- suggested absolute amount to scroll (will be negated later) RETURN: carry set if scroll needed, with: dx -- possibly updated to only scroll what is necessary DESTROYED: di PSEUDO CODE/STRATEGY: can scroll if docOrigin.x > dragLeft KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 5/ 3/91 Initial version ------------------------------------------------------------------------------@ CNSN_VERTICAL equ offset P_y - offset P_x CheckIfNegativeScrollNeeded proc near uses cx, bp .enter mov di, ds:[si] add di, ds:[di].Gen_offset add di, bx ;account for direction for add di, bx ; GVI_origin (using add di, bx ; CNSN_VERTICAL * 3) mov bp, ds:[si] add bp, ds:[bp].Vis_offset test ds:[bp].OLPI_optFlags, mask OLPOF_LIMIT_DRAG_SCROLLING jz needed ;not limiting, exit add bp, bx ;account for direction for add bp, bx ; OLPI_dragBounds (using ; CNSN_VERTICAL * 2) mov cx, ds:[di].GVI_origin.PDF_x.DWF_int.high cmp cx, ds:[bp].OLPI_dragBounds.RD_left.high jg needed jl notNeeded mov cx, ds:[di].GVI_origin.PDF_x.DWF_int.low sub cx, ds:[bp].OLPI_dragBounds.RD_left.low jbe notNeeded ;already onscreen, branch ; ; We need the thing onscreen. If the amount of scrolling needed to ; get the object completely onscreen is smaller than the increment ; amount, then we'll just scroll that amount. ; cmp cx, dx ;still a ways to go before ja needed ; getting onscreen, branch mov dx, cx ;else only scroll as much as we jmp short needed ; need notNeeded: clc jmp short exit needed: stc exit: .leave ret CheckIfNegativeScrollNeeded endp COMMENT @---------------------------------------------------------------------- ROUTINE: CheckIfPositiveScrollNeeded SYNOPSIS: Checks to see we need a positive scroll to see more of the drag bounds. CALLED BY: OLPaneSelectScroll PASS: *ds:si -- view bx -- CNSN_VERTICAL if in y, zero otherwise RETURN: carry set if scroll needed DESTROYED: di PSEUDO CODE/STRATEGY: should scroll if docOrigin.x + pageWidth < dragRight KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 5/ 3/91 Initial version ------------------------------------------------------------------------------@ CheckIfPositiveScrollNeeded proc near uses ax, cx, bp CheckHack <CNSN_VERTICAL eq (offset OLPI_pageHeight - \ offset OLPI_pageWidth)> CheckHack <CNSN_VERTICAL*3 eq (offset GVI_origin.PDF_y - \ offset GVI_origin.PDF_x)> CheckHack <CNSN_VERTICAL*2 eq (offset OLPI_dragBounds.RD_top - \ offset OLPI_dragBounds.RD_left)> .enter mov di, ds:[si] add di, ds:[di].Gen_offset add di, bx ;account for direction add di, bx ; using CNSN_VERTICAL*3 add di, bx mov bp, ds:[si] add bp, ds:[bp].Vis_offset test ds:[bp].OLPI_optFlags, mask OLPOF_LIMIT_DRAG_SCROLLING jz needed ;not limiting, exit mov ax, ds:[di].GVI_origin.PDF_x.DWF_int.high mov cx, ds:[di].GVI_origin.PDF_x.DWF_int.low tst ds:[di].GVI_origin.PDF_x.DWF_frac.high clc ; set carry correct for round jns addWidth stc addWidth: add bp, bx ;vertical offset to words add cx, ds:[bp].OLPI_pageWidth ;origin + pageWidth adc ax, 0 add bp, bx ;bp now used for dwords cmp ax, ds:[bp].OLPI_dragBounds.RD_right.high jl needed jg notNeeded sub cx, ds:[bp].OLPI_dragBounds.RD_right.low jae notNeeded ; ; We need the thing onscreen. If the amount of scrolling needed to ; get the object completely onscreen is smaller than the increment ; amount, then we'll just scroll that amount. ; neg cx ;make positive cmp cx, dx ;still a ways to go before ja needed ; getting onscreen, branch mov dx, cx ;else only scroll as much as we jmp short needed ; need notNeeded: clc jmp short exit needed: stc exit: .leave ret CheckIfPositiveScrollNeeded endp ViewScroll ends
25.638738
81
0.634316
340448d2adc2a141060e4c2f9650dbb606f3c6a2
526
asm
Assembly
programs/oeis/231/A231686.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/231/A231686.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/231/A231686.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A231686: a(n) = Sum_{i=0..n} digsum_9(i)^3, where digsum_9(i) = A053830(i). ; 0,1,9,36,100,225,441,784,1296,1297,1305,1332,1396,1521,1737,2080,2592,3321,3329,3356,3420,3545,3761,4104,4616,5345,6345,6372,6436,6561,6777,7120,7632,8361,9361,10692,10756,10881,11097,11440,11952,12681,13681,15012,16740,16865,17081,17424,17936,18665,19665,20996,22724,24921,25137,25480,25992,26721,27721,29052 mov $2,$0 mov $4,$0 lpb $4 mov $0,$2 sub $4,1 sub $0,$4 mov $3,$0 div $0,9 mod $3,9 add $3,$0 pow $3,3 add $1,$3 lpe
30.941176
311
0.684411
4b1e59b08b187c19f3498564434a68a0171aae05
1,923
asm
Assembly
programs/oeis/053/A053220.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/053/A053220.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/053/A053220.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A053220: a(n) = (3*n-1) * 2^(n-2). ; 1,5,16,44,112,272,640,1472,3328,7424,16384,35840,77824,167936,360448,770048,1638400,3473408,7340032,15466496,32505856,68157440,142606336,297795584,620756992,1291845632,2684354560,5570035712,11542724608,23890755584,49392123904,102005473280,210453397504,433791696896,893353197568,1838246002688,3779571220480,7765300871168,15942918602752,32710470926336,67070209294336,137438953472000,281474976710656,576144092954624,1178676464975872,2410129488084992,4925812092436480,10062730417405952,20547673299877888,41939771529887744,85568392920039424,174514485560606720,355784370562269184,725079540006649856,1477180677777522688,3008404551083491328,6124895493223874560,12465963768561532928,25364273101350633472,51593237331156402176,104915856919223074816,213290478352266690560,433498485732174462976,880832029519631089664,1789334175149826506752,3634008582520781668352,7378697629483820646400,14978756187852155912192,30400234233473341063168,61685912182484740603904,125142711796045598162944,253827198454243430236160,514737946632791328292864,1043642992714191592226816,2115620184325601055735808,4287908766445637854035968,8689154328480147193200640,17604982248138037356658688,35663311678631560653832192,72233317721974093188694016,146280024173370130139447296,296186825805584147803013120,599627206528856070654263296,1213761522893087691405000704,2456537265456926483002949632,4971102970255355166391795712,10058262819193714733555384320,20348639395753438268654354432,41161506306238894140395880448,83251467641941823486966104064,168359845342811717386280894464,340433510803479575597259161600,688294661842671432843913068544,1391444604156767428986615627776,2812599769256383984570810236928,5684620660398466222336778436608,11488083564568328951063872798720,23213851616679450914908377448448,46903072208444487855378018598912,94756882367060147761878564601856 mov $1,$0 mul $0,3 add $0,2 mov $2,2 pow $2,$1 mul $0,$2 div $0,2
174.818182
1,818
0.918877
c0f691f25ea907715df73a561aacf5f75691a3b4
1,253
asm
Assembly
_build/dispatcher/jmp_ippsAESDecryptXTS_Direct_26b9d39e.asm
zyktrcn/ippcp
b0bbe9bbb750a7cf4af5914dd8e6776a8d544466
[ "Apache-2.0" ]
1
2021-10-04T10:21:54.000Z
2021-10-04T10:21:54.000Z
_build/dispatcher/jmp_ippsAESDecryptXTS_Direct_26b9d39e.asm
zyktrcn/ippcp
b0bbe9bbb750a7cf4af5914dd8e6776a8d544466
[ "Apache-2.0" ]
null
null
null
_build/dispatcher/jmp_ippsAESDecryptXTS_Direct_26b9d39e.asm
zyktrcn/ippcp
b0bbe9bbb750a7cf4af5914dd8e6776a8d544466
[ "Apache-2.0" ]
null
null
null
extern m7_ippsAESDecryptXTS_Direct:function extern n8_ippsAESDecryptXTS_Direct:function extern y8_ippsAESDecryptXTS_Direct:function extern e9_ippsAESDecryptXTS_Direct:function extern l9_ippsAESDecryptXTS_Direct:function extern n0_ippsAESDecryptXTS_Direct:function extern k0_ippsAESDecryptXTS_Direct:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsAESDecryptXTS_Direct .Larraddr_ippsAESDecryptXTS_Direct: dq m7_ippsAESDecryptXTS_Direct dq n8_ippsAESDecryptXTS_Direct dq y8_ippsAESDecryptXTS_Direct dq e9_ippsAESDecryptXTS_Direct dq l9_ippsAESDecryptXTS_Direct dq n0_ippsAESDecryptXTS_Direct dq k0_ippsAESDecryptXTS_Direct segment .text global ippsAESDecryptXTS_Direct:function (ippsAESDecryptXTS_Direct.LEndippsAESDecryptXTS_Direct - ippsAESDecryptXTS_Direct) .Lin_ippsAESDecryptXTS_Direct: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsAESDecryptXTS_Direct: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsAESDecryptXTS_Direct] mov r11, qword [r11+rax*8] jmp r11 .LEndippsAESDecryptXTS_Direct:
32.128205
123
0.824421
cf4bc3bf069059f38d00abbdee6627d16c6487f7
8,098
asm
Assembly
Transynther/x86/_processed/NC/_ht_zr_/i9-9900K_12_0xca.log_21829_17.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NC/_ht_zr_/i9-9900K_12_0xca.log_21829_17.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NC/_ht_zr_/i9-9900K_12_0xca.log_21829_17.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 %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x495c, %r12 nop nop nop nop dec %r9 mov (%r12), %ebx nop nop nop xor $27082, %rdx lea addresses_normal_ht+0x801c, %rsi lea addresses_WC_ht+0xbde, %rdi and $28035, %r14 mov $127, %rcx rep movsb nop nop nop nop nop dec %r12 lea addresses_A_ht+0x1781c, %rbx nop and $4316, %rdi mov (%rbx), %dx nop nop nop nop nop xor $59671, %rsi lea addresses_WT_ht+0xf01c, %rbx nop nop nop nop add $26761, %rdi mov (%rbx), %edx nop nop nop nop nop and %r12, %r12 lea addresses_D_ht+0x47fc, %rdi nop nop mfence movb $0x61, (%rdi) nop nop nop nop cmp $55192, %rdx lea addresses_A_ht+0xdbcf, %rdx cmp %rbx, %rbx mov (%rdx), %esi nop xor $25182, %rdx lea addresses_normal_ht+0x1a13a, %rsi lea addresses_D_ht+0x1a7fc, %rdi nop nop nop nop add $52362, %r12 mov $117, %rcx rep movsb dec %rbx lea addresses_WT_ht+0x1e1c, %rsi clflush (%rsi) nop add $55768, %r14 mov (%rsi), %ecx nop sub %r9, %r9 lea addresses_D_ht+0x314e, %rsi lea addresses_UC_ht+0x12f1c, %rdi nop nop nop nop add %r14, %r14 mov $19, %rcx rep movsw cmp $47573, %r9 lea addresses_WT_ht+0x2a96, %rsi nop nop cmp %rbx, %rbx mov (%rsi), %r12w nop and $3769, %r14 lea addresses_UC_ht+0x32a3, %rsi nop nop nop nop nop add %rdx, %rdx movb (%rsi), %r14b nop and %rdi, %rdi lea addresses_A_ht+0x1441c, %rsi lea addresses_UC_ht+0xea1c, %rdi nop nop add %r12, %r12 mov $61, %rcx rep movsw nop inc %r12 lea addresses_D_ht+0x1b89c, %rcx nop nop add %rdx, %rdx movb (%rcx), %bl nop nop cmp %rdx, %rdx lea addresses_WT_ht+0x64dc, %rsi lea addresses_A_ht+0x1481c, %rdi nop add %r9, %r9 mov $50, %rcx rep movsb cmp %rsi, %rsi lea addresses_D_ht+0x17f6c, %rsi nop nop nop nop nop and %rbx, %rbx movb $0x61, (%rsi) nop nop nop nop nop sub %r12, %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %rbx push %rdi push %rdx push %rsi // Load lea addresses_WT+0x1b79c, %r10 nop nop nop cmp %rdi, %rdi mov (%r10), %r12d nop nop nop nop nop sub $7777, %r10 // Store lea addresses_D+0x1a1c, %rdi nop nop nop add $6513, %r15 mov $0x5152535455565758, %r10 movq %r10, (%rdi) nop nop dec %rdi // Faulty Load mov $0x332abe000000001c, %r15 nop nop cmp %rdx, %rdx movups (%r15), %xmm3 vpextrq $1, %xmm3, %r12 lea oracles, %r15 and $0xff, %r12 shlq $12, %r12 mov (%r15,%r12,1), %r12 pop %rsi pop %rdx pop %rdi pop %rbx pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': True, 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': True, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 8}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}, 'dst': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_D_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': True, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_A_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 2}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'44': 67, '45': 21500, '00': 2, '46': 260} 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 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 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 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 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 */
32.918699
2,999
0.651642
61c986a2d946204643d6c374920fab50eb93d79e
5,408
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_74_993.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_74_993.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_74_993.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 %r15 push %r8 push %r9 push %rcx push %rdi push %rsi lea addresses_WC_ht+0xbbc3, %rdi nop nop nop nop cmp %r15, %r15 mov $0x6162636465666768, %rcx movq %rcx, %xmm0 movups %xmm0, (%rdi) nop nop nop add $22908, %rdi lea addresses_D_ht+0xefb0, %r8 clflush (%r8) nop nop nop inc %r10 mov $0x6162636465666768, %r15 movq %r15, %xmm4 and $0xffffffffffffffc0, %r8 vmovntdq %ymm4, (%r8) nop cmp %r15, %r15 lea addresses_A_ht+0x1b289, %r9 xor $5717, %r12 mov $0x6162636465666768, %r15 movq %r15, (%r9) add %r15, %r15 lea addresses_UC_ht+0xe1c3, %r10 nop nop nop nop nop and %rdi, %rdi mov $0x6162636465666768, %r15 movq %r15, (%r10) nop nop nop sub $58681, %r12 lea addresses_normal_ht+0x33d4, %rsi lea addresses_D_ht+0x10fc3, %rdi clflush (%rdi) nop nop xor $14347, %r9 mov $62, %rcx rep movsw nop nop and $43011, %r9 lea addresses_A_ht+0x148a3, %rsi lea addresses_WT_ht+0x122b3, %rdi nop nop nop sub %r12, %r12 mov $93, %rcx rep movsl nop nop nop nop nop cmp $29027, %r9 lea addresses_A_ht+0x1c3, %r12 nop cmp %r15, %r15 vmovups (%r12), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rsi nop nop nop nop xor $63414, %rdi lea addresses_A_ht+0x15dbb, %r9 nop sub $6670, %r10 movups (%r9), %xmm6 vpextrq $0, %xmm6, %r15 nop nop nop nop dec %rdi lea addresses_WT_ht+0x156c9, %r12 nop nop nop and %r8, %r8 movw $0x6162, (%r12) nop nop nop nop and %r8, %r8 lea addresses_D_ht+0x1ccf7, %r15 clflush (%r15) dec %r10 mov $0x6162636465666768, %rdi movq %rdi, %xmm6 movups %xmm6, (%r15) nop nop nop nop nop xor $31706, %rcx lea addresses_normal_ht+0xfa43, %rcx nop nop nop sub %r8, %r8 mov $0x6162636465666768, %rsi movq %rsi, %xmm7 and $0xffffffffffffffc0, %rcx vmovaps %ymm7, (%rcx) add %r15, %r15 lea addresses_WC_ht+0x1d7c3, %r12 nop nop nop cmp %r10, %r10 movw $0x6162, (%r12) nop xor %r8, %r8 pop %rsi pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r8 push %rax push %rbp push %rcx push %rdx // Store lea addresses_UC+0x11cd3, %rcx nop nop nop nop nop cmp $51443, %rbp movb $0x51, (%rcx) nop and %rax, %rax // Load lea addresses_US+0x87c3, %rax nop nop nop nop cmp $11511, %rcx vmovaps (%rax), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rbp and %rcx, %rcx // Store lea addresses_US+0x115c3, %r11 nop nop nop nop cmp %rbp, %rbp movw $0x5152, (%r11) nop nop nop add $16552, %r11 // Store lea addresses_PSE+0x8fe3, %rdx nop add %r8, %r8 mov $0x5152535455565758, %r10 movq %r10, %xmm5 vmovups %ymm5, (%rdx) nop nop xor $57676, %r11 // Faulty Load lea addresses_WT+0x21c3, %r8 nop nop add $46629, %r10 mov (%r8), %rcx lea oracles, %r10 and $0xff, %rcx shlq $12, %rcx mov (%r10,%rcx,1), %rcx pop %rdx pop %rcx pop %rbp pop %rax pop %r8 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_US', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_US', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_WT', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal_ht', 'same': True, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'39': 74} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
21.291339
221
0.649223
fbc2004d149bebcbb2c5923b5d35280a49937369
7,776
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_21829_771.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_21829_771.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_21829_771.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 %r13 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x19787, %rbx nop nop nop cmp $14315, %r13 mov $0x6162636465666768, %r11 movq %r11, %xmm0 movups %xmm0, (%rbx) nop nop nop nop add $19352, %rbx lea addresses_D_ht+0x8ec7, %rsi lea addresses_UC_ht+0x4387, %rdi nop and $50254, %r15 mov $54, %rcx rep movsl dec %r15 lea addresses_WT_ht+0x17787, %rsi lea addresses_D_ht+0xfc07, %rdi nop nop nop nop xor %rbx, %rbx mov $39, %rcx rep movsl nop sub %rbx, %rbx lea addresses_WC_ht+0x5387, %rdi nop nop nop nop cmp %rbx, %rbx mov $0x6162636465666768, %r15 movq %r15, %xmm3 movups %xmm3, (%rdi) add %r11, %r11 lea addresses_UC_ht+0x15e87, %rbx nop nop inc %rsi vmovups (%rbx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rdi nop nop nop inc %r13 lea addresses_normal_ht+0x1d947, %rsi lea addresses_D_ht+0xaf87, %rdi nop nop nop nop nop dec %r13 mov $103, %rcx rep movsw add $64244, %r13 lea addresses_UC_ht+0x183cf, %r13 nop nop nop cmp %rbx, %rbx movb $0x61, (%r13) nop nop nop sub $61858, %rcx lea addresses_D_ht+0x6287, %rdi nop nop nop sub $14423, %r11 movw $0x6162, (%rdi) xor %rbx, %rbx lea addresses_UC_ht+0xdf87, %r15 nop add %r13, %r13 vmovups (%r15), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rsi nop cmp $47171, %r13 lea addresses_WC_ht+0x8687, %r11 nop nop nop nop nop cmp $13734, %rdi mov (%r11), %r13 nop nop nop nop nop cmp $17671, %r13 lea addresses_normal_ht+0x18b87, %r15 nop cmp %r11, %r11 movl $0x61626364, (%r15) nop nop xor $65263, %rbx lea addresses_D_ht+0xbc43, %rcx clflush (%rcx) cmp %rdi, %rdi movw $0x6162, (%rcx) nop nop nop nop nop and $38418, %rbx lea addresses_UC_ht+0x12a67, %r13 nop nop nop nop sub %rbx, %rbx vmovups (%r13), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %r15 cmp %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r8 push %r9 push %rbp push %rbx push %rdx push %rsi // Store lea addresses_UC+0x11987, %r12 nop nop nop nop nop and %rdx, %rdx movw $0x5152, (%r12) nop nop dec %r8 // Store mov $0x187, %rbp clflush (%rbp) nop nop nop cmp %r9, %r9 mov $0x5152535455565758, %r8 movq %r8, %xmm7 movups %xmm7, (%rbp) nop nop nop nop and %rbp, %rbp // Faulty Load mov $0x4262be0000000787, %r8 sub $41353, %rdx mov (%r8), %r9 lea oracles, %rdx and $0xff, %r9 shlq $12, %r9 mov (%rdx,%r9,1), %r9 pop %rsi pop %rdx pop %rbx pop %rbp pop %r9 pop %r8 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
33.956332
2,999
0.654835
0364874688e18954cdb8ad4bfdb09fb44074b29d
507
asm
Assembly
programs/oeis/338/A338233.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/338/A338233.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/338/A338233.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A338233: Number of numbers less than n whose square does not divide n. ; 0,0,1,1,3,4,5,5,6,8,9,9,11,12,13,12,15,15,17,17,19,20,21,21,22,24,24,25,27,28,29,28,31,32,33,31,35,36,37,37,39,40,41,41,42,44,45,44,46,47,49,49,51,51,53,53,55,56,57,57,59,60,60,59,63,64,65,65,67,68,69,67 trn $0,1 add $0,1 mov $1,$0 seq $1,57918 ; Number of pairs of numbers (a,b) each less than n where (a,b,n) is in geometric progression. seq $1,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. sub $0,$1
50.7
205
0.668639
a2f9c37e7b46c8e3dd58a610f3c7fe91a858caaf
3,391
asm
Assembly
external/source/shellcode/windows/templates/inc/pe.asm
OsmanDere/metasploit-framework
b7a014a5d22d3b57157e301d4af57e3a31ad03a9
[ "BSD-2-Clause", "BSD-3-Clause" ]
26,932
2015-01-01T00:04:51.000Z
2022-03-31T22:51:38.000Z
external/source/shellcode/windows/templates/inc/pe.asm
Kilo-411/metasploit-framework
aaf27d7fa51390895dea63c58cb3b76e959d36f8
[ "BSD-2-Clause", "BSD-3-Clause" ]
11,048
2015-01-01T00:05:44.000Z
2022-03-31T21:49:52.000Z
external/source/shellcode/windows/templates/inc/pe.asm
Kilo-411/metasploit-framework
aaf27d7fa51390895dea63c58cb3b76e959d36f8
[ "BSD-2-Clause", "BSD-3-Clause" ]
12,593
2015-01-01T01:01:20.000Z
2022-03-31T22:13:32.000Z
; PE FILE STRUCTURE ; ================= %include "pe.inc" BIN_Begin MZHeader MZExtendedHeader MZSection.text_Begin push cs pop ds mov dx,MZSection.text_VA(text_string) mov ah,09 int 21h mov ax,4C01h int 21h text_string: db 'This program cannot be run in DOS mode.',0Dh,0Ah,'$' MZSection.text_End PEHeader %define PEOptionalheader_EipRVA PESection.text_RVA(mondebut) PEOptionalHeader_Begin PEOptionalHeader_Directory Export,0,0 PEOptionalHeader_Directory Import,Import_Directorys_RVA,Import_Directorys_VS ; PEOptionalHeader_Directory Resource,0,0 ; PEOptionalHeader_Directory Exception,0,0 ; PEOptionalHeader_Directory Security,0,0 ; PEOptionalHeader_Directory Relocations,0,0 ; PEOptionalHeader_Directory Debug,0,0 ; PEOptionalHeader_Directory ImageDescription,0,0 ; PEOptionalHeader_Directory MachineSpecific,0,0 ; PEOptionalHeader_Directory ThreadLocalStorage,0,0 PEOptionalHeader_End PESectionHeader .text,'.text',PESectionHeader_Flags_EXECUTABLECODE | PESectionHeader_Flags_DATAFROMFILE | PESectionHeader_Flags_EXECUTEACCESS | PESectionHeader_Flags_READACCESS PESectionHeader .rdata,'.rdata',PESectionHeader_Flags_DATAFROMFILE | PESectionHeader_Flags_READACCESS PESectionHeader .data,'.data',PESectionHeader_Flags_DATAFROMFILE | PESectionHeader_Flags_READACCESS | PESectionHeader_Flags_WRITEACCESS PESectionHeader .bss,'.bss', PESectionHeader_Flags_DATA0 | PESectionHeader_Flags_READACCESS | PESectionHeader_Flags_WRITEACCESS PESectionHeader .idata,'.idata',PESectionHeader_Flags_DATAFROMFILE | PESectionHeader_Flags_READACCESS PESections_Begin PESection.text_Begin int 03h mondebut: MB_OK equ 0 mov eax,MB_OK push eax mov eax,PESection.rdata_VA(message) call [GetCommandLineA] push eax push eax mov eax,0 push eax call [MessageBoxA] call [PESection.idata_VA(Import.KERNEL32.ExitProcess)] mov [PESection.text_VA(text1)],eax mov [PESection.rdata_VA(rdata1)],ebx mov [PESection.data_VA(data1)],ecx mov [PESection.bss_VA(bss1)],edx text1: jmp short mondebut PESection.text_End PESection.rdata_Begin message: db "coucou",0 rdata1: times 1001h db 22h ;db 'data1' PESection.rdata_End PESection.data_Begin data1: times 1205h db 0FEh PESection.data_End PESection.bss_Begin bss1: resb 1001h PESection.bss_End PESection.idata_Begin Import_Directorys_Begin .idata Import_Directory KERNEL32 Import_Directory USER32 Import_Directorys_End Import_RVAs_Begin KERNEL32 Import_RVA KERNEL32,GetCommandLineA Import_RVA KERNEL32,ExitProcess Import_RVAs_End Import_RVAs_Begin USER32 Import_RVA USER32,MessageBoxA Import_RVAs_End Import_VAs_Begin KERNEL32 Import_VA KERNEL32,GetCommandLineA,0BFF8C5ACh Import_VA KERNEL32,ExitProcess,0BFF8D4CAh Import_VAs_End Import_VAs_Begin USER32 Import_VA USER32,MessageBoxA Import_VAs_End Import_Strings_Begin KERNEL32 Import_String_Function KERNEL32,GetCommandLineA,"GetCommandLineA",0D0h Import_String_Function KERNEL32,ExitProcess,"ExitProcess",07Fh Import_String_Dll KERNEL32,"KERNEL32.DLL" Import_Strings_End Import_Strings_Begin USER32 Import_String_Function USER32,MessageBoxA,"MessageBoxA" Import_String_Dll USER32,"USER32.DLL" Import_Strings_End PESection.idata_End PESections_End BIN_End
30.00885
177
0.794751
ced7390d83b8bd95dac61c3b5208b3c2163a344c
6,957
asm
Assembly
src/shaders/post_processing/gen5_6/Common/RGB16x8_Save_Y416.asm
martin-kokos/intel-vaapi-driver
3ed3f6a783fdfff3fa1b567888518dcbda7eb2a3
[ "MIT" ]
192
2018-01-26T11:51:55.000Z
2022-03-25T20:04:19.000Z
src/shaders/post_processing/gen5_6/Common/RGB16x8_Save_Y416.asm
martin-kokos/intel-vaapi-driver
3ed3f6a783fdfff3fa1b567888518dcbda7eb2a3
[ "MIT" ]
256
2017-01-23T02:10:27.000Z
2018-01-23T10:00:05.000Z
src/shaders/post_processing/gen5_6/Common/RGB16x8_Save_Y416.asm
martin-kokos/intel-vaapi-driver
3ed3f6a783fdfff3fa1b567888518dcbda7eb2a3
[ "MIT" ]
64
2018-01-30T19:51:53.000Z
2021-11-24T01:26:14.000Z
/* * All Video Processing kernels * Copyright © <2010>, Intel Corporation. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * This file was originally licensed under the following license * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ // Module name: RGB16x8_Save_Y416.asm // // Save packed ARGB 444 frame data block of size 16x8 // // To save 16x8 block (128x8 byte layout for ARGB 16bit per component) we need 4 send instructions // ----------------- // | 1 | 2 | 3 | 4 | // ----------------- #include "RGB16x8_Save_RGB.inc" shl (1) rMSGSRC.0<1>:d wORIX<0;1,0>:w 3:w { NoDDClr } // H. block origin need to become 8 times mov (1) rMSGSRC.1<1>:d wORIY<0;1,0>:w { NoDDClr, NoDDChk } // Block origin (1st quadrant) mov (1) rMSGSRC.2<1>:ud nDPW_BLOCK_SIZE_ARGB:ud { NoDDChk } // Block width and height (32x8) mov (8) mMSGHDR<1>:ud rMSGSRC<8;8,1>:ud /* Not needed for validation kernels for now -vK //Use the mask to determine which pixels shouldn't be over-written and (1) acc0.0<1>:ud udBLOCK_MASK<0;1,0>:ud 0x00FFFFFF:ud cmp.ge.f0.0(1) dNULLREG acc0.0<0;1,0>:ud 0x00FFFFFF:ud //Check if all pixels in the block need to be modified (f0.0) jmpi WriteARGBToDataPort //If mask is not all 1's, then load the entire 64x8 block //so that only those bytes may be modified that need to be (using the mask) // Load first block 16x8 packed ARGB 444 --------------------------------------- or (1) acc0.0<1>:ud udBLOCK_MASK<0;1,0>:ud 0xFF00FF00:ud //Check first block cmp.e.f0.0 (1) dNULLREG acc0.0<0;1,0>:ud 0xFFFFFFFF:ud (f0.0) jmpi SkipFirstBlockMerge //If full mask then skip this block send (8) udSRC_ARGB(0)<1> mMSGHDR udDUMMY_NULL nDATAPORT_READ nDPMR_MSGDSC+nDPR_MSG_SIZE_ARGB+nBI_DESTINATION_RGB:ud mov (8) mMSGHDR<1>:ud rMSGSRC<8;8,1>:ud //Merge the data mov (1) f0.0:uw ubBLOCK_MASK_V:ub //Load the mask on flag reg (f0.0) mov (8) rMASK_TEMP<1>:uw uwBLOCK_MASK_H:uw //use sel instruction - vK (-f0.0) mov (8) rMASK_TEMP<1>:uw 0:uw $for(0, 0; <nY_NUM_OF_ROWS; 1, 2) { //take care of the lines in the block, they are different in the src and dest mov (1) f0.1:uw uwMASK_TEMP(0,%1)<0;1,0> (-f0.1) mov (8) udDEST_ARGB(%2)<1> udSRC_ARGB(%1) } SkipFirstBlockMerge: // Load second block 16x8 packed ARGB 444 --------------------------------------- or (1) acc0.0<1>:ud udBLOCK_MASK<0;1,0>:ud 0xFF0000FF:ud //Check second block cmp.e.f0.0 (1) dNULLREG acc0.0<0;1,0>:ud 0xFFFFFFFF:ud (f0.0) jmpi WriteARGBToDataPort //If full mask then skip this block add (1) mMSGHDR.0<1>:d rMSGSRC.0<0;1,0>:d 32:d // Point to 2nd part send (8) udSRC_ARGB(0)<1> mMSGHDR udDUMMY_NULL nDATAPORT_READ nDPMR_MSGDSC+nDPR_MSG_SIZE_ARGB+nBI_DESTINATION_RGB:ud mov (8) mMSGHDR<1>:ud rMSGSRC<8;8,1>:ud // Point to 1st part again //Merge the data mov (1) f0.0:uw ubBLOCK_MASK_V:ub //Load the mask on flag reg (f0.0) shr (8) rMASK_TEMP<1>:uw uwBLOCK_MASK_H:uw 8:uw //load the mask for second block (-f0.0) mov (8) rMASK_TEMP<1>:uw 0:uw $for(0, 1; <nY_NUM_OF_ROWS; 1, 2) { //take care of the lines in the block, they are different in the src and dest mov (1) f0.1:uw uwMASK_TEMP(0,%1)<0;1,0> (-f0.1) mov (8) udDEST_ARGB(%2)<1> udSRC_ARGB(%1) } */ WriteARGBToDataPort: // Move packed data to MRF and output //Write 1st 4X8 pixels $for(0; <nY_NUM_OF_ROWS; 1) { mov (8) mudMSGPAYLOAD(%1)<1> udDEST_ARGB(%1*4) } send (8) dNULLREG mMSGHDR udDUMMY_NULL nDATAPORT_WRITE nDPMW_MSGDSC+nDPW_MSG_SIZE_ARGB+nBI_DESTINATION_RGB:ud //Write 2nd 4X8 pixels mov (8) mMSGHDR<1>:ud rMSGSRC<8;8,1>:ud add (1) mMSGHDR.0<1>:d rMSGSRC.0<0;1,0>:d 32:d // Point to 2nd part $for(0; <nY_NUM_OF_ROWS; 1) { mov (8) mudMSGPAYLOAD(%1)<1> udDEST_ARGB(%1*4+1) } send (8) dNULLREG mMSGHDR udDUMMY_NULL nDATAPORT_WRITE nDPMW_MSGDSC+nDPW_MSG_SIZE_ARGB+nBI_DESTINATION_RGB:ud //Write 3rd 4X8 pixels mov (8) mMSGHDR<1>:ud rMSGSRC<8;8,1>:ud add (1) mMSGHDR.0<1>:d rMSGSRC.0<0;1,0>:d 64:d // Point to 2nd part $for(0; <nY_NUM_OF_ROWS; 1) { mov (8) mudMSGPAYLOAD(%1)<1> udDEST_ARGB(%1*4+2) } send (8) dNULLREG mMSGHDR udDUMMY_NULL nDATAPORT_WRITE nDPMW_MSGDSC+nDPW_MSG_SIZE_ARGB+nBI_DESTINATION_RGB:ud //Write 4th 4X8 pixels mov (8) mMSGHDR<1>:ud rMSGSRC<8;8,1>:ud add (1) mMSGHDR.0<1>:d rMSGSRC.0<0;1,0>:d 96:d // Point to 2nd part $for(0; <nY_NUM_OF_ROWS; 1) { mov (8) mudMSGPAYLOAD(%1)<1> udDEST_ARGB(%1*4+3) } send (8) dNULLREG mMSGHDR udDUMMY_NULL nDATAPORT_WRITE nDPMW_MSGDSC+nDPW_MSG_SIZE_ARGB+nBI_DESTINATION_RGB:ud // End of RGB16x8_Save_Y416
50.413043
132
0.617076
affaf325836fca96fff67a5cf2be4fc56f2421f5
5,862
asm
Assembly
lib/am335x_sdk/ti/drv/pruss/example/apps/sorte/firmware/src/slave/line_delay.asm
brandonbraun653/Apollo
a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce
[ "MIT" ]
2
2021-12-27T10:19:01.000Z
2022-03-15T07:09:06.000Z
lib/am335x_sdk/ti/drv/pruss/example/apps/sorte/firmware/src/slave/line_delay.asm
brandonbraun653/Apollo
a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce
[ "MIT" ]
null
null
null
lib/am335x_sdk/ti/drv/pruss/example/apps/sorte/firmware/src/slave/line_delay.asm
brandonbraun653/Apollo
a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce
[ "MIT" ]
null
null
null
;Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; ; Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; ; Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the ; distribution. ; ; Neither the name of Texas Instruments Incorporated nor the names of ; its contributors may be used to endorse or promote products derived ; from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ; brief: contains the line delay measurement of the synchronization state implementation ; ; Version Description Author ; 0.1 Created Thomas Mauer ;include section .include "../include/macros/macros.inc" .include "../include/icss/icss_regs.inc" .include "../include/protocol/sorte_pru_slave_register.inc" .include "../include/protocol/sorte_host_interface.inc" .include "../include/protocol/sorte_packet_definition.inc" .include "../include/protocol/sorte_slave_cfg.inc" .include "../include/protocol/sorte_state_define.inc" .global FN_LINE_DELAY_MASTER .global FN_LINE_DELAY_SLAVE .global STATE_MACHINE_RETURN ;**************************** ; line delay master function ;**************************** ; entry point called by main state machine for LINE DELAY state ; MASTER in this context is originator of the LINE DELAY measurement frame FN_LINE_DELAY_MASTER: ; Check to see if the PRU received a line delay trigger via scratch register ldi R0.b0, SHIFT_LINE_DELAY_TRIGGER xin SCRATCH_BANK0, &TEMP_REG_1.b0, 1 qbeq FN_LINE_DELAY_DONE, TEMP_REG_1.b0, 0 ; send LINE DELAY measurment frame ; pre-amble ; send 8 byte PA (preamble) .if $defined(FULL_PREAMBLE) ldi TX_DATA_WORD, 0x5555 NOP M_PUSH_WORD ldi TX_DATA_WORD, 0x5555 NOP M_PUSH_WORD .endif ; send 4 byte pre-amble ldi TX_DATA_WORD, 0x5555 NOP M_PUSH_WORD ldi TX_DATA_WORD, 0xd555 NOP M_PUSH_WORD ; 4 bytes header ldi32 TEMP_REG_2, DELAY_REQ_P mov TX_DATA_WORD, TEMP_REG_2.w0 NOP M_PUSH_WORD ; state change bit? qbne LINE_DELAY_MASTER_LAST, TEMP_REG_1.b0, 2 ; set set TEMP_REG_2.b3, TEMP_REG_2.b3, 3 ;ST_STATE_CHANGE ; initiate state change set DEVICE_STATUS, DEVICE_STATUS, SWITCH_PORT_CONFIG ldi PROTOCOL_STATE, SYNC_STATE LINE_DELAY_MASTER_LAST: mov TX_DATA_WORD, TEMP_REG_2.w2 NOP M_PUSH_WORD ; end packet with crc generated by PRU M_CMD16 D_PUSH_CRC_MSWORD_CMD | D_PUSH_CRC_LSWORD_CMD | D_TX_EOF ; clear scratch register ldi TEMP_REG_1.b0, 0 xout SCRATCH_BANK0, &TEMP_REG_1.b0, 1 ; receive DELAY_RESP packet LINE_DELAY_MASTER_WAIT_BANK0: xin RXL2_BANK0, &R18.b0, 1 qbeq LINE_DELAY_MASTER_WAIT_BANK0, R18.b0, 0 ; read rx and tx time stamp - sof based .if $defined (PRU0) lbco &R2,ICSS_IEP_CONST, ICSS_IEP_CAPR0_REG, 4 lbco &R6,ICSS_IEP_CONST, ICSS_IEP_CAPR4_REG, 4 ; use port 0, caculate difference between RX_SOF and TX_SOF sub TEMP_REG_1, R2, R6 .else lbco &R2,ICSS_IEP_CONST, ICSS_IEP_CAPR2_REG, 4 lbco &R6,ICSS_IEP_CONST, ICSS_IEP_CAPR5_REG, 4 ; use port 1, caculate difference between RX_SOF and TX_SOF sub TEMP_REG_1, R4, R7 .endif lbco &TEMP_REG_2, ICSS_SHARED_RAM_CONST, PORT_DELAY, 4 ; divide by n --> measurement results complete the measurement. lsr TEMP_REG_1, TEMP_REG_1, LD_SHIFT_16 add TEMP_REG_2,TEMP_REG_2, TEMP_REG_1 sbco &TEMP_REG_2, ICSS_SHARED_RAM_CONST, PORT_DELAY, 4 set DEVICE_STATUS, DEVICE_STATUS, RX_IGNORE_TO_EOF LINE_DELAY_MASTER_DONE: jmp STATE_MACHINE_RETURN ;*************************** ; line delay slave function ;*************************** ; SLAVE in this context is the responder to the LINE DELAY measurement frame FN_LINE_DELAY_SLAVE: M_XIN_L2_BANK0 LD_SLAVE_FRAME_PROCESS, 4 LD_SLAVE_FRAME_PROCESS: ; Check to see if the PRU received a line delay trigger qbne LINE_DELAY_IGNORE_FRAME, R2.b2, T_LD_REQ_P2P ; trigger line delay measurement on other PRU via scratch register ldi R0.b0, SHIFT_LINE_DELAY_TRIGGER ldi TEMP_REG_1.b0, 1 ; trigger line delay w/o state change qbbc LD_SLAVE_TRIGGER_LD, R2.b3, 3 ; ST_STATE_CHANGE ldi TEMP_REG_1.b0, 2 ; trigger line delay with state change (last line delay measurement) ; state change ldi PROTOCOL_STATE, SYNC_STATE set DEVICE_STATUS, DEVICE_STATUS, SWITCH_PORT_CONFIG ; last slave needs to initiate state and port switch here qbbs LD_SLAVE_TRIGGER_LD, DEVICE_STATUS, PRU_MASTER_PORT_FLAG ; initiate port switching for last slave ; clear scratch pad LDI TEMP_REG_1.b0, 0 LD_SLAVE_TRIGGER_LD: xout SCRATCH_BANK0, &TEMP_REG_1.b0, 1 LINE_DELAY_IGNORE_FRAME: set DEVICE_STATUS, DEVICE_STATUS, RX_IGNORE_TO_EOF FN_LINE_DELAY_DONE: jmp STATE_MACHINE_RETURN
37.101266
92
0.75145
e477c0d5d06e366034b7000f465ed88eefbfba3e
88
asm
Assembly
Assignment 7/Vivado Files/11-3 (Added support for all req_d instructions. MULTU is broken)/mult_test.asm
sidarthshahri/Computer-Architecture-and-Design
6abef46d85e6cf3e5bce071acbe4c061fbde990c
[ "MIT" ]
null
null
null
Assignment 7/Vivado Files/11-3 (Added support for all req_d instructions. MULTU is broken)/mult_test.asm
sidarthshahri/Computer-Architecture-and-Design
6abef46d85e6cf3e5bce071acbe4c061fbde990c
[ "MIT" ]
null
null
null
Assignment 7/Vivado Files/11-3 (Added support for all req_d instructions. MULTU is broken)/mult_test.asm
sidarthshahri/Computer-Architecture-and-Design
6abef46d85e6cf3e5bce071acbe4c061fbde990c
[ "MIT" ]
4
2021-10-05T04:38:42.000Z
2022-02-09T18:58:25.000Z
addi $a0, $zero, 3 addi $a1, $zero, 4 multu $a0, $a1 add $a0, $a1, $a0 mfhi $a2 mflo $a3
14.666667
18
0.590909
5a7ec633685dfbacb22b0f327de64e9089017854
244
asm
Assembly
programs/oeis/033/A033397.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/033/A033397.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/033/A033397.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A033397: [ 77/n ]. ; 77,38,25,19,15,12,11,9,8,7,7,6,5,5,5,4,4,4,4,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 add $0,1 mov $1,77 div $1,$0
34.857143
192
0.512295
fdc942caf46f755e13a7db92d8d133beedd7d60c
508
asm
Assembly
libsrc/_DEVELOPMENT/adt/b_vector/z80/asm_b_vector_clear.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/adt/b_vector/z80/asm_b_vector_clear.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/adt/b_vector/z80/asm_b_vector_clear.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; =============================================================== ; Feb 2014 ; =============================================================== ; ; void b_vector_clear(b_vector_t *v) ; ; Clear the vector to empty. ; ; =============================================================== SECTION code_clib SECTION code_adt_b_vector PUBLIC asm_b_vector_clear EXTERN l_zeroword_hl defc asm_b_vector_clear = l_zeroword_hl - 2 ; enter : hl = vector * ; ; exit : hl = & vector.size ; ; uses : hl
19.538462
65
0.415354
a9689eb102d9803b295907f9f130a90c145a02b4
8,187
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_279.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_279.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_279.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 %r12 push %r15 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xa9f, %r11 nop nop cmp $45377, %rcx movw $0x6162, (%r11) dec %r10 lea addresses_D_ht+0x1499f, %r12 nop nop nop nop nop xor %rbx, %rbx vmovups (%r12), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %r11 nop nop nop mfence lea addresses_normal_ht+0xfd1b, %r10 nop nop nop nop nop xor $50814, %r11 movups (%r10), %xmm0 vpextrq $1, %xmm0, %rdx nop nop and %rbx, %rbx lea addresses_UC_ht+0x29f, %rbx nop sub %r15, %r15 movw $0x6162, (%rbx) nop nop and $43779, %rbx lea addresses_D_ht+0xfe9f, %r15 nop nop nop nop cmp %rbx, %rbx movl $0x61626364, (%r15) nop nop nop nop nop cmp %r10, %r10 lea addresses_normal_ht+0xa9f, %rsi lea addresses_WT_ht+0x18a9f, %rdi xor $37933, %rbx mov $68, %rcx rep movsw nop nop nop nop inc %rcx lea addresses_WC_ht+0x14d4f, %r10 nop nop nop and $61553, %rdi mov (%r10), %rdx nop nop nop nop nop xor %rbx, %rbx lea addresses_WT_ht+0x195fe, %rsi nop nop nop nop nop add %r12, %r12 movb (%rsi), %r11b nop sub %rcx, %rcx lea addresses_D_ht+0x1a69f, %rsi lea addresses_D_ht+0x1e9f, %rdi nop nop sub %rbx, %rbx mov $34, %rcx rep movsl add %r10, %r10 lea addresses_UC_ht+0x8f1f, %rdx nop nop nop cmp %rsi, %rsi mov $0x6162636465666768, %r12 movq %r12, %xmm5 and $0xffffffffffffffc0, %rdx vmovaps %ymm5, (%rdx) nop nop nop nop nop and $9006, %rsi lea addresses_WC_ht+0x161f, %rcx nop nop sub %r12, %r12 movups (%rcx), %xmm5 vpextrq $0, %xmm5, %r10 nop and $5479, %rbx lea addresses_WT_ht+0x17eef, %rdx nop nop add %r12, %r12 movups (%rdx), %xmm0 vpextrq $0, %xmm0, %r11 nop nop nop and $53207, %rsi lea addresses_WT_ht+0xa91f, %rdx nop dec %r15 movb (%rdx), %r11b xor %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r15 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %r9 push %rbp push %rcx // Store lea addresses_UC+0x16b4f, %rbp nop inc %r14 movb $0x51, (%rbp) nop inc %r9 // Store lea addresses_RW+0x57cf, %rbp nop nop nop dec %r13 movb $0x51, (%rbp) nop nop nop sub $5945, %r13 // Store lea addresses_RW+0xa69f, %r9 nop nop nop and $61150, %rcx mov $0x5152535455565758, %r13 movq %r13, (%r9) nop nop add $18119, %rbp // Load lea addresses_WC+0x197df, %rcx nop nop nop sub %r8, %r8 vmovups (%rcx), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r9 nop nop and $14723, %rbp // Faulty Load lea addresses_PSE+0x12e9f, %rcx nop nop nop nop nop cmp %r13, %r13 mov (%rcx), %r14 lea oracles, %rcx and $0xff, %r14 shlq $12, %r14 mov (%rcx,%r14,1), %r14 pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 3, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'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 */
31.856031
2,999
0.65262
4303ced5275ab1527cc1448473c8ea7c3e614a3b
898
asm
Assembly
programs/oeis/340/A340849.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/340/A340849.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/340/A340849.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A340849: a(n) = A001045(n) + A052928(n). ; 0,1,3,5,9,15,27,49,93,179,351,693,1377,2743,5475,10937,21861,43707,87399,174781,349545,699071,1398123,2796225,5592429,11184835,22369647,44739269,89478513,178956999,357913971,715827913 mov $12,$0 mov $14,$0 lpb $14,1 clr $0,12 mov $0,$12 sub $14,1 sub $0,$14 mov $9,$0 mov $11,$0 lpb $11,1 mov $0,$9 sub $11,1 sub $0,$11 mov $5,$0 mov $7,2 lpb $7,1 clr $0,5 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 lpb $0,1 mov $1,$0 mov $2,4 cal $1,97073 ; Expansion of (1-x+2*x^2)/((1+x)*(1-2*x)). mov $0,0 add $2,$1 lpe mov $1,$2 mov $8,$7 lpb $8,1 mov $6,$1 sub $8,1 lpe lpe lpb $5,1 mov $5,0 sub $6,$1 lpe mov $1,$6 div $1,4 add $10,$1 lpe add $13,$10 lpe mov $1,$13
17.96
185
0.48441
400239c221497d9535d0d017c70180f5bc06548f
259
asm
Assembly
mc-sema/validator/x86_64/tests/IMUL64rri32.asm
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
2
2021-08-07T16:21:29.000Z
2021-11-17T10:58:37.000Z
mc-sema/validator/x86_64/tests/IMUL64rri32.asm
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
null
null
null
mc-sema/validator/x86_64/tests/IMUL64rri32.asm
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
null
null
null
BITS 64 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS=FLAG_SF|FLAG_ZF|FLAG_AF|FLAG_PF ;TEST_FILE_META_END ; IMUL64rri32 mov ebx, 0x20000 mov ecx, 0x34343434 ;TEST_BEGIN_RECORDING imul ebx, ecx, 0xbbbbb ;TEST_END_RECORDING
19.923077
49
0.764479
00cfff125afd6355934e4d11c84312e39529a4b8
1,352
asm
Assembly
pwnlib/shellcraft/templates/i386/linux/loader_append.asm
DrKeineLust/pwntools
415f11bba7096b7d68fe144f5b3432b9c12a4f0a
[ "MIT" ]
2
2015-05-09T03:21:45.000Z
2017-01-24T18:50:07.000Z
pwnlib/shellcraft/templates/i386/linux/loader_append.asm
DrKeineLust/pwntools
415f11bba7096b7d68fe144f5b3432b9c12a4f0a
[ "MIT" ]
null
null
null
pwnlib/shellcraft/templates/i386/linux/loader_append.asm
DrKeineLust/pwntools
415f11bba7096b7d68fe144f5b3432b9c12a4f0a
[ "MIT" ]
1
2020-12-03T07:19:00.000Z
2020-12-03T07:19:00.000Z
<% from pwnlib.shellcraft.i386.linux import loader from pwnlib.shellcraft import common %> <%docstring> Loads a statically-linked ELF into memory and transfers control. Similar to loader.asm but loads an appended ELF. Arguments: data(str): If a valid filename, the data is loaded from the named file. Otherwise, this is treated as raw ELF data to append. If ``None``, it is ignored. Example: >>> gcc = process(['gcc','-m32','-xc','-static','-Wl,-Ttext-segment=0x20000000','-']) >>> gcc.write(b''' ... int main() { ... printf("Hello, %s!\\n", "i386"); ... } ... ''') >>> gcc.shutdown('send') >>> gcc.poll(True) 0 >>> sc = shellcraft.loader_append('a.out') The following doctest is commented out because it doesn't work on Travis for reasons I cannot diagnose. However, it should work just fine :-) # >>> run_assembly(sc).recvline() == b'Hello, i386!\n' # True </%docstring> <%page args="data = None"/> <% elf_data = common.label('elf_data') load = common.label('load') %> jmp ${elf_data} ${load}: pop eax ${loader('eax')} ${elf_data}: call ${load} %if data: <% import os if os.path.isfile(data): with open(data, 'rb') as f: data = f.read() %> ${'.string "%s"' % ''.join('\\x%02x' % c for c in bytearray(data))} %endif
24.142857
89
0.595414
a0903a7417f4f4a854879ce060dc668ae32a856a
5,543
asm
Assembly
source/unary/val.asm
paulscottrobson/Basic65816
167c25b1bbc2680f55acdf4bff771750acfe907c
[ "MIT" ]
null
null
null
source/unary/val.asm
paulscottrobson/Basic65816
167c25b1bbc2680f55acdf4bff771750acfe907c
[ "MIT" ]
4
2019-06-18T14:45:35.000Z
2019-06-22T17:18:22.000Z
source/unary/val.asm
paulscottrobson/Basic65816
167c25b1bbc2680f55acdf4bff771750acfe907c
[ "MIT" ]
1
2021-03-18T04:31:44.000Z
2021-03-18T04:31:44.000Z
; ******************************************************************************************* ; ******************************************************************************************* ; ; Name : val.asm ; Purpose : String to Integer ; Date : 11th July 2019 ; Author : paul@robsons.org.uk ; ; ******************************************************************************************* ; ******************************************************************************************* ; ******************************************************************************************* ; ; val(string,base) ; ; ******************************************************************************************* Function_VAL: ;; val( jsr ResetTypeInteger ; returns an integer jsr EvaluateNextString ; get the value you are absoluting pha ; put string address on stack. jsr VALGetBase ; process , base (shared with STR$()) ply ; get string address back phx ; save X on stack tax ; base in X tya ; address in A jsr StringToInteger plx ; restore X sta EXSValueL+0,x sty EXSValueH+0,x rts ; ******************************************************************************************* ; ; Get Base. either ,Base) or ) ; ; ******************************************************************************************* VALGetBase: lda (DCodePtr) ; look at next cmp #commaTokenID ; if comma, go to get base code. beq _VGBAlternate jsr ExpectRightBracket ; expect ), and return 10. lda #10 rts ; ; found ,base, means base other than 10. ; _VGBAlternate: jsr ExpectComma ; skip comma. jsr EvaluateNextInteger ; get base cpy #0 ; check base legal bne _VGBBadBase cmp #2 bcc _VGBBadBase cmp #16+1 ; 0-9A-F bcs _VGBBadBase jsr ExpectRightBracket ; get right bracket and return. rts ; _VGBBadBase: #error "Bad Number Base" ; ******************************************************************************************* ; ; Convert string at A base X and return in YA, error message if illegal. ; ; ******************************************************************************************* StringToInteger: sta DTemp3 ; DTemp3 is the character pointer lda (DTemp3) ; DTemp3+2 is the character count to do. and #$00FF sta DTemp3+2 beq _STIError ; if length zero it's bad. inc DTemp3 ; skip length byte. ; stx DSignCount ; Signcount is the base, 2-16. stz DTemp1 ; Zero DTemp1, this is the result register. stz DTemp1+2 ; ; See if it is -something ; lda (DTemp3) ; look at first character and #$00FF ; mask off pha ; push on stack cmp #"-" ; if not -, skip bne _STILoop inc DTemp3 ; advance pointer over minus sign dec DTemp3+2 ; dec count beq _STIError ; if only - then error. ; ; Scan string loop ; _STILoop: lda DSignCount ; multiply DTemp1 by DSignCount jsr MultiplyTemp1ByA ; lda (DTemp3) ; get character, mask and #$00FF jsr ConvertUpperCase ; make U/C ; cmp #'0' ; validate it check if 0-9 bcc _STIError cmp #'9'+1 bcc _STIOkay1 cmp #'A' ; check if A-Z bcc _STIError cmp #'Z'+1 bcs _STIError clc ; shift to correct range. adc #9 _STIOkay1: and #15 ; now in range 0-35 cmp DSignCount ; error if >= base bcs _STIError ; ; Add digit into return value. ; clc ; add A to DTemp1 adc DTemp1 sta DTemp1 bcc _STINoCarry inc DTemp1+2 _STINoCarry: inc DTemp3 ; get character, pre-increment because of count byte dec DTemp3+2 ; decrement counter bne _STILoop ; loop back. pla ; get optional minus bac cmp #"-" bne _STINotNegative ; handle the negative character sec ; negate DTemp1 lda #0 sbc DTemp1 sta DTemp1 lda #0 sbc DTemp1+2 sta DTemp1+2 _STINotNegative: lda DTemp1 ; get the result ldy DTemp1+2 rts _STIError: #error "Bad constant" ; ******************************************************************************************* ; ; Convert A to upper case ; ; ******************************************************************************************* ConvertUpperCase: cmp #'a' bcc _CUCExit cmp #'z'+1 bcs _CUCExit sec sbc #32 _CUCExit: rts ; ******************************************************************************************* ; ; Multiply DTemp1 by A (uses DTemp2), CS on overflow. ; ; ******************************************************************************************* MultiplyTemp1ByA: _MTGeneral: phx tax ; multiplier in X lda DTemp1 ; copy DTemp1 to DTemp2 sta DTemp2 lda DTemp1+2 sta DTemp2+2 stz DTemp1 ; zero DTemp1 stz DTemp1+2 ldy #0 ; this is the 'high byte' of the result. ; ; Main multiply loop. ; _MTLoop: txa ; shift X right into C lsr a tax bcc _MTNoAdd clc lda DTemp1 ; add if LSB set adc DTemp2 sta DTemp1 lda DTemp1+2 adc DTemp2+2 sta DTemp1+2 bcc _MTNoAdd iny _MTNoAdd: asl DTemp2 ; shift multiplicand left rol DTemp2+2 bcc _MTNoOverflow iny _MTNoOverflow: txa ; until multiplier is zero. bne _MTLoop tya clc adc #$FFFF plx ; restore X rts ; and exit
26.146226
93
0.456251
b702e730863a6fcaf78c3b8f5e8b7cdedee2e7c1
373
asm
Assembly
libsrc/zx81/basic/zx_basemem.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/zx81/basic/zx_basemem.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/zx81/basic/zx_basemem.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; ; ZX 81 specific routines ; by Stefano Bodrato, 25/07/2008 ; ; int zx_basemem; ; ; This function returns the base memory size in kbytes ; Measures only up to the RAMPTOP limit ; ; $Id: zx_basemem.asm,v 1.2 2015/01/19 01:33:26 pauloscustodio Exp $ ; PUBLIC zx_basemem zx_basemem: ld a,(16389) srl a inc a srl a sub 16 ; subtract the ROM size ld l,a ld h,0 ret
15.541667
68
0.699732
6c0f58d970c151ff39fd019cb13c5ad0520ddc04
692
asm
Assembly
programs/oeis/158/A158638.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/158/A158638.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/158/A158638.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A158638: a(n) = 48*n^2 + 1. ; 1,49,193,433,769,1201,1729,2353,3073,3889,4801,5809,6913,8113,9409,10801,12289,13873,15553,17329,19201,21169,23233,25393,27649,30001,32449,34993,37633,40369,43201,46129,49153,52273,55489,58801,62209,65713,69313,73009,76801,80689,84673,88753,92929,97201,101569,106033,110593,115249,120001,124849,129793,134833,139969,145201,150529,155953,161473,167089,172801,178609,184513,190513,196609,202801,209089,215473,221953,228529,235201,241969,248833,255793,262849,270001,277249,284593,292033,299569,307201,314929,322753,330673,338689,346801,355009,363313,371713,380209,388801,397489,406273,415153,424129,433201,442369,451633,460993,470449 pow $0,2 mul $0,48 add $0,1
98.857143
632
0.810694
316738c207764eea09a40b8046dbf40d452798c5
939
asm
Assembly
programs/oeis/293/A293547.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/293/A293547.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/293/A293547.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A293547: a(n) is the integer k that minimizes |k/Fibonacci(n) - 2/3|. ; 0,1,1,1,2,3,5,9,14,23,37,59,96,155,251,407,658,1065,1723,2787,4510,7297,11807,19105,30912,50017,80929,130945,211874,342819,554693,897513,1452206,2349719,3801925,6151643,9953568,16105211,26058779,42163991,68222770,110386761,178609531,288996291,467605822,756602113,1224207935,1980810049,3205017984,5185828033,8390846017,13576674049,21967520066,35544194115,57511714181,93055908297,150567622478,243623530775,394191153253,637814684027,1032005837280,1669820521307,2701826358587,4371646879895,7073473238482,11445120118377,18518593356859,29963713475235,48482306832094,78446020307329,126928327139423,205374347446753,332302674586176,537677022032929,869979696619105,1407656718652033,2277636415271138,3685293133923171,5962929549194309 mov $1,3 mov $2,7 lpb $0 sub $0,1 sub $1,1 mov $4,$2 add $2,$1 sub $2,2 mov $3,2 add $3,$4 mov $1,$3 sub $1,2 lpe div $1,6
52.166667
724
0.808307
31b37db10b05449abb1c398f093f575e1bee386f
8,584
asm
Assembly
Transynther/x86/_processed/NC/_zr_un_/i3-7100_9_0x84_notsx.log_21829_699.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NC/_zr_un_/i3-7100_9_0x84_notsx.log_21829_699.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NC/_zr_un_/i3-7100_9_0x84_notsx.log_21829_699.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 %rdx push %rsi lea addresses_normal_ht+0xe19a, %rsi lea addresses_A_ht+0x1bd3a, %rdi nop and %rdx, %rdx mov $24, %rcx rep movsw nop nop nop nop inc %rbx lea addresses_normal_ht+0x14c3a, %rsi lea addresses_UC_ht+0x16aca, %rdi nop nop xor $22898, %rbp mov $86, %rcx rep movsb nop nop nop nop nop inc %rdi lea addresses_WC_ht+0x13cd0, %rdi nop nop nop add $12624, %r10 movl $0x61626364, (%rdi) nop inc %rsi lea addresses_WT_ht+0x3d7a, %rsi lea addresses_UC_ht+0xd83a, %rdi nop nop nop xor $12214, %rbx mov $96, %rcx rep movsb nop nop nop nop cmp $4630, %rdi lea addresses_normal_ht+0x1403a, %rsi lea addresses_WT_ht+0x179a, %rdi clflush (%rsi) nop nop xor $63817, %rbx mov $125, %rcx rep movsl nop nop nop nop nop cmp %rbp, %rbp lea addresses_normal_ht+0xeca, %rsi lea addresses_UC_ht+0x1bd12, %rdi nop nop nop nop nop xor $12813, %rax mov $93, %rcx rep movsq nop and $44468, %rdx lea addresses_WT_ht+0x1b8ba, %rdx nop nop dec %r10 mov $0x6162636465666768, %rcx movq %rcx, (%rdx) nop nop sub $45462, %r10 lea addresses_normal_ht+0xb0a2, %rdx nop nop nop inc %r10 mov (%rdx), %rcx nop nop nop nop nop cmp $55510, %r10 lea addresses_D_ht+0xb03a, %rdx nop nop xor $4394, %rcx movb (%rdx), %al nop nop nop nop sub $59243, %rax lea addresses_WC_ht+0x16bba, %rcx clflush (%rcx) nop nop nop cmp $26238, %rdi vmovups (%rcx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r10 nop nop nop nop nop sub $6393, %rcx lea addresses_A_ht+0x10d72, %r10 clflush (%r10) nop nop nop nop and %rdi, %rdi mov (%r10), %ax nop nop nop nop sub %rax, %rax lea addresses_A_ht+0x283a, %rbx clflush (%rbx) nop nop nop nop cmp $15273, %rbp movw $0x6162, (%rbx) nop nop xor $37914, %rdi lea addresses_D_ht+0x25fa, %rsi lea addresses_WT_ht+0xb23a, %rdi xor %r10, %r10 mov $119, %rcx rep movsq nop nop nop nop nop dec %rsi lea addresses_A_ht+0x1183a, %rsi lea addresses_normal_ht+0x303a, %rdi nop inc %rax mov $95, %rcx rep movsw nop nop nop xor $7722, %rcx lea addresses_normal_ht+0x1d902, %rax nop nop inc %rbp movb (%rax), %bl xor %rbx, %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi // Store lea addresses_UC+0x1c4d6, %r11 nop nop nop nop nop sub %rsi, %rsi movb $0x51, (%r11) nop nop nop nop nop inc %rsi // REPMOV lea addresses_WC+0x171da, %rsi lea addresses_RW+0x1d83a, %rdi nop nop nop nop nop and $17245, %rbx mov $31, %rcx rep movsl nop nop nop cmp $64232, %rbx // Faulty Load mov $0x3d0dca000000083a, %r14 nop nop nop add %rbx, %rbx movups (%r14), %xmm7 vpextrq $0, %xmm7, %rcx lea oracles, %r10 and $0xff, %rcx shlq $12, %rcx mov (%r10,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_RW', 'congruent': 11, 'same': False}, 'OP': 'REPM'} [Faulty Load] {'src': {'type': 'addresses_NC', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'same': True, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': True, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': True, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': True, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'0a': 1, '1a': 1, '79': 1, 'b0': 16163, '00': 5662, 'd0': 1} 00 00 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 b0 b0 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 00 00 00 00 00 b0 b0 b0 b0 00 b0 b0 b0 00 00 b0 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 b0 b0 00 b0 b0 b0 b0 b0 00 00 00 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 00 00 00 00 00 b0 b0 00 00 00 00 00 00 00 00 00 00 b0 00 00 00 00 b0 b0 00 00 00 b0 b0 b0 b0 00 00 00 b0 b0 00 00 b0 b0 b0 b0 00 00 00 b0 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 00 00 b0 b0 b0 00 00 b0 00 b0 b0 b0 b0 00 00 b0 00 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 00 00 b0 00 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 00 b0 b0 00 00 00 b0 b0 b0 b0 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 b0 b0 00 00 00 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 00 00 00 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 00 00 00 b0 b0 b0 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 00 00 00 b0 b0 b0 00 00 b0 b0 00 b0 b0 b0 00 b0 b0 00 00 b0 00 b0 b0 b0 00 b0 b0 b0 b0 00 b0 b0 b0 00 00 00 00 00 b0 00 00 b0 b0 00 00 00 00 b0 b0 b0 b0 b0 00 00 00 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 b0 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 00 00 b0 00 00 b0 00 b0 b0 b0 b0 00 b0 00 00 00 b0 00 b0 00 00 00 b0 b0 b0 00 b0 00 b0 00 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 00 b0 b0 b0 00 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 00 b0 00 00 b0 b0 b0 b0 b0 b0 00 b0 00 b0 b0 00 00 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 b0 b0 00 00 00 00 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 00 b0 b0 00 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 b0 b0 b0 b0 b0 b0 b0 b0 00 00 00 00 00 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 00 00 b0 00 b0 b0 b0 b0 00 00 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 b0 00 00 00 b0 b0 b0 b0 b0 00 00 b0 b0 00 b0 b0 b0 b0 b0 00 00 00 00 00 b0 b0 b0 00 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 b0 00 00 00 b0 b0 b0 00 00 00 00 b0 00 00 00 00 b0 00 00 b0 00 00 b0 b0 b0 b0 */
30.548043
2,999
0.658784
83aec3927b7667e734fe406d01dbf0c6d715810a
49,808
asm
Assembly
engine/overworld/scripting.asm
pokeachromicdevs/pokeoctober
db74bb68bbfceac07eec6d64674bc24fd4c0b67f
[ "blessing" ]
1
2021-07-05T23:48:37.000Z
2021-07-05T23:48:37.000Z
engine/overworld/scripting.asm
AtmaBuster/pokeoctober
12652b84eb2df1a0ed2f654a0ffcfb78202e515f
[ "blessing" ]
1
2020-12-16T01:11:20.000Z
2020-12-16T22:53:56.000Z
engine/overworld/scripting.asm
AtmaBuster/pokeoctober
12652b84eb2df1a0ed2f654a0ffcfb78202e515f
[ "blessing" ]
1
2021-07-05T23:33:22.000Z
2021-07-05T23:33:22.000Z
; Event scripting commands. EnableScriptMode:: push af ld a, SCRIPT_READ ld [wScriptMode], a pop af ret ScriptEvents:: call StartScript .loop ld a, [wScriptMode] ld hl, .modes rst JumpTable call CheckScript jr nz, .loop ret .modes dw EndScript dw RunScriptCommand dw WaitScriptMovement dw WaitScript EndScript: call StopScript ret WaitScript: call StopScript ld hl, wScriptDelay dec [hl] ret nz farcall Function58b9 ld a, SCRIPT_READ ld [wScriptMode], a call StartScript ret WaitScriptMovement: call StopScript ld hl, wVramState bit 7, [hl] ret nz farcall Function58b9 ld a, SCRIPT_READ ld [wScriptMode], a call StartScript ret RunScriptCommand: call GetScriptByte ld hl, ScriptCommandTable rst JumpTable ret ScriptCommandTable: ; entries correspond to macros/scripts/events.asm enumeration dw Script_scall ; 00 dw Script_farscall ; 01 dw Script_memcall ; 02 dw Script_sjump ; 03 dw Script_farsjump ; 04 dw Script_memjump ; 05 dw Script_ifequal ; 06 dw Script_ifnotequal ; 07 dw Script_iffalse ; 08 dw Script_iftrue ; 09 dw Script_ifgreater ; 0a dw Script_ifless ; 0b dw Script_jumpstd ; 0c dw Script_callstd ; 0d dw Script_callasm ; 0e dw Script_special ; 0f dw Script_memcallasm ; 10 dw Script_checkmapscene ; 11 dw Script_setmapscene ; 12 dw Script_checkscene ; 13 dw Script_setscene ; 14 dw Script_setval ; 15 dw Script_addval ; 16 dw Script_random ; 17 dw Script_checkver ; 18 dw Script_readmem ; 19 dw Script_writemem ; 1a dw Script_loadmem ; 1b dw Script_readvar ; 1c dw Script_writevar ; 1d dw Script_loadvar ; 1e dw Script_giveitem ; 1f dw Script_takeitem ; 20 dw Script_checkitem ; 21 dw Script_givemoney ; 22 dw Script_takemoney ; 23 dw Script_checkmoney ; 24 dw Script_givecoins ; 25 dw Script_takecoins ; 26 dw Script_checkcoins ; 27 dw Script_addcellnum ; 28 dw Script_delcellnum ; 29 dw Script_checkcellnum ; 2a dw Script_checktime ; 2b dw Script_checkpoke ; 2c dw Script_givepoke ; 2d dw Script_giveegg ; 2e dw Script_givepokemail ; 2f dw Script_checkpokemail ; 30 dw Script_checkevent ; 31 dw Script_clearevent ; 32 dw Script_setevent ; 33 dw Script_checkflag ; 34 dw Script_clearflag ; 35 dw Script_setflag ; 36 dw Script_wildon ; 37 dw Script_wildoff ; 38 dw Script_xycompare ; 39 dw Script_warpmod ; 3a dw Script_blackoutmod ; 3b dw Script_warp ; 3c dw Script_getmoney ; 3d dw Script_getcoins ; 3e dw Script_getnum ; 3f dw Script_getmonname ; 40 dw Script_getitemname ; 41 dw Script_getcurlandmarkname ; 42 dw Script_gettrainername ; 43 dw Script_getstring ; 44 dw Script_itemnotify ; 45 dw Script_pocketisfull ; 46 dw Script_opentext ; 47 dw Script_refreshscreen ; 48 dw Script_closetext ; 49 dw Script_writeunusedbytebuffer ; 4a dw Script_farwritetext ; 4b dw Script_writetext ; 4c dw Script_repeattext ; 4d dw Script_yesorno ; 4e dw Script_loadmenu ; 4f dw Script_closewindow ; 50 dw Script_jumptextfaceplayer ; 51 dw Script_farjumptext ; 52 dw Script_jumptext ; 53 dw Script_waitbutton ; 54 dw Script_buttonsound ; 55 dw Script_pokepic ; 56 dw Script_closepokepic ; 57 dw Script__2dmenu ; 58 dw Script_verticalmenu ; 59 dw Script_loadpikachudata ; 5a dw Script_randomwildmon ; 5b dw Script_loadtemptrainer ; 5c dw Script_loadwildmon ; 5d dw Script_loadtrainer ; 5e dw Script_startbattle ; 5f dw Script_reloadmapafterbattle ; 60 dw Script_catchtutorial ; 61 dw Script_trainertext ; 62 dw Script_trainerflagaction ; 63 dw Script_winlosstext ; 64 dw Script_scripttalkafter ; 65 dw Script_endifjustbattled ; 66 dw Script_checkjustbattled ; 67 dw Script_setlasttalked ; 68 dw Script_applymovement ; 69 dw Script_applymovementlasttalked ; 6a dw Script_faceplayer ; 6b dw Script_faceobject ; 6c dw Script_variablesprite ; 6d dw Script_disappear ; 6e dw Script_appear ; 6f dw Script_follow ; 70 dw Script_stopfollow ; 71 dw Script_moveobject ; 72 dw Script_writeobjectxy ; 73 dw Script_loademote ; 74 dw Script_showemote ; 75 dw Script_turnobject ; 76 dw Script_follownotexact ; 77 dw Script_earthquake ; 78 dw Script_changemapblocks ; 79 dw Script_changeblock ; 7a dw Script_reloadmap ; 7b dw Script_reloadmappart ; 7c dw Script_writecmdqueue ; 7d dw Script_delcmdqueue ; 7e dw Script_playmusic ; 7f dw Script_encountermusic ; 80 dw Script_musicfadeout ; 81 dw Script_playmapmusic ; 82 dw Script_dontrestartmapmusic ; 83 dw Script_cry ; 84 dw Script_playsound ; 85 dw Script_waitsfx ; 86 dw Script_warpsound ; 87 dw Script_specialsound ; 88 dw Script_autoinput ; 89 dw Script_newloadmap ; 8a dw Script_pause ; 8b dw Script_deactivatefacing ; 8c dw Script_prioritysjump ; 8d dw Script_warpcheck ; 8e dw Script_stopandsjump ; 8f dw Script_return ; 90 dw Script_end ; 91 dw Script_reloadandreturn ; 92 dw Script_endall ; 93 dw Script_pokemart ; 94 dw Script_elevator ; 95 dw Script_trade ; 96 dw Script_askforphonenumber ; 97 dw Script_phonecall ; 98 dw Script_hangup ; 99 dw Script_describedecoration ; 9a dw Script_fruittree ; 9b dw Script_specialphonecall ; 9c dw Script_checkphonecall ; 9d dw Script_verbosegiveitem ; 9e dw Script_verbosegiveitemvar ; 9f dw Script_swarm ; a0 dw Script_halloffame ; a1 dw Script_credits ; a2 dw Script_warpfacing ; a3 dw Script_battletowertext ; a4 dw Script_getlandmarkname ; a5 dw Script_gettrainerclassname ; a6 dw Script_getname ; a7 dw Script_wait ; a8 dw Script_checksave ; a9 dw Script_loadmonindex ; aa dw Script_checkmaplockedmons ; ab dw Script_givetmhm ; ac dw Script_checktmhm ; ad dw Script_verbosegivetmhm ; ae dw Script_tmhmnotify ; af dw Script_tmhmtotext ; b0 StartScript: ld hl, wScriptFlags set SCRIPT_RUNNING, [hl] ret CheckScript: ld hl, wScriptFlags bit SCRIPT_RUNNING, [hl] ret StopScript: ld hl, wScriptFlags res SCRIPT_RUNNING, [hl] ret Script_callasm: ; script command 0xe ; parameters: asm call GetScriptByte ld b, a call GetScriptByte ld l, a call GetScriptByte ld h, a ld a, b rst FarCall ret Script_special: ; script command 0xf ; parameters: predefined_script call GetScriptByte ld e, a call GetScriptByte ld d, a farcall Special ret Script_memcallasm: ; script command 0x10 ; parameters: asm call GetScriptByte ld l, a call GetScriptByte ld h, a ld b, [hl] inc hl ld a, [hli] ld h, [hl] ld l, a ld a, b rst FarCall ret Script_jumptextfaceplayer: ; script command 0x51 ; parameters: text_pointer ld a, [wScriptBank] ld [wScriptTextBank], a call GetScriptByte ld [wScriptTextAddr], a call GetScriptByte ld [wScriptTextAddr + 1], a ld b, BANK(JumpTextFacePlayerScript) ld hl, JumpTextFacePlayerScript jp ScriptJump Script_jumptext: ; script command 0x53 ; parameters: text_pointer ld a, [wScriptBank] ld [wScriptTextBank], a call GetScriptByte ld [wScriptTextAddr], a call GetScriptByte ld [wScriptTextAddr + 1], a ld b, BANK(JumpTextScript) ld hl, JumpTextScript jp ScriptJump JumpTextFacePlayerScript: faceplayer JumpTextScript: opentext repeattext -1, -1 waitbutton closetext end Script_farjumptext: ; script command 0x52 ; parameters: text_pointer call GetScriptByte ld [wScriptTextBank], a call GetScriptByte ld [wScriptTextAddr], a call GetScriptByte ld [wScriptTextAddr + 1], a ld b, BANK(JumpTextScript) ld hl, JumpTextScript jp ScriptJump Script_writetext: ; script command 0x4c ; parameters: text_pointer call GetScriptByte ld l, a call GetScriptByte ld h, a ld a, [wScriptBank] ld b, a call MapTextbox ret Script_farwritetext: ; script command 0x4b ; parameters: text_pointer call GetScriptByte ld b, a call GetScriptByte ld l, a call GetScriptByte ld h, a call MapTextbox ret Script_repeattext: ; script command 0x4d ; parameters: byte, byte call GetScriptByte ld l, a call GetScriptByte ld h, a cp -1 jr nz, .done ld a, l cp -1 jr nz, .done ld hl, wScriptTextBank ld a, [hli] ld b, a ld a, [hli] ld h, [hl] ld l, a call MapTextbox ret .done ret Script_waitbutton: ; script command 0x54 jp WaitButton Script_buttonsound: ; script command 0x55 ldh a, [hOAMUpdate] push af ld a, $1 ldh [hOAMUpdate], a call WaitBGMap call ButtonSound pop af ldh [hOAMUpdate], a ret Script_yesorno: ; script command 0x4e call YesNoBox ld a, FALSE jr c, .no ld a, TRUE .no ld [wScriptVar], a ret Script_loadmenu: ; script command 0x4f ; parameters: menu_header call GetScriptByte ld l, a call GetScriptByte ld h, a ld de, LoadMenuHeader ld a, [wScriptBank] call Call_a_de call UpdateSprites ret Script_closewindow: ; script command 0x50 call CloseWindow call UpdateSprites ret Script_pokepic: ; script command 0x56 ; parameters: pokemon call LoadScriptPokemonID ld [wCurPartySpecies], a farcall Pokepic ret Script_closepokepic: ; script command 0x57 farcall ClosePokepic ret Script_verticalmenu: ; script command 0x59 ld a, [wScriptBank] ld hl, VerticalMenu rst FarCall ld a, [wMenuCursorY] jr nc, .ok xor a .ok ld [wScriptVar], a ret Script__2dmenu: ; script command 0x58 ld a, [wScriptBank] ld hl, _2DMenu rst FarCall ld a, [wMenuCursorBuffer] jr nc, .ok xor a .ok ld [wScriptVar], a ret Script_battletowertext: ; script command 0xa4 ; parameters: bttext_id call SetUpTextbox call GetScriptByte ld c, a farcall BattleTowerText ret Script_verbosegiveitem: ; script command 0x9e ; parameters: item, quantity call Script_giveitem call CurItemName ld de, wStringBuffer1 ld a, STRING_BUFFER_4 call CopyConvertedText ld b, BANK(GiveItemScript) ld de, GiveItemScript jp ScriptCall ret_96f76: ret GiveItemScript: callasm ret_96f76 writetext ReceivedItemText iffalse .Full waitsfx specialsound waitbutton itemnotify end .Full: buttonsound pocketisfull end ReceivedItemText: text_far UnknownText_0x1c4719 text_end Script_verbosegiveitemvar: ; script command 0x9f ; parameters: item, var call GetScriptByte cp ITEM_FROM_MEM jr nz, .ok ld a, [wScriptVar] .ok ld [wCurItem], a call GetScriptByte call GetVarAction ld a, [de] ld [wItemQuantityChangeBuffer], a ld hl, wNumItems call ReceiveItem ld a, TRUE jr c, .ok2 xor a .ok2 ld [wScriptVar], a call CurItemName ld de, wStringBuffer1 ld a, STRING_BUFFER_4 call CopyConvertedText ld b, BANK(GiveItemScript) ld de, GiveItemScript jp ScriptCall Script_itemnotify: ; script command 0x45 call GetPocketName call CurItemName ld b, BANK(PutItemInPocketText) ld hl, PutItemInPocketText call MapTextbox ret Script_pocketisfull: ; script command 0x46 call GetPocketName call CurItemName ld b, BANK(PocketIsFullText) ld hl, PocketIsFullText call MapTextbox ret Script_specialsound: ; script command 0x88 farcall CheckItemPocket ld a, [wItemAttributeParamBuffer] cp TM_HM ld de, SFX_GET_TM jr z, .play ld de, SFX_ITEM .play call PlaySFX call WaitSFX ret GetPocketName: farcall CheckItemPocket ld a, [wItemAttributeParamBuffer] dec a ld hl, ItemPocketNames maskbits NUM_POCKETS add a ld e, a ld d, 0 add hl, de ld a, [hli] ld d, [hl] ld e, a ld hl, wStringBuffer3 call CopyName2 ret INCLUDE "data/items/pocket_names.asm" CurItemName: ld a, [wCurItem] ld [wNamedObjectIndexBuffer], a call GetItemName ret CurTMHMName: ld a, [wCurTMHM] ld [wd265], a call GetTMHMName ret PutItemInPocketText: text_far UnknownText_0x1c472c text_end PocketIsFullText: text_far UnknownText_0x1c474b text_end Script_pokemart: ; script command 0x94 ; parameters: mart_type, mart_id call GetScriptByte ld c, a call GetScriptByte ld e, a call GetScriptByte ld d, a ld a, [wScriptBank] ld b, a farcall OpenMartDialog ret Script_elevator: ; script command 0x95 ; parameters: floor_list_pointer xor a ld [wScriptVar], a call GetScriptByte ld e, a call GetScriptByte ld d, a ld a, [wScriptBank] ld b, a farcall Elevator ret c ld a, TRUE ld [wScriptVar], a ret Script_trade: ; script command 0x96 ; parameters: trade_id call GetScriptByte ld e, a farcall NPCTrade ret Script_phonecall: ; script command 0x98 ; parameters: caller_name call GetScriptByte ld e, a call GetScriptByte ld d, a ld a, [wScriptBank] ld b, a farcall PhoneCall ret Script_hangup: ; script command 0x99 farcall HangUp ret Script_askforphonenumber: ; script command 0x97 ; parameters: number call YesNoBox jr c, .refused call GetScriptByte ld c, a farcall AddPhoneNumber jr c, .phonefull xor a ; PHONE_CONTACT_GOT jr .done .phonefull ld a, PHONE_CONTACTS_FULL jr .done .refused call GetScriptByte ld a, PHONE_CONTACT_REFUSED .done ld [wScriptVar], a ret Script_describedecoration: ; script command 0x9a ; parameters: byte call GetScriptByte ld b, a farcall DescribeDecoration ld h, d ld l, e jp ScriptJump Script_fruittree: ; script command 0x9b ; parameters: tree_id call GetScriptByte ld [wCurFruitTree], a ld b, BANK(FruitTreeScript) ld hl, FruitTreeScript jp ScriptJump Script_swarm: ; script command 0xa0 ; parameters: flag, map_group, map_id call GetScriptByte ld c, a call GetScriptByte ld d, a call GetScriptByte ld e, a farcall StoreSwarmMapIndices ret Script_trainertext: ; script command 0x62 ; parameters: text_id call GetScriptByte ld c, a ld b, 0 ld hl, wSeenTextPointer add hl, bc add hl, bc ld a, [hli] ld h, [hl] ld l, a ld a, [wSeenTrainerBank] ld b, a call MapTextbox ret Script_scripttalkafter: ; script command 0x65 ld hl, wScriptAfterPointer ld a, [hli] ld h, [hl] ld l, a ld a, [wSeenTrainerBank] ld b, a jp ScriptJump Script_trainerflagaction: ; script command 0x63 ; parameters: action xor a ld [wScriptVar], a ld hl, wTempTrainerEventFlag ld e, [hl] inc hl ld d, [hl] call GetScriptByte ld b, a call EventFlagAction ld a, c and a ret z ld a, TRUE ld [wScriptVar], a ret Script_winlosstext: ; script command 0x64 ; parameters: win_text_pointer, loss_text_pointer ld hl, wWinTextPointer call GetScriptByte ld [hli], a call GetScriptByte ld [hli], a ld hl, wLossTextPointer call GetScriptByte ld [hli], a call GetScriptByte ld [hli], a ret Script_endifjustbattled: ; script command 0x66 ld a, [wRunningTrainerBattleScript] and a ret z jp Script_end Script_checkjustbattled: ; script command 0x67 ld a, TRUE ld [wScriptVar], a ld a, [wRunningTrainerBattleScript] and a ret nz xor a ld [wScriptVar], a ret Script_encountermusic: ; script command 0x80 ld a, [wOtherTrainerClass] ld e, a farcall PlayTrainerEncounterMusic ret Script_playmapmusic: ; script command 0x82 call PlayMapMusic ret Script_playmusic: ; script command 0x7f ; parameters: music_pointer ld de, MUSIC_NONE call PlayMusic xor a ld [wMusicFade], a call MaxVolume call GetScriptByte ld e, a call GetScriptByte ld d, a call PlayMusic ret Script_musicfadeout: ; script command 0x81 ; parameters: music, fadetime call GetScriptByte ld [wMusicFadeID], a call GetScriptByte ld [wMusicFadeID + 1], a call GetScriptByte and $ff ^ (1 << MUSIC_FADE_IN_F) ld [wMusicFade], a ret Script_playsound: ; script command 0x85 ; parameters: sound_pointer call GetScriptByte ld e, a call GetScriptByte ld d, a call PlaySFX ret Script_waitsfx: ; script command 0x86 call WaitSFX ret Script_warpsound: ; script command 0x87 farcall GetWarpSFX call PlaySFX ret Script_cry: ; script command 0x84 ; parameters: cry_id call LoadScriptPokemonID call PlayMonCry ret GetScriptObject: and a ; PLAYER? ret z cp LAST_TALKED ret z dec a ret Script_setlasttalked: ; script command 0x68 ; parameters: object_id call GetScriptByte call GetScriptObject ldh [hLastTalked], a ret Script_applymovement: ; script command 0x69 ; parameters: object_id, data call GetScriptByte call GetScriptObject ld c, a ApplyMovement: push bc ld a, c farcall SetFlagsForMovement_1 pop bc push bc call SetFlagsForMovement_2 pop bc call GetScriptByte ld l, a call GetScriptByte ld h, a ld a, [wScriptBank] ld b, a call GetMovementData ret c ld a, SCRIPT_WAIT_MOVEMENT ld [wScriptMode], a call StopScript ret SetFlagsForMovement_2: farcall _SetFlagsForMovement_2 ret Script_applymovementlasttalked: ; script command 0x6a ; parameters: data ; apply movement to last talked ldh a, [hLastTalked] ld c, a jp ApplyMovement Script_faceplayer: ; script command 0x6b ldh a, [hLastTalked] and a ret z ld d, $0 ldh a, [hLastTalked] ld e, a farcall GetRelativeFacing ld a, d add a add a ld e, a ldh a, [hLastTalked] ld d, a call ApplyObjectFacing ret Script_faceobject: ; script command 0x6c ; parameters: object1, object2 call GetScriptByte call GetScriptObject cp LAST_TALKED jr c, .ok ldh a, [hLastTalked] .ok ld e, a call GetScriptByte call GetScriptObject cp LAST_TALKED jr nz, .ok2 ldh a, [hLastTalked] .ok2 ld d, a push de farcall GetRelativeFacing pop bc ret c ld a, d add a add a ld e, a ld d, c call ApplyObjectFacing ret Script_turnobject: ; script command 0x76 ; parameters: object_id, facing call GetScriptByte call GetScriptObject cp LAST_TALKED jr nz, .ok ldh a, [hLastTalked] .ok ld d, a call GetScriptByte add a add a ld e, a call ApplyObjectFacing ret ApplyObjectFacing: ld a, d push de call CheckObjectVisibility jr c, .not_visible ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] push bc call DoesSpriteHaveFacings pop bc jr c, .not_visible ; STILL_SPRITE ld hl, OBJECT_FLAGS1 add hl, bc bit FIXED_FACING_F, [hl] jr nz, .not_visible pop de ld a, e call SetSpriteDirection ld hl, wVramState bit 6, [hl] jr nz, .text_state call .DisableTextTiles .text_state call UpdateSprites ret .not_visible pop de scf ret .DisableTextTiles: call LoadMapPart hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT .loop res 7, [hl] inc hl dec bc ld a, b or c jr nz, .loop ret Script_variablesprite: ; script command 0x6d ; parameters: byte, sprite call GetScriptByte ld e, a ld d, $0 ld hl, wVariableSprites add hl, de call GetScriptByte ld [hl], a ret Script_appear: ; script command 0x6f ; parameters: object_id call GetScriptByte call GetScriptObject call _CopyObjectStruct ldh a, [hMapObjectIndexBuffer] ld b, 0 ; clear call ApplyEventActionAppearDisappear ret Script_disappear: ; script command 0x6e ; parameters: object_id call GetScriptByte call GetScriptObject cp LAST_TALKED jr nz, .ok ldh a, [hLastTalked] .ok call DeleteObjectStruct ldh a, [hMapObjectIndexBuffer] ld b, 1 ; set call ApplyEventActionAppearDisappear farcall _UpdateSprites ret ApplyEventActionAppearDisappear: push bc call GetMapObject ld hl, MAPOBJECT_EVENT_FLAG add hl, bc pop bc ld e, [hl] inc hl ld d, [hl] ld a, -1 cp e jr nz, .okay cp d jr nz, .okay xor a ret .okay call EventFlagAction ret Script_follow: ; script command 0x70 ; parameters: object2, object1 call GetScriptByte call GetScriptObject ld b, a call GetScriptByte call GetScriptObject ld c, a farcall StartFollow ret Script_stopfollow: ; script command 0x71 farcall StopFollow ret Script_moveobject: ; script command 0x72 ; parameters: object id, x, y call GetScriptByte call GetScriptObject ld b, a call GetScriptByte add 4 ld d, a call GetScriptByte add 4 ld e, a farcall CopyDECoordsToMapObject ret Script_writeobjectxy: ; script command 0x73 ; parameters: object_id call GetScriptByte call GetScriptObject cp LAST_TALKED jr nz, .ok ldh a, [hLastTalked] .ok ld b, a farcall WriteObjectXY ret Script_follownotexact: ; script command 0x77 ; parameters: object2, object1 call GetScriptByte call GetScriptObject ld b, a call GetScriptByte call GetScriptObject ld c, a farcall FollowNotExact ret Script_loademote: ; script command 0x74 ; parameters: bubble call GetScriptByte cp EMOTE_FROM_MEM jr nz, .not_var_emote ld a, [wScriptVar] .not_var_emote ld c, a farcall LoadEmote ret Script_showemote: ; script command 0x75 ; parameters: bubble, object_id, time call GetScriptByte ld [wScriptVar], a call GetScriptByte call GetScriptObject cp LAST_TALKED jr z, .ok ldh [hLastTalked], a .ok call GetScriptByte ld [wScriptDelay], a ld b, BANK(ShowEmoteScript) ld de, ShowEmoteScript jp ScriptCall ShowEmoteScript: loademote EMOTE_FROM_MEM applymovementlasttalked .Show pause 0 applymovementlasttalked .Hide end .Show: show_emote step_sleep 1 step_end .Hide: hide_emote step_sleep 1 step_end Script_earthquake: ; script command 0x78 ; parameters: param ld hl, EarthquakeMovement ld de, wEarthquakeMovementDataBuffer ld bc, EarthquakeMovement.End - EarthquakeMovement call CopyBytes call GetScriptByte ld [wEarthquakeMovementDataBuffer + 1], a and %00111111 ld [wEarthquakeMovementDataBuffer + 3], a ld b, BANK(.script) ld de, .script jp ScriptCall .script applymovement PLAYER, wEarthquakeMovementDataBuffer end EarthquakeMovement: step_shake 16 ; the 16 gets overwritten with the script byte step_sleep 16 ; the 16 gets overwritten with the lower 6 bits of the script byte step_end .End Script_loadpikachudata: ; script command 0x5a ld hl, PIKACHU call GetPokemonIDFromIndex ld [wTempWildMonSpecies], a ld a, 5 ld [wCurPartyLevel], a ret Script_randomwildmon: ; script command 0x5b xor a ld [wBattleScriptFlags], a ret Script_loadtemptrainer: ; script command 0x5c ld a, (1 << 7) | 1 ld [wBattleScriptFlags], a ld a, [wTempTrainerClass] ld [wOtherTrainerClass], a ld a, [wTempTrainerID] ld [wOtherTrainerID], a ret Script_loadwildmon: ; script command 0x5d ; parameters: pokemon, level ld a, (1 << 7) ld [wBattleScriptFlags], a call LoadScriptPokemonID ld [wTempWildMonSpecies], a call GetScriptByte ld [wCurPartyLevel], a ret Script_loadtrainer: ; script command 0x5e ; parameters: trainer_group, trainer_id ld a, (1 << 7) | 1 ld [wBattleScriptFlags], a call GetScriptByte ld [wOtherTrainerClass], a call GetScriptByte ld [wOtherTrainerID], a ret Script_startbattle: ; script command 0x5f call BufferScreen predef StartBattle ld a, [wBattleResult] and $ff ^ BATTLERESULT_BITMASK ld [wScriptVar], a ret Script_catchtutorial: ; script command 0x61 ; parameters: byte call GetScriptByte ld [wBattleType], a call BufferScreen farcall CatchTutorial jp Script_reloadmap Script_reloadmapafterbattle: ; script command 0x60 ld hl, wBattleScriptFlags ld d, [hl] ld [hl], 0 ld a, [wBattleResult] and $ff ^ BATTLERESULT_BITMASK cp LOSE jr nz, .notblackedout ld b, BANK(Script_BattleWhiteout) ld hl, Script_BattleWhiteout jp ScriptJump .notblackedout bit 0, d jr z, .was_wild farcall MomTriesToBuySomething jr .done .was_wild ld a, [wBattleResult] bit BATTLERESULT_BOX_FULL, a jr z, .done ld b, BANK(Script_SpecialBillCall) ld de, Script_SpecialBillCall farcall LoadScriptBDE .done jp Script_reloadmap Script_reloadmap: ; script command 0x7b xor a ld [wBattleScriptFlags], a ld a, MAPSETUP_RELOADMAP ldh [hMapEntryMethod], a ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret Script_scall: ; script command 0x0 ; parameters: pointer ld a, [wScriptBank] ld b, a call GetScriptByte ld e, a call GetScriptByte ld d, a jr ScriptCall Script_farscall: ; script command 0x1 ; parameters: pointer call GetScriptByte ld b, a call GetScriptByte ld e, a call GetScriptByte ld d, a jr ScriptCall Script_memcall: ; script command 0x2 ; parameters: pointer call GetScriptByte ld l, a call GetScriptByte ld h, a ld b, [hl] inc hl ld e, [hl] inc hl ld d, [hl] ; fallthrough ScriptCall: ; Bug: The script stack has a capacity of 5 scripts, yet there is ; nothing to stop you from pushing a sixth script. The high part ; of the script address can then be overwritten by modifications ; to wScriptDelay, causing the script to return to the rst/interrupt ; space. push de ld hl, wScriptStackSize ld e, [hl] inc [hl] ld d, 0 ld hl, wScriptStack add hl, de add hl, de add hl, de pop de ld a, [wScriptBank] ld [hli], a ld a, [wScriptPos] ld [hli], a ld a, [wScriptPos + 1] ld [hl], a ld a, b ld [wScriptBank], a ld a, e ld [wScriptPos], a ld a, d ld [wScriptPos + 1], a ret CallCallback:: ld a, [wScriptBank] or $80 ld [wScriptBank], a jp ScriptCall Script_sjump: ; script command 0x3 ; parameters: pointer call GetScriptByte ld l, a call GetScriptByte ld h, a ld a, [wScriptBank] ld b, a jp ScriptJump Script_farsjump: ; script command 0x4 ; parameters: pointer call GetScriptByte ld b, a call GetScriptByte ld l, a call GetScriptByte ld h, a jp ScriptJump Script_memjump: ; script command 0x5 ; parameters: pointer call GetScriptByte ld l, a call GetScriptByte ld h, a ld b, [hl] inc hl ld a, [hli] ld h, [hl] ld l, a jp ScriptJump Script_iffalse: ; script command 0x8 ; parameters: pointer ld a, [wScriptVar] and a jp nz, SkipTwoScriptBytes jp Script_sjump Script_iftrue: ; script command 0x9 ; parameters: pointer ld a, [wScriptVar] and a jp nz, Script_sjump jp SkipTwoScriptBytes Script_ifequal: ; script command 0x6 ; parameters: byte, pointer call GetScriptByte ld hl, wScriptVar cp [hl] jr z, Script_sjump jr SkipTwoScriptBytes Script_ifnotequal: ; script command 0x7 ; parameters: byte, pointer call GetScriptByte ld hl, wScriptVar cp [hl] jr nz, Script_sjump jr SkipTwoScriptBytes Script_ifgreater: ; script command 0xa ; parameters: byte, pointer ld a, [wScriptVar] ld b, a call GetScriptByte cp b jr c, Script_sjump jr SkipTwoScriptBytes Script_ifless: ; script command 0xb ; parameters: byte, pointer call GetScriptByte ld b, a ld a, [wScriptVar] cp b jr c, Script_sjump jr SkipTwoScriptBytes Script_jumpstd: ; script command 0xc ; parameters: predefined_script call StdScript jr ScriptJump Script_callstd: ; script command 0xd ; parameters: predefined_script call StdScript ld d, h ld e, l jp ScriptCall StdScript: call GetScriptByte ld e, a call GetScriptByte ld d, a ld hl, StdScripts add hl, de add hl, de add hl, de ld a, BANK(StdScripts) call GetFarByte ld b, a inc hl ld a, BANK(StdScripts) call GetFarHalfword ret SkipTwoScriptBytes: call GetScriptByte call GetScriptByte ret ScriptJump: ld a, b ld [wScriptBank], a ld a, l ld [wScriptPos], a ld a, h ld [wScriptPos + 1], a ret Script_prioritysjump: ; script command 0x8d ; parameters: pointer ld a, [wScriptBank] ld [wPriorityScriptBank], a call GetScriptByte ld [wPriorityScriptAddr], a call GetScriptByte ld [wPriorityScriptAddr + 1], a ld hl, wScriptFlags set 3, [hl] ret Script_checkscene: ; script command 0x13 call CheckScenes jr z, .no_scene ld [wScriptVar], a ret .no_scene ld a, $ff ld [wScriptVar], a ret Script_checkmapscene: ; script command 0x11 ; parameters: map_group, map_id call GetScriptByte ld b, a call GetScriptByte ld c, a call GetMapSceneID ld a, d or e jr z, .no_scene ld a, [de] ld [wScriptVar], a ret .no_scene ld a, $ff ld [wScriptVar], a ret Script_setscene: ; script command 0x14 ; parameters: scene_id ld a, [wMapGroup] ld b, a ld a, [wMapNumber] ld c, a jr DoScene Script_setmapscene: ; script command 0x12 ; parameters: map_group, map_id, scene_id call GetScriptByte ld b, a call GetScriptByte ld c, a DoScene: call GetMapSceneID ld a, d or e jr z, .no_scene call GetScriptByte ld [de], a .no_scene ret Script_readmem: ; script command 0x19 ; parameters: address call GetScriptByte ld l, a call GetScriptByte ld h, a ld a, [hl] ld [wScriptVar], a ret Script_writemem: ; script command 0x1a ; parameters: address call GetScriptByte ld l, a call GetScriptByte ld h, a ld a, [wScriptVar] ld [hl], a ret Script_loadmem: ; script command 0x1b ; parameters: address, value call GetScriptByte ld l, a call GetScriptByte ld h, a call GetScriptByte ld [hl], a ret Script_setval: ; script command 0x15 ; parameters: value call GetScriptByte ld [wScriptVar], a ret Script_addval: ; script command 0x16 ; parameters: value call GetScriptByte ld hl, wScriptVar add [hl] ld [hl], a ret Script_random: ; script command 0x17 ; parameters: input call GetScriptByte ld [wScriptVar], a and a ret z ld c, a call .Divide256byC and a jr z, .no_restriction ; 256 % b == 0 ld b, a xor a sub b ld b, a .loop push bc call Random pop bc ldh a, [hRandomAdd] cp b jr nc, .loop jr .finish .no_restriction push bc call Random pop bc ldh a, [hRandomAdd] .finish push af ld a, [wScriptVar] ld c, a pop af call SimpleDivide ld [wScriptVar], a ret .Divide256byC: xor a ld b, a sub c .mod_loop inc b sub c jr nc, .mod_loop dec b add c ret Script_readvar: ; script command 0x1c ; parameters: variable_id call GetScriptByte call GetVarAction ld a, [de] ld [wScriptVar], a ret Script_writevar: ; script command 0x1d ; parameters: variable_id call GetScriptByte call GetVarAction ld a, [wScriptVar] ld [de], a ret Script_loadvar: ; script command 0x1e ; parameters: variable_id, value call GetScriptByte call GetVarAction call GetScriptByte ld [de], a ret GetVarAction: ld c, a farcall _GetVarAction ret Script_checkver: ; script command 0x18 ld a, [.gs_version] ld [wScriptVar], a ret .gs_version: db GS_VERSION Script_getmonname: ; script command 0x40 ; parameters: string_buffer, mon_id (0 aka USE_SCRIPT_VAR to use wScriptVar) call LoadScriptPokemonID ld [wNamedObjectIndexBuffer], a call GetPokemonName ld de, wStringBuffer1 GetStringBuffer: call GetScriptByte cp NUM_STRING_BUFFERS jr c, .ok xor a .ok CopyConvertedText: ld hl, wStringBuffer3 ld bc, wStringBuffer4 - wStringBuffer3 call AddNTimes call CopyName2 ret Script_getitemname: ; script command 0x41 ; parameters: string_buffer, item_id (0 aka USE_SCRIPT_VAR to use wScriptVar) call GetScriptByte and a ; USE_SCRIPT_VAR jr nz, .ok ld a, [wScriptVar] .ok ld [wNamedObjectIndexBuffer], a call GetItemName ld de, wStringBuffer1 jr GetStringBuffer Script_getcurlandmarkname: ; script command 0x42 ; parameters: string_buffer ld a, [wMapGroup] ld b, a ld a, [wMapNumber] ld c, a call GetWorldMapLocation ConvertLandmarkToText: ld e, a farcall GetLandmarkName ld de, wStringBuffer1 jp GetStringBuffer Script_getlandmarkname: ; script command 0xa5 ; parameters: string_buffer, landmark_id call GetScriptByte jr ConvertLandmarkToText Script_gettrainername: ; script command 0x43 ; parameters: string_buffer, trainer_group, trainer_id call GetScriptByte ld c, a call GetScriptByte ld b, a farcall GetTrainerName jr GetStringBuffer Script_getname: ; script command 0xa7 ; parameters: string_buffer, type, id call GetScriptByte ld [wNamedObjectTypeBuffer], a ContinueToGetName: call GetScriptByte ld [wCurSpecies], a call GetName ld de, wStringBuffer1 jp GetStringBuffer Script_gettrainerclassname: ; script command 0xa6 ; parameters: string_buffer, trainer_group ld a, TRAINER_NAME ld [wNamedObjectTypeBuffer], a jr ContinueToGetName Script_getmoney: ; script command 0x3d ; parameters: string_buffer, account call ResetStringBuffer1 call GetMoneyAccount ld hl, wStringBuffer1 lb bc, PRINTNUM_RIGHTALIGN | 3, 6 call PrintNum ld de, wStringBuffer1 jp GetStringBuffer Script_getcoins: ; script command 0x3e ; parameters: string_buffer call ResetStringBuffer1 ld hl, wStringBuffer1 ld de, wCoins lb bc, PRINTNUM_RIGHTALIGN | 2, 6 call PrintNum ld de, wStringBuffer1 jp GetStringBuffer Script_getnum: ; script command 0x3f ; parameters: string_buffer call ResetStringBuffer1 ld de, wScriptVar ld hl, wStringBuffer1 lb bc, PRINTNUM_RIGHTALIGN | 1, 3 call PrintNum ld de, wStringBuffer1 jp GetStringBuffer ResetStringBuffer1: ld hl, wStringBuffer1 ld bc, NAME_LENGTH ld a, "@" call ByteFill ret Script_getstring: ; script command 0x44 ; parameters: string_buffer, text_pointer call GetScriptByte ld e, a call GetScriptByte ld d, a ld a, [wScriptBank] ld hl, CopyName1 rst FarCall ld de, wStringBuffer2 jp GetStringBuffer Script_givepokemail: ; script command 0x2f ; parameters: pointer call GetScriptByte ld l, a call GetScriptByte ld h, a ld a, [wScriptBank] call GetFarByte ld b, a push bc inc hl ld bc, MAIL_MSG_LENGTH ld de, wd002 ld a, [wScriptBank] call FarCopyBytes pop bc farcall GivePokeMail ret Script_checkpokemail: ; script command 0x30 ; parameters: pointer call GetScriptByte ld e, a call GetScriptByte ld d, a ld a, [wScriptBank] ld b, a farcall CheckPokeMail ret Script_giveitem: ; script command 0x1f ; parameters: item, quantity call GetScriptByte cp ITEM_FROM_MEM jr nz, .ok ld a, [wScriptVar] .ok ld [wCurItem], a call GetScriptByte ld [wItemQuantityChangeBuffer], a ld hl, wNumItems call ReceiveItem jr nc, .full ld a, TRUE ld [wScriptVar], a ret .full xor a ld [wScriptVar], a ret Script_takeitem: ; script command 0x20 ; parameters: item, quantity xor a ld [wScriptVar], a call GetScriptByte ld [wCurItem], a call GetScriptByte ld [wItemQuantityChangeBuffer], a ld a, -1 ld [wCurItemQuantity], a ld hl, wNumItems call TossItem ret nc ld a, TRUE ld [wScriptVar], a ret Script_checkitem: ; script command 0x21 ; parameters: item xor a ld [wScriptVar], a call GetScriptByte ld [wCurItem], a ld hl, wNumItems call CheckItem ret nc ld a, TRUE ld [wScriptVar], a ret Script_givemoney: ; script command 0x22 ; parameters: account, money call GetMoneyAccount call LoadMoneyAmountToMem farcall GiveMoney ret Script_takemoney: ; script command 0x23 ; parameters: account, money call GetMoneyAccount call LoadMoneyAmountToMem farcall TakeMoney ret Script_checkmoney: ; script command 0x24 ; parameters: account, money call GetMoneyAccount call LoadMoneyAmountToMem farcall CompareMoney CompareMoneyAction: jr c, .less jr z, .exact ld a, HAVE_MORE jr .done .exact ld a, HAVE_AMOUNT jr .done .less ld a, HAVE_LESS .done ld [wScriptVar], a ret GetMoneyAccount: call GetScriptByte and a ld de, wMoney ; YOUR_MONEY ret z ld de, wMomsMoney ; MOMS_MONEY ret LoadMoneyAmountToMem: ld bc, hMoneyTemp push bc call GetScriptByte ld [bc], a inc bc call GetScriptByte ld [bc], a inc bc call GetScriptByte ld [bc], a pop bc ret Script_givecoins: ; script command 0x25 ; parameters: coins call LoadCoinAmountToMem farcall GiveCoins ret Script_takecoins: ; script command 0x26 ; parameters: coins call LoadCoinAmountToMem farcall TakeCoins ret Script_checkcoins: ; script command 0x27 ; parameters: coins call LoadCoinAmountToMem farcall CheckCoins jr CompareMoneyAction LoadCoinAmountToMem: call GetScriptByte ldh [hMoneyTemp + 1], a call GetScriptByte ldh [hMoneyTemp], a ld bc, hMoneyTemp ret Script_checktime: ; script command 0x2b ; parameters: time xor a ld [wScriptVar], a farcall CheckTime call GetScriptByte and c ret z ld a, TRUE ld [wScriptVar], a ret Script_checkpoke: ; script command 0x2c ; parameters: pokemon xor a ld [wScriptVar], a call LoadScriptPokemonID ld hl, wPartySpecies ld de, 1 call IsInArray ret nc ld a, TRUE ld [wScriptVar], a ret Script_addcellnum: ; script command 0x28 ; parameters: person xor a ld [wScriptVar], a call GetScriptByte ld c, a farcall AddPhoneNumber ret nc ld a, TRUE ld [wScriptVar], a ret Script_delcellnum: ; script command 0x29 ; parameters: person xor a ld [wScriptVar], a call GetScriptByte ld c, a farcall DelCellNum ret nc ld a, TRUE ld [wScriptVar], a ret Script_checkcellnum: ; script command 0x2a ; parameters: person ; returns false if the cell number is not in your phone xor a ld [wScriptVar], a call GetScriptByte ld c, a farcall CheckCellNum ret nc ld a, TRUE ld [wScriptVar], a ret Script_specialphonecall: ; script command 0x9c ; parameters: call_id call GetScriptByte ld [wSpecialPhoneCallID], a call GetScriptByte ld [wSpecialPhoneCallID + 1], a ret Script_checkphonecall: ; script command 0x9d ; returns false if no special phone call is stored ld a, [wSpecialPhoneCallID] and a jr z, .ok ld a, TRUE .ok ld [wScriptVar], a ret Script_givepoke: ; script command 0x2d ; parameters: pokemon, level, item, trainer, trainer_name_pointer, pkmn_nickname call LoadScriptPokemonID ld [wCurPartySpecies], a call GetScriptByte ld [wCurPartyLevel], a call GetScriptByte ld [wCurItem], a call GetScriptByte and a ld b, a jr z, .ok ld hl, wScriptPos ld e, [hl] inc hl ld d, [hl] call GetScriptByte call GetScriptByte call GetScriptByte call GetScriptByte .ok farcall GivePoke ld a, b ld [wScriptVar], a ret Script_giveegg: ; script command 0x2e ; parameters: pokemon, level ; if no room in the party, return 0 in wScriptVar; else, return 2 xor a ; PARTYMON ld [wScriptVar], a ld [wMonType], a call LoadScriptPokemonID ld [wCurPartySpecies], a call GetScriptByte ld [wCurPartyLevel], a farcall GiveEgg ret nc ld a, 2 ld [wScriptVar], a ret Script_setevent: ; script command 0x33 ; parameters: bit_number call GetScriptByte ld e, a call GetScriptByte ld d, a ld b, SET_FLAG call EventFlagAction ret Script_clearevent: ; script command 0x32 ; parameters: bit_number call GetScriptByte ld e, a call GetScriptByte ld d, a ld b, RESET_FLAG call EventFlagAction ret Script_checkevent: ; script command 0x31 ; parameters: bit_number call GetScriptByte ld e, a call GetScriptByte ld d, a ld b, CHECK_FLAG call EventFlagAction ld a, c and a jr z, .false ld a, TRUE .false ld [wScriptVar], a ret Script_setflag: ; script command 0x36 ; parameters: bit_number call GetScriptByte ld e, a call GetScriptByte ld d, a ld b, SET_FLAG call _EngineFlagAction ret Script_clearflag: ; script command 0x35 ; parameters: bit_number call GetScriptByte ld e, a call GetScriptByte ld d, a ld b, RESET_FLAG call _EngineFlagAction ret Script_checkflag: ; script command 0x34 ; parameters: bit_number call GetScriptByte ld e, a call GetScriptByte ld d, a ld b, CHECK_FLAG call _EngineFlagAction ld a, c and a jr z, .false ld a, TRUE .false ld [wScriptVar], a ret _EngineFlagAction: farcall EngineFlagAction ret Script_wildoff: ; script command 0x38 ld hl, wStatusFlags set STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl] ret Script_wildon: ; script command 0x37 ld hl, wStatusFlags res STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl] ret Script_xycompare: ; script command 0x39 ; parameters: pointer call GetScriptByte ld [wXYComparePointer], a call GetScriptByte ld [wXYComparePointer + 1], a ret Script_warpfacing: ; script command 0xa3 ; parameters: facing, map_group, map_id, x, y call GetScriptByte maskbits NUM_DIRECTIONS ld c, a ld a, [wPlayerSpriteSetupFlags] set PLAYERSPRITESETUP_CUSTOM_FACING_F, a or c ld [wPlayerSpriteSetupFlags], a ; fall through Script_warp: ; script command 0x3c ; parameters: map_group, map_id, x, y ; This seems to be some sort of error handling case. call GetScriptByte and a jr z, .not_ok ld [wMapGroup], a call GetScriptByte ld [wMapNumber], a call GetScriptByte ld [wXCoord], a call GetScriptByte ld [wYCoord], a ld a, SPAWN_N_A ld [wDefaultSpawnpoint], a ld a, MAPSETUP_WARP ldh [hMapEntryMethod], a ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret .not_ok call GetScriptByte call GetScriptByte call GetScriptByte ld a, SPAWN_N_A ld [wDefaultSpawnpoint], a ld a, MAPSETUP_BADWARP ldh [hMapEntryMethod], a ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret Script_warpmod: ; script command 0x3a ; parameters: warp_id, map_group, map_id call GetScriptByte ld [wBackupWarpNumber], a call GetScriptByte ld [wBackupMapGroup], a call GetScriptByte ld [wBackupMapNumber], a ret Script_blackoutmod: ; script command 0x3b ; parameters: map_group, map_id call GetScriptByte ld [wLastSpawnMapGroup], a call GetScriptByte ld [wLastSpawnMapNumber], a ret Script_dontrestartmapmusic: ; script command 0x83 ld a, TRUE ld [wDontPlayMapMusicOnReload], a ret Script_writecmdqueue: ; script command 0x7d ; parameters: queue_pointer call GetScriptByte ld e, a call GetScriptByte ld d, a ld a, [wScriptBank] ld b, a farcall WriteCmdQueue ; no need to farcall ret Script_delcmdqueue: ; script command 0x7e ; parameters: byte xor a ld [wScriptVar], a call GetScriptByte ld b, a farcall DelCmdQueue ; no need to farcall ret c ld a, TRUE ld [wScriptVar], a ret Script_changemapblocks: ; script command 0x79 ; parameters: map_data_pointer call GetScriptByte ld [wMapBlocksBank], a call GetScriptByte ld [wMapBlocksPointer], a call GetScriptByte ld [wMapBlocksPointer + 1], a call ChangeMap call BufferScreen ret Script_changeblock: ; script command 0x7a ; parameters: x, y, block call GetScriptByte add 4 ld d, a call GetScriptByte add 4 ld e, a call GetBlockLocation call GetScriptByte ld [hl], a call BufferScreen ret Script_reloadmappart:: ; script command 0x7c xor a ldh [hBGMapMode], a call OverworldTextModeSwitch call GetMovementPermissions farcall ReloadMapPart call UpdateSprites ret Script_warpcheck: ; script command 0x8e call WarpCheck ret nc farcall EnableEvents ret Script_enableevents: ; unused farcall EnableEvents ret Script_newloadmap: ; script command 0x8a ; parameters: which_method call GetScriptByte ldh [hMapEntryMethod], a ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret Script_reloadandreturn: ; script command 0x92 call Script_newloadmap jp Script_end Script_opentext: ; script command 0x47 call OpenText ret Script_refreshscreen: ; script command 0x48 ; parameters: dummy call RefreshScreen call GetScriptByte ret Script_writeunusedbytebuffer: ; script command 0x4a ; parameters: byte call GetScriptByte ld [wUnusedScriptByteBuffer], a ret db closetext_command ; unused Script_closetext: ; script command 0x49 call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap call CloseText ret Script_autoinput: ; script command 0x89 ; parameters: input_pointer call GetScriptByte push af call GetScriptByte ld l, a call GetScriptByte ld h, a pop af call StartAutoInput ret Script_pause: ; script command 0x8b ; parameters: length call GetScriptByte and a jr z, .loop ld [wScriptDelay], a .loop ld c, 2 call DelayFrames ld hl, wScriptDelay dec [hl] jr nz, .loop ret Script_deactivatefacing: ; script command 0x8c ; parameters: time call GetScriptByte and a jr z, .no_time ld [wScriptDelay], a .no_time ld a, SCRIPT_WAIT ld [wScriptMode], a call StopScript ret Script_stopandsjump: ; script command 0x8f ; parameters: pointer call StopScript jp Script_sjump Script_end: ; script command 0x91 call ExitScriptSubroutine jr c, .resume ret .resume xor a ld [wScriptRunning], a ld a, SCRIPT_OFF ld [wScriptMode], a ld hl, wScriptFlags res 0, [hl] call StopScript ret Script_return: ; script command 0x90 call ExitScriptSubroutine jr c, .dummy .dummy ld hl, wScriptFlags res 0, [hl] call StopScript ret ExitScriptSubroutine: ; Return carry if there's no parent to return to. ld hl, wScriptStackSize ld a, [hl] and a jr z, .done dec [hl] ld e, [hl] ld d, $0 ld hl, wScriptStack add hl, de add hl, de add hl, de ld a, [hli] ld b, a and " " ld [wScriptBank], a ld a, [hli] ld e, a ld [wScriptPos], a ld a, [hl] ld d, a ld [wScriptPos + 1], a and a ret .done scf ret Script_endall: ; script command 0x93 xor a ld [wScriptStackSize], a ld [wScriptRunning], a ld a, SCRIPT_OFF ld [wScriptMode], a ld hl, wScriptFlags res 0, [hl] call StopScript ret Script_halloffame: ; script command 0xa1 ld hl, wGameTimerPause res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] farcall StubbedTrainerRankings_HallOfFame farcall StubbedTrainerRankings_HallOfFame2 farcall HallOfFame ld hl, wGameTimerPause set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] jr ReturnFromCredits Script_credits: ; script command 0xa2 farcall RedCredits ReturnFromCredits: call Script_endall ld a, MAPSTATUS_DONE call LoadMapStatus call StopScript ret Script_wait: ; script command 0xa8 ; parameters: unknown push bc call GetScriptByte .loop push af ld c, 6 call DelayFrames pop af dec a jr nz, .loop pop bc ret Script_checksave: ; script command 0xa9 farcall CheckSave ld a, c ld [wScriptVar], a ret ; unused ld a, [.byte] ld [wScriptVar], a ret .byte db 0 Script_loadmonindex: ; script command 0xaa call LoadScriptPokemonID ld [wScriptVar], a ld c, a call GetScriptByte dec a cp NUM_MAP_LOCKED_MON_IDS ret nc if LOCKED_MON_ID_MAP_1 > 1 add a, LOCKED_MON_ID_MAP_1 elif LOCKED_MON_ID_MAP_1 == 1 inc a endc ld l, a ld a, c jp LockPokemonID Script_checkmaplockedmons: ; script command 0xab ; check if the script variable's value is one of the reserved map indexes ld a, [wScriptVar] and a ret z cp MON_TABLE_ENTRIES + 1 ld c, 0 jr nc, .done ld b, a ldh a, [rSVBK] push af ld a, BANK(wPokemonIndexTable) ldh [rSVBK], a ld hl, wPokemonIndexTableLockedEntries + LOCKED_MON_ID_MAP_1 .loop inc c ld a, [hli] cp b jr z, .found ld a, c cp NUM_MAP_LOCKED_MON_IDS jr c, .loop ld c, 0 .found pop af ldh [rSVBK], a .done ld a, c ld [wScriptVar], a ret LoadScriptPokemonID: call GetScriptByte ld l, a call GetScriptByte ld h, a or l jp nz, GetPokemonIDFromIndex ld a, [wScriptVar] ret Script_givetmhm: ; script command 0xae ; parameters: ; tmhm (TMHMLabelByte) call GetScriptByte ld [wCurTMHM], a ld [wItemQuantityChangeBuffer], a call ReceiveTMHM jr nc, .full ld a, TRUE ld [wScriptVar], a ret .full xor a ld [wScriptVar], a ret ReceiveTMHM: ; d3c4 ld a, [wCurTMHM] ld e, a ld d, 0 ld b, SET_FLAG ld hl, wTMsHMs call FlagAction scf ret Script_checktmhm: ; script command 0xaf ; parameters: ; tmhm (TMHMLabelByte) xor a ld [wScriptVar], a call GetScriptByte ld [wCurTMHM], a call CheckTMHM ret nc ld a, TRUE ld [wScriptVar], a ret CheckTMHM: ; d3fb ld a, [wCurTMHM] ld e, a ld d, 0 ld b, CHECK_FLAG ld hl, wTMsHMs call FlagAction ret z scf ret Script_verbosegivetmhm: ; script command 0xb0 ; parameters: ; tmhm (TMHMLabelByte) call Script_givetmhm call CurTMHMName ld de, wStringBuffer1 ld a, 1 call CopyConvertedText ld b, BANK(GiveTMHMScript) ld de, GiveTMHMScript jp ScriptCall GiveTMHMScript: callasm ret_96f76 writetext ReceivedItemText waitsfx specialsound waitbutton tmhmnotify end Script_tmhmnotify: ; script command 0xb1 call wGetTMHMPocketName call CurTMHMName ld b, BANK(PutItemInPocketText) ld hl, PutItemInPocketText call MapTextbox ret ; 96fd5 Script_tmhmtotext: ; script command 0xb2 ; parameters: ; tmhm (TMHMLabelByte); use 0 to draw from ScriptVar ; memory (SingleByteParam) call GetScriptByte and a jr nz, .ok ld a, [wScriptVar] .ok ld [wd265], a call GetTMHMName ld de, wStringBuffer1 jp wConvertMemToText wConvertMemToText: call GetScriptByte cp 3 jr c, .ok xor a .ok wGetTMHMPocketName: ld hl, TMHMPocketName TMHMPocketName: db "TM POCKET@"
16.602667
81
0.709003
06b3ac3245500e81dd5ad31a63c31f00badc086e
858
asm
Assembly
programs/oeis/015/A015224.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/015/A015224.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/015/A015224.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A015224: Even pentagonal pyramidal numbers. ; 0,6,18,40,126,196,288,550,726,936,1470,1800,2176,3078,3610,4200,5566,6348,7200,9126,10206,11368,13950,15376,16896,20230,22050,23976,28158,30420,32800,37926,40678,43560,49726,53016,56448,63750,67626,71656,80190,84700,89376,99238,104430,109800,121086,127008,133120,145926,152626,159528,173950,181476,189216,205350,213750,222376,240318,249640,259200,279046,289338,299880,321726,333036,344608,368550,380926,393576,419710,433200,446976,475398,490050,505000,535806,551668,567840,601126,618246,635688,671550,689976,708736,747270,767050,787176,828478,849660,871200,915366,937998,961000,1008126,1032256,1056768,1106950,1132626,1158696 mul $0,2 mov $3,3 mov $4,$0 lpb $0 div $0,$3 mov $2,1 sub $4,$0 mov $1,$4 pow $1,2 mov $3,$4 add $3,1 mul $3,11 mul $2,$3 lpe mul $1,$2 div $1,44 mul $1,2 mov $0,$1
39
627
0.759907
c35f5a649a2cfd92556442ccabb5860ab2b47d28
1,094
asm
Assembly
Driver/Printer/PrintCom/printcomEpsonRXCursor.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Driver/Printer/PrintCom/printcomEpsonRXCursor.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Driver/Printer/PrintCom/printcomEpsonRXCursor.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Epson 9-pin print drivers FILE: printcomEpsonRXCursor.asm AUTHOR: Dave Durran, 14 March 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 3/14/90 Initial revision Dave 3/92 moved from epson9 to printcom DESCRIPTION: This file contains most of the code to implement the epson RX type print driver cursor movement support The cursor position is kept in 2 words: integer 216ths in Y and integer 72nds in X $Id: printcomEpsonRXCursor.asm,v 1.1 97/04/18 11:50:11 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include Cursor/cursorDotMatrixCommon.asm include Cursor/cursorSetCursorSpace72.asm include Cursor/cursorPrLineFeedExe.asm include Cursor/cursorPrFormFeed72.asm include Cursor/cursorConvert216.asm include Cursor/cursor1ScanlineFeed.asm
26.682927
79
0.627971
03b5bccd73bfc46e398bdf7f23355166069c1c5f
13,816
asm
Assembly
vp8/common/arm/armv6/filter_v6.asm
CM-Archive/android_external_libvpx
76e0247ec867fcc232fc79f21e9bf85d3c3a5a3f
[ "BSD-3-Clause" ]
3
2015-08-31T15:24:31.000Z
2020-04-24T20:31:29.000Z
vp8/common/arm/armv6/filter_v6.asm
CM-Archive/android_external_libvpx
76e0247ec867fcc232fc79f21e9bf85d3c3a5a3f
[ "BSD-3-Clause" ]
null
null
null
vp8/common/arm/armv6/filter_v6.asm
CM-Archive/android_external_libvpx
76e0247ec867fcc232fc79f21e9bf85d3c3a5a3f
[ "BSD-3-Clause" ]
4
2015-09-16T11:40:39.000Z
2019-06-10T01:08:46.000Z
; ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; EXPORT |vp8_filter_block2d_first_pass_armv6| EXPORT |vp8_filter_block2d_second_pass_armv6| EXPORT |vp8_filter4_block2d_second_pass_armv6| EXPORT |vp8_filter_block2d_first_pass_only_armv6| EXPORT |vp8_filter_block2d_second_pass_only_armv6| AREA |.text|, CODE, READONLY ; name this block of code ;------------------------------------- ; r0 unsigned char *src_ptr ; r1 short *output_ptr ; r2 unsigned int src_pixels_per_line ; r3 unsigned int output_width ; stack unsigned int output_height ; stack const short *vp8_filter ;------------------------------------- ; vp8_filter the input and put in the output array. Apply the 6 tap FIR filter with ; the output being a 2 byte value and the intput being a 1 byte value. |vp8_filter_block2d_first_pass_armv6| PROC stmdb sp!, {r4 - r11, lr} ldr r11, [sp, #40] ; vp8_filter address ldr r7, [sp, #36] ; output height sub r2, r2, r3 ; inside loop increments input array, ; so the height loop only needs to add ; r2 - width to the input pointer mov r3, r3, lsl #1 ; multiply width by 2 because using shorts add r12, r3, #16 ; square off the output sub sp, sp, #4 ;;IF ARCHITECTURE=6 ;pld [r0, #-2] ;;pld [r0, #30] ;;ENDIF ldr r4, [r11] ; load up packed filter coefficients ldr r5, [r11, #4] ldr r6, [r11, #8] str r1, [sp] ; push destination to stack mov r7, r7, lsl #16 ; height is top part of counter ; six tap filter |height_loop_1st_6| ldrb r8, [r0, #-2] ; load source data ldrb r9, [r0, #-1] ldrb r10, [r0], #2 orr r7, r7, r3, lsr #2 ; construct loop counter |width_loop_1st_6| ldrb r11, [r0, #-1] pkhbt lr, r8, r9, lsl #16 ; r9 | r8 pkhbt r8, r9, r10, lsl #16 ; r10 | r9 ldrb r9, [r0] smuad lr, lr, r4 ; apply the filter pkhbt r10, r10, r11, lsl #16 ; r11 | r10 smuad r8, r8, r4 pkhbt r11, r11, r9, lsl #16 ; r9 | r11 smlad lr, r10, r5, lr ldrb r10, [r0, #1] smlad r8, r11, r5, r8 ldrb r11, [r0, #2] sub r7, r7, #1 pkhbt r9, r9, r10, lsl #16 ; r10 | r9 pkhbt r10, r10, r11, lsl #16 ; r11 | r10 smlad lr, r9, r6, lr smlad r11, r10, r6, r8 ands r10, r7, #0xff ; test loop counter add lr, lr, #0x40 ; round_shift_and_clamp ldrneb r8, [r0, #-2] ; load data for next loop usat lr, #8, lr, asr #7 add r11, r11, #0x40 ldrneb r9, [r0, #-1] usat r11, #8, r11, asr #7 strh lr, [r1], r12 ; result is transposed and stored, which ; will make second pass filtering easier. ldrneb r10, [r0], #2 strh r11, [r1], r12 bne width_loop_1st_6 ;;add r9, r2, #30 ; attempt to load 2 adjacent cache lines ;;IF ARCHITECTURE=6 ;pld [r0, r2] ;;pld [r0, r9] ;;ENDIF ldr r1, [sp] ; load and update dst address subs r7, r7, #0x10000 add r0, r0, r2 ; move to next input line add r1, r1, #2 ; move over to next column str r1, [sp] bne height_loop_1st_6 add sp, sp, #4 ldmia sp!, {r4 - r11, pc} ENDP ;--------------------------------- ; r0 short *src_ptr, ; r1 unsigned char *output_ptr, ; r2 unsigned int output_pitch, ; r3 unsigned int cnt, ; stack const short *vp8_filter ;--------------------------------- |vp8_filter_block2d_second_pass_armv6| PROC stmdb sp!, {r4 - r11, lr} ldr r11, [sp, #36] ; vp8_filter address sub sp, sp, #4 mov r7, r3, lsl #16 ; height is top part of counter str r1, [sp] ; push destination to stack ldr r4, [r11] ; load up packed filter coefficients ldr r5, [r11, #4] ldr r6, [r11, #8] pkhbt r12, r5, r4 ; pack the filter differently pkhbt r11, r6, r5 sub r0, r0, #4 ; offset input buffer |height_loop_2nd| ldr r8, [r0] ; load the data ldr r9, [r0, #4] orr r7, r7, r3, lsr #1 ; loop counter |width_loop_2nd| smuad lr, r4, r8 ; apply filter sub r7, r7, #1 smulbt r8, r4, r8 ldr r10, [r0, #8] smlad lr, r5, r9, lr smladx r8, r12, r9, r8 ldrh r9, [r0, #12] smlad lr, r6, r10, lr smladx r8, r11, r10, r8 add r0, r0, #4 smlatb r10, r6, r9, r8 add lr, lr, #0x40 ; round_shift_and_clamp ands r8, r7, #0xff usat lr, #8, lr, asr #7 add r10, r10, #0x40 strb lr, [r1], r2 ; the result is transposed back and stored usat r10, #8, r10, asr #7 ldrne r8, [r0] ; load data for next loop ldrne r9, [r0, #4] strb r10, [r1], r2 bne width_loop_2nd ldr r1, [sp] ; update dst for next loop subs r7, r7, #0x10000 add r0, r0, #16 ; updata src for next loop add r1, r1, #1 str r1, [sp] bne height_loop_2nd add sp, sp, #4 ldmia sp!, {r4 - r11, pc} ENDP ;--------------------------------- ; r0 short *src_ptr, ; r1 unsigned char *output_ptr, ; r2 unsigned int output_pitch, ; r3 unsigned int cnt, ; stack const short *vp8_filter ;--------------------------------- |vp8_filter4_block2d_second_pass_armv6| PROC stmdb sp!, {r4 - r11, lr} ldr r11, [sp, #36] ; vp8_filter address mov r7, r3, lsl #16 ; height is top part of counter ldr r4, [r11] ; load up packed filter coefficients add lr, r1, r3 ; save final destination pointer ldr r5, [r11, #4] ldr r6, [r11, #8] pkhbt r12, r5, r4 ; pack the filter differently pkhbt r11, r6, r5 mov r4, #0x40 ; rounding factor (for smlad{x}) |height_loop_2nd_4| ldrd r8, [r0, #-4] ; load the data orr r7, r7, r3, lsr #1 ; loop counter |width_loop_2nd_4| ldr r10, [r0, #4]! smladx r6, r9, r12, r4 ; apply filter pkhbt r8, r9, r8 smlad r5, r8, r12, r4 pkhbt r8, r10, r9 smladx r6, r10, r11, r6 sub r7, r7, #1 smlad r5, r8, r11, r5 mov r8, r9 ; shift the data for the next loop mov r9, r10 usat r6, #8, r6, asr #7 ; shift and clamp usat r5, #8, r5, asr #7 strb r5, [r1], r2 ; the result is transposed back and stored tst r7, #0xff strb r6, [r1], r2 bne width_loop_2nd_4 subs r7, r7, #0x10000 add r0, r0, #16 ; update src for next loop sub r1, lr, r7, lsr #16 ; update dst for next loop bne height_loop_2nd_4 ldmia sp!, {r4 - r11, pc} ENDP ;------------------------------------ ; r0 unsigned char *src_ptr ; r1 unsigned char *output_ptr, ; r2 unsigned int src_pixels_per_line ; r3 unsigned int cnt, ; stack unsigned int output_pitch, ; stack const short *vp8_filter ;------------------------------------ |vp8_filter_block2d_first_pass_only_armv6| PROC stmdb sp!, {r4 - r11, lr} ldr r4, [sp, #36] ; output pitch ldr r11, [sp, #40] ; HFilter address sub sp, sp, #8 mov r7, r3 sub r2, r2, r3 ; inside loop increments input array, ; so the height loop only needs to add ; r2 - width to the input pointer sub r4, r4, r3 str r4, [sp] ; save modified output pitch str r2, [sp, #4] mov r2, #0x40 ldr r4, [r11] ; load up packed filter coefficients ldr r5, [r11, #4] ldr r6, [r11, #8] ; six tap filter |height_loop_1st_only_6| ldrb r8, [r0, #-2] ; load data ldrb r9, [r0, #-1] ldrb r10, [r0], #2 mov r12, r3, lsr #1 ; loop counter |width_loop_1st_only_6| ldrb r11, [r0, #-1] pkhbt lr, r8, r9, lsl #16 ; r9 | r8 pkhbt r8, r9, r10, lsl #16 ; r10 | r9 ldrb r9, [r0] ;; smuad lr, lr, r4 smlad lr, lr, r4, r2 pkhbt r10, r10, r11, lsl #16 ; r11 | r10 ;; smuad r8, r8, r4 smlad r8, r8, r4, r2 pkhbt r11, r11, r9, lsl #16 ; r9 | r11 smlad lr, r10, r5, lr ldrb r10, [r0, #1] smlad r8, r11, r5, r8 ldrb r11, [r0, #2] subs r12, r12, #1 pkhbt r9, r9, r10, lsl #16 ; r10 | r9 pkhbt r10, r10, r11, lsl #16 ; r11 | r10 smlad lr, r9, r6, lr smlad r10, r10, r6, r8 ;; add lr, lr, #0x40 ; round_shift_and_clamp ldrneb r8, [r0, #-2] ; load data for next loop usat lr, #8, lr, asr #7 ;; add r10, r10, #0x40 strb lr, [r1], #1 ; store the result usat r10, #8, r10, asr #7 ldrneb r9, [r0, #-1] strb r10, [r1], #1 ldrneb r10, [r0], #2 bne width_loop_1st_only_6 ;;add r9, r2, #30 ; attempt to load 2 adjacent cache lines ;;IF ARCHITECTURE=6 ;pld [r0, r2] ;;pld [r0, r9] ;;ENDIF ldr lr, [sp] ; load back output pitch ldr r12, [sp, #4] ; load back output pitch subs r7, r7, #1 add r0, r0, r12 ; updata src for next loop add r1, r1, lr ; update dst for next loop bne height_loop_1st_only_6 add sp, sp, #8 ldmia sp!, {r4 - r11, pc} ENDP ; |vp8_filter_block2d_first_pass_only_armv6| ;------------------------------------ ; r0 unsigned char *src_ptr, ; r1 unsigned char *output_ptr, ; r2 unsigned int src_pixels_per_line ; r3 unsigned int cnt, ; stack unsigned int output_pitch, ; stack const short *vp8_filter ;------------------------------------ |vp8_filter_block2d_second_pass_only_armv6| PROC stmdb sp!, {r4 - r11, lr} ldr r11, [sp, #40] ; VFilter address ldr r12, [sp, #36] ; output pitch mov r7, r3, lsl #16 ; height is top part of counter sub r0, r0, r2, lsl #1 ; need 6 elements for filtering, 2 before, 3 after sub sp, sp, #8 ldr r4, [r11] ; load up packed filter coefficients ldr r5, [r11, #4] ldr r6, [r11, #8] str r0, [sp] ; save r0 to stack str r1, [sp, #4] ; save dst to stack ; six tap filter |width_loop_2nd_only_6| ldrb r8, [r0], r2 ; load data orr r7, r7, r3 ; loop counter ldrb r9, [r0], r2 ldrb r10, [r0], r2 |height_loop_2nd_only_6| ; filter first column in this inner loop, than, move to next colum. ldrb r11, [r0], r2 pkhbt lr, r8, r9, lsl #16 ; r9 | r8 pkhbt r8, r9, r10, lsl #16 ; r10 | r9 ldrb r9, [r0], r2 smuad lr, lr, r4 pkhbt r10, r10, r11, lsl #16 ; r11 | r10 smuad r8, r8, r4 pkhbt r11, r11, r9, lsl #16 ; r9 | r11 smlad lr, r10, r5, lr ldrb r10, [r0], r2 smlad r8, r11, r5, r8 ldrb r11, [r0] sub r7, r7, #2 sub r0, r0, r2, lsl #2 pkhbt r9, r9, r10, lsl #16 ; r10 | r9 pkhbt r10, r10, r11, lsl #16 ; r11 | r10 smlad lr, r9, r6, lr smlad r10, r10, r6, r8 ands r9, r7, #0xff add lr, lr, #0x40 ; round_shift_and_clamp ldrneb r8, [r0], r2 ; load data for next loop usat lr, #8, lr, asr #7 add r10, r10, #0x40 strb lr, [r1], r12 ; store the result for the column usat r10, #8, r10, asr #7 ldrneb r9, [r0], r2 strb r10, [r1], r12 ldrneb r10, [r0], r2 bne height_loop_2nd_only_6 ldr r0, [sp] ldr r1, [sp, #4] subs r7, r7, #0x10000 add r0, r0, #1 ; move to filter next column str r0, [sp] add r1, r1, #1 str r1, [sp, #4] bne width_loop_2nd_only_6 add sp, sp, #8 ldmia sp!, {r4 - r11, pc} ENDP ; |vp8_filter_block2d_second_pass_only_armv6| END
31.117117
94
0.474088
94a9f56e1c8855e868b8871a542426e19e5c2751
679
asm
Assembly
Examples/ch05/RevStr.asm
satadriver/LiunuxOS
693174ac2b3e503d72782fc7a14f18c8a4f2756c
[ "Apache-2.0" ]
null
null
null
Examples/ch05/RevStr.asm
satadriver/LiunuxOS
693174ac2b3e503d72782fc7a14f18c8a4f2756c
[ "Apache-2.0" ]
null
null
null
Examples/ch05/RevStr.asm
satadriver/LiunuxOS
693174ac2b3e503d72782fc7a14f18c8a4f2756c
[ "Apache-2.0" ]
null
null
null
TITLE Program Template (RevStr.asm) ; This program reverses a string. ; Last update: 1/28/02 INCLUDE Irvine32.inc .data aName BYTE "Abraham Lincoln",0 nameSize = ($ - aName) - 1 .code main PROC ; Push the name on the stack. mov ecx,nameSize mov esi,0 L1: movzx eax,aName[esi] ; get character push eax ; push on stack inc esi Loop L1 ; Pop the name from the stack, in reverse, ; and store in the aName array. mov ecx,nameSize mov esi,0 L2: pop eax ; get character mov aName[esi],al ; store in string inc esi Loop L2 ; Display the name. mov edx,OFFSET aName call Writestring call Crlf exit main ENDP END main
16.560976
45
0.662739
1cf0f28d6f934ff7311207596ca6a0ef3c61fab8
3,596
asm
Assembly
SOURCE/base/boot/SingLdrPc/x86/blidt.asm
pmache/singularityrdk
090dbe7d1314fd4938d259abc103c4f3310798e5
[ "MIT" ]
3
2020-05-30T09:57:51.000Z
2020-05-30T10:01:47.000Z
SOURCE/base/boot/SingLdrPc/x86/blidt.asm
pmache/singularityrdk
090dbe7d1314fd4938d259abc103c4f3310798e5
[ "MIT" ]
1
2020-05-29T08:14:06.000Z
2020-05-29T08:14:06.000Z
SOURCE/base/boot/SingLdrPc/x86/blidt.asm
pmache/singularityrdk
090dbe7d1314fd4938d259abc103c4f3310798e5
[ "MIT" ]
null
null
null
;++ ; ; Copyright (c) Microsoft Corporation ; ; Module Name: ; ; blidt.asm ; ; Abstract: ; ; This module implements IDT functions for the boot loader. ; ; Environment: ; ; Boot loader. ; ;-- include bl.inc .686p .model flat .code assume ds:flat assume es:flat assume ss:flat assume fs:flat extrn ?BlTrapFatal@@YIXKPAU_BL_TRAP_CONTEXT@@@Z:near ;++ ; ; VOID ; BlTrapEnter( ; VOID ; ) ; ; Routine Description: ; ; Entry point for incoming exceptions. ; ;-- align 16 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; The IDT_ENTER building macros insure that each IDT target has ;;; an offset of form BlTrapEnter + 0x10 * interrupt_number. ;;; IDT_ENTER_NOERR MACRO num:req push 77h ; No error call @f align 8 ENDM IDT_ENTER_ERR MACRO num:req call @f align 8 ENDM align 16 ?BlTrapEnter@@YIXXZ proc IDT_ENTER_NOERR 000h ; #DE Divide-by-Zero IDT_ENTER_NOERR 001h ; #DB Debug Exception IDT_ENTER_NOERR 002h ; NMI Non-Maskable-Interrupt IDT_ENTER_NOERR 003h ; #BP Breakpoint IDT_ENTER_NOERR 004h ; #OF OVerflow IDT_ENTER_NOERR 005h ; #BR Bound-Range IDT_ENTER_NOERR 006h ; #UD Invalid Opcode IDT_ENTER_NOERR 007h ; #NM Device Not Available IDT_ENTER_ERR 008h ; #DF Double Fault IDT_ENTER_NOERR 009h ; Unused (was x87 segment except) IDT_ENTER_ERR 00ah ; #TS Invalid TSS IDT_ENTER_ERR 00bh ; #NP Sgement Not Present IDT_ENTER_ERR 00ch ; #SS Stack Exception IDT_ENTER_ERR 00dh ; #GP General Protection IDT_ENTER_ERR 00eh ; #PF Page Fault IDT_ENTER_NOERR 00fh ; Reserved IDT_ENTER_NOERR 010h ; #MF x87 Math Error IDT_ENTER_ERR 011h ; #AC Alignment Check IDT_ENTER_NOERR 012h ; #MC Machine Check IDT_ENTER_NOERR 013h ; #XF SIMD Exception inum = 014h ; 014h to 020h WHILE inum LE 020h IDT_ENTER_NOERR inum inum = inum + 1 ENDM @@: push eax push ebx push ecx push edx push esi push edi push ebp mov eax, esp add eax, 48 push eax mov eax, cr2 push eax mov edx, esp mov ecx, [edx].BL_TRAP_CONTEXT.TrapNum sub ecx, ?BlTrapEnter@@YIXXZ shr ecx, 3 mov [edx].BL_TRAP_CONTEXT.TrapNum, ecx call ?BlTrapFatal@@YIXKPAU_BL_TRAP_CONTEXT@@@Z @@: jmp @b ?BlTrapEnter@@YIXXZ endp ;++ ; ; VOID ; FASTCALL ; BlTrapSetIdtr( ; PIDTR Idtr ; ) ; ; Routine Description: ; ; This function sets the IDTR register. ; ; Arguments: ; ; Idtr - Supplies the data to write to the IDTR register. ; ;-- ?BlTrapSetIdtr@@YIXPAU_IDTR@@@Z proc lidt fword ptr [ecx] ret ?BlTrapSetIdtr@@YIXPAU_IDTR@@@Z endp end
25.146853
89
0.483871
e8f84bd8ef6620577a0304d15c8a0af9f6384075
286
asm
Assembly
programs/oeis/059/A059602.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/059/A059602.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/059/A059602.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A059602: Expansion of (5+10*x+x^2)/(1-x)^10. ; 5,60,376,1660,5830,17380,45760,109252,240955,497640,972400,1812200,3241628,5594360,9354080,15206840,24107105,37360004,56722600,84527300,123830850,178592700,253886880,356151900 mul $0,2 add $0,1 seq $0,38165 ; G.f.: 1/((1-x)*(1-x^2))^5.
40.857143
177
0.727273
a579a3b0223131b73dc1c1c70a7c49fd244ce210
4,144
asm
Assembly
lib/vg5k_crt0.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
lib/vg5k_crt0.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
lib/vg5k_crt0.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; CRT0 for the VG5000 ; ; Joaopa Jun. 2014 ; Stefano Bodrato Lug. 2014 ; ; $Id: vg5k_crt0.asm,v 1.4 2015/01/21 07:05:01 stefano Exp $ ; MODULE vg5k_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- EXTERN _main ;main() is always external to crt0 code PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) PUBLIC _std_seed ;Integer rand() seed PUBLIC _vfprintf ;jp to the printf() core PUBLIC exitsp ;atexit() variables PUBLIC exitcount PUBLIC heaplast ;Near malloc heap variables PUBLIC heapblocks PUBLIC __sgoioblk ;stdio info block PUBLIC base_graphics ;Graphical variables PUBLIC coords ;Current xy position PUBLIC snd_tick ;Sound variable PUBLIC bit_irqstatus ; current irq status when DI is necessary ; Now, getting to the real stuff now! IF !myzorg defc myzorg = 20480 ENDIF org myzorg org myzorg start: xor a ld (18434), a ;default character will be normal and black ex de,hl ; preserve HL ld (start1+1),sp ;Save entry stack ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp push de ; save HL ;push ix ; Optional definition for auto MALLOC init ; it assumes we have free space between the end of ; the compiled program and the stack pointer IF DEFINED_USING_amalloc INCLUDE "amalloc.def" ENDIF IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF di call _main ei cleanup: ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio EXTERN closeall call closeall ENDIF ENDIF ;pop ix ; We preserved HL and IX pop hl ; ..let's restore them ! ld ix,$47FA start1: ld sp,0 ret l_dcal: jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- __sgoioblk: IF DEFINED_ANSIstdio INCLUDE "stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- _vfprintf: IF DEFINED_floatstdio EXTERN vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio EXTERN vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio EXTERN vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- coords: defw 0 ; Current graphics xy coordinates base_graphics: defw $4000 ; Address of the Graphics map _std_seed: defw 0 ; Seed for integer rand() routines exitsp: defw 0 ; Address of where the atexit() stack is exitcount: defb 0 ; How many routines on the atexit() stack heaplast: defw 0 ; Address of last block on heap heapblocks: defw 0 ; Number of blocks IF DEFINED_USING_amalloc EXTERN ASMTAIL PUBLIC _heap ; The heap pointer will be wiped at startup, ; but first its value (based on ASMTAIL) ; will be kept for sbrk() to setup the malloc area _heap: defw ASMTAIL ; Location of the last program byte defw 0 ENDIF IF DEFINED_NEED1bitsound snd_tick: defb 0 ; Sound variable bit_irqstatus: defw 0 ENDIF ; defm "Small C+ VG5000" ; defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "float.asm" fp_seed: defb $80,$80,0,0,0,0 ;FP seed (unused ATM) extra: defs 6 ;FP register fa: defs 6 ;FP Accumulator fasign: defb 0 ;FP register ENDIF
21.583333
73
0.594112
579979b7b8aecfcbc91a3076aad24ce278828df5
463
asm
Assembly
libsrc/fcntl/spectrum/zxbasdrv/creat.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/fcntl/spectrum/zxbasdrv/creat.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/fcntl/spectrum/zxbasdrv/creat.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; ; Create a file by the BASIC driver (open then close) ; ; Stefano - 5/7/2006 ; ; int creat(char *name, mode_t mode); ; ; $Id: creat.asm,v 1.4 2016-06-23 20:40:25 dom Exp $ SECTION code_clib PUBLIC creat PUBLIC _creat EXTERN open EXTERN close .creat ._creat pop bc pop hl push hl push bc push bc push bc push hl call open pop bc pop bc pop bc ld a,h or l cp 255 ; -1 => error ? ret z push hl call close pop hl ld hl,0 ret
11.02381
53
0.639309
4640d1504e64802d287fb8d72de960b973cc6bdf
374
asm
Assembly
programs/oeis/332/A332102.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/332/A332102.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/332/A332102.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A332102: Least m > 0 such that 2*m^n <= Sum_{k < m} k^n. ; 3,5,8,10,13,15,18,20,23,25,28,30,33,35,38,40,42,45,47,50,52,55,57,60,62,65,67,70,72,75,77,79,82,84,87,89,92,94,97,99,102,104,107,109,112,114,116,119,121,124,126,129,131,134,136,139,141,144,146,149,151,153,156,158,161,163,166 mov $2,$0 add $2,1 mov $1,$2 mul $1,44 div $1,30 add $2,6 add $1,$2 sub $1,5 mov $0,$1
28.769231
226
0.636364
8f45b71be9408a6826bbe01ddf71c5d672fc8811
5,116
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_21829_1113.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_21829_1113.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_21829_1113.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 %r13 push %rcx push %rdi push %rsi lea addresses_A_ht+0x68ec, %rsi lea addresses_UC_ht+0x1aa5c, %rdi nop nop nop nop sub $64776, %r10 mov $28, %rcx rep movsq nop nop nop xor %r10, %r10 lea addresses_WT_ht+0x535c, %r11 cmp %rsi, %rsi mov (%r11), %r13w nop nop nop nop inc %rcx pop %rsi pop %rdi pop %rcx pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %r8 push %r9 push %rdx // Store lea addresses_UC+0x1855c, %rdx nop nop cmp $23729, %r8 movb $0x51, (%rdx) nop and %r9, %r9 // Load mov $0x6eaed900000006fc, %r10 nop nop nop nop inc %r13 movups (%r10), %xmm1 vpextrq $1, %xmm1, %r15 nop nop nop nop add $29810, %r9 // Store lea addresses_WT+0x11e60, %r8 nop nop nop nop cmp $58917, %r9 mov $0x5152535455565758, %r10 movq %r10, (%r8) nop add $16651, %r8 // Faulty Load lea addresses_WT+0xc35c, %r9 nop nop nop nop nop dec %r11 movntdqa (%r9), %xmm5 vpextrq $0, %xmm5, %r13 lea oracles, %r15 and $0xff, %r13 shlq $12, %r13 mov (%r15,%r13,1), %r13 pop %rdx pop %r9 pop %r8 pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_UC', 'AVXalign': False, 'size': 1}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_NC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}} [Faulty Load] {'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}} {'src': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'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 */
41.934426
2,999
0.657349
2da580eb0e31deddd4a01e9247076ae41d1e8fcb
648
asm
Assembly
oeis/001/A001053.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/001/A001053.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/001/A001053.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A001053: a(n+1) = n*a(n) + a(n-1) with a(0)=1, a(1)=0. ; Submitted by Jamie Morken(s1) ; 1,0,1,2,7,30,157,972,6961,56660,516901,5225670,57999271,701216922,9173819257,129134686520,1946194117057,31268240559432,533506283627401,9634381345852650,183586751854827751,3681369418442407670,77492344539145388821,1708512949279640961732,39373290177970887508657,946667477220580941169500,23706060220692494416746157,617304233215225435776569582,16690920357031779260384124871,467963074230105044726532065970,13587620073030078076329814038001,408096565265132447334620953206000 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $3,$0 add $3,$1 mov $1,$2 lpe mov $0,$3
46.285714
468
0.813272
a4ff3dbe5b03abbbef7e3f6b3081a066ca58e560
550
asm
Assembly
libsrc/target/c128/outvdc.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
38
2021-06-18T12:56:15.000Z
2022-03-12T20:38:40.000Z
libsrc/target/c128/outvdc.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
2
2021-06-20T16:28:12.000Z
2021-11-17T21:33:56.000Z
libsrc/target/c128/outvdc.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
6
2021-06-18T18:18:36.000Z
2021-12-22T08:01:32.000Z
; ;Based on the SG C Tools 1.7 ;(C) 1993 Steve Goldsmith ; ;$Id: outvdc.asm,v 1.3 2016-06-16 21:13:07 dom Exp $ ; ;set vdc register SECTION code_clib PUBLIC outvdc PUBLIC _outvdc EXTERN outvdc_callee EXTERN ASMDISP_OUTVDC_CALLEE outvdc: _outvdc: pop bc ;return address pop de ;data pop hl ;vdc register to write push hl push de push bc jp outvdc_callee + ASMDISP_OUTVDC_CALLEE
22
54
0.529091
1762050c581bf77448f18cd70ce660de3bfb4e86
1,418
asm
Assembly
bvs/BvsShared.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
null
null
null
bvs/BvsShared.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
null
null
null
bvs/BvsShared.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
null
null
null
;/*! ; @file ; ; @brief Shared code of VIO API DOS wrappers ; ; (c) osFree Project 2021, <http://www.osFree.org> ; for licence see licence.txt in root directory, or project website ; ; This is Family API implementation for DOS, used with BIND tools ; to link required API ; ; @author Yuri Prokushev (yuri.prokushev@gmail.com) ; ;*/ .8086 INCLUDE bios.inc INCLUDE bseerr.inc _TEXT SEGMENT BYTE PUBLIC 'CODE' USE16 PUBLIC VIOCHECKHANDLE PUBLIC VIOCHECKXYH PUBLIC VIOGOTOXYH VIOGOTOXYH PROC NEAR CALL VIOCHECKXYH JNZ EXIT @SetCurPos DL, CL XOR AX,AX ; SUCCESSFUL RETURN EXIT: RET VIOGOTOXYH ENDP VIOCHECKXYH PROC NEAR CALL VIOCHECKHANDLE ; CHECK HANDLE FIRST JNZ EXIT ; EXIT IF BAD ; AX = 0 HERE CMP CX,AX ; IS IT LESS THAN 0 JB ERRORROW ; GET OUT IF BAD F19_2: CMP CX,24 ; IS IT GREATER THAN 24 JBE F19_3 ; OK SO FAR ERRORROW: MOV AX,ERROR_VIO_ROW ; BAD ROW JMP EXIT ; GET OUT F19_3: CMP DX,AX ; IS IT LESS THAN 0 JB ERRORCOL ; GET OUT IF BAD CMP DX,79 ; IS IT GREATER THAN 79 JBE EXIT ; OK SO FAR ERRORCOL: MOV AX,ERROR_VIO_COL ; BAD COLUMN EXIT: RET VIOCHECKXYH ENDP VIOCHECKHANDLE PROC NEAR XOR AX,AX ; GOOD HANDLE CMP AX,BX ; IS IT ZERO JZ OK ; IT IS OK MOV AX,ERROR_VIO_INVALID_HANDLE ; BAD HANDLE OK: RET VIOCHECKHANDLE ENDP _TEXT ENDS END
19.971831
69
0.658674
b24b60894f2d9ba5e0aa70baaaa8b2a4f5cdf29a
393
asm
Assembly
programs/oeis/088/A088202.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/088/A088202.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/088/A088202.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A088202: Chromatic number of the n X n queen graph. ; 1,4,5,5,5,7,7,9,10,11,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 mov $3,2 mov $4,$0 lpb $0 mov $2,$0 add $0,1 div $0,4 seq $2,13632 ; Difference between n and the next prime greater than n. add $3,$2 mov $1,$3 sub $1,1 mov $5,-1 lpb $3 div $3,4 add $5,1 lpe mov $3,$5 lpe add $1,1 add $1,$4 mov $0,$1
16.375
72
0.577608
26305d486620b0dc919743bf555c9556d5a211e4
7,842
asm
Assembly
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1189.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_0x48.log_21829_1189.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_0x48.log_21829_1189.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 %r13 push %r15 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WC_ht+0x5c46, %r15 clflush (%r15) xor %r13, %r13 mov (%r15), %r11w nop nop xor $28339, %rax lea addresses_D_ht+0x13f46, %rax clflush (%rax) nop nop nop xor $33276, %r11 mov (%rax), %si sub $36659, %rsi lea addresses_D_ht+0x1e5b6, %r9 nop nop nop and %rcx, %rcx mov (%r9), %r13w sub %r15, %r15 lea addresses_A_ht+0x1bea6, %rcx nop nop and $22563, %rax mov $0x6162636465666768, %r15 movq %r15, (%rcx) nop nop inc %r11 lea addresses_WT_ht+0xf946, %r15 nop nop nop nop nop and $11562, %r13 mov (%r15), %r11d nop nop nop nop and $37234, %rsi lea addresses_D_ht+0x1d976, %rsi lea addresses_D_ht+0x2106, %rdi nop nop nop nop nop sub $44229, %r9 mov $60, %rcx rep movsb nop nop nop nop cmp $17500, %r15 lea addresses_A_ht+0x1346, %rcx nop nop nop nop add %r9, %r9 mov $0x6162636465666768, %rdi movq %rdi, (%rcx) dec %rcx lea addresses_D_ht+0x11526, %rsi lea addresses_WC_ht+0x14f3e, %rdi nop nop and %r13, %r13 mov $84, %rcx rep movsl nop nop nop nop nop add %r13, %r13 lea addresses_normal_ht+0xe746, %r15 nop nop cmp $48128, %rdi movw $0x6162, (%r15) nop nop nop nop xor %rsi, %rsi lea addresses_WC_ht+0xe66, %r15 nop nop add $53082, %rdi vmovups (%r15), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %rax nop nop nop dec %r13 lea addresses_D_ht+0xb6e6, %r13 dec %rax mov (%r13), %r15w inc %rdi lea addresses_normal_ht+0xed62, %r11 nop nop nop cmp %rax, %rax movl $0x61626364, (%r11) nop nop nop nop nop add %rdi, %rdi lea addresses_UC_ht+0xf9ca, %r11 nop nop nop nop add %r9, %r9 mov (%r11), %r13w nop nop nop nop nop xor $50890, %rsi lea addresses_normal_ht+0x3d06, %r13 nop nop nop nop nop and $10032, %r15 movb $0x61, (%r13) nop nop nop add $48454, %rax lea addresses_D_ht+0x13b46, %rsi lea addresses_A_ht+0x1e946, %rdi and $32100, %r11 mov $13, %rcx rep movsq nop nop and $39416, %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r15 push %r9 push %rbx // Store lea addresses_PSE+0x13206, %r10 nop nop nop xor $7388, %rbx movb $0x51, (%r10) nop nop nop xor $36748, %r13 // Faulty Load lea addresses_WT+0x3346, %r12 nop nop xor $61907, %r15 movb (%r12), %r10b lea oracles, %r13 and $0xff, %r10 shlq $12, %r10 mov (%r13,%r10,1), %r10 pop %rbx pop %r9 pop %r15 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 2, 'size': 1, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
33.088608
2,999
0.654297
819a0db9d5ddfbba918daf4cd36034711ae39064
3,098
asm
Assembly
boot/bootloader.asm
MahmoudYounes/BeOS
e832950a9103f154903eb600b0496d95c9826efb
[ "MIT" ]
null
null
null
boot/bootloader.asm
MahmoudYounes/BeOS
e832950a9103f154903eb600b0496d95c9826efb
[ "MIT" ]
null
null
null
boot/bootloader.asm
MahmoudYounes/BeOS
e832950a9103f154903eb600b0496d95c9826efb
[ "MIT" ]
null
null
null
;=================================================================== ; BeOS BootLoader Code ; ==================== ; ; boot code to boot the kernel from iso 9660 compliant CD ; works on 8086 architecture, 32 bits, single CPU ; boot sector size is 2kb ~ 2048 bytes ;=================================================================== ; TODO: make more explicit error messages ; TODO: discover memory layout [BITS 16] [ORG 0x7C00] jmp _start global _start _start: ; setting up segments and offsets cli xor ax, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax mov sp, 0xffff sti ; far jmp to make sure that cs and ip are the correct values ; 5 = 1 opcode + 2 segment + 2 offset jmp 0h:$ + 5 ; preserving boot drive number mov BYTE[BootDrive], dl ; print loading msg mov si, BootLoadingMsg call func_biosPrintf ; resetting boot drive mov dl, [BootDrive] call func_ResetDisk ; TODO: Check if int 13h extension methods 40h-48h exist and supported by BIOS. if not bootFailure ; ; reading primary volume descriptor to locate the kernel files ; first 32kb (16 sectors) are empty start at sector 16 mov eax, 100h mov es, eax xor edi, edi call func_ReadPrimaryVolumeDescriptor ; search for kernel file mov eax, 100h mov es, eax xor edi, edi call func_LocateKernelImage call func_LoadKernel call func_EnableA20 call func_PrepareGDT call func_EnableProtectedModeAndJmpKernel cli hlt bootFailure: mov si, BootFailureMsg call func_biosPrintf bootloaderEnd: cli hlt %include "./screen.asm" %include "./isoUtilities.asm" %include "./kernelLoad.asm" %include "./enableA20.asm" %include "./gdt.asm" %include "./protectedMode.asm" ; boot loader data BootDrive: db 0 BootFailureMsg: db "Booting sequence failed", 0 BootLoadingMsg: db "loading BeOS...", 0 BytesPerSector: dw 0 ; kernel info KernelName: db "KERNEL.IMG", 0x3b, 0x31 KernelLBA: dd 0 KernelLength: dd 0 ; gdtr gdtData: dd 0x0000 dd 0x0000 ; ;Code Descriptor dw 0xFFFF ;Limit (Low) dw 0x0000 ;Base (Low) DB 0x00 ;Base (Middle) DB 10011010b ;Access DB 11001111b ;Granularity DB 0x00 ;Base (High) ; ;Data Descriptor dw 0xFFFF ;Limit (Low) dw 0x0000 ;Base (Low) DB 0x00 ;Base (Middle) DB 10010010b ;Access DB 11001111b ;Granularity DB 0x00 ;Base (High) gdtEnd: GDT: dw gdtEnd - gdtData - 1 ;GDT Size - 1 dd gdtData ;Base Of GDT ; DAP buffer DAP: db 10h ; DAP size (disk address packet) db 0 ; unused dapNumSectors: dw 0 ; num sectors dapBufferOffset: dw 0 ; offset for buffer dapBufferSegment: dw 0 ; segment for buffer dapSectorNumL: dd 0 ; absolute sector number low dapSectorNumH: dd 0 ; absolute sector number high ; screen state currentCursorPosition: db 0 ; the current position of the cursor state whiteOnBlackConst: equ 0x0f ; const added to video memory rowsLimit: equ 80 colsLimit: equ 25 TIMES 2046-($-$$) db 0 dw 0xaa55
22.613139
99
0.642995
60c636aedbaf861ff245cc60c50944eedb4fad8d
56
asm
Assembly
src/main/fragment/mos6502-common/vwum2=_deref_pwuz1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
2
2022-03-01T02:21:14.000Z
2022-03-01T04:33:35.000Z
src/main/fragment/mos6502-common/vwum2=_deref_pwuz1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
src/main/fragment/mos6502-common/vwum2=_deref_pwuz1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
ldy #0 lda ({z1}),y sta {m2} iny lda ({z1}),y sta {m2}+1
9.333333
12
0.535714
27e845fb54890e63841432b30a5b8a127fae29fa
255
asm
Assembly
libsrc/stdio/ansi/gal/f_ansi_bel.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/stdio/ansi/gal/f_ansi_bel.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/stdio/ansi/gal/f_ansi_bel.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; ; ANSI Video handling for the Galaksija ; By Stefano Bodrato - 2017 ; ; BEL - chr(7) Beep it out ; ; ; Stefano Bodrato - 2017 ; ; ; $Id: f_ansi_bel.asm $ ; SECTION code_clib PUBLIC ansi_BEL ; No sound, for now! .ansi_BEL ret
10.625
40
0.607843
c5dc1b542378e1fdd180472134bf86eddec9ee0f
5,957
asm
Assembly
misc/cpcacid_src/cpcacid_modetrig.asm
floooh/yakc
0d00dac14a81bf8d92351ebe1397813385c82b3b
[ "MIT" ]
106
2015-11-15T19:55:05.000Z
2021-06-05T11:55:32.000Z
misc/cpcacid_src/cpcacid_modetrig.asm
floooh/yakc
0d00dac14a81bf8d92351ebe1397813385c82b3b
[ "MIT" ]
28
2015-11-14T09:21:03.000Z
2018-04-04T22:36:17.000Z
misc/cpcacid_src/cpcacid_modetrig.asm
floooh/yakc
0d00dac14a81bf8d92351ebe1397813385c82b3b
[ "MIT" ]
9
2016-06-22T00:09:23.000Z
2021-04-25T00:39:02.000Z
;; (c) Copyright Kevin Thacker 2015-2016 ;; This code is part of the Arnold emulator distribution. ;; This code is free to distribute without modification ;; this copyright header must be retained. org &4000 scr_set_mode equ &bc0e txt_output equ &bb5a scr_set_border equ &bc38 km_wait_char equ &bb06 start: ld a,2 call scr_set_mode ld hl,message call display_msg call km_wait_char ld a,2 call scr_set_mode ld b,0 ld c,b call scr_set_border xor a ld b,0 ld c,0 call scr_set_border ld a,1 ld b,26 ld c,26 call scr_set_border ld hl,&c000 ld e,l ld d,h inc de ld bc,&3fff ld (hl),&aa ldir ;; now copy each pen into the screen ld b,end_lines-lines srl b ld hl,lines dl1: push bc ld e,(hl) inc hl ld d,(hl) inc hl push hl ex de,hl ld e,l ld d,h inc de ld bc,80-1 ld (hl),&ff ldir pop hl pop bc djnz dl1 ld b,12 l3: halt djnz l3 di ld hl,&c9fb ld (&0038),hl ei loop: ld b,&f5 l2: in a,(c) rra jr nc,l2 ld bc,&7f00+%10001110 out (c),c ld bc,&7f10 out (c),c ld bc,&7f46 out (c),c halt halt di ld d,20 l1a: defs 64-1-3 dec d jp nz,l1a defs 64-2 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f52 out (c),c ;; 0->1 ld h,%10001100 ld l,%10001101 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f40 out (c),c ;; 1->0 ld h,%10001101 ld l,%10001100 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f52 out (c),c ;; 0->2 ld h,%10001100 ld l,%10001110 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f40 out (c),c ;; 2->0 ld h,%10001110 ld l,%10001100 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f52 out (c),c ;; 0->3 ld h,%10001100 ld l,%10001111 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f40 out (c),c ;; 3->0 ld h,%10001111 ld l,%10001100 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f52 out (c),c ;; 1->2 ld h,%10001101 ld l,%10001110 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f40 out (c),c ;; 2->1 ld h,%10001110 ld l,%10001101 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f52 out (c),c ;; 1->3 ld h,%10001101 ld l,%10001111 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f40 out (c),c ;; 3->1 ld h,%10001111 ld l,%10001101 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f52 out (c),c ;; 2->3 ld h,%10001110 ld l,%10001111 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ld bc,&7f10 out (c),c ld bc,&7f40 out (c),c ;; 3->2 ld h,%10001111 ld l,%10001110 defs 13 rept 15 out (c),h out (c),l call wait_64_7 endm out (c),h out (c),l defs 10 ;;----------------------------------------------------------------------------------------------------- ld bc,&7f10 out (c),c ld bc,&7f46 out (c),c ld bc,&7f00+%10011110 out (c),c ei jp loop wait_64_7: defs 64-7-5-3 ret lines: defw &c000+(1*80)+(3*&800) defw &c000+(2*80)+(0*&800) defw &c000+(3*80)+(3*&800) defw &c000+(4*80)+(0*&800) defw &c000+(5*80)+(3*&800) defw &c000+(6*80)+(0*&800) defw &c000+(7*80)+(3*&800) defw &c000+(8*80)+(0*&800) defw &c000+(9*80)+(3*&800) defw &c000+(10*80)+(0*&800) defw &c000+(11*80)+(3*&800) defw &c000+(12*80)+(0*&800) defw &c000+(13*80)+(3*&800) defw &c000+(14*80)+(0*&800) defw &c000+(15*80)+(3*&800) defw &c000+(16*80)+(0*&800) defw &c000+(17*80)+(3*&800) defw &c000+(18*80)+(0*&800) defw &c000+(19*80)+(3*&800) defw &c000+(20*80)+(0*&800) defw &c000+(21*80)+(3*&800) defw &c000+(22*80)+(0*&800) defw &c000+(23*80)+(3*&800) defw &c000+(24*80)+(0*&800) end_lines: display_msg: ld a,(hl) cp '$' ret z inc hl call txt_output jr display_msg message: defb "This is a visual test.",13,10,13,10 defb "This test changes the mode to indicate the exact time when the ",13,10 defb "Gate-Array accepts and performs the change.",13,10,13,10 defb "The test changes rapidly from a mode to another and tests all mode combinations",13,10 defb "excluding two modes of the same number",13,10,13,10 defb "A solid line is drawn on the line before AND the line after where each mode",13,10 defb "takes effect. Between these lines the graphics should be different so you can",13,10 defb "see it is a different mode",13,10,13,10 defb "in order: 1->0, 0->1, 2->0, 0->2, 3->0, 0->3, 1->2, 2->1, 1->3",13,10 defb "3->1,2->3,3->2",13,10,13,10 defb "Press a key to start",'$' end start
13.600457
103
0.510156
fcbfcfdeb837d793768193206a131304d5134e91
2,440
asm
Assembly
Lab5/ask3.asm
mikaelaksil/NTUA-Microprocessors
656c924286d63c110accc1638204e85e4a1a0991
[ "MIT" ]
null
null
null
Lab5/ask3.asm
mikaelaksil/NTUA-Microprocessors
656c924286d63c110accc1638204e85e4a1a0991
[ "MIT" ]
null
null
null
Lab5/ask3.asm
mikaelaksil/NTUA-Microprocessors
656c924286d63c110accc1638204e85e4a1a0991
[ "MIT" ]
null
null
null
INCLUDE macros.asm CODE SEGMENT ASSUME CS:CODE MAIN PROC FAR START: CALL HEX_KEYB ;Εισαγωγή 1ου ψηφίου CMP AL,'T' ;Ψηφίο = T ? JE FINISH ;Έλεγχος για τερματισμό MOV BL,AL ;Αποθήκευση 1ου ψηφίου ROL BL,4 ; CALL HEX_KEYB ;Εισαγωγή 2ου ψηφίου CMP AL,'T' JE FINISH MOV DL,AL ;Αποθήκευση 2ου ψηφίου ROL DL,4 ; CALL HEX_KEYB ;Εισαγωγή 3ου ψηφίου CMP AL,'T' JE FINISH OR BL,AL OR DL,AL ;Ένωση ψηφίων PRINTCH '=' CALL PRINT__DEC ;Εμφάνιση δεκαδικού PRINTCH '=' CALL PRINT_OCT ;Εμφάνιση οκταδικού PRINTCH '=' CALL PRINT_BIN ;Εμφάνιση δυαδικού PRINTLN JMP START FINISH: EXIT MAIN ENDP ;Εισαγωγή δεκαεξαδικού ψηφίου (στον AL) HEX_KEYB PROC NEAR READ: READCH CMP AL,'T' ;=Τ ? JE RETURN CMP AL,48 ;<0 ? JL READ CMP AL,57 ;>9 ? JG LETTER PRINTCH AL SUB AL,48 ;Κωδικός ASCII JMP RETURN LETTER: ;A...F CMP AL,'A' ;<A ? JL READ CMP AL,'F' ;>F ? JG READ PRINTCH AL SUB AL,55 ;Κωδικός ASCII RETURN: RET HEX_KEYB ENDP ;Εμφάνιση δεκαδικού αριθμού (από τον BL) PRINT__DEC PROC NEAR;βλ. mP11_80x86_programs.pdf σελ. 26-27 PUSH BX MOV AL,BL MOV BL,10 ;Δεκαδικός => διαιρέσεις με 10 MOV CX,0 ;Μετρητής ψηφίων GETDEC: ;Εξαγωγή ψηφίων MOV AH,0 ;Αριθμός mod 10 (υπόλοιπο) DIV BL ;Διαίρεση με 10 PUSH AX ;Προσωρινή αποθήκευση INC CL CMP AL,0 ;Αριθμός div 10 = 0 ? (πηλίκο) JNE GETDEC PRINTDEC: ;Εμφάνιση ψηφίων POP AX ADD AH,48 ;Κωδικός ASCII PRINTCH AH LOOP PRINTDEC POP BX RET PRINT__DEC ENDP ;Εμφάνιση οκταδικού αριθμού (από τον BL) PRINT_OCT PROC NEAR PUSH BX MOV AL,BL MOV BL,8 ;Οκταδικός => διαιρέσεις με 8 MOV CX,0 GETOCT: MOV AH,0 DIV BL PUSH AX INC CL CMP AL,0 JNE GETOCT PRINTOCT: POP AX ADD AH,48 PRINTCH AH LOOP PRINTOCT POP BX RET PRINT_OCT ENDP ;Εμφάνιση δυαδικού αριθμού (από τον BL) PRINT_BIN PROC NEAR MOV AL,BL MOV BL,2 ;Δυαδικός => διαιρέσεις με 2 MOV CX,0 GETBIN: MOV AH,0 DIV BL PUSH AX INC CL CMP AL,0 JNE GETBIN PRINTBIN: POP AX ADD AH,48 PRINTCH AH LOOP PRINTBIN RET PRINT_BIN ENDP CODE ENDS END MAIN
19.0625
61
0.584836
5b1ca24334c834edbaa873af089ecbff0cb663ba
1,603
asm
Assembly
libsrc/math/z88math/c/sccz80/fmod.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/math/z88math/c/sccz80/fmod.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/math/z88math/c/sccz80/fmod.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ; ; fmod(z,x) = z-x*floor(z/x) ; if x>0 then 0 <= fmod(z,x) < x ; if x<0 then x < fmod(z,x) <= 0 ; ;x is in the FA ;z is on the stack +8 (+2=x) SECTION code_fp IF FORz88 INCLUDE "target/z88/def/fpp.def" ELSE INCLUDE "fpp.def" ENDIF PUBLIC fmod EXTERN fsetup EXTERN stkequ2 EXTERN fa .fmod ld ix,8 add ix,sp ld l,(ix+1) ld h,(ix+2) ld de,(fa+1) exx ;main set ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) ld de,(fa+3) ld a,(fa+5) ld b,a push ix IF FORz88 fpp(FP_DIV) ELSE ld a,+(FP_DIV) call FPP ENDIF IF FORz88 fpp(FP_INT) ;floor ELSE ld a,+(FP_INT) call FPP ENDIF ;Load up x from the FA and multiply ld de,(fa+3) ld a,(fa+5) ld b,a exx ld de,(fa+1) exx IF FORz88 fpp(FP_MUL) ELSE ld a,+(FP_MUL) call FPP ENDIF IF FORz88 fpp(FP_NEG) ;negate ELSE ld a,+(FP_NEG) call FPP ENDIF ;load up z again pop ix ld e,(ix+3) ld d,(ix+4) ld b,(ix+5) ;exponent exx ld e,(ix+1) ld d,(ix+2) exx IF FORz88 fpp(FP_ADD) ELSE ld a,+(FP_ADD) call FPP ENDIF jp stkequ2
17.053191
49
0.417966
99b54d35b765e5dcf3cd04fd8c2b0c483296dd1c
45,847
asm
Assembly
45/qb/ir/ssrude.asm
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
45/qb/ir/ssrude.asm
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
45/qb/ir/ssrude.asm
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
page 49,132 TITLE ssrude - Scan and Descan support routines for SS_RUDE mode ;*** ;ssrude - Scan and descan support for SS_RUDE mode ; ; Copyright <C> 1986, Microsoft Corporation ; ;Purpose: ; ; Certain opcodes require work to scan from SS_RUDE to SS_PARSE and ; back. This module contains most of the dispatched entrypoints ; for performing this work. ; ; The connection between scan routines and descan routines is as ; follows: ; - Each scan routine is declared with macro SsVProc. If there is ; work required to get to/from SS_RUDE then the optional parameter ; "rude" is specified on the SsVProc invocation. Each scan dispatch ; so declared will have the address of the rude mode scan/descan ; routine stored in the scanner segment at the SsVProc entrypoint - ; SsVProcRude. ; - The scan and descan main loop will vector through the above address ; when the mpOpAtr entry for the opcode indicates that work is required ; to get to or from SS_RUDE mode. ; - The dispatched routine will determine whether the current operation ; is scan or descan by branching on PSW.Z. PSW.Z set indicates ; descan from SS_PARSE to SS_RUDE. PSW.Z clear indicates scan from ; SS_RUDE to SS_PARSE. ; ; Rude scan/descan dispatches are entered with the following convention: ; ax = oTyp from rule table (for opId's only) ; cx = opcode ; dx = pVariable table (Descan to SS_RUDE only) ; si = descan source ; di = descan destination ; es = text segment ; PSW.Z set indicates SS_PARSE -> SS_RUDE ; ; Special Cases: ; ------------- ; CONSTants ; When an opStConst statement is seen, we continue scanning ; IdLd pcodes normally, except that we give an error if ; MakeVariable finds one of these that is not already created ; as a CONSTant. Each time we find an IdSt pcode, we call ; ScanAndExec with the pcode expression we've just scanned ; ScanAndExec calls MakeVariable to create the new CONSTant ; variable, scans the expression to SS_EXECUTE, executes it ; (thus storing the value of the expression in the CONSTant), ; and then descans the expression back to SS_PARSE. ; ; ;***************************************************************************** .xlist include version.inc SSRUDE_ASM = ON IncludeOnce architec IncludeOnce context IncludeOnce names IncludeOnce opcodes ; IncludeOnce opid ; IncludeOnce opmin IncludeOnce optables IncludeOnce parser IncludeOnce pcode IncludeOnce qbimsgs IncludeOnce scanner IncludeOnce ssint IncludeOnce txtmgr IncludeOnce ui IncludeOnce variable .list ;Invoked after calling any function which could cause heap movement ; and thus, movement of the current text table being scanned. ; This macro preserves all registers except ES (including flags) ; SsRefreshES MACRO GETSEGTXTCUR ; ES = current pcode segment, ; all other registers preserved, ; including flags ENDM assumes ds, DATA assumes es, NOTHING assumes SS, DATA sBegin DATA globalW oNamOfPrsCur,UNDEFINED ;Speed optimization for rude scan ; set up here, used by varmgr staticW otxConstCur,0 ;otx to start of current CONST expr ; if scanning a CONST stmt, else 0 staticW varFlags_Reset,0 ;Normally 0, set to FVI_SHARED, ; FVI_STATIC, FVI_COMMON, FVI_AUTO, ; or FVI_PUBLIC whenever one of those ; bits must be temporarily reset ; in mkVar.flags by IdLd. ; Always reset by HandleId. staticB fErrWithinOp,0 ;set to 1 if an error occurred within ; the operand of a big opcode (like ; opStDeclare), so error can be ; reported at the operand. staticW spErrorRestore,0 ;used for error recovery sEnd DATA sBegin SCAN assumes cs,SCAN page ;*** ;SsRudeScan ;Purpose: ; Move text between SS_PARSE and SS_RUDE. ; ; This routine dispatches to the same entrypoint for moving ; text in either direction. The individual entrypoints must ; examine PSW to determine which direction to take the current ; opcode. ; ; Rude mode register convention is: ; ax = opcode ; dx = mrsCur.MRS_bdVar_pb (if not SizeD) ; es:si/di = source and destination pointers ; PSW.Z set indicates descan from SS_PARSE to SS_RUDE ; reset indicates scan from SS_RUDE to SS_PARSE ; ; Dispatching is performed for all opcodes. Table space is ; conserved by placing the rude dispatch as a prefix to the non-rude ; scan dispatch entrypoint for the opcode. Note that this restriction ; limits the resolution of the rude scan dispatching to that of the ; standard scan dispatching. In other words, there are no two opcodes ; with individual rude dispatches that have a common standard scan ; dispatch. ; ; A further space savings is that not all standard scan dispatches ; have rude dispatch prefixes. The scan entrypoint declaration macro ; SsProc has a second parameter that determines whether the rude ; dispatch is required. The opcode atribute table mpOpAtr contains ; a bit (OPA_fSsRude) that indicates to the rude scan loop whether ; there is work to go to/from SS_RUDE for that opcode. All opcodes ; that do not have this bit set are dispatched to a common entrypoint ; that skips operands to the next opcode. ; ; The rude scans are wholly space invarient. The rude scan is ; a scan in place - it is not necessary for dispatch points to emit ; text that is not modified (for instance, it is not necessary to ; emit the opcode). ; ; Descanning from SS_PARSE to SS_RUDE can cause no errors. ; ; Scanning from SS_RUDE to SS_PARSE can cause errors. When a dispatch ; point finds an error it must: ; - record the variable in a static variable. ; - recover the opcode that it is processing to a consistent (RUDE or ; PARSE mode state (all operands must be in the same state). ; - replace the first SS_RUDE mode opcode in the text table with an ; opEot. ; - restart SsRudeScan to descan the pcode up to the opEot. ; - replace the opEot with the saved opcode. ; - return, reporting the error. ; ;NOTE: This is not a recursive scheme; an alternate reentry point is ; used to descan the pcode, and the opEot detects whether an error ; has occurred or not. Aside from the above mechanism, this routine ; is NOT reentrant. ; ; Error control variables are: ; SsErrOTx - text offset of pcode which was replaced by opEot ; descanner expects this to be UNDEFINED if no ; error has occured. ; SsErr - error code to be returned by scanner. ; SsErrOpcode - opcode which was replaced by opEot ; ;Entry: ; parmW target scan state (must be SS_RUDE or SS_PARSE) ;Exit: ; ax == 0 ----> Output registers are the same as for GetTXDInfo ; ax != 0 ----> ax = error code ; [grs.GRS_otxCur] = text offset to error. If low ; bit is set, error is within an operand (like opStSub, ; opStDeclare, etc.), so caller can position cursor ; exactly to the error token. ; ;************************************************************ cProc SsRudeScan,<PUBLIC,FNEAR>,<si,di> parmB TargetState cBegin mov [spErrorRestore],sp ;in case an error occurs with ; stack in an intermediate state sub ax,ax mov [fErrWithinOp],al dec ax ;ax = UNDEFINED mov [SsErrOTx],ax ;initialize in case we're descanning cmp [TargetState],SS_RUDE ;Indicate scan or descan jz SsRudeDeScan ;brif descanning to SS_RUDE call OtxDefType0Far ; set all 26 letter default ; types to initial default SkipDT: cmp [grs.GRS_fDirect],FALSE jz Not_Direct ;brif not scanning direct mode buffer push [grs.GRS_otxCONT] ; In direct mode, call OtxDefTypeCurFar ; set all 26 letter defaults to ; values at the current program counter. ; If cant CONT (i.e. UNDEFINED), set ; them to their value at EOT Not_Direct: DbAssertRelB [TargetState],z,SS_PARSE,SCAN,<ssrude: invalid target state> cmp [grs.GRS_oPrsCur],UNDEFINED jz SsRudeScanErr ;brif not scanning a procedure table cmp [grs.GRS_fDirect],FALSE jnz SsRudeScanErr ;ignore prsCur stuff if in Direct Mode push [prsCur.PRS_ogNam] call ONamOfOgNamFar ;must succeed (as prs already exists) DbAssertRel ax,nz,0,SCAN,<SsRudeScan: [6] ONamOfOgNam returned an error> mov [oNamOfPrsCur],ax ;speed optimization - used by varmgr call MakePrsTVar ;make var hash table for prsCur or ax,ax ;error return? jnz SsRudeScanErr ; brif not PUSHI ax,ER_OM ;insufficient memory - - exit jmp ErrExit SsRudeDeScan: ;only get here if we're descanning DbAssertRelB [grs.GRS_fDirect],z,FALSE,SCAN,<ssrudedescan: fDirect TRUE> ;don't want to reset otxCONT when dealing with the Direct Mode buffer, ; so we're counting on the fact that we never descan the D.M. buffer mov [grs.GRS_otxCONT],UNDEFINED ;ensure this is correctly set whenever ; we descan any text table SsRudeScanErr: ;reentry point in case of scan error SsRefreshES ;es = cur pcode seg (heap movement) mov dx,[mrsCur.MRS_bdVar.BD_pb] ;Address of variable table SetStartOtx si ;Start scan from the top mov di,si ;Destination = source RudeLoop: LODSWTX ;Pick up opcode mov bx,ax and bx,OPCODE_MASK ; ax is actual opcode, bx is ; masked opcode DbAssertRel bx,be,op_max,SCAN,<Rude Scan Loop: opcode out of range.> DbAssertRel spErrorRestore,e,sp,SCAN,<Rude Scan Loop: Stack Use Err.> DbAssertRel si,ae,di,SCAN,<Rude Scan Loop: Emit overran source.> DbAssertRel es,z,EScheckRude,SCAN,<Rude Scan Loop: ES not preserved> mov cl,mpOpAtr.[bx] ;load attribute byte test cl,OPA_fSsRude ;Test for scan work for rude mode jnz RudeScanWork ;Work required to get to SS_RUDE Ssv_NOps: ;Skip opcode and operands and cx,OPA_CntMask ;get the operand count from attribute .errnz OPA_CntMask AND 0FF00H ;must use cx in next line if non-zero cmp cl,OPA_CntMask ;check for cnt field in operand jz Fetch_Cnt ; brif there is a cnt field Bump_TxtPtr: add si,cx jmp RudeLoop ;start over for next operand Fetch_Cnt: LODSWTX ;load the cnt field mov cx,ax inc cx and cl,0FEH ;round up to even byte count jmp short Bump_TxtPtr RudeScanWork: mov di,si ;Bring destination in line with source mov al,ah ; al contains oTyp for opId's, ; but left shifted SHIFT H,R,al,2 ; shift al right two bits .errnz OPCODE_MASK - 03FFH ; 03FF mask implies it's shifted ; left two bits. cbw ;ax = oTyp for opId's mov cx,bx ; cx = masked opcode shl bx,1 ;To word offset mov bx,[bx].mpOpScanDisp ;Scan dispatch address DbPub DispSSR ;a handy public for debugging cmp [TargetState],SS_RUDE ;Indicate scan or descan DispSSR: jmp word ptr cs:[bx].SsProcRude ;Dispatch to RUDE scanner ;*** ;SsVProc Eot ;Purpose: ; Rude scan/descan dispatch. ; ;Input: ; Standard rude dispatch ;Output: ;************************************************************ SsVProc Eot jnz SsRudeOkX ;if scanning and got to opEot, no errors mov ax,UNDEFINED cmp [grs.GRS_fDirect],FALSE jnz Eot_Cont1 mov bx,dataOFFSET mrsCur cmp [grs.GRS_oPrsCur],ax jz Eot_Cont ;brif not scanning a procedure table mov bx,dataOFFSET prsCur mov [prsCur.PRS_oVarHash],ax ;must ensure this gets reset here, in ; case we were called to descan a ; prs with an empty text table Eot_Cont: .errnz PRS_cbFrameVars - MRS_cbFrameVars mov [bx.PRS_cbFrameVars],-FR_FirstVar ; reset to init. value. This value ; is 2 to account for the fact that ; b$curframe is always pushed on the ; stack after bp, so we treat this ; word as a frame var for ref'ing ; the real frame vars off of bp Eot_Cont1: ;reset to default cmp [SsErrOTx],ax ;did we just descan due to a scan err? jz SsRudeOkX ;No error - exit. mov di,[SsErrOTx] mov ax,[SsErrOpcode] STOSWTX ;restore the saved opcode in text table push [SsErr] ;in case ModuleRudeEdit changes this ErrExit: cmp [grs.GRS_fDirect],FALSE jnz Eot_Err_Exit ;don't call ModuleRudeEdit if error ; in scanning Direct mode buffer - - ; no need to do so. call ModuleRudeEditFar ;discard vartable, reset name table bits mov [spErrorRestore],sp ;refresh (ModuleRudeEdit recursively ; calls SsRudeScan which changes this) Eot_Err_Exit: pop ax ;retval SsRudeErr: ;ax = error code, set carry and return jmp short SsRudeX SsRudeOkX: mov al,[TargetState] cmp [grs.GRS_fDirect],FALSE jnz SsRudeX1 ;brif just scanned direct mode buffer mov [txdCur.TXD_scanState],al ;in case we had a DEF FN without an END DEF (an error the execute ; scanner will catch), deactivate prsCur if the current text table ; is for mrsCur test [txdCur.TXD_flags],FTX_mrs jz SsRudeX1 ;brif a prs is active call PrsDeActivateFar ; in case we had a DEF FN w/o an END DEF SsRudeX1: DbMessTimer SCAN,<Leave SsRudeScan - > sub ax,ax ; Indicate success SsRudeX: mov [oNamOfPrsCur],UNDEFINED ;reset to default value cEnd ;*** ;HandleError ;Purpose: ; This routine is called when an error occurs in scanning from ; SS_RUDE to SS_PARSE. It saves away the first unscanned pcode, ; replacing it with opEot. It saves away the error code for later ; reporting. It sets SI & DI to zero, sets the TargetState to ; SS_RUDE for descanning, and returns to the scan/descan loop. ;Input: ; SI-4 points to the first unscanned pcode. ; AL contains the qbimsgs error code; AH is likely non-zero. ; ES is still set up for text table being scanned. ; DI Assumed != UNDEFINED, EXCEPT for the special case where a ; statement might be fully scanned to parse and THEN the ; error is noticed. Example: CONST x = 1/0. ; In this case, the otx for where the error actually occured ; is on the stack ;Exit: ; [SsErrOTx] = text offset to error ; ;***************************************************************************** DbPub HandleError HandleError: SsRefreshES ; es = cur pcode seg (heap movement) xor ah,ah ;convert error code to a word mov [SsErr],ax cmp [grs.GRS_oPrsCur],UNDEFINED jz HandleErr_Cont ;brif no prs active cmp [prsCur.PRS_procType],PT_DEFFN jnz HandleErr_Cont ;brif active prs is not a DEF FN call PrsDeActivateFar ; deactivate the DEF FN HandleErr_Cont: sub si,4 ;move back to first unscanned opcode mov [SsErrOTx],si ;save oTx of opcode we're replacing mov ax,si inc di ;special case? jnz HandleErr_Cont1 ; brif not pop ax HandleErr_Cont1: mov sp,[spErrorRestore] ;in case stack in an intermediate state or al,[fErrWithinOp] ;tell caller if error was at operand mov [grs.GRS_otxCur],ax ;tell SsRudeScan's caller where error is LODSWTX ;get original opcode mov [SsErrOpcode],ax ; and save it for later restoration mov WORD PTR es:[si-2],opEot mov [TargetState],SS_RUDE ;so we'll descan portion scanned so far jmp SsRudeScanErr ;return to the main loop ;*** ;HandleId ;Purpose: ; Given an oTyp in ax, an oNam at es:[si], and mkVar.flags ; set up appropriately, call MakeVariable to search for ; (and create if necessary) the variable, replacing the ; oNam with an oVar. ;Input: ; ax = oTyp for var ; es:si and es:di both point to oNam in pcode ; mkVar.flags and mkVar.cDimensions (if appropriate) ; are already set up per varmgr spec.s. ;Output: ; The oVar is substituted for the oNam ; si & di point at the following word ;Preserves: ; ES ;***************************************************************************** DbPub HandleId HandleId PROC NEAR mov [mkVar.MKVAR_oTyp],ax LODSWTX ;Pick up oNam mov [mkVar.MKVAR_oNam],ax call MakeVariableFar SsRefreshES ;es = cur pcode seg (heap movement) or ah,ah ;an error return? js Id_Mkvar_Error ; brif so cmp [otxConstCur],0 ;scanning a CONST statement? jnz ConstCheck ; brif so HandleId_Exit: STOSWTX ;emit the oVar xor ax,ax xchg ax,[varFlags_Reset] ; reset flag, fetch previous ; settings of certain flag bits or [mkVar.MKVAR_flags],ax ;for special case; see IdLd, below ret Id_Mkvar_Error: TESTM mkVar.MKVAR_exitFlags,FVI_INDEXED jz HandleError5 ;brif not an array pcode Id_Error: dec si ;so si points 4-bytes past opcode dec si HandleError5: jmp HandleError ConstCheck: test [mkVar.MKVAR_flags2],MV_fConstFound jnz HandleId_Exit ;brif things are okay, i.e., we're in ; a CONST statement and the variable ; we just found is really a constant mov al,MSG_InvConst ;"Invalid Constant" jmp short Id_Mkvar_Error HandleId ENDP page ;*** ;SsVProc Unsupported ; ;Purpose: ; ; This routine reports an error when unsupported opcodes are encountered. ; This will occur from a binary load of a file from another basic product ; that supports statements not supported by this product. ; ;Input: ; ; standard rude scan dispatch. ; ;Output: ; ; standard rude scan dispatch. ; ;********************************************************************** SsVProc Unsupported mov al,Msg_Unsupported HandleError7: inc si ; Set SI-4 to point to this opcode inc si jmp short HandleError5 ;*** ;SsVProc Id<Ld|St> ;Purpose: ; Simple Id SS_RUDE scan/descan dispatch points. ; ; The only rude mode issue is to move the single operand between ; oVar and oNam. ; ; Scanning: ; For each of these, the oNam in in the pcode stream, ; the oTyp can be fetched from the rule table (mpOpRule). ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc IdSt jz DIdRude mov cx,[otxConstCur] jcxz IdSt ;brif not scanning a CONST statement inc si ;advance txt ptr to next pcode inc si ;cx = oTx of start of CONST expression mov ax,si sub ax,cx ; ax = count of bytes in CONST expr. cCall ScanAndExec,<cx,ax> ; creates CONST variable, scans & ; executes expression, setting ; value field in the new CONST variable SsRefreshES ;es = text segment ; (ScanAndExec can cause far heap ; movement) mov [spErrorRestore],sp ;refresh (ScanAndExec changes this) or ax,ax jz IdSt_NoErr ;brif no error js HandleError5 ;brif pcode not modified by ScanAndExec sub si,4 ;so we report error on correct line push si mov di,UNDEFINED ;signal special case, so UI will report ; the error on the correct line add si,8 ;advance oTx to reflect that the IdSt ; pcode did get bound to an oVar by ; ScanAndExec jmp short HandleError5 ;brif error IdSt_NoErr: mov [otxConstCur],si ;in case there are more CONSTant ; expressions in this statement jmp short RetToScan5 ;no error IdSt: ;start of code shared for array St's or [mkVar.MKVAR_flags],FVI_LVAL ;We know the zero flag won't be set after the above 'or', so fall thru SsVProc IdLd jz DIdRude ;The following tests for ReDim scalar which can appear because QB4 ;incorrectly allowed it. The binary translator mucks with the code ;but must leave it so it can be listed to and editted by the user. cmp PTRTX[si+2],opStReDimTo+OPCODE_MASK+1 ; ReDimScalar je ReDimScalar IdLd_1: ;The below code is for a case like STATIC X,Y(A),Z ; where 'A' will be an IdLd. We preserve and HandleId restore's the ; previous state of the FVI_STATIC flag in case of variables like 'Z' mov cx,[mkVar.MKVAR_flags] KEYWORD_FLAGS EQU FVI_SHARED OR FVI_COMMON OR FVI_STATIC OR FVI_DIM and cx,KEYWORD_FLAGS mov [varFlags_Reset],cx ;0 or some flag bit and [mkVar.MKVAR_flags],NOT KEYWORD_FLAGS IdLd: ;start of code shared for array Ld ID's call HandleId RetToScan5: jmp RudeLoop ;return to the main loop ReDimScalar: mov al,Msg_SubCnt jmp short HandleError7 DIdRude: ;Common ID rude descan code LODSWTX ;Pick up operand add ax,dx ; ax = pVariable xchg bx,ax mov ax,[bx].VAR_oNam ;ax = oNam for variable STOSWTX ;emit the oNam jmp RudeLoop ;And return to the main loop SsVProc VtRf jz DIdRude IdVtRf: ;start of code shared for array VtRf's TestM [mkVar.MKVAR_flags],FVI_ASCLAUSE jz IdLd ;brif no 'AS' clause found cmp ax,ET_IMP jnz IdLd ;brif explicitly typed VtRf opcode mov ax,[mkVar.MKVAR_oTyp] ;desired oTyp is already in mkVar jmp short IdLd ;*** ;SsVProc AId<Ld|St> ;Purpose: ; Array Id SS_RUDE scan/descan dispatch points. ; ; The only rude mode issue is to move the single operand between ; oVar and oNam. ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc AIdSt call AIdPreamble ;common code to all Array ID's jmp short IdSt ;shared code for all St ID's SsVProc AIdLd call AIdPreamble ;common code to all Array ID's cmp PTRTX[si+2],opStReDimTo ; Is this a ReDim statement? je ArrayDeclare ; Yes, need to set FVI_ARRAY jmp short IdLd_1 ; shared code for all Ld ID's SsVProc AVtRf call AIdPreamble ;common code to all Array ID's ArrayDeclare: shr [mkVar.MKVAR_cDimensions],1 ;divide cDimensions by two in case this ; is an array ref., since the 'cnt' for ; that pcode counts lower & upper ; bounds for each dimension or [mkVar.MKVAR_flags],FVI_ARRAY jmp short IdVtRf ;shared code for all VtRf ID's ;*** ;AIdPreamble ;Purpose: ; Perform actions common to all array ID opcodes. This ; includes checking to see if we're scanning or descanning, ; (and handling the descan case entirely), setting up ; mkVar.cDimensions, and setting the FVI_INDEXED bit in mkVar.flags. ; ;Input: ; standard rude scan dispatch. ;Output: ; ax = type of ID ; mkVar.MKVAR_cDimensions field set up (though it could be 2 cDim's) ; di = si ; mkVar.flags has FVI_INDEXED set ;***************************************************************************** DbPub AIdPreamble AIdPreamble PROC NEAR jz DAIdRude xchg ax,bx ;save array type in bx LODSWTX ;Pick up (assumed) cDimensions ; (note that this might be 2 * cDim's) or ah,ah ;special value in lieu of 0? jns Save_cDims ; brif not xor al,al ;set cDims to zero Save_cDims: mov [mkVar.MKVAR_cDimensions],al xchg ax,bx ;common code expects type in ax inc di ;set di = si inc di or [mkVar.MKVAR_flags],FVI_INDEXED ret AIdPreamble ENDP DAIdRude: pop ax ;throw away return addr from AIdPreamble inc si ;skip index count inc si mov di,si ;Move to oVar operand jmp DIdRude ; and dereference just like an Id ;*** ;SsVProc Off<Ld|St> ;Purpose: ; Record offset Id SS_RUDE scan/descan dispatch points. ; ; Scan work: Convert oNam to oElem ; Descan work: Convert oElem to oNam ;Input: ; standard rude scan dispatch. ; Count on the oTyp of parent being in mkVar.oTyp. ;Output: ; standard rude scan dispatch. ; Leave the oTyp of found element in mkVar.oTyp. ;***************************************************************************** SsVProc OffLd SsVProc OffSt xchg ax,bx ; bx == explicit type constant LODSWTX ;fetch oNam/oElem from pcode jz D_Off ;brif descanning cmp [mkVar.MKVAR_oTyp],ET_MAX jbe Not_User_Defined ;[26] brif not user defined type cCall RefElem,<ax,bx> ;[36] SsRefreshES ;es = cur pcode seg (heap movement) or ax,ax js HandleError2 ;brif error return Off_Exit: STOSWTX ;emit the oElem/oNam (common exit point) RetToScan7: jmp RudeLoop ;return to the main loop D_Off: mov bx,dx ; get start of type table (bdVar) add bx,ax ;bx = pElem mov ax,[bx.ELEM_oNam] ;fetch oNam of the element jmp short Off_Exit ; emit the oNam/iCE and return ; to main loop Not_User_Defined: OffError_oTyp: mov al,MSG_BadElemRef ;in case this isn't of ; user defined type HandleError2: jmp HandleError ;descan up to this opcode, report error ;*** ;SsVProc AsType - handle opAsType and opAsTypeExp ;Purpose: ; Set the mkVar flag to note that an 'AS' clause has been ; seen, and set mkVar.oTyp to the appropriate type. ; op[A]IdVtRfImp dispatch points must check to see if ; the FVI_ASCLAUSE bit is set in mkVar.flags, and leave the ; oTyp alone if so (rather than loading it from the rule ; table index). ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ; ;***************************************************************************** SsVProc AsType ;Includes AsTypeExp jz D_AsType ;no descanning work here or [mkVar.MKVAR_flags],FVI_ASCLAUSE LODSWTX ;ax = 1st operand cmp cx,opAsType ;is this for opAsType? jnz AsTypeExp ; brif not - opAsTypeExp cCall RefTyp,<ax,di> SsRefreshES ; es = cur pcode seg (heap movement) or ah,ah ;an error return? jns AsType_Cont ; brif not HandleError6: jmp short HandleError2 AsTypeExp: cmp cx,opAsTypeExp jz AsType_Cont ;ax contains a pre-defined oTyp DbAssertRel cx,z,opAsTypeFixed,SCAN,<SsVProc AsType: unexpected opcode> xchg ax,dx LODSWTX ;ax contains cbFS or oNam of const ; or oNam of FORM/MENU or dh,dh ;length, or oNam? jns AsTypeFixed_Cont ; brif ax == length or [mkVar.MKVAR_flags2],MV_fONamInOTyp and dh,07FH ;mask to make this a normal oTyp AsTypeFixed_Cont: .errnz MKVAR_fsLength - MKVAR_oNamForm mov [mkVar.MKVAR_fsLength],ax xchg ax,dx AsType_Cont: ;have type in ax mov [mkVar.MKVAR_oTyp],ax inc si inc si ;Skip listing column jmp short RetToScan2 D_AsType: add si,4 ;skip to next pcode if descanning cmp cx,opAsTypeFixed jnz RetToScan2 ;brif only two-bytes to skip inc si inc si ;Skip listing column jmp short RetToScan2 ;*** ;SsVProc StDefTyp ;Purpose: ; Grab the 4-byte mask from the pcode; pass this to SetDefBits to ; reset the default type for specified alphabet letters. ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc StDefType jz D_DefType ;no descanning work here inc si ;skip link field - - point to inc si ; I4mask in pcode LODSWTX ;Pick up low word xchg ax,dx ;DX = Low word of mask LODSWTX ;AX:DX = I4mask push ax push dx and dl,FV_TYP_MASK ; mask out all but type constant push dx call SetDefBits ;set new type default(s) SsRefreshES ; es = cur pcode seg (heap movement) RetToScan2: jmp RudeLoop ;return to the main loop D_DefType: ;fall through to StStatic for return to descan loop ;*** ;SsVProc StCommon, StShared, StStatic, Shared ;Purpose: ; Set flags for later variable references. Each of these ; opcodes come before the associated Id opcodes, so these ; flags are simply set up, and left until BOS/BOL. ; ; To save code, don't bother to detect if we're scanning or ; descanning; just set the flags regardless. ; ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc StStatic or [mkVar.MKVAR_flags],FVI_STATIC RetToScanOps: jmp Operand_Skip_Ret ;skip operands and return to main loop SsVProc StCommon or [mkVar.MKVAR_flags],FVI_COMMON jmp short RetToScanOps SsVProc StShared SsVProc Shared or [mkVar.MKVAR_flags],FVI_SHARED jmp short RetToScanOps SsVProc StDim or [mkVar.MKVAR_flags],FVI_DIM jmp short RetToScanOps ;*** ;HandleProcName ;Purpose: ; Shared code for handling the procedure name in a ; DECLARE, FUNCTION, or DEF FN statement. Calls MakeVariable. ; ; NOTE: See qbipcode.txt for a description of the procAtr word in ; the pcode in order to better understand this routine. ;Input: ; es:[si+2] = oNam or oPrs for procedure ; If this is for a DEF FN, bits cl = PT_DEFFN, else cx = 0 ;Exit: ; Should not be called for a SUB definition. If called for DECLARE SUB, ; does nothing, only return value is bl = PT_SUB. ; Otherwise, ; no Prs is active (i.e. module level text tbl is active) ; mkVar.MKVAR_oTyp contains oTyp returned by MakeVariable ; bl contains the procType of the prs ; cx = oPrs of FUNCTION/DEF FN ;Preserves: ; SI,DI,ES ;Exceptions: ; This routine handles MakeVariable error return ;***************************************************************************** DbPub HandleProcName HandleProcName PROC NEAR mov ax,es:[si.DCL_atr] ;ax = procAtr operand and ah,DCLA_procType / 100h ;ah = procType (PT_SUB etc.) mov bl,PT_SUB ;put procType in bl in case of a SUB cmp ah,bl ;is this a SUB? DJMP jz HandleProc_Exit ; brif so - do nothing, exit HandleProcName_Cont: push [grs.GRS_oRsCur] ;save caller's oRs test al,DCLA_Explicit ;explicitly typed DEF or FUNCTION? jnz HandleProc_Type ; brif so mov al,ET_IMP ;proc was implicitly typed HandleProc_Type: and ax,DCLA_oTyp ;ax = oTyp returned by function mov [mkVar.MKVAR_oTyp],ax mov bx,es:[si.DCL_oPrs] ;fetch oPrs (or oNam) from pcode stream jcxz NotDefFn mov [oNamOfPrsCur],bx ;speed optimization - used by varmgr ; This is safe because varmgr only uses ; this when grs.oPrsCur != UNDEFINED push bx ;oNam of DEF FN push cx ;procType cmp al,ET_IMP ;implicitly typed DEF FN? jnz Not_Implicit ; brif not cCall oTypOfONamDefault,<bx> ; returns ax = default oTyp ; for this oNam Not_Implicit: push ax ;oTyp of DEF FN (could be ET_IMP) xor dx,dx push dx ;fNotDefine call PrsDefine SsRefreshES ;es = cur pcode seg (new txt tbl) or ax,ax jnz ProcNameError ;error in defining prs for DEF FN or [prsCur.PRS_flags],FP_DEFINED mov ax,si sub ax,4 ;ax == otx of opStDefFn mov [prsCur.PRS_otxDef],ax mov ax,[grs.GRS_oMrsCur] mov [prsCur.PRS_oRsDef],ax ;oRsDef is the module's oRS mov bx,[grs.GRS_oPrsCur] ;oPrs for DEF FN mov es:[si.DCL_oPrs],bx ;replace oNam in pcode with oPrs NotDefFn: push bx ; save oPrs across calls push bx ;pass oPrs to FieldsOfPrs below call PrsDeActivateFar ; make main level variable for ; DEF FN or FUNCTION cCall FieldsOfPrsFar ; get oNam in ax, procType in dl ; parm was already pushed above mov [mkVar.MKVAR_oNam],ax push dx ;save procType for retval cmp dl,PT_FUNCTION ;is this prs for a FUNCTION? jnz ProcFlagsSet ; brif not - - must be for a DEF FN or [mkVar.MKVAR_flags],FVI_FUNCTION ProcFlagsSet: call MakeVariableFar ;search for and create var if not found pop bx ;restore procType for retval pop cx ; restore oPrs or ah,ah ;an error return? js HandleProc_Error ; brif so DbAssertRel [mkVar.MKVAR_oTyp],nz,ET_IMP,SCAN,<HandleProcName:ET_IMP oTyp> pop dx ;discard caller's grs.oRsCur HandleProc_Exit: ret HandleProc_Error: TESTM mkVar.MKVAR_exitFlags,FVI_FNNAME ;Note: could use DX instead if ; MakeVariable in native code jnz ProcNameError ;brif an opStDefFn pcode inc si ;so si points 4-bytes past opcode inc si ; as expected by HandleError ProcNameError: pop dx ;dx = caller's grs.oRsCur push ax ;save error code cCall RsActivate,<dx> ; re-activate caller's oRs pop ax ;restore ax = error code HandleError1: jmp HandleError HandleProcName ENDP ;*** ;SsVProc StDefFn, StFunction, StSub ;Purpose: ; Handle the pcodes for SUB, FUNCTION, and DEF. ; ; For SUB, the proc name is ignored, and we share ; code with the others for handling each formal ; parameter (all given as operands to the opcode). ; ; For DEF, we must bypass the link field; otherwise, ; it is treated the same as FUNCTION (common code ; will set the FVI_FUNCTION flag as appropriate). ; ;Inputs: ; standard rude scan dispatch. ;Outputs: ; standard rude scan dispatch. ;***************************************************************************** SsVProc StDefFn pushf inc si ;move to 2-bytes prior to oPrs inc si ; DECLARE & FUNCTION have no 'link' cmp [grs.GRS_oPrsCur],UNDEFINED jne DefInDefErr ;brif found in another prs mov cl,PT_DEFFN ;tell HanldeProcName this is a DefFn popf jmp short Func_Or_Def DefInDefErr: mov ax,MSG_InvProc ;"Invalid within procedure" jmp SHORT HandleError1 SsVProc StFunction mov cx,0 ;'mov' doesn't affect flags Func_Or_Def: jz StProc_DeScan ;skip the following if descanning call HandleProcName ;calls MakeVariable for FUNCTION/DEF push bx ;save bl=procType cCall PrsActivate,<cx> ; make FUNCTION/DEF FN active pop bx ;restore bl=procType SsRefreshES ;es = cur pcode seg (new txt tbl) mov ax,es:[si.DCL_atr] ;ax = procAtr operand and ax,NOT DCLA_oTyp ;mask out existing oTyp mov dx,[mkVar.MKVAR_oTyp] ;get actual oTyp of DEF FN or FUNCTION DbAssertRel dx,be,ET_FS,SCAN,<SsV_StFunction: oTyp is invalid> or ax,dx ;set correct oTyp in pcode, for later mov es:[si.DCL_atr],ax ; checking by execute scanner and [prsCur.PRS_oType],NOT M_PT_OTYPE ; turn off existing oTyp bits or [prsCur.PRS_oType],dl ; ensure oType field set correctly in prs DJMP jmp SHORT StProc_Scan SsVProc StSub ;at this point, es:[si+2] is the proc oPrs; PSW.Z set if descanning mov bl,PT_SUB jz Not_A_DefFn ;brif descanning to SS_RUDE jmp StProc_Scan1 ;brif scanning to SS_PARSE StProc_DeScan: ;descanning: walk through parms, converting each oVar to an oNam ;first, reset prs.oVarHash and replace oPrs with oNam in pcode if this ; is a DEF FN jcxz Not_A_DefFn mov ax,es:[si.DCL_oPrs] ;get oPrs push dx ;save pVarTable cCall FieldsOfPrsFar,<ax> ;ax = oNam, dl = proctype DbAssertRelB dl,z,PT_DEFFN,SCAN,<rude descan: dl should == PT_DEFFN here> mov es:[si.DCL_oPrs],ax ;replace oPrs for DEF FN with oNam pop dx ;restore pVarTable Not_A_DefFn: xor bx,bx ;bx = zero indicates we have oVar's that ; must be converted to oNam's add si,DCL_cParms ;mov to parm count D_FormalParm_Descan: LODSWTX mov cx,ax ;cx = count of parm sets (3 words/set) inc ax ;no parms? (test for UNDEFINED) jz D_Formal_Exit ; exit if so - si points to next opcode jcxz D_Formal_Exit ;exit if parm count of zero D_FormalParm_Loop: mov di,si ;point to the oVar in pcode cmp [SsErrOTx],si jz RetToScan3 ;special case: if a scan error occured ; in this formal parm, the 'oNam' field ; will now contain opEot; just dispatch ; to it now if we've descanned to error LODSWTX ;fetch oVar (or oNam if DECLARE) or bx,bx ;are we descanning a DECLARE statment? jnz D_ONam_Okay ; brif so - - oNam field fine as is add ax,dx ; ax = pVariable xchg bx,ax mov ax,[bx].VAR_oNam ;ax = oNam for variable STOSWTX ;emit the oNam xor bx,bx ;bx == 0 ===> not descanning a DECLARE D_ONam_Okay: inc si ;move source pointer to inc si ; the oTyp field LODSWTX cmp ax,ET_MAX ;user-defined oTyp? jbe D_Formal_Cont ; brif not - - leave it alone push bx cCall ONamOTyp,<ax> ; ax = oNam for name of this type pop bx mov es:[si-2],ax ;replace oTyp with oNam of type in pcode D_Formal_Cont: loop D_FormalParm_Loop ;loop for each parm set D_Formal_Exit: or bx,bx ;descanning a DECLARE? jz RetToScan3 ; brif not mov si,bx ;skip past alias text in pcode RetToScan3: jmp RudeLoop ;return to the main loop OM_ProcError: mov al,ER_OM ;insufficient memory for var hash table dec si ;[si-4] = opStDefFn dec si jmp short HandleError3 StProcError: ;Found an error while scanning a formal parameter for a SUB, FUNCTION, ; or DEF. SI points past this formal parameter (that was itself ; unmodified). ;For StProcError, [si-4] = oNam. This will cause oNam of the formal ; to be temporarily replaced with opEot; wierd, but saves code. mov [fErrWithinOp],1 ;tell caller error was in operand HandleError3: jmp HandleError StProc_Scan: ;scan each formal parameter for the proc ;es:si points 2-bytes before the oPrs for FUNCTION/DEF statement ;bl = procType of proc cmp bl,PT_DEFFN ;are we scanning a DEF FN statement? jnz Not_Def_Fn ; brif not push bx call MakePrsTVar ;make variable hash table for DEF FN pop bx SsRefreshES ;es = cur pcode seg (heap movement) or ax,ax ;error return? mov al,ER_OM jz HandleError3 ; brif so Not_Def_Fn: ;At this point, we make a RetVal entry for the FUNCTION/DEF FN. ;This is so there is space in the variable table for this, even ;if not used, in case we determine at execute scan time that we ;have a RetVal where we thought we had a reference. Note that this ;logic depends on the fact that we always end up in SS_RUDE when a ;FUNCTION or DEF FN is added. ;Note that we assume that the oTyp and oNam are still valid in mkVar ;for this FUNCTION or DEF FN mov [mkVar.MKVAR_flags],FVI_LVAL push bx call MakeVariableFar ;search for and create var if not found pop bx ;Note that we don't use the return value, i.e., it doesn't go in the ;pcode - - - the goal is just to create the retval entry. SsRefreshES ;es = cur pcode seg (heap movement) or ah,ah ;an error return? jns StProc_Scan1 ; brif not cmp bl,PT_DEFFN jz HandleError3 ; si-4 points to opStDefFn inc si inc si DbAssertRelB bl,z,PT_FUNCTION,SCAN,<ssrude:opStFunction, invalid PT_ type> jmp HandleError3 ; si-4 points to opStFunction StProc_Scan1: ;SUB support joins up w/FUNCTION & ; DEF FN support here add si,6 ; point si past oPrs and procAttr .errnz DCL_oPrs - 2 ; operands LODSWTX ;get count of parameters .errnz DCL_cParms - 6 mov cx,ax ;cx = count of parm sets (3 words/set) jcxz RetToScan3 ;brif zero parms inc ax ;test for UNDEFINED ;special value indicating no parameters? jz RetToScan3 ; brif so or [mkVar.MKVAR_flags],FVI_FORMAL mov BYTE PTR [mkVar.MKVAR_cDimensions],0 ;set this to default for any array parms DbPub FormalParm_Loop FormalParm_Loop: mov di,si ;reset di to point to oNam of parm LODSWTX ;ax = oNam of parm mov [mkVar.MKVAR_oNam],ax LODSWTX ;ax = flags for parm mov dx,ax and ax,(FVI_ARRAY OR FVI_ASCLAUSE) or [mkVar.MKVAR_flags],ax .erre FVI_ARRAY AND PATR_array .erre FVI_ASCLAUSE AND PATR_asClause mov ax,ET_IMP TESTX dx,<PATR_asClause OR PATR_explicit> jz Set_Typ ;brif must set oTyp to default based on ; oNam mov ax,es:[si] ;oTyp or oNam DbAssertRel ax,nz,0,SCAN,<ssrude formal parm found with AS ANY oTyp> ;(AS ANY clause only valid for DECLARE statement) cmp ax,ET_MAX ;is this a predefined type? jbe Set_Typ ; brif so (CAN'T be fixed-length string) ;ax is the oNam of a user type push cx ;save count of formals across call cCall RefTyp,<ax,si> ;returns oTyp or error code pop cx or ah,ah ;an error return? jns Set_Typ ; brif no error StProcError1: jmp StProcError Set_Typ: mov [mkVar.MKVAR_oTyp],ax push cx ;preserve count of formals call MakeVariableFar ; create the parm entry pop cx SsRefreshES ;es = cur pcode seg (heap movement) or ah,ah ;was an error code returned? js StProcError1 ; brif so STOSWTX ;replace oNam with oVar mov ax,[mkVar.MKVAR_oTyp] mov es:[si],ax ;put oTyp of found/created var in pcode @@: inc si ;skip past oTyp field inc si DJMP loop FormalParm_Loop ;continue for each parameter and [mkVar.MKVAR_flags],NOT FVI_FORMAL ;turn off this flag for subsequent ; scanning RetToScan1: jmp RudeLoop ;return to the main loop ;*** ;SsVProc StDeclare ;Purpose: ; Call varmgr with FUNCTION name only - - we don't create variables ; for SUB's, and the parser guarantees that we'll never see a DECLARE ; for a DEF FN (invalid syntax). ; Note that the oVar returned by MakeVariable is discarded ; we need to call this to create var entry if it doesn't ; already exist. ; ; For each formal parameter, if oTyp not correctly set (based on flags ; in pcode), set it based on current def type. ; ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc StDeclare pushf LODSWTX ;ax = cntEos operand add ax,si ;ax points to next opcode popf jnz Scan_StDeclare ;brif scanning, not descanning ;descanning - - must convert each user-defined oTyp in formal parm ; list to an oNam, since the type table is gone when in SS_RUDE. ;share code with StSub/StDefFn/StFunction for this add si,DCL_cParms-2 ;point to count of formal parms xchg ax,bx ;tell shared code we there are no ; oVar's to convert to oNam's jmp D_FormalParm_Descan Scan_StDeclare: push ax ;save, so we can skip alias text @ end dec si dec si ;si points to cntEos operand xor cx,cx ;can't be a DEFFN call HandleProcName ;make the var if it's DECLARE FUNCTION SsRefreshES ;es = cur pcode seg (heap movement) cmp bl,PT_FUNCTION jnz StDeclare_Cont ;only change pCode for DECLARE FUNCTION mov ax,es:[si.DCL_atr] ;ax = procAtr operand and ax,NOT DCLA_oTyp ;mask out existing oTyp mov dx,[mkVar.MKVAR_oTyp] ; get actual oTyp of FUNCTION DbAssertRel dx,be,ET_FS,SCAN,<SsV_StDeclare: oTyp is invalid> or ax,dx ; set correct oTyp in pcode for later mov es:[si.DCL_atr],ax ; checking by execute scanner xchg ax,cx ; ax = oPrs (from HanldeProcName) call PPrsOPrsSCAN ; bx = pPrs and PTRRS[bx.PRS_oType],NOT M_PT_OTYPE ; turn off existing oTyp bits or BPTRRS[bx.PRS_oType],dl ; ensure oTyp field set correctly in prs StDeclare_Cont: add si,DCL_cParms ;point to count of formal parms LODSWTX ;ax = cParms operand mov cx,ax ;cx = count of parms in pcode inc ax ;no parms? (test for UNDEFINED) jz StDeclare_Exit ; exit if so - si points to next opcode jcxz StDeclare_Exit ;brif no formals to scan Declare_Formal_Loop: ;loop for each formal parm in DECLARE pcode, setting the oTyp to ; the appropriate default if required LODSWTX ;ax = oNam of parameter xchg ax,dx LODSWTX ;ax = flags, si points to oTyp field push cx ;preserve count of formals TESTX ax,<PATR_asClause OR PATR_explicit> jz Formal_Type_Def_Set ;brif must set oTyp to default based on ; oNam mov ax,es:[si] ;oTyp or oNam cmp ax,ET_MAX ;is this a predefined type? jbe Formal_Type_Set ; brif so (CAN'T be fixed-length string) ;ax is the oNam of a user type cCall RefTyp,<ax,si> ;returns oTyp or error code SsRefreshES ; es = cur pcode seg (heap movement) or ah,ah ;an error return? jns Set_Formal_Typ ; brif not mov [fErrWithinOp],1 ;tell caller error was in operand HandleError4: jmp HandleError Formal_Type_Def_Set: cCall oTypOfONamDefault,<dx> ; default oTyp for given oNam SsRefreshES ; es = cur pcode seg (heap movement) Set_Formal_Typ: mov es:[si],ax ;put default oTyp in pcode Formal_Type_Set: pop cx ;restore count of formals inc si ;skip past this formal inc si loop Declare_Formal_Loop ;brif another formal to scan StDeclare_Exit: pop si ;pointer to next pcode RetToScan4: jmp RetToScan1 ;*** ;SsVProc StEndDef ;Purpose: ; This dispatch point is required for END DEF ; to deactivate the current prs. Keeping prsCur correct during ; rude scanning is important so that variable search & creation ; is performed correctly. ; ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc EndSingleDef SsVProc StEndDef jz Operand_Skip_Ret ;do nothing in descan case mov [oNamOfPrsCur],UNDEFINED ; reset to default - just in case push cx ;save opcode for operand skipping cCall PrsDeActivateFar pop cx jmp short Operand_Skip_Ret ;*** ;SsVProc StType ;Purpose: ; Rude scan an entire TYPE/END TYPE block ;Exit: ; si points to 1st opcode after opStEndType ; ;***************************************************************************** SsVProc StType jz Operand_Skip_Ret ;brif descanning to SS_RUDE push si ;in case of error return call ScanTypeBlock pop cx ;previous (pushed) oTx SsRefreshES ;es = cur pcode seg (heap movement) or ax,ax je RetToScan4 ;brif no error inc cx inc cx ;cx points 4-bytes past opStType xchg cx,si ;si for descanning up to opStType push cx ;oTx of where error really occured mov di,UNDEFINED ;signal special case to HandleError jmp SHORT HandleError4 ;descan up to this opcode, report error ;*** ;SsVProc StEndType ;Purpose: ; Report "END TYPE without TYPE error, since all balanced opStEndType ; opcodes are consumed by ScanTypeBlock. ; ;***************************************************************************** SsVProc StEndType jz Operand_Skip_Ret ;brif descanning to SS_RUDE inc si ;bump si by 2 for HandleError inc si mov al,MSG_NoType ;give "END TYPE without TYPE error" jmp SHORT HandleError4 ;*** ;SsVProc StConst ;Purpose: ; ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc StConst mov [otxConstCur],si ;remember we're scanning a CONSTant stmt ; and save current text pointer jmp short RetToScan4 ;*** ;SsVProc For, Next, NextId ;Purpose: ; ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc For SsVProc Next SsVProc NextId mov word ptr es:[si],UNDEFINED ;replace oBP with UNDEFINED, ; so it will be so reset by the time ; the scanner sees it again (i.e., ; in case we are descanning or have ; descanned from SS_PARSE to SS_RUDE) jmp short Operand_Skip_Ret ;*** ;SsVProc Bos,Bol,BolLabDef ;Purpose: ; At the start of each statement, reset mkVar.flags to ; all zeroes (default bit-flag values). This is necessary, ; since some flags (such as STATIC, COMMON) must stay in ; effect for the duration of a statement. ; ;Input: ; standard rude scan dispatch. ;Output: ; standard rude scan dispatch. ;***************************************************************************** SsVProc Bol SsVProc BolEmit SsVProc BolLabDef mov ax,[SsLineCount] inc ax mov [SsLineCount],ax test al,LineUpdate-1 ;Time to update line count on screen? jz UpdateLine ;brif so SsVProc Bos Bos: sub ax,ax mov [mkVar.MKVAR_flags],ax mov [otxConstCur],ax ;in case we were scanning a CONST stmt Operand_Skip_Ret: mov bx,cx ;put opcode into bx mov cl,mpOpAtr.[bx] ;load attribute byte jmp Ssv_NOps ;skip past operands, return to loop UpdateLine: cmp [TargetState],SS_RUDE ;Are we descanning? jz Bos ; brif so - no line count push cx PUSH_ES push dx cCall UpdStatusLn,<ax> pop dx POP_ES pop cx jmp short Bos sEnd SCAN end
31.531637
78
0.705782
45e6c5bfdc1149bff62cfdc25ec36bcb08f68d74
245
asm
Assembly
data/mapHeaders/SilphCo1F.asm
AmateurPanda92/pokemon-rby-dx
f7ba1cc50b22d93ed176571e074a52d73360da93
[ "MIT" ]
9
2020-07-12T19:44:21.000Z
2022-03-03T23:32:40.000Z
data/mapHeaders/SilphCo1F.asm
JStar-debug2020/pokemon-rby-dx
c2fdd8145d96683addbd8d9075f946a68d1527a1
[ "MIT" ]
7
2020-07-16T10:48:52.000Z
2021-01-28T18:32:02.000Z
data/mapHeaders/SilphCo1F.asm
JStar-debug2020/pokemon-rby-dx
c2fdd8145d96683addbd8d9075f946a68d1527a1
[ "MIT" ]
2
2021-03-28T18:33:43.000Z
2021-05-06T13:12:09.000Z
SilphCo1F_h: db FACILITY ; tileset db SILPH_CO_1F_HEIGHT, SILPH_CO_1F_WIDTH ; dimensions (y, x) dw SilphCo1F_Blocks ; blocks dw SilphCo1F_TextPointers ; texts dw SilphCo1F_Script ; scripts db 0 ; connections dw SilphCo1F_Object ; objects
27.222222
61
0.791837
d896de26afdfe47b6cc97714d8603ab449f602d1
146
asm
Assembly
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/c-select.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/c-select.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/c-select.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
Name: c-select.asm Type: file Size: 34206 Last-Modified: '1992-06-29T15:00:00Z' SHA-1: 7CC52BC3E454D511A67486203A46813A9A190A40 Description: null
20.857143
47
0.808219
68e953daec4b339eaafad29878c3ec3b6d2defc3
470
asm
Assembly
u7bg/initializeDsegBytes.asm
ptrie/UltimaHacks
2c3557a86d94ad8b54b26bc395b9aed1604f8be1
[ "MIT" ]
1
2021-09-21T02:14:41.000Z
2021-09-21T02:14:41.000Z
u7bg/initializeDsegBytes.asm
ptrie/UltimaHacks
2c3557a86d94ad8b54b26bc395b9aed1604f8be1
[ "MIT" ]
null
null
null
u7bg/initializeDsegBytes.asm
ptrie/UltimaHacks
2c3557a86d94ad8b54b26bc395b9aed1604f8be1
[ "MIT" ]
null
null
null
%include "include/u7bg-all-includes.asm" %macro gameSpecificInitializations 0 startBlockAt seg_dseg, dseg_prevFrameTime dd 0 endBlock startBlockAt seg_dseg, dseg_frameLimiterAdjust dw 6 endBlock startBlockAt seg_dseg, dseg_frameLimiterAdjustString db 'Delay? current=--', 0 endBlockOfLength 18 startBlockAt seg_dseg, dseg_frameLimiterAdjustStringFormat db '%02d', 0 endBlockOfLength 5 %endmacro %include "../u7-common/patch-initializeDsegBytes.asm"
21.363636
59
0.804255
3a181de7c1beea4a491eafdd667ef802c758703f
369
asm
Assembly
oeis/075/A075924.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/075/A075924.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/075/A075924.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A075924: Fifth column of triangle A075502. ; Submitted by Christian Krause ; 1,105,6860,360150,16689351,714717675,29027537770,1135995214200,43285014073301,1617172212901245,59536438207963080,2167526889938878650,78241359077417918851,2805721220626405336815,100098458195602131838790 mov $2,7 pow $2,$0 seq $0,481 ; Stirling numbers of the second kind, S(n,5). mul $0,$2
41
203
0.821138
cff34fb326fd6885fd6b2d5dc5cb9a4279406a3f
449
asm
Assembly
programs/oeis/298/A298271.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
null
null
null
programs/oeis/298/A298271.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
null
null
null
programs/oeis/298/A298271.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
null
null
null
; A298271: Expansion of x/((1 - x)*(1 - 322*x + x^2)). ; 0,1,323,104006,33489610,10783550415,3472269744021,1118060074024348,360011871566096036,115922704584208899245,37326750864243699460855,12019097855581887017496066,3870112182746503375934272398,1246164103746518505163818216091,401260971294196212159373531308905,129204786592627433796813113263251320 mov $2,$0 seq $2,119032 ; a(n+2)=18a(n+1)-a(n)+8. add $1,$2 mul $1,$2 add $1,$2 div $1,90 mov $0,$1
40.818182
292
0.790646
37793c8a53bdf446d8889181753a49e426abcc98
309
asm
Assembly
ejemp1.asm
alfreedom/Z80-ASM-Programs
29526e14c35e10d86554d24340c81be0918ab98a
[ "MIT" ]
null
null
null
ejemp1.asm
alfreedom/Z80-ASM-Programs
29526e14c35e10d86554d24340c81be0918ab98a
[ "MIT" ]
null
null
null
ejemp1.asm
alfreedom/Z80-ASM-Programs
29526e14c35e10d86554d24340c81be0918ab98a
[ "MIT" ]
null
null
null
X .EQU 0FEFEH LD A,0 LD B,A LD A,1 LD C,A LD A,5 LD D,A LD A,0 LD E,A TEST: LD A,B INC A LD (HL),C CP (HL) JP Z,FIN CALL CALCUL INC (HL) JP TEST JP FIN CALCUL: LD A,(R) ADD A,(X) LD (R),A LD A,(X) ADD A,(X) LD (X),A RET FIN: .END
9.967742
15
0.440129
5376d39637e81ef1fef2832657ddfe3afc1e799a
466
asm
Assembly
programs/oeis/127/A127241.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/127/A127241.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/127/A127241.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A127241: A Thue-Morse triangle. ; 1,0,1,0,1,1,0,0,1,1,0,0,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,1 seq $0,26729 ; Square array of binomial coefficients T(n,k) = binomial(n,k), n >= 0, k >= 0, read by antidiagonals. seq $0,10060 ; Thue-Morse sequence: let A_k denote the first 2^k terms; then A_0 = 0 and for k >= 0, A_{k+1} = A_k B_k, where B_k is obtained from A_k by interchanging 0's and 1's.
77.666667
180
0.633047
e1966e58092aa15e763f588034575fd78a5a0470
5,409
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_1685_128.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_1685_128.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_1685_128.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 %r13 push %r14 push %r9 push %rbp push %rdx lea addresses_normal_ht+0xeb6b, %r9 nop xor $50804, %r13 mov $0x6162636465666768, %r14 movq %r14, %xmm0 and $0xffffffffffffffc0, %r9 vmovntdq %ymm0, (%r9) sub $54247, %r11 lea addresses_UC_ht+0x89c7, %rdx nop nop sub %r13, %r13 movl $0x61626364, (%rdx) nop nop nop nop add %r14, %r14 lea addresses_A_ht+0xd8c7, %rbp nop and $16503, %r9 movl $0x61626364, (%rbp) nop nop cmp %r13, %r13 pop %rdx pop %rbp pop %r9 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %rbp push %rcx push %rdi push %rsi // Store lea addresses_normal+0x110fb, %rdi nop nop nop add $287, %rbp mov $0x5152535455565758, %r11 movq %r11, (%rdi) sub %r11, %r11 // REPMOV lea addresses_A+0x1191e, %rsi lea addresses_normal+0x14787, %rdi nop nop nop nop dec %r12 mov $58, %rcx rep movsb nop nop nop nop and $54267, %r11 // Store lea addresses_WT+0x11dea, %r12 nop nop nop xor %rcx, %rcx movl $0x51525354, (%r12) nop nop nop nop nop xor $1317, %rsi // Faulty Load lea addresses_WC+0x118c7, %rdi nop nop nop nop and $10804, %r11 mov (%rdi), %r12 lea oracles, %rsi and $0xff, %r12 shlq $12, %r12 mov (%rsi,%r12,1), %r12 pop %rsi pop %rdi pop %rcx pop %rbp pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'00': 1685} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
41.930233
2,999
0.660011
cb42d01a8a999402a9ab8b8cc929e47fae977939
436
asm
Assembly
oeis/308/A308185.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/308/A308185.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/308/A308185.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A308185: Fixed point (beginning with a) of the morphism a -> abab, b -> b, over the alphabet {a,b} = {0,1}. ; Submitted by Christian Krause ; 0,1,0,1,1,0,1,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,0,1,0,1,1,0,1,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,0,1,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,0,1,0,1,1,0,1,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,0,1,0,1,1 add $0,1 seq $0,288932 ; Fixed point of the mapping 00->1000, 10->10101, starting with 00.
62.285714
201
0.59633
e92b40f2e4aead7197707a35a656d2e002f7758f
1,510
asm
Assembly
setup.asm
RevolutionSoftware/Juego
31c1706e41713e9bcf631f369b89ce1f94bef0d5
[ "Unlicense" ]
1
2021-09-18T21:02:45.000Z
2021-09-18T21:02:45.000Z
setup.asm
RevolutionSoftware/Juego
31c1706e41713e9bcf631f369b89ce1f94bef0d5
[ "Unlicense" ]
null
null
null
setup.asm
RevolutionSoftware/Juego
31c1706e41713e9bcf631f369b89ce1f94bef0d5
[ "Unlicense" ]
null
null
null
di ld hl,12000 bcall(_EnoughMem) jr nc,$+5 bjump(_JForceCmdNoChar) ;chau! ex de,hl ;hl = RAM to insert ld de,$9D95 bcall(_InsertMem) ld h,d ld l,e inc de ld (hl),0 ld bc,11999 ldir ld hl,salirDelPrograma push hl ;el último ret nos mandará a salirDelPrograma ;cargar rutinas en RAM ld hl,copy_to_ram ld de,ramRoutines ld bc,copy_to_ram_end-copy_to_ram_start ldir ;vaciar inventorio ld hl,playerInventory ld (hl),$FF ld de,playerInventory+1 ld bc,184 ldir ld hl,playerInventory ld a,8 ld (hl),a ;4 items inc hl ld (hl),0 inc hl ld (hl),99 inc hl ld (hl),1 inc hl ld (hl),4 inc hl ld (hl),2 inc hl ld (hl),40 inc hl ld (hl),3 inc hl ld (hl),50 inc hl ld (hl),4 inc hl ld (hl),5 inc hl ld (hl),5 inc hl ld (hl),7 inc hl ld (hl),6 inc hl ld (hl),19 inc hl ld (hl),7 inc hl ld (hl),2 ld a,$3 ld (playerGold),a ld hl,$FF70 ld (playerGold+1),hl ;playerGold = $3FFFF ;default values xor a ld b,6 ld hl,bigNumberString ld (hl),a inc hl djnz $-2 ld (hl),a ;0 terminate the string ld (playerDir),a ;default stats xor a call loadPlayer ;load player ID 0 (franci) xor a ld hl,playerAnimation ld (hl),a ld hl,mapOverDraw ;variable to know which pass through the mapper we're at (si hay que dibujar el suelo o las mascaras) ld (hl),1 ld hl,animationCounter ld (hl),32 inc hl ;animation frame ld (hl),a ;frame 0 ld (secondPulsado),a ld a,MAP_START ld de,(PLAY_Y_START*256)+PLAY_X_START call changeMap
13.482143
120
0.662914
430297a298a2cae8774b80f65810046cf2378c0f
652
asm
Assembly
oeis/083/A083296.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/083/A083296.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/083/A083296.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A083296: a(n) = (4*3^n + (-7)^n)/5. ; Submitted by Jon Maiga ; 1,1,17,-47,545,-3167,24113,-162959,1158209,-8054975,56542289,-395323631,2768682593,-19376526623,135648440945,-949500822863,6646620551297,-46525999485311,325683029518481,-2279778107265455,15958456048949921,-111709164448374239,781964234821445297,-5473749392701640207,38316246502056912065,-268213723254962092607,1877496069563043523793,-13142472466606378039919,91997307327249426159329,-643981151107731643475615,4507868058303164523248369,-31555076406475022605981391,220885534850266545412141313 mov $1,-7 pow $1,$0 add $1,12 mov $2,3 pow $2,$0 mov $0,$1 mul $2,4 add $0,$2 sub $0,12 div $0,5
43.466667
490
0.808282
bc392661400a2ea390e585f064d037b5d7756acf
148
asm
Assembly
manuscript/cs/ch01-helloWorld-370.asm
jasoncable/i-can-program-too
3408c6189cb3e90e92c5337a281d16e0add335f2
[ "CC0-1.0" ]
3
2019-04-20T01:12:19.000Z
2022-01-08T21:46:05.000Z
manuscript/cs/ch01-helloWorld-370.asm
jasoncable/i-can-program-too
3408c6189cb3e90e92c5337a281d16e0add335f2
[ "CC0-1.0" ]
1
2019-02-18T10:46:24.000Z
2019-02-19T13:36:28.000Z
manuscript/cs/ch01-helloWorld-370.asm
jasoncable/i-can-program-too
3408c6189cb3e90e92c5337a281d16e0add335f2
[ "CC0-1.0" ]
1
2019-01-04T01:46:44.000Z
2019-01-04T01:46:44.000Z
TITLE 'Hello World for IBM Assembler/370 (VM/CMS)' HELLO START BALR 12,0 USING *,12 * WRTERM 'Hello World!' * SR 15,15 BR 14 * END HELLO
13.454545
50
0.648649
55f180ede09defdc1d0b52916256ce76eb59e1a7
450
asm
Assembly
Irvine/Examples/ch08/32 bit/Read_File.asm
alieonsido/ASM_TESTING
4d5e2a3e11d921eeb50d69bbe4352cfc0e99afa7
[ "Apache-2.0" ]
null
null
null
Irvine/Examples/ch08/32 bit/Read_File.asm
alieonsido/ASM_TESTING
4d5e2a3e11d921eeb50d69bbe4352cfc0e99afa7
[ "Apache-2.0" ]
null
null
null
Irvine/Examples/ch08/32 bit/Read_File.asm
alieonsido/ASM_TESTING
4d5e2a3e11d921eeb50d69bbe4352cfc0e99afa7
[ "Apache-2.0" ]
null
null
null
; Read_File procedure (Read_File.asm) ; Demonstrates MASM-generated code. ; View the generated code in the Disassembly window ; when running in Debug mode. INCLUDE Irvine32.inc .data buffer BYTE 4096 DUP(0) .code main PROC push offset buffer call Read_File exit main ENDP Read_File PROC USES eax ebx, pBuffer:PTR BYTE LOCAL fileHandle:DWORD mov esi,pBuffer mov fileHandle,eax pop ebx pop eax leave ret 4 Read_File ENDP END main
14.516129
52
0.762222
8c8103a33cb0137a4082b82c1a5184b9d2ce6ed2
646
asm
Assembly
examples/direct/test_li_float.asm
hughperkins/toy_proc
501caddd100e5245658008bb42f17ef8e97d4192
[ "MIT" ]
4
2022-03-22T06:58:06.000Z
2022-03-25T12:35:06.000Z
examples/direct/test_li_float.asm
hughperkins/toy_proc
501caddd100e5245658008bb42f17ef8e97d4192
[ "MIT" ]
null
null
null
examples/direct/test_li_float.asm
hughperkins/toy_proc
501caddd100e5245658008bb42f17ef8e97d4192
[ "MIT" ]
1
2022-03-25T01:06:32.000Z
2022-03-25T01:06:32.000Z
# first make sure li is working correctly, then check li on floats li x1, 123 outr x1 li x1, 2000 outr x1 addi x1, x0, 1000 outr x1 # this will produce a very postive output, since we are printing unsigned addi x1, x0, -1000 outr x1 addi x1, x0, 2000 outr x1 # this will produce a very postive output, since we are printing unsigned addi x1, x0, -2000 outr x1 # int(math.pow(2,24)) + 123 : li x1, 16777339 outr x1 li x1, 12345678 outr x1 li x1, 123456789 outr x1 li x1, 1234567891 outr x1 li x1, 2345678912 outr x1 li x1, 3456789123 outr x1 li x1, -2.5 outr.s x1 li x1, 1.23 outr.s x1 li x1 123.456 outr.s x1 li x1 0.000123456 outr.s x1 halt
15.380952
73
0.726006
d4590801b2bc689107af1667b9515b49c23c0eeb
2,889
asm
Assembly
maps/IcePathB1F.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
28
2019-11-08T07:19:00.000Z
2021-12-20T10:17:54.000Z
maps/IcePathB1F.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
13
2020-01-11T17:00:40.000Z
2021-09-14T01:27:38.000Z
maps/IcePathB1F.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
22
2020-05-28T17:31:38.000Z
2022-03-07T20:49:35.000Z
object_const_def ; object_event constants const ICEPATHB1F_BOULDER1 const ICEPATHB1F_BOULDER2 const ICEPATHB1F_BOULDER3 const ICEPATHB1F_BOULDER4 const ICEPATHB1F_POKE_BALL IcePathB1F_MapScripts: db 0 ; scene scripts db 1 ; callbacks callback MAPCALLBACK_CMDQUEUE, .SetUpStoneTable .SetUpStoneTable: writecmdqueue .CommandQueue return .CommandQueue: cmdqueue CMDQUEUE_STONETABLE, .StoneTable ; check if any stones are sitting on a warp .StoneTable: stonetable 3, ICEPATHB1F_BOULDER1, .Boulder1 stonetable 4, ICEPATHB1F_BOULDER2, .Boulder2 stonetable 5, ICEPATHB1F_BOULDER3, .Boulder3 stonetable 6, ICEPATHB1F_BOULDER4, .Boulder4 db -1 ; end .Boulder1: disappear ICEPATHB1F_BOULDER1 clearevent EVENT_BOULDER_IN_ICE_PATH_1A sjump .FinishBoulder .Boulder2: disappear ICEPATHB1F_BOULDER2 clearevent EVENT_BOULDER_IN_ICE_PATH_2A sjump .FinishBoulder .Boulder3: disappear ICEPATHB1F_BOULDER3 clearevent EVENT_BOULDER_IN_ICE_PATH_3A sjump .FinishBoulder .Boulder4: disappear ICEPATHB1F_BOULDER4 clearevent EVENT_BOULDER_IN_ICE_PATH_4A sjump .FinishBoulder .FinishBoulder: pause 30 scall .BoulderFallsThrough opentext writetext IcePathBoulderFellThroughText waitbutton closetext end .BoulderFallsThrough: playsound SFX_STRENGTH earthquake 80 end IcePathB1FBoulder: jumpstd strengthboulder IcePathB1FIron: itemball IRON IcePathB1FHiddenMaxPotion: hiddenitem MAX_POTION, EVENT_ICE_PATH_B1F_HIDDEN_MAX_POTION IcePathBoulderFellThroughText: text "The boulder fell" line "through." done IcePathB1F_MapEvents: db 0, 0 ; filler db 8 ; warp events warp_event 3, 15, ICE_PATH_1F, 3 warp_event 17, 3, ICE_PATH_B2F_MAHOGANY_SIDE, 1 warp_event 11, 2, ICE_PATH_B2F_MAHOGANY_SIDE, 3 ; hole warp_event 4, 7, ICE_PATH_B2F_MAHOGANY_SIDE, 4 ; hole warp_event 5, 12, ICE_PATH_B2F_MAHOGANY_SIDE, 5 ; hole warp_event 12, 13, ICE_PATH_B2F_MAHOGANY_SIDE, 6 ; hole warp_event 5, 25, ICE_PATH_1F, 4 warp_event 11, 27, ICE_PATH_B2F_BLACKTHORN_SIDE, 1 db 0 ; coord events db 1 ; bg events bg_event 17, 30, BGEVENT_ITEM, IcePathB1FHiddenMaxPotion db 5 ; object events object_event 11, 7, SPRITE_BOULDER, SPRITEMOVEDATA_STRENGTH_BOULDER, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, IcePathB1FBoulder, EVENT_BOULDER_IN_ICE_PATH_1 object_event 7, 8, SPRITE_BOULDER, SPRITEMOVEDATA_STRENGTH_BOULDER, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, IcePathB1FBoulder, EVENT_BOULDER_IN_ICE_PATH_2 object_event 8, 9, SPRITE_BOULDER, SPRITEMOVEDATA_STRENGTH_BOULDER, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, IcePathB1FBoulder, EVENT_BOULDER_IN_ICE_PATH_3 object_event 17, 7, SPRITE_BOULDER, SPRITEMOVEDATA_STRENGTH_BOULDER, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, IcePathB1FBoulder, EVENT_BOULDER_IN_ICE_PATH_4 object_event 5, 35, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, IcePathB1FIron, EVENT_ICE_PATH_B1F_IRON
28.89
156
0.812738
608cbf05bfa81d221cf06d2457e85ac9142b49a1
175
asm
Assembly
src/data/index.asm
jonasbantunes/tictactoe-gb
21838bf92219a923cc1c1be8bc078b8adeab144a
[ "MIT" ]
null
null
null
src/data/index.asm
jonasbantunes/tictactoe-gb
21838bf92219a923cc1c1be8bc078b8adeab144a
[ "MIT" ]
null
null
null
src/data/index.asm
jonasbantunes/tictactoe-gb
21838bf92219a923cc1c1be8bc078b8adeab144a
[ "MIT" ]
null
null
null
SECTION "Constants", ROM0 INCLUDE "src/data/dialogs.asm" INCLUDE "src/data/font.asm" INCLUDE "src/data/grid.asm" INCLUDE "src/data/scoreboard.asm" INCLUDE "src/data/wram.asm"
25
33
0.765714
ba0d186d05849d49e5233b5d9ed0d07acffa17f4
316
asm
Assembly
libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/vfprintf_unlocked.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/vfprintf_unlocked.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/vfprintf_unlocked.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; int vfprintf_unlocked(FILE *stream, const char *format, void *arg) SECTION code_clib SECTION code_stdio PUBLIC _vfprintf_unlocked EXTERN l0_vfprintf_unlocked_callee _vfprintf_unlocked: pop af pop hl pop de pop bc push bc push de push hl push af jp l0_vfprintf_unlocked_callee
13.166667
68
0.737342
6057ad5fd1ee59af761b81cf32b18f59eb7de6c6
381
asm
Assembly
oeis/344/A344215.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/344/A344215.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/344/A344215.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A344215: a(n) = n*(3^(n-1) - 2^(n-1)). ; 0,0,2,15,76,325,1266,4655,16472,56745,191710,638275,2101188,6855485,22205834,71498775,229058224,730680145,2322163638,7356008555,23234743580,73200452325,230081633122,721667902015,2259234965256,7060318981625,22028631430286,68628565425555,213512971483252 mov $2,$0 sub $0,1 lpb $0 sub $0,1 mul $1,3 add $1,$2 mul $2,2 lpe mov $0,$1
29.307692
253
0.737533
588aba0855750922359d7eb1f772dfb865783d71
629
asm
Assembly
oeis/004/A004695.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/004/A004695.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/004/A004695.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A004695: a(n) = floor(Fibonacci(n)/2). ; 0,0,0,1,1,2,4,6,10,17,27,44,72,116,188,305,493,798,1292,2090,3382,5473,8855,14328,23184,37512,60696,98209,158905,257114,416020,673134,1089154,1762289,2851443,4613732,7465176,12078908,19544084,31622993,51167077,82790070,133957148,216747218,350704366,567451585,918155951,1485607536,2403763488,3889371024,6293134512,10182505537,16475640049,26658145586,43133785636,69791931222,112925716858,182717648081,295643364939,478361013020,774004377960,1252365390980,2026369768940,3278735159921,5305104928861 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. div $0,2
104.833333
495
0.798092
37a5637cb30fff03408ce8b68cfc4eeaa1e3c68b
6,571
asm
Assembly
sem_01/lab_02/part1/rudakov1997_61.1.asm
Justarone/bmstu-os
db5382bbf5683d7900a19ff38516c62edd3b860f
[ "MIT" ]
5
2021-09-23T09:43:25.000Z
2021-12-22T18:52:56.000Z
sem_01/lab_02/part1/rudakov1997_61.1.asm
Justarone/bmstu-os
db5382bbf5683d7900a19ff38516c62edd3b860f
[ "MIT" ]
null
null
null
sem_01/lab_02/part1/rudakov1997_61.1.asm
Justarone/bmstu-os
db5382bbf5683d7900a19ff38516c62edd3b860f
[ "MIT" ]
2
2021-12-21T08:42:21.000Z
2022-03-19T08:53:22.000Z
; В защищённом режиме вывод фиксированных символов на экран .386P ; (1) Разрешение трансляции всех, в том ; числе привилегированных команд МП 386 ; и 486 ; Структура для описания дескрипторов сегментов descr struc ; (2) limit dw 0 ; (3) Граница (биты 0...15) base_l dw 0 ; (4) База, биты 0...15 base_m db 0 ; (5) База, биты 16...23 attr_1 db 0 ; (6) Байт атрибутов 1 attr_2 db 0 ; (7) Граница (биты 16...19) и атрибуты 2 base_h db 0 ; (8) База, биты 24...31 descr ends ; (9) data segment use16 ; (10) Начало сегмента данных // в книге без use16 ; Таблица глобальных дескрипторов GDT gdt_null descr<0,0,0,0,0,0> ; (11) Селектор 0 — обязательный ; нулевой дескриптор gdt_data descr<data_size-1,0,0,92h,0,0> ; (12) Селектор 8, сегмент данных gdt_code descr<code_size-1,0,0,98h,0,0> ; (13) Селектор 16, сегмент команд gdt_stack descr<255,0,0,92h,0,0> ; (14) Селектор 24, сегмент стека gdt_screen descr<4095,8000h,0Bh,92h,0,0>; (15) Селектор 32, видеобуфер gdt_size=$-gdt_null ; (16) Размер GDT ; Поля данных программы pdescr df 0 ; (17) Псевдодескриптор для lgdt // в книге dq real_sp dw 0 ; (18) Ячейка для хранения SP sym db 1 ; (19) Символ для вывода на экран attr db 1Eh ; (20) Его атрибут mes db 27,'[31;42m Вернулись в реальный режим! ',27,'[0m$'; (21) data_size=$-gdt_null ; (22) Размер сегмента данных data ends ; (23) Конец сегмента данных text segment 'code' use16 ; (24) Начало сегмента команд. Будем ; работать в 16-разрядном режиме assume cs:text,ds:data ; (25) main proc ; (26) mov ax,data ; (27) Инициализация реального mov ds,ax ; (28) режима ; Вычислим 32-битовый линейный адрес сегмента данных и загрузим его ; в дескриптор сегмента данных в таблице GDT. В регистре AX уже ; находится сегментный адрес. Умножим его на 16 сдвигом влево на 4 ; биты с размещением результата в регистрах DL:AX mov dl,0 ; (29) shld dx,ax,4 ; (30) Сдвинем биты 12...15 AX в DL shl ax,4 ; (31) Сдвинем влево AX на 4 бита ; Теперь в DL:AX 32-битовый линейный адрес сегмента данных mov bx,offset gdt_data; (32) В BX адрес дескриптора mov [bx].base_l,ax ; (33) Загрузим младшую часть базы mov [bx].base_m,dl ; (34) Загрузим среднюю часть базы ; Вычислим 32-битовый линейный адрес сегмента команд и загрузим его ; в дескриптор сегмента команд в таблице глобальных дескрипторов mov ax,cs ; (35) AX=адрес сегмента команд mov dl,0 ; (36) Та же процедура умножения shld dx,ax,4 ; (37) сегментного адреса на 16 shl ax,4 ; (38) сдвигом влево на 4 бита mov bx,offset gdt_code; (39) BX=адрес дескриптора mov [bx].base_l,ax ; (40) Загрузка младшей mov [bx].base_m,dl ; (41) и средней частей базы ; Аналогично для адреса сегмента стека mov ax,ss ; (42) mov dl,0 ; (43) Та же процедура умножения shld dx,ax,4 ; (44) сегментного адреса на 16 shl ax,4 ; (45) сдвигом влево на 4 бита mov bx,offset gdt_stack; (46) BX=адрес дескриптора mov [bx].base_l,ax ; (47) Загрузка младшей mov [bx].base_m,dl ; (48) и средней частей базы ; Подготовим псевдодескриптор pdescr загрузим регистр GDTR mov bx,offset gdt_data ; (49) Адрес GDT mov ax,[bx].base_l ; (50) Получим и занесём в pdescr mov word ptr pdescr+2,ax ; (51) базу, биты 0...15 mov dl,[bx].base_m ; (52) Получим и занесём в pdescr mov byte ptr pdescr+4,dl ; (53) базу, биты 16...23 mov word ptr pdescr,gdt_size-1; (54) Граница GDT lgdt pdescr ; (55) Загрузим регистр GDTR ; Подготовимся к возврату из защищённого режима в реальный mov ax,40h ; (56) Настроим ES на область mov es,ax ; (57) данных BIOS mov word ptr es:[67h],offset return; (58) смещение точки возврата mov es:[69h],cs ; (59) Сегмент точки возврата ; Подготовимся к переходу в защищённый режим cli ; (60) Запрет аппаратных прерываний mov al,8Fh ; (61) Запрет NMI (80h) и выборка ; байта состояния отключения 0Fh out 70h,al ; (62) Порт КМОП-микросхем jmp $+2 ; (63) Задержка mov al,0Ah ; (64) Установим режим восстановления out 71h,al ; (65) после сброса процессора ; Переходим в защищённый режим smsw ax ; (66) Получим слово состояния машины or ax,1 ; (67) Установим бит PE lmsw ax ; (68) Запишем назад слово состояния ; Теперь процессор работает в защищённом режиме ; Загружаем в CS:IP селектор:смещение точки continue ; и заодно очищаем очередь команд db 0EAh ; (69) Код команды far jmp dw offset continue ; (70) Смещение dw 16 ; (71) Селектор сегмента команд continue: ; Делаем адресуемыми данные mov ax,8 ; (73) Селектор сегмента данных mov ds,ax ; (74) ; Делаем адресуемым стек mov ax,24 ; (75) Селектор сегмента стека mov ss,ax ; (76) ; Инициализируем ES и выводим символы mov ax,32 ; (77) Селектор сегмента видеобуфера mov es,ax ; (78) mov bx,800 ; (79) Начальное смещение на экране mov cx,640 ; (80) Число выводимых символов mov ax,word ptr sym ; (81) Начальный символ с атрибутом screen: mov es:[bx], ax ; (82) Вывод в видеобуфер add bx,2 ; (83) Сместится в видеобуфере inc ax ; (84) Следующий символ loop screen ; (85) Цикл вывода на экран ; Вернёмся в реальный режим mov real_sp,SP ; (86) Сохраним SP mov al,0FEh ; (87) Команда сброса процессора out 64h,AL ; (88) в порт 64h hlt ; (89) Останов процессора до окончания сброса ; Теперь процессор снова работает в реальном режиме ; Восстановим операционную среду реального режима return: mov ax,data ; (90) Восстановим адресуемость mov ds,ax ; (91) данных mov sp,real_sp ; (92) Восстановим mov ax,stk ; (93) адресуемость mov ss,ax ; (94) стека ; Разрешим аппаратные и немаскируемые прерывания sti ; (95) Разрешение прерываний mov al,0 ; (96) Сброс 7 бита в 7 порте CMOS- out 70h,al ; (97) разрешение NMI ; Проверим выполнение функций DOS после возврата в реальный режим mov ax,09h ; (98) Функция вывода на экран строки mov dx,offset mes ; (99) Адрес строки int 21h ; (100) Вызов DOS mov ax,4C00h ; (101) Завершим программу обычным int 21h ; (102) образом main endp ; (103) Конец сегмента команд code_size=$-main ; (104) Размер сегмента команд text ends ; (105) Конец сегмента команд stk segment stack 'stack' ; (106) Начало сегмента стека db 256 dup ('^') ; (107) stk ends ; (108) Конец сегмента стека end main ; (109) Конец программы
45.006849
78
0.667783
ead2bc3e100c55ef52f0f45c818082cba47090b5
883
asm
Assembly
code/jump/mac/jump.asm
HudsonSchumaker/x86_64-NSAM
833d27cdb76775050192079c1b1f7d657d41f712
[ "MIT" ]
null
null
null
code/jump/mac/jump.asm
HudsonSchumaker/x86_64-NSAM
833d27cdb76775050192079c1b1f7d657d41f712
[ "MIT" ]
null
null
null
code/jump/mac/jump.asm
HudsonSchumaker/x86_64-NSAM
833d27cdb76775050192079c1b1f7d657d41f712
[ "MIT" ]
1
2020-10-18T12:56:31.000Z
2020-10-18T12:56:31.000Z
; O3 Ozone Project Lab ; jump.asm ; Hudson Schumaker bits 64 extern _printf section .data number1 dq 42 number2 dq 41 fmt1 db "NUMBER1 > = NUMBER2",10,0 fmt2 db "NUMBER1 < NUMBER2",10,0 section .bss section .text global _main _main: mov rbp, rsp; for correct debugging push rbp mov rbp, rsp mov rax, [rel number1] ; move the numbers into registers mov rbx, [rel number2] cmp rax, rbx ; compare rax and rbx jge greater ; rax greater or equal go to greater: mov rdi, fmt2 ; rax is smaller, continue here mov rax, 0 ; no xmm involved call _printf ; display fmt2 jmp exit ; jump to label exit: greater: mov rdi, fmt1 ; rax is greater mov rax, 0 ; no xmm involved call _printf ; display fmt1 exit: ; exit program mov rax, 0x02000001 xor rdi, rdi syscall
19.622222
62
0.629672
3d0368d11d956dcc6666ea7e4fab99f7927ae831
1,376
asm
Assembly
ex1.asm
iTooly/asm_ex
2491e4c415388f479344d13ddabcbac5297daf39
[ "MIT" ]
null
null
null
ex1.asm
iTooly/asm_ex
2491e4c415388f479344d13ddabcbac5297daf39
[ "MIT" ]
null
null
null
ex1.asm
iTooly/asm_ex
2491e4c415388f479344d13ddabcbac5297daf39
[ "MIT" ]
null
null
null
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« .486 ; create 32 bit code .model flat, stdcall ; 32 bit memory model option casemap :none ; case sensitive include \masm32\include\windows.inc include \masm32\macros\macros.asm ; ----------------------------------------------------------------- ; include files that have MASM format prototypes for function calls ; ----------------------------------------------------------------- include \masm32\include\masm32.inc include \masm32\include\gdi32.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc ; ------------------------------------------------ ; Library files that have definitions for function ; exports and tested reliable prebuilt code. ; ------------------------------------------------ includelib \masm32\lib\masm32.lib includelib \masm32\lib\gdi32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« .code start: xor eax, eax xor ebx, ebx xor ecx, ecx mov ecx, 64h increment: inc ebx add eax, ebx cmp ebx, ecx jl increment print_value: print str$(eax),13,10 exit: exit ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« end start
26.980392
75
0.460029
237198c956a84fe37893ce71af7aadb0f3d93f88
624
asm
Assembly
programs/oeis/312/A312890.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/312/A312890.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/312/A312890.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A312890: Coordination sequence Gal.6.115.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,4,9,13,17,21,25,29,33,37,41,46,50,54,59,63,67,71,75,79,83,87,91,96,100,104,109,113,117,121,125,129,133,137,141,146,150,154,159,163,167,171,175,179,183,187,191,196,200,204 mov $2,$0 add $2,1 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 mov $4,$0 mul $0,2 mov $5,1 mov $6,$4 lpb $0 mov $0,4 mov $5,2 bin $6,2 gcd $6,6 trn $5,$6 lpe add $5,$0 mul $5,2 sub $5,2 div $5,2 add $5,1 add $1,$5 lpe
21.517241
177
0.612179
ba3291245967bb541bd7a4cafc3efb6384a0b904
6,586
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1205.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1205.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1205.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 %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x15a53, %r9 nop nop nop add %r12, %r12 movups (%r9), %xmm2 vpextrq $1, %xmm2, %rax nop nop nop add %rdx, %rdx lea addresses_normal_ht+0xc53, %rsi lea addresses_D_ht+0x7d53, %rdi clflush (%rdi) xor %r10, %r10 mov $99, %rcx rep movsl nop nop nop nop cmp %r9, %r9 lea addresses_A_ht+0x11c53, %r10 nop nop nop nop nop xor %rcx, %rcx mov (%r10), %rax nop nop and $20984, %rsi lea addresses_UC_ht+0x3013, %rsi lea addresses_WT_ht+0x155c7, %rdi nop nop nop nop xor $3034, %rdx mov $74, %rcx rep movsl nop nop add $12887, %r9 lea addresses_WC_ht+0x1ceb3, %rdx nop nop cmp %r9, %r9 mov (%rdx), %ecx nop xor %rdi, %rdi lea addresses_normal_ht+0xe673, %rdi nop xor %r12, %r12 mov $0x6162636465666768, %rdx movq %rdx, %xmm4 and $0xffffffffffffffc0, %rdi movntdq %xmm4, (%rdi) sub %r12, %r12 lea addresses_UC_ht+0x3253, %rdi clflush (%rdi) nop nop inc %rcx movb (%rdi), %dl nop nop nop nop cmp %r9, %r9 lea addresses_UC_ht+0x1d853, %rax nop nop nop nop cmp $38271, %rdi mov (%rax), %ecx nop nop nop nop nop and %rdi, %rdi lea addresses_UC_ht+0xed53, %r9 nop and $61357, %rsi mov (%r9), %r12 nop nop nop xor %r9, %r9 lea addresses_WC_ht+0x1949f, %rdi nop cmp $34402, %rax mov (%rdi), %esi nop add %r10, %r10 lea addresses_UC_ht+0x466a, %r12 nop nop nop xor $64893, %rax movl $0x61626364, (%r12) nop nop and $63032, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %rbp push %rbx push %rsi // Faulty Load lea addresses_PSE+0x1fc53, %rbp nop nop nop cmp %r12, %r12 movb (%rbp), %r15b lea oracles, %rsi and $0xff, %r15 shlq $12, %r15 mov (%rsi,%r15,1), %r15 pop %rsi pop %rbx pop %rbp pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 4, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 6, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}} {'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 */
37.634286
2,999
0.655481
02d8e350030ab1fe1c1d6cdba74a10281367149c
977
asm
Assembly
libsrc/math/zxmath/tanh.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
libsrc/math/zxmath/tanh.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
libsrc/math/zxmath/tanh.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
; ; ; ZX Maths Routines ; ; 21/03/03 - Stefano Bodrato ; ; ; $Id: tanh.asm,v 1.4 2015/08/10 08:52:13 stefano Exp $ ; ;double tanh(double) ; e = exp(x) ; ; return (e-1.0/e)/(e+1.0/e) ; IF FORzx INCLUDE "zxfp.def" ENDIF IF FORzx81 INCLUDE "81fp.def" ENDIF IF FORlambda INCLUDE "lambdafp.def" ENDIF PUBLIC tanh EXTERN fsetup1 EXTERN stkequ .tanh call fsetup1 defb ZXFP_EXP ; and at the beginning exp (x) defb ZXFP_ST_MEM_0 defb ZXFP_STK_ONE defb ZXFP_EXCHANGE defb ZXFP_DIVISION ; 1/e defb ZXFP_DUPLICATE defb ZXFP_GET_MEM_0 defb ZXFP_ADDITION defb ZXFP_EXCHANGE defb ZXFP_GET_MEM_0 defb ZXFP_EXCHANGE defb ZXFP_SUBTRACT defb ZXFP_EXCHANGE ; This might be slightly optimized, maybe, but watch out.. ; test it deeply with positive and negative values ! IF FORlambda defb ZXFP_DIVISION + 128 ELSE defb ZXFP_DIVISION defb ZXFP_END_CALC ENDIF jp stkequ
15.030769
78
0.667349
6d677f76f7cc6253728d49715a284ccc887a76a4
846
asm
Assembly
oeis/142/A142201.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/142/A142201.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/142/A142201.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A142201: Primes congruent to 4 mod 41. ; Submitted by Christian Krause ; 127,373,619,701,947,1193,1439,1931,2341,2423,2833,3079,3407,3571,4391,4637,4801,5867,6113,6277,6359,7507,7589,7753,8081,8573,8737,8819,9311,9721,9803,9967,10459,11197,11279,11443,11689,12263,12919,13001,13411,13903,14149,14723,14887,14969,15461,16363,16691,16937,17183,17839,17921,18413,19069,19889,20627,20873,21283,21529,21611,22349,23087,23251,23333,23497,23743,24071,24317,24481,24809,25219,25301,25793,26203,26449,26777,28499,28663,28909,29401,29483,30139,30467,30631,30713,31123,32189,32353 mov $1,42 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $1,20 sub $2,1 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,61 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,121
33.84
498
0.728132
fad379f7103adb7f1d35297be926cac2135d3daa
8,038
asm
Assembly
base/ntos/ex/i386/splocks.asm
yang235/wrk-v1.2
daeeb598c7bf091b1370e8875626ad0cb3cd1ec0
[ "Intel" ]
209
2018-10-30T15:59:10.000Z
2022-03-31T06:02:48.000Z
base/ntos/ex/i386/splocks.asm
WindowsExploitation/wrk-v1.2
daeeb598c7bf091b1370e8875626ad0cb3cd1ec0
[ "Intel" ]
2
2019-01-17T04:52:33.000Z
2019-06-11T06:37:43.000Z
base/ntos/ex/i386/splocks.asm
WindowsExploitation/wrk-v1.2
daeeb598c7bf091b1370e8875626ad0cb3cd1ec0
[ "Intel" ]
66
2018-08-03T11:15:44.000Z
2022-03-31T01:03:03.000Z
title "Global SpinLock declerations" ;++ ; ; Copyright (c) Microsoft Corporation. All rights reserved. ; ; You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt). ; If you do not agree to the terms, do not use the code. ; ; ; Module Name: ; ; splocks.asm ; ; Abstract: ; ; All global spinlocks in the kernel image are declared in this ; module. This is done so that each spinlock can be spaced out ; sufficiently to guarantee that the L2 cache does not thrash ; by having a spinlock and another high use variable in the same ; cache line. ; ;-- .386p .xlist ifdef NT_UP PADLOCKS equ 4 _DATA SEGMENT PARA PUBLIC 'DATA' else PADLOCKS equ 128 _DATA SEGMENT PAGE PUBLIC 'DATA' endif ULONG macro VariableName align PADLOCKS public VariableName VariableName dd 0 endm ; ; These values are referenced together so they are defined in a single cache ; line. They are never modified after they are initialized on during boot. ; ; pIofCallDriver - This is a pointer to the function to call a driver. ; align PADLOCKS public _pIofCallDriver _pIofCallDriver dd 0 ; ; pIofCompleteRequest - This is a pointer to the function to call to complete ; an I/O request. ; public _pIofCompleteRequest _pIofCompleteRequest dd 0 ; ; pIoAllocateIrp - This is pointer to the function to call to allocate an IRP. ; public _pIoAllocateIrp _pIoAllocateIrp dd 0 ; ; pIoFreeIrp - This is a pointer to a function to call to free an IRP. ; public _pIoFreeIrp _pIoFreeIrp dd 0 ; ; These variables are updated frequently and under control of the dispatcher ; database lock. They are defined in a single cache line to reduce false ; sharing in MP systems. ; ; KiIdleSummary - This is the set of processors which are idle. It is ; used by the ready thread code to speed up the search for a thread ; to preempt when a thread becomes runnable. ; align PADLOCKS public _KiIdleSummary _KiIdleSummary dd 0 ; ; KiIdleSMTSummary - In multi threaded processors, this is the set of ; idle processors in which all the logical processors that make up a ; physical processor are idle. That is, this is the set of logical ; processors in completely idle physical processors. ; public _KiIdleSMTSummary _KiIdleSMTSummary dd 0 ; ; KiTbFlushTimeStamp - This is the TB flush entire time stamp counter. ; ; This variable is in it own cache line to reduce false sharing on MP systems. ; align PADLOCKS public _KiTbFlushTimeStamp _KiTbFlushTimeStamp dd 0 ; ; These variables are referenced together and are defined in a single cache ; line to reduce sharing on MP systems. ; ; KeTickCount - This is the number of clock ticks that have occurred since ; the system was booted. This count is used to compute a millisecond ; tick counter. ; align PADLOCKS public _KeTickCount _KeTickCount dd 0, 0, 0 ; ; KeMaximumIncrement - This is the maximum time between clock interrupts ; in 100ns units that is supported by the host HAL. ; public _KeMaximumIncrement _KeMaximumIncrement dd 0 ; ; KiTimeIncrementReciprocal - This is the reciprocal fraction of the time ; increment value that is specified by the HAL when the system is ; booted. ; public _KiTimeIncrementReciprocal _KiTimeIncrementReciprocal dq 0 ; ; KeTimeAdjustment - This is the actual number of 100ns units that are to ; be added to the system time at each interval timer interupt. This ; value is copied from KeTimeIncrement at system start up and can be ; later modified via the set system information service. ; timer table entries. ; public _KeTimeAdjustment _KeTimeAdjustment dd 0 ; ; KiTimeIncrementShiftCount - This is the shift count that corresponds to ; the time increment reciprocal value. ; public _KiTimeIncrementShiftCount _KiTimeIncrementShiftCount dd 0 ; ; KiTickOffset - This is the number of 100ns units remaining before a tick ; is added to the tick count and the system time is updated. ; public _KiTickOffset _KiTickOffset dd 0 ; ; These variables are referenced together and are defined in a single cache ; line to reduce sharing on MP systems. ; ; KiMaximumDpcQueueDepth - This is used to control how many DPCs can be ; queued before a DPC of medium importance will trigger a dispatch ; interrupt. ; align PADLOCKS public _KiMaximumDpcQueueDepth _KiMaximumDpcQueueDepth dd 4 ; ; KiMinimumDpcRate - This is the rate of DPC requests per clock tick that ; must be exceeded before DPC batching of medium importance DPCs ; will occur. ; public _KiMinimumDpcRate _KiMinimumDpcRate dd 3 ; ; KiAdjustDpcThreshold - This is the threshold used by the clock interrupt ; routine to control the rate at which the processor's DPC queue depth ; is dynamically adjusted. ; public _KiAdjustDpcThreshold _KiAdjustDpcThreshold dd 20 ; ; KiIdealDpcRate - This is used to control the aggressiveness of the DPC ; rate adjusting algorithm when decrementing the queue depth. As long ; as the DPC rate for the last tick is greater than this rate, the ; DPC queue depth will not be decremented. ; public _KiIdealDpcRate _KiIdealDpcRate dd 20 ; ; These variables are referenced together and are defined in a single cache ; line to reduce sharing on MP systems. ; ; KeErrorMask - This is the value used to mask the error code passed to ; memory management on page faults. ; align PADLOCKS public _KeErrorMask _KeErrorMask dd 1 ; ; MmPaeErrMask - This is the value used to mask upper bits of a PAE error. ; public _MmPaeErrMask _MmPaeErrMask dd 0 ; ; MmPaeMask - This is the value used to mask upper bits of a PAE PTE. ; public _MmPaeMask _MmPaeMask dq 0 ; ; MmHighestUserAddress - This is the highest user virtual address. ; public _MmHighestUserAddress _MmHighestUserAddress dd 0 ; ; MmSystemRangeStart - This is the start of the system virtual address space. ; public _MmSystemRangeStart _MmSystemRangeStart dd 0 ; ; MmUserProbeAddress - This is the address that is used to probe user buffers. ; public _MmUserProbeAddress _MmUserProbeAddress dd 0 ; ; MmHighestPhysicalPage - This is the highest physical page number in the ; system. ; public _MmHighestPhysicalPage _MmHighestPhysicalPage dd 0 ; ; MmPfnDatabase - This is the base address of the PFN database. ; public _MmPfnDatabase _MmPfnDatabase dd 0 ; ; MmSecondaryColors - This is the number of secondary page colors as determined ; by the size of the second level cache. ; public _MmSecondaryColors _MmSecondaryColors dd 0 ; ; MmSecondaryColorMask - This is the secondary color mask. ; public _MmSecondaryColorMask _MmSecondaryColorMask dd 0 ; ; MmSecondaryColorNodeShift - This is the secondary color node shift. ; public _MmSecondaryColorNodeShift _MmSecondaryColorNodeShift db 0 ; ; MmPfnDereferenceSListHead - This is used to store free blocks used for ; deferred PFN reference count releasing. ; align PADLOCKS public _MmPfnDereferenceSListHead _MmPfnDereferenceSListHead dq 0 ; ; MmPfnDeferredList - This is used to queue items that need reference count ; decrement processing. ; align PADLOCKS public _MmPfnDeferredList _MmPfnDeferredList dd 0 ; ; MmSystemLockPagesCount - This is the count of the number of locked pages ; in the system. ; align PADLOCKS public _MmSystemLockPagesCount _MmSystemLockPagesCount dd 0 align PADLOCKS _DATA ends end
23.571848
134
0.708634
6e9678ee16285ccf227705e4ff640cd9bf833aee
1,988
asm
Assembly
programs/oeis/290/A290682.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/290/A290682.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/290/A290682.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A290682: Decimal representation of the diagonal from the corner to the origin of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 929", based on the 5-celled von Neumann neighborhood. ; 1,2,7,14,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295,8589934591,17179869183,34359738367,68719476735,137438953471,274877906943,549755813887,1099511627775,2199023255551,4398046511103,8796093022207,17592186044415,35184372088831,70368744177663,140737488355327,281474976710655,562949953421311,1125899906842623,2251799813685247,4503599627370495,9007199254740991,18014398509481983,36028797018963967,72057594037927935,144115188075855871,288230376151711743,576460752303423487,1152921504606846975,2305843009213693951,4611686018427387903,9223372036854775807,18446744073709551615,36893488147419103231,73786976294838206463,147573952589676412927,295147905179352825855,590295810358705651711,1180591620717411303423,2361183241434822606847,4722366482869645213695,9444732965739290427391,18889465931478580854783,37778931862957161709567,75557863725914323419135,151115727451828646838271,302231454903657293676543,604462909807314587353087,1208925819614629174706175,2417851639229258349412351,4835703278458516698824703,9671406556917033397649407,19342813113834066795298815,38685626227668133590597631,77371252455336267181195263,154742504910672534362390527,309485009821345068724781055,618970019642690137449562111,1237940039285380274899124223,2475880078570760549798248447,4951760157141521099596496895,9903520314283042199192993791,19807040628566084398385987583,39614081257132168796771975167,79228162514264337593543950335,158456325028528675187087900671,316912650057057350374175801343,633825300114114700748351602687,1267650600228229401496703205375 add $0,2 mov $2,5 mod $2,$0 sub $0,1 mov $1,2 pow $1,$0 mod $2,2 add $1,$2 sub $1,2 mov $0,$1
142
1,671
0.903924
2786543764aee36e30ceaed4f0ab6e781949aa2b
42,347
asm
Assembly
base/Kernel/Native/ix86/halasm.asm
sphinxlogic/Singularity-RDK-2.0
2968c3b920a5383f7360e3e489aa772f964a7c42
[ "MIT" ]
null
null
null
base/Kernel/Native/ix86/halasm.asm
sphinxlogic/Singularity-RDK-2.0
2968c3b920a5383f7360e3e489aa772f964a7c42
[ "MIT" ]
null
null
null
base/Kernel/Native/ix86/halasm.asm
sphinxlogic/Singularity-RDK-2.0
2968c3b920a5383f7360e3e489aa772f964a7c42
[ "MIT" ]
null
null
null
; ; Copyright (c) Microsoft Corporation. All rights reserved. ; include hal.inc externdef __throwDispatcher:NEAR externdef __throwDispatcherExplicitAddrAfter:NEAR externdef ?ExceptionTableLookup@@YI_KPAUClass_System_Exception@@I@Z:NEAR ifdef SINGULARITY_KERNEL externdef ?g_setStopContext@Class_System_Threading_Thread@@SIXPAU1@PAUClass_System_Exception@@@Z:NEAR externdef __throwBeyondMarker:NEAR endif ; SINGULARITY_KERNEL externdef __throwDivideByZeroException:NEAR externdef __throwNullPointerException:NEAR externdef __throwOverflowException:NEAR externdef __throwStackOverflowException:NEAR if EXCLUDED externdef __checkFPStackDepth0:NEAR externdef __checkFPStackDepth1:NEAR externdef __checkFPStackDepth2:NEAR externdef __checkFPStackDepth3:NEAR externdef __checkFPStackDepth4:NEAR externdef __checkFPStackDepth5:NEAR externdef __checkFPStackDepth6:NEAR externdef __checkFPStackDepth7:NEAR endif ;; EXCLUDED align 8 $DBLMAXINT DQ 041dfffffffc00000r ; 2.14747e+009 $DBLMININT DQ 0c1e0000000000000r ; -2.14748e+009 $MAXLONG DQ 07fffffffffffffffh $MINLONG DQ 08000000000000000h ; ; __throwDispatcher(ecx=exception) ; ; Description: this function is called to explicitly throw an exception. ; It assumes that the return address points to the instruction immediately ; after the one where the exception was thrown ; ; Arguments: ; ecx = exception object ; [esp] = the return address ; Effects: ; 1. Create ebp chain entry ; 2. Get return address and uses it to calculate the address of the ; instruction that threw the exception. ; 3. Looks up the appropriate handler and jumps to code to process it. align 16 __throwDispatcher proc push ebp ; create ebp chain entry mov ebp, esp ; set new ebp mov edx, [ebp+4] ; get return address push ecx ; save exception sub edx, 1 ; adjust to point to throw location call ?ExceptionTableLookup@@YI_KPAUClass_System_Exception@@I@Z pop ecx ; restore exception pop ebp ; remove ebp chain add esp, 4 ; remove eip from the stack ; mov edx is already ok jmp __throwDispatcherHandler __throwDispatcher endp ; ; __throwDispatcherExplicitAddr (ecx=exception, edx=throwAddress) ; ; Description: ; This is to be used when the address where the exception occurred ; is passed in as an extra argument ; ; Arguments: ; ecx = exception object ; edx = address where the exception was thrown ; align 16 __throwDispatcherExplicitAddr proc push ecx ; save exception call ?ExceptionTableLookup@@YI_KPAUClass_System_Exception@@I@Z pop ecx ; restore exception ; mov edx is already ok jmp __throwDispatcherHandler __throwDispatcherExplicitAddr endp ; ; __throwDispatcherExplictAddrAfter (ecx=exception, edx=throwAddress) ; ; Description: ; This is to be used when the address of the instruction immediately after ; the one that actually threw the exception is passed as an argument. ; ; Arguments: ; ecx = pointer to exception object being thrown ; edx = address of the instruction following the one where ; the exception was thrown ; ; This is used, for example, in stack unwinding, where edx is the ; return address on the stack for the current procedure. ; ; Stack unwinding occurs when the current procedure does not have a handler ; for the routine. The idea is to pop the stack frame and treat the call ; instruction in the caller as though it threw. We only have the return ; address, though, which points to the instruction *after* the call. ; align 16 __throwDispatcherExplicitAddrAfter proc ifdef SINGULARITY ; int 3 push ecx push edx mov ecx, edx call ?g_IsUnlinkStack@Class_System_Exception@@SI_NPAUuintPtr@@@Z pop edx pop ecx test al, al je normal mov eax, ecx ; save exception type mov ecx, edx mov edx, [ebp+4] ; save the return addr in caller mov [ebp+4], afterUnlinkStack ; override return addr to instr after jmp ecx ; unlink stack which saves eax, edx afterUnlinkStack: mov ecx, eax ; restore return addr in caller normal: ; Have we reached a kernel->process or process->kernel boundary? ; Call Exception.CheckKernelProcessBoundary(esp, ebp, exception) push ecx push edx push ecx ; arg 3 (exception) mov ecx, esp ; arg 2 (ebp) mov edx, ebp ; arg 1 (esp) call ?g_CheckKernelProcessBoundary@Class_System_Threading_Thread@@SIPAUuintPtr@@PAU2@0PAUClass_System_Exception@@@Z pop edx pop ecx ; A non-zero return value means we reached a boundary. test eax, eax jz normal2 ifdef SINGULARITY_PROCESS ;; The process's exception reached the kernel's frames. ; Return gracefully to the kernel (i.e. jump to the kernel's ; return address), and the kernel's popStackMark ; will check uncaughtFlag and throw a new exception. jmp edx endif ; SINGULARITY_PROCESS ifdef SINGULARITY_KERNEL ; There are 3 control paths that merge here: ; (1) When Thread.cs stops a process mode thread, it sets eip to point here. ; (2) When Thread.cs stops a blocked kernel thread, it sets eip to point here. ; (3) The stack unwinder falls through to this case when a kernel exception ; reaches a process's frames. ; For control path (3), a finally block puts us in a GC safe state ; just before we reach here. ; We also expect to be in the GC safe state most of the ; time for control paths (1) and (2), but ; because pushStackMark and popStackMark are not atomic operations, ; we cannot be 100% sure that we're in the GC safe state. ; eax: kernel->process or kernel->kernel marker ; ecx: exception __throwBeyondMarker LABEL NEAR push ecx push eax ; Leave the GC safe state (if we're actually in it) call ?g_RestoreMutatorControlIfNeeded@Class_System_GCs_Transitions@@SIXXZ pop eax pop ecx ; eax: kernel->process or kernel->kernel marker ; ecx: exception ; Restore state from the marker, skipping over any intermediate frames. ; Keep the original exception in ecx. ; Get the return address for the frame beyond the marker into edx: mov edx, dword ptr [eax].Struct_System_GCs_CallStack_TransitionRecord._stackBottom mov edx, dword ptr [edx - 4] ; Restore the kernel's ebx, edi, esi, ebp from the marker: mov ebx, dword ptr [eax].Struct_System_GCs_CallStack_TransitionRecord._calleeSaveRegisters._EBX mov edi, dword ptr [eax].Struct_System_GCs_CallStack_TransitionRecord._calleeSaveRegisters._EDI mov esi, dword ptr [eax].Struct_System_GCs_CallStack_TransitionRecord._calleeSaveRegisters._ESI mov ebp, dword ptr [eax].Struct_System_GCs_CallStack_TransitionRecord._calleeSaveRegisters._EBP ; Keep a copy of transition record (eax) and oldTransitionRecord push eax push dword ptr [eax].Struct_System_GCs_CallStack_TransitionRecord._oldTransitionRecord ; Read _stackBottom (the new esp) from the kernel->process marker: mov eax, dword ptr [eax].Struct_System_GCs_CallStack_TransitionRecord._stackBottom ; Save ecx, edx to new stack -- this may overwrite the transition record, ; so don't read any more fields from the transition record after this point. mov [eax - 4], ecx ; (exception) mov [eax - 8], edx ; (return address) ; Set up the two arguments to DiscardStackSegments pop edx ; (oldTransitionRecord) pop ecx ; (marker) ; Restore the kernel's esp from the kernel->process marker: lea esp, [eax - 8] ; Free any stack segments that we skipped over: ;; TODO: are we sure there's enough stack space to call this? call ?g_DiscardSkippedStackSegments@Class_System_Threading_Thread@@SIXPAUStruct_System_GCs_CallStack_TransitionRecord@@0@Z pop edx ; (return address) pop ecx ; (exception) endif ; SINGULARITY_KERNEL normal2: endif push ecx ; save exception dec edx call ?ExceptionTableLookup@@YI_KPAUClass_System_Exception@@I@Z pop ecx ; restore exception ; mov edx is already ok jmp __throwDispatcherHandler __throwDispatcherExplicitAddrAfter endp ; __throwDispatcherHandler (eax=frameSetupInfo or exceptionType, ; ecx=exception, ; edx=spillSize,frameSetupSize, or handlerAddress ; ; Description: ; After the exception table entry has been found, the values are passed here ; for processing. This method simply checks for the easy case of an explicit ; handler (known if the exceptionType is given <-- low bit is zero). ; In this case it simply jumps to the handler. Otherwise it passes the ; information along to __throwDispatcherUnwind. ; ; Arguments: ; If low bit of eax is set: ; eax = frame setup information ; ecx = exception object ; edx = spill size excluding callee-save register saves ; or offset from ebp to end of callee-save register saves ; Otherwise: ; eax = exception type (unused) ; ecx = exception object ; edx = handler address align 16 __throwDispatcherHandler proc test eax, 1 jne __throwDispatcherUnwind ;; ecx=exception, edx=handler jmp edx __throwDispatcherHandler endp ; __throwDispatcherUnwind (eax=frame setup info, ecx=exception, edx=spill size ; ; Description: ; This is the global unwind handler. It is used to unwind a single stack ; frame if there are no explicit handlers that catch an exception in a given ; function. ; ; Arguments: ; eax = frame setup information, must have low bit set ; ecx = exception object ; edx = spill size excluding callee-save register saves ; or offset from ebp to end of callee-save register saves ; ; See tables\ExceptionTable.cs for details on these values align 16 __throwDispatcherUnwind proc ;; eax=frame info ;; edx=spill size ;; obviously ebp isn't useful under frame pointer omission ;; but less obviously esp may be invalid if ebp is good ;; (e.g. under varargs we may not have known how many arguments to ;; pop; this is one reason why varargs turns off frame pointer omission) test eax, 2h jne esp_is_good ;; ebp_is_good add edx, ebp mov esp, edx jmp esp_is_setup esp_is_good: ;; pop spill slots add esp, edx esp_is_setup: ;; restore callee-saves and pop values from stack ;; (excludes ebp if used as the frame pointer) test eax, 4h je skip_edi_restore ;; restore edi pop edi skip_edi_restore: test eax, 8h je skip_esi_restore ;; restore esi pop esi skip_esi_restore: test eax, 10h je skip_ebp_restore ;; restore ebp pop ebp skip_ebp_restore: test eax, 20h je skip_ebx_restore ;; restore ebx pop ebx skip_ebx_restore: test eax, 40h je skip_jump_transition_record ;; jump over transition record add esp, (SIZE Struct_System_GCs_CallStack_TransitionRecord) skip_jump_transition_record: ;; restore ebp if it was used as the frame pointer test eax, 2h jne skip_frame_pointer_restore ;; restore frame pointer (esp == ebp already) pop ebp skip_frame_pointer_restore: ;; set edx=return address pop edx ;; pop arguments shr eax, 16 add esp, eax ;; At this point ;; ecx=exception, edx=return address ;; esi/edi/ebx/ebp/esp have been restored ;; eax is scratch ;; set up next handler search jmp __throwDispatcherExplicitAddrAfter __throwDispatcherUnwind endp ; ; __throwDivideByZeroException: instantiate an divide-by-zero exception ; and throw it. ; ; Assumes edx points to the address after the one that threw. ; align 16 __throwDivideByZeroException proc push ebx push esi mov ebx,edx ; save address if SINGLE_THREADED inc ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock inc ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; SINGLE_THREADED mov ecx,offset ??_7System_DivideByZeroException@@6B@ call ?g_AllocateObject@Class_System_GC@@SIPAUClass_System_Object@@PAUClass_System_VTable@@@Z mov esi,eax ; save pointer to instance of exception mov ecx,eax ; initialize instance call ?m__ctor@Class_System_DivideByZeroException@@SIXPAU1@@Z if SINGLE_THREADED dec ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock dec ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; SINGLE_THREADED mov ecx,esi mov edx,ebx pop esi pop ebx jmp __throwDispatcherExplicitAddr __throwDivideByZeroException endp ; ; __throwStackOverflowException: instantiate an StackOverflow exception ; and throw it. ; ; Assumes edx points to the address of the instruction that faulted ; align 16 __throwStackOverflowException proc push ebx push esi mov ebx,edx ; save address if SINGLE_THREADED inc ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock inc ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; MULTI_THREADED mov ecx,offset ??_7System_StackOverflowException@@6B@ call ?g_AllocateObject@Class_System_GC@@SIPAUClass_System_Object@@PAUClass_System_VTable@@@Z mov esi,eax ; save pointer to instance of exception mov ecx,eax ; initialize instance call ?m__ctor@Class_System_StackOverflowException@@SIXPAU1@@Z if SINGLE_THREADED dec ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock dec ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; MULTI_THREADED mov ecx,esi mov edx,ebx call ?ExceptionTableLookup@@YI_KPAUClass_System_Exception@@I@Z ifndef SINGULARITY push esi push edx call ?ResetGuardPage@@YIXXZ pop edx pop eax endif pop esi pop ebx mov ecx,eax ; mov edx is already ok jmp edx __throwStackOverflowException endp ; ; __throwNullReferenceException: instantiate an NullReference exception ; and throw it. ; ; Assumes edx points to the address of the instruction that faulted ; align 16 __throwNullReferenceException proc push ebx push esi mov ebx,edx ; save address if SINGLE_THREADED inc ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock inc ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; SINGLE_THREADED mov ecx,offset ??_7System_NullReferenceException@@6B@ call ?g_AllocateObject@Class_System_GC@@SIPAUClass_System_Object@@PAUClass_System_VTable@@@Z mov esi,eax ; save pointer to instance of exception mov ecx,eax ; initialize instance call ?m__ctor@Class_System_NullReferenceException@@SIXPAU1@@Z if SINGLE_THREADED dec ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock dec ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; SINGLE_THREADED mov ecx,esi mov edx,ebx pop esi pop ebx jmp __throwDispatcherExplicitAddr __throwNullReferenceException endp ; ; __throwDivideByZeroException: instantiate an divide-by-zero exception ; and throw it. ; ; Assumes edx points to the address of the instruction that faulted ; align 16 __throwOverflowException proc push ebx push esi mov ebx,edx ; save address if SINGLE_THREADED inc ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock inc ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; SINGLE_THREADED mov ecx,offset ??_7System_OverflowException@@6B@ call ?g_AllocateObject@Class_System_GC@@SIPAUClass_System_Object@@PAUClass_System_VTable@@@Z mov esi,eax ; save pointer to instance of exception mov ecx,eax ; initialize instance call ?m__ctor@Class_System_OverflowException@@SIXPAU1@@Z if SINGLE_THREADED dec ?c_allocationInhibitGC@Class_System_GC@@2_NA else ; SINGLE_THREADED lock dec ?c_allocationInhibitGC@Class_System_GC@@2_NA endif ; SINGLE_THREADED mov ecx,esi mov edx,ebx pop esi pop ebx jmp __throwDispatcherExplicitAddr __throwOverflowException endp ifdef SINGULARITY_KERNEL ; ; void Thread.setStopContext(Thread t, Exception exn) ; align 16 ?g_setStopContext@Class_System_Threading_Thread@@SIXPAU1@PAUClass_System_Exception@@@Z proc ; ecx = ecx.context add ecx, Class_System_Threading_Thread._context ; context.eip = __throwBeyondMarker ; context.ecx = processStopException ; context.eax = context.stackMarkers mov [ecx].Struct_Microsoft_Singularity_ThreadContext._threadRecord._spill._ip, __throwBeyondMarker mov [ecx].Struct_Microsoft_Singularity_ThreadContext._threadRecord._spill._cx, edx mov eax, [ecx].Struct_Microsoft_Singularity_ThreadContext._stackMarkers mov [ecx].Struct_Microsoft_Singularity_ThreadContext._threadRecord._spill._ax, eax ret ?g_setStopContext@Class_System_Threading_Thread@@SIXPAU1@PAUClass_System_Exception@@@Z endp endif ; SINGULARITY_KERNEL ; ; int System.VTable.doubleToInt(double) ; align 16 ?g_doubleToInt@Class_System_VTable@@SIHN@Z proc push ebp mov ebp,esp add esp,-8 fld real8 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp dword ptr [ebp-8] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-8] cmp eax,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 8 possible_overflow: fld real8 ptr [ebp+8] fcomp real8 ptr $DBLMAXINT fnstsw ax test ah,4 jne short return_zero test ah,1 jne short return_MININT return_MAXINT: mov eax, 07fffffffh jmp short return return_zero: xor eax, eax jmp short return return_MININT: mov eax, 080000000h jmp short return ?g_doubleToInt@Class_System_VTable@@SIHN@Z endp ; ; long System.VTable.doubleToLong(double) ; align 16 ?g_doubleToLong@Class_System_VTable@@SI_JN@Z proc push ebp mov ebp,esp add esp,-12 fld real8 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp qword ptr [ebp-12] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-12] mov edx,dword ptr [ebp-8] cmp edx,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 8 possible_overflow: mov edx,eax ; save lsw fld real8 ptr [ebp+8] fild qword ptr $MAXLONG fcompp fnstsw ax test ah,4 jne short return_zero test ah,65 je short check_MINLONG return_MAXLONG: mov eax, 0ffffffffh mov edx, 07fffffffh jmp short return return_zero: xor eax, eax xor edx, edx jmp short return check_MINLONG: fld real8 ptr [ebp+8] fild qword ptr $MINLONG fcompp fnstsw ax test ah,1 jne short return_original return_MINLONG: xor edx, edx ; zero lsw return_original: mov eax, edx ; restore lsw to eax mov edx, 080000000h jmp short return ?g_doubleToLong@Class_System_VTable@@SI_JN@Z endp ; ; int System.VTable.floatToInt(float) ; align 16 ?g_floatToInt@Class_System_VTable@@SIHM@Z proc push ebp mov ebp,esp add esp,-8 fld real4 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait xor eax,eax mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp dword ptr [ebp-8] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-8] cmp eax,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 4 possible_overflow: fld real4 ptr [ebp+8] fcomp real8 ptr $DBLMAXINT fnstsw ax test ah,4 jne short return_zero test ah,1 jne short return_MININT mov eax, 07fffffffh jmp short return return_zero: xor eax, eax jmp short return return_MININT: mov eax, 080000000h jmp short return ?g_floatToInt@Class_System_VTable@@SIHM@Z endp ; ; long System.VTable.floatToLong(float) ; align 16 ?g_floatToLong@Class_System_VTable@@SI_JM@Z proc push ebp mov ebp,esp add esp,-12 fld real4 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp qword ptr [ebp-12] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-12] mov edx,dword ptr [ebp-8] cmp edx,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 4 possible_overflow: mov edx,eax ; save lsw fld real4 ptr [ebp+8] fild qword ptr $MAXLONG fcompp fnstsw ax test ah,4 jne short return_zero test ah,65 je short check_MINLONG return_MAXLONG: mov eax, 0ffffffffh mov edx, 07fffffffh jmp short return return_zero: xor eax, eax xor edx, edx jmp short return check_MINLONG: fld real4 ptr [ebp+8] fild qword ptr $MINLONG fcompp fnstsw ax test ah,1 jne short return_original return_MINLONG: xor edx, edx ; zero lsw return_original: mov eax, edx ; restore lsw to eax mov edx, 080000000h jmp short return ?g_floatToLong@Class_System_VTable@@SI_JM@Z endp ; ; int System.VTable.checkedDoubleToInt(double) ; align 16 ?g_checkedDoubleToInt@Class_System_VTable@@SIHN@Z proc push ebp mov ebp,esp add esp,-8 fld real8 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp dword ptr [ebp-8] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-8] cmp eax,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 8 possible_overflow: fld real8 ptr [ebp+8] fcomp real8 ptr $DBLMAXINT fnstsw ax test ah,4 ; test for unordered jne short throw_exception test ah,1 ; test for <$DBLMAXINT jne short return_MININT ; src > $DBLMAXINT ; throw an overflow exception jmp short throw_exception return_MININT: ; check against $DBLMININT fld real8 ptr [ebp+8] fcomp real8 ptr $DBLMININT fnstsw ax test ah, 1 ; test for < $DBLMININT jne short throw_exception ; throw exception if true mov eax, 080000000h jmp short return throw_exception: ; throw an overflow exception ; set up stack frame so that it looks like a call to throwNewOverflowException ; from the caller of this function. mov esp,ebp pop ebp pop eax ; grab return address add esp, 4 ; move esp pass the first parameter. mov [esp],eax ; overwrite argument jmp ?g_throwNewOverflowException@Class_System_VTable@@SIXXZ ?g_checkedDoubleToInt@Class_System_VTable@@SIHN@Z endp ; ; long System.VTable.checkedDoubleToLong(double) ; align 16 ?g_checkedDoubleToLong@Class_System_VTable@@SI_JN@Z proc push ebp mov ebp,esp add esp,-12 fld real8 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp qword ptr [ebp-12] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-12] mov edx,dword ptr [ebp-8] cmp edx,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 8 possible_overflow: mov edx,eax ; save lsw fld real8 ptr [ebp+8] fild qword ptr $MAXLONG fcompp fnstsw ax test ah,4 ; test for unordered jne short return_zero test ah,65 ; test for <= $MAXLONG je short check_MINLONG return_MAXLONG: ; src > $MAXLONG ; throw an exception jmp short throw_exception return_zero: jmp short throw_exception check_MINLONG: ; src <= $MINLONG fild qword ptr $MINLONG fld real8 ptr [ebp+8] fcompp ; real8 ptr [ebp+8] < $MINLONG fnstsw ax test ah,1 jne short throw_exception return_MINLONG: mov eax, edx ; restore lsw to eax mov edx, 080000000h jmp short return throw_exception: ; throw an overflow exception ; set up stack frame so that it looks like a call to throwNewOverflowException ; from the caller of this function. mov esp,ebp pop ebp pop eax ; grab return address add esp, 4 ; move esp pass the first parameter. mov [esp],eax ; overwrite argument jmp ?g_throwNewOverflowException@Class_System_VTable@@SIXXZ ?g_checkedDoubleToLong@Class_System_VTable@@SI_JN@Z endp ; ; int System.VTable.checkedFloatToInt(float) ; align 16 ?g_checkedFloatToInt@Class_System_VTable@@SIHM@Z proc push ebp mov ebp,esp add esp,-8 fld real4 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait xor eax,eax mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp dword ptr [ebp-8] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-8] cmp eax,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 4 possible_overflow: fld real4 ptr [ebp+8] fcomp real8 ptr $DBLMAXINT fnstsw ax test ah,4 ; test for unordered jne short throw_exception test ah,1 ; test for src < $DBLMAXINT jne short return_MININT ; src > $DBLMAXINT ; throw an overflow exception jmp short throw_exception return_MININT: ; need to check against $DBLMININT, if it is less than, ; then throw an overflow exception fld real4 ptr [ebp+8] fcomp real8 ptr $DBLMININT fnstsw ax test ah,1 ; test for less than jne short throw_exception mov eax, 080000000h jmp short return throw_exception: ; throw an overflow exception ; set up stack frame so that it looks like a call to throwNewOverflowException ; from the caller of this function. mov esp,ebp pop ebp pop eax ; grab return address mov [esp],eax ; overwrite argument jmp ?g_throwNewOverflowException@Class_System_VTable@@SIXXZ ?g_checkedFloatToInt@Class_System_VTable@@SIHM@Z endp ; ; long System.VTable.checkedFloatToLong(float) ; align 16 ?g_checkedFloatToLong@Class_System_VTable@@SI_JM@Z proc push ebp mov ebp,esp add esp,-12 fld real4 ptr [ebp+8] wait fnstcw word ptr [ebp-2] wait mov ax,word ptr [ebp-2] or eax,0C00h mov word ptr [ebp-4],ax fldcw word ptr [ebp-4] fistp qword ptr [ebp-12] fldcw word ptr [ebp-2] mov eax,dword ptr [ebp-12] mov edx,dword ptr [ebp-8] cmp edx,080000000h je possible_overflow return: mov esp,ebp pop ebp ret 4 possible_overflow: mov edx,eax ; save lsw fld real4 ptr [ebp+8] fild qword ptr $MAXLONG fcompp fnstsw ax test ah,4 ; test for unordered jne short return_zero test ah,65 ; test for <= $MAXLONG je short check_MINLONG return_MAXLONG: ; src > $MAXLONG ; throw an exception jmp short throw_exception return_zero: ; compare with $MAXLONG results in unordered ; throw an overflow exception jmp short throw_exception check_MINLONG: ; src <= $MINLONG fild qword ptr $MINLONG fld real4 ptr [ebp+8] fcompp ; real8 ptr [ebp+8] < $MINLONG fnstsw ax test ah,1 jne short throw_exception ; throw an overflow exception when src < $MINLONG return_MINLONG: mov eax, edx ; restore lsw mov edx, 080000000h jmp short return throw_exception: ; throw an overflow exception ; set up stack frame so that it looks like a call to throwNewOverflowException ; from the caller of this function. mov esp,ebp pop ebp pop eax ; grab return address mov [esp],eax ; overwrite argument jmp ?g_throwNewOverflowException@Class_System_VTable@@SIXXZ ?g_checkedFloatToLong@Class_System_VTable@@SI_JM@Z endp align 16 ?g_floatRem@Class_System_VTable@@SIMMM@Z proc fld real4 ptr [esp+8] fld real4 ptr [esp+4] fremloop: fprem fstsw ax fwait sahf jp fremloop ; Continue while the FPU status bit C2 is set ffree st(1) ret 8 ?g_floatRem@Class_System_VTable@@SIMMM@Z endp align 16 ?g_doubleRem@Class_System_VTable@@SINNN@Z proc fld real8 ptr [esp+12] fld real8 ptr [esp+4] fremloop: fprem fstsw ax fwait sahf jp fremloop ; Continue while the FPU status bit C2 is set ffree st(1) ret 16 ?g_doubleRem@Class_System_VTable@@SINNN@Z endp if EXCLUDED ; ; void __checkFPStackDepth0 ; align 16 __checkFPStackDepth0 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,0 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth0 endp ; ; void __checkFPStackDepth1 ; align 16 __checkFPStackDepth1 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,8-1 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth1 endp ; ; void __checkFPStackDepth2 ; align 16 __checkFPStackDepth2 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,8-2 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth2 endp ; ; void __checkFPStackDepth3 ; align 16 __checkFPStackDepth3 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,8-3 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth3 endp ; ; void __checkFPStackDepth4 ; align 16 __checkFPStackDepth4 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,8-4 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth4 endp ; ; void __checkFPStackDepth5 ; align 16 __checkFPStackDepth5 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,8-5 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth5 endp ; ; void __checkFPStackDepth6 ; align 16 __checkFPStackDepth6 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,8-6 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth6 endp ; ; void __checkFPStackDepth7 ; align 16 __checkFPStackDepth7 proc push ebp mov ebp,esp push eax pushfd xor eax,eax wait fnstsw ax wait shr eax,11 and eax,7 cmp eax,8-7 je ok oops: int 3 ok: popfd pop eax pop ebp ret 0 __checkFPStackDepth7 endp endif ; EXCLUDED ;;; ;;; ;;; ;;; ifdef SINGULARITY ?g_ZeroPages@Class_System_Buffer@@SIXPAEH@Z proc ;; ECX = dst ;; EDX = len (bytes) push ebp mov ebp, esp pxor mm0, mm0 next: movntq [ecx + 0], mm0 movntq [ecx + 8], mm0 movntq [ecx + 16], mm0 movntq [ecx + 24], mm0 movntq [ecx + 32], mm0 movntq [ecx + 40], mm0 movntq [ecx + 48], mm0 movntq [ecx + 56], mm0 add ecx, 64 sub edx, 64 ja next sfence emms pop ebp ret ?g_ZeroPages@Class_System_Buffer@@SIXPAEH@Z endp ?g_CopyPages@Class_System_Buffer@@SIXPAE0H@Z proc ;; ECX = dst ;; EDX = src ;; [ebp+8] len (bytes) push ebp mov ebp, esp mov eax, [ebp + 8] cmp ecx, edx js down ;; destination is lower than source add ecx, eax add edx, eax sub ecx, 64 sub edx, 64 up: movq mm0, [edx + 0] movq mm1, [edx + 8] movq mm2, [edx + 16] movq mm3, [edx + 24] movq mm4, [edx + 32] movq mm5, [edx + 40] movq mm6, [edx + 48] movq mm7, [edx + 56] movntq [ecx + 0], mm0 movntq [ecx + 8], mm1 movntq [ecx + 16], mm2 movntq [ecx + 24], mm3 movntq [ecx + 32], mm4 movntq [ecx + 40], mm5 movntq [ecx + 48], mm6 movntq [ecx + 56], mm7 sub ecx, 64 sub edx, 64 sub eax, 64 ja up sfence emms pop ebp ret 4 ;; destination is higher than source down: movq mm0, [edx + 0] movq mm1, [edx + 8] movq mm2, [edx + 16] movq mm3, [edx + 24] movq mm4, [edx + 32] movq mm5, [edx + 40] movq mm6, [edx + 48] movq mm7, [edx + 56] movntq [ecx + 0], mm0 movntq [ecx + 8], mm1 movntq [ecx + 16], mm2 movntq [ecx + 24], mm3 movntq [ecx + 32], mm4 movntq [ecx + 40], mm5 movntq [ecx + 48], mm6 movntq [ecx + 56], mm7 add ecx, 64 add edx, 64 sub eax, 64 ja down sfence emms pop ebp ret 4 ?g_CopyPages@Class_System_Buffer@@SIXPAE0H@Z endp endif end
29.800844
138
0.536756
07f7f7645e4821b00dd6920ffb6272fc572cbece
105
asm
Assembly
assembly-x86/hello.asm
imsad2/hello-worlds
3b57fc46b0d28127ec9d99f9ca8c4e4c87697175
[ "Unlicense" ]
null
null
null
assembly-x86/hello.asm
imsad2/hello-worlds
3b57fc46b0d28127ec9d99f9ca8c4e4c87697175
[ "Unlicense" ]
null
null
null
assembly-x86/hello.asm
imsad2/hello-worlds
3b57fc46b0d28127ec9d99f9ca8c4e4c87697175
[ "Unlicense" ]
null
null
null
org 0x100 mov dx, msg mov ah, 9 int 0x21 mov ah, 0x4c int 0x21 msg db "hello world!", 0x0d, 0x0a, "$"
9.545455
38
0.647619
d1613fccc0b9be4993b8ca37ff71f1813b8fd7db
432
asm
Assembly
oeis/286/A286546.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/286/A286546.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/286/A286546.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A286546: a(n) = A006068(n) - n. ; Submitted by Simon Strandgaard ; 0,0,1,-1,3,1,-2,-2,7,5,2,2,-4,-4,-3,-5,15,13,10,10,4,4,5,3,-8,-8,-7,-9,-5,-7,-10,-10,31,29,26,26,20,20,21,19,8,8,9,7,11,9,6,6,-16,-16,-15,-17,-13,-15,-18,-18,-9,-11,-14,-14,-20,-20,-19,-21,63,61,58,58,52,52,53,51,40,40,41,39,43,41,38,38,16,16,17,15,19,17,14,14,23,21,18,18,12,12,13,11,-32,-32,-31,-33 mov $1,$0 seq $0,6068 ; a(n) is Gray-coded into n. sub $0,$1
54
302
0.571759
ba038dbecce57acea2b3927098a06a26246a0250
653
asm
Assembly
libsrc/_DEVELOPMENT/adt/bv_stack/z80/asm_bv_stack_empty.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/adt/bv_stack/z80/asm_bv_stack_empty.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/adt/bv_stack/z80/asm_bv_stack_empty.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; =============================================================== ; Feb 2014 ; =============================================================== ; ; int bv_stack_empty(bv_stack_t *s) ; ; Return true (non-zero) if stack is empty. ; ; =============================================================== SECTION code_adt_bv_stack PUBLIC asm_bv_stack_empty EXTERN l_testword_hl defc asm_bv_stack_empty = l_testword_hl - 2 ; enter : hl = stack * ; ; exit : if stack is empty ; ; hl = 1 ; z flag set ; ; if stack is not empty ; ; hl = 0 ; nz flag set ; ; uses : af, hl
19.787879
65
0.378254
3dc5fbdbd208318a3c46484abb7d77e7a22d84d6
606
asm
Assembly
oeis/125/A125833.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/125/A125833.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/125/A125833.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A125833: Numbers whose base 5 representation is 333333.......3. ; 0,3,18,93,468,2343,11718,58593,292968,1464843,7324218,36621093,183105468,915527343,4577636718,22888183593,114440917968,572204589843,2861022949218,14305114746093,71525573730468,357627868652343,1788139343261718,8940696716308593,44703483581542968,223517417907714843,1117587089538574218,5587935447692871093,27939677238464355468,139698386192321777343,698491930961608886718,3492459654808044433593,17462298274040222167968,87311491370201110839843,436557456851005554199218,2182787284255027770996093 mov $1,5 pow $1,$0 div $1,4 mul $1,3 mov $0,$1
67.333333
491
0.867987
2b4ddc01d9aa97c6aea61a065ac1e14d787937d1
13,614
asm
Assembly
kProfiler2/prfamd64msc.asm
OS2World/DEV-UTIL-kstuff
a7c7c889dbec27938222c5823eb378f5a26aef40
[ "MIT" ]
null
null
null
kProfiler2/prfamd64msc.asm
OS2World/DEV-UTIL-kstuff
a7c7c889dbec27938222c5823eb378f5a26aef40
[ "MIT" ]
null
null
null
kProfiler2/prfamd64msc.asm
OS2World/DEV-UTIL-kstuff
a7c7c889dbec27938222c5823eb378f5a26aef40
[ "MIT" ]
null
null
null
; $Id$; ;; @file ; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, AMD64. ; ; ; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; [section .data] ; g_fCalibrated: dd 0 g_OverheadAdj: dd 0 [section .text] extern KPRF_ENTER extern KPRF_LEAVE global _penter global _pexit ;ifdef UNDEFINED global common_return_path global common_overhead global common_no_overhead global calibrate global calib_inner_update_minimum global calib_inner_next global calib_outer_dec global calib_outer_inc global calib_done global calib_nullproc ;endif ;; ; On x86 the call to this function has been observed to be put before ; creating the stack frame, as the very first instruction in the function. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 _penter: ; save volatile register and get the time stamp. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; setting up the enter call frame mov r8d, edx shl r8, 32 or r8, rax ; param 3 - the timestamp mov [rsp + 20h], r8 ; save the tsc for later use. lea rdx, [rsp + 8*8 + 28h] ; Param 2 - default frame pointer mov rcx, [rdx] ; Param 1 - The function address ; MSC seems to put the _penter both before and after the typical sub rsp, xxh ; statement as if it cannot quite make up its mind. We'll try adjust for this ; to make the unwinding a bit more accurate wrt to longjmp/throw. But since ; there are also an uneven amount of push/pop around the _penter/_pexit we ; can never really make a perfect job of it. sigh. cmp word [rcx - 5 - 4], 08348h ; sub rsp, imm8 jne .not_byte_sub cmp byte [rcx - 5 - 2], 0ech jne .not_byte_sub movzx eax, byte [rcx - 5 - 1] ; imm8 add rdx, rax jmp .call_prf_enter .not_byte_sub: cmp word [rcx - 5 - 7], 08148h ; sub rsp, imm32 jne .not_dword_sub cmp byte [rcx - 5 - 5], 0ech jne .not_dword_sub mov eax, [rcx - 5 - 4] ; imm32 add rdx, rax ; jmp .call_prf_enter .not_dword_sub: .call_prf_enter: call KPRF_ENTER jmp common_return_path ;; ; On x86 the call to this function has been observed to be put right before ; return instruction. This fact matters since since we have to calc the same ; stack address as in _penter. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 _pexit: ; save volatile register and get the time stamp. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; setting up the enter call frame mov r8d, edx shl r8, 32 or r8, rax ; param 3 - the timestamp mov [rsp + 20h], r8 ; save the tsc for later use. lea rdx, [rsp + 8*8 + 28h] ; Param 2 - frame pointer. mov rcx, [rdx] ; Param 1 - The function address ; MSC some times put the _pexit before the add rsp, xxh. To try match up with ; any adjustments made in _penter, we'll try detect this. cmp word [rcx], 08348h ; add rsp, imm8 jne .not_byte_sub cmp byte [rcx + 2], 0c4h jne .not_byte_sub movzx eax, byte [rcx + 3] ; imm8 add rdx, rax jmp .call_prf_leave .not_byte_sub: cmp word [rcx], 08148h ; add rsp, imm32 jne .not_dword_sub cmp byte [rcx + 2], 0c4h jne .not_dword_sub mov eax, [rcx + 3] ; imm32 add rdx, rax ; jmp .call_prf_leave .not_dword_sub: .call_prf_leave: call KPRF_LEAVE jmp common_return_path ;; ; This is the common return path for both the enter and exit hooks. ; It's kept common because we can then use the same overhead adjustment ; and save some calibration efforts. It also saves space :-) align 16 common_return_path: ; Update overhead test rax, rax jz common_no_overhead cmp byte [g_fCalibrated wrt rip], 0 jnz common_overhead call calibrate common_overhead: mov rcx, rax ; rcx <- pointer to overhead counter. mov eax, [g_OverheadAdj wrt rip]; apply the adjustment before reading tsc sub [rsp + 20h], rax rdtsc shl rdx, 32 or rdx, rax ; rdx = 64-bit timestamp sub rdx, [rsp + 20h] ; rdx = elapsed lock add [rcx], rdx ; update counter. common_no_overhead: ; restore volatile registers. add rsp, 28h pop r11 pop r10 pop r9 pop r8 pop rcx popfq pop rdx pop rax ret ;; ; Data rsi points to while we're calibrating. struc CALIBDATA .Overhead resq 1 .Profiled resq 1 .EnterTS resq 1 .Min resq 1 endstruc align 16 ;; ; Do necessary calibrations. ; calibrate: ; prolog - save everything push rbp pushfq push rax ; pushaq push rbx push rcx push rdx push rdi push rsi push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 mov rbp, rsp sub rsp, CALIBDATA_size mov rsi, rsp ; rsi points to the CALIBDATA and rsp, -16 ; ; Indicate that we have finished calibrating. ; mov eax, 1 xchg dword [g_fCalibrated wrt rip], eax ; ; The outer loop - find the right adjustment. ; mov ebx, 200h ; loop counter. calib_outer_loop: ; ; The inner loop - calls the function number of times to establish a ; good minimum value ; mov ecx, 200h mov dword [rsi + CALIBDATA.Min], 0ffffffffh mov dword [rsi + CALIBDATA.Min + 4], 07fffffffh calib_inner_loop: ; zero the overhead and profiled times. xor eax, eax mov [rsi + CALIBDATA.Overhead], rax mov [rsi + CALIBDATA.Profiled], rax call calib_nullproc ; subtract the overhead mov rax, [rsi + CALIBDATA.Profiled] sub rax, [rsi + CALIBDATA.Overhead] ; update the minimum value. bt rax, 63 jc near calib_outer_dec ; if negative, just simplify and shortcut cmp rax, [rsi + CALIBDATA.Min] jge calib_inner_next calib_inner_update_minimum: mov [rsi + CALIBDATA.Min], rax calib_inner_next: loop calib_inner_loop ; Is the minimum value acceptable? test dword [rsi + CALIBDATA.Min + 4], 80000000h jnz calib_outer_dec ; simplify if negative. cmp dword [rsi + CALIBDATA.Min + 4], 0 jnz calib_outer_inc ; this shouldn't be possible cmp dword [rsi + CALIBDATA.Min], 1fh jbe calib_outer_dec ; too low - 2 ticks per pair is the minimum! ;cmp dword [rsi + CALIBDATA.Min], 30h ;jbe calib_done ; this is fine! cmp dword [rsi + CALIBDATA.Min], 70h ; - a bit weird... jbe calib_outer_next ; do the full 200h*200h iteration calib_outer_inc: inc dword [g_OverheadAdj wrt rip] jmp calib_outer_next calib_outer_dec: cmp dword [g_OverheadAdj wrt rip], 1 je calib_done dec dword [g_OverheadAdj wrt rip] calib_outer_next: dec ebx jnz calib_outer_loop calib_done: ; epilog - restore it all. mov rsp, rbp pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rsi pop rdi pop rdx pop rcx pop rbx pop rax popfq pop rbp ret ;; ; The calibration _penter - this must be identical to the real thing except for the KPRF call. align 16 calib_penter: ; This part must be identical past the rdtsc. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; store the entry / stack frame. mov r8d, edx shl r8, 32 or r8, rax mov [rsp + 20h], r8 mov [rsi + CALIBDATA.EnterTS], r8 lea rax, [rsi + CALIBDATA.Overhead] jmp common_overhead ;; ; The calibration _pexit - this must be identical to the real thing except for the KPRF call. align 16 calib_pexit: ; This part must be identical past the rdtsc. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; store the entry / stack frame. mov r8d, edx shl r8, 32 or r8, rax mov [rsp + 20h], r8 sub r8, [rsi + CALIBDATA.EnterTS] add [rsi + CALIBDATA.Profiled], r8 lea rax, [rsi + CALIBDATA.EnterTS] jmp common_overhead ;; ; The 'function' we're profiling. ; The general idea is that each pair should take something like 2-10 ticks. ; ; (Btw. If we don't use multiple pairs here, we end up with the wrong result.) align 16 calib_nullproc: call calib_penter ;0 call calib_pexit call calib_penter ;1 call calib_pexit call calib_penter ;2 call calib_pexit call calib_penter ;3 call calib_pexit call calib_penter ;4 call calib_pexit call calib_penter ;5 call calib_pexit call calib_penter ;6 call calib_pexit call calib_penter ;7 call calib_pexit call calib_penter ;8 call calib_pexit call calib_penter ;9 call calib_pexit call calib_penter ;a call calib_pexit call calib_penter ;b call calib_pexit call calib_penter ;c call calib_pexit call calib_penter ;d call calib_pexit call calib_penter ;e call calib_pexit call calib_penter ;f call calib_pexit ret ; ; Dummy stack check function. ; global __chkstk __chkstk: ret
28.661053
94
0.547157
c052dc22cf3c485ce8c06d11b92124104d085c24
5,330
asm
Assembly
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_1046.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_1046.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_1046.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 %r12 push %r13 push %r14 push %r8 push %rbx push %rcx lea addresses_D_ht+0xe2a8, %r13 nop nop nop nop nop sub $51393, %r8 mov $0x6162636465666768, %r12 movq %r12, %xmm5 movups %xmm5, (%r13) cmp %r13, %r13 lea addresses_WC_ht+0x1328, %r14 sub %rcx, %rcx mov (%r14), %ebx nop nop nop nop cmp $65067, %r14 lea addresses_normal_ht+0x10b0, %r14 nop cmp $4499, %r11 mov (%r14), %r12w nop nop nop nop and %r11, %r11 lea addresses_D_ht+0x1d780, %r13 nop nop nop and $9998, %r14 mov $0x6162636465666768, %rbx movq %rbx, %xmm3 vmovups %ymm3, (%r13) sub %r11, %r11 lea addresses_UC_ht+0x137a8, %r8 nop nop nop cmp $41391, %rbx mov $0x6162636465666768, %r14 movq %r14, (%r8) nop inc %r11 lea addresses_normal_ht+0x1a8, %r11 nop xor $53696, %r14 movb (%r11), %bl nop nop nop add %rbx, %rbx pop %rcx pop %rbx pop %r8 pop %r14 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r9 push %rax push %rsi // Faulty Load lea addresses_WT+0x17fa8, %r12 dec %rsi vmovups (%r12), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %rax lea oracles, %rsi and $0xff, %rax shlq $12, %rax mov (%rsi,%rax,1), %rax pop %rsi pop %rax pop %r9 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'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 */
46.754386
2,999
0.659099
66da51d4556dc56aebcca40974493baf9acc3ffd
525
asm
Assembly
oeis/080/A080566.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/080/A080566.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/080/A080566.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A080566: Partial sums of A079000. ; Submitted by Jamie Morken ; 1,5,11,18,26,35,46,59,74,90,107,125,144,164,185,208,233,260,289,320,353,387,422,458,495,533,572,612,653,695,738,782,827,874,923,974,1027,1082,1139,1198,1259,1322,1387,1454,1523,1593,1664,1736,1809,1883,1958 lpb $0 mov $2,$0 sub $0,1 seq $2,79000 ; a(n) is taken to be the smallest positive integer greater than a(n-1) which is consistent with the condition "n is a member of the sequence if and only if a(n) is odd". add $3,$2 lpe mov $0,$3 add $0,1
40.384615
208
0.710476
1b9e6ff1e29e2c983ac339683802b131559d062b
347
asm
Assembly
oeis/249/A249600.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/249/A249600.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/249/A249600.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A249600: Decimal expansion of 1/phi + 1/phi^3 + 1/phi^5, where phi is the Golden Ratio. ; 9,4,4,2,7,1,9,0,9,9,9,9,1,5,8,7,8,5,6,3,6,6,9,4,6,7,4,9,2,5,1,0,4,9,4,1,7,6,2,4,7,3,4,3,8,4,4,6,1,0,2,8,9,7,0,8,3,5,8,8,9,8,1,6,4,2,0,8,3,7,0,2,5,5,1,2,1,9,5,9,7,6,5,7,6,5,7,6,3,3,5,1,5,1,2 add $0,1 seq $0,10532 ; Decimal expansion of square root of 80.
57.833333
191
0.587896
54535f37a57916df1d11c94eea06411754c83122
634
asm
Assembly
randomly-solved-programs/binary input and output.asm
informramiz/Assembly-Language-Programs
600d8f737a09ef4c133b686918501fba56dd586e
[ "Apache-2.0" ]
null
null
null
randomly-solved-programs/binary input and output.asm
informramiz/Assembly-Language-Programs
600d8f737a09ef4c133b686918501fba56dd586e
[ "Apache-2.0" ]
null
null
null
randomly-solved-programs/binary input and output.asm
informramiz/Assembly-Language-Programs
600d8f737a09ef4c133b686918501fba56dd586e
[ "Apache-2.0" ]
null
null
null
.MODEL SMALL .STACK 100H .DATA INPUT_MSG DB 'Enter a number: $' BIT_MSG DB 0AH,0DH,'Number of 1 bits are:$' .CODE MAIN PROC ;making the DS to point to data segment MOV AX,@DATA MOV DS,AX XOR BX,BX MOV AH,1 INT 21H INPUT: CMP AL,0DH JE END_WHILE_ AND AL,01H SHL BX,1 OR BL,AL INT 21H JMP INPUT END_WHILE_: MOV AH,2 MOV CX,16 PRINT: ROL BX,1 JC ONE JNC ZERO ONE : MOV DL,'1' INT 21H LOOP PRINT JMP EXIT ZERO: MOV DL,'0' INT 21H LOOP PRINT EXIT: MOV AH,4CH INT 21H MAIN ENDP END MAIN
10.745763
47
0.550473
935cf13388e1f2610c014f05a10d852930749e24
44,495
asm
Assembly
user/bigfile.asm
joshiamey/xv6-riscv-fall19
c7098eff109b6548bd16b25996ce47e64925e854
[ "MIT-0" ]
1
2020-10-23T12:35:52.000Z
2020-10-23T12:35:52.000Z
user/bigfile.asm
joshiamey/xv6-riscv-fall19
c7098eff109b6548bd16b25996ce47e64925e854
[ "MIT-0" ]
null
null
null
user/bigfile.asm
joshiamey/xv6-riscv-fall19
c7098eff109b6548bd16b25996ce47e64925e854
[ "MIT-0" ]
null
null
null
user/_bigfile: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <main>: #include "kernel/fcntl.h" #include "kernel/fs.h" int main() { 0: bd010113 addi sp,sp,-1072 4: 42113423 sd ra,1064(sp) 8: 42813023 sd s0,1056(sp) c: 40913c23 sd s1,1048(sp) 10: 41213823 sd s2,1040(sp) 14: 41313423 sd s3,1032(sp) 18: 41413023 sd s4,1024(sp) 1c: 43010413 addi s0,sp,1072 char buf[BSIZE]; int fd, i, blocks; fd = open("big.file", O_CREATE | O_WRONLY); 20: 20100593 li a1,513 24: 00001517 auipc a0,0x1 28: 8fc50513 addi a0,a0,-1796 # 920 <malloc+0xe4> 2c: 00000097 auipc ra,0x0 30: 412080e7 jalr 1042(ra) # 43e <open> if(fd < 0){ 34: 00054b63 bltz a0,4a <main+0x4a> 38: 892a mv s2,a0 3a: 4481 li s1,0 *(int*)buf = blocks; int cc = write(fd, buf, sizeof(buf)); if(cc <= 0) break; blocks++; if (blocks % 100 == 0) 3c: 06400993 li s3,100 printf("."); 40: 00001a17 auipc s4,0x1 44: 920a0a13 addi s4,s4,-1760 # 960 <malloc+0x124> 48: a01d j 6e <main+0x6e> printf("bigfile: cannot open big.file for writing\n"); 4a: 00001517 auipc a0,0x1 4e: 8e650513 addi a0,a0,-1818 # 930 <malloc+0xf4> 52: 00000097 auipc ra,0x0 56: 72c080e7 jalr 1836(ra) # 77e <printf> exit(-1); 5a: 557d li a0,-1 5c: 00000097 auipc ra,0x0 60: 3a2080e7 jalr 930(ra) # 3fe <exit> printf("."); 64: 8552 mv a0,s4 66: 00000097 auipc ra,0x0 6a: 718080e7 jalr 1816(ra) # 77e <printf> *(int*)buf = blocks; 6e: bc942823 sw s1,-1072(s0) int cc = write(fd, buf, sizeof(buf)); 72: 40000613 li a2,1024 76: bd040593 addi a1,s0,-1072 7a: 854a mv a0,s2 7c: 00000097 auipc ra,0x0 80: 3a2080e7 jalr 930(ra) # 41e <write> if(cc <= 0) 84: 00a05a63 blez a0,98 <main+0x98> blocks++; 88: 0014879b addiw a5,s1,1 8c: 0007849b sext.w s1,a5 if (blocks % 100 == 0) 90: 0337e7bb remw a5,a5,s3 94: ffe9 bnez a5,6e <main+0x6e> 96: b7f9 j 64 <main+0x64> } printf("\nwrote %d blocks\n", blocks); 98: 85a6 mv a1,s1 9a: 00001517 auipc a0,0x1 9e: 8ce50513 addi a0,a0,-1842 # 968 <malloc+0x12c> a2: 00000097 auipc ra,0x0 a6: 6dc080e7 jalr 1756(ra) # 77e <printf> if(blocks != 65803) { aa: 67c1 lui a5,0x10 ac: 10b78793 addi a5,a5,267 # 1010b <__global_pointer$+0xeeb2> b0: 00f48f63 beq s1,a5,ce <main+0xce> printf("bigfile: file is too small\n"); b4: 00001517 auipc a0,0x1 b8: 8cc50513 addi a0,a0,-1844 # 980 <malloc+0x144> bc: 00000097 auipc ra,0x0 c0: 6c2080e7 jalr 1730(ra) # 77e <printf> exit(-1); c4: 557d li a0,-1 c6: 00000097 auipc ra,0x0 ca: 338080e7 jalr 824(ra) # 3fe <exit> } close(fd); ce: 854a mv a0,s2 d0: 00000097 auipc ra,0x0 d4: 356080e7 jalr 854(ra) # 426 <close> fd = open("big.file", O_RDONLY); d8: 4581 li a1,0 da: 00001517 auipc a0,0x1 de: 84650513 addi a0,a0,-1978 # 920 <malloc+0xe4> e2: 00000097 auipc ra,0x0 e6: 35c080e7 jalr 860(ra) # 43e <open> ea: 892a mv s2,a0 if(fd < 0){ printf("bigfile: cannot re-open big.file for reading\n"); exit(-1); } for(i = 0; i < blocks; i++){ ec: 4481 li s1,0 if(fd < 0){ ee: 04054463 bltz a0,136 <main+0x136> for(i = 0; i < blocks; i++){ f2: 69c1 lui s3,0x10 f4: 10b98993 addi s3,s3,267 # 1010b <__global_pointer$+0xeeb2> int cc = read(fd, buf, sizeof(buf)); f8: 40000613 li a2,1024 fc: bd040593 addi a1,s0,-1072 100: 854a mv a0,s2 102: 00000097 auipc ra,0x0 106: 314080e7 jalr 788(ra) # 416 <read> if(cc <= 0){ 10a: 04a05363 blez a0,150 <main+0x150> printf("bigfile: read error at block %d\n", i); exit(-1); } if(*(int*)buf != i){ 10e: bd042583 lw a1,-1072(s0) 112: 04959d63 bne a1,s1,16c <main+0x16c> for(i = 0; i < blocks; i++){ 116: 2485 addiw s1,s1,1 118: ff3490e3 bne s1,s3,f8 <main+0xf8> *(int*)buf, i); exit(-1); } } printf("bigfile done; ok\n"); 11c: 00001517 auipc a0,0x1 120: 90c50513 addi a0,a0,-1780 # a28 <malloc+0x1ec> 124: 00000097 auipc ra,0x0 128: 65a080e7 jalr 1626(ra) # 77e <printf> exit(0); 12c: 4501 li a0,0 12e: 00000097 auipc ra,0x0 132: 2d0080e7 jalr 720(ra) # 3fe <exit> printf("bigfile: cannot re-open big.file for reading\n"); 136: 00001517 auipc a0,0x1 13a: 86a50513 addi a0,a0,-1942 # 9a0 <malloc+0x164> 13e: 00000097 auipc ra,0x0 142: 640080e7 jalr 1600(ra) # 77e <printf> exit(-1); 146: 557d li a0,-1 148: 00000097 auipc ra,0x0 14c: 2b6080e7 jalr 694(ra) # 3fe <exit> printf("bigfile: read error at block %d\n", i); 150: 85a6 mv a1,s1 152: 00001517 auipc a0,0x1 156: 87e50513 addi a0,a0,-1922 # 9d0 <malloc+0x194> 15a: 00000097 auipc ra,0x0 15e: 624080e7 jalr 1572(ra) # 77e <printf> exit(-1); 162: 557d li a0,-1 164: 00000097 auipc ra,0x0 168: 29a080e7 jalr 666(ra) # 3fe <exit> printf("bigfile: read the wrong data (%d) for block %d\n", 16c: 8626 mv a2,s1 16e: 00001517 auipc a0,0x1 172: 88a50513 addi a0,a0,-1910 # 9f8 <malloc+0x1bc> 176: 00000097 auipc ra,0x0 17a: 608080e7 jalr 1544(ra) # 77e <printf> exit(-1); 17e: 557d li a0,-1 180: 00000097 auipc ra,0x0 184: 27e080e7 jalr 638(ra) # 3fe <exit> 0000000000000188 <strcpy>: #include "kernel/fcntl.h" #include "user/user.h" char* strcpy(char *s, const char *t) { 188: 1141 addi sp,sp,-16 18a: e422 sd s0,8(sp) 18c: 0800 addi s0,sp,16 char *os; os = s; while((*s++ = *t++) != 0) 18e: 87aa mv a5,a0 190: 0585 addi a1,a1,1 192: 0785 addi a5,a5,1 194: fff5c703 lbu a4,-1(a1) 198: fee78fa3 sb a4,-1(a5) 19c: fb75 bnez a4,190 <strcpy+0x8> ; return os; } 19e: 6422 ld s0,8(sp) 1a0: 0141 addi sp,sp,16 1a2: 8082 ret 00000000000001a4 <strcmp>: int strcmp(const char *p, const char *q) { 1a4: 1141 addi sp,sp,-16 1a6: e422 sd s0,8(sp) 1a8: 0800 addi s0,sp,16 while(*p && *p == *q) 1aa: 00054783 lbu a5,0(a0) 1ae: cb91 beqz a5,1c2 <strcmp+0x1e> 1b0: 0005c703 lbu a4,0(a1) 1b4: 00f71763 bne a4,a5,1c2 <strcmp+0x1e> p++, q++; 1b8: 0505 addi a0,a0,1 1ba: 0585 addi a1,a1,1 while(*p && *p == *q) 1bc: 00054783 lbu a5,0(a0) 1c0: fbe5 bnez a5,1b0 <strcmp+0xc> return (uchar)*p - (uchar)*q; 1c2: 0005c503 lbu a0,0(a1) } 1c6: 40a7853b subw a0,a5,a0 1ca: 6422 ld s0,8(sp) 1cc: 0141 addi sp,sp,16 1ce: 8082 ret 00000000000001d0 <strlen>: uint strlen(const char *s) { 1d0: 1141 addi sp,sp,-16 1d2: e422 sd s0,8(sp) 1d4: 0800 addi s0,sp,16 int n; for(n = 0; s[n]; n++) 1d6: 00054783 lbu a5,0(a0) 1da: cf91 beqz a5,1f6 <strlen+0x26> 1dc: 0505 addi a0,a0,1 1de: 87aa mv a5,a0 1e0: 4685 li a3,1 1e2: 9e89 subw a3,a3,a0 1e4: 00f6853b addw a0,a3,a5 1e8: 0785 addi a5,a5,1 1ea: fff7c703 lbu a4,-1(a5) 1ee: fb7d bnez a4,1e4 <strlen+0x14> ; return n; } 1f0: 6422 ld s0,8(sp) 1f2: 0141 addi sp,sp,16 1f4: 8082 ret for(n = 0; s[n]; n++) 1f6: 4501 li a0,0 1f8: bfe5 j 1f0 <strlen+0x20> 00000000000001fa <memset>: void* memset(void *dst, int c, uint n) { 1fa: 1141 addi sp,sp,-16 1fc: e422 sd s0,8(sp) 1fe: 0800 addi s0,sp,16 char *cdst = (char *) dst; int i; for(i = 0; i < n; i++){ 200: ce09 beqz a2,21a <memset+0x20> 202: 87aa mv a5,a0 204: fff6071b addiw a4,a2,-1 208: 1702 slli a4,a4,0x20 20a: 9301 srli a4,a4,0x20 20c: 0705 addi a4,a4,1 20e: 972a add a4,a4,a0 cdst[i] = c; 210: 00b78023 sb a1,0(a5) for(i = 0; i < n; i++){ 214: 0785 addi a5,a5,1 216: fee79de3 bne a5,a4,210 <memset+0x16> } return dst; } 21a: 6422 ld s0,8(sp) 21c: 0141 addi sp,sp,16 21e: 8082 ret 0000000000000220 <strchr>: char* strchr(const char *s, char c) { 220: 1141 addi sp,sp,-16 222: e422 sd s0,8(sp) 224: 0800 addi s0,sp,16 for(; *s; s++) 226: 00054783 lbu a5,0(a0) 22a: cb99 beqz a5,240 <strchr+0x20> if(*s == c) 22c: 00f58763 beq a1,a5,23a <strchr+0x1a> for(; *s; s++) 230: 0505 addi a0,a0,1 232: 00054783 lbu a5,0(a0) 236: fbfd bnez a5,22c <strchr+0xc> return (char*)s; return 0; 238: 4501 li a0,0 } 23a: 6422 ld s0,8(sp) 23c: 0141 addi sp,sp,16 23e: 8082 ret return 0; 240: 4501 li a0,0 242: bfe5 j 23a <strchr+0x1a> 0000000000000244 <gets>: char* gets(char *buf, int max) { 244: 711d addi sp,sp,-96 246: ec86 sd ra,88(sp) 248: e8a2 sd s0,80(sp) 24a: e4a6 sd s1,72(sp) 24c: e0ca sd s2,64(sp) 24e: fc4e sd s3,56(sp) 250: f852 sd s4,48(sp) 252: f456 sd s5,40(sp) 254: f05a sd s6,32(sp) 256: ec5e sd s7,24(sp) 258: 1080 addi s0,sp,96 25a: 8baa mv s7,a0 25c: 8a2e mv s4,a1 int i, cc; char c; for(i=0; i+1 < max; ){ 25e: 892a mv s2,a0 260: 4481 li s1,0 cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; if(c == '\n' || c == '\r') 262: 4aa9 li s5,10 264: 4b35 li s6,13 for(i=0; i+1 < max; ){ 266: 89a6 mv s3,s1 268: 2485 addiw s1,s1,1 26a: 0344d863 bge s1,s4,29a <gets+0x56> cc = read(0, &c, 1); 26e: 4605 li a2,1 270: faf40593 addi a1,s0,-81 274: 4501 li a0,0 276: 00000097 auipc ra,0x0 27a: 1a0080e7 jalr 416(ra) # 416 <read> if(cc < 1) 27e: 00a05e63 blez a0,29a <gets+0x56> buf[i++] = c; 282: faf44783 lbu a5,-81(s0) 286: 00f90023 sb a5,0(s2) if(c == '\n' || c == '\r') 28a: 01578763 beq a5,s5,298 <gets+0x54> 28e: 0905 addi s2,s2,1 290: fd679be3 bne a5,s6,266 <gets+0x22> for(i=0; i+1 < max; ){ 294: 89a6 mv s3,s1 296: a011 j 29a <gets+0x56> 298: 89a6 mv s3,s1 break; } buf[i] = '\0'; 29a: 99de add s3,s3,s7 29c: 00098023 sb zero,0(s3) return buf; } 2a0: 855e mv a0,s7 2a2: 60e6 ld ra,88(sp) 2a4: 6446 ld s0,80(sp) 2a6: 64a6 ld s1,72(sp) 2a8: 6906 ld s2,64(sp) 2aa: 79e2 ld s3,56(sp) 2ac: 7a42 ld s4,48(sp) 2ae: 7aa2 ld s5,40(sp) 2b0: 7b02 ld s6,32(sp) 2b2: 6be2 ld s7,24(sp) 2b4: 6125 addi sp,sp,96 2b6: 8082 ret 00000000000002b8 <stat>: int stat(const char *n, struct stat *st) { 2b8: 1101 addi sp,sp,-32 2ba: ec06 sd ra,24(sp) 2bc: e822 sd s0,16(sp) 2be: e426 sd s1,8(sp) 2c0: e04a sd s2,0(sp) 2c2: 1000 addi s0,sp,32 2c4: 892e mv s2,a1 int fd; int r; fd = open(n, O_RDONLY); 2c6: 4581 li a1,0 2c8: 00000097 auipc ra,0x0 2cc: 176080e7 jalr 374(ra) # 43e <open> if(fd < 0) 2d0: 02054563 bltz a0,2fa <stat+0x42> 2d4: 84aa mv s1,a0 return -1; r = fstat(fd, st); 2d6: 85ca mv a1,s2 2d8: 00000097 auipc ra,0x0 2dc: 17e080e7 jalr 382(ra) # 456 <fstat> 2e0: 892a mv s2,a0 close(fd); 2e2: 8526 mv a0,s1 2e4: 00000097 auipc ra,0x0 2e8: 142080e7 jalr 322(ra) # 426 <close> return r; } 2ec: 854a mv a0,s2 2ee: 60e2 ld ra,24(sp) 2f0: 6442 ld s0,16(sp) 2f2: 64a2 ld s1,8(sp) 2f4: 6902 ld s2,0(sp) 2f6: 6105 addi sp,sp,32 2f8: 8082 ret return -1; 2fa: 597d li s2,-1 2fc: bfc5 j 2ec <stat+0x34> 00000000000002fe <atoi>: int atoi(const char *s) { 2fe: 1141 addi sp,sp,-16 300: e422 sd s0,8(sp) 302: 0800 addi s0,sp,16 int n; n = 0; while('0' <= *s && *s <= '9') 304: 00054603 lbu a2,0(a0) 308: fd06079b addiw a5,a2,-48 30c: 0ff7f793 andi a5,a5,255 310: 4725 li a4,9 312: 02f76963 bltu a4,a5,344 <atoi+0x46> 316: 86aa mv a3,a0 n = 0; 318: 4501 li a0,0 while('0' <= *s && *s <= '9') 31a: 45a5 li a1,9 n = n*10 + *s++ - '0'; 31c: 0685 addi a3,a3,1 31e: 0025179b slliw a5,a0,0x2 322: 9fa9 addw a5,a5,a0 324: 0017979b slliw a5,a5,0x1 328: 9fb1 addw a5,a5,a2 32a: fd07851b addiw a0,a5,-48 while('0' <= *s && *s <= '9') 32e: 0006c603 lbu a2,0(a3) 332: fd06071b addiw a4,a2,-48 336: 0ff77713 andi a4,a4,255 33a: fee5f1e3 bgeu a1,a4,31c <atoi+0x1e> return n; } 33e: 6422 ld s0,8(sp) 340: 0141 addi sp,sp,16 342: 8082 ret n = 0; 344: 4501 li a0,0 346: bfe5 j 33e <atoi+0x40> 0000000000000348 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 348: 1141 addi sp,sp,-16 34a: e422 sd s0,8(sp) 34c: 0800 addi s0,sp,16 char *dst; const char *src; dst = vdst; src = vsrc; if (src > dst) { 34e: 02b57663 bgeu a0,a1,37a <memmove+0x32> while(n-- > 0) 352: 02c05163 blez a2,374 <memmove+0x2c> 356: fff6079b addiw a5,a2,-1 35a: 1782 slli a5,a5,0x20 35c: 9381 srli a5,a5,0x20 35e: 0785 addi a5,a5,1 360: 97aa add a5,a5,a0 dst = vdst; 362: 872a mv a4,a0 *dst++ = *src++; 364: 0585 addi a1,a1,1 366: 0705 addi a4,a4,1 368: fff5c683 lbu a3,-1(a1) 36c: fed70fa3 sb a3,-1(a4) while(n-- > 0) 370: fee79ae3 bne a5,a4,364 <memmove+0x1c> src += n; while(n-- > 0) *--dst = *--src; } return vdst; } 374: 6422 ld s0,8(sp) 376: 0141 addi sp,sp,16 378: 8082 ret dst += n; 37a: 00c50733 add a4,a0,a2 src += n; 37e: 95b2 add a1,a1,a2 while(n-- > 0) 380: fec05ae3 blez a2,374 <memmove+0x2c> 384: fff6079b addiw a5,a2,-1 388: 1782 slli a5,a5,0x20 38a: 9381 srli a5,a5,0x20 38c: fff7c793 not a5,a5 390: 97ba add a5,a5,a4 *--dst = *--src; 392: 15fd addi a1,a1,-1 394: 177d addi a4,a4,-1 396: 0005c683 lbu a3,0(a1) 39a: 00d70023 sb a3,0(a4) while(n-- > 0) 39e: fee79ae3 bne a5,a4,392 <memmove+0x4a> 3a2: bfc9 j 374 <memmove+0x2c> 00000000000003a4 <memcmp>: int memcmp(const void *s1, const void *s2, uint n) { 3a4: 1141 addi sp,sp,-16 3a6: e422 sd s0,8(sp) 3a8: 0800 addi s0,sp,16 const char *p1 = s1, *p2 = s2; while (n-- > 0) { 3aa: ca05 beqz a2,3da <memcmp+0x36> 3ac: fff6069b addiw a3,a2,-1 3b0: 1682 slli a3,a3,0x20 3b2: 9281 srli a3,a3,0x20 3b4: 0685 addi a3,a3,1 3b6: 96aa add a3,a3,a0 if (*p1 != *p2) { 3b8: 00054783 lbu a5,0(a0) 3bc: 0005c703 lbu a4,0(a1) 3c0: 00e79863 bne a5,a4,3d0 <memcmp+0x2c> return *p1 - *p2; } p1++; 3c4: 0505 addi a0,a0,1 p2++; 3c6: 0585 addi a1,a1,1 while (n-- > 0) { 3c8: fed518e3 bne a0,a3,3b8 <memcmp+0x14> } return 0; 3cc: 4501 li a0,0 3ce: a019 j 3d4 <memcmp+0x30> return *p1 - *p2; 3d0: 40e7853b subw a0,a5,a4 } 3d4: 6422 ld s0,8(sp) 3d6: 0141 addi sp,sp,16 3d8: 8082 ret return 0; 3da: 4501 li a0,0 3dc: bfe5 j 3d4 <memcmp+0x30> 00000000000003de <memcpy>: void * memcpy(void *dst, const void *src, uint n) { 3de: 1141 addi sp,sp,-16 3e0: e406 sd ra,8(sp) 3e2: e022 sd s0,0(sp) 3e4: 0800 addi s0,sp,16 return memmove(dst, src, n); 3e6: 00000097 auipc ra,0x0 3ea: f62080e7 jalr -158(ra) # 348 <memmove> } 3ee: 60a2 ld ra,8(sp) 3f0: 6402 ld s0,0(sp) 3f2: 0141 addi sp,sp,16 3f4: 8082 ret 00000000000003f6 <fork>: # generated by usys.pl - do not edit #include "kernel/syscall.h" .global fork fork: li a7, SYS_fork 3f6: 4885 li a7,1 ecall 3f8: 00000073 ecall ret 3fc: 8082 ret 00000000000003fe <exit>: .global exit exit: li a7, SYS_exit 3fe: 4889 li a7,2 ecall 400: 00000073 ecall ret 404: 8082 ret 0000000000000406 <wait>: .global wait wait: li a7, SYS_wait 406: 488d li a7,3 ecall 408: 00000073 ecall ret 40c: 8082 ret 000000000000040e <pipe>: .global pipe pipe: li a7, SYS_pipe 40e: 4891 li a7,4 ecall 410: 00000073 ecall ret 414: 8082 ret 0000000000000416 <read>: .global read read: li a7, SYS_read 416: 4895 li a7,5 ecall 418: 00000073 ecall ret 41c: 8082 ret 000000000000041e <write>: .global write write: li a7, SYS_write 41e: 48c1 li a7,16 ecall 420: 00000073 ecall ret 424: 8082 ret 0000000000000426 <close>: .global close close: li a7, SYS_close 426: 48d5 li a7,21 ecall 428: 00000073 ecall ret 42c: 8082 ret 000000000000042e <kill>: .global kill kill: li a7, SYS_kill 42e: 4899 li a7,6 ecall 430: 00000073 ecall ret 434: 8082 ret 0000000000000436 <exec>: .global exec exec: li a7, SYS_exec 436: 489d li a7,7 ecall 438: 00000073 ecall ret 43c: 8082 ret 000000000000043e <open>: .global open open: li a7, SYS_open 43e: 48bd li a7,15 ecall 440: 00000073 ecall ret 444: 8082 ret 0000000000000446 <mknod>: .global mknod mknod: li a7, SYS_mknod 446: 48c5 li a7,17 ecall 448: 00000073 ecall ret 44c: 8082 ret 000000000000044e <unlink>: .global unlink unlink: li a7, SYS_unlink 44e: 48c9 li a7,18 ecall 450: 00000073 ecall ret 454: 8082 ret 0000000000000456 <fstat>: .global fstat fstat: li a7, SYS_fstat 456: 48a1 li a7,8 ecall 458: 00000073 ecall ret 45c: 8082 ret 000000000000045e <link>: .global link link: li a7, SYS_link 45e: 48cd li a7,19 ecall 460: 00000073 ecall ret 464: 8082 ret 0000000000000466 <mkdir>: .global mkdir mkdir: li a7, SYS_mkdir 466: 48d1 li a7,20 ecall 468: 00000073 ecall ret 46c: 8082 ret 000000000000046e <chdir>: .global chdir chdir: li a7, SYS_chdir 46e: 48a5 li a7,9 ecall 470: 00000073 ecall ret 474: 8082 ret 0000000000000476 <dup>: .global dup dup: li a7, SYS_dup 476: 48a9 li a7,10 ecall 478: 00000073 ecall ret 47c: 8082 ret 000000000000047e <getpid>: .global getpid getpid: li a7, SYS_getpid 47e: 48ad li a7,11 ecall 480: 00000073 ecall ret 484: 8082 ret 0000000000000486 <sbrk>: .global sbrk sbrk: li a7, SYS_sbrk 486: 48b1 li a7,12 ecall 488: 00000073 ecall ret 48c: 8082 ret 000000000000048e <sleep>: .global sleep sleep: li a7, SYS_sleep 48e: 48b5 li a7,13 ecall 490: 00000073 ecall ret 494: 8082 ret 0000000000000496 <uptime>: .global uptime uptime: li a7, SYS_uptime 496: 48b9 li a7,14 ecall 498: 00000073 ecall ret 49c: 8082 ret 000000000000049e <ntas>: .global ntas ntas: li a7, SYS_ntas 49e: 48d9 li a7,22 ecall 4a0: 00000073 ecall ret 4a4: 8082 ret 00000000000004a6 <putc>: static char digits[] = "0123456789ABCDEF"; static void putc(int fd, char c) { 4a6: 1101 addi sp,sp,-32 4a8: ec06 sd ra,24(sp) 4aa: e822 sd s0,16(sp) 4ac: 1000 addi s0,sp,32 4ae: feb407a3 sb a1,-17(s0) write(fd, &c, 1); 4b2: 4605 li a2,1 4b4: fef40593 addi a1,s0,-17 4b8: 00000097 auipc ra,0x0 4bc: f66080e7 jalr -154(ra) # 41e <write> } 4c0: 60e2 ld ra,24(sp) 4c2: 6442 ld s0,16(sp) 4c4: 6105 addi sp,sp,32 4c6: 8082 ret 00000000000004c8 <printint>: static void printint(int fd, int xx, int base, int sgn) { 4c8: 7139 addi sp,sp,-64 4ca: fc06 sd ra,56(sp) 4cc: f822 sd s0,48(sp) 4ce: f426 sd s1,40(sp) 4d0: f04a sd s2,32(sp) 4d2: ec4e sd s3,24(sp) 4d4: 0080 addi s0,sp,64 4d6: 84aa mv s1,a0 char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 4d8: c299 beqz a3,4de <printint+0x16> 4da: 0805c863 bltz a1,56a <printint+0xa2> neg = 1; x = -xx; } else { x = xx; 4de: 2581 sext.w a1,a1 neg = 0; 4e0: 4881 li a7,0 4e2: fc040693 addi a3,s0,-64 } i = 0; 4e6: 4701 li a4,0 do{ buf[i++] = digits[x % base]; 4e8: 2601 sext.w a2,a2 4ea: 00000517 auipc a0,0x0 4ee: 55e50513 addi a0,a0,1374 # a48 <digits> 4f2: 883a mv a6,a4 4f4: 2705 addiw a4,a4,1 4f6: 02c5f7bb remuw a5,a1,a2 4fa: 1782 slli a5,a5,0x20 4fc: 9381 srli a5,a5,0x20 4fe: 97aa add a5,a5,a0 500: 0007c783 lbu a5,0(a5) 504: 00f68023 sb a5,0(a3) }while((x /= base) != 0); 508: 0005879b sext.w a5,a1 50c: 02c5d5bb divuw a1,a1,a2 510: 0685 addi a3,a3,1 512: fec7f0e3 bgeu a5,a2,4f2 <printint+0x2a> if(neg) 516: 00088b63 beqz a7,52c <printint+0x64> buf[i++] = '-'; 51a: fd040793 addi a5,s0,-48 51e: 973e add a4,a4,a5 520: 02d00793 li a5,45 524: fef70823 sb a5,-16(a4) 528: 0028071b addiw a4,a6,2 while(--i >= 0) 52c: 02e05863 blez a4,55c <printint+0x94> 530: fc040793 addi a5,s0,-64 534: 00e78933 add s2,a5,a4 538: fff78993 addi s3,a5,-1 53c: 99ba add s3,s3,a4 53e: 377d addiw a4,a4,-1 540: 1702 slli a4,a4,0x20 542: 9301 srli a4,a4,0x20 544: 40e989b3 sub s3,s3,a4 putc(fd, buf[i]); 548: fff94583 lbu a1,-1(s2) 54c: 8526 mv a0,s1 54e: 00000097 auipc ra,0x0 552: f58080e7 jalr -168(ra) # 4a6 <putc> while(--i >= 0) 556: 197d addi s2,s2,-1 558: ff3918e3 bne s2,s3,548 <printint+0x80> } 55c: 70e2 ld ra,56(sp) 55e: 7442 ld s0,48(sp) 560: 74a2 ld s1,40(sp) 562: 7902 ld s2,32(sp) 564: 69e2 ld s3,24(sp) 566: 6121 addi sp,sp,64 568: 8082 ret x = -xx; 56a: 40b005bb negw a1,a1 neg = 1; 56e: 4885 li a7,1 x = -xx; 570: bf8d j 4e2 <printint+0x1a> 0000000000000572 <vprintf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void vprintf(int fd, const char *fmt, va_list ap) { 572: 7119 addi sp,sp,-128 574: fc86 sd ra,120(sp) 576: f8a2 sd s0,112(sp) 578: f4a6 sd s1,104(sp) 57a: f0ca sd s2,96(sp) 57c: ecce sd s3,88(sp) 57e: e8d2 sd s4,80(sp) 580: e4d6 sd s5,72(sp) 582: e0da sd s6,64(sp) 584: fc5e sd s7,56(sp) 586: f862 sd s8,48(sp) 588: f466 sd s9,40(sp) 58a: f06a sd s10,32(sp) 58c: ec6e sd s11,24(sp) 58e: 0100 addi s0,sp,128 char *s; int c, i, state; state = 0; for(i = 0; fmt[i]; i++){ 590: 0005c903 lbu s2,0(a1) 594: 18090f63 beqz s2,732 <vprintf+0x1c0> 598: 8aaa mv s5,a0 59a: 8b32 mv s6,a2 59c: 00158493 addi s1,a1,1 state = 0; 5a0: 4981 li s3,0 if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 5a2: 02500a13 li s4,37 if(c == 'd'){ 5a6: 06400c13 li s8,100 printint(fd, va_arg(ap, int), 10, 1); } else if(c == 'l') { 5aa: 06c00c93 li s9,108 printint(fd, va_arg(ap, uint64), 10, 0); } else if(c == 'x') { 5ae: 07800d13 li s10,120 printint(fd, va_arg(ap, int), 16, 0); } else if(c == 'p') { 5b2: 07000d93 li s11,112 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 5b6: 00000b97 auipc s7,0x0 5ba: 492b8b93 addi s7,s7,1170 # a48 <digits> 5be: a839 j 5dc <vprintf+0x6a> putc(fd, c); 5c0: 85ca mv a1,s2 5c2: 8556 mv a0,s5 5c4: 00000097 auipc ra,0x0 5c8: ee2080e7 jalr -286(ra) # 4a6 <putc> 5cc: a019 j 5d2 <vprintf+0x60> } else if(state == '%'){ 5ce: 01498f63 beq s3,s4,5ec <vprintf+0x7a> for(i = 0; fmt[i]; i++){ 5d2: 0485 addi s1,s1,1 5d4: fff4c903 lbu s2,-1(s1) 5d8: 14090d63 beqz s2,732 <vprintf+0x1c0> c = fmt[i] & 0xff; 5dc: 0009079b sext.w a5,s2 if(state == 0){ 5e0: fe0997e3 bnez s3,5ce <vprintf+0x5c> if(c == '%'){ 5e4: fd479ee3 bne a5,s4,5c0 <vprintf+0x4e> state = '%'; 5e8: 89be mv s3,a5 5ea: b7e5 j 5d2 <vprintf+0x60> if(c == 'd'){ 5ec: 05878063 beq a5,s8,62c <vprintf+0xba> } else if(c == 'l') { 5f0: 05978c63 beq a5,s9,648 <vprintf+0xd6> } else if(c == 'x') { 5f4: 07a78863 beq a5,s10,664 <vprintf+0xf2> } else if(c == 'p') { 5f8: 09b78463 beq a5,s11,680 <vprintf+0x10e> printptr(fd, va_arg(ap, uint64)); } else if(c == 's'){ 5fc: 07300713 li a4,115 600: 0ce78663 beq a5,a4,6cc <vprintf+0x15a> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 604: 06300713 li a4,99 608: 0ee78e63 beq a5,a4,704 <vprintf+0x192> putc(fd, va_arg(ap, uint)); } else if(c == '%'){ 60c: 11478863 beq a5,s4,71c <vprintf+0x1aa> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 610: 85d2 mv a1,s4 612: 8556 mv a0,s5 614: 00000097 auipc ra,0x0 618: e92080e7 jalr -366(ra) # 4a6 <putc> putc(fd, c); 61c: 85ca mv a1,s2 61e: 8556 mv a0,s5 620: 00000097 auipc ra,0x0 624: e86080e7 jalr -378(ra) # 4a6 <putc> } state = 0; 628: 4981 li s3,0 62a: b765 j 5d2 <vprintf+0x60> printint(fd, va_arg(ap, int), 10, 1); 62c: 008b0913 addi s2,s6,8 630: 4685 li a3,1 632: 4629 li a2,10 634: 000b2583 lw a1,0(s6) 638: 8556 mv a0,s5 63a: 00000097 auipc ra,0x0 63e: e8e080e7 jalr -370(ra) # 4c8 <printint> 642: 8b4a mv s6,s2 state = 0; 644: 4981 li s3,0 646: b771 j 5d2 <vprintf+0x60> printint(fd, va_arg(ap, uint64), 10, 0); 648: 008b0913 addi s2,s6,8 64c: 4681 li a3,0 64e: 4629 li a2,10 650: 000b2583 lw a1,0(s6) 654: 8556 mv a0,s5 656: 00000097 auipc ra,0x0 65a: e72080e7 jalr -398(ra) # 4c8 <printint> 65e: 8b4a mv s6,s2 state = 0; 660: 4981 li s3,0 662: bf85 j 5d2 <vprintf+0x60> printint(fd, va_arg(ap, int), 16, 0); 664: 008b0913 addi s2,s6,8 668: 4681 li a3,0 66a: 4641 li a2,16 66c: 000b2583 lw a1,0(s6) 670: 8556 mv a0,s5 672: 00000097 auipc ra,0x0 676: e56080e7 jalr -426(ra) # 4c8 <printint> 67a: 8b4a mv s6,s2 state = 0; 67c: 4981 li s3,0 67e: bf91 j 5d2 <vprintf+0x60> printptr(fd, va_arg(ap, uint64)); 680: 008b0793 addi a5,s6,8 684: f8f43423 sd a5,-120(s0) 688: 000b3983 ld s3,0(s6) putc(fd, '0'); 68c: 03000593 li a1,48 690: 8556 mv a0,s5 692: 00000097 auipc ra,0x0 696: e14080e7 jalr -492(ra) # 4a6 <putc> putc(fd, 'x'); 69a: 85ea mv a1,s10 69c: 8556 mv a0,s5 69e: 00000097 auipc ra,0x0 6a2: e08080e7 jalr -504(ra) # 4a6 <putc> 6a6: 4941 li s2,16 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 6a8: 03c9d793 srli a5,s3,0x3c 6ac: 97de add a5,a5,s7 6ae: 0007c583 lbu a1,0(a5) 6b2: 8556 mv a0,s5 6b4: 00000097 auipc ra,0x0 6b8: df2080e7 jalr -526(ra) # 4a6 <putc> for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4) 6bc: 0992 slli s3,s3,0x4 6be: 397d addiw s2,s2,-1 6c0: fe0914e3 bnez s2,6a8 <vprintf+0x136> printptr(fd, va_arg(ap, uint64)); 6c4: f8843b03 ld s6,-120(s0) state = 0; 6c8: 4981 li s3,0 6ca: b721 j 5d2 <vprintf+0x60> s = va_arg(ap, char*); 6cc: 008b0993 addi s3,s6,8 6d0: 000b3903 ld s2,0(s6) if(s == 0) 6d4: 02090163 beqz s2,6f6 <vprintf+0x184> while(*s != 0){ 6d8: 00094583 lbu a1,0(s2) 6dc: c9a1 beqz a1,72c <vprintf+0x1ba> putc(fd, *s); 6de: 8556 mv a0,s5 6e0: 00000097 auipc ra,0x0 6e4: dc6080e7 jalr -570(ra) # 4a6 <putc> s++; 6e8: 0905 addi s2,s2,1 while(*s != 0){ 6ea: 00094583 lbu a1,0(s2) 6ee: f9e5 bnez a1,6de <vprintf+0x16c> s = va_arg(ap, char*); 6f0: 8b4e mv s6,s3 state = 0; 6f2: 4981 li s3,0 6f4: bdf9 j 5d2 <vprintf+0x60> s = "(null)"; 6f6: 00000917 auipc s2,0x0 6fa: 34a90913 addi s2,s2,842 # a40 <malloc+0x204> while(*s != 0){ 6fe: 02800593 li a1,40 702: bff1 j 6de <vprintf+0x16c> putc(fd, va_arg(ap, uint)); 704: 008b0913 addi s2,s6,8 708: 000b4583 lbu a1,0(s6) 70c: 8556 mv a0,s5 70e: 00000097 auipc ra,0x0 712: d98080e7 jalr -616(ra) # 4a6 <putc> 716: 8b4a mv s6,s2 state = 0; 718: 4981 li s3,0 71a: bd65 j 5d2 <vprintf+0x60> putc(fd, c); 71c: 85d2 mv a1,s4 71e: 8556 mv a0,s5 720: 00000097 auipc ra,0x0 724: d86080e7 jalr -634(ra) # 4a6 <putc> state = 0; 728: 4981 li s3,0 72a: b565 j 5d2 <vprintf+0x60> s = va_arg(ap, char*); 72c: 8b4e mv s6,s3 state = 0; 72e: 4981 li s3,0 730: b54d j 5d2 <vprintf+0x60> } } } 732: 70e6 ld ra,120(sp) 734: 7446 ld s0,112(sp) 736: 74a6 ld s1,104(sp) 738: 7906 ld s2,96(sp) 73a: 69e6 ld s3,88(sp) 73c: 6a46 ld s4,80(sp) 73e: 6aa6 ld s5,72(sp) 740: 6b06 ld s6,64(sp) 742: 7be2 ld s7,56(sp) 744: 7c42 ld s8,48(sp) 746: 7ca2 ld s9,40(sp) 748: 7d02 ld s10,32(sp) 74a: 6de2 ld s11,24(sp) 74c: 6109 addi sp,sp,128 74e: 8082 ret 0000000000000750 <fprintf>: void fprintf(int fd, const char *fmt, ...) { 750: 715d addi sp,sp,-80 752: ec06 sd ra,24(sp) 754: e822 sd s0,16(sp) 756: 1000 addi s0,sp,32 758: e010 sd a2,0(s0) 75a: e414 sd a3,8(s0) 75c: e818 sd a4,16(s0) 75e: ec1c sd a5,24(s0) 760: 03043023 sd a6,32(s0) 764: 03143423 sd a7,40(s0) va_list ap; va_start(ap, fmt); 768: fe843423 sd s0,-24(s0) vprintf(fd, fmt, ap); 76c: 8622 mv a2,s0 76e: 00000097 auipc ra,0x0 772: e04080e7 jalr -508(ra) # 572 <vprintf> } 776: 60e2 ld ra,24(sp) 778: 6442 ld s0,16(sp) 77a: 6161 addi sp,sp,80 77c: 8082 ret 000000000000077e <printf>: void printf(const char *fmt, ...) { 77e: 711d addi sp,sp,-96 780: ec06 sd ra,24(sp) 782: e822 sd s0,16(sp) 784: 1000 addi s0,sp,32 786: e40c sd a1,8(s0) 788: e810 sd a2,16(s0) 78a: ec14 sd a3,24(s0) 78c: f018 sd a4,32(s0) 78e: f41c sd a5,40(s0) 790: 03043823 sd a6,48(s0) 794: 03143c23 sd a7,56(s0) va_list ap; va_start(ap, fmt); 798: 00840613 addi a2,s0,8 79c: fec43423 sd a2,-24(s0) vprintf(1, fmt, ap); 7a0: 85aa mv a1,a0 7a2: 4505 li a0,1 7a4: 00000097 auipc ra,0x0 7a8: dce080e7 jalr -562(ra) # 572 <vprintf> } 7ac: 60e2 ld ra,24(sp) 7ae: 6442 ld s0,16(sp) 7b0: 6125 addi sp,sp,96 7b2: 8082 ret 00000000000007b4 <free>: static Header base; static Header *freep; void free(void *ap) { 7b4: 1141 addi sp,sp,-16 7b6: e422 sd s0,8(sp) 7b8: 0800 addi s0,sp,16 Header *bp, *p; bp = (Header*)ap - 1; 7ba: ff050693 addi a3,a0,-16 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7be: 00000797 auipc a5,0x0 7c2: 2a27b783 ld a5,674(a5) # a60 <freep> 7c6: a805 j 7f6 <free+0x42> 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; 7c8: 4618 lw a4,8(a2) 7ca: 9db9 addw a1,a1,a4 7cc: feb52c23 sw a1,-8(a0) bp->s.ptr = p->s.ptr->s.ptr; 7d0: 6398 ld a4,0(a5) 7d2: 6318 ld a4,0(a4) 7d4: fee53823 sd a4,-16(a0) 7d8: a091 j 81c <free+0x68> } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 7da: ff852703 lw a4,-8(a0) 7de: 9e39 addw a2,a2,a4 7e0: c790 sw a2,8(a5) p->s.ptr = bp->s.ptr; 7e2: ff053703 ld a4,-16(a0) 7e6: e398 sd a4,0(a5) 7e8: a099 j 82e <free+0x7a> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7ea: 6398 ld a4,0(a5) 7ec: 00e7e463 bltu a5,a4,7f4 <free+0x40> 7f0: 00e6ea63 bltu a3,a4,804 <free+0x50> { 7f4: 87ba mv a5,a4 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7f6: fed7fae3 bgeu a5,a3,7ea <free+0x36> 7fa: 6398 ld a4,0(a5) 7fc: 00e6e463 bltu a3,a4,804 <free+0x50> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 800: fee7eae3 bltu a5,a4,7f4 <free+0x40> if(bp + bp->s.size == p->s.ptr){ 804: ff852583 lw a1,-8(a0) 808: 6390 ld a2,0(a5) 80a: 02059713 slli a4,a1,0x20 80e: 9301 srli a4,a4,0x20 810: 0712 slli a4,a4,0x4 812: 9736 add a4,a4,a3 814: fae60ae3 beq a2,a4,7c8 <free+0x14> bp->s.ptr = p->s.ptr; 818: fec53823 sd a2,-16(a0) if(p + p->s.size == bp){ 81c: 4790 lw a2,8(a5) 81e: 02061713 slli a4,a2,0x20 822: 9301 srli a4,a4,0x20 824: 0712 slli a4,a4,0x4 826: 973e add a4,a4,a5 828: fae689e3 beq a3,a4,7da <free+0x26> } else p->s.ptr = bp; 82c: e394 sd a3,0(a5) freep = p; 82e: 00000717 auipc a4,0x0 832: 22f73923 sd a5,562(a4) # a60 <freep> } 836: 6422 ld s0,8(sp) 838: 0141 addi sp,sp,16 83a: 8082 ret 000000000000083c <malloc>: return freep; } void* malloc(uint nbytes) { 83c: 7139 addi sp,sp,-64 83e: fc06 sd ra,56(sp) 840: f822 sd s0,48(sp) 842: f426 sd s1,40(sp) 844: f04a sd s2,32(sp) 846: ec4e sd s3,24(sp) 848: e852 sd s4,16(sp) 84a: e456 sd s5,8(sp) 84c: e05a sd s6,0(sp) 84e: 0080 addi s0,sp,64 Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 850: 02051493 slli s1,a0,0x20 854: 9081 srli s1,s1,0x20 856: 04bd addi s1,s1,15 858: 8091 srli s1,s1,0x4 85a: 0014899b addiw s3,s1,1 85e: 0485 addi s1,s1,1 if((prevp = freep) == 0){ 860: 00000517 auipc a0,0x0 864: 20053503 ld a0,512(a0) # a60 <freep> 868: c515 beqz a0,894 <malloc+0x58> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 86a: 611c ld a5,0(a0) if(p->s.size >= nunits){ 86c: 4798 lw a4,8(a5) 86e: 02977f63 bgeu a4,s1,8ac <malloc+0x70> 872: 8a4e mv s4,s3 874: 0009871b sext.w a4,s3 878: 6685 lui a3,0x1 87a: 00d77363 bgeu a4,a3,880 <malloc+0x44> 87e: 6a05 lui s4,0x1 880: 000a0b1b sext.w s6,s4 p = sbrk(nu * sizeof(Header)); 884: 004a1a1b slliw s4,s4,0x4 p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 888: 00000917 auipc s2,0x0 88c: 1d890913 addi s2,s2,472 # a60 <freep> if(p == (char*)-1) 890: 5afd li s5,-1 892: a88d j 904 <malloc+0xc8> base.s.ptr = freep = prevp = &base; 894: 00000797 auipc a5,0x0 898: 1d478793 addi a5,a5,468 # a68 <base> 89c: 00000717 auipc a4,0x0 8a0: 1cf73223 sd a5,452(a4) # a60 <freep> 8a4: e39c sd a5,0(a5) base.s.size = 0; 8a6: 0007a423 sw zero,8(a5) if(p->s.size >= nunits){ 8aa: b7e1 j 872 <malloc+0x36> if(p->s.size == nunits) 8ac: 02e48b63 beq s1,a4,8e2 <malloc+0xa6> p->s.size -= nunits; 8b0: 4137073b subw a4,a4,s3 8b4: c798 sw a4,8(a5) p += p->s.size; 8b6: 1702 slli a4,a4,0x20 8b8: 9301 srli a4,a4,0x20 8ba: 0712 slli a4,a4,0x4 8bc: 97ba add a5,a5,a4 p->s.size = nunits; 8be: 0137a423 sw s3,8(a5) freep = prevp; 8c2: 00000717 auipc a4,0x0 8c6: 18a73f23 sd a0,414(a4) # a60 <freep> return (void*)(p + 1); 8ca: 01078513 addi a0,a5,16 if((p = morecore(nunits)) == 0) return 0; } } 8ce: 70e2 ld ra,56(sp) 8d0: 7442 ld s0,48(sp) 8d2: 74a2 ld s1,40(sp) 8d4: 7902 ld s2,32(sp) 8d6: 69e2 ld s3,24(sp) 8d8: 6a42 ld s4,16(sp) 8da: 6aa2 ld s5,8(sp) 8dc: 6b02 ld s6,0(sp) 8de: 6121 addi sp,sp,64 8e0: 8082 ret prevp->s.ptr = p->s.ptr; 8e2: 6398 ld a4,0(a5) 8e4: e118 sd a4,0(a0) 8e6: bff1 j 8c2 <malloc+0x86> hp->s.size = nu; 8e8: 01652423 sw s6,8(a0) free((void*)(hp + 1)); 8ec: 0541 addi a0,a0,16 8ee: 00000097 auipc ra,0x0 8f2: ec6080e7 jalr -314(ra) # 7b4 <free> return freep; 8f6: 00093503 ld a0,0(s2) if((p = morecore(nunits)) == 0) 8fa: d971 beqz a0,8ce <malloc+0x92> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 8fc: 611c ld a5,0(a0) if(p->s.size >= nunits){ 8fe: 4798 lw a4,8(a5) 900: fa9776e3 bgeu a4,s1,8ac <malloc+0x70> if(p == freep) 904: 00093703 ld a4,0(s2) 908: 853e mv a0,a5 90a: fef719e3 bne a4,a5,8fc <malloc+0xc0> p = sbrk(nu * sizeof(Header)); 90e: 8552 mv a0,s4 910: 00000097 auipc ra,0x0 914: b76080e7 jalr -1162(ra) # 486 <sbrk> if(p == (char*)-1) 918: fd5518e3 bne a0,s5,8e8 <malloc+0xac> return 0; 91c: 4501 li a0,0 91e: bf45 j 8ce <malloc+0x92>
30.20706
74
0.467603
5ff89dbc5f7339bb70fbf69c77cf5e84f1659a0b
345
asm
Assembly
programs/oeis/162/A162786.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/162/A162786.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/162/A162786.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A162786: a(n) = A162526(n)/6. ; 6,7,8,9,10,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277 mov $1,$0 trn $1,1 seq $1,6005 ; The odd prime numbers together with 1. sub $1,6 max $0,$1 add $0,6
34.5
211
0.672464
cd3552656ce852916911e9d548c9839e9fd74442
1,420
asm
Assembly
scripts/route12gateupstairs.asm
etdv-thevoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
1
2022-01-09T05:28:52.000Z
2022-01-09T05:28:52.000Z
scripts/route12gateupstairs.asm
ETDV-TheVoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
null
null
null
scripts/route12gateupstairs.asm
ETDV-TheVoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
null
null
null
Route12GateUpstairsScript: jp DisableAutoTextBoxDrawing Route12GateUpstairsTextPointers: dw Route12GateUpstairsText1 dw Route12GateUpstairsText2 dw Route12GateUpstairsText3 Route12GateUpstairsText1: TX_ASM CheckEvent EVENT_GOT_TM39, 1 jr c, .asm_0ad3c ld hl, TM39PreReceiveText call PrintText lb bc, TM_39, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedTM39Text call PrintText SetEvent EVENT_GOT_TM39 jr .asm_4ba56 .BagFull ld hl, TM39NoRoomText call PrintText jr .asm_4ba56 .asm_0ad3c ld hl, TM39ExplanationText call PrintText .asm_4ba56 jp TextScriptEnd TM39PreReceiveText: TX_FAR _TM39PreReceiveText db "@" ReceivedTM39Text: TX_FAR _ReceivedTM39Text TX_SFX_ITEM_1 db "@" TM39ExplanationText: TX_FAR _TM39ExplanationText db "@" TM39NoRoomText: TX_FAR _TM39NoRoomText db "@" Route12GateUpstairsText2: TX_ASM ld hl, Route12GateUpstairsText_495b8 jp GateUpstairsScript_PrintIfFacingUp Route12GateUpstairsText_495b8: TX_FAR _Route12GateUpstairsText_495b8 db "@" Route12GateUpstairsText3: TX_ASM ld hl, Route12GateUpstairsText_495c4 jp GateUpstairsScript_PrintIfFacingUp Route12GateUpstairsText_495c4: TX_FAR _Route12GateUpstairsText_495c4 db "@" GateUpstairsScript_PrintIfFacingUp: ld a, [wSpriteStateData1 + 9] cp SPRITE_FACING_UP jr z, .up ld a, $1 jr .done .up call PrintText xor a .done ld [wDoNotWaitForButtonPressAfterDisplayingText], a jp TextScriptEnd
17.974684
52
0.821831
ae248cc8c847ac1e8bc89378709eaf72a1c73e84
10,140
asm
Assembly
src/test/ref/primes-1000-2.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
2
2022-03-01T02:21:14.000Z
2022-03-01T04:33:35.000Z
src/test/ref/primes-1000-2.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
src/test/ref/primes-1000-2.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
// Calculates the 1000 first primes // From A Comparison of Language Speed, The Transactor, March 1987, Volume 7, Issue 5 // http://csbruce.com/cbm/transactor/pdfs/trans_v7_i05.pdf // Commodore 64 PRG executable file .file [name="primes-1000-2.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .const SIZEOF_UNSIGNED_INT = 2 .label print_screen = $400 .label print_char_cursor = $b // The number currently being tested for whether it is a prime .label potential = $10 // The last index to test. It is the smallest index where PRIMES[test_last] > sqr(potential) .label test_last = $12 // The index into PRIMES[] used for prime testing. It runs from 2 to test_last for each number tested. .label test_idx = $d // The index of the last prime we put into the PRIME[] table .label prime_idx = $13 .segment Code main: { .label __0 = $e .label __14 = 2 .label __15 = 2 // PRIMES[1] = 2 lda #<2 sta PRIMES+1*SIZEOF_UNSIGNED_INT lda #>2 sta PRIMES+1*SIZEOF_UNSIGNED_INT+1 // PRIMES[2] = 3 lda #<3 sta PRIMES+2*SIZEOF_UNSIGNED_INT lda #>3 sta PRIMES+2*SIZEOF_UNSIGNED_INT+1 lda #<print_screen sta.z print_char_cursor lda #>print_screen sta.z print_char_cursor+1 lda #<2 sta.z prime_idx lda #>2 sta.z prime_idx+1 lda #<3 sta.z potential lda #>3 sta.z potential+1 lda #2 sta.z test_last __b1: // char p = (char)PRIMES[test_last] lda.z test_last asl tay lda PRIMES,y // mul8u(p, p) tax jsr mul8u // if(potential > mul8u(p, p)) lda.z potential+1 cmp.z __0+1 bne !+ lda.z potential cmp.z __0 beq __b2 !: bcc __b2 // test_last++; inc.z test_last __b2: // potential +=2 lda #2 clc adc.z potential sta.z potential bcc !+ inc.z potential+1 !: lda #2 sta.z test_idx __b3: // div16u8u(potential, (char)PRIMES[test_idx++]) lda.z test_idx asl tax lda PRIMES,x sta.z div16u8u.divisor jsr div16u8u // div16u8u(potential, (char)PRIMES[test_idx++]); inc.z test_idx // if(rem8u == 0) cpy #0 bne __b4 // potential +=2 lda #2 clc adc.z potential sta.z potential bcc !+ inc.z potential+1 !: lda #2 sta.z test_idx __b4: // while (test_idx<=test_last) lda.z test_last cmp.z test_idx bcs __b3 // PRIMES[++prime_idx] = potential; inc.z prime_idx bne !+ inc.z prime_idx+1 !: // PRIMES[++prime_idx] = potential lda.z prime_idx asl sta.z __14 lda.z prime_idx+1 rol sta.z __14+1 lda.z __15 clc adc #<PRIMES sta.z __15 lda.z __15+1 adc #>PRIMES sta.z __15+1 ldy #0 lda.z potential sta (__15),y iny lda.z potential+1 sta (__15),y // print_uint_decimal(potential) jsr print_uint_decimal // print_char(' ') lda #' ' jsr print_char // while(prime_idx<totalprimes) lda.z prime_idx+1 cmp #>$3e8 bcs !__b1+ jmp __b1 !__b1: bne !+ lda.z prime_idx cmp #<$3e8 bcs !__b1+ jmp __b1 !__b1: !: // } rts } // Perform binary multiplication of two unsigned 8-bit chars into a 16-bit unsigned int // __zp($e) unsigned int mul8u(__register(X) char a, __register(A) char b) mul8u: { .label mb = 2 .label res = $e .label return = $e // unsigned int mb = b sta.z mb lda #0 sta.z mb+1 sta.z res sta.z res+1 __b1: // while(a!=0) cpx #0 bne __b2 // } rts __b2: // a&1 txa and #1 // if( (a&1) != 0) cmp #0 beq __b3 // res = res + mb clc lda.z res adc.z mb sta.z res lda.z res+1 adc.z mb+1 sta.z res+1 __b3: // a = a>>1 txa lsr tax // mb = mb<<1 asl.z mb rol.z mb+1 jmp __b1 } // Divide unsigned 16-bit unsigned long dividend with a 8-bit unsigned char divisor // The 8-bit unsigned char remainder can be found in rem8u after the division // unsigned int div16u8u(__zp($10) unsigned int dividend, __zp(8) char divisor) div16u8u: { .label dividend = $10 .label divisor = 8 // unsigned char quotient_hi = divr8u(BYTE1(dividend), divisor, 0) lda.z dividend+1 sta.z divr8u.dividend ldy #0 jsr divr8u // unsigned char quotient_lo = divr8u(BYTE0(dividend), divisor, rem8u) lda.z dividend sta.z divr8u.dividend jsr divr8u // } rts } // Print a unsigned int as DECIMAL // void print_uint_decimal(__zp($10) unsigned int w) print_uint_decimal: { .label w = $10 // utoa(w, decimal_digits, DECIMAL) lda.z w sta.z utoa.value lda.z w+1 sta.z utoa.value+1 jsr utoa // print_str(decimal_digits) jsr print_str // } rts } // Print a single char // void print_char(__register(A) char ch) print_char: { // *(print_char_cursor++) = ch ldy #0 sta (print_char_cursor),y // *(print_char_cursor++) = ch; inc.z print_char_cursor bne !+ inc.z print_char_cursor+1 !: // } rts } // Performs division on two 8 bit unsigned chars and an initial remainder // Returns dividend/divisor. // The final remainder will be set into the global variable rem8u // Implemented using simple binary division // __zp(6) char divr8u(__zp(7) char dividend, __zp(8) char divisor, __register(Y) char rem) divr8u: { .label dividend = 7 .label quotient = 6 .label return = 6 .label divisor = 8 ldx #0 txa sta.z quotient __b1: // rem = rem << 1 tya asl tay // dividend & $80 lda #$80 and.z dividend // if( (dividend & $80) != 0 ) cmp #0 beq __b2 // rem = rem | 1 tya ora #1 tay __b2: // dividend = dividend << 1 asl.z dividend // quotient = quotient << 1 asl.z quotient // if(rem>=divisor) cpy.z divisor bcc __b3 // quotient++; inc.z quotient // rem = rem - divisor tya sec sbc.z divisor tay __b3: // for( char i : 0..7) inx cpx #8 bne __b1 // rem8u = rem // } rts } // Converts unsigned number value to a string representing it in RADIX format. // If the leading digits are zero they are not included in the string. // - value : The number to be converted to RADIX // - buffer : receives the string representing the number and zero-termination. // - radix : The radix to convert the number to (from the enum RADIX) // void utoa(__zp(2) unsigned int value, __zp(9) char *buffer, char radix) utoa: { .const max_digits = 5 .label value = 2 .label digit_value = 4 .label buffer = 9 .label digit = $d lda #<decimal_digits sta.z buffer lda #>decimal_digits sta.z buffer+1 ldx #0 txa sta.z digit __b1: // for( char digit=0; digit<max_digits-1; digit++ ) lda.z digit cmp #max_digits-1 bcc __b2 // *buffer++ = DIGITS[(char)value] ldx.z value lda DIGITS,x ldy #0 sta (buffer),y // *buffer++ = DIGITS[(char)value]; inc.z buffer bne !+ inc.z buffer+1 !: // *buffer = 0 lda #0 tay sta (buffer),y // } rts __b2: // unsigned int digit_value = digit_values[digit] lda.z digit asl tay lda RADIX_DECIMAL_VALUES,y sta.z digit_value lda RADIX_DECIMAL_VALUES+1,y sta.z digit_value+1 // if (started || value >= digit_value) cpx #0 bne __b5 cmp.z value+1 bne !+ lda.z digit_value cmp.z value beq __b5 !: bcc __b5 __b4: // for( char digit=0; digit<max_digits-1; digit++ ) inc.z digit jmp __b1 __b5: // utoa_append(buffer++, value, digit_value) jsr utoa_append // utoa_append(buffer++, value, digit_value) // value = utoa_append(buffer++, value, digit_value) // value = utoa_append(buffer++, value, digit_value); inc.z buffer bne !+ inc.z buffer+1 !: ldx #1 jmp __b4 } // Print a zero-terminated string // void print_str(__zp(9) char *str) print_str: { .label str = 9 lda #<decimal_digits sta.z str lda #>decimal_digits sta.z str+1 __b1: // while(*str) ldy #0 lda (str),y cmp #0 bne __b2 // } rts __b2: // print_char(*(str++)) ldy #0 lda (str),y jsr print_char // print_char(*(str++)); inc.z str bne !+ inc.z str+1 !: jmp __b1 } // Used to convert a single digit of an unsigned number value to a string representation // Counts a single digit up from '0' as long as the value is larger than sub. // Each time the digit is increased sub is subtracted from value. // - buffer : pointer to the char that receives the digit // - value : The value where the digit will be derived from // - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. // (For decimal the subs used are 10000, 1000, 100, 10, 1) // returns : the value reduced by sub * digit so that it is less than sub. // __zp(2) unsigned int utoa_append(__zp(9) char *buffer, __zp(2) unsigned int value, __zp(4) unsigned int sub) utoa_append: { .label buffer = 9 .label value = 2 .label sub = 4 .label return = 2 ldx #0 __b1: // while (value >= sub) lda.z sub+1 cmp.z value+1 bne !+ lda.z sub cmp.z value beq __b2 !: bcc __b2 // *buffer = DIGITS[digit] lda DIGITS,x ldy #0 sta (buffer),y // } rts __b2: // digit++; inx // value -= sub lda.z value sec sbc.z sub sta.z value lda.z value+1 sbc.z sub+1 sta.z value+1 jmp __b1 } .segment Data // The digits used for numbers DIGITS: .text "0123456789abcdef" // Values of decimal digits RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a // Digits used for storing the decimal unsigned int decimal_digits: .fill 6, 0 // Table that is filled with the primes we are finding PRIMES: .fill 2*$3e8, 0
22.236842
111
0.602959
07459c7b14c963b33624bb3bb1ba23ab120f6c03
1,704
asm
Assembly
libsrc/graphics/px8/w_plotpixl.asm
Toysoft/z88dk
f930bef9ac4feeec91a07303b79ddd9071131a24
[ "ClArtistic" ]
8
2017-01-18T12:02:17.000Z
2021-06-12T09:40:28.000Z
libsrc/graphics/px8/w_plotpixl.asm
Toysoft/z88dk
f930bef9ac4feeec91a07303b79ddd9071131a24
[ "ClArtistic" ]
1
2017-03-06T07:41:56.000Z
2017-03-06T07:41:56.000Z
libsrc/graphics/px8/w_plotpixl.asm
Toysoft/z88dk
f930bef9ac4feeec91a07303b79ddd9071131a24
[ "ClArtistic" ]
3
2017-03-07T03:19:40.000Z
2021-09-15T17:59:19.000Z
INCLUDE "graphics/grafix.inc" SECTION code_clib PUBLIC w_plotpixel EXTERN l_cmp EXTERN __gfx_coords EXTERN px8_conout ; ; $Id: w_plotpixl.asm, stefano - 2017 $ ; ; ****************************************************************** ; ; Plot pixel at (x,y) coordinate. ; ; Wide resolution (WORD based parameters) version by Stefano Bodrato ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; The (0,0) origin is placed at the top left corner. ; ; in: hl,de = (x,y) coordinate of pixel ; ; registers changed after return: ; ......../ixiy same ; afbcdehl/.... different ; .w_plotpixel push hl ld hl,maxy call l_cmp pop hl ret nc ; Return if Y overflows push de ld de,maxx call l_cmp pop de ret c ; Return if X overflows ld (__gfx_coords),hl ; store X ld (__gfx_coords+2),de ; store Y: COORDS must be 2 bytes wider push hl push de ld c,27 ; ESCape call px8_conout ld c,0xc7 ; PSET/PRESET call px8_conout ld c,1 ; PSET (PRESET=0) call px8_conout pop de ld c,e call px8_conout ; y pop hl push hl ld c,h call px8_conout ; x (msb) pop hl ld c,l jp px8_conout ; x (lsb)
25.432836
93
0.431925
8cd97c94e1f32e414a308c6e364fb4a2ffdb36b8
1,146
asm
Assembly
src_32bit/get_encoding.asm
tedtheripper/EAN13-generator-hybrid
f394d5e5663d1ec59c1bc22e48a69d712b61d4bd
[ "MIT" ]
null
null
null
src_32bit/get_encoding.asm
tedtheripper/EAN13-generator-hybrid
f394d5e5663d1ec59c1bc22e48a69d712b61d4bd
[ "MIT" ]
null
null
null
src_32bit/get_encoding.asm
tedtheripper/EAN13-generator-hybrid
f394d5e5663d1ec59c1bc22e48a69d712b61d4bd
[ "MIT" ]
null
null
null
; Marcel Jarosz, ARKO 2020L, x86_2, Final version ; EAN-13 Barcode Generator SECTION .DATA encoding: db "AAAAAAAABABBAABBABAABBBAABAABBABBAABABBBAAABABABABABBAABBABA", 60, 0 SECTION .bss chosen_encoding: resb 20 SECTION .TEXT global _get_encoding extern puts _get_encoding: get_encoding: get_encoding_function: ;copies correct part of the encoding push ebp mov ebp, esp sub esp, 0 mov ebx, [ebp+8] movzx eax, byte [ebx] mov ecx, encoding deb: sub eax, 0x30 mov ebx, 6 mul ebx add ecx, eax mov eax, ecx add eax, 0x06 mov ebx, chosen_encoding loop_en: movzx edx, byte [ecx] h1: mov [ebx], dl h2: inc ecx h3: inc ebx h4: cmp ecx, eax h5: je enc_exit jmp loop_en enc_exit: ;push chosen_encoding ;call puts ;add esp, 4 mov esp, ebp mov eax, chosen_encoding pop ebp ret
23.387755
86
0.513962
067ff2bf074876c63cf6b2f0f61faba2b61b2874
223
asm
Assembly
programs/oeis/161/A161836.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/161/A161836.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/161/A161836.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A161836: Number of concave-convex hexagons in the Y-toothpick structure of A160120 after n rounds. ; 0,0,0,0,3,3,3,3,9,15 mov $1,3 sub $1,$0 bin $1,23220 dif $1,2 mod $1,10 add $1,10 mod $1,9 sub $1,1 mul $1,3 mov $0,$1
15.928571
100
0.663677
b0fb404ac7c8cb4eac288232e3ac7c2b78475fc7
482
asm
Assembly
programs/oeis/077/A077432.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/077/A077432.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/077/A077432.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A077432: Squares of the form u'v'w, where in decimal representation u=n^2, v=2*n^2 and w=n^2 possibly with a leading zero. ; 121,484,91809,163216,255025,367236,499849,64128064,81162081,100200100,121242121,144288144,169338169,196392196,225450225,256512256,289578289,324648324,361722361,400800400,441882441,484968484,52910580529 cal $0,77431 ; n repeated in decimal representation, but separated by enough zeros that the square has the pattern (n^2)(2n^2)(n^2). pow $0,2 mov $1,$0
68.857143
203
0.786307
80accbab79aba9cb24aa77b08a7d32dd129f0a2a
6,854
asm
Assembly
I2C_Slave_Code_Dev/I2C_Logger/asm/src/lcd_cdm_16100_4bit.asm
CmdrZin/chips_avr_examples
d4b57a8efd6aff2a678adef4fd405e6359e891e6
[ "MIT" ]
5
2017-04-17T15:11:40.000Z
2021-12-13T23:52:09.000Z
I2C_Slave_Code_Dev/I2C_Logger/asm/src/lcd_cdm_16100_4bit.asm
CmdrZin/chips_avr_examples
d4b57a8efd6aff2a678adef4fd405e6359e891e6
[ "MIT" ]
null
null
null
I2C_Slave_Code_Dev/I2C_Logger/asm/src/lcd_cdm_16100_4bit.asm
CmdrZin/chips_avr_examples
d4b57a8efd6aff2a678adef4fd405e6359e891e6
[ "MIT" ]
null
null
null
/* * LCD_CDM-16100 Display Driver - 4 bit interface * * org: 9/29/2014 * auth: Nels "Chip" Pearson * * Target: LCD_CDM-116100 Demo Board w/ LCD display and keypad I/O, 8MHz * LCD control: ST7066U * * Resources * SRAM * * IO * */ .equ LC_CLEAR_DISPLAY = 0x01 ; Write 0x20 to DDRAM and reset AC to 00. [1.52ms] .equ LC_RETURN_HOME = 0x02 ; Reset AC to 00 and return cursor to home. [1.52ms] .equ LC_SET_ENTRY_MODE = 0x04 ; b1: I/D, b0: S Set cursor move and display shift. [37us] .equ LC_DISPLAY_ONOFF = 0x08 ; b2: Display, b1: Cursor, b0: Cursor position. [37us] .equ LC_CURSOR_DISPLAY_SHIFT = 0x10 ; b3: Select, b2: R/L. [37us] .equ LC_SET_FUNCTION = 0x20 ; b4: Interface, b3: Lines, b2: Font. [37us] .equ LC_SET_CGRAM_ADRS = 0x40 ; b5:0 CGRAM Address. [37us] .equ LC_SET_DDRAM_ADRS = 0x80 ; b6:0 DDRAM Address. [37us] .equ LCD_SHIFT_CURSOR_LEFT = 0b00000000 .equ LCD_SHIFT_CURSOR_RIGHT = 0b00000100 .equ LCD_SHIFT_DISPLAY_LEFT = 0b00001000 .equ LCD_SHIFT_DISPLAY_RIGHT = 0b00001100 ; PORTC bits .equ LCD_RS = 3 .equ LCD_RW = 2 .equ LCD_E = 1 /* * lcd_delay_40us() * Tweak delay loop based on CPU clock * Call twice for 80us and 39 times for 1.52ms * * For 8MHz * */ lcd_delay_40us: push R16 ; ldi R16, 40 ; 8 * 40 cycles ; 8 cycle loop = 1us ld1_loop1: nop nop nop nop nop dec R16 brne ld1_loop1 ; pop R16 ret /* * lcd_delay_1ms(n) * Tweak delay loop based on CPU clock * * input: R17 - n ms * For 8MHz * */ lcd_delay_1ms: push R16 ; ld1m_loop2: ldi R16, 25 ld1m_loop1: call lcd_delay_40us dec R16 brne ld1m_loop1 dec R17 brne ld1m_loop2 ; pop R16 ret /* * lcd_init() * Set up I/O and LDC module for 4 bit access. * * PortD.7:0 - Data 7:0 in/out * PortC.3 - RS out * PortC.2 - R/W out * PortC.1 - E out * */ lcd_init: ; Set up I/O sbi DDRC, LCD_RS sbi DDRC, LCD_RW sbi DDRC, LCD_E cbi PORTC, LCD_RS cbi PORTC, LCD_RW cbi PORTC, LCD_E ; Wait 40ms after power up. ldi R17, 40 call lcd_delay_1ms ; Interface starts as 8 bit access ldi R17, 0x20 ; Function set..chenage from 8bit to 4bit call lcd_write_ins_once ldi R17, 40 call lcd_delay_1ms ; Set interface for 4 bit access ldi R17, 0x2C ; Function set..MUST write TWICE call lcd_write_ins_nochk call lcd_delay_40us ldi R17, 40 call lcd_delay_1ms ; ; Set interface for 4 bit access ldi R17, 0x2C ; Function set..MUST write TWICE call lcd_write_ins_nochk call lcd_delay_40us ldi R17, 40 call lcd_delay_1ms ; call lcd_clear_display ; ldi R17, 0b00001110 ; Display ON, Cursor ON, Blink OFF call lcd_write_ins_nochk ldi R17, 1 call lcd_delay_1ms ; ldi R18, 1 ldi R19, 0 ; 1:Display Shift ON call lcd_set_entry_mode ; ret /* * Instruction Access * input: R17 - Data */ lcd_write_ins_chk: call lcd_ckeck_busy ; Blocking call while Busy lcd_write_ins_nochk: cbi PORTC, LCD_RS cbi PORTC, LCD_RW call lcd_raw_write swap R17 lcd_write_ins_once: call lcd_raw_write ret /* Blocking call while Busy */ lcd_ckeck_busy: push R17 lcb_loop00: call lcd_delay_40us ; wait 80us call lcd_delay_40us ; cbi PORTC, LCD_RS sbi PORTC, LCD_RW call lcd_raw_read ; read upper 4 bits push R17 call lcd_raw_read ; read upper 4 bits pop R17 lsl R17 ; test Busy bit..D7 brcs lcb_loop00 ; BS=1..Busy ; cbi PORTC, LCD_RS cbi PORTC, LCD_RW ; pop R17 ret /* * output: R17 - Data in */ lcd_raw_read: push R16 clr R16 out DDRD, R16 ; set for input ser R16 out PORTD, R16 ; turn on pull-ups ; sbi PORTC, LCD_E ; min PW = 500ns..4 cycles @ 8MHz nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop in R17, PORTD nop cbi PORTC, LCD_E ; pop R16 ret /* * output: R17 - Data out */ lcd_raw_write: push R16 ldi R16, 0xF0 out DDRD, R16 ; set for output nop nop ; out PORTD, R17 nop nop ; sbi PORTC, LCD_E ; min PW = 500ns..4 cycles @ 8MHz nop nop nop nop nop nop nop nop nop nop nop nop nop nop cbi PORTC, LCD_E ; pop R16 ret /* * lcd_clear_display() */ lcd_clear_display: ldi R17, LC_CLEAR_DISPLAY call lcd_write_ins_nochk ldi R17, 10 ; 1.52ms delay call lcd_delay_1ms ret /* * lcd_return_home() */ lcd_return_home: ldi R17, LC_RETURN_HOME call lcd_write_ins_nochk ldi R17, 10 ; 1.52ms delay call lcd_delay_1ms ret /* * lcd_set_entry_mode( direction, shift_enable ) * * input R18 Adrs Direction. 0: Left (Dec), 1:Right (Inc) * R19 Enable display shift. 0:False, 1:True */ lcd_set_entry_mode: ldi R17, LC_SET_ENTRY_MODE tst R18 breq lse_skip00 ori R17, 0x02 ; Inc and move cursor right ; lse_skip00: tst R19 breq lse_skip01 ori R17, 0x01 ; Display shift with cursor ; lse_skip01: call lcd_write_ins_nochk ldi R17, 1 call lcd_delay_1ms ; HACK until BF check resolved. ; ret /* * lcd_display_on_off( display, cursor, blink ) */ lcd_display_on_off: ret /* * lcd_cursor_display_shift( LCD_SHIFT_XXXX ) * Shifts the cursor position one step. * * input: R17 - Control * * LCD_SHIFT_CURSOR_LEFT * LCD_SHIFT_CURSOR_RIGHT * LCD_SHIFT_DISPLAY_LEFT * LCD_SHIFT_DISPLAY_RIGHT */ lcd_cursor_display_shift: ori R17, LC_CURSOR_DISPLAY_SHIFT call lcd_write_ins_nochk call lcd_delay_40us ldi R17, 1 call lcd_delay_1ms ; HACK until BF check resolved. ret /* * lcd_set_cgram_adrs( address ) * input: R17 - CGRAM addres */ lcd_set_cgram_adrs: ori R17, 0x40 call lcd_write_ins_nochk call lcd_delay_40us ldi R17, 1 call lcd_delay_1ms ; HACK until BF check resolved. ret /* * lcd_set_ddram_adrs( address ) */ lcd_set_ddram_adrs: ori R17, 0x80 call lcd_write_ins_nochk call lcd_delay_40us ldi R17, 1 call lcd_delay_1ms ; HACK until BF check resolved. ret /* * char lcd_get_busy_flag() * Non-blocking Busy Flag read. * output: R17 - b7: Busy Flag, b6:0 DDRAM/CGRAM address */ lcd_get_busy_flag: cbi PORTC, LCD_RS sbi PORTC, LCD_RW call lcd_raw_read push R17 call lcd_raw_read ; ldi R17, 1 call lcd_delay_1ms ; HACK until BF check resolved. ; cbi PORTC, LCD_RW pop R17 ret /* * lcd_write_data( data ) * input: R17 - Data * */ lcd_write_data: sbi PORTC, LCD_RS cbi PORTC, LCD_RW call lcd_raw_write swap R17 call lcd_raw_write ; call lcd_delay_40us call lcd_delay_40us ; ldi R17, 1 call lcd_delay_1ms ; HACK until BF check resolved. ; call lcd_get_busy_flag ; cbi PORTC, LCD_RS ret /* * char lcd_read_data() * output: R17 - Data * */ lcd_read_data: sbi PORTC, LCD_RS sbi PORTC, LCD_RW call lcd_raw_read push R17 call lcd_raw_read swap R17 andi R17, 0x0F pop R16 andi R16, 0xF0 or R17, R16 ; combine push R17 ; call lcd_delay_40us call lcd_delay_40us ; ldi R17, 1 call lcd_delay_1ms ; HACK until BF check resolved. ; call lcd_get_busy_flag ; pop R17 ret
16.475962
89
0.695798
ea8d8f5a2801197fa5cbaab08d1de4c1c751b3ae
1,894
asm
Assembly
C/LoDosLib/dosgetft.asm
p-k-p/SysToolsLib
827be2799e541410cb5c11358cd4ce6859e171ad
[ "Apache-2.0" ]
232
2016-04-27T21:56:11.000Z
2022-03-29T09:02:15.000Z
C/LoDosLib/dosgetft.asm
p-k-p/SysToolsLib
827be2799e541410cb5c11358cd4ce6859e171ad
[ "Apache-2.0" ]
31
2016-05-09T09:05:36.000Z
2022-03-29T19:17:45.000Z
C/LoDosLib/dosgetft.asm
p-k-p/SysToolsLib
827be2799e541410cb5c11358cd4ce6859e171ad
[ "Apache-2.0" ]
94
2016-06-01T18:10:39.000Z
2022-03-26T10:44:57.000Z
page ,132 ;*****************************************************************************; ; ; ; FILE NAME: dosgetft.asm ; ; ; ; DESCRIPTION: MS-DOS get file time function 5700H ; ; ; ; NOTES: ; ; ; ; HISTORY: ; ; 1998/05/24 JFL Created this file. ; ; ; ; (c) Copyright 1998-2017 Hewlett Packard Enterprise Development LP ; ; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ; ;*****************************************************************************; INCLUDE ADEFINE.INC INCLUDE DOS.INC ; For the DOS call macros .CODE ;-----------------------------------------------------------------------------; ; ; ; Function: _dos_getftime ; ; ; ; Description: MS-DOS get file time function 5700H ; ; ; ; Parameters: WORD hFile MS-DOS file handle ; ; WORD *pwDate Where to store the date ; ; WORD *pwTime Where to store the time ; ; ; ; Returns: AX MS-DOS error code. 0=Success. ; ; ; ; Notes: ; ; ; ; Regs altered: AX, BX, CX, DX. ; ; ; ; History: ; ; ; ; 1998/05/24 JFL Created this routine ; ; ; ;-----------------------------------------------------------------------------; _dos_getftime proc near public, \ hFile:WORD, pwDate:PTR WORD, pwTime:PTR WORD mov ax, 5700H mov bx, hFile int 21H jc @F mov bx, pwDate mov WORD ptr [bx], dx ; Modification date mov bx, pwTime mov WORD ptr [bx], cx ; Modification time xor ax, ax @@: ; Return in AX the MS-DOS error. 0 = Success. ret _dos_getftime endp END
30.063492
79
0.395987
0f351c90b31054fa9d00d1c4c1123b81ea61ef47
24,582
asm
Assembly
frogger.asm
VijayS02/FroggeASM
43a7ebe6f0c108bf1ba9ba7706d9cd2f2bbc6dcb
[ "MIT" ]
null
null
null
frogger.asm
VijayS02/FroggeASM
43a7ebe6f0c108bf1ba9ba7706d9cd2f2bbc6dcb
[ "MIT" ]
null
null
null
frogger.asm
VijayS02/FroggeASM
43a7ebe6f0c108bf1ba9ba7706d9cd2f2bbc6dcb
[ "MIT" ]
null
null
null
##################################################################### # # CSC258H5S Winter 2022 Assembly Final Project # University of Toronto, St. George # # Student: Name, Student Number # # Bitmap Display Configuration: # - Unit width in pixels: 4 # - Unit height in pixels: 4 # - Display width in pixels: 256 # - Display height in pixels: 256 # - Base Address for Display: 0x10008000 ($gp) # # Which milestone is reached in this submission? # (See the assignment handout for descriptions of the milestones) # - Milestone 1/2/3/4/5 (choose the one the applies) # # Which approved additional features have been implemented? # (See the assignment handout for the list of additional features) # 1. (fill in the feature, if any) # 2. (fill in the feature, if any) # 3. (fill in the feature, if any) # ... (add more if necessary) # # Any additional information that the TA needs to know: # - (write here, if any) # ##################################################################### # ERROR CODES # 10 - Screen size is not a multiple of 64 # 20 - Canvas Size not set # 30 - BlockSize not set # 100 - frog x position out of range # 110 - frog y position out of range # 200 - Non-Static is not set # 400 - frog blocksize not implemented ##################################################################### .data displayAddress: .word 0x10008000 unitSize: .word 4 screenSize: .word 256 canvasSize: .word 0 # A calculated value which stores how many pixels are on the screen blockDim: .word 8 # This determines how large the frog is, (blockSize x blockSize) blockSize: .word 0 non_static: .word 0 red: .word 0x00ff0000 green: .word 0x0000ff00 blue: .word 0x000000ff color: .word 0x000000ff goal_region_color: .word 0x000ff00 water_region_color: .word 0x000000ff safe_region_color: .word 0x00c2b280 road_region_color: .word 0x00333333 starting_region_color: .word 0x00aabb33 car_color: .word 0x00850101 log_color: .word 0x00ba8c63 drawing_acc: .word 0 frog_color: .word 0x0000cc00 frog_pos_x: .word 0 frog_pos_y: .word 0 game_state_a: .word 0 game_state_b: .word 1 game_state_c: .word 0 game_state_d: .word -1 car_draw_1: .word 0 car_draw_2: .word 0 log_draw_1: .word 0 log_draw_2: .word 0 coll_mode: .word 0 coll_code: .word 0 is_half: .word 0 frames: .word 0 lives: .word 3 .text # Function template -------------- # label: # addiu $sp, $sp, -4 # Allocate word on stack # sw $ra, 0($sp) # Set current stack element to $ra # ... code ... # lw $ra, 0($sp) # Load previous $ra value from stack # addiu $sp, $sp, 4 # unallocate stack word # jr $ra # Jump back jal init j program_loop ############################### Calculate frog start ############################### calculate_frog_start: lw $t0, blockSize addi $a0, $zero, 30 beqz $t0, exit_with_error # report error if blockSize is not set addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra la $t1, frog_pos_x la $t2, frog_pos_y sra $t3, $t0, 1 sw $t3, 0($t1) addi $t4, $t0, -1 sw $t4, 0($t2) lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Calculate canvas size ############################### calculate_canvas_size: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $t0, screenSize # Load screen size lw $t1, unitSize # Load unit size div $t0, $t1 # screenSize/unitSize la $t2, canvasSize # Load address of canvasSize into $t2 mflo $t3 # Read output of division into $t3 sw $t3, 0($t2) # Store $t3 into canvasSize addi $t5, $zero, 32 # Store int into $t5 - let us call this min_screenSize div $t3, $t5 # Divide $t3 by $t5 mfhi $t4 # Read the remainder of division addi $a0, $zero, 10 # Set error code to 10 bgtz $t4, exit_with_error # If $t3 is not a multiple of min_screenSize, exit with an error. (This checks that the screen is at least min_screenSize X min_screenSize) lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Calculate block size ############################### calculate_block_size: lw $t0, canvasSize addi $a0, $zero, 20 beqz $t0, exit_with_error # report error if canvasSize is not set addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $t1, blockDim div $t0, $t1 mflo $t2 la $t3 blockSize sw $t2, 0($t3) lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Draw rectangle ############################### draw_rect: # Function to draw rectangle, $a0 - width, $a1 - height, $a2 - x, $a3 - y # This function prevents drawing outside and does not let the drawing loop around. addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra addi $s7, $zero, 4 lw $s0, displayAddress # Load display address lw $s1, canvasSize lw $s3, color mult $s1, $s7 # Calculate canvasSize * 4 mflo $s2 mult $a0, $s7 # Calculate a0*4 mflo $t2 mult $s2, $a1 # Calculate a1*canvasSize*4 mflo $t4 sub $s4, $s1, $a0 sub $s5, $s1, $a1 add $t3, $t2, $t4 # Calculate a2 + a3 position in pixels into cur_pos addi $t0, $zero, 0 # y_val = 0 rect_y_loop: beq $t0, $a3, rect_y_end # loop y_val -> a1 addi $t1, $zero, 0 # x_val = 0 bge $t0, $s5, rect_x_end # if x_pos > (height - a1) rect_x_loop: beq $t1, $a2, rect_x_end # loop x_val -> a0 bge $t1, $s4, rect_x_end # if x_pos > (width - a0) add $t5, $s0, $t3 sw $s3, 0($t5) rect_skip_draw: addi $t3, $t3, 4 # cur_pos += 4 addi $t1, $t1, 1 # x_val += 1 j rect_x_loop rect_x_end: mult $t1, $s7 mflo $t4 add $t3, $t3, $s2 # cur_pos += canvasSize * 4 sub $t3, $t3, $t4 # cur_pos -= x_val * 4 addi $t0, $t0, 1 # y_val += 1 j rect_y_loop rect_y_end: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # go back to calling program ############################### Draw Background ############################### draw_background: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $s0, blockSize sub $t0, $s0, 4 #t0 = blocksize - 4 addi $t2, $zero, 2 # t2 = 2 div $t0, $t2 # (blocksize - 4)/2 la $t6, non_static mflo $s1 # Size of non-static portions of level sw $s1, 0($t6) la $t2, color lw $t0, starting_region_color sw $t0, 0($t2) # set color = starting_region_color lw $t0, blockDim # load blockdim into t0 lw $t1, canvasSize addi $a0, $zero, 0 addi $a1, $zero, 0 add $a2, $zero, $t1 add $a3, $zero, $t0 la $t5, drawing_acc sw $t0, 0($t5) jal draw_rect # rect(0,0,canvasSize, blockSize) lw $t0, blockDim lw $t1, canvasSize la $t2, color lw $t5, water_region_color sw $t5, 0($t2) # set color = water_region_color lw $t3, drawing_acc lw $s1, non_static mult $t0, $s1 mflo $t4 addi $a0, $zero, 0 add $a1, $zero, $t3 add $a2, $zero, $t1 add $a3, $zero, $t4 la $t5, drawing_acc add $t4, $t4, $t3 sw $t4, 0($t5) jal draw_rect # rect(0,blockSize + 1,canvasSize, s1) lw $t0, blockDim lw $t1, canvasSize la $t2, color lw $t5, safe_region_color sw $t5, 0($t2) # set color = safe_region_color lw $t3, drawing_acc lw $s1, non_static addi $a0, $zero, 0 add $a1, $zero, $t3 add $a2, $zero, $t1 add $a3, $zero, $t0 la $t5, drawing_acc add $t0, $t0, $t3 sw $t0, 0($t5) jal draw_rect # rect(0,blockSize + 1,canvasSize, s1) lw $t0, blockDim lw $t1, canvasSize la $t2, color lw $t5, road_region_color sw $t5, 0($t2) # set color = water_region_color lw $t3, drawing_acc lw $s1, non_static mult $t0, $s1 mflo $t4 addi $a0, $zero, 0 add $a1, $zero, $t3 add $a2, $zero, $t1 add $a3, $zero, $t4 la $t5, drawing_acc add $t4, $t4, $t3 sw $t4, 0($t5) jal draw_rect # rect(0,blockSize + 1,canvasSize, s1) lw $t0, blockDim lw $t1, canvasSize la $t2, color lw $t5, starting_region_color sw $t5, 0($t2) # set color = safe_region_color lw $t3, drawing_acc lw $s1, non_static add $t0, $t0, $t0 addi $a0, $zero, 0 add $a1, $zero, $t3 add $a2, $zero, $t1 add $a3, $zero, $t0 la $t5, drawing_acc add $t0, $t0, $t3 sw $t0, 0($t5) jal draw_rect # rect(0,blockSize + 1,canvasSize, s1) lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # go back to calling program ############################### Block pos to XYpixel ############################### block_to_xy: #a0 -> block_x, a1->block_y addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $s0, blockDim lw $s1, canvasSize addi $s6, $zero, 4 mult $a1, $s0 # a1 * blockSize = y_pixel_position mflo $v1 # v1 = mult $a0, $s0 # a0 * blockSize = x_pixel_position mflo $v0 # v0 = lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # go back to calling program ############################### Block Pos to addrOffset ############################### block_to_pixel: # a0 - > block_x, a1-> block_y addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $s0, blockDim lw $s1, canvasSize addi $s6, $zero, 4 mult $a1, $s0 # a1 * blockSize = pixel_position mflo $t0 # t0 = mult $a0, $s0 # a0 * blockSize = pixel_position mflo $t1 mult $t0, $s1 #a1 * blockSize * canvasSize mflo $t0 add $v0, $t0, $t1 #v0 = a1*blockSize*canvasSize + a0*blockSize mult $v0, $s6 #v0 = v0*4 mflo $v0 lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # go back to calling program ############################### Draw Frog ############################### draw_frog: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $s0, frog_pos_x lw $s1, frog_pos_y lw $s2, blockSize lw $s3, blockDim addi $t0, $zero, 100 bge $s0, $s2, exit_with_error # frog x position out of range addi $t0, $zero, 110 bge $s1, $s2, exit_with_error # frog y position out of range add $a0, $zero, $s0 add $a1, $zero, $s1 jal block_to_pixel addi $t0, $zero, 4 addi $t1, $zero, 8 lw $s4, displayAddress lw $s6, canvasSize lw $s5, frog_color add $t3, $zero, $v0 add $t3, $s4, $t3 mult $s6, $t0 mflo $t4 bgt $s3, $t0, frog_block_ge_four sw $s5, 0($t3) sw $s5, 12($t3) add $t3, $t3, $t4 sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 8($t3) sw $s5, 12($t3) add $t3, $t3, $t4 sw $s5, 4($t3) sw $s5, 8($t3) add $t3, $t3, $t4 sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 8($t3) sw $s5, 12($t3) j frog_finish frog_block_ge_four: bgt $s3, $t1, frog_block_ge_eight sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 24($t3) sw $s5, 28($t3) add $t3, $t3, $t4 sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 24($t3) sw $s5, 28($t3) add $t3, $t3, $t4 sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 8($t3) sw $s5, 12($t3) sw $s5, 16($t3) sw $s5, 20($t3) sw $s5, 24($t3) sw $s5, 28($t3) add $t3, $t3, $t4 sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 8($t3) sw $s5, 12($t3) sw $s5, 16($t3) sw $s5, 20($t3) sw $s5, 24($t3) sw $s5, 28($t3) add $t3, $t3, $t4 sw $s5, 8($t3) sw $s5, 12($t3) sw $s5, 16($t3) sw $s5, 20($t3) add $t3, $t3, $t4 sw $s5, 8($t3) sw $s5, 12($t3) sw $s5, 16($t3) sw $s5, 20($t3) add $t3, $t3, $t4 sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 8($t3) sw $s5, 12($t3) sw $s5, 16($t3) sw $s5, 20($t3) sw $s5, 24($t3) sw $s5, 28($t3) add $t3, $t3, $t4 sw $s5, 0($t3) sw $s5, 4($t3) sw $s5, 8($t3) sw $s5, 12($t3) sw $s5, 16($t3) sw $s5, 20($t3) sw $s5, 24($t3) sw $s5, 28($t3) # addi $a0, $zero, 400 # j exit_with_error j frog_finish frog_block_ge_eight: addi $a0, $zero, 120 j exit_with_error frog_finish: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # go back to calling program ############################### Check Keyboard Input ############################### get_keyboard_input: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra addi $v0, $zero, 0 lw $t8, 0xffff0000 beq $t8, 1, keyboard_input j end_keyboard_input keyboard_input: lw $s0, frog_pos_x lw $s1, frog_pos_y lw $t2, 0xffff0004 beq $t2, 0x77, keyboard_w beq $t2, 0x61, keyboard_a beq $t2, 0x73, keyboard_s beq $t2, 0x64, keyboard_d j end_keyboard_input ######## A keyboard_a: beqz $s0, kb_skip_a la $s2, frog_pos_x addi $s0, $s0, -1 sw $s0, 0($s2) addi $v0, $zero, 1 kb_skip_a: j end_keyboard_input ######## W keyboard_w: beqz $s1, kb_skip_w la $s3, frog_pos_y addi $s1, $s1, -1 sw $s1, 0($s3) addi $v0, $zero, 1 kb_skip_w: j end_keyboard_input ######## S keyboard_s: lw $t3, blockSize addi $t3, $t3, -1 bge $s1, $t3, kb_skip_s la $s3, frog_pos_y addi $s1, $s1, 1 sw $s1, 0($s3) addi $v0, $zero, 1 kb_skip_s: j end_keyboard_input ######## D keyboard_d: lw $t3, blockSize addi $t3, $t3, -1 bge $s0, $t3, kb_skip_s la $s2, frog_pos_x addi $s0, $s0, 1 sw $s0, 0($s2) addi $v0, $zero, 1 kb_skip_d: j end_keyboard_input end_keyboard_input: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra ############################### Delay ############################### kill_frog: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra la $t0, lives lw $t1, lives addi $t1, $t1, -1 beqz $t1, exit sw $t1, 0($t0) lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra ############################### Delay ############################### delay: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra li $v0, 32 li $a0, 16 syscall lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra ############################### inc_wrap ############################### inc_wrap: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra addi $v0, $a0, 1 addi $t1, $zero, 2 beq $v0, $t1, inc_reset j inc_skip_reset inc_reset: addi $v0, $zero, -1 inc_skip_reset: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra ############################### dec_wrap ############################### dec_wrap: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra addi $v0, $a0, -1 addi $t1, $zero, -2 beq $v0, $t1, dec_reset j dec_skip_reset dec_reset: addi $v0, $zero, 1 dec_skip_reset: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra ############################### Update Game State ############################### update_game_state: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra la $t2, game_state_a lw $a0, game_state_a jal inc_wrap sw $v0, 0($t2) la $t2, game_state_b lw $a0, game_state_b jal dec_wrap sw $v0, 0($t2) la $t2, game_state_c lw $a0, game_state_c jal inc_wrap sw $v0, 0($t2) la $t2, game_state_d lw $a0, game_state_d jal dec_wrap sw $v0, 0($t2) lw $a1, coll_mode lw $a0, coll_code lw $s0, frog_pos_x beq $a1, 1, move_frog j dont_move_frog move_frog: beq $a0, 4, update_frog_left lw $t3, blockSize blez $s0, frog_skip_right la $s2, frog_pos_x addi $s0, $s0, -1 sw $s0, 0($s2) frog_skip_right: j dont_move_frog update_frog_left: lw $t3, blockSize addi $t3, $t3, -1 bge $s0, $t3, frog_skip_left la $s2, frog_pos_x addi $s0, $s0, 1 sw $s0, 0($s2) frog_skip_left: dont_move_frog: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra ############################### Check Map pos ############################### #map -1: 1, 0:0, 1:2 check_get_map: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra beq $a0, -1, map_minus beq $a0, 1, map_one addi $v0, $zero, 0 j map_end map_minus: addi $v0, $zero, 1 j map_end map_one: addi $v0, $zero, 2 j map_end map_end: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### UpdateFrog ############################### update_frog: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra # a0 -> code from check_collision (0- nothing, 1 - car, 2- car, 3- log L, 4- log right) # a1 -> s7 from check_collision lw $a0, coll_code lw $a1, coll_mode bgtz $a1, log_move beqz $a0, end_update_frog reset_frog: addi $a0, $a1, 0 li $v0, 1 syscall jal calculate_frog_start jal kill_frog j end_update_frog log_move: lw $s0, frog_pos_x lw $s1, frog_pos_y beqz $a0, reset_frog end_update_frog: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Check collision ############################### check_collision: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $s0, frog_pos_x lw $s1, frog_pos_y lw $s2, non_static addi $t2, $s2, 2 addi $v0, $zero, 0 addi $s7, $zero, 0 bge $s1, $t2, check_road_area bge $s1, 1, check_water_area j end_check check_road_area: add $t2, $t2, $s2 bge $s1, $t2, end_check addi $t2, $s2, 2 sub $t0, $s1, $t2 addi $t1, $zero, 2 div $t0, $t1 mfhi $t0 beqz $t0, check_state_a j check_state_b j end_check check_water_area: bgt $s1, $s2, end_check addi $s7, $zero, 1 addi $t0, $s1, -1 addi $t1, $zero, 2 div $t0, $t1 mfhi $t0 addi $s0, $s0, 2 beqz $t0, check_state_c j check_state_d j end_check check_state_a: lw $a0, game_state_a addi $v1, $zero, 1 j end_check_col check_state_b: lw $a0, game_state_b addi $v1, $zero, 2 j end_check_col check_state_c: lw $a0, game_state_c addi $v1, $zero, 3 j end_check_col check_state_d: lw $a0, game_state_d addi $v1, $zero, 4 j end_check_col no_collision: addi $v0, $zero, 0 j end_check end_check_col: jal check_get_map addi $t3, $zero, 3 div $s0, $t3 mfhi $t2 beq $t2, $v0, no_collision addi $v0, $v1, 0 end_check: la $t0, coll_code la $t1, coll_mode sw $v0, 0($t0) sw $s7, 0($t1) lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Init ############################### init: addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra jal calculate_canvas_size # Calcuate canvas size and set the canvasSize label jal calculate_block_size jal calculate_frog_start lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Draw Log ############################### draw_log: #a0 = blockX, $a1= blockY addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra bltz $a0, log_half la $t0, is_half sw $zero, 0($t0) j end_log_half log_half: addi $t1, $zero, 1 la $t0, is_half sw $t1, 0($t0) end_log_half: jal block_to_xy lw $t0, is_half beqz $t0, log_draw_reg log_draw_half: lw $s2, blockDim add $s0, $s2, $v0 # x position add $s1, $zero, $v1 # y position addi $a3, $s2, -2 # height = blocksize - 2 # addi $a3, $s2, 0 add $a2, $s2,$zero # width = blocksize addi $a2, $a2, -1 # width -= 2 addi $a0, $s0, 0 addi $a1, $s1, 1 j log_draw_main log_draw_reg: add $s0, $zero, $v0 # x position add $s1, $zero, $v1 # y position lw $s2, blockDim addi $a3, $s2, -2 # height = blocksize - 2 # addi $a3, $s2, 0 add $a2, $s2,$s2 # width = blocksize * 2 addi $a2, $a2, -2 # width -= 2 addi $a0, $s0, 1 addi $a1, $s1, 1 log_draw_main: la $t2, color lw $t5, log_color sw $t5, 0($t2) # set color = water_region_color jal draw_rect lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # go back to calling program ############################### Draw All Logs ############################### draw_all_logs: lw $s0, non_static addi $a0, $zero, 200 beqz $s0, exit_with_error # report error if canvasSize is not set addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $t8, game_state_c lw $t9, game_state_d addi $a1, $zero, 1 # y_block = 1 draw_all_logs_outer_loop: lw $s0, non_static addi $s0, $s0, 1 bge $a1, $s0, draw_all_logs_end_loop # loop until y_pos > 2*non_static for each row addi $t4, $zero, 2 div $a1, $t4 mfhi $t4 beqz $t4, draw_all_l_state_a add $a0, $zero, $t9 j draw_all_l_inner_loop draw_all_l_state_a: add $a0, $zero, $t8 j draw_all_l_inner_loop draw_all_l_inner_loop: lw $s0, blockSize bge $a0, $s0, draw_all_logs_end_iloop # Loop until end of screen la $s5, log_draw_1 la $s6, log_draw_2 sw $a0, 0($s5) sw $a1, 0($s6) jal draw_log lw $a0, log_draw_1 lw $a1, log_draw_2 addi $a0, $a0, 3 j draw_all_l_inner_loop draw_all_logs_end_iloop: addi $a1, $a1, 1 j draw_all_logs_outer_loop draw_all_logs_end_loop: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Draw Car ############################### draw_car: #a0 = blockX, $a1= blockY addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra bltz $a0, car_half la $t0, is_half sw $zero, 0($t0) j end_car_half car_half: addi $t1, $zero, 1 la $t0, is_half sw $t1, 0($t0) end_car_half: jal block_to_xy lw $t0, is_half beqz $t0, car_draw_reg carog_draw_half: lw $s2, blockDim add $s0, $s2, $v0 # x position add $s1, $zero, $v1 # y position addi $a3, $s2, -2 # height = blocksize - 2 # addi $a3, $s2, 0 add $a2, $s2,$zero # width = blocksize addi $a2, $a2, -1 # width -= 2 addi $a0, $s0, 0 addi $a1, $s1, 1 j car_draw_main car_draw_reg: add $s0, $zero, $v0 # x position add $s1, $zero, $v1 # y position lw $s2, blockDim addi $a3, $s2, -2 # height = blocksize - 2 # addi $a3, $s2, 0 add $a2, $s2,$s2 # width = blocksize * 2 addi $a2, $a2, -2 # width -= 2 addi $a0, $s0, 1 addi $a1, $s1, 1 car_draw_main: la $t2, color lw $t5, car_color sw $t5, 0($t2) # set color = water_region_color jal draw_rect lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # go back to calling program ############################### Draw All Cars ############################### draw_all_cars: lw $s0, non_static addi $a0, $zero, 200 beqz $s0, exit_with_error # report error if canvasSize is not set addiu $sp, $sp, -4 # Allocate word on stack sw $ra, 0($sp) # Set current stack element to $ra lw $t8, game_state_a lw $t9, game_state_b addi $a1, $s0, 2 # y_block = non_static + 1 draw_all_cars_outer_loop: lw $s0, non_static sll $s0, $s0, 1 addi $s0,$s0, 2 bge $a1, $s0, draw_all_cars_end_loop # loop until y_pos > 2*non_static for each row addi $t4, $zero, 2 div $a1, $t4 mfhi $t4 beqz $t4, draw_all_state_a add $a0, $zero, $t9 j draw_all_inner_loop draw_all_state_a: add $a0, $zero, $t8 j draw_all_inner_loop draw_all_inner_loop: lw $s0, blockSize bge $a0, $s0, draw_all_cars_end_iloop # Loop until end of screen la $s5, car_draw_1 la $s6, car_draw_2 sw $a0, 0($s5) sw $a1, 0($s6) jal draw_car lw $a0, car_draw_1 lw $a1, car_draw_2 addi $a0, $a0, 3 j draw_all_inner_loop draw_all_cars_end_iloop: addi $a1, $a1, 1 j draw_all_cars_outer_loop draw_all_cars_end_loop: lw $ra, 0($sp) # Load previous $ra value from stack addiu $sp, $sp, 4 # unallocate stack word jr $ra # Go back to calling program ############################### Program loop ############################### program_loop: jal get_keyboard_input bgtz $v0, update la $t0, frames lw $t1, frames addi $t1, $t1, 1 sw $t1, 0($t0) beq $t1, 59, advance_state bgt $t1, 60, update j end_update update: la $t0, frames lw $t1, frames addi $t1, $t1, 1 sw $t1, 0($t0) jal check_collision jal update_frog jal check_collision jal draw_background jal draw_frog jal draw_all_cars jal draw_all_logs jal get_keyboard_input lw $t0, frames bge $t0, 59, reset_state j end_state advance_state: jal update_game_state jal update_frog j end_state reset_state: la $t0, frames sw $zero, 0($t0) end_reset_state: end_update: end_state: jal delay j program_loop exit_with_error: li $v0, 1 syscall j exit exit: li $v0, 10 syscall
20.083333
166
0.619559
74276adbaaef6bbcde490476d073c15f061869c0
1,322
asm
Assembly
third_party/libvpx/source/config/linux/ia32/vpx_config.asm
roisagiv/webrtc-ndk
b22a896d995a5601dade8a26ad20f6eb166bae80
[ "BSD-3-Clause" ]
1
2019-12-31T10:36:13.000Z
2019-12-31T10:36:13.000Z
third_party_mods/libvpx/source/config/mac/ia32/vpx_config.asm
stoiczek/WebRTC
6d8190b8c89b3bee9c5ee9eabbd9d67169449f8c
[ "BSD-3-Clause" ]
null
null
null
third_party_mods/libvpx/source/config/mac/ia32/vpx_config.asm
stoiczek/WebRTC
6d8190b8c89b3bee9c5ee9eabbd9d67169449f8c
[ "BSD-3-Clause" ]
5
2015-10-30T17:35:19.000Z
2021-06-04T01:39:27.000Z
ARCH_ARM equ 0 ARCH_MIPS equ 0 ARCH_X86 equ 1 ARCH_X86_64 equ 0 ARCH_PPC32 equ 0 ARCH_PPC64 equ 0 HAVE_ARMV5TE equ 0 HAVE_ARMV6 equ 0 HAVE_ARMV7 equ 0 HAVE_IWMMXT equ 0 HAVE_IWMMXT2 equ 0 HAVE_MIPS32 equ 0 HAVE_MMX equ 1 HAVE_SSE equ 1 HAVE_SSE2 equ 1 HAVE_SSE3 equ 1 HAVE_SSSE3 equ 1 HAVE_SSE4_1 equ 1 HAVE_ALTIVEC equ 0 HAVE_VPX_PORTS equ 1 HAVE_STDINT_H equ 1 HAVE_ALT_TREE_LAYOUT equ 0 HAVE_PTHREAD_H equ 1 HAVE_SYS_MMAN_H equ 1 CONFIG_EXTERNAL_BUILD equ 0 CONFIG_INSTALL_DOCS equ 0 CONFIG_INSTALL_BINS equ 1 CONFIG_INSTALL_LIBS equ 1 CONFIG_INSTALL_SRCS equ 0 CONFIG_DEBUG equ 0 CONFIG_GPROF equ 0 CONFIG_GCOV equ 0 CONFIG_RVCT equ 0 CONFIG_GCC equ 1 CONFIG_MSVS equ 0 CONFIG_PIC equ 1 CONFIG_BIG_ENDIAN equ 0 CONFIG_CODEC_SRCS equ 0 CONFIG_DEBUG_LIBS equ 0 CONFIG_FAST_UNALIGNED equ 1 CONFIG_MEM_MANAGER equ 0 CONFIG_MEM_TRACKER equ 0 CONFIG_MEM_CHECKS equ 0 CONFIG_MD5 equ 1 CONFIG_DEQUANT_TOKENS equ 0 CONFIG_DC_RECON equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_POSTPROC equ 1 CONFIG_MULTITHREAD equ 1 CONFIG_PSNR equ 0 CONFIG_VP8_ENCODER equ 1 CONFIG_VP8_DECODER equ 1 CONFIG_VP8 equ 1 CONFIG_ENCODERS equ 1 CONFIG_DECODERS equ 1 CONFIG_STATIC_MSVCRT equ 0 CONFIG_SPATIAL_RESAMPLING equ 1 CONFIG_REALTIME_ONLY equ 0 CONFIG_SHARED equ 0 CONFIG_SMALL equ 0 CONFIG_POSTPROC_VISUALIZER equ 0 CONFIG_OS_SUPPORT equ 1
20.984127
32
0.859304
773c40e0803ada725ae7fd77896a98392e14d76b
2,196
asm
Assembly
nasm assembly/library/longest rep sub seq.asm
AI-Factor-y/NASM-library
5141901352a47b73e716e27d628bb719f1891092
[ "Apache-2.0" ]
null
null
null
nasm assembly/library/longest rep sub seq.asm
AI-Factor-y/NASM-library
5141901352a47b73e716e27d628bb719f1891092
[ "Apache-2.0" ]
null
null
null
nasm assembly/library/longest rep sub seq.asm
AI-Factor-y/NASM-library
5141901352a47b73e716e27d628bb719f1891092
[ "Apache-2.0" ]
null
null
null
long_rep_sseq: ;; longest repeating subsequence ;; string base address in ebx ;; result in long_rep_len ;; string length in string_len section .bss dp: resd 10000 row_size: resd 1 col_size: resd 1 sseq_i: resd 1 sseq_j: resd 1 long_rep_len: resd 1 section .text push rax push rbx push rcx push rdx mov eax, [string_len] inc eax mov [row_size], eax mov [col_size], eax push rbx mov ebx, dp call set_mat_to_zero pop rbx mov dword[sseq_i],1 sseq_loop_1: mov ax, word[sseq_i] cmp ax, word[string_len] ja exit_sseq_loop_1 mov dword[sseq_j],1 sseq_loop_2: ; push rbx ; mov ebx, dp ; call print_matrix ; pop rbx mov ax, word[sseq_j] cmp ax, word[string_len] ja exit_sseq_loop_2 mov eax, [sseq_i] dec eax mov cl, byte[ebx+eax] mov eax, [sseq_j] dec eax mov dl, byte[ebx+eax] cmp cl, dl jne sseq_else mov eax, [sseq_i] mov ecx, [sseq_j] cmp eax, ecx je sseq_else ; if case push rbx mov ebx, dp mov eax, [sseq_i] dec eax mov ecx, [sseq_j] dec ecx call get_elem mov word[num],cx inc cx mov dx,cx mov eax, [sseq_i] mov ecx, [sseq_j] call put_elem pop rbx jmp exit_sseq_if_else sseq_else: ; else case push rbx mov ebx, dp mov eax, [sseq_i] mov ecx, [sseq_j] dec ecx call get_elem mov word[find_max_1],cx mov eax, [sseq_i] dec eax mov ecx, [sseq_j] call get_elem mov word[find_max_2],cx call find_max mov dx , word[find_max_max] mov eax, [sseq_i] mov ecx, [sseq_j] call put_elem pop rbx exit_sseq_if_else: inc dword[sseq_j] jmp sseq_loop_2 exit_sseq_loop_2: inc dword[sseq_i] jmp sseq_loop_1 exit_sseq_loop_1: push rbx mov ebx, dp mov eax, [string_len] mov ecx, [string_len] call get_elem mov word[long_rep_len], cx pop rbx pop rdx pop rcx pop rbx pop rax ret
13.149701
33
0.56694
7e83969ea8522234b0300db4b987ceabb3412777
242
asm
Assembly
examples/dm-exec/ex14.asm
jthornber/deconstructed-volume-manager
d68eac4d2b5aa97050c19dd24b8acd939c164789
[ "BSD-3-Clause" ]
null
null
null
examples/dm-exec/ex14.asm
jthornber/deconstructed-volume-manager
d68eac4d2b5aa97050c19dd24b8acd939c164789
[ "BSD-3-Clause" ]
null
null
null
examples/dm-exec/ex14.asm
jthornber/deconstructed-volume-manager
d68eac4d2b5aa97050c19dd24b8acd939c164789
[ "BSD-3-Clause" ]
null
null
null
device foo = {name = "foo"} table t1 = [ linear 1024 "/dev/loop/0 0", linear 4096 "/dev/loop/1 1024" ] .start create foo jmp-fail .label0 load foo t1 jmp-fail .label2 jmp .label3 .label2 remove foo .label3 jmp .label0 .label0
10.083333
31
0.652893
81e95820cd9adcd4c9c7dbc650e882555d1766e7
359
asm
Assembly
oeis/134/A134346.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/134/A134346.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/134/A134346.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A134346: Triangle read by rows: A124929 * A007318. ; Submitted by Jon Maiga ; 1,3,3,7,14,7,15,45,45,15,31,124,186,124,31,63,315,630,630,315,63,127,762,1905,2540,1905,762,127,255,1785,5355,8925,8925,5355,1785,255,511,4088,14308,28616,35770,28616,14308,4088,511 lpb $0 add $1,1 sub $0,$1 mul $2,2 add $2,2 lpe bin $1,$0 mul $2,$1 add $2,$1 mov $0,$2
23.933333
183
0.674095